|
@@ -183,8 +183,35 @@ public class AdminAgentToothHandler {
|
|
|
msg.setStatus(false);
|
|
|
msg.setMessage("您没有选择代理商,请选择!");
|
|
|
}
|
|
|
+
|
|
|
//拆分产品id和金额
|
|
|
String[] productPrice = productColor.split(",");
|
|
|
+
|
|
|
+ //根据代理商id查询所有优惠价配置信息
|
|
|
+ AgentConfig agentConfig = new AgentConfig();
|
|
|
+ agentConfig.setAgentId(Integer.parseInt(agentId));
|
|
|
+ agentConfig.setConfigStatus(1);
|
|
|
+ List<AgentConfig> configList = agentInfoService.listAgentConfig(agentConfig);
|
|
|
+
|
|
|
+ //校验是否已经存在该代理商的优惠价
|
|
|
+ for (int i = 0;i < productPrice.length;i++) {
|
|
|
+ String[] color = productPrice[i].split(":");
|
|
|
+ int color1 = Integer.parseInt(color[0]);
|
|
|
+ for(AgentConfig agentConfig2 : configList) {
|
|
|
+ if (color1 == agentConfig2.getColorId()) {
|
|
|
+ StringBuilder message = new StringBuilder("产品为");
|
|
|
+ message.append(agentConfig2.getProductName());
|
|
|
+ message.append("颜色为");
|
|
|
+ message.append(agentConfig2.getColorName());
|
|
|
+ message.append("的产品已经配置了优惠价,无法重复配置!");
|
|
|
+ msg.setResultCode(ResultInfo.ERRORCODE);
|
|
|
+ msg.setStatus(false);
|
|
|
+ msg.setMessage(message.toString());
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
List<AgentConfig> list = new ArrayList<AgentConfig>();
|
|
|
for (int i = 0;i < productPrice.length;i++) {
|
|
|
String[] color = productPrice[i].split(":");
|
|
@@ -278,6 +305,18 @@ public class AdminAgentToothHandler {
|
|
|
msg.setStatus(false);
|
|
|
msg.setMessage("修改代理商优惠价配置失败!");
|
|
|
}
|
|
|
+ AgentConfig config2 = new AgentConfig();
|
|
|
+ config2.setConfigStatus(1);
|
|
|
+ config2.setAgentId(config.getAgentId());
|
|
|
+ config2.setColorId(config.getColorId());
|
|
|
+ //根据代理商id和产品颜色id查询配置信息
|
|
|
+ config2 = agentInfoService.getAgentConfig(config);
|
|
|
+ if (config2 != null && config2.getConfigId().intValue() != config.getConfigId()) {
|
|
|
+ msg.setResultCode(ResultInfo.ERRORCODE);
|
|
|
+ msg.setStatus(false);
|
|
|
+ msg.setMessage("该代理商已配置过该产品的优惠价,不能重复配置!");
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
//修改代理商优惠价配置信息
|
|
|
int num = agentInfoService.updateAgentConfig(config);
|
|
|
if (num > 0) {
|
|
@@ -313,7 +352,23 @@ public class AdminAgentToothHandler {
|
|
|
msg.setStatus(false);
|
|
|
return msg;
|
|
|
}
|
|
|
+
|
|
|
config.setConfigId(Integer.parseInt(configId));
|
|
|
+ //根据id查询配置信息
|
|
|
+ AgentConfig agentConfig = agentInfoService.getAgentConfig(config);
|
|
|
+
|
|
|
+ AgentConfig config2 = new AgentConfig();
|
|
|
+ config2.setConfigStatus(1);
|
|
|
+ config2.setAgentId(agentConfig.getAgentId());
|
|
|
+ config2.setColorId(agentConfig.getColorId());
|
|
|
+ //根据代理商id和产品颜色id查询配置信息
|
|
|
+ config2 = agentInfoService.getAgentConfig(config);
|
|
|
+ if (config2 != null) {
|
|
|
+ msg.setResultCode(ResultInfo.ERRORCODE);
|
|
|
+ msg.setStatus(false);
|
|
|
+ msg.setMessage("该代理商已配置过该产品的优惠价,不能重复配置!");
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
config.setConfigStatus(Integer.parseInt(configStatus));
|
|
|
//修改代理商优惠价配置信息
|
|
|
int num = agentInfoService.updateAgentConfig(config);
|