| | |
| | | import com.nq.enums.EConfigKey; |
| | | import com.nq.pojo.StockConfig; |
| | | import com.nq.service.IStockConfigServices; |
| | | import org.apache.commons.lang3.math.NumberUtils; |
| | | import org.apache.http.util.TextUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | StockConfigMapper stockConfigMapper; |
| | | @Override |
| | | public ServerResponse updateStockConfig(StockConfig stockConfig) { |
| | | if(stockConfig.getCKey().equals(EConfigKey.AGENT_MAX_GRADE.getCode()) && !NumberUtils.isCreatable(stockConfig.getCValue())){ |
| | | if(stockConfig.getCKey().equals(EConfigKey.AGENT_MAX_GRADE.getCode())){ |
| | | try { |
| | | int number = Integer.parseInt(stockConfig.getCValue()); |
| | | if(number <= 0){ |
| | | ServerResponse.createByErrorMsg("请输入有效等级"); |
| | | return ServerResponse.createByErrorMsg("请输入有效等级"); |
| | | } |
| | | } catch (NumberFormatException e) { |
| | | ServerResponse.createByErrorMsg("请输入有效等级"); |
| | | return ServerResponse.createByErrorMsg("请输入有效等级"); |
| | | } |
| | | } |
| | | int ref = stockConfigMapper.updateById(stockConfig); |
| | | if(ref>0){ |
| | | return ServerResponse.createBySuccess(); |
| | | return ServerResponse.createBySuccessMsg("设置成功"); |
| | | } |
| | | return ServerResponse.createByErrorMsg("设置失败"); |
| | | } |