|
@@ -1,27 +1,44 @@
|
|
package com.iamberry.wechat.handles.admin;
|
|
package com.iamberry.wechat.handles.admin;
|
|
|
|
|
|
|
|
+import com.iamberry.app.tool.log.RatFWLogger;
|
|
import com.iamberry.wechat.core.entity.PageBean;
|
|
import com.iamberry.wechat.core.entity.PageBean;
|
|
import com.iamberry.wechat.core.entity.ResultMsg;
|
|
import com.iamberry.wechat.core.entity.ResultMsg;
|
|
import com.iamberry.wechat.core.entity.agentInfo.AgentConfig;
|
|
import com.iamberry.wechat.core.entity.agentInfo.AgentConfig;
|
|
|
|
+import com.iamberry.wechat.core.entity.agentInfo.AgentOrder;
|
|
import com.iamberry.wechat.core.entity.agentInfo.AgentTooth;
|
|
import com.iamberry.wechat.core.entity.agentInfo.AgentTooth;
|
|
|
|
+import com.iamberry.wechat.core.entity.drp.PlaceRoleInfo;
|
|
|
|
+import com.iamberry.wechat.core.entity.member.Member;
|
|
|
|
+import com.iamberry.wechat.core.entity.order.Order;
|
|
import com.iamberry.wechat.core.entity.product.ProductColor;
|
|
import com.iamberry.wechat.core.entity.product.ProductColor;
|
|
import com.iamberry.wechat.face.agentInfo.AgentInfoService;
|
|
import com.iamberry.wechat.face.agentInfo.AgentInfoService;
|
|
|
|
+import com.iamberry.wechat.face.agentInfo.AgentPurchaseOrderService;
|
|
|
|
+import com.iamberry.wechat.face.drp.DrpRoleInfoService;
|
|
|
|
+import com.iamberry.wechat.face.efast.EfastRentService;
|
|
|
|
+import com.iamberry.wechat.face.member.MemberService;
|
|
|
|
+import com.iamberry.wechat.face.order.CodeService;
|
|
import com.iamberry.wechat.face.porduct.ProductColorService;
|
|
import com.iamberry.wechat.face.porduct.ProductColorService;
|
|
|
|
+import com.iamberry.wechat.tools.NameUtils;
|
|
import com.iamberry.wechat.tools.ResultInfo;
|
|
import com.iamberry.wechat.tools.ResultInfo;
|
|
|
|
+import com.iamberry.wechat.utils.SendMessageUtil;
|
|
|
|
+import org.apache.commons.collections.map.HashedMap;
|
|
import org.apache.commons.lang.StringUtils;
|
|
import org.apache.commons.lang.StringUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Controller;
|
|
import org.springframework.stereotype.Controller;
|
|
|
|
+import org.springframework.web.bind.annotation.PathVariable;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
+import java.text.SimpleDateFormat;
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
+import static com.iamberry.wechat.service.ImberryConfig.INFORM_SHIPPING;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 代理商逻辑处理类
|
|
* 代理商逻辑处理类
|
|
* Created by liuzhiwei on 2017/10/11.
|
|
* Created by liuzhiwei on 2017/10/11.
|
|
@@ -34,6 +51,20 @@ public class AdminAgentToothHandler {
|
|
private AgentInfoService agentInfoService;
|
|
private AgentInfoService agentInfoService;
|
|
@Autowired
|
|
@Autowired
|
|
private ProductColorService productColorService;
|
|
private ProductColorService productColorService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private AgentPurchaseOrderService agentPurchaseOrderService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private EfastRentService efastRentService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private SendMessageUtil sendMessageUtil;
|
|
|
|
+ @Autowired
|
|
|
|
+ private RatFWLogger logger;
|
|
|
|
+ @Autowired
|
|
|
|
+ private CodeService codeService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private MemberService memberService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private DrpRoleInfoService drpRoleInfoService;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 分页查询代理商优惠价配置信息
|
|
* 分页查询代理商优惠价配置信息
|
|
@@ -156,8 +187,35 @@ public class AdminAgentToothHandler {
|
|
msg.setStatus(false);
|
|
msg.setStatus(false);
|
|
msg.setMessage("您没有选择代理商,请选择!");
|
|
msg.setMessage("您没有选择代理商,请选择!");
|
|
}
|
|
}
|
|
|
|
+
|
|
//拆分产品id和金额
|
|
//拆分产品id和金额
|
|
String[] productPrice = productColor.split(",");
|
|
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>();
|
|
List<AgentConfig> list = new ArrayList<AgentConfig>();
|
|
for (int i = 0;i < productPrice.length;i++) {
|
|
for (int i = 0;i < productPrice.length;i++) {
|
|
String[] color = productPrice[i].split(":");
|
|
String[] color = productPrice[i].split(":");
|
|
@@ -251,6 +309,18 @@ public class AdminAgentToothHandler {
|
|
msg.setStatus(false);
|
|
msg.setStatus(false);
|
|
msg.setMessage("修改代理商优惠价配置失败!");
|
|
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);
|
|
int num = agentInfoService.updateAgentConfig(config);
|
|
if (num > 0) {
|
|
if (num > 0) {
|
|
@@ -286,7 +356,23 @@ public class AdminAgentToothHandler {
|
|
msg.setStatus(false);
|
|
msg.setStatus(false);
|
|
return msg;
|
|
return msg;
|
|
}
|
|
}
|
|
|
|
+
|
|
config.setConfigId(Integer.parseInt(configId));
|
|
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));
|
|
config.setConfigStatus(Integer.parseInt(configStatus));
|
|
//修改代理商优惠价配置信息
|
|
//修改代理商优惠价配置信息
|
|
int num = agentInfoService.updateAgentConfig(config);
|
|
int num = agentInfoService.updateAgentConfig(config);
|
|
@@ -299,4 +385,314 @@ public class AdminAgentToothHandler {
|
|
}
|
|
}
|
|
return msg;
|
|
return msg;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 分页查询代理商采购订单信息
|
|
|
|
+ * @param request
|
|
|
|
+ * @param pageSize
|
|
|
|
+ * @param pageNO
|
|
|
|
+ * @return
|
|
|
|
+ * @throws Exception
|
|
|
|
+ */
|
|
|
|
+ @RequestMapping("/select_agent_order_list")
|
|
|
|
+ public ModelAndView selectAgentOrderList(HttpServletRequest request,
|
|
|
|
+ @RequestParam(value = "pageSize", defaultValue = "10", required = false) Integer pageSize,
|
|
|
|
+ @RequestParam(value = "pageNO", defaultValue = "1", required = false) Integer pageNO) throws Exception {
|
|
|
|
+ ModelAndView mv = new ModelAndView("admin/agentInfo/agentOrderList");
|
|
|
|
+ AgentOrder agentOrder = new AgentOrder();
|
|
|
|
+ SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
+ StringBuilder url = new StringBuilder("/admin/agentTooth/select_agent_order_list?pageSize=");
|
|
|
|
+ url.append(pageSize);
|
|
|
|
+ String agentStatus = request.getParameter("agentStatus");
|
|
|
|
+ String agentName = request.getParameter("agentName");
|
|
|
|
+ String agentTel = request.getParameter("agentTel");
|
|
|
|
+ String agentAddressName = request.getParameter("agentAddressName");
|
|
|
|
+ String agentAddressTel = request.getParameter("agentAddressTel");
|
|
|
|
+ String beginDate = request.getParameter("beginDate");
|
|
|
|
+ String endDate = request.getParameter("endDate");
|
|
|
|
+ if (StringUtils.isNotEmpty(agentStatus)) {
|
|
|
|
+ agentOrder.setAgentStatus(Integer.parseInt(agentStatus));
|
|
|
|
+ url.append("&agentStatus=");
|
|
|
|
+ url.append(Integer.parseInt(agentStatus));
|
|
|
|
+ mv.addObject("agentStatus",Integer.parseInt(agentStatus));
|
|
|
|
+ }
|
|
|
|
+ if (StringUtils.isNotEmpty(agentName)) {
|
|
|
|
+ agentOrder.setAgentName(agentName);
|
|
|
|
+ url.append("&agentName=");
|
|
|
|
+ url.append(agentName);
|
|
|
|
+ mv.addObject("agentName",agentName);
|
|
|
|
+ }
|
|
|
|
+ if (StringUtils.isNotEmpty(agentTel)) {
|
|
|
|
+ agentOrder.setAgentTel(agentTel);
|
|
|
|
+ url.append("&agentTel=");
|
|
|
|
+ url.append(agentTel);
|
|
|
|
+ mv.addObject("agentTel",agentTel);
|
|
|
|
+ }
|
|
|
|
+ if (StringUtils.isNotEmpty(agentAddressName)) {
|
|
|
|
+ agentOrder.setAgentAddressName(agentAddressName);
|
|
|
|
+ url.append("&agentAddressName=");
|
|
|
|
+ url.append(agentAddressName);
|
|
|
|
+ mv.addObject("agentAddressName",agentAddressName);
|
|
|
|
+ }
|
|
|
|
+ if (StringUtils.isNotEmpty(agentAddressTel)) {
|
|
|
|
+ agentOrder.setAgentAddressTel(agentAddressTel);
|
|
|
|
+ url.append("&agentAddressTel=");
|
|
|
|
+ url.append(agentAddressTel);
|
|
|
|
+ mv.addObject("agentAddressTel",agentAddressTel);
|
|
|
|
+ }
|
|
|
|
+ if (StringUtils.isNotEmpty(beginDate)) {
|
|
|
|
+ url.append("&beginDate=");
|
|
|
|
+ url.append(beginDate);
|
|
|
|
+ mv.addObject("beginDate",beginDate);
|
|
|
|
+ agentOrder.setBeginDate(format.parse(beginDate));
|
|
|
|
+ }
|
|
|
|
+ if (StringUtils.isNotEmpty(endDate)) {
|
|
|
|
+ url.append("&endDate=");
|
|
|
|
+ url.append(endDate);
|
|
|
|
+ mv.addObject("endDate",endDate);
|
|
|
|
+ agentOrder.setEndDate(format.parse(endDate));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ PageBean page = new PageBean();
|
|
|
|
+ page.setPageNumber(pageNO);
|
|
|
|
+ page.setPageSize(pageSize);
|
|
|
|
+ page.initRecordBegin();
|
|
|
|
+ agentOrder.setPage(page);
|
|
|
|
+ List agentOrderList = agentPurchaseOrderService.listAgentOrder(agentOrder);
|
|
|
|
+ url.append("&pageNO=");
|
|
|
|
+ mv.addObject("agentOrderList",agentOrderList);
|
|
|
|
+ mv.addObject("pageNO", pageNO);
|
|
|
|
+ mv.addObject("pageSize", agentPurchaseOrderService.listAgentOrderCount(agentOrder));
|
|
|
|
+ mv.addObject("url",url.toString());
|
|
|
|
+ return mv;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 同步订单状态
|
|
|
|
+ * @param request
|
|
|
|
+ * @param orderId
|
|
|
|
+ * @throws Exception
|
|
|
|
+ */
|
|
|
|
+ @ResponseBody
|
|
|
|
+ @RequestMapping("/sync_efast_order/{orderId}")
|
|
|
|
+ public ResultMsg syncEfastOrder(HttpServletRequest request,
|
|
|
|
+ @PathVariable("orderId") String orderId) throws Exception {
|
|
|
|
+ //efast的订单编号
|
|
|
|
+ String efastOrderId = request.getParameter("efastOrderId");
|
|
|
|
+ ResultMsg msg = new ResultMsg();
|
|
|
|
+
|
|
|
|
+ if (!StringUtils.isNotEmpty(orderId)) {
|
|
|
|
+ msg.setMessage("订单号为空!");
|
|
|
|
+ msg.setResultCode(ResultInfo.ERRORCODE);
|
|
|
|
+ msg.setStatus(false);
|
|
|
|
+ return msg;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ String id = efastOrderId;
|
|
|
|
+ String EsastType = "1"; //0:百胜外部交易号; 1:百胜订单号
|
|
|
|
+ //查询efast系统该订单的状态
|
|
|
|
+ Map<String, Object> map = efastRentService.getEfastSendOrderInfo(id,EsastType);
|
|
|
|
+ if (!(boolean) map.get("status")) {
|
|
|
|
+ msg.setMessage(map.get("result").toString());
|
|
|
|
+ msg.setResultCode(ResultInfo.ERRORCODE);
|
|
|
|
+ msg.setStatus(false);
|
|
|
|
+ return msg;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //获取订单信息
|
|
|
|
+ AgentOrder agentOrder = new AgentOrder();
|
|
|
|
+ agentOrder.setAgentOrderid(orderId);
|
|
|
|
+ //查询代理商订单列表
|
|
|
|
+ List<AgentOrder> orderList = agentPurchaseOrderService.listSelectAgentOrder(agentOrder);
|
|
|
|
+ if (orderList == null || orderList.size() == 0) {
|
|
|
|
+ msg.setMessage("该订单不存在!");
|
|
|
|
+ msg.setResultCode(ResultInfo.ERRORCODE);
|
|
|
|
+ msg.setStatus(false);
|
|
|
|
+ return msg;
|
|
|
|
+ }
|
|
|
|
+ agentOrder = orderList.get(0);
|
|
|
|
+
|
|
|
|
+ AgentOrder order = new AgentOrder();
|
|
|
|
+ order.setAgentOrderid(orderId);
|
|
|
|
+ order.setAgentStatus(5);
|
|
|
|
+ order.setAgentPostFirm((String) map.get("postFirm"));
|
|
|
|
+ order.setAgentPostNum((String) map.get("postNum"));
|
|
|
|
+ //修改代理商订单信息
|
|
|
|
+ int flag = agentPurchaseOrderService.updateAgentPurchaseOrder(order);
|
|
|
|
+ if (flag < 1){
|
|
|
|
+ msg.setMessage("修改订单状态失败");
|
|
|
|
+ msg.setResultCode(ResultInfo.ERRORCODE);
|
|
|
|
+ msg.setStatus(false);
|
|
|
|
+ return msg;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Member member = memberService.getMemberByUserOpenId(agentOrder.getAgentOpenId());
|
|
|
|
+ if (member == null || 1 == member.getUserStatus() || 0 == member.getUserStatus()){ //未关注或者取消关注的,将发送手机短信
|
|
|
|
+ logger.info("短信通知:"+ agentOrder.getAgentOrderid() +" 用户的订单已发货");
|
|
|
|
+ String phone = agentOrder.getAgentTel();
|
|
|
|
+ codeService.informShipping(phone,INFORM_SHIPPING);
|
|
|
|
+ }else if(2 == member.getUserStatus()){ //已关注的用户推送信息到公众号
|
|
|
|
+ logger.info("公众号推送物流信息: "+ agentOrder.getAgentOpenId() +" 用户的订单已发货");
|
|
|
|
+ //消息内容
|
|
|
|
+ String data = ResultInfo.ORDERPACKAGETEMP;
|
|
|
|
+ data = data.replaceFirst("firstValueOrder", ResultInfo.SHIPMENTMESSAGE)
|
|
|
|
+ .replaceFirst("orderIdValueOrder", orderId)
|
|
|
|
+ .replaceFirst("orderValuePackageId", SendMessageUtil.hashmap.get(map.get("postFirm")) + ":" + map.get("postNum"))
|
|
|
|
+ .replaceFirst("orderRemarkValue", ResultInfo.INTOSHOP);
|
|
|
|
+ sendMessageUtil.sendTemplateMessageToOpenid(data, agentOrder.getAgentOpenId(), ResultInfo.PAGE_SHIPMENT + orderId, 2);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ msg.setMessage(NameUtils.getConfig("SUCCESSINFO"));
|
|
|
|
+ msg.setResultCode(ResultInfo.SUCCESSCODE);
|
|
|
|
+ msg.setStatus(true);
|
|
|
|
+ return msg;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 分页查询代理商
|
|
|
|
+ * @param request
|
|
|
|
+ * @param pageSize
|
|
|
|
+ * @param pageNO
|
|
|
|
+ * @return
|
|
|
|
+ * @throws Exception
|
|
|
|
+ */
|
|
|
|
+ @RequestMapping("/select_agentInfo_list")
|
|
|
|
+ public ModelAndView selectAgentInfoList(HttpServletRequest request,
|
|
|
|
+ @RequestParam(value = "pageSize", defaultValue = "10", required = false) Integer pageSize,
|
|
|
|
+ @RequestParam(value = "pageNO", defaultValue = "1", required = false) Integer pageNO) throws Exception {
|
|
|
|
+ AgentTooth agentTooth = new AgentTooth();
|
|
|
|
+ ModelAndView mv = new ModelAndView("admin/agentInfo/agentInfoList");
|
|
|
|
+ StringBuilder url = new StringBuilder("/admin/agentTooth/select_agentInfo_list?pageSize=");
|
|
|
|
+ url.append(pageSize);
|
|
|
|
+ String agentName = request.getParameter("agentName");
|
|
|
|
+ String agentTel = request.getParameter("agentTel");
|
|
|
|
+ String agentStatus = request.getParameter("agentStatus");
|
|
|
|
+ if (StringUtils.isNotEmpty(agentName)) {
|
|
|
|
+ agentTooth.setAgentName(agentName);
|
|
|
|
+ url.append("&agentName=");
|
|
|
|
+ url.append(agentName);
|
|
|
|
+ mv.addObject("agentName",agentName);
|
|
|
|
+ }
|
|
|
|
+ if (StringUtils.isNotEmpty(agentTel)) {
|
|
|
|
+ agentTooth.setAgentTel(agentTel);
|
|
|
|
+ url.append("&agentTel=");
|
|
|
|
+ url.append(agentTel);
|
|
|
|
+ mv.addObject("agentTel",agentTel);
|
|
|
|
+ }
|
|
|
|
+ if (StringUtils.isNotEmpty(agentStatus)) {
|
|
|
|
+ agentTooth.setAgentStatus(Integer.valueOf(agentStatus));
|
|
|
|
+ url.append("&agentStatus=");
|
|
|
|
+ url.append(agentStatus);
|
|
|
|
+ mv.addObject("agentStatus",agentStatus);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ PageBean page = new PageBean();
|
|
|
|
+ page.setPageSize(pageSize);
|
|
|
|
+ page.setPageNumber(pageNO);
|
|
|
|
+ page.initRecordBegin();
|
|
|
|
+ agentTooth.setPage(page);
|
|
|
|
+ url.append("&pageNO=");
|
|
|
|
+ //查询代理商配置金额集合
|
|
|
|
+ List<AgentTooth> agentToothList = agentInfoService.selectAllAgentinfo(agentTooth);
|
|
|
|
+ mv.addObject("agentToothList", agentToothList);
|
|
|
|
+ mv.addObject("pageNO", pageNO);
|
|
|
|
+ mv.addObject("pageSize", agentInfoService.selectAllAgentinfoCount(agentTooth));
|
|
|
|
+ mv.addObject("url",url.toString());
|
|
|
|
+ return mv;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 修改代理商
|
|
|
|
+ * @param request
|
|
|
|
+ * @return
|
|
|
|
+ * @throws Exception
|
|
|
|
+ */
|
|
|
|
+ @ResponseBody
|
|
|
|
+ @RequestMapping("/update_agentInfo")
|
|
|
|
+ public ResultMsg updateAgentInfo(HttpServletRequest request,AgentTooth agentTooth) throws Exception{
|
|
|
|
+ ResultMsg msg = new ResultMsg();
|
|
|
|
+ if (!StringUtils.isNotEmpty(agentTooth.getAgentId().toString())) {
|
|
|
|
+ msg.setResultCode(ResultInfo.ERRORCODE);
|
|
|
|
+ msg.setStatus(false);
|
|
|
|
+ msg.setMessage("修改代理商配置失败!");
|
|
|
|
+ }
|
|
|
|
+ //修改代理商信息
|
|
|
|
+ int num = agentInfoService.updateAgentTooth(agentTooth);
|
|
|
|
+ if (num > 0) {
|
|
|
|
+ msg.setResultCode(ResultInfo.SUCCESSCODE);
|
|
|
|
+ msg.setStatus(true);
|
|
|
|
+ } else {
|
|
|
|
+ msg.setResultCode(ResultInfo.ERRORCODE);
|
|
|
|
+ msg.setStatus(false);
|
|
|
|
+ }
|
|
|
|
+ return msg;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 进入修改代理商页面
|
|
|
|
+ * @param request
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @RequestMapping("/_update_agentInfo")
|
|
|
|
+ public ModelAndView _updateAgentInfo(HttpServletRequest request){
|
|
|
|
+ ModelAndView mv = new ModelAndView("admin/agentInfo/updateAgentInfo");
|
|
|
|
+ String agentId = request.getParameter("agentId");
|
|
|
|
+ if(agentId == null || agentId.equals("")){
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+ List<PlaceRoleInfo> roleInfoList = drpRoleInfoService.getDrpRoleList2();
|
|
|
|
+ mv.addObject("roleInfoList",roleInfoList);
|
|
|
|
+
|
|
|
|
+ AgentTooth agentTooth = new AgentTooth();
|
|
|
|
+ agentTooth.setAgentId(Integer.valueOf(agentId));
|
|
|
|
+ agentTooth = agentInfoService.getAgentTooth(agentTooth);
|
|
|
|
+ mv.addObject("agentTooth",agentTooth);
|
|
|
|
+
|
|
|
|
+ return mv;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 进入新增代理商页面
|
|
|
|
+ * @param request
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @RequestMapping("/_add_agentInfo")
|
|
|
|
+ public ModelAndView _addAgentInfo(HttpServletRequest request){
|
|
|
|
+ ModelAndView mv = new ModelAndView("admin/agentInfo/addAgentInfo");
|
|
|
|
+ List<PlaceRoleInfo> roleInfoList = drpRoleInfoService.getDrpRoleList2();
|
|
|
|
+ mv.addObject("roleInfoList",roleInfoList);
|
|
|
|
+ return mv;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 新增代理商
|
|
|
|
+ * @param request
|
|
|
|
+ * @return
|
|
|
|
+ * @throws Exception
|
|
|
|
+ */
|
|
|
|
+ @ResponseBody
|
|
|
|
+ @RequestMapping("/add_agentInfo")
|
|
|
|
+ public ResultMsg addAgentInfo(HttpServletRequest request,AgentTooth agentTooth) throws Exception{
|
|
|
|
+ ResultMsg msg = new ResultMsg();
|
|
|
|
+ if (!StringUtils.isNotEmpty(agentTooth.getAgentName())
|
|
|
|
+ || !StringUtils.isNotEmpty(agentTooth.getAgentAddr())
|
|
|
|
+ || !StringUtils.isNotEmpty(agentTooth.getAgentTel())
|
|
|
|
+ || !StringUtils.isNotEmpty(String.valueOf(agentTooth.getAgentRoleId()))
|
|
|
|
+ || !StringUtils.isNotEmpty(String.valueOf(agentTooth.getAgentStatus()))) {
|
|
|
|
+ msg.setResultCode(ResultInfo.ERRORCODE);
|
|
|
|
+ msg.setStatus(false);
|
|
|
|
+ msg.setMessage("修改代理商配置失败!");
|
|
|
|
+ }
|
|
|
|
+ //add代理商信息
|
|
|
|
+ int num = agentInfoService.addAgentinfo(agentTooth);
|
|
|
|
+ if (num > 0) {
|
|
|
|
+ msg.setResultCode(ResultInfo.SUCCESSCODE);
|
|
|
|
+ msg.setStatus(true);
|
|
|
|
+ } else {
|
|
|
|
+ msg.setResultCode(ResultInfo.ERRORCODE);
|
|
|
|
+ msg.setStatus(false);
|
|
|
|
+ }
|
|
|
|
+ return msg;
|
|
|
|
+ }
|
|
}
|
|
}
|