1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639 |
- package com.iamberry.rst.controllers.cm;
- import com.iamberry.rst.core.address.City;
- import com.iamberry.rst.core.cm.*;
- 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.faces.address.AddressService;
- import com.iamberry.rst.faces.cm.*;
- 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.AdminUtils;
- import com.iamberry.rst.utils.OrderNoUtil;
- import com.iamberry.rst.utils.StitchAttrUtil;
- import com.iamberry.wechat.tools.NameUtils;
- import com.iamberry.wechat.tools.ResponseJson;
- import net.sf.json.JSONArray;
- import org.apache.commons.codec.binary.Base64;
- import org.apache.commons.lang.StringUtils;
- import org.apache.shiro.authz.annotation.RequiresPermissions;
- import org.slf4j.Logger;
- import org.slf4j.LoggerFactory;
- 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.http.HttpServletRequest;
- import java.text.MessageFormat;
- import java.util.ArrayList;
- import java.util.Date;
- import java.util.List;
- import java.util.Map;
- /**
- * 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 RenewedService renewedService;
- @Autowired
- private RepairService repairService;
- @Autowired
- private BackGoodsService backGoodsService;
- @Autowired
- private FittingsInfoService fittingsInfoService;
- @Autowired
- private ReissueService reissueService;
- @Autowired
- private NoreasonBackService noreasonBackService;
- @Autowired
- private ComplaintQuestionInfoService complaintQuestionInfoService;
- @Autowired
- private SmsService smsService;
- @Autowired
- private ComplaintSignclosedInfoService complaintSignclosedInfoService;
- @Autowired
- private ComplaintSmallClassInfoService complaintSmallClassInfoService;
- @Autowired
- private CustomerCommonService customerCommonService;
- @Autowired
- private AddressService addressService;
- /**
- * 获取客诉列表
- *
- * @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<Customer> pagedResult = ptsBomService.listCustomer(pageNO, pageSize, ptsBom, totalNum == 0);
- // if (totalNum != 0) {
- // pagedResult.setTotal(totalNum);
- // }
- // //获取产品集合,用于页面选择产品
- // List<Produce> list = produceService.getProduceList();
- // mv.addObject("produceList", list);
- // StitchAttrUtil.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<Produce> 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<ProductType> typeList = productService.listProductType(productType);
- //查询客诉类型集合
- List<ComplaintTypeInfo> complaintTypeList = complaintTypeInfoService.listComplaintTypeInfo(new ComplaintTypeInfo());
- //查询跟进客服集合
- Admin admin = new Admin();
- admin.setAdminStatus(1);
- List<Admin> adminList = sysService.listSelectAdmin(admin);
- //获取登录人id
- Integer loginAdminId = AdminUtils.getLoginAdminId();
- //查询客诉基本信息
- CustomerInfo customerInfo = customerService.getCustomerInfo(customerId);
- /*客诉信息处理-stast*/
- //对于区域处理
- if(customerInfo!=null && customerInfo.getCustomerArea() != null){
- // String[] customerAreaAndCity = customerInfo.getCustomerArea().split("-");
- // customerInfo.setProvinceName(customerAreaAndCity[0]);
- // City city
- // addressService.listCity(customerAreaAndCity[0]);
- // customerInfo.setCityName(customerAreaAndCity[0]);
- }
- /*客诉信息处理-end*/
- CustomerCommon customerCommon = new CustomerCommon();
- if(customerInfo.getCustomerIsSolve() != null){
- switch (customerInfo.getCustomerIsSolve()){ //处理结果: 1:已解决 2:未解决 3:换新 4:维修 5:补发 6:退货 7:无理由退货
- case 3://获取换新
- Renewed renewed = new Renewed();
- renewed.setCustomerId(customerInfo.getCustomerId());
- renewed = renewedService.getRenewed(renewed);
- customerCommon = customerCommon.getCustomerCommon(3,renewed);
- break;
- case 4://维修
- Repair repair = new Repair();
- repair.setCustomerId(customerInfo.getCustomerId());
- repair = repairService.getRepair(repair);
- customerCommon = customerCommon.getCustomerCommon(4,repair);
- break;
- case 5:
- Reissue reissue = new Reissue();
- reissue.setCustomerId(customerInfo.getCustomerId());
- reissue = reissueService.getReissue(reissue);
- customerCommon = customerCommon.getCustomerCommon(5,reissue);
- break;
- case 6:
- BackGoods backGoods = new BackGoods();
- backGoods.setCustomerId(customerInfo.getCustomerId());
- backGoods = backGoodsService.getBackGoods(backGoods);
- customerCommon = customerCommon.getCustomerCommon(6,backGoods);
- break;
- case 7:
- NoreasonBack noreasonBack = new NoreasonBack();
- noreasonBack.setCustomerId(customerInfo.getCustomerId());
- noreasonBack = noreasonBackService.getNoreasonBack(noreasonBack);
- customerCommon = customerCommon.getCustomerCommon(7,noreasonBack);
- break;
- }
- /*查询所有需要寄入寄出的产品*/
- customerCommon.setCustomerIsSolve(customerInfo.getCustomerIsSolve());
- customerCommon = customerCommonService.getListProduceAndFitting(customerCommon);
- mv.addObject("customerCommon", customerCommon);
- /*查询所有的产品,颜色和配件信息*/
- List<Product> productList = productService.listProduce(new Product());
- for(Product product : productList){
- ProductColor productColor = new ProductColor();
- productColor.setColorProductId(product.getProductId());
- List<ProductColor> productColorList = productService.listProduceColor(productColor);
- product.setColorList(productColorList);
- FittingsInfo fittingsInfo = new FittingsInfo();
- fittingsInfo.setProductId(product.getProductId());
- List<FittingsInfo> fittingsInfoList = fittingsInfoService.listFittings(fittingsInfo);
- product.setFittingsList(fittingsInfoList);
- }
- mv.addObject("productList", productList);
- if(customerCommon.getOrderId() != null){
- /*查询订单信息*/
- SalesOrder salesOrder = salesOrderService.getSalesOrderById(customerCommon.getOrderId());
- SalesOrderItem salesOrderItem = new SalesOrderItem();
- salesOrderItem.setItemOrderId(salesOrder.getSalesId());
- List<SalesOrderItem> salesOrderItemList = salesOrderService.listSalesOrderItem(salesOrderItem);
- salesOrder.setSalesOrderItemList(salesOrderItemList);
- mv.addObject("salesOrder", salesOrder);
- }
- }
- 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<ComplaintSmallClassInfo> complaintSmallClassInfoList = complaintSmallClassInfoService.listComplaintSmallClassInfo(complaintSmallClassInfo);
- //查询问题大类
- ComplaintTypeInfo complaintTypeInfo = new ComplaintTypeInfo();
- List<ComplaintTypeInfo> complaintTypeInfoList = complaintTypeInfoService.listComplaintTypeInfo(complaintTypeInfo);
- 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);
- //mv.addObject("questionDescribe", questionDescribe);
- 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<CompanyInfo> 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<SalesOrderItem> 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.getItemProductId());
- ProductColor productColor = productService.getProduceColor(salesOrderItem.getItemProductId());
- 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();
- } else if (salesOrderItem.getItemIsSource() == 2) {
- Product product = productService.getProductById(salesOrderItem.getItemProductId());
- FittingsInfo fittingsInfo = fittingsInfoService.getFittingsById(salesOrderItem.getItemColorId());
- salesOrderItem.setItemProductType(product.getProductType());
- salesOrderItem.setItemProductName(product.getProductName());
- salesOrderItem.setItemProductColor(fittingsInfo.getFittingsName());
- salesOrderItem.setItemColorBar(fittingsInfo.getFittingsBar());
- salesOrderItem.setItemProductPrice(fittingsInfo.getFittingsPrice());
- salesOrderItem.setItemProductDiscount(fittingsInfo.getFittingsDiscount());
- salesOrderItem.setItemIsSource(2);
- salesAmount += fittingsInfo.getFittingsDiscount();
- }
- }
- 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.setSalesShippingStatus(1); //发货状态: 0(未发货)1(已发货,即已扫描出库)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); //邮费
- Integer adminId = AdminUtils.getLoginAdminId();
- String orderCode = OrderNoUtil.createOrderCode(adminId);
- salesOrder.setSalesDealCode(orderCode);
- salesOrder.setSalesOrderId(orderCode);
- //salesOrder = salesOrderService.addOrderAndIteminfo(salesOrder,list);
- salesOrder.setSalesOrderItemList(list);
- try {
- Map<String, Object> map = customerService.sendEfastOrder(salesOrder);
- // if (map.get("status") == 1) {
- // salesOrder.setSalesOrderId((String) map.get("EfastOrderId"));
- // }
- } 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;
- }
- /**
- * 获取店铺集合
- *
- * @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<StoreInfo> 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,
- @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) {
- //分页获取订单信息
- PagedResult<SalesOrder> pagedResult = salesOrderService.listSalesOrderPage(pageNO, pageSize, salesOrder, totalNum == 0);
- List<SalesOrder> salesOrderList = pagedResult.getDataList();
- for (SalesOrder order : salesOrderList) {
- SalesOrderItem salesOrderItem = new SalesOrderItem();
- salesOrderItem.setItemOrderId(order.getSalesId());
- List<SalesOrderItem> salesOrderItemList = salesOrderService.listSalesOrderItem(salesOrderItem);
- order.setSalesOrderItemList(salesOrderItemList);
- }
- 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 = "1", 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);
- isFirst = 2;
- }
- PagedResult<CustomerInfo> pagedResult = customerService.listCustomer(pageNO, pageSize, customerInfo, totalNum == 0);
- if (totalNum != 0) {
- pagedResult.setTotal(totalNum);
- }
- ProductType productType = new ProductType();
- //查询产品类型集合
- List<ProductType> typeList = productService.listProductType(productType);
- //查询客诉类型集合
- List<ComplaintTypeInfo> complaintTypeList = complaintTypeInfoService.listComplaintTypeInfo(new ComplaintTypeInfo());
- //查询跟进客服集合
- Admin admin = new Admin();
- admin.setAdminStatus(1);
- List<Admin> adminList = sysService.listSelectAdmin(admin);
- //获取登录人id
- Integer loginAdminId = AdminUtils.getLoginAdminId();
- mv.addObject("loginAdminId", loginAdminId);
- mv.addObject("typeList", typeList);
- mv.addObject("complaintTypeList", complaintTypeList);
- mv.addObject("adminList", adminList);
- mv.addObject("isFirst", isFirst);
- customerInfo.setVisit(null);
- customerInfo.setCustomerCommon(null);
- customerInfo.setComplaintDetectList(null);
- StitchAttrUtil.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");
- 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<String, Object> map = customerService.getCustomerInfo(customerInfo);
- ResponseJson rj = new ResponseJson(200, "修改成功!", 200);
- rj.addResponseKeyValue("customerCommon", map.get("customerCommon"));
- rj.addResponseKeyValue("customer", map.get("customer"));
- rj.addResponseKeyValue("salesOrder", map.get("salesOrder"));
- 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.setAdminStatus(1);
- List<Admin> 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();
- List<Admin> 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<ProductType> 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<Product> productList = productService.listProduce(product);
- for (Product pro : productList) {
- ProductColor productColor = new ProductColor();
- productColor.setColorProductId(pro.getProductId());
- List<ProductColor> 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("/select_produce_fittings")
- public ResponseJson selectProduceFittings(HttpServletRequest request, FittingsInfo fittingsInfo) {
- ResponseJson rj = new ResponseJson(200, "查询成功!", 200);
- List<FittingsInfo> produceFittingsList = fittingsInfoService.listFittings(fittingsInfo);
- if (produceFittingsList != null && produceFittingsList.size() > 0) {
- rj.addResponseKeyValue("produceFittingsList", produceFittingsList);
- 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, CustomerCommon customerCommon,
- String sendProdcuesJson, String sendFittingsJson, String closedProdcuesJson, String closedFittingsJson) throws Exception {
- ResponseJson rjx = this.isValiData(customerInfo);
- if(rjx.getResultCode() == 500){
- return rjx;
- }
- Integer flag = 0;
- JSONArray jsonArray;
- List<SendProdcue> sendProdcueList;
- List<SendFitting> sendFittingList;
- List<ClosedProdcue> closedProdcueList;
- List<ClosedFitting> closedFittingList;
- Integer customerIsSolve = customerInfo.getCustomerIsSolve(); //处理类型
- String phone = customerInfo.getCustomerTel(); //手机号码
- Integer typeCompany = customerInfo.getTypeCompany(); // 所属商城 1:美国watero; 2:上朵电动牙刷 3:优尼雅净水机
- jsonArray = JSONArray.fromObject(sendProdcuesJson);
- sendProdcueList = (List) JSONArray.toCollection(jsonArray, SendProdcue.class);
- jsonArray = JSONArray.fromObject(sendFittingsJson);
- sendFittingList = (List) JSONArray.toCollection(jsonArray, SendFitting.class);
- jsonArray = JSONArray.fromObject(closedProdcuesJson);
- closedProdcueList = (List) JSONArray.toCollection(jsonArray, ClosedProdcue.class);
- jsonArray = JSONArray.fromObject(closedFittingsJson);
- closedFittingList = (List) JSONArray.toCollection(jsonArray, ClosedFitting.class);
- customerCommon.setSendProdcues(sendProdcueList);
- customerCommon.setSendFittings(sendFittingList);
- customerCommon.setClosedProdcues(closedProdcueList);
- customerCommon.setClosedFittings(closedFittingList);
- customerInfo.setCustomerCommon(customerCommon);
- 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) {
- return new ResponseJson(500, e.getMessage(), 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 + "<br>客诉信息发送失败并不影响客诉添加。客诉编号为:"+ 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, CustomerCommon customerCommon,
- String sendProdcuesJson, String sendFittingsJson, String closedProdcuesJson, String closedFittingsJson) throws Exception {
- ResponseJson rjx = this.isValiData(customerInfo);
- if(rjx.getResultCode() == 500){
- return rjx;
- }
- Integer flag = 0;
- JSONArray jsonArray;
- List<SendProdcue> sendProdcueList;
- List<SendFitting> sendFittingList;
- List<ClosedProdcue> closedProdcueList;
- List<ClosedFitting> closedFittingList;
- Integer customerIsSolve = customerInfo.getCustomerIsSolve(); //处理类型
- String phone = customerInfo.getCustomerTel(); //手机号码
- Integer typeCompany = customerInfo.getTypeCompany(); // 所属商城 1:美国watero; 2:上朵电动牙刷 3:优尼雅净水机
- jsonArray = JSONArray.fromObject(sendProdcuesJson);
- sendProdcueList = (List) JSONArray.toCollection(jsonArray, SendProdcue.class);
- jsonArray = JSONArray.fromObject(sendFittingsJson);
- sendFittingList = (List) JSONArray.toCollection(jsonArray, SendFitting.class);
- jsonArray = JSONArray.fromObject(closedProdcuesJson);
- closedProdcueList = (List) JSONArray.toCollection(jsonArray, ClosedProdcue.class);
- jsonArray = JSONArray.fromObject(closedFittingsJson);
- closedFittingList = (List) JSONArray.toCollection(jsonArray, ClosedFitting.class);
- customerCommon.setSendProdcues(sendProdcueList);
- customerCommon.setSendFittings(sendFittingList);
- customerCommon.setClosedProdcues(closedProdcueList);
- customerCommon.setClosedFittings(closedFittingList);
- customerInfo.setCustomerCommon(customerCommon);
- 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.updateCustomerInfo(customerInfo, salesOrder);
- } catch (RuntimeException e) {
- return new ResponseJson(500, e.getMessage(), 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();
- 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";
- 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<Visit> 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<QuestionDescribe> questionList = questionDescribeService.listQuestionDescribe(describe);
- if (questionList == null || questionList.size() == 0) {
- return new ResponseJson(500, "该客诉信息没有问题描述!", 500);
- }
- describe = questionList.get(0);
- ResponseJson rj = new ResponseJson(200, "查询成功", 200);
- rj.addResponseKeyValue("describe", describe);
- return rj;
- }
- /**
- * 进入修改换新页面
- *
- * @param request
- * @return
- * @throws Exception
- */
- @RequiresPermissions("customer:update:renewed")
- @RequestMapping("/_update_renewed")
- public ModelAndView toUpdateRenewed(HttpServletRequest request) throws Exception {
- ModelAndView mv = new ModelAndView("cm/customer/update_renewed");
- String customerId = request.getParameter("customerId");
- mv.addObject("customerId", customerId);
- return mv;
- }
- /**
- * 获取换新详情
- *
- * @param request
- * @return
- */
- @ResponseBody
- @RequiresPermissions("customer:get:renewed")
- @RequestMapping("/get_renewed_info")
- public ResponseJson getRenewedInfo(HttpServletRequest request) throws Exception {
- String customerId = request.getParameter("customerId");
- if (!StringUtils.isNotEmpty(customerId)) {
- return new ResponseJson(500, "该客诉信息不存在!", 500);
- }
- Renewed renewed = new Renewed();
- renewed.setCustomerId(Integer.parseInt(customerId));
- renewed.setRenewedState(1);
- //获取换新详情和检测信息
- renewed = customerService.getRenewedInfo(renewed);
- if (renewed == null) {
- return new ResponseJson(500, "该客诉没有换新信息!", 500);
- } else {
- ResponseJson rj = new ResponseJson(200, "查询成功", 200);
- rj.addResponseKeyValue("renewed", renewed);
- return rj;
- }
- }
- /**
- * 修改换新信息
- *
- * @param request
- * @param renewed
- * @return
- * @throws Exception
- */
- @ResponseBody
- @RequiresPermissions("customer:update:renewed")
- @RequestMapping("/update_renewed_info")
- public ResponseJson updateRenewedInfo(HttpServletRequest request, Renewed renewed) throws Exception {
- /*String closedProducts = request.getParameter("closed_products");
- String closedFittings = request.getParameter("closed_fittings");*/
- String mergeAddress = request.getParameter("merge_address");
- if (!StringUtils.isNotEmpty(renewed.getRenewedId().toString())) {
- return new ResponseJson(500, "该换新信息不能修改!", 500);
- }
- // if (StringUtils.isNotEmpty(renewed.getRenewedBackPostage().toString())) {
- // renewed.setRenewedBackPostage(renewed.getRenewedBackPostage().intValue() * 100);
- // }
- /*if (!StringUtils.isNotEmpty(renewed.getRenewedBackEfastOrderId())) {
- return new ResponseJson(500, "请输入efast订单号!", 500);
- }*/
- if (StringUtils.isNotEmpty(mergeAddress)) {
- renewed.setRenewedSendMergeAddress(mergeAddress);
- }
- if(renewed.getRenewedBackStatus() != null){
- if(renewed.getRenewedBackStatus() != 1){
- ComplaintSignclosedInfo cs = new ComplaintSignclosedInfo();
- cs.setSignclosedCustomerId(renewed.getCustomerId());
- cs.setSignclosedLogistics(renewed.getRenewedBackLogisticsCompany());
- cs.setSignclosedLogisticsNumber(renewed.getRenewedBackLogisticsNo());
- complaintSignclosedInfoService.updateSignclosedByCustomerId(cs);
- }
- }
- //修改换新信息
- int num = renewedService.updateRenewedInfo(renewed, null, null);
- if (num > 0) {
- return new ResponseJson(200, "修改成功!", 200);
- } else {
- return new ResponseJson(500, "修改失败!", 500);
- }
- }
- /**
- * 进入修改维修页面
- *
- * @param request
- * @return
- * @throws Exception
- */
- @RequiresPermissions("customer:update:repair")
- @RequestMapping("/_to_update_repair")
- public ModelAndView toUpdateRepair(HttpServletRequest request) throws Exception {
- ModelAndView mv = new ModelAndView("cm/customer/update_repair");
- String customerId = request.getParameter("customerId");
- mv.addObject("customerId", customerId);
- return mv;
- }
- /**
- * 进入修改维修页面
- *
- * @param request
- * @return
- * @throws Exception
- */
- @ResponseBody
- @RequiresPermissions("customer:update:repair")
- @RequestMapping("/_update_repair")
- public ResponseJson updateRepairUI(HttpServletRequest request) throws Exception {
- String customerId = request.getParameter("customerId");
- if (!StringUtils.isNotEmpty(customerId)) {
- return new ResponseJson(500, "该客诉信息不存在!", 500);
- }
- Repair repair = new Repair();
- repair.setCustomerId(Integer.parseInt(customerId));
- repair.setRepairState(1);
- //获取维修详情和品质检测信息
- repair = customerService.getRepairInfo(repair);
- if (repair == null) {
- return new ResponseJson(500, "该客诉没有维修信息!", 500);
- } else {
- ResponseJson rj = new ResponseJson(200, "查询成功", 200);
- rj.addResponseKeyValue("repair", repair);
- return rj;
- }
- }
- /**
- * 修改维修处理信息
- *
- * @param request
- * @param repair
- * @return
- * @throws Exception
- */
- @ResponseBody
- @RequiresPermissions("customer:update:repair")
- @RequestMapping("/update_repair_info")
- public ResponseJson updateRepairInfo(HttpServletRequest request, Repair repair) throws Exception {
- if (!StringUtils.isNotEmpty(repair.getRepairId().toString())) {
- return new ResponseJson(500, "该换新信息不能修改!", 500);
- }
- /* String closedProducts = request.getParameter("closed_products");
- String closedFittings = request.getParameter("closed_fittings");*/
- String provinceNumber = request.getParameter("repairProvinceNumber");
- String cityNumber = request.getParameter("repairCityNumber");
- String areaNumber = request.getParameter("repairAreaNumber");
- String mergeAddress = request.getParameter("merge_address");
- if (StringUtils.isNotEmpty(provinceNumber)) {
- repair.setProvinceNumber(Integer.parseInt(provinceNumber));
- }
- if (StringUtils.isNotEmpty(cityNumber)) {
- repair.setCityNumber(Integer.parseInt(cityNumber));
- }
- if (StringUtils.isNotEmpty(areaNumber)) {
- repair.setAreaNumber(Integer.parseInt(areaNumber));
- }
- if (StringUtils.isNotEmpty(mergeAddress)) {
- repair.setRepairSendMergeAddress(mergeAddress);
- }
- // if (StringUtils.isNotEmpty(repair.getRepairBackPostage().toString())) {
- // repair.setRepairBackPostage(repair.getRepairBackPostage().intValue() * 100);
- // }
- /*if (!StringUtils.isNotEmpty(repair.getRepairBackEfastOrderId())) {
- return new ResponseJson(500, "请输入efast订单号!", 500);
- }*/
- if (StringUtils.isNotEmpty(mergeAddress)) {
- repair.setRepairSendMergeAddress(mergeAddress);
- }
- /*SalesOrder order = new SalesOrder();
- order.setSalesOrderStatus(1);
- order.setSalesOrderId(repair.getRepairBackEfastOrderId());
- int count = salesOrderService.getOrderInfoCount(order);
- //判断efast订单是否可查出有效数据
- if (count == 0) {
- return new ResponseJson(500, "该efast订单号无效,请重新输入!", 500);
- }*/
- if(repair.getRepairBackStatus() != null){
- if(repair.getRepairBackStatus() != 1){
- ComplaintSignclosedInfo cs = new ComplaintSignclosedInfo();
- cs.setSignclosedCustomerId(repair.getCustomerId());
- cs.setSignclosedLogistics(repair.getRepairBackLogisticsCompany());
- cs.setSignclosedLogisticsNumber(repair.getRepairBackLogisticsNo());
- complaintSignclosedInfoService.updateSignclosedByCustomerId(cs);
- }
- }
- //修改维修信息
- int num = repairService.updateRepairInfo(repair, null, null);
- if (num > 0) {
- return new ResponseJson(200, "修改成功!", 200);
- } else {
- return new ResponseJson(500, "修改失败!", 500);
- }
- }
- /**
- * 进入修改退货页面
- *
- * @param request
- * @return
- * @throws Exception
- */
- @RequiresPermissions("customer:update:backGoods")
- @RequestMapping("/_to_update_book_goods")
- public ModelAndView toUpdateBookGoods(HttpServletRequest request) throws Exception {
- ModelAndView mv = new ModelAndView("cm/customer/update_back_goods");
- String customerId = request.getParameter("customerId");
- mv.addObject("customerId", customerId);
- return mv;
- }
- /**
- * 进入修改售后退货页面
- *
- * @param request
- * @return
- * @throws Exception
- */
- @ResponseBody
- @RequiresPermissions("customer:update:backGoods")
- @RequestMapping("/_update_back_goods")
- public ResponseJson updateBackGoodsUI(HttpServletRequest request) throws Exception {
- String customerId = request.getParameter("customerId");
- if (!StringUtils.isNotEmpty(customerId)) {
- return new ResponseJson(500, "该客诉信息不存在!", 500);
- }
- BackGoods backGoods = new BackGoods();
- backGoods.setCustomerId(Integer.parseInt(customerId));
- //获取售后退货信息
- backGoods = customerService.getBackGoods(backGoods);
- if (backGoods == null) {
- return new ResponseJson(500, "该客诉没有售后退货信息!", 500);
- } else {
- ResponseJson rj = new ResponseJson(200, "查询成功", 200);
- rj.addResponseKeyValue("backGoods", backGoods);
- return rj;
- }
- }
- /**
- * 修改售后退货信息
- *
- * @param request
- * @param backGoods
- * @return
- * @throws Exception
- */
- @ResponseBody
- @RequiresPermissions("customer:update:backGoods")
- @RequestMapping("/update_back_goods")
- public ResponseJson updateBackGoods(HttpServletRequest request, BackGoods backGoods) throws Exception {
- String closedProducts = request.getParameter("closed_products");
- String closedFittings = request.getParameter("closed_fittings");
- if (!StringUtils.isNotEmpty(backGoods.getBackGoodsId().toString())) {
- return new ResponseJson(500, "该售后退货信息不能修改!", 500);
- }
- // if (StringUtils.isNotEmpty(backGoods.getBackGoodsBackPostage().toString())) {
- // backGoods.setBackGoodsBackPostage(backGoods.getBackGoodsBackPostage().intValue() * 100);
- // }
- // if(backGoods.getBackGoodsBackStatus() != 1){
- // ComplaintSignclosedInfo cs = new ComplaintSignclosedInfo();
- // cs.setSignclosedCustomerId(backGoods.getCustomerId());
- // cs.setSignclosedLogistics(backGoods.getBackGoodsBackLogisticsCompany());
- // cs.setSignclosedLogisticsNumber(backGoods.getBackGoodsBackLogisticsNo());
- // complaintSignclosedInfoService.updateSignclosedByCustomerId(cs);
- // }
- int num = backGoodsService.updateBackGoods(backGoods, closedProducts, closedFittings);
- if (num > 0) {
- return new ResponseJson(200, "修改成功!", 200);
- } else {
- return new ResponseJson(500, "修改失败!", 500);
- }
- }
- /**
- * 进入修改补寄页面
- *
- * @param request
- * @return
- * @throws Exception
- */
- @RequiresPermissions("customer:update:reissue")
- @RequestMapping("/_to_update_reissue")
- public ModelAndView toUpdateReissue(HttpServletRequest request) throws Exception {
- ModelAndView mv = new ModelAndView("cm/customer/update_reissue");
- String customerId = request.getParameter("customerId");
- mv.addObject("customerId", customerId);
- return mv;
- }
- /**
- * 进入修改补寄信息页面
- *
- * @param request
- * @return
- */
- @ResponseBody
- @RequiresPermissions("customer:update:reissue")
- @RequestMapping("/get_reissue_info")
- public ResponseJson getReissueInfo(HttpServletRequest request) {
- String customerId = request.getParameter("customerId");
- if (!StringUtils.isNotEmpty(customerId)) {
- return new ResponseJson(500, "该客诉信息不存在!", 500);
- }
- Reissue reissue = new Reissue();
- reissue.setCustomerId(Integer.parseInt(customerId));
- //获取售后补寄信息
- reissue = customerService.getReissue(reissue);
- if (reissue == null) {
- return new ResponseJson(500, "该客诉没有售后退货信息!", 500);
- } else {
- ResponseJson rj = new ResponseJson(200, "查询成功", 200);
- rj.addResponseKeyValue("reissue", reissue);
- return rj;
- }
- }
- /**
- * 修改售后补寄信息
- *
- * @param request
- * @param reissue
- * @return
- * @throws Exception
- */
- @ResponseBody
- @RequiresPermissions("customer:update:reissue")
- @RequestMapping("/update_reissue_info")
- public ResponseJson updateReissueInfo(HttpServletRequest request, Reissue reissue) throws Exception {
- String provinceNumber = request.getParameter("reissueProvinceNumber");
- String cityNumber = request.getParameter("reissueCityNumber");
- String areaNumber = request.getParameter("reissueAreaNumber");
- String mergeAddress = request.getParameter("merge_address");
- if (!StringUtils.isNotEmpty(reissue.getReissueId().toString())) {
- return new ResponseJson(500, "该售后补寄信息不能修改!", 500);
- }
- if (StringUtils.isNotEmpty(provinceNumber)) {
- reissue.setProvinceNumber(Integer.parseInt(provinceNumber));
- }
- if (StringUtils.isNotEmpty(cityNumber)) {
- reissue.setCityNumber(Integer.parseInt(cityNumber));
- }
- if (StringUtils.isNotEmpty(areaNumber)) {
- reissue.setAreaNumber(Integer.parseInt(areaNumber));
- }
- if (StringUtils.isNotEmpty(mergeAddress)) {
- reissue.setReissueSendMergeAddress(mergeAddress);
- }
- //修改售后补寄信息
- int num = reissueService.updateReissueInfo(reissue);
- if (num > 0) {
- return new ResponseJson(200, "修改成功!", 200);
- } else {
- return new ResponseJson(500, "修改失败!", 500);
- }
- }
- /**
- * 进入修改退货页面
- *
- * @param request
- * @return
- * @throws Exception
- */
- @RequiresPermissions("customer:update:noreason")
- @RequestMapping("/_update_noreason_back")
- public ModelAndView toUpdateNoreasonBack(HttpServletRequest request) throws Exception {
- ModelAndView mv = new ModelAndView("cm/customer/update_noreason_back");
- String customerId = request.getParameter("customerId");
- mv.addObject("customerId", customerId);
- return mv;
- }
- /**
- * 获取无理由退货信息
- *
- * @param request
- * @return
- * @throws Exception
- */
- @ResponseBody
- @RequiresPermissions("customer:update:noreason")
- @RequestMapping("/get_noreason_back")
- public ResponseJson getNoreasonBack(HttpServletRequest request) throws Exception {
- String customerId = request.getParameter("customerId");
- if (!StringUtils.isNotEmpty(customerId)) {
- return new ResponseJson(500, "该客诉信息不存在!", 500);
- }
- NoreasonBack noreasonBack = new NoreasonBack();
- noreasonBack.setCustomerId(Integer.parseInt(customerId));
- noreasonBack.setNoreasonBackState(1);
- //获取无理由退货信息
- noreasonBack = customerService.getNoreasonBack(noreasonBack);
- if (noreasonBack == null) {
- return new ResponseJson(500, "该客诉没有无理由售后退货信息!", 500);
- } else {
- ResponseJson rj = new ResponseJson(200, "查询成功", 200);
- rj.addResponseKeyValue("noreasonBack", noreasonBack);
- return rj;
- }
- }
- /**
- * 修改售后无理由退货信息
- *
- * @param request
- * @param noreasonBack
- * @return
- * @throws Exception
- */
- @ResponseBody
- @RequiresPermissions("customer:update:noreason")
- @RequestMapping("/update_noreason")
- public ResponseJson updateNoreason(HttpServletRequest request, NoreasonBack noreasonBack) throws Exception {
- String closedProducts = request.getParameter("closed_products");
- String closedFittings = request.getParameter("closed_fittings");
- if (!StringUtils.isNotEmpty(noreasonBack.getNoreasonBackId().toString())) {
- return new ResponseJson(500, "该售后无理由退货信息不能修改!", 500);
- }
- // if (StringUtils.isNotEmpty(noreasonBack.getNoreasonBackBackPostage().toString())) {
- // noreasonBack.setNoreasonBackBackPostage(noreasonBack.getNoreasonBackBackPostage().intValue() * 100);
- // }
- // if(noreasonBack.getNoreasonBackBackStatus() != 1){
- // ComplaintSignclosedInfo cs = new ComplaintSignclosedInfo();
- // cs.setSignclosedCustomerId(noreasonBack.getCustomerId());
- // cs.setSignclosedLogistics(noreasonBack.getNoreasonBackBackLogisticsCompany());
- // cs.setSignclosedLogisticsNumber(noreasonBack.getNoreasonBackBackLogisticsNo());
- // complaintSignclosedInfoService.updateSignclosedByCustomerId(cs);
- // }
- int num = noreasonBackService.updateNoreasonBack(noreasonBack, closedProducts, closedFittings);
- if (num > 0) {
- return new ResponseJson(200, "修改成功!", 200);
- } else {
- return new ResponseJson(500, "修改失败!", 500);
- }
- }
- }
|