|
@@ -187,8 +187,35 @@ public class AdminAgentToothHandler {
|
|
|
msg.setStatus(false);
|
|
|
msg.setMessage("您没有选择代理商,请选择!");
|
|
|
}
|
|
|
+
|
|
|
|
|
|
String[] productPrice = productColor.split(",");
|
|
|
+
|
|
|
+
|
|
|
+ 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(":");
|
|
@@ -282,6 +309,18 @@ public class AdminAgentToothHandler {
|
|
|
msg.setStatus(false);
|
|
|
msg.setMessage("修改代理商优惠价配置失败!");
|
|
|
}
|
|
|
+ AgentConfig config2 = new AgentConfig();
|
|
|
+ config2.setConfigStatus(1);
|
|
|
+ config2.setAgentId(config.getAgentId());
|
|
|
+ config2.setColorId(config.getColorId());
|
|
|
+
|
|
|
+ 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) {
|
|
@@ -317,7 +356,23 @@ public class AdminAgentToothHandler {
|
|
|
msg.setStatus(false);
|
|
|
return msg;
|
|
|
}
|
|
|
+
|
|
|
config.setConfigId(Integer.parseInt(configId));
|
|
|
+
|
|
|
+ AgentConfig agentConfig = agentInfoService.getAgentConfig(config);
|
|
|
+
|
|
|
+ AgentConfig config2 = new AgentConfig();
|
|
|
+ config2.setConfigStatus(1);
|
|
|
+ config2.setAgentId(agentConfig.getAgentId());
|
|
|
+ config2.setColorId(agentConfig.getColorId());
|
|
|
+
|
|
|
+ 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);
|