package com.iamberry.rst.controllers.cm; import com.iamberry.rst.core.cm.*; import com.iamberry.rst.core.fm.ComplaintSignclosedInfo; import com.iamberry.rst.core.fm.ComplaintSmallClassInfo; import com.iamberry.rst.core.order.Product; import com.iamberry.rst.core.order.ProductColor; import com.iamberry.rst.core.order.ProductType; import com.iamberry.rst.core.page.PagedResult; import com.iamberry.rst.core.sys.Admin; import com.iamberry.rst.core.tools.LogisticsInfo; import com.iamberry.rst.faces.address.AddressService; import com.iamberry.rst.faces.cm.*; import com.iamberry.rst.faces.fm.ComplaintSignclosedInfoService; import com.iamberry.rst.faces.fm.ComplaintSmallClassInfoService; import com.iamberry.rst.faces.order.EfastOrderService; import com.iamberry.rst.faces.order.LogisticsInfoService; import com.iamberry.rst.faces.product.ProductService; import com.iamberry.rst.faces.sms.SmsService; import com.iamberry.rst.faces.sys.SysService; import com.iamberry.rst.util.SmsConfig; import com.iamberry.rst.utils.*; import com.iamberry.wechat.tools.NameUtils; import com.iamberry.wechat.tools.ResponseJson; import com.iamberry.wechat.tools.ResultInfo; import net.sf.json.JSONArray; import net.sf.json.JSONObject; import org.apache.commons.codec.binary.Base64; import org.apache.commons.lang.StringUtils; import org.apache.poi.hssf.usermodel.*; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.servlet.ModelAndView; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.*; import java.text.MessageFormat; import java.text.SimpleDateFormat; import java.util.*; /** * Created by wxm */ @Controller @RequestMapping("/admin/customer") public class AdminCustomerController { private Logger logger = LoggerFactory.getLogger(AdminCustomerController.class); @Autowired private CompanyInfoService companyInfoService; @Autowired private StoreInfoService storeInfoService; @Autowired private SalesOrderService salesOrderService; @Autowired private CustomerService customerService; @Autowired private ProductService productService; @Autowired private SysService sysService; @Autowired private ComplaintTypeInfoService complaintTypeInfoService; @Autowired private VisitService visitService; @Autowired private QuestionDescribeService questionDescribeService; @Autowired private ComplaintQuestionInfoService complaintQuestionInfoService; @Autowired private SmsService smsService; @Autowired private ComplaintSignclosedInfoService complaintSignclosedInfoService; @Autowired private ComplaintSmallClassInfoService complaintSmallClassInfoService; @Autowired private AddressService addressService; @Autowired private PostageService postageService; @Autowired private EfastOrderService efastOrderService; @Autowired private RelationOrderService relationOrderService; @Autowired private GenerateKeyUtil generateKeyUtil ; @Autowired private CmRelationService cmRelationService ; @Autowired private ProcMethodService procMethodService ; @Autowired private LogisticsInfoService logisticsInfoService; /** * 获取客诉列表 * * @param request * @return */ @RequiresPermissions("customer:list:customer") @RequestMapping("/_customer_list") public ModelAndView getCustomer(HttpServletRequest request, CustomerInfo customer, @RequestParam(value = "pageSize", defaultValue = "10", required = false) Integer pageSize, @RequestParam(value = "pageNO", defaultValue = "1", required = false) Integer pageNO, @RequestParam(value = "totalNum", defaultValue = "0", required = false) Integer totalNum) { ModelAndView mv = new ModelAndView("cm/customer/custome_list"); // PagedResult pagedResult = ptsBomService.listCustomer(pageNO, pageSize, ptsBom, totalNum == 0); // if (totalNum != 0) { // pagedResult.setTotal(totalNum); // } // //获取产品集合,用于页面选择产品 // List list = produceService.getProduceList(); // mv.addObject("produceList", list); // StitchAttrUtil.getSa().setModelAndView(customer, mv, "/admin/bom/_bom_list", pagedResult); return mv; } /** * 跳转到添加客诉页面 * * @return */ @RequiresPermissions("customer:add:customer") @RequestMapping(value = "/to_add_customer") public ModelAndView toAddCustomer(HttpServletRequest request) { ModelAndView mv = new ModelAndView("cm/customer/add_customer"); //获取产品集合,用于页面选择产品 // List produceList = produceService.getProduceList(); // mv.addObject("produceList", produceList); return mv; } /** * 跳转到修改客诉页面 * * @return */ @RequiresPermissions("customer:update:customer") @RequestMapping(value = "/to_update_customer") public ModelAndView toUpdateCustomer(HttpServletRequest request, Integer customerId) { ModelAndView mv = new ModelAndView("cm/customer/update_customer"); ProductType productType = new ProductType(); //查询产品类型集合 List typeList = productService.listProductType(productType); //查询客诉类型集合 List complaintTypeList = complaintTypeInfoService.listComplaintTypeInfo(new ComplaintTypeInfo()); //查询跟进客服集合 Admin admin = new Admin(); admin.setAdminDept(3); admin.setAdminStatus(1); List adminList = sysService.listSelectAdmin(admin); //获取登录人id Integer loginAdminId = AdminUtils.getLoginAdminId(); //查询客诉基本信息 CustomerInfo customerInfo = customerService.getCustomerInfo(customerId); /*查询处理方式*/ CmRelation cmRelation = cmRelationService.getCmRelationByCustomerId(customerInfo.getCustomerId()); /*获取寄出寄入产品*/ cmRelationService.getSendAndBackProduct(cmRelation); /*处理方式*/ ProcMethod procMethod = procMethodService.getProcMethodById(cmRelation.getProcMethodId()); if (customerInfo.getTypeId() == 1 || (procMethod.getProcMethodIsSend()==2 && procMethod.getProcMethodIsBack() == 2)) { customerInfo.setIsNeedSelectOrder(2); //不需要订单 } else { customerInfo.setIsNeedSelectOrder(1); } //setIsNeedSelectOrder if (customerInfo.getIsNeedSelectOrder() == 1 ) { RelationOrder relationOrder = new RelationOrder(); relationOrder.setRelationId(cmRelation.getRelationId()); List relationOrderList = relationOrderService.getRelationOrderList(relationOrder); String[] salesIds = new String[relationOrderList.size()]; for (int k = 0; k < relationOrderList.size(); k++) { salesIds[k] = String.valueOf(relationOrderList.get(k).getSalesId()); } if(salesIds!=null && salesIds.length > 0){ SalesOrder so = new SalesOrder(); so.setSalesIds(salesIds); List orderList = salesOrderService.listSalesOrder(so); for (SalesOrder sor : orderList) { SalesOrderItem salesOrderItem = new SalesOrderItem(); salesOrderItem.setItemOrderId(sor.getSalesId()); List salesOrderItemList = salesOrderService.listSalesOrderItem(salesOrderItem); sor.setSalesOrderItemList(salesOrderItemList); } mv.addObject("salesOrderList", orderList); } } else { mv.addObject("salesOrderList", null); } if ("2".equals(customerInfo.getCustomerIsVisit())) { //1:不需要回访 2:需要回访 Visit visit = new Visit(); visit.setCustomerId(customerInfo.getCustomerId()); visit = visitService.getVisit(visit); mv.addObject("visit", visit); } //查询关联问题 ComplaintQuestionInfo complaintQuestionInfo = complaintQuestionInfoService.getQuestionById(customerInfo.getQuestionId()); //查询问题小类 ComplaintSmallClassInfo complaintSmallClassInfo = new ComplaintSmallClassInfo(); complaintSmallClassInfo.setComplaintId(complaintQuestionInfo.getComplaintId()); List complaintSmallClassInfoList = complaintSmallClassInfoService.listComplaintSmallClassInfo(complaintSmallClassInfo); //查询问题大类 ComplaintTypeInfo complaintTypeInfo = new ComplaintTypeInfo(); List complaintTypeInfoList = complaintTypeInfoService.listComplaintTypeInfo(complaintTypeInfo); mv.addObject("cmRelation", cmRelation); mv.addObject("procMethod", procMethod); mv.addObject("customerInfo", customerInfo); mv.addObject("typeList", typeList); mv.addObject("complaintTypeList", complaintTypeList); mv.addObject("complaintTypeList", complaintTypeList); mv.addObject("adminList", adminList); mv.addObject("loginAdminId", loginAdminId); mv.addObject("complaintQuestionInfo", complaintQuestionInfo); mv.addObject("complaintSmallClassInfoList", complaintSmallClassInfoList); mv.addObject("complaintTypeInfoList", complaintTypeInfoList); return mv; } /** * 查询问题描述 * * @return */ @ResponseBody @RequiresPermissions("customer:add:customer") @RequestMapping(value = "/select_question_describe") public ResponseJson selectQuestionDescribe(HttpServletRequest request, Integer customerId) throws Exception { if (customerId == null || customerId == 0) { return new ResponseJson(500, "未获取到问题描述", 500); } //查询问题描述表 QuestionDescribe questionDescribe = new QuestionDescribe(); questionDescribe.setCustomerId(customerId); questionDescribe = questionDescribeService.listQuestionDescribe(questionDescribe).get(0); ResponseJson rj = new ResponseJson(200, "查询成功", 200); rj.addResponseKeyValue("questionDescribe", questionDescribe); return rj; } /** * 搜索订单列表弹出框 * * @return */ @RequiresPermissions("customer:add:customer") @RequestMapping(value = "/select_order") public ModelAndView selectOrder(HttpServletRequest request) { ModelAndView mv = new ModelAndView("cm/customer/order_list"); //获取销售公司 List companyInfoList = companyInfoService.listCompanyInfo(new CompanyInfo()); mv.addObject("companyInfoList", companyInfoList); return mv; } /** * 添加订单列表弹出框 * * @return */ @RequiresPermissions("customer:add:customer") @RequestMapping(value = "/add_order") public ModelAndView addOder(HttpServletRequest request) { ModelAndView mv = new ModelAndView("cm/customer/order_add"); return mv; } /** * 添加订单 * * @return */ @ResponseBody @RequiresPermissions("customer:add:customer") @RequestMapping(value = "/add_order_info") public ResponseJson addOrderInfo(HttpServletRequest request, SalesOrder salesOrder, String itemJson) throws Exception { List list = new ArrayList<>(); JSONArray jsonArray = JSONArray.fromObject(itemJson); list = (List) JSONArray.toCollection(jsonArray, SalesOrderItem.class); Integer salesAmount = 0; for (int i = 0; i < list.size(); i++) { SalesOrderItem salesOrderItem = list.get(i); if (salesOrderItem.getItemIsSource() == 1) { //产品来源 1:产品颜色表,2:配件表 Product product = productService.getProductById(salesOrderItem.getItemColorId()); ProductColor productColor = productService.getProduceColor(salesOrderItem.getItemColorId()); salesOrderItem.setItemProductType(product.getProductType()); salesOrderItem.setItemProductName(product.getProductName()); salesOrderItem.setItemProductPic(productColor.getColorPicture()); salesOrderItem.setItemProductColor(productColor.getColorName()); salesOrderItem.setItemColorBar(productColor.getColorBar()); salesOrderItem.setItemProductPrice(productColor.getColorPrice()); salesOrderItem.setItemProductDiscount(productColor.getColorDiscount()); salesOrderItem.setItemIsSource(1); salesAmount += productColor.getColorDiscount(); } } salesOrder.setSalesOpenId("0"); salesOrder.setSalesAmount(salesAmount); salesOrder.setSalesPayMoney(salesAmount); salesOrder.setSalesOrderStatus(1); salesOrder.setSalesCreateTime(new Date()); //salesOrder.setSalesPayTime(new Date()); salesOrder.setSalesLastMoney(salesAmount); salesOrder.setSalesWaitMoney(0); salesOrder.setSalesPayMoney(salesAmount); salesOrder.setSalesSalesTime(new Date()); salesOrder.setSalesDiscountMoney(salesAmount); salesOrder.setSalesPledgeMoney(0); salesOrder.setSalesRemainDeposit(0); salesOrder.setSalesType(1); salesOrder.setSalesStatus(1);//确认状态:0(未确认)1(确认)2(挂起)3(作废) salesOrder.setSalesPayStatus(2); //已付款 salesOrder.setSalesProcessStatus(0); //单据状态:0(正常单)1(问题单) salesOrder.setSalesIsSend(0); //0:否 1:是 是否通知配货 salesOrder.setSalesIsLocked(0); //是否锁定 0:否 1:是 salesOrder.setSalesIsSeparate(0); //是否缺货 0:否 1:是 salesOrder.setSalesShippingFee(0); //邮费 salesOrder.setSalesDeliver(2); // 已出库 Integer adminId = AdminUtils.getLoginAdminId(); String orderCode = GenerateKeyUtil.createOrderCode(adminId); salesOrder.setSalesDealCode(orderCode); salesOrder.setSalesOrderId(orderCode); salesOrder.setSalesBatchId(generateKeyUtil.getSalesBatchIdKS()); //salesOrder = salesOrderService.addOrderAndIteminfo(salesOrder,list); salesOrder.setSalesOrderItemList(list); try { Integer flag = customerService.addOrder(salesOrder); } catch (RuntimeException e) { return new ResponseJson(500, "添加订单失败--" + e.getMessage(), 500); } Integer orderId = salesOrder.getSalesId(); ResponseJson rj = new ResponseJson(200, "添加订单成功", 200); rj.addResponseKeyValue("orderId", orderId); return rj; } /** * 查询销售公司 * * @return */ @ResponseBody @RequiresPermissions("customer:add:customer") @RequestMapping(value = "/select_company") public ResponseJson getCompany(HttpServletRequest request) throws Exception { //获取销售公司 List companyInfoList = companyInfoService.listCompanyInfo(new CompanyInfo()); ResponseJson rj = new ResponseJson(200, "查询成功", 200); rj.addResponseKeyValue("companyInfoList", companyInfoList); return rj; } /** * 获取店铺集合 * * @param request * @param storeInfo * @return */ @ResponseBody @RequiresPermissions("customer:add:customer") @RequestMapping(value = "/select_storeInfo") public ResponseJson listStoreInfo(HttpServletRequest request, StoreInfo storeInfo) { storeInfo.setStoreStatus(1); List storeInfoList = storeInfoService.listStore(storeInfo); if (storeInfoList == null || storeInfoList.size() < 1) { return new ResponseJson(500, "查询失败", 500); } else { ResponseJson rj = new ResponseJson(200, "查询成功", 200); rj.addResponseKeyValue("storeInfoList", storeInfoList); return rj; } } /** * 获取订单集合 * * @param request * @param salesOrder * @return */ @ResponseBody @RequiresPermissions("customer:add:customer") @RequestMapping(value = "/select_salesOrder") public ResponseJson listOrder(HttpServletRequest request, SalesOrder salesOrder, String ids, @RequestParam(value = "pageSize", defaultValue = "20", required = false) Integer pageSize, @RequestParam(value = "pageNO", defaultValue = "1", required = false) Integer pageNO, @RequestParam(value = "totalNum", defaultValue = "0", required = false) Integer totalNum) { if (ids != null && ids.indexOf("_") > -1) { String[] salesIds = ids.split("_"); salesOrder.setSalesIds(salesIds); } //分页获取订单信息 PagedResult pagedResult = salesOrderService.listSalesOrderPage(pageNO, pageSize, salesOrder, totalNum == 0); List salesOrderList = pagedResult.getDataList(); for (SalesOrder so:salesOrderList) { if(so.getSalesOrderStatus() != 0){ ProcMethod procMethod = procMethodService.getProcMethodById(so.getSalesOrderStatus()); so.setSalesOrderStatusProcTypeName(procMethod.getProcTypeName()); } } if (salesOrderList == null || salesOrderList.size() < 1) { return new ResponseJson(500, "查询失败", 500); } else { ResponseJson rj = new ResponseJson(200, "查询成功", 200); rj.addResponseKeyValue("salesOrderList", salesOrderList); return rj; } } /** * 分页查询客诉列表信息 * * @param request * @param customerInfo * @param pageSize * @param pageNO * @param totalNum * @return * @throws Exception */ @RequiresPermissions("customer:select:customer") @RequestMapping("/select_customer_list") public ModelAndView selectCustomerList(HttpServletRequest request, CustomerInfo customerInfo, @RequestParam(value = "isFirst", defaultValue = "2", required = false) Integer isFirst, @RequestParam(value = "pageSize", defaultValue = "10", required = false) Integer pageSize, @RequestParam(value = "pageNO", defaultValue = "1", required = false) Integer pageNO, @RequestParam(value = "totalNum", defaultValue = "0", required = false) Integer totalNum) throws Exception { ModelAndView mv = new ModelAndView("cm/customer/custome_list"); /*if (customerInfo.getAdminId() == null && isFirst == 1) { //获取登录员工id Integer adminId = AdminUtils.getLoginAdminId(); customerInfo.setAdminId(adminId); }*/ PagedResult pagedResult = customerService.listCustomer(pageNO, pageSize, customerInfo, totalNum == 0); if (totalNum != 0) { pagedResult.setTotal(totalNum); } ProductType productType = new ProductType(); //查询产品类型集合 List typeList = productService.listProductType(productType); //查询客诉类型集合 List complaintTypeList = complaintTypeInfoService.listComplaintTypeInfo(new ComplaintTypeInfo()); //查询客诉类型集合 List complaintSmallClassInfoList = complaintSmallClassInfoService.listComplaintSmallClassInfo(new ComplaintSmallClassInfo()); //查询处理类型 List procTypeList = customerService.listProcType(); //店铺(销售渠道) List listStoreInfo = storeInfoService.listStore(new StoreInfo()); //查询问题集合 第 30 条bug // List questionDescribeList = questionDescribeService.listQuestionDescribe(new QuestionDescribe()); //查询跟进客服集合 Admin admin = new Admin(); admin.setAdminDept(3); admin.setAdminStatus(1); List adminList = sysService.listSelectAdmin(admin); //获取登录人id Integer loginAdminId = AdminUtils.getLoginAdminId(); mv.addObject("complaintSmallClassInfoList", complaintSmallClassInfoList); mv.addObject("loginAdminId", loginAdminId); mv.addObject("typeList", typeList); mv.addObject("complaintTypeList", complaintTypeList); mv.addObject("adminList", adminList); mv.addObject("procTypeList", procTypeList); mv.addObject("listStoreInfo", listStoreInfo); customerInfo.setVisit(null); customerInfo.setCustomerCommon(null); customerInfo.setComplaintDetectList(null); StitchAttrUtil sa = StitchAttrUtil.getSa(); sa.addDatePro("yyyy-MM-dd", "startTime", "endTime"); sa.setModelAndView(customerInfo, mv, "/admin/customer/select_customer_list", pagedResult); return mv; } /** * 进入客诉基本信息页面 * * @param request * @return * @throws Exception */ @RequiresPermissions("customer:select:customer") @RequestMapping("/_customer_info") public ModelAndView toCustomerInfo(HttpServletRequest request) throws Exception { ModelAndView mv = new ModelAndView("cm/customer/custome_detail"); String customerId = request.getParameter("customerId"); CmRelation cmRelation = new CmRelation(); cmRelation.setCustomerId(Integer.valueOf(customerId)); cmRelation = customerService.getCmRelationInfo(cmRelation); ProcMethod procMethod = customerService.getProcMethod(cmRelation.getProcMethodId()); ListlogisticsInfoList = logisticsInfoService.getLogisticsInfoList(new LogisticsInfo()); List listPostageInfo = customerService.listPostageInfo(cmRelation.getRelationId()); List listSendbackInfo = customerService.listSendbackInfo(cmRelation.getRelationId()); //查询寄回产品 ClosedProdcue record = new ClosedProdcue(); record.setRelationId(cmRelation.getRelationId()); List listClosedProdcue = customerService.listclosedProdcue(record); mv.addObject("listClosedProdcue",listClosedProdcue); mv.addObject("listSendbackInfo",listSendbackInfo); mv.addObject("logisticsInfoList",logisticsInfoList); mv.addObject("listPostageInfo", listPostageInfo); mv.addObject("procMethod", procMethod); mv.addObject("customerId", customerId); return mv; } /** * 查询客诉基本信息 * * @param request * @return * @throws Exception */ @ResponseBody @RequiresPermissions("customer:select:customer") @RequestMapping("/get_customer_info") public ResponseJson getCustomerInfo(HttpServletRequest request) throws Exception { String customerId = request.getParameter("customerId"); if (!StringUtils.isNotEmpty(customerId)) { return new ResponseJson(500, "该客诉信息不存在!", 500); } CustomerInfo customerInfo = new CustomerInfo(); customerInfo.setCustomerId(Integer.parseInt(customerId)); Map map = customerService.getCustomerInfo(customerInfo); ResponseJson rj = new ResponseJson(200, "修改成功!", 200); //查询处理方式信息 CmRelation cmRelation = new CmRelation(); cmRelation.setCustomerId(customerInfo.getCustomerId()); cmRelation = customerService.getCmRelationInfo(cmRelation); ProcMethod procMethod = customerService.getProcMethod(cmRelation.getProcMethodId()); rj.addResponseKeyValue("cmRelation", cmRelation); rj.addResponseKeyValue("procMethod", procMethod); rj.addResponseKeyValue("customerCommon", map.get("customerCommon")); rj.addResponseKeyValue("customer", map.get("customer")); rj.addResponseKeyValue("orderList", map.get("orderList")); return rj; } /** * 查询客诉基本信息 * * @param request * @return * @throws Exception */ @ResponseBody @RequiresPermissions("customer:select:customer") @RequestMapping("/get_customer") public ResponseJson getCustomer(HttpServletRequest request) throws Exception { String customerId = request.getParameter("customerId"); if (!StringUtils.isNotEmpty(customerId)) { return new ResponseJson(500, "该客诉信息不存在!", 500); } SalesOrder salesOrder = new SalesOrder(); salesOrder.setSalesCustomerId(Integer.valueOf(customerId)); List salesOrderList = salesOrderService.salesOrderListAndItem(salesOrder); ResponseJson rj = ResponseJson.getSUCCESS(); rj.addResponseKeyValue("salesOrderList", salesOrderList); return rj; } /** * 进入添加回访页面 * * @param request * @return * @throws Exception */ @RequiresPermissions("customer:select:customer") @RequestMapping("/_add_visit") public ModelAndView toAddVisit(HttpServletRequest request) throws Exception { ModelAndView mv = new ModelAndView("cm/customer/add_visit"); String customerId = request.getParameter("customerId"); //查询跟进客服集合 Admin admin = new Admin(); admin.setAdminDept(3); admin.setAdminStatus(1); List adminList = sysService.listSelectAdmin(admin); //获取登录人id Integer loginAdminId = AdminUtils.getLoginAdminId(); mv.addObject("loginAdminId", loginAdminId); mv.addObject("customerId", customerId); mv.addObject("adminList", adminList); return mv; } /** * 添加回访信息 * * @param request * @param visit * @return */ @ResponseBody @RequiresPermissions("customer:add:visit") @RequestMapping("/add_visit_info") public ResponseJson addVisitInfo(HttpServletRequest request, Visit visit) throws Exception { String visitAdminId = request.getParameter("visitAdminId"); if (!StringUtils.isNotEmpty(visitAdminId)) { return new ResponseJson(500, "请选择回访人!", 500); } Integer loginAdminId = AdminUtils.getLoginAdminId(); visit.setAdminId(loginAdminId); visit.setDesignatedAdminId(Integer.parseInt(visitAdminId)); visit.setVisitStatus(1); visit.setVisitCreateTime(new Date()); int num = visitService.addVisitInfo(visit, visit.getCustomerId()); if (num > 0) { return new ResponseJson(200, "修改成功!", 200); } else { return new ResponseJson(500, "修改失败!", 500); } } /** * 修改客诉状态为已解决 * * @param request * @return */ @ResponseBody @RequiresPermissions("customer:update:customerIsSolve") @RequestMapping("/update_customerIsSolve") public ResponseJson updateCustomerIsSolve(HttpServletRequest request) throws Exception { String customerId = request.getParameter("customerId"); if (!StringUtils.isNotEmpty(customerId)) { return new ResponseJson(500, "该客诉信息不存在!", 500); } //根据id获取客诉信息 CustomerInfo customer = customerService.getCustomerInfo(Integer.parseInt(customerId)); if (customer == null) { return new ResponseJson(500, "该客诉信息不存在!", 500); } if (customer.getCustomerIsSolve().intValue() != 2) { return new ResponseJson(500, "该客诉信息不能修改为已解决状态!", 500); } CustomerInfo customerInfo = new CustomerInfo(); customerInfo.setCustomerId(Integer.parseInt(customerId)); customerInfo.setCustomerIsSolve(1); //修改客诉信息 int num = customerService.updateCustomerInfo(customerInfo); if (num > 0) { return new ResponseJson(200, "修改成功!", 200); } else { return new ResponseJson(500, "修改失败!", 500); } } /** * 查询客服 * * @param request * @return */ @ResponseBody @RequiresPermissions("customer:add:customer") @RequestMapping("/select_sys_admin") public ResponseJson selectSysAdmin(HttpServletRequest request) throws Exception { ResponseJson rj = new ResponseJson(200, "修改成功!", 200); Integer adminId = AdminUtils.getLoginAdminId(); Admin admin = new Admin(); admin.setAdminDept(3); admin.setAdminStatus(1); List adminList = sysService.listSelectAdmin(admin); if (adminList.size() > 0) { rj.addResponseKeyValue("adminList", adminList); rj.addResponseKeyValue("adminId", adminId); return rj; } else { return new ResponseJson(500, "查询失败!", 500); } } /** * 查询产品类型 * * @param request * @return */ @ResponseBody @RequiresPermissions("customer:add:customer") @RequestMapping("/select_produce_type") public ResponseJson selectProduceType(HttpServletRequest request) throws Exception { ResponseJson rj = new ResponseJson(200, "修改成功!", 200); ProductType productType = new ProductType(); productType.setTypeStatus(1); List productTypeList = productService.listProductType(productType); if (productTypeList != null && productTypeList.size() > 0) { rj.addResponseKeyValue("productTypeList", productTypeList); return rj; } else { return new ResponseJson(500, "查询失败!", 500); } } /** * 查询产品 * * @param request * @return */ @ResponseBody @RequiresPermissions("customer:add:customer") @RequestMapping("/select_produce") public ResponseJson selectProduce(HttpServletRequest request) { ResponseJson rj = new ResponseJson(200, "查询成功!", 200); Product product = new Product(); List productList = productService.listProduce(product); for (Product pro : productList) { ProductColor productColor = new ProductColor(); productColor.setColorProductId(pro.getProductId()); List productColorList = productService.listProduceColor(productColor); pro.setColorList(productColorList); } if (productList != null && productList.size() > 0) { rj.addResponseKeyValue("productList", productList); return rj; } else { return new ResponseJson(500, "查询失败!", 500); } } /** * 添加客诉 * * @param request * @return */ @ResponseBody @RequiresPermissions("customer:add:customer") @RequestMapping("/save_customer") public ResponseJson addCustomer(HttpServletRequest request, CustomerInfo customerInfo, SalesOrder salesOrder, CmRelation cmRelation, String sendProdcuesJson,String closedProdcuesJson) throws Exception { ResponseJson rjx = this.isValiData(customerInfo); if (rjx.getResultCode() == 500) { return rjx; } if(customerInfo.getCustomerTel() != null && !"".equals(customerInfo.getCustomerTel())){ customerInfo.setCustomerTel(customerInfo.getCustomerTel().trim()); } if(cmRelation.getRelationBackTel() != null && !"".equals(cmRelation.getRelationBackTel())){ cmRelation.setRelationBackTel(cmRelation.getRelationBackTel().trim()); } if(cmRelation.getRelationSendTel() != null && !"".equals(cmRelation.getRelationSendTel())){ cmRelation.setRelationSendTel(cmRelation.getRelationSendTel().trim()); } Integer customerIsSolve = customerInfo.getCustomerIsSolve(); //处理类型 String phone = customerInfo.getCustomerTel(); //手机号码 Integer typeCompany = customerInfo.getTypeCompany(); // 所属商城 1:美国watero; 2:上朵电动牙刷 3:优尼雅净水机 Integer flag = 0; if (customerInfo.getIsNeedSelectOrder() == 1) { ////1:需要有订单 2:不需要有订单 JSONArray jsonArray; List sendProdcueList; List closedProdcueList; jsonArray = JSONArray.fromObject(sendProdcuesJson); sendProdcueList = (List) JSONArray.toCollection(jsonArray, SendProdcue.class); jsonArray = JSONArray.fromObject(closedProdcuesJson); closedProdcueList = (List) JSONArray.toCollection(jsonArray, ClosedProdcue.class); cmRelation.setSendProdcues(sendProdcueList); cmRelation.setClosedProdcues(closedProdcueList); } customerInfo.setCmRelation(cmRelation); String orderId = ""; if (customerInfo.getCustomerIsSolve() == 3 || customerInfo.getCustomerIsSolve() == 4 || customerInfo.getCustomerIsSolve() == 5) { Integer adminId = AdminUtils.getLoginAdminId(); orderId = OrderNoUtil.createOrderCode(adminId); } customerInfo.setTransactionNumber(orderId); Integer customerId = customerInfo.getCustomerId(); logger.info("-----------------添加客诉开始----------------------"); try { flag = customerService.saveCustomerInfo(customerInfo, salesOrder); } catch (RuntimeException e) { e.printStackTrace(); return new ResponseJson(500, e.getMessage(), 500); } catch (Exception e) { e.printStackTrace(); return new ResponseJson(500, "添加失败", 500); } customerId = customerInfo.getCustomerId(); logger.info("-----------------添加客诉结束----------------------"); if (flag < 1) { return new ResponseJson(500, "添加客诉失败!", 500); } String msg = ""; //处理结果: 1:已解决 2:未解决 3:换新 4:维修 5:补发 6:退货 7:无理由退货 if (customerIsSolve == 3 || customerIsSolve == 4 || customerIsSolve == 5 || customerIsSolve == 6 || customerIsSolve == 7) { String solveMsg = ""; switch (customerIsSolve) { case 3: solveMsg = "为您更换新机"; break; case 4: solveMsg = "为您维修机器"; break; case 5: solveMsg = "为您补发产品"; break; case 6: solveMsg = "为您办理退货"; break; case 7: solveMsg = "为您办理退货"; break; } String addCustomerSuccessMsg = ""; String typeMsg = ""; switch (typeCompany) { case 1: addCustomerSuccessMsg = SmsConfig.ADD_CUSTOMER_SUCCESS_WATERO; typeMsg = "美国WaterO售后"; break; case 2: addCustomerSuccessMsg = SmsConfig.ADD_CUSTOMER_SUCCESS_SHANGDUO; typeMsg = "上朵售后"; break; case 3: addCustomerSuccessMsg = SmsConfig.ADD_CUSTOMER_SUCCESS_YULIA; typeMsg = "YULIA售后"; break; case 4: addCustomerSuccessMsg = SmsConfig.ADD_CUSTOMER_SUCCESS_AIBERLE; typeMsg = "爱贝源售后"; break; } // Object [] msg = new Object[]{solveMsg,typeMsg}; // String text = MessageFormat.format(addCustomerSuccessMsg, msg); // logger.info("添加客诉成功后,给 "+ phone +" 手机用户发送短信:" + text ); // String result = smsService.sendOtherCMS(phone, text); // // if (!"SUCCESS".equals(result)) { // return new ResponseJson(505, "添加客诉发送短信失败,失败原因:" + result + "
客诉信息发送失败并不影响客诉添加。客诉编号为:"+ customerId, 505); // } msg = ",请前往Efast进行换货/退货操作。"; } return new ResponseJson(200, "录入客诉成功!客诉编号:" + customerId + msg, 200); } /** * 修改客诉 * * @param request * @return */ @ResponseBody @RequiresPermissions("customer:update:customer") @RequestMapping("/update_customer") public ResponseJson updateCustomer(HttpServletRequest request, CustomerInfo customerInfo, SalesOrder salesOrder, CmRelation cmRelation, String sendProdcuesJson, String closedProdcuesJson) throws Exception { ResponseJson rjx = this.isValiData(customerInfo); if (rjx.getResultCode() == 500) { return rjx; } Integer flag = 0; if(customerInfo.getCustomerTel() != null && !"".equals(customerInfo.getCustomerTel())){ customerInfo.setCustomerTel(customerInfo.getCustomerTel().trim()); } if(cmRelation.getRelationBackTel() != null && !"".equals(cmRelation.getRelationBackTel())){ cmRelation.setRelationBackTel(cmRelation.getRelationBackTel().trim()); } if(cmRelation.getRelationSendTel() != null && !"".equals(cmRelation.getRelationSendTel())){ cmRelation.setRelationSendTel(cmRelation.getRelationSendTel().trim()); } Integer customerIsSolve = customerInfo.getCustomerIsSolve(); //处理类型 String phone = customerInfo.getCustomerTel(); //手机号码 Integer typeCompany = customerInfo.getTypeCompany(); // 所属商城 1:美国watero; 2:上朵电动牙刷 3:优尼雅净水机 if (customerInfo.getIsNeedSelectOrder() == 1) { JSONArray jsonArray; List sendProdcueList; List closedProdcueList; jsonArray = JSONArray.fromObject(sendProdcuesJson); sendProdcueList = (List) JSONArray.toCollection(jsonArray, SendProdcue.class); jsonArray = JSONArray.fromObject(closedProdcuesJson); closedProdcueList = (List) JSONArray.toCollection(jsonArray, ClosedProdcue.class); cmRelation.setSendProdcues(sendProdcueList); cmRelation.setClosedProdcues(closedProdcueList); } String orderId = ""; if (customerInfo.getCustomerIsSolve() == 3 || customerInfo.getCustomerIsSolve() == 4 || customerInfo.getCustomerIsSolve() == 5) { Integer adminId = AdminUtils.getLoginAdminId(); orderId = OrderNoUtil.createOrderCode(adminId); } customerInfo.setTransactionNumber(orderId); customerInfo.setCmRelation(cmRelation); Integer customerId = customerInfo.getCustomerId(); logger.info("-----------------修改客诉开始----------------------"); try { flag = customerService.updateCustomerInfo(customerInfo, salesOrder); } catch (RuntimeException e) { e.printStackTrace(); return new ResponseJson(500, e.getMessage(), 500); } catch (Exception e) { e.printStackTrace(); return new ResponseJson(500, "修改失败", 500); } customerId = customerInfo.getCustomerId(); logger.info("-----------------修改客诉结束----------------------"); if (flag < 1) { return new ResponseJson(500, "修改客诉失败!", 500); } return new ResponseJson(200, "修改客诉成功!客诉编号为:" + customerId, 200); } /** * 验证方法 * * @param customerInfo * @return */ public ResponseJson isValiData(CustomerInfo customerInfo) { ResponseJson rj = new ResponseJson(); if (customerInfo.getAdminId() == null) { return new ResponseJson(500, "未填写客诉id", 500); } return rj; } /** * 发送短信 * * @param request * @return */ @ResponseBody @RequiresPermissions("customer:add:customer") @RequestMapping("/send_phone_sms") public ResponseJson sendPhoneSms(HttpServletRequest request, String type, String phone, Integer typeCompany, ComplaintQuestionInfo complaintQuestionInfo) throws Exception { String url = NameUtils.getConfig("website"); Integer flag = 1; if (typeCompany == null || typeCompany == 0) { return new ResponseJson(500, "未获取到产品类型!", 500); } String con = ""; if (type != null && !"".equals(type)) { if ("p".equals(type)) { //problem" 问题处理; mailAddress:邮寄地址; if (complaintQuestionInfo.getQuestionId() == null || "".equals(complaintQuestionInfo.getQuestionId())) { complaintQuestionInfo.setQuestionState(1); complaintQuestionInfo.setQuestionIsQcDetect(0); complaintQuestionInfo = complaintQuestionInfoService.insertBackInfo(complaintQuestionInfo); } else { complaintQuestionInfo.setSmallClassId(null); //不能修改小类类型 flag = complaintQuestionInfoService.updateQuestionById(complaintQuestionInfo); if (flag < 1) { return new ResponseJson(500, "问题修改失败!", 500); } } url += "/" + complaintQuestionInfo.getQuestionId() + "/" + typeCompany; switch (typeCompany) { case 1: con = SmsConfig.SEND_PRODUCT_SEND_WATERO; break; case 2: con = SmsConfig.SEND_PRODUCT_SEND_SHANGDUO; break; case 3: con = SmsConfig.SEND_PRODUCT_SEND_YULIA; break; case 4: con = SmsConfig.SEND_PRODUCT_SEND_AIBERLE; break; } } else if ("m".equals(type)) { if (complaintQuestionInfo.getQuestionId() == null) { return new ResponseJson(500, "未获取到邮寄信息!", 500); } complaintQuestionInfo.setQuestionName(null); complaintQuestionInfo.setSmallClassId(null); url += "/5/0"; switch (typeCompany) { case 1: con = SmsConfig.SEND_PRODUCT_SMS_WATERO; break; case 2: con = SmsConfig.SEND_PRODUCT_SMS_SHANGDUO; break; case 3: con = SmsConfig.SEND_PRODUCT_SMS_YULIA; break; case 4: con = SmsConfig.SEND_PRODUCT_SMS_AIBERLE; break; } } } String userPhone = encodePhoneNumber(phone); String text = MessageFormat.format(con, url); logger.info("给 " + phone + " 手机用户发送短信:" + text); String result = smsService.sendOtherCMS(phone, text); if ("SUCCESS".equals(result)) { return new ResponseJson(200, "发送短信成功!", 200); } else { return new ResponseJson(500, "发送短信失败,失败原因:" + result, 500); } } String encodePhoneNumber(String number) { int encnum = Integer.parseInt(number.substring(2)); int prefix = (number.charAt(1) - '2') / 2; // '3'=>0, '5'=>1, '[67]'=>2, '8'=>3 encnum |= (prefix <<= 30); final byte[] raw = new byte[4]; raw[0] = (byte) (encnum >>> 24); raw[1] = (byte) (encnum >>> 16); raw[2] = (byte) (encnum >>> 8); raw[3] = (byte) encnum; return Base64.encodeBase64URLSafeString(raw); } /** * 进入回访完成页面 * * @param request * @return * @throws Exception */ @RequiresPermissions("customer:update:visit") @RequestMapping("/_update_visit_info") public ModelAndView toUpdateVisitFinish(HttpServletRequest request) throws Exception { ModelAndView mv = new ModelAndView("cm/customer/visit_finish"); String customerId = request.getParameter("customerId"); mv.addObject("customerId", customerId); return mv; } /** * 添加回访完成内容 * * @param request * @param visit * @return */ @ResponseBody @RequiresPermissions("customer:update:visit") @RequestMapping("/update_visit_finish") public ResponseJson updateVisitFinish(HttpServletRequest request, Visit visit) throws Exception { String customerId = request.getParameter("finish_customerId"); if (!StringUtils.isNotEmpty(customerId)) { return new ResponseJson(500, "该客诉信息不存在!", 500); } visit.setCustomerId(Integer.parseInt(customerId)); visit.setVisitStatus(2); //修改回访信息内容 int num = visitService.updateVisit(visit); if (num > 0) { return new ResponseJson(200, "添加成功!", 200); } else { return new ResponseJson(500, "添加失败!", 500); } } /** * 进入回访信息详情 * * @param request * @return * @throws Exception */ @RequiresPermissions("customer:get:visit") @RequestMapping("/_visit_info") public ModelAndView toVisitInfo(HttpServletRequest request) throws Exception { ModelAndView mv = new ModelAndView("cm/customer/visit_detail"); String customerId = request.getParameter("customerId"); // 1:未回访,2:已回访 String num = request.getParameter("num"); if (!StringUtils.isNotEmpty(num)) { num = "2"; } mv.addObject("customerId", customerId); mv.addObject("num", num); return mv; } /** * 获取回访信息详情 * * @param request * @return */ @ResponseBody @RequiresPermissions("customer:get:visit") @RequestMapping("/get_visit_info") public ResponseJson getVisitInfo(HttpServletRequest request) throws Exception { String customerId = request.getParameter("customerId"); if (!StringUtils.isNotEmpty(customerId)) { return new ResponseJson(500, "该客诉信息不存在!", 500); } Visit visit = new Visit(); visit.setCustomerId(Integer.parseInt(customerId)); //查询回访信息集合 List visitList = visitService.listVisit(visit); if (visitList == null || visitList.size() == 0) { return new ResponseJson(500, "该客诉没有回访信息!", 500); } visit = visitList.get(0); ResponseJson rj = new ResponseJson(200, "查询成功", 200); rj.addResponseKeyValue("visit", visit); return rj; } /** * 进入问题描述页面 * * @param request * @return * @throws Exception */ @RequiresPermissions("customer:get:describe") @RequestMapping("/_question_describe") public ModelAndView toQuestionDescribe(HttpServletRequest request) throws Exception { ModelAndView mv = new ModelAndView("cm/customer/describe_detail"); String customerId = request.getParameter("customerId"); mv.addObject("customerId", customerId); return mv; } /** * 获取问题描述信息 * * @param request * @return */ @ResponseBody @RequiresPermissions("customer:get:describe") @RequestMapping("/get_describe_info") public ResponseJson getDescribeInfo(HttpServletRequest request) throws Exception { String customerId = request.getParameter("customerId"); if (!StringUtils.isNotEmpty(customerId)) { return new ResponseJson(500, "该客诉信息不存在!", 500); } QuestionDescribe describe = new QuestionDescribe(); describe.setCustomerId(Integer.parseInt(customerId)); //查询问题集合 List questionList = questionDescribeService.listQuestionDescribe(describe); if (questionList == null || questionList.size() == 0) { return new ResponseJson(500, "该客诉信息没有问题描述!", 500); } describe = questionList.get(0); CustomerInfo customerInfo = customerService.getCustomerInfo(Integer.parseInt(customerId)); ResponseJson rj = new ResponseJson(200, "查询成功", 200); rj.addResponseKeyValue("describe", describe); rj.addResponseKeyValue("customerInfo", customerInfo); return rj; } /** * 进入修改售后处理信息页面 * * @param request * @return * @throws Exception */ @RequiresPermissions("customer:update:renewed") @RequestMapping("/_update_relation") public ModelAndView toUpdateRenewed(HttpServletRequest request) throws Exception { ModelAndView mv = new ModelAndView("cm/customer/update_relation"); String customerId = request.getParameter("customerId"); CmRelation cmRelation = new CmRelation(); cmRelation.setCustomerId(Integer.valueOf(customerId)); cmRelation = customerService.getCmRelationInfo(cmRelation); ProcMethod procMethod = customerService.getProcMethod(cmRelation.getProcMethodId()); ListlogisticsInfoList = logisticsInfoService.getLogisticsInfoList(new LogisticsInfo()); List listPostageInfo = customerService.listPostageInfo(cmRelation.getRelationId()); List listSendbackInfo = customerService.listSendbackInfo(cmRelation.getRelationId()); List listInformationInfo = customerService.listInformationInfo(cmRelation.getRelationId()); //查询寄回产品 ClosedProdcue record = new ClosedProdcue(); record.setRelationId(cmRelation.getRelationId()); List listClosedProdcue = customerService.listclosedProdcue(record); mv.addObject("listInformationInfo",listInformationInfo); mv.addObject("listClosedProdcue",listClosedProdcue); mv.addObject("listSendbackInfo",listSendbackInfo); mv.addObject("logisticsInfoList",logisticsInfoList); mv.addObject("listPostageInfo", listPostageInfo); mv.addObject("procMethod", procMethod); mv.addObject("customerId", customerId); return mv; } /** * 获取售后详情 * * @param request * @return */ @ResponseBody @RequiresPermissions("customer:get:renewed") @RequestMapping("/get_cmRelation_info") public ResponseJson getRenewedInfo(HttpServletRequest request) throws Exception { String customerId = request.getParameter("customerId"); if (!StringUtils.isNotEmpty(customerId)) { return new ResponseJson(500, "该客诉信息不存在!", 500); } CmRelation cmRelation = new CmRelation(); cmRelation.setCustomerId(Integer.parseInt(customerId)); //获取换新详情和检测信息 cmRelation = customerService.getCmRelationInfo(cmRelation); if (cmRelation == null) { return new ResponseJson(500, "该客诉没有售后信息!", 500); } else { ResponseJson rj = new ResponseJson(200, "查询成功", 200); rj.addResponseKeyValue("cmRelation", cmRelation); return rj; } } /** * 修改处理信息 * * @param request * @param cmRelation * @return * @throws Exception */ @ResponseBody @RequiresPermissions("customer:update:renewed") @RequestMapping("/update_cmRelation_info") public ResponseJson updateRenewedInfo(HttpServletRequest request, CmRelation cmRelation) throws Exception { String mergeAddress = request.getParameter("merge_address"); if (!StringUtils.isNotEmpty(cmRelation.getRelationId().toString())) { return new ResponseJson(500, "该售后信息不能修改!", 500); } if (StringUtils.isNotEmpty(mergeAddress)) { cmRelation.setRelationSendMergeAddress(mergeAddress); } if (cmRelation.getRelationBackStatus() != null) { if (cmRelation.getRelationBackStatus() != 1) { ComplaintSignclosedInfo cs = new ComplaintSignclosedInfo(); cs.setSignclosedCustomerId(cmRelation.getCustomerId()); cs.setSignclosedLogistics(cmRelation.getRelationBackLogisticsCompany()); cs.setSignclosedLogisticsNumber(cmRelation.getRelationBackLogisticsNo()); complaintSignclosedInfoService.updateSignclosedByCustomerId(cs); } } //修改售后信息 int num = customerService.updateCmRelation(cmRelation); if (num > 0) { return new ResponseJson(200, "修改成功!", 200); } else { return new ResponseJson(500, "修改失败!", 500); } } /** * 查询未解决客诉数量 */ @ResponseBody @RequestMapping(value = "/selectNumberBacklog") public ResultMsg selectTodo(HttpServletRequest request) { ResultMsg msg = new ResultMsg(); CustomerInfo customerInfo = new CustomerInfo(); //获取登录员工id Admin admin = AdminUtils.getLoginAdmin(); // customerInfo.setAdminId(admin.getAdminId()); // customerInfo.setCustomerIsSolve(2); //未解决客诉数量 // Integer notSolvedCustomer = customerService.selectNotSolvedCustomer(customerInfo); //需要向工厂确认所有已签收的产品数量 // CustomerCommon customerCommon = new CustomerCommon(); // customerCommon.setAdminId(admin.getAdminId()); // customerCommon.setRelationBackStatus(4); // Integer amountReceivedCustomer = customerCommonService.listCustomerCommonByStatus(customerCommon); //需要填写Efast订单号的客诉数量 // customerCommon.setRelationBackStatus(3); // Integer noEntryCustomer = customerCommonService.listCustomerCommonByStatus(customerCommon); //客诉录入后,三天后未寄回的客诉数量 // customerCommon.setRelationBackStatus(1); // customerCommon.setRelationCreateTime(new Date()); // Integer notSendCustomer = customerCommonService.listCustomerCommonByStatus(customerCommon); SalesOrder salesOrder = new SalesOrder(); salesOrder.setSalesStatus(0); //未确认 Integer toBeConfirmedOrder = salesOrderService.listSalesOrderNum(salesOrder); salesOrder = new SalesOrder(); salesOrder.setSalesShippingStatus(0); //未发货 Integer toBeAnnounced = salesOrderService.listSalesOrderNum(salesOrder); salesOrder.setSalesShippingStatus(11); //已通知配货 Integer toBeDelivered = salesOrderService.listSalesOrderNum(salesOrder); Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.HOUR_OF_DAY,00); calendar.set(Calendar.MINUTE,00); calendar.set(Calendar.SECOND,01); salesOrder = new SalesOrder(); salesOrder.setStartDate(calendar.getTime()); //startDate Calendar ca = Calendar.getInstance(); ca.set(Calendar.HOUR_OF_DAY,23); ca.set(Calendar.MINUTE,59); ca.set(Calendar.SECOND,59); salesOrder.setEndDate(ca.getTime()); Integer allToDayOrder = salesOrderService.listSalesOrderNum(salesOrder); Map numberMap = new HashMap<>(); numberMap.put("toBeConfirmedOrder", toBeConfirmedOrder); numberMap.put("toBeAnnounced", toBeAnnounced); numberMap.put("toBeDelivered", toBeDelivered); numberMap.put("allToDayOrder", allToDayOrder); // numberMap.put("notSolvedCustomer", notSolvedCustomer); // numberMap.put("amountReceivedCustomer", amountReceivedCustomer); // numberMap.put("noEntryCustomer", noEntryCustomer); // numberMap.put("notSendCustomer", notSendCustomer); numberMap.put("adminDept", admin.getAdminDept()); msg.setResultCode(ResultInfo.SUCCESSCODE); msg.setStatus(true); msg.setData(numberMap); return msg; } // /** // * 根据微信昵称/姓名/电话查询客诉 // * // * @param request // * @return // */ // @ResponseBody // @RequiresPermissions("customer:list:customer") // @RequestMapping("/get_custoner_info") // public ResponseJson getCustonerInfo(HttpServletRequest request, CustomerCommon customerCommon) throws Exception { // if (customerCommon == null) { // return new ResponseJson(500, "参数错误!", 500); // } // List customerCommonList = customerCommonService.listCustomerCommon(customerCommon); // if (customerCommonList.size() < 1) { // return new ResponseJson(500, "不存在相关客诉信息!", 500); // } else { // ResponseJson rj = new ResponseJson(200, "查询成功", 200); // rj.addResponseKeyValue("customer", customerCommonList.get(0)); // return rj; // } // } /** * 申请邮费 * * @return */ @ResponseBody @RequiresPermissions("customer:applyPostage:customer") @RequestMapping(value = "/apply_postage") public ResponseJson applyPostage(HttpServletRequest request, Integer customerId) throws Exception { CustomerInfo customerInfo = customerService.getCustomerInfo(customerId); if (customerInfo == null) { return new ResponseJson(500, "未获取到客诉", 500); } CmRelation cmRelation = cmRelationService.getCmRelationByCustomerId(customerId); if (cmRelation.getRelationBackStatus() == 1) { //1:未寄回 2:已寄回 3:已收货 4:已签收待确认 return new ResponseJson(500, "请修改寄回状态,并填写寄回信息", 500); } if (cmRelation.getRelationBackStatus() == 2) { //1:未寄回 2:已寄回 3:已收货 4:已签收待确认 return new ResponseJson(500, "产品正在寄回中!", 500); } if (cmRelation.getRelationIsTransfer() == 0) { //relationIsTransfer 是否需要转账邮费 0:不需要 10:需要转账 return new ResponseJson(500, "请修改邮费转账状态,并填写邮费信息", 500); } if (cmRelation.getRelationBackPostage() == null || cmRelation.getRelationBackPostage() == 0 //relationBackPostage || cmRelation.getRelationAlipay() == null || cmRelation.getRelationAlipayName() == null) { return new ResponseJson(500, "请填写邮费信息", 500); } if (customerInfo.getCompanyId() == null || customerInfo.getCompanyId() == 0) { return new ResponseJson(500, "未正确选择销售公司", 500); } Postage age = new Postage(); age.setCustomerId(customerInfo.getCustomerId()); //客诉id List postageList = postageService.listPostage(age); if (postageList != null && postageList.size() > 0) { return new ResponseJson(500, "该条客诉已在申请邮费中了", 500); } ResponseJson rj = new ResponseJson(200, "可以申请邮费", 200); rj.addResponseKeyValue("customerCommon", cmRelation); rj.addResponseKeyValue("customerInfo", customerInfo); return rj; } /** * 申请邮费 * * @return */ @ResponseBody @RequiresPermissions("customer:applyPostage:customer") @RequestMapping(value = "/add_postage") public ResponseJson addPostage(HttpServletRequest request, Integer customerId, String postageLogisticsImg) throws Exception { CustomerInfo customerInfo = customerService.getCustomerInfo(customerId); if (customerInfo == null) { return new ResponseJson(500, "未获取到客诉", 500); } CmRelation cmRelation = cmRelationService.getCmRelationByCustomerId(customerId); if (cmRelation.getRelationBackStatus() == 1) { //1:未寄回 2:已寄回 3:已收货 4:已签收待确认 return new ResponseJson(500, "请修改寄回状态,并填写寄回信息", 500); } if (cmRelation.getRelationBackStatus() == 2) { //1:未寄回 2:已寄回 3:已收货 4:已签收待确认 return new ResponseJson(500, "产品正在寄回中!", 500); } if (cmRelation.getRelationIsTransfer() == 0) { //relationIsTransfer 是否需要转账邮费 0:不需要 10:需要转账 return new ResponseJson(500, "请修改邮费转账状态,并填写邮费信息", 500); } if (cmRelation.getRelationBackPostage() == null || cmRelation.getRelationBackPostage() == 0 //relationBackPostage || cmRelation.getRelationAlipay() == null || cmRelation.getRelationAlipayName() == null) { return new ResponseJson(500, "请填写邮费信息", 500); } if (customerInfo.getCompanyId() == null || customerInfo.getCompanyId() == 0) { return new ResponseJson(500, "未正确选择销售公司", 500); } Postage age = new Postage(); age.setCustomerId(customerInfo.getCustomerId()); //客诉id List postageList = postageService.listPostage(age); if (postageList != null && postageList.size() > 0) { return new ResponseJson(500, "该条客诉已在申请邮费中了", 500); } String orderId = ""; for (SalesOrder salesOrder : cmRelation.getSalesOrderList()) { if ("".equals(orderId)) { orderId = salesOrder.getSalesOrderId(); } else { orderId += "," + salesOrder.getSalesOrderId(); } } Integer flag = 0; Postage postage = new Postage(); postage.setCompanyId(customerInfo.getCompanyId()); //销售公司 postage.setAdminId(customerInfo.getAdminId()); //客服 postage.setCustomerId(customerInfo.getCustomerId()); //客诉id postage.setPostageCustomerStatus(2); //------考虑手动点, 直接变为申请中 postage.setPostageManagerStatus(1); //------考虑手动点, 直接变为申请中 postage.setPostageOrderSource(customerInfo.getStoreId()); //店铺id // postage.setPostageTreatmentMethod(cmRelation.getProcMethodId()); //处理方式 postage.setSalesOrderId(orderId); //efast订单号 postage.setPostageClientName(cmRelation.getRelationBackName()); postage.setPostageClientTel(cmRelation.getRelationBackTel()); postage.setPostageClientAddress(cmRelation.getRelationSendAddress()); postage.setPostageLogisticsCompany(cmRelation.getRelationBackLogisticsCompany()); postage.setPostageLogisticsNo(cmRelation.getRelationBackLogisticsNo()); postage.setPostageAmount(cmRelation.getRelationBackPostage()); //寄回邮费 postage.setPostageAlipay(cmRelation.getRelationAlipay()); //支付宝账户 postage.setPostageAlipayName(cmRelation.getRelationAlipayName()); //支付宝账号名称 postage.setPostageLogisticsImg(postageLogisticsImg); flag = postageService.savePostage(postage); if (flag < 1) { return new ResponseJson(500, "申请失败", 500); } ResponseJson rj = new ResponseJson(200, "申请成功,请前往邮费转账列表查看", 200); return rj; } /** * 根据客诉id查询产品类型 * * @param request * @return * @throws Exception */ @ResponseBody @RequestMapping("/getProductType") public ResponseJson getProductType(HttpServletRequest request) throws Exception { String customerId = request.getParameter("customerId"); if (!StringUtils.isNotEmpty(customerId)) { return new ResponseJson(500, "查询产品类型失败!", 500); } //查询客诉产品类型 ProductType productType = productService.getProductType(Integer.valueOf(customerId)); if (productType == null) { return new ResponseJson(500, "未找到产品类型!", 500); } else { ResponseJson rj = new ResponseJson(200, "查询成功", 200); rj.addResponseKeyValue("productType", productType); return rj; } } /** * 根据客户信息查询旧的客诉信息 * * @param request * @return * @throws Exception */ @ResponseBody @RequestMapping("/selectOnCustomer") public ResponseJson listOnCustomer(HttpServletRequest request, CustomerInfo customerInfo) throws Exception { if (customerInfo == null) { return new ResponseJson(500, "查询客诉失败!", 500); } List onCustomerList = customerService.listOnCustomer(customerInfo); if (onCustomerList.size() == 0) { return new ResponseJson(500, "未找到客诉!", 500); } else { ResponseJson rj = new ResponseJson(200, "查询成功", 200); rj.addResponseKeyValue("onCustomerList", onCustomerList); return rj; } } /** * 根据efast订单号查询efast订单物流信息 * * @param request * @return * @throws Exception */ @ResponseBody @RequestMapping("/getefastOrder") public ResponseJson getEfastOrderInfo(HttpServletRequest request, String efastOrderId) throws Exception { if (efastOrderId == null) { return new ResponseJson(500, "查询失败!", 500); } JSONObject orderInfo = efastOrderService.getOrderFormEfastByOrderId(efastOrderId); if (orderInfo == null) { return new ResponseJson(500, "查询失败!", 500); } else if (!orderInfo.has("orders")) { return new ResponseJson(500, "查询失败!", 500); } else { ResponseJson rj = new ResponseJson(200, "查询成功", 200); rj.addResponseKeyValue("orderInfo", orderInfo.toString()); return rj; } } /** * 下载客诉信息 (2018-05-29) * * @param request * @param res * @param * @throws Exception */ @RequestMapping("/download_customer_excel") public void downloadEfastOrderExcel(HttpServletRequest request, HttpServletResponse res) throws Exception { List customerList = customerService.listStatisticalCustomer(); String[] cells = { "日期", "姓名", "联系电话", "类别", "来源入口", "问题类别", "小类名称", "客诉问题", "处理过程", "购买日期", "处理方式","处理结果", "销售公司", "销售渠道", "产品型号", "产品颜色", "产品数量", "寄回快递", "寄回单号", "签收日期", "状态", "寄出快递", "寄出快递", "开箱损", "二次客诉", "跟进客服", "工厂报价", "客户报价", "邮费信息" }; List customerStatisticalInfoList = new ArrayList<>(); SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); for (CustomerStatisticalInfo customerInfo : customerList) { //新建一个容器 CustomerStatisticalInfo customer = new CustomerStatisticalInfo(); //将数据copy到新容器 BeanUtils.copyProperties(customerInfo, customer); CustomerCommon customerCommon = new CustomerCommon(); customerCommon.setCustomerId(customerInfo.getCustomerId()); customerCommon.setRelationId(customerInfo.getRelationId()); List listCustomerCommon = customerService.listCustomerCommons(customerCommon); if(listCustomerCommon.size() > 0) { for (CustomerCommon common : listCustomerCommon) { if (common.getSalesOrderList().size() > 0) { for (SalesOrder salesOrder : common.getSalesOrderList()) { if (salesOrder.getSalesOrderItemList().size() > 0) { for (SalesOrderItem salesOrderItem : salesOrder.getSalesOrderItemList()) { //将数据copy到新容器 CustomerStatisticalInfo customers = new CustomerStatisticalInfo(); BeanUtils.copyProperties(customer, customers); customers.setRelationBackLogisticsCompany(customerInfo.getRelationBackLogisticsCompany()); customers.setRelationBackLogisticsNo(customerInfo.getRelationBackLogisticsNo()); customers.setRelationSendLogisticsCompany(customerInfo.getRelationSendLogisticsCompany()); customers.setRelationSendLogisticsNo(customerInfo.getRelationSendLogisticsNo()); customers.setRelationBackStatus(String.valueOf(customerInfo.getRelationBackStatus())); if(customerInfo.getRelationBackReceiptDate() == null){ customers.setRelationBackReceiptDate(null); }else{ customers.setRelationBackReceiptDate(customerInfo.getRelationBackReceiptDate()); } customers.setSalesPayTime(salesOrder.getSalesPayTime()); customers.setItemProductName(salesOrderItem.getItemProductName()); customers.setItemProductColor(salesOrderItem.getItemProductColor()); customers.setItemNum(String.valueOf(salesOrderItem.getItemNum())); customers.setRelationFactoryCosts(customerInfo.getRelationFactoryCosts()); customers.setRelationCustomerCosts(customerInfo.getRelationCustomerCosts()); String postageString = ""; //查询邮费信息 List listPostageInfo = customerService.listPostageInfo(customers.getRelationId()); if(listPostageInfo.size() > 0){ for(PostageInfo postageInfo : listPostageInfo){ String state = ""; if(postageInfo.getPostageStatus() == 1){ state = "未申请"; } if(postageInfo.getPostageStatus() == 2){ state = "已申请(待转账)"; } if(postageInfo.getPostageStatus() == 3){ state = "已转账"; } postageString = postageString+"状态:"+state+" ,金额:"+postageInfo.getPostageAmount()/100+" ,支付宝账号:"+postageInfo.getPostageAlipay()+";"; } } customers.setPostageString(postageString); customerStatisticalInfoList.add(customers); } } else { customerStatisticalInfoList.add(customer); } } } else { customerStatisticalInfoList.add(customer); } } }else{ customerStatisticalInfoList.add(customer); } } //导出订单Excel并下载 customerExcel(request,res,cells,customerStatisticalInfoList); } /** * 导出订单Excel并下载 * @param request * @param res * @param cells * @throws Exception */ public void customerExcel(HttpServletRequest request,HttpServletResponse res, String[] cells,List customerList) throws Exception { //创建一个workbook,对应一个Excel文件 HSSFWorkbook wb = new HSSFWorkbook(); //在workbook中添加一个sheet,对应Excel中的一个sheet HSSFSheet sheet = wb.createSheet("导出订单"); //在sheet中添加表头第0行,老版本poi对excel行数列数有限制short HSSFRow row = sheet.createRow((int) 0); //创建单元格,设置值表头,设置表头居中 HSSFCellStyle style = wb.createCellStyle(); //居中格式 style.setAlignment(HSSFCellStyle.ALIGN_CENTER); //设置表头 if (cells == null || cells.length == 0) { return; } //循环设置表头 HSSFCell cell = null; for (int i = 0;i < cells.length;i++) { String name = cells[i]; cell = row.createCell(i); cell.setCellValue(name); cell.setCellStyle(style); } SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); for (int i = 0; i < customerList.size(); i++) { row = sheet.createRow((int) i + 1); CustomerStatisticalInfo customerStatisticalInfo = customerList.get(i); String createTime = ""; if(customerStatisticalInfo.getCreateTime() != null){ createTime = format.format(customerStatisticalInfo.getCreateTime()); } String salesPayTime = ""; if(customerStatisticalInfo.getSalesPayTime() != null ){ salesPayTime = format.format(customerStatisticalInfo.getSalesPayTime()); } String backLogisticsCompany = ""; if(customerStatisticalInfo.getRelationBackLogisticsCompany() != null){ backLogisticsCompany = KuaiDi100.replace(customerStatisticalInfo.getRelationBackLogisticsCompany()); } String backStatus = "未知"; if(customerStatisticalInfo.getRelationBackStatus() != null){ if(customerStatisticalInfo.getRelationBackStatus().equals("1")){ backStatus = "未寄回"; } if(customerStatisticalInfo.getRelationBackStatus().equals("2")){ backStatus = "已寄回"; } if(customerStatisticalInfo.getRelationBackStatus().equals("3")){ backStatus = "已收货"; } } String sendLogisticsCompany = ""; if(customerStatisticalInfo.getRelationSendLogisticsCompany() != null){ sendLogisticsCompany = KuaiDi100.replace(customerStatisticalInfo.getRelationSendLogisticsCompany()); } // 创建单元格,设置值 row.createCell(0).setCellValue(createTime); row.createCell(1).setCellValue(customerStatisticalInfo.getCustomerName() == null ? null : customerStatisticalInfo.getCustomerName()); row.createCell(2).setCellValue(customerStatisticalInfo.getCustomerTel() == null ? null : customerStatisticalInfo.getCustomerTel()); row.createCell(3).setCellValue(customerStatisticalInfo.getCounselType() == null ? null : customerStatisticalInfo.getCounselType()); row.createCell(4).setCellValue(customerStatisticalInfo.getSourceType() == null ? null : customerStatisticalInfo.getSourceType()); row.createCell(5).setCellValue(customerStatisticalInfo.getComplaintClassName() == null ? null : customerStatisticalInfo.getComplaintClassName()); row.createCell(6).setCellValue(customerStatisticalInfo.getSmallClassName() == null ? null : customerStatisticalInfo.getSmallClassName()); row.createCell(7).setCellValue(customerStatisticalInfo.getDescribeTitle() == null ? null : customerStatisticalInfo.getDescribeTitle()); row.createCell(8).setCellValue(customerStatisticalInfo.getDescribeHandleDesc() == null ? null : customerStatisticalInfo.getDescribeHandleDesc()); row.createCell(9).setCellValue(salesPayTime); row.createCell(10).setCellValue(customerStatisticalInfo.getProcMethodName() == null ? null : customerStatisticalInfo.getProcMethodName()); row.createCell(11).setCellValue(customerStatisticalInfo.getCustomerIsSolve() == null ? null : customerStatisticalInfo.getCustomerIsSolve()); row.createCell(12).setCellValue(customerStatisticalInfo.getCompanyName() == null ? null : customerStatisticalInfo.getCompanyName()); row.createCell(13).setCellValue(customerStatisticalInfo.getStoreName() == null ? null : customerStatisticalInfo.getStoreName()); row.createCell(14).setCellValue(customerStatisticalInfo.getItemProductName() == null ? null : customerStatisticalInfo.getItemProductName()); row.createCell(15).setCellValue(customerStatisticalInfo.getItemProductColor() == null ? null : customerStatisticalInfo.getItemProductColor()); row.createCell(16).setCellValue(customerStatisticalInfo.getItemNum() == null ? null : customerStatisticalInfo.getItemNum()); row.createCell(17).setCellValue(backLogisticsCompany); row.createCell(18).setCellValue(customerStatisticalInfo.getRelationBackLogisticsNo() == null ? null : customerStatisticalInfo.getRelationBackLogisticsNo()); row.createCell(19).setCellValue(customerStatisticalInfo.getRelationBackReceiptDate() == null ? null : customerStatisticalInfo.getRelationBackReceiptDate()); row.createCell(20).setCellValue(backStatus); row.createCell(21).setCellValue(sendLogisticsCompany); row.createCell(22).setCellValue(customerStatisticalInfo.getRelationSendLogisticsNo() == null ? null : customerStatisticalInfo.getRelationSendLogisticsNo()); row.createCell(23).setCellValue(customerStatisticalInfo.getCustomerOutDamaged() == null ? null : customerStatisticalInfo.getCustomerOutDamaged()); row.createCell(24).setCellValue(customerStatisticalInfo.getCustomerSecondaryCustomer() == null ? null : customerStatisticalInfo.getCustomerSecondaryCustomer()); row.createCell(25).setCellValue(customerStatisticalInfo.getAdminName() == null ? null : customerStatisticalInfo.getAdminName()); if(customerStatisticalInfo.getRelationFactoryCosts() == null){ row.createCell(25).setCellValue(""); }else{ row.createCell(25).setCellValue(customerStatisticalInfo.getRelationFactoryCosts()); } if(customerStatisticalInfo.getRelationCustomerCosts() == null){ row.createCell(26).setCellValue(""); }else{ row.createCell(26).setCellValue(customerStatisticalInfo.getRelationCustomerCosts()); } row.createCell(27).setCellValue(customerStatisticalInfo.getPostageString()); } //下载导出订单Excel downloadCustomerExcel(res,wb); } /** * 下载导出客诉到Excel * @param res * @param wb * @throws Exception */ public void downloadCustomerExcel(HttpServletResponse res, HSSFWorkbook wb) throws Exception{ SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); String fileName = format.format(new Date()) + "客诉报表"; ByteArrayOutputStream os = new ByteArrayOutputStream(); wb.write(os); byte[] content = os.toByteArray(); InputStream is = new ByteArrayInputStream(content); // 设置response参数,可以打开下载页面 res.reset(); res.setContentType("application/vnd.ms-excel;charset=utf-8"); res.setHeader("Content-Disposition", "attachment;filename=" + new String((fileName + ".xls").getBytes(), "iso-8859-1")); ServletOutputStream out = res.getOutputStream(); BufferedInputStream bis = null; BufferedOutputStream bos = null; try { bis = new BufferedInputStream(is); bos = new BufferedOutputStream(out); byte[] buff = new byte[2048]; int bytesRead; // Simple read/write loop. while (-1 != (bytesRead = bis.read(buff, 0, buff.length))) { bos.write(buff, 0, bytesRead); } } catch (Exception e) { // TODO: handle exception e.printStackTrace(); } finally { if (bis != null) bis.close(); if (bos != null) bos.close(); } } /** * 跳转到添加客诉页面 * * @return */ @RequiresPermissions("customer:statistical:customer") @RequestMapping(value = "/to_return_statistics") public ModelAndView toReturnStatistics(HttpServletRequest request) { ModelAndView mv = new ModelAndView("cm/report/return_statistics"); //获取产品集合,用于页面选择产品 ProductColor productColor = new ProductColor(); List productColorList = productService.listproductAndColor(productColor); mv.addObject("productColorList", productColorList); //查询店铺 StoreInfo storeInfo = new StoreInfo(); List storeList = storeInfoService.listStore(storeInfo); mv.addObject("storeList", storeList); return mv; } /** * 退换货统计 * @param request * @param salesOrder * @return */ @ResponseBody @RequestMapping("/return_statistics") public ResponseJson returnStatistics(HttpServletRequest request,SalesOrder salesOrder){ if(salesOrder.getStartDate() == null){ Date now = new Date(); Calendar c = Calendar.getInstance(); c.setTime(now); c.set(Calendar.DAY_OF_YEAR, 1); c.set(Calendar.HOUR, 0); c.set(Calendar.MINUTE, 0); c.set(Calendar.SECOND, 0); salesOrder.setStartDate(c.getTime()); c.add(Calendar.YEAR, 1); c.set(Calendar.DAY_OF_YEAR, -1); c.set(Calendar.HOUR, 23); c.set(Calendar.MINUTE, 59); c.set(Calendar.SECOND, 59); salesOrder.setEndDate(c.getTime()); } if(salesOrder.getItemColorBar() != null && !salesOrder.getItemColorBar().equals("")){ List listColorBar = Arrays.asList(salesOrder.getItemColorBar().split(",")); salesOrder.setListColorBar(listColorBar); } /*销售总数*/ List listTotalSales = customerService.salesTotalSales(salesOrder); /*总换货*/ List listTotalExchange = customerService.salesTotalExchange(salesOrder); /*总退货*/ List listTotalReturn = customerService.salesTotalReturn(salesOrder); /*二次换货*/ List listSecondaryChangeNew = customerService.salesSecondaryChangeNew(salesOrder); /*二次换新退货*/ List listReturnForSecond = customerService.salesReturnForSecond(salesOrder); /*封装数据*/ List listReturnStatisticsInfo = new ArrayList<>(); boolean isThereAre = false; for (int i = 1;i<=12;i++){ ReturnStatisticsInfo returnStatisticsInfo = new ReturnStatisticsInfo(); for(int j = 0;j< listTotalSales.size(); j++){ if(i == listTotalSales.get(j).getMonths()){ returnStatisticsInfo.setMonths(i); returnStatisticsInfo.setTotalSales(listTotalSales.get(j).getNum()); isThereAre = true; } } if(!isThereAre){ returnStatisticsInfo.setMonths(i); returnStatisticsInfo.setTotalSales(0); } isThereAre = false; listReturnStatisticsInfo.add(returnStatisticsInfo); } for(int i = 0;i pagedResult = customerService.listCustomer(pageNO, pageSize, customer, totalNum == 0); if (totalNum != 0) { pagedResult.setTotal(totalNum); } // // //查询产品类型集合 // List typeList = productService.listProductType(new ProductType()); // //查询客诉类型集合 // List complaintTypeList = complaintTypeInfoService.listComplaintTypeInfo(new ComplaintTypeInfo()); // //查询客诉类型集合 // List complaintSmallClassInfoList = complaintSmallClassInfoService.listComplaintSmallClassInfo(new ComplaintSmallClassInfo()); //查询跟进客服集合 Admin admin = new Admin(); admin.setAdminDept(3); admin.setAdminStatus(1); List adminList = sysService.listSelectAdmin(admin); ResponseJson rj = ResponseJson.getSUCCESS(); // rj.addResponseKeyValue("typeList",typeList); // rj.addResponseKeyValue("complaintTypeList",complaintTypeList); // rj.addResponseKeyValue("complaintSmallClassInfoList",complaintSmallClassInfoList); rj.addResponseKeyValue("adminList",adminList); rj.addResponseKeyValue("customerList",pagedResult.getDataList()); return rj; } /** * 获取邮费信息 * @param request * @param postageId * @return */ @ResponseBody @RequestMapping("/get_PostageInfo") public ResponseJson getPostageInfo(HttpServletRequest request,Integer postageId){ ResponseJson rj = new ResponseJson(200, "查询成功", 200); if(postageId == null){ return new ResponseJson(500, "查询失败!", 500); } PostageInfo postageInfo = customerService.getPostageInfo(postageId); rj.addResponseKeyValue("postageInfo",postageInfo); return rj; } /** * 添加邮费信息 * @param request * @param postageInfo * @return */ @ResponseBody @RequestMapping("/add_PostageInfo") public ResponseJson addPostageInfo(HttpServletRequest request,PostageInfo postageInfo){ ResponseJson rj = new ResponseJson(200, "添加成功", 200); if(postageInfo == null){ return new ResponseJson(500, "添加失败,请检查参数!", 500); } Integer msg = customerService.addPostageInfo(postageInfo); if(msg < 1){ return new ResponseJson(500, "添加失败", 500); } rj.addResponseKeyValue("postageInfo",postageInfo); return rj; } /** * 修改邮费信息 * @param request * @param postageInfo * @return */ @ResponseBody @RequestMapping("/update_PostageInfo") public ResponseJson updatePostageInfo(HttpServletRequest request,PostageInfo postageInfo){ ResponseJson rj = new ResponseJson(200, "修改成功", 200); if(postageInfo == null){ return new ResponseJson(500, "修改失败,请检查参数!", 500); } Integer msg = customerService.updatePostageInfo(postageInfo); if(msg < 1){ return new ResponseJson(500, "修改失败", 500); } rj.addResponseKeyValue("postageInfo",postageInfo); return rj; } /** * 删除邮费信息 * @param request * @param postageId * @return */ @ResponseBody @RequestMapping("/delete_PostageInfo") public ResponseJson deletePostageInfo(HttpServletRequest request,Integer postageId){ ResponseJson rj = new ResponseJson(200, "删除成功", 200); if(postageId == null){ return new ResponseJson(500, "删除失败,请检查参数!", 500); } Integer msg = customerService.deletePostageInfo(postageId); if(msg < 1){ return new ResponseJson(500, "删除失败", 500); } return rj; } /** * 获取寄回信息 * @param request * @param sendbackId * @return */ @ResponseBody @RequestMapping("/get_SendbackInfo") public ResponseJson getSendbackInfo(HttpServletRequest request,Integer sendbackId){ ResponseJson rj = new ResponseJson(200, "查询成功", 200); if(sendbackId == null){ return new ResponseJson(500, "查询失败!", 500); } SendbackInfo sendbackInfo = customerService.getSendbackInfo(sendbackId); rj.addResponseKeyValue("sendbackInfo",sendbackInfo); return rj; } /** * 添加寄回信息 * @param request * @param sendbackInfo * @return */ @ResponseBody @RequestMapping("/add_SendbackInfo") public ResponseJson addSendbackInfo(HttpServletRequest request,SendbackInfo sendbackInfo){ ResponseJson rj = new ResponseJson(200, "添加成功", 200); if(sendbackInfo == null){ return new ResponseJson(500, "添加失败,请检查参数!", 500); } /*signTime*/ SendbackInfo info = customerService.addSendbackInfo(sendbackInfo); if(info == null){ return new ResponseJson(500, "添加失败", 500); } SendbackInfo info1 = customerService.getSendbackInfo(sendbackInfo.getSendbackId()); rj.addResponseKeyValue("sendbackInfo",info1); return rj; } /** * 修改寄回信息 * @param request * @param sendbackInfo * @return */ @ResponseBody @RequestMapping("/update_SendbackInfo") public ResponseJson updateSendbackInfo(HttpServletRequest request,SendbackInfo sendbackInfo){ ResponseJson rj = new ResponseJson(200, "修改成功", 200); if(sendbackInfo == null){ return new ResponseJson(500, "修改失败,请检查参数!", 500); } SendbackInfo info = customerService.updateSendbackInfo(sendbackInfo); if(info == null){ return new ResponseJson(500, "修改失败", 500); } SendbackInfo info1 = customerService.getSendbackInfo(sendbackInfo.getSendbackId()); rj.addResponseKeyValue("sendbackInfo",info1); return rj; } /** * 修改寄回状态为已签收 * @param request * @param sendbackInfo * @return */ @ResponseBody @RequestMapping("/update_SendbackStatus") public ResponseJson updateSendbackStatus(HttpServletRequest request,SendbackInfo sendbackInfo){ ResponseJson rj = new ResponseJson(200, "修改成功", 200); if(sendbackInfo == null){ return new ResponseJson(500, "修改失败,请检查参数!", 500); } if(customerService.updateSendbackStatus(sendbackInfo) < 1){ return new ResponseJson(500, "修改失败", 500); } SendbackInfo info1 = customerService.getSendbackInfo(sendbackInfo.getSendbackId()); rj.addResponseKeyValue("sendbackInfo",info1); return rj; } /** * 删除单个寄回信息 * @param request * @param sendbackId * @return */ @ResponseBody @RequestMapping("/delete_SendbackInfo") public ResponseJson deleteSendbackInfo(HttpServletRequest request,Integer sendbackId){ ResponseJson rj = new ResponseJson(200, "删除成功", 200); if(sendbackId == null){ return new ResponseJson(500, "删除失败,请检查参数!", 500); } Integer msg = customerService.deleteSendbackInfo(sendbackId); if(msg < 1){ return new ResponseJson(500, "删除失败", 500); } return rj; } /** * 同步邮费信息 * @param request * @param * @return */ /*@ResponseBody @RequestMapping("/synchronize_PostageInfo")*/ public ResponseJson synchronizePostageInfo(HttpServletRequest request){ String msg = customerService.synchronizePostageInfo(); return new ResponseJson(200, msg, 200); } /** * 同步寄回信息 * @param request * @param * @return */ /*@ResponseBody @RequestMapping("/synchronizeSendbackInfo")*/ public ResponseJson synchronizeSendbackInfo(HttpServletRequest request){ String msg = customerService.synchronizeSendbackInfo(); return new ResponseJson(200, msg, 200); } /** * 添加收费 * @param request * @param informationInfo * @return */ @ResponseBody @RequestMapping("/add_informationInfo") public ResponseJson addInformationInfo(HttpServletRequest request,InformationInfo informationInfo){ ResponseJson rj = new ResponseJson(200, "添加成功", 200); if(informationInfo == null){ return new ResponseJson(500, "添加失败,请检查参数!", 500); } /*signTime*/ Integer msg = customerService.addInformationInfo(informationInfo); if(msg < 1){ return new ResponseJson(500, "添加失败", 500); } InformationInfo info = customerService.getInformationInfo(informationInfo.getFeeId()); rj.addResponseKeyValue("informationInfo",info); return rj; } /** * 修改收费 * @param request * @param informationInfo * @return */ @ResponseBody @RequestMapping("/update_informationInfo") public ResponseJson updateInformationInfo(HttpServletRequest request,InformationInfo informationInfo){ ResponseJson rj = new ResponseJson(200, "修改成功", 200); if(informationInfo == null){ return new ResponseJson(500, "修改失败,请检查参数!", 500); } /*signTime*/ Integer msg = customerService.updateInformationInfo(informationInfo); if(msg < 1){ return new ResponseJson(500, "修改失败", 500); } InformationInfo info = customerService.getInformationInfo(informationInfo.getFeeId()); rj.addResponseKeyValue("informationInfo",info); return rj; } /** * 删除单个收费信息 * @param request * @param feeId * @return */ @ResponseBody @RequestMapping("/delete_informationInfo") public ResponseJson deleteInformationInfo(HttpServletRequest request,Integer feeId){ ResponseJson rj = new ResponseJson(200, "删除成功", 200); if(feeId == null){ return new ResponseJson(500, "删除失败,请检查参数!", 500); } Integer msg = customerService.delInformationInfo(feeId); if(msg < 1){ return new ResponseJson(500, "删除失败", 500); } return rj; } /** * 查询单个收费信息 * @param request * @param feeId * @return */ @ResponseBody @RequestMapping("/get_informationInfo") public ResponseJson getInformationInfo(HttpServletRequest request,Integer feeId){ ResponseJson rj = new ResponseJson(200, "查询成功", 200); if(feeId == null){ return new ResponseJson(500, "查询成功,请检查参数!", 500); } InformationInfo informationInfo = customerService.getInformationInfo(feeId); if(informationInfo == null){ return new ResponseJson(500, "查询成功", 500); } rj.addResponseKeyValue("informationInfo",informationInfo); return rj; } }