AdminCustomerController.java 65 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639
  1. package com.iamberry.rst.controllers.cm;
  2. import com.iamberry.rst.core.address.City;
  3. import com.iamberry.rst.core.cm.*;
  4. import com.iamberry.rst.core.order.Product;
  5. import com.iamberry.rst.core.order.ProductColor;
  6. import com.iamberry.rst.core.order.ProductType;
  7. import com.iamberry.rst.core.page.PagedResult;
  8. import com.iamberry.rst.core.sys.Admin;
  9. import com.iamberry.rst.faces.address.AddressService;
  10. import com.iamberry.rst.faces.cm.*;
  11. import com.iamberry.rst.faces.product.ProductService;
  12. import com.iamberry.rst.faces.sms.SmsService;
  13. import com.iamberry.rst.faces.sys.SysService;
  14. import com.iamberry.rst.util.SmsConfig;
  15. import com.iamberry.rst.utils.AdminUtils;
  16. import com.iamberry.rst.utils.OrderNoUtil;
  17. import com.iamberry.rst.utils.StitchAttrUtil;
  18. import com.iamberry.wechat.tools.NameUtils;
  19. import com.iamberry.wechat.tools.ResponseJson;
  20. import net.sf.json.JSONArray;
  21. import org.apache.commons.codec.binary.Base64;
  22. import org.apache.commons.lang.StringUtils;
  23. import org.apache.shiro.authz.annotation.RequiresPermissions;
  24. import org.slf4j.Logger;
  25. import org.slf4j.LoggerFactory;
  26. import org.springframework.beans.factory.annotation.Autowired;
  27. import org.springframework.stereotype.Controller;
  28. import org.springframework.web.bind.annotation.RequestMapping;
  29. import org.springframework.web.bind.annotation.RequestParam;
  30. import org.springframework.web.bind.annotation.ResponseBody;
  31. import org.springframework.web.servlet.ModelAndView;
  32. import javax.servlet.http.HttpServletRequest;
  33. import java.text.MessageFormat;
  34. import java.util.ArrayList;
  35. import java.util.Date;
  36. import java.util.List;
  37. import java.util.Map;
  38. /**
  39. * Created by wxm
  40. */
  41. @Controller
  42. @RequestMapping("/admin/customer")
  43. public class AdminCustomerController {
  44. private Logger logger = LoggerFactory.getLogger(AdminCustomerController.class);
  45. @Autowired
  46. private CompanyInfoService companyInfoService;
  47. @Autowired
  48. private StoreInfoService storeInfoService;
  49. @Autowired
  50. private SalesOrderService salesOrderService;
  51. @Autowired
  52. private CustomerService customerService;
  53. @Autowired
  54. private ProductService productService;
  55. @Autowired
  56. private SysService sysService;
  57. @Autowired
  58. private ComplaintTypeInfoService complaintTypeInfoService;
  59. @Autowired
  60. private VisitService visitService;
  61. @Autowired
  62. private QuestionDescribeService questionDescribeService;
  63. @Autowired
  64. private RenewedService renewedService;
  65. @Autowired
  66. private RepairService repairService;
  67. @Autowired
  68. private BackGoodsService backGoodsService;
  69. @Autowired
  70. private FittingsInfoService fittingsInfoService;
  71. @Autowired
  72. private ReissueService reissueService;
  73. @Autowired
  74. private NoreasonBackService noreasonBackService;
  75. @Autowired
  76. private ComplaintQuestionInfoService complaintQuestionInfoService;
  77. @Autowired
  78. private SmsService smsService;
  79. @Autowired
  80. private ComplaintSignclosedInfoService complaintSignclosedInfoService;
  81. @Autowired
  82. private ComplaintSmallClassInfoService complaintSmallClassInfoService;
  83. @Autowired
  84. private CustomerCommonService customerCommonService;
  85. @Autowired
  86. private AddressService addressService;
  87. /**
  88. * 获取客诉列表
  89. *
  90. * @param request
  91. * @return
  92. */
  93. @RequiresPermissions("customer:list:customer")
  94. @RequestMapping("/_customer_list")
  95. public ModelAndView getCustomer(HttpServletRequest request, CustomerInfo customer,
  96. @RequestParam(value = "pageSize", defaultValue = "10", required = false) Integer pageSize,
  97. @RequestParam(value = "pageNO", defaultValue = "1", required = false) Integer pageNO,
  98. @RequestParam(value = "totalNum", defaultValue = "0", required = false) Integer totalNum) {
  99. ModelAndView mv = new ModelAndView("cm/customer/custome_list");
  100. // PagedResult<Customer> pagedResult = ptsBomService.listCustomer(pageNO, pageSize, ptsBom, totalNum == 0);
  101. // if (totalNum != 0) {
  102. // pagedResult.setTotal(totalNum);
  103. // }
  104. // //获取产品集合,用于页面选择产品
  105. // List<Produce> list = produceService.getProduceList();
  106. // mv.addObject("produceList", list);
  107. // StitchAttrUtil.setModelAndView(customer, mv, "/admin/bom/_bom_list", pagedResult);
  108. return mv;
  109. }
  110. /**
  111. * 跳转到添加客诉页面
  112. *
  113. * @return
  114. */
  115. @RequiresPermissions("customer:add:customer")
  116. @RequestMapping(value = "/to_add_customer")
  117. public ModelAndView toAddCustomer(HttpServletRequest request) {
  118. ModelAndView mv = new ModelAndView("cm/customer/add_customer");
  119. //获取产品集合,用于页面选择产品
  120. // List<Produce> produceList = produceService.getProduceList();
  121. // mv.addObject("produceList", produceList);
  122. return mv;
  123. }
  124. /**
  125. * 跳转到修改客诉页面
  126. *
  127. * @return
  128. */
  129. @RequiresPermissions("customer:update:customer")
  130. @RequestMapping(value = "/to_update_customer")
  131. public ModelAndView toUpdateCustomer(HttpServletRequest request,Integer customerId) {
  132. ModelAndView mv = new ModelAndView("cm/customer/update_customer");
  133. ProductType productType = new ProductType();
  134. //查询产品类型集合
  135. List<ProductType> typeList = productService.listProductType(productType);
  136. //查询客诉类型集合
  137. List<ComplaintTypeInfo> complaintTypeList = complaintTypeInfoService.listComplaintTypeInfo(new ComplaintTypeInfo());
  138. //查询跟进客服集合
  139. Admin admin = new Admin();
  140. admin.setAdminStatus(1);
  141. List<Admin> adminList = sysService.listSelectAdmin(admin);
  142. //获取登录人id
  143. Integer loginAdminId = AdminUtils.getLoginAdminId();
  144. //查询客诉基本信息
  145. CustomerInfo customerInfo = customerService.getCustomerInfo(customerId);
  146. /*客诉信息处理-stast*/
  147. //对于区域处理
  148. if(customerInfo!=null && customerInfo.getCustomerArea() != null){
  149. // String[] customerAreaAndCity = customerInfo.getCustomerArea().split("-");
  150. // customerInfo.setProvinceName(customerAreaAndCity[0]);
  151. // City city
  152. // addressService.listCity(customerAreaAndCity[0]);
  153. // customerInfo.setCityName(customerAreaAndCity[0]);
  154. }
  155. /*客诉信息处理-end*/
  156. CustomerCommon customerCommon = new CustomerCommon();
  157. if(customerInfo.getCustomerIsSolve() != null){
  158. switch (customerInfo.getCustomerIsSolve()){ //处理结果: 1:已解决 2:未解决 3:换新 4:维修 5:补发 6:退货 7:无理由退货
  159. case 3://获取换新
  160. Renewed renewed = new Renewed();
  161. renewed.setCustomerId(customerInfo.getCustomerId());
  162. renewed = renewedService.getRenewed(renewed);
  163. customerCommon = customerCommon.getCustomerCommon(3,renewed);
  164. break;
  165. case 4://维修
  166. Repair repair = new Repair();
  167. repair.setCustomerId(customerInfo.getCustomerId());
  168. repair = repairService.getRepair(repair);
  169. customerCommon = customerCommon.getCustomerCommon(4,repair);
  170. break;
  171. case 5:
  172. Reissue reissue = new Reissue();
  173. reissue.setCustomerId(customerInfo.getCustomerId());
  174. reissue = reissueService.getReissue(reissue);
  175. customerCommon = customerCommon.getCustomerCommon(5,reissue);
  176. break;
  177. case 6:
  178. BackGoods backGoods = new BackGoods();
  179. backGoods.setCustomerId(customerInfo.getCustomerId());
  180. backGoods = backGoodsService.getBackGoods(backGoods);
  181. customerCommon = customerCommon.getCustomerCommon(6,backGoods);
  182. break;
  183. case 7:
  184. NoreasonBack noreasonBack = new NoreasonBack();
  185. noreasonBack.setCustomerId(customerInfo.getCustomerId());
  186. noreasonBack = noreasonBackService.getNoreasonBack(noreasonBack);
  187. customerCommon = customerCommon.getCustomerCommon(7,noreasonBack);
  188. break;
  189. }
  190. /*查询所有需要寄入寄出的产品*/
  191. customerCommon.setCustomerIsSolve(customerInfo.getCustomerIsSolve());
  192. customerCommon = customerCommonService.getListProduceAndFitting(customerCommon);
  193. mv.addObject("customerCommon", customerCommon);
  194. /*查询所有的产品,颜色和配件信息*/
  195. List<Product> productList = productService.listProduce(new Product());
  196. for(Product product : productList){
  197. ProductColor productColor = new ProductColor();
  198. productColor.setColorProductId(product.getProductId());
  199. List<ProductColor> productColorList = productService.listProduceColor(productColor);
  200. product.setColorList(productColorList);
  201. FittingsInfo fittingsInfo = new FittingsInfo();
  202. fittingsInfo.setProductId(product.getProductId());
  203. List<FittingsInfo> fittingsInfoList = fittingsInfoService.listFittings(fittingsInfo);
  204. product.setFittingsList(fittingsInfoList);
  205. }
  206. mv.addObject("productList", productList);
  207. if(customerCommon.getOrderId() != null){
  208. /*查询订单信息*/
  209. SalesOrder salesOrder = salesOrderService.getSalesOrderById(customerCommon.getOrderId());
  210. SalesOrderItem salesOrderItem = new SalesOrderItem();
  211. salesOrderItem.setItemOrderId(salesOrder.getSalesId());
  212. List<SalesOrderItem> salesOrderItemList = salesOrderService.listSalesOrderItem(salesOrderItem);
  213. salesOrder.setSalesOrderItemList(salesOrderItemList);
  214. mv.addObject("salesOrder", salesOrder);
  215. }
  216. }
  217. if ("2".equals(customerInfo.getCustomerIsVisit())){ //1:不需要回访 2:需要回访
  218. Visit visit = new Visit();
  219. visit.setCustomerId(customerInfo.getCustomerId());
  220. visit = visitService.getVisit(visit);
  221. mv.addObject("visit", visit);
  222. }
  223. //查询关联问题
  224. ComplaintQuestionInfo complaintQuestionInfo = complaintQuestionInfoService.getQuestionById(customerInfo.getQuestionId());
  225. //查询问题小类
  226. ComplaintSmallClassInfo complaintSmallClassInfo = new ComplaintSmallClassInfo();
  227. complaintSmallClassInfo.setComplaintId(complaintQuestionInfo.getComplaintId());
  228. List<ComplaintSmallClassInfo> complaintSmallClassInfoList = complaintSmallClassInfoService.listComplaintSmallClassInfo(complaintSmallClassInfo);
  229. //查询问题大类
  230. ComplaintTypeInfo complaintTypeInfo = new ComplaintTypeInfo();
  231. List<ComplaintTypeInfo> complaintTypeInfoList = complaintTypeInfoService.listComplaintTypeInfo(complaintTypeInfo);
  232. mv.addObject("customerInfo", customerInfo);
  233. mv.addObject("typeList", typeList);
  234. mv.addObject("complaintTypeList", complaintTypeList);
  235. mv.addObject("complaintTypeList", complaintTypeList);
  236. mv.addObject("adminList", adminList);
  237. mv.addObject("loginAdminId", loginAdminId);
  238. mv.addObject("complaintQuestionInfo", complaintQuestionInfo);
  239. mv.addObject("complaintSmallClassInfoList", complaintSmallClassInfoList);
  240. mv.addObject("complaintTypeInfoList", complaintTypeInfoList);
  241. //mv.addObject("questionDescribe", questionDescribe);
  242. return mv;
  243. }
  244. /**
  245. * 查询问题描述
  246. * @return
  247. */
  248. @ResponseBody
  249. @RequiresPermissions("customer:add:customer")
  250. @RequestMapping(value = "/select_question_describe")
  251. public ResponseJson selectQuestionDescribe(HttpServletRequest request, Integer customerId) throws Exception {
  252. if(customerId == null || customerId == 0){
  253. return new ResponseJson(500, "未获取到问题描述", 500);
  254. }
  255. //查询问题描述表
  256. QuestionDescribe questionDescribe = new QuestionDescribe();
  257. questionDescribe.setCustomerId(customerId);
  258. questionDescribe = questionDescribeService.listQuestionDescribe(questionDescribe).get(0);
  259. ResponseJson rj = new ResponseJson(200, "查询成功", 200);
  260. rj.addResponseKeyValue("questionDescribe", questionDescribe);
  261. return rj;
  262. }
  263. /**
  264. * 搜索订单列表弹出框
  265. *
  266. * @return
  267. */
  268. @RequiresPermissions("customer:add:customer")
  269. @RequestMapping(value = "/select_order")
  270. public ModelAndView selectOrder(HttpServletRequest request) {
  271. ModelAndView mv = new ModelAndView("cm/customer/order_list");
  272. //获取销售公司
  273. List<CompanyInfo> companyInfoList = companyInfoService.listCompanyInfo(new CompanyInfo());
  274. mv.addObject("companyInfoList", companyInfoList);
  275. return mv;
  276. }
  277. /**
  278. * 添加订单列表弹出框
  279. *
  280. * @return
  281. */
  282. @RequiresPermissions("customer:add:customer")
  283. @RequestMapping(value = "/add_order")
  284. public ModelAndView addOder(HttpServletRequest request) {
  285. ModelAndView mv = new ModelAndView("cm/customer/order_add");
  286. return mv;
  287. }
  288. /**
  289. * 添加订单
  290. *
  291. * @return
  292. */
  293. @ResponseBody
  294. @RequiresPermissions("customer:add:customer")
  295. @RequestMapping(value = "/add_order_info")
  296. public ResponseJson addOrderInfo(HttpServletRequest request, SalesOrder salesOrder, String itemJson) throws Exception {
  297. List<SalesOrderItem> list = new ArrayList<>();
  298. JSONArray jsonArray = JSONArray.fromObject(itemJson);
  299. list = (List) JSONArray.toCollection(jsonArray, SalesOrderItem.class);
  300. Integer salesAmount = 0;
  301. for (int i = 0; i < list.size(); i++) {
  302. SalesOrderItem salesOrderItem = list.get(i);
  303. if (salesOrderItem.getItemIsSource() == 1) { //产品来源 1:产品颜色表,2:配件表
  304. Product product = productService.getProductById(salesOrderItem.getItemProductId());
  305. ProductColor productColor = productService.getProduceColor(salesOrderItem.getItemProductId());
  306. salesOrderItem.setItemProductType(product.getProductType());
  307. salesOrderItem.setItemProductName(product.getProductName());
  308. salesOrderItem.setItemProductPic(productColor.getColorPicture());
  309. salesOrderItem.setItemProductColor(productColor.getColorName());
  310. salesOrderItem.setItemColorBar(productColor.getColorBar());
  311. salesOrderItem.setItemProductPrice(productColor.getColorPrice());
  312. salesOrderItem.setItemProductDiscount(productColor.getColorDiscount());
  313. salesOrderItem.setItemIsSource(1);
  314. salesAmount += productColor.getColorDiscount();
  315. } else if (salesOrderItem.getItemIsSource() == 2) {
  316. Product product = productService.getProductById(salesOrderItem.getItemProductId());
  317. FittingsInfo fittingsInfo = fittingsInfoService.getFittingsById(salesOrderItem.getItemColorId());
  318. salesOrderItem.setItemProductType(product.getProductType());
  319. salesOrderItem.setItemProductName(product.getProductName());
  320. salesOrderItem.setItemProductColor(fittingsInfo.getFittingsName());
  321. salesOrderItem.setItemColorBar(fittingsInfo.getFittingsBar());
  322. salesOrderItem.setItemProductPrice(fittingsInfo.getFittingsPrice());
  323. salesOrderItem.setItemProductDiscount(fittingsInfo.getFittingsDiscount());
  324. salesOrderItem.setItemIsSource(2);
  325. salesAmount += fittingsInfo.getFittingsDiscount();
  326. }
  327. }
  328. salesOrder.setSalesOpenId("0");
  329. salesOrder.setSalesAmount(salesAmount);
  330. salesOrder.setSalesPayMoney(salesAmount);
  331. salesOrder.setSalesOrderStatus(1);
  332. salesOrder.setSalesCreateTime(new Date());
  333. //salesOrder.setSalesPayTime(new Date());
  334. salesOrder.setSalesLastMoney(salesAmount);
  335. salesOrder.setSalesWaitMoney(0);
  336. salesOrder.setSalesPayMoney(salesAmount);
  337. salesOrder.setSalesSalesTime(new Date());
  338. salesOrder.setSalesDiscountMoney(salesAmount);
  339. salesOrder.setSalesPledgeMoney(0);
  340. salesOrder.setSalesRemainDeposit(0);
  341. salesOrder.setSalesType(1);
  342. salesOrder.setSalesStatus(1);//确认状态:0(未确认)1(确认)2(挂起)3(作废)
  343. salesOrder.setSalesShippingStatus(1); //发货状态: 0(未发货)1(已发货,即已扫描出库)3(备货中)*****+++
  344. salesOrder.setSalesPayStatus(2); //已付款
  345. salesOrder.setSalesProcessStatus(0); //单据状态:0(正常单)1(问题单)
  346. salesOrder.setSalesIsSend(0); //0:否 1:是 是否通知配货
  347. salesOrder.setSalesIsLocked(0); //是否锁定 0:否 1:是
  348. salesOrder.setSalesIsSeparate(0); //是否缺货 0:否 1:是
  349. salesOrder.setSalesShippingFee(0); //邮费
  350. Integer adminId = AdminUtils.getLoginAdminId();
  351. String orderCode = OrderNoUtil.createOrderCode(adminId);
  352. salesOrder.setSalesDealCode(orderCode);
  353. salesOrder.setSalesOrderId(orderCode);
  354. //salesOrder = salesOrderService.addOrderAndIteminfo(salesOrder,list);
  355. salesOrder.setSalesOrderItemList(list);
  356. try {
  357. Map<String, Object> map = customerService.sendEfastOrder(salesOrder);
  358. // if (map.get("status") == 1) {
  359. // salesOrder.setSalesOrderId((String) map.get("EfastOrderId"));
  360. // }
  361. } catch (RuntimeException e) {
  362. return new ResponseJson(500, "添加订单成功--"+ e.getMessage(), 500);
  363. }
  364. Integer orderId = salesOrder.getSalesId();
  365. ResponseJson rj = new ResponseJson(200, "添加订单成功", 200);
  366. rj.addResponseKeyValue("orderId", orderId);
  367. return rj;
  368. }
  369. /**
  370. * 获取店铺集合
  371. *
  372. * @param request
  373. * @param storeInfo
  374. * @return
  375. */
  376. @ResponseBody
  377. @RequiresPermissions("customer:add:customer")
  378. @RequestMapping(value = "/select_storeInfo")
  379. public ResponseJson listStoreInfo(HttpServletRequest request, StoreInfo storeInfo) {
  380. storeInfo.setStoreStatus(1);
  381. List<StoreInfo> storeInfoList = storeInfoService.listStore(storeInfo);
  382. if (storeInfoList == null || storeInfoList.size() < 1) {
  383. return new ResponseJson(500, "查询失败", 500);
  384. } else {
  385. ResponseJson rj = new ResponseJson(200, "查询成功", 200);
  386. rj.addResponseKeyValue("storeInfoList", storeInfoList);
  387. return rj;
  388. }
  389. }
  390. /**
  391. * 获取订单集合
  392. *
  393. * @param request
  394. * @param salesOrder
  395. * @return
  396. */
  397. @ResponseBody
  398. @RequiresPermissions("customer:add:customer")
  399. @RequestMapping(value = "/select_salesOrder")
  400. public ResponseJson listOrder(HttpServletRequest request, SalesOrder salesOrder,
  401. @RequestParam(value = "pageSize", defaultValue = "10", required = false) Integer pageSize,
  402. @RequestParam(value = "pageNO", defaultValue = "1", required = false) Integer pageNO,
  403. @RequestParam(value = "totalNum", defaultValue = "0", required = false) Integer totalNum) {
  404. //分页获取订单信息
  405. PagedResult<SalesOrder> pagedResult = salesOrderService.listSalesOrderPage(pageNO, pageSize, salesOrder, totalNum == 0);
  406. List<SalesOrder> salesOrderList = pagedResult.getDataList();
  407. for (SalesOrder order : salesOrderList) {
  408. SalesOrderItem salesOrderItem = new SalesOrderItem();
  409. salesOrderItem.setItemOrderId(order.getSalesId());
  410. List<SalesOrderItem> salesOrderItemList = salesOrderService.listSalesOrderItem(salesOrderItem);
  411. order.setSalesOrderItemList(salesOrderItemList);
  412. }
  413. if (salesOrderList == null || salesOrderList.size() < 1) {
  414. return new ResponseJson(500, "查询失败", 500);
  415. } else {
  416. ResponseJson rj = new ResponseJson(200, "查询成功", 200);
  417. rj.addResponseKeyValue("salesOrderList", salesOrderList);
  418. return rj;
  419. }
  420. }
  421. /**
  422. * 分页查询客诉列表信息
  423. *
  424. * @param request
  425. * @param customerInfo
  426. * @param pageSize
  427. * @param pageNO
  428. * @param totalNum
  429. * @return
  430. * @throws Exception
  431. */
  432. @RequiresPermissions("customer:select:customer")
  433. @RequestMapping("/select_customer_list")
  434. public ModelAndView selectCustomerList(HttpServletRequest request, CustomerInfo customerInfo,
  435. @RequestParam(value = "isFirst", defaultValue = "1", required = false) Integer isFirst,
  436. @RequestParam(value = "pageSize", defaultValue = "10", required = false) Integer pageSize,
  437. @RequestParam(value = "pageNO", defaultValue = "1", required = false) Integer pageNO,
  438. @RequestParam(value = "totalNum", defaultValue = "0", required = false) Integer totalNum) throws Exception {
  439. ModelAndView mv = new ModelAndView("cm/customer/custome_list");
  440. if(customerInfo.getAdminId() == null && isFirst == 1){
  441. //获取登录员工id
  442. Integer adminId = AdminUtils.getLoginAdminId();
  443. customerInfo.setAdminId(adminId);
  444. isFirst = 2;
  445. }
  446. PagedResult<CustomerInfo> pagedResult = customerService.listCustomer(pageNO, pageSize, customerInfo, totalNum == 0);
  447. if (totalNum != 0) {
  448. pagedResult.setTotal(totalNum);
  449. }
  450. ProductType productType = new ProductType();
  451. //查询产品类型集合
  452. List<ProductType> typeList = productService.listProductType(productType);
  453. //查询客诉类型集合
  454. List<ComplaintTypeInfo> complaintTypeList = complaintTypeInfoService.listComplaintTypeInfo(new ComplaintTypeInfo());
  455. //查询跟进客服集合
  456. Admin admin = new Admin();
  457. admin.setAdminStatus(1);
  458. List<Admin> adminList = sysService.listSelectAdmin(admin);
  459. //获取登录人id
  460. Integer loginAdminId = AdminUtils.getLoginAdminId();
  461. mv.addObject("loginAdminId", loginAdminId);
  462. mv.addObject("typeList", typeList);
  463. mv.addObject("complaintTypeList", complaintTypeList);
  464. mv.addObject("adminList", adminList);
  465. mv.addObject("isFirst", isFirst);
  466. customerInfo.setVisit(null);
  467. customerInfo.setCustomerCommon(null);
  468. customerInfo.setComplaintDetectList(null);
  469. StitchAttrUtil.setModelAndView(customerInfo, mv, "/admin/customer/select_customer_list", pagedResult);
  470. return mv;
  471. }
  472. /**
  473. * 进入客诉基本信息页面
  474. *
  475. * @param request
  476. * @return
  477. * @throws Exception
  478. */
  479. @RequiresPermissions("customer:select:customer")
  480. @RequestMapping("/_customer_info")
  481. public ModelAndView toCustomerInfo(HttpServletRequest request) throws Exception {
  482. ModelAndView mv = new ModelAndView("cm/customer/custome_detail");
  483. String customerId = request.getParameter("customerId");
  484. mv.addObject("customerId", customerId);
  485. return mv;
  486. }
  487. /**
  488. * 查询客诉基本信息
  489. *
  490. * @param request
  491. * @return
  492. * @throws Exception
  493. */
  494. @ResponseBody
  495. @RequiresPermissions("customer:select:customer")
  496. @RequestMapping("/get_customer_info")
  497. public ResponseJson getCustomerInfo(HttpServletRequest request) throws Exception {
  498. String customerId = request.getParameter("customerId");
  499. if (!StringUtils.isNotEmpty(customerId)) {
  500. return new ResponseJson(500, "该客诉信息不存在!", 500);
  501. }
  502. CustomerInfo customerInfo = new CustomerInfo();
  503. customerInfo.setCustomerId(Integer.parseInt(customerId));
  504. Map<String, Object> map = customerService.getCustomerInfo(customerInfo);
  505. ResponseJson rj = new ResponseJson(200, "修改成功!", 200);
  506. rj.addResponseKeyValue("customerCommon", map.get("customerCommon"));
  507. rj.addResponseKeyValue("customer", map.get("customer"));
  508. rj.addResponseKeyValue("salesOrder", map.get("salesOrder"));
  509. return rj;
  510. }
  511. /**
  512. * 进入添加回访页面
  513. *
  514. * @param request
  515. * @return
  516. * @throws Exception
  517. */
  518. @RequiresPermissions("customer:select:customer")
  519. @RequestMapping("/_add_visit")
  520. public ModelAndView toAddVisit(HttpServletRequest request) throws Exception {
  521. ModelAndView mv = new ModelAndView("cm/customer/add_visit");
  522. String customerId = request.getParameter("customerId");
  523. //查询跟进客服集合
  524. Admin admin = new Admin();
  525. admin.setAdminStatus(1);
  526. List<Admin> adminList = sysService.listSelectAdmin(admin);
  527. //获取登录人id
  528. Integer loginAdminId = AdminUtils.getLoginAdminId();
  529. mv.addObject("loginAdminId", loginAdminId);
  530. mv.addObject("customerId", customerId);
  531. mv.addObject("adminList", adminList);
  532. return mv;
  533. }
  534. /**
  535. * 添加回访信息
  536. *
  537. * @param request
  538. * @param visit
  539. * @return
  540. */
  541. @ResponseBody
  542. @RequiresPermissions("customer:add:visit")
  543. @RequestMapping("/add_visit_info")
  544. public ResponseJson addVisitInfo(HttpServletRequest request, Visit visit) throws Exception {
  545. String visitAdminId = request.getParameter("visitAdminId");
  546. if (!StringUtils.isNotEmpty(visitAdminId)) {
  547. return new ResponseJson(500, "请选择回访人!", 500);
  548. }
  549. Integer loginAdminId = AdminUtils.getLoginAdminId();
  550. visit.setAdminId(loginAdminId);
  551. visit.setDesignatedAdminId(Integer.parseInt(visitAdminId));
  552. visit.setVisitStatus(1);
  553. visit.setVisitCreateTime(new Date());
  554. int num = visitService.addVisitInfo(visit, visit.getCustomerId());
  555. if (num > 0) {
  556. return new ResponseJson(200, "修改成功!", 200);
  557. } else {
  558. return new ResponseJson(500, "修改失败!", 500);
  559. }
  560. }
  561. /**
  562. * 修改客诉状态为已解决
  563. *
  564. * @param request
  565. * @return
  566. */
  567. @ResponseBody
  568. @RequiresPermissions("customer:update:customerIsSolve")
  569. @RequestMapping("/update_customerIsSolve")
  570. public ResponseJson updateCustomerIsSolve(HttpServletRequest request) throws Exception {
  571. String customerId = request.getParameter("customerId");
  572. if (!StringUtils.isNotEmpty(customerId)) {
  573. return new ResponseJson(500, "该客诉信息不存在!", 500);
  574. }
  575. //根据id获取客诉信息
  576. CustomerInfo customer = customerService.getCustomerInfo(Integer.parseInt(customerId));
  577. if (customer == null) {
  578. return new ResponseJson(500, "该客诉信息不存在!", 500);
  579. }
  580. if (customer.getCustomerIsSolve().intValue() != 2) {
  581. return new ResponseJson(500, "该客诉信息不能修改为已解决状态!", 500);
  582. }
  583. CustomerInfo customerInfo = new CustomerInfo();
  584. customerInfo.setCustomerId(Integer.parseInt(customerId));
  585. customerInfo.setCustomerIsSolve(1);
  586. //修改客诉信息
  587. int num = customerService.updateCustomerInfo(customerInfo);
  588. if (num > 0) {
  589. return new ResponseJson(200, "修改成功!", 200);
  590. } else {
  591. return new ResponseJson(500, "修改失败!", 500);
  592. }
  593. }
  594. /**
  595. * 查询客服
  596. *
  597. * @param request
  598. * @return
  599. */
  600. @ResponseBody
  601. @RequiresPermissions("customer:add:customer")
  602. @RequestMapping("/select_sys_admin")
  603. public ResponseJson selectSysAdmin(HttpServletRequest request) throws Exception {
  604. ResponseJson rj = new ResponseJson(200, "修改成功!", 200);
  605. Integer adminId = AdminUtils.getLoginAdminId();
  606. Admin admin = new Admin();
  607. List<Admin> adminList = sysService.listSelectAdmin(admin);
  608. if (adminList.size() > 0) {
  609. rj.addResponseKeyValue("adminList", adminList);
  610. rj.addResponseKeyValue("adminId", adminId);
  611. return rj;
  612. } else {
  613. return new ResponseJson(500, "查询失败!", 500);
  614. }
  615. }
  616. /**
  617. * 查询产品类型
  618. *
  619. * @param request
  620. * @return
  621. */
  622. @ResponseBody
  623. @RequiresPermissions("customer:add:customer")
  624. @RequestMapping("/select_produce_type")
  625. public ResponseJson selectProduceType(HttpServletRequest request) throws Exception {
  626. ResponseJson rj = new ResponseJson(200, "修改成功!", 200);
  627. ProductType productType = new ProductType();
  628. productType.setTypeStatus(1);
  629. List<ProductType> productTypeList = productService.listProductType(productType);
  630. if (productTypeList != null && productTypeList.size() > 0) {
  631. rj.addResponseKeyValue("productTypeList", productTypeList);
  632. return rj;
  633. } else {
  634. return new ResponseJson(500, "查询失败!", 500);
  635. }
  636. }
  637. /**
  638. * 查询产品
  639. *
  640. * @param request
  641. * @return
  642. */
  643. @ResponseBody
  644. @RequiresPermissions("customer:add:customer")
  645. @RequestMapping("/select_produce")
  646. public ResponseJson selectProduce(HttpServletRequest request) {
  647. ResponseJson rj = new ResponseJson(200, "查询成功!", 200);
  648. Product product = new Product();
  649. List<Product> productList = productService.listProduce(product);
  650. for (Product pro : productList) {
  651. ProductColor productColor = new ProductColor();
  652. productColor.setColorProductId(pro.getProductId());
  653. List<ProductColor> productColorList = productService.listProduceColor(productColor);
  654. pro.setColorList(productColorList);
  655. }
  656. if (productList != null && productList.size() > 0) {
  657. rj.addResponseKeyValue("productList", productList);
  658. return rj;
  659. } else {
  660. return new ResponseJson(500, "查询失败!", 500);
  661. }
  662. }
  663. /**
  664. * 查询产品
  665. *
  666. * @param request
  667. * @return
  668. */
  669. @ResponseBody
  670. @RequiresPermissions("customer:add:customer")
  671. @RequestMapping("/select_produce_fittings")
  672. public ResponseJson selectProduceFittings(HttpServletRequest request, FittingsInfo fittingsInfo) {
  673. ResponseJson rj = new ResponseJson(200, "查询成功!", 200);
  674. List<FittingsInfo> produceFittingsList = fittingsInfoService.listFittings(fittingsInfo);
  675. if (produceFittingsList != null && produceFittingsList.size() > 0) {
  676. rj.addResponseKeyValue("produceFittingsList", produceFittingsList);
  677. return rj;
  678. } else {
  679. return new ResponseJson(500, "查询失败!", 500);
  680. }
  681. }
  682. /**
  683. * 添加客诉
  684. *
  685. * @param request
  686. * @return
  687. */
  688. @ResponseBody
  689. @RequiresPermissions("customer:add:customer")
  690. @RequestMapping("/save_customer")
  691. public ResponseJson addCustomer(HttpServletRequest request, CustomerInfo customerInfo, SalesOrder salesOrder, CustomerCommon customerCommon,
  692. String sendProdcuesJson, String sendFittingsJson, String closedProdcuesJson, String closedFittingsJson) throws Exception {
  693. ResponseJson rjx = this.isValiData(customerInfo);
  694. if(rjx.getResultCode() == 500){
  695. return rjx;
  696. }
  697. Integer flag = 0;
  698. JSONArray jsonArray;
  699. List<SendProdcue> sendProdcueList;
  700. List<SendFitting> sendFittingList;
  701. List<ClosedProdcue> closedProdcueList;
  702. List<ClosedFitting> closedFittingList;
  703. Integer customerIsSolve = customerInfo.getCustomerIsSolve(); //处理类型
  704. String phone = customerInfo.getCustomerTel(); //手机号码
  705. Integer typeCompany = customerInfo.getTypeCompany(); // 所属商城 1:美国watero; 2:上朵电动牙刷 3:优尼雅净水机
  706. jsonArray = JSONArray.fromObject(sendProdcuesJson);
  707. sendProdcueList = (List) JSONArray.toCollection(jsonArray, SendProdcue.class);
  708. jsonArray = JSONArray.fromObject(sendFittingsJson);
  709. sendFittingList = (List) JSONArray.toCollection(jsonArray, SendFitting.class);
  710. jsonArray = JSONArray.fromObject(closedProdcuesJson);
  711. closedProdcueList = (List) JSONArray.toCollection(jsonArray, ClosedProdcue.class);
  712. jsonArray = JSONArray.fromObject(closedFittingsJson);
  713. closedFittingList = (List) JSONArray.toCollection(jsonArray, ClosedFitting.class);
  714. customerCommon.setSendProdcues(sendProdcueList);
  715. customerCommon.setSendFittings(sendFittingList);
  716. customerCommon.setClosedProdcues(closedProdcueList);
  717. customerCommon.setClosedFittings(closedFittingList);
  718. customerInfo.setCustomerCommon(customerCommon);
  719. String orderId = "";
  720. if (customerInfo.getCustomerIsSolve() == 3 || customerInfo.getCustomerIsSolve() == 4 || customerInfo.getCustomerIsSolve() == 5) {
  721. Integer adminId = AdminUtils.getLoginAdminId();
  722. orderId = OrderNoUtil.createOrderCode(adminId);
  723. }
  724. customerInfo.setTransactionNumber(orderId);
  725. Integer customerId = customerInfo.getCustomerId();
  726. logger.info("-----------------添加客诉开始----------------------");
  727. try {
  728. flag = customerService.saveCustomerInfo(customerInfo, salesOrder);
  729. } catch (RuntimeException e) {
  730. return new ResponseJson(500, e.getMessage(), 500);
  731. }
  732. customerId = customerInfo.getCustomerId();
  733. logger.info("-----------------添加客诉结束----------------------");
  734. if (flag < 1) {
  735. return new ResponseJson(500, "添加客诉失败!", 500);
  736. }
  737. String msg = "";
  738. //处理结果: 1:已解决 2:未解决 3:换新 4:维修 5:补发 6:退货 7:无理由退货
  739. if (customerIsSolve == 3 || customerIsSolve == 4 || customerIsSolve == 5 || customerIsSolve == 6 || customerIsSolve == 7) {
  740. String solveMsg = "";
  741. switch (customerIsSolve) {
  742. case 3:
  743. solveMsg = "为您更换新机";
  744. break;
  745. case 4:
  746. solveMsg = "为您维修机器";
  747. break;
  748. case 5:
  749. solveMsg = "为您补发产品";
  750. break;
  751. case 6:
  752. solveMsg = "为您办理退货";
  753. break;
  754. case 7:
  755. solveMsg = "为您办理退货";
  756. break;
  757. }
  758. String addCustomerSuccessMsg = "";
  759. String typeMsg = "";
  760. switch (typeCompany) {
  761. case 1:
  762. addCustomerSuccessMsg = SmsConfig.ADD_CUSTOMER_SUCCESS_WATERO;
  763. typeMsg = "美国WaterO售后";
  764. break;
  765. case 2:
  766. addCustomerSuccessMsg = SmsConfig.ADD_CUSTOMER_SUCCESS_SHANGDUO;
  767. typeMsg = "上朵售后";
  768. break;
  769. case 3:
  770. addCustomerSuccessMsg = SmsConfig.ADD_CUSTOMER_SUCCESS_YULIA;
  771. typeMsg = "YULIA售后";
  772. break;
  773. case 4:
  774. addCustomerSuccessMsg = SmsConfig.ADD_CUSTOMER_SUCCESS_AIBERLE;
  775. typeMsg = "爱贝源售后";
  776. break;
  777. }
  778. // Object [] msg = new Object[]{solveMsg,typeMsg};
  779. // String text = MessageFormat.format(addCustomerSuccessMsg, msg);
  780. // logger.info("添加客诉成功后,给 "+ phone +" 手机用户发送短信:" + text );
  781. // String result = smsService.sendOtherCMS(phone, text);
  782. //
  783. // if (!"SUCCESS".equals(result)) {
  784. // return new ResponseJson(505, "添加客诉发送短信失败,失败原因:" + result + "<br>客诉信息发送失败并不影响客诉添加。客诉编号为:"+ customerId, 505);
  785. // }
  786. msg = ",请前往Efast进行换货/退货操作。";
  787. }
  788. return new ResponseJson(200, "录入客诉成功!客诉编号:" + customerId + msg, 200);
  789. }
  790. /**
  791. * 修改客诉
  792. *
  793. * @param request
  794. * @return
  795. */
  796. @ResponseBody
  797. @RequiresPermissions("customer:update:customer")
  798. @RequestMapping("/update_customer")
  799. public ResponseJson updateCustomer(HttpServletRequest request, CustomerInfo customerInfo, SalesOrder salesOrder, CustomerCommon customerCommon,
  800. String sendProdcuesJson, String sendFittingsJson, String closedProdcuesJson, String closedFittingsJson) throws Exception {
  801. ResponseJson rjx = this.isValiData(customerInfo);
  802. if(rjx.getResultCode() == 500){
  803. return rjx;
  804. }
  805. Integer flag = 0;
  806. JSONArray jsonArray;
  807. List<SendProdcue> sendProdcueList;
  808. List<SendFitting> sendFittingList;
  809. List<ClosedProdcue> closedProdcueList;
  810. List<ClosedFitting> closedFittingList;
  811. Integer customerIsSolve = customerInfo.getCustomerIsSolve(); //处理类型
  812. String phone = customerInfo.getCustomerTel(); //手机号码
  813. Integer typeCompany = customerInfo.getTypeCompany(); // 所属商城 1:美国watero; 2:上朵电动牙刷 3:优尼雅净水机
  814. jsonArray = JSONArray.fromObject(sendProdcuesJson);
  815. sendProdcueList = (List) JSONArray.toCollection(jsonArray, SendProdcue.class);
  816. jsonArray = JSONArray.fromObject(sendFittingsJson);
  817. sendFittingList = (List) JSONArray.toCollection(jsonArray, SendFitting.class);
  818. jsonArray = JSONArray.fromObject(closedProdcuesJson);
  819. closedProdcueList = (List) JSONArray.toCollection(jsonArray, ClosedProdcue.class);
  820. jsonArray = JSONArray.fromObject(closedFittingsJson);
  821. closedFittingList = (List) JSONArray.toCollection(jsonArray, ClosedFitting.class);
  822. customerCommon.setSendProdcues(sendProdcueList);
  823. customerCommon.setSendFittings(sendFittingList);
  824. customerCommon.setClosedProdcues(closedProdcueList);
  825. customerCommon.setClosedFittings(closedFittingList);
  826. customerInfo.setCustomerCommon(customerCommon);
  827. String orderId = "";
  828. if (customerInfo.getCustomerIsSolve() == 3 || customerInfo.getCustomerIsSolve() == 4 || customerInfo.getCustomerIsSolve() == 5) {
  829. Integer adminId = AdminUtils.getLoginAdminId();
  830. orderId = OrderNoUtil.createOrderCode(adminId);
  831. }
  832. customerInfo.setTransactionNumber(orderId);
  833. Integer customerId = customerInfo.getCustomerId();
  834. logger.info("-----------------修改客诉开始----------------------");
  835. try {
  836. flag = customerService.updateCustomerInfo(customerInfo, salesOrder);
  837. } catch (RuntimeException e) {
  838. return new ResponseJson(500, e.getMessage(), 500);
  839. }
  840. customerId = customerInfo.getCustomerId();
  841. logger.info("-----------------修改客诉结束----------------------");
  842. if (flag < 1) {
  843. return new ResponseJson(500, "修改客诉失败!", 500);
  844. }
  845. return new ResponseJson(200, "修改客诉成功!客诉编号为:" + customerId, 200);
  846. }
  847. /**
  848. * 验证方法
  849. *
  850. * @param customerInfo
  851. * @return
  852. */
  853. public ResponseJson isValiData(CustomerInfo customerInfo) {
  854. ResponseJson rj = new ResponseJson();
  855. if(customerInfo.getAdminId() == null){
  856. return new ResponseJson(500, "未填写客诉id", 500);
  857. }
  858. return rj;
  859. }
  860. /**
  861. * 发送短信
  862. *
  863. * @param request
  864. * @return
  865. */
  866. @ResponseBody
  867. @RequiresPermissions("customer:add:customer")
  868. @RequestMapping("/send_phone_sms")
  869. public ResponseJson sendPhoneSms(HttpServletRequest request, String type, String phone, Integer typeCompany, ComplaintQuestionInfo complaintQuestionInfo) throws Exception {
  870. String url = NameUtils.getConfig("website");
  871. Integer flag = 1;
  872. if (typeCompany == null || typeCompany == 0) {
  873. return new ResponseJson(500, "未获取到产品类型!", 500);
  874. }
  875. String con = "";
  876. if (type != null && !"".equals(type)) {
  877. if ("p".equals(type)) { //problem" 问题处理; mailAddress:邮寄地址;
  878. if (complaintQuestionInfo.getQuestionId() == null || "".equals(complaintQuestionInfo.getQuestionId())) {
  879. complaintQuestionInfo.setQuestionState(1);
  880. complaintQuestionInfo.setQuestionIsQcDetect(0);
  881. complaintQuestionInfo = complaintQuestionInfoService.insertBackInfo(complaintQuestionInfo);
  882. } else {
  883. complaintQuestionInfo.setSmallClassId(null); //不能修改小类类型
  884. flag = complaintQuestionInfoService.updateQuestionById(complaintQuestionInfo);
  885. if (flag < 1) {
  886. return new ResponseJson(500, "问题修改失败!", 500);
  887. }
  888. }
  889. url += "/" + complaintQuestionInfo.getQuestionId();
  890. switch (typeCompany) {
  891. case 1:
  892. con = SmsConfig.SEND_PRODUCT_SEND_WATERO;
  893. break;
  894. case 2:
  895. con = SmsConfig.SEND_PRODUCT_SEND_SHANGDUO;
  896. break;
  897. case 3:
  898. con = SmsConfig.SEND_PRODUCT_SEND_YULIA;
  899. break;
  900. case 4:
  901. con = SmsConfig.SEND_PRODUCT_SEND_AIBERLE;
  902. break;
  903. }
  904. } else if ("m".equals(type)) {
  905. if (complaintQuestionInfo.getQuestionId() == null) {
  906. return new ResponseJson(500, "未获取到邮寄信息!", 500);
  907. }
  908. complaintQuestionInfo.setQuestionName(null);
  909. complaintQuestionInfo.setSmallClassId(null);
  910. url += "/5";
  911. switch (typeCompany) {
  912. case 1:
  913. con = SmsConfig.SEND_PRODUCT_SMS_WATERO;
  914. break;
  915. case 2:
  916. con = SmsConfig.SEND_PRODUCT_SMS_SHANGDUO;
  917. break;
  918. case 3:
  919. con = SmsConfig.SEND_PRODUCT_SMS_YULIA;
  920. break;
  921. case 4:
  922. con = SmsConfig.SEND_PRODUCT_SMS_AIBERLE;
  923. break;
  924. }
  925. }
  926. }
  927. String userPhone = encodePhoneNumber(phone);
  928. String text = MessageFormat.format(con, url);
  929. logger.info("给 " + phone + " 手机用户发送短信:" + text);
  930. String result = smsService.sendOtherCMS(phone, text);
  931. if ("SUCCESS".equals(result)) {
  932. return new ResponseJson(200, "发送短信成功!", 200);
  933. } else {
  934. return new ResponseJson(500, "发送短信失败,失败原因:" + result, 500);
  935. }
  936. }
  937. String encodePhoneNumber(String number)
  938. {
  939. int encnum = Integer.parseInt(number.substring(2));
  940. int prefix = (number.charAt(1) - '2') /2; // '3'=>0, '5'=>1, '[67]'=>2, '8'=>3
  941. encnum |= (prefix <<= 30);
  942. final byte[] raw = new byte[4];
  943. raw[0] = (byte)(encnum >>> 24);
  944. raw[1] = (byte)(encnum >>> 16);
  945. raw[2] = (byte)(encnum >>> 8);
  946. raw[3] = (byte) encnum;
  947. return Base64.encodeBase64URLSafeString(raw);
  948. }
  949. /**
  950. * 进入回访完成页面
  951. *
  952. * @param request
  953. * @return
  954. * @throws Exception
  955. */
  956. @RequiresPermissions("customer:update:visit")
  957. @RequestMapping("/_update_visit_info")
  958. public ModelAndView toUpdateVisitFinish(HttpServletRequest request) throws Exception {
  959. ModelAndView mv = new ModelAndView("cm/customer/visit_finish");
  960. String customerId = request.getParameter("customerId");
  961. mv.addObject("customerId", customerId);
  962. return mv;
  963. }
  964. /**
  965. * 添加回访完成内容
  966. *
  967. * @param request
  968. * @param visit
  969. * @return
  970. */
  971. @ResponseBody
  972. @RequiresPermissions("customer:update:visit")
  973. @RequestMapping("/update_visit_finish")
  974. public ResponseJson updateVisitFinish(HttpServletRequest request, Visit visit) throws Exception {
  975. String customerId = request.getParameter("finish_customerId");
  976. if (!StringUtils.isNotEmpty(customerId)) {
  977. return new ResponseJson(500, "该客诉信息不存在!", 500);
  978. }
  979. visit.setCustomerId(Integer.parseInt(customerId));
  980. visit.setVisitStatus(2);
  981. //修改回访信息内容
  982. int num = visitService.updateVisit(visit);
  983. if (num > 0) {
  984. return new ResponseJson(200, "添加成功!", 200);
  985. } else {
  986. return new ResponseJson(500, "添加失败!", 500);
  987. }
  988. }
  989. /**
  990. * 进入回访信息详情
  991. *
  992. * @param request
  993. * @return
  994. * @throws Exception
  995. */
  996. @RequiresPermissions("customer:get:visit")
  997. @RequestMapping("/_visit_info")
  998. public ModelAndView toVisitInfo(HttpServletRequest request) throws Exception {
  999. ModelAndView mv = new ModelAndView("cm/customer/visit_detail");
  1000. String customerId = request.getParameter("customerId");
  1001. // 1:未回访,2:已回访
  1002. String num = request.getParameter("num");
  1003. if (!StringUtils.isNotEmpty(num)) {
  1004. num = "2";
  1005. }
  1006. mv.addObject("customerId", customerId);
  1007. mv.addObject("num", num);
  1008. return mv;
  1009. }
  1010. /**
  1011. * 获取回访信息详情
  1012. *
  1013. * @param request
  1014. * @return
  1015. */
  1016. @ResponseBody
  1017. @RequiresPermissions("customer:get:visit")
  1018. @RequestMapping("/get_visit_info")
  1019. public ResponseJson getVisitInfo(HttpServletRequest request) throws Exception {
  1020. String customerId = request.getParameter("customerId");
  1021. if (!StringUtils.isNotEmpty(customerId)) {
  1022. return new ResponseJson(500, "该客诉信息不存在!", 500);
  1023. }
  1024. Visit visit = new Visit();
  1025. visit.setCustomerId(Integer.parseInt(customerId));
  1026. //查询回访信息集合
  1027. List<Visit> visitList = visitService.listVisit(visit);
  1028. if (visitList == null || visitList.size() == 0) {
  1029. return new ResponseJson(500, "该客诉没有回访信息!", 500);
  1030. }
  1031. visit = visitList.get(0);
  1032. ResponseJson rj = new ResponseJson(200, "查询成功", 200);
  1033. rj.addResponseKeyValue("visit", visit);
  1034. return rj;
  1035. }
  1036. /**
  1037. * 进入问题描述页面
  1038. *
  1039. * @param request
  1040. * @return
  1041. * @throws Exception
  1042. */
  1043. @RequiresPermissions("customer:get:describe")
  1044. @RequestMapping("/_question_describe")
  1045. public ModelAndView toQuestionDescribe(HttpServletRequest request) throws Exception {
  1046. ModelAndView mv = new ModelAndView("cm/customer/describe_detail");
  1047. String customerId = request.getParameter("customerId");
  1048. mv.addObject("customerId", customerId);
  1049. return mv;
  1050. }
  1051. /**
  1052. * 获取问题描述信息
  1053. *
  1054. * @param request
  1055. * @return
  1056. */
  1057. @ResponseBody
  1058. @RequiresPermissions("customer:get:describe")
  1059. @RequestMapping("/get_describe_info")
  1060. public ResponseJson getDescribeInfo(HttpServletRequest request) throws Exception {
  1061. String customerId = request.getParameter("customerId");
  1062. if (!StringUtils.isNotEmpty(customerId)) {
  1063. return new ResponseJson(500, "该客诉信息不存在!", 500);
  1064. }
  1065. QuestionDescribe describe = new QuestionDescribe();
  1066. describe.setCustomerId(Integer.parseInt(customerId));
  1067. //查询问题集合
  1068. List<QuestionDescribe> questionList = questionDescribeService.listQuestionDescribe(describe);
  1069. if (questionList == null || questionList.size() == 0) {
  1070. return new ResponseJson(500, "该客诉信息没有问题描述!", 500);
  1071. }
  1072. describe = questionList.get(0);
  1073. ResponseJson rj = new ResponseJson(200, "查询成功", 200);
  1074. rj.addResponseKeyValue("describe", describe);
  1075. return rj;
  1076. }
  1077. /**
  1078. * 进入修改换新页面
  1079. *
  1080. * @param request
  1081. * @return
  1082. * @throws Exception
  1083. */
  1084. @RequiresPermissions("customer:update:renewed")
  1085. @RequestMapping("/_update_renewed")
  1086. public ModelAndView toUpdateRenewed(HttpServletRequest request) throws Exception {
  1087. ModelAndView mv = new ModelAndView("cm/customer/update_renewed");
  1088. String customerId = request.getParameter("customerId");
  1089. mv.addObject("customerId", customerId);
  1090. return mv;
  1091. }
  1092. /**
  1093. * 获取换新详情
  1094. *
  1095. * @param request
  1096. * @return
  1097. */
  1098. @ResponseBody
  1099. @RequiresPermissions("customer:get:renewed")
  1100. @RequestMapping("/get_renewed_info")
  1101. public ResponseJson getRenewedInfo(HttpServletRequest request) throws Exception {
  1102. String customerId = request.getParameter("customerId");
  1103. if (!StringUtils.isNotEmpty(customerId)) {
  1104. return new ResponseJson(500, "该客诉信息不存在!", 500);
  1105. }
  1106. Renewed renewed = new Renewed();
  1107. renewed.setCustomerId(Integer.parseInt(customerId));
  1108. renewed.setRenewedState(1);
  1109. //获取换新详情和检测信息
  1110. renewed = customerService.getRenewedInfo(renewed);
  1111. if (renewed == null) {
  1112. return new ResponseJson(500, "该客诉没有换新信息!", 500);
  1113. } else {
  1114. ResponseJson rj = new ResponseJson(200, "查询成功", 200);
  1115. rj.addResponseKeyValue("renewed", renewed);
  1116. return rj;
  1117. }
  1118. }
  1119. /**
  1120. * 修改换新信息
  1121. *
  1122. * @param request
  1123. * @param renewed
  1124. * @return
  1125. * @throws Exception
  1126. */
  1127. @ResponseBody
  1128. @RequiresPermissions("customer:update:renewed")
  1129. @RequestMapping("/update_renewed_info")
  1130. public ResponseJson updateRenewedInfo(HttpServletRequest request, Renewed renewed) throws Exception {
  1131. /*String closedProducts = request.getParameter("closed_products");
  1132. String closedFittings = request.getParameter("closed_fittings");*/
  1133. String mergeAddress = request.getParameter("merge_address");
  1134. if (!StringUtils.isNotEmpty(renewed.getRenewedId().toString())) {
  1135. return new ResponseJson(500, "该换新信息不能修改!", 500);
  1136. }
  1137. // if (StringUtils.isNotEmpty(renewed.getRenewedBackPostage().toString())) {
  1138. // renewed.setRenewedBackPostage(renewed.getRenewedBackPostage().intValue() * 100);
  1139. // }
  1140. /*if (!StringUtils.isNotEmpty(renewed.getRenewedBackEfastOrderId())) {
  1141. return new ResponseJson(500, "请输入efast订单号!", 500);
  1142. }*/
  1143. if (StringUtils.isNotEmpty(mergeAddress)) {
  1144. renewed.setRenewedSendMergeAddress(mergeAddress);
  1145. }
  1146. if(renewed.getRenewedBackStatus() != null){
  1147. if(renewed.getRenewedBackStatus() != 1){
  1148. ComplaintSignclosedInfo cs = new ComplaintSignclosedInfo();
  1149. cs.setSignclosedCustomerId(renewed.getCustomerId());
  1150. cs.setSignclosedLogistics(renewed.getRenewedBackLogisticsCompany());
  1151. cs.setSignclosedLogisticsNumber(renewed.getRenewedBackLogisticsNo());
  1152. complaintSignclosedInfoService.updateSignclosedByCustomerId(cs);
  1153. }
  1154. }
  1155. //修改换新信息
  1156. int num = renewedService.updateRenewedInfo(renewed, null, null);
  1157. if (num > 0) {
  1158. return new ResponseJson(200, "修改成功!", 200);
  1159. } else {
  1160. return new ResponseJson(500, "修改失败!", 500);
  1161. }
  1162. }
  1163. /**
  1164. * 进入修改维修页面
  1165. *
  1166. * @param request
  1167. * @return
  1168. * @throws Exception
  1169. */
  1170. @RequiresPermissions("customer:update:repair")
  1171. @RequestMapping("/_to_update_repair")
  1172. public ModelAndView toUpdateRepair(HttpServletRequest request) throws Exception {
  1173. ModelAndView mv = new ModelAndView("cm/customer/update_repair");
  1174. String customerId = request.getParameter("customerId");
  1175. mv.addObject("customerId", customerId);
  1176. return mv;
  1177. }
  1178. /**
  1179. * 进入修改维修页面
  1180. *
  1181. * @param request
  1182. * @return
  1183. * @throws Exception
  1184. */
  1185. @ResponseBody
  1186. @RequiresPermissions("customer:update:repair")
  1187. @RequestMapping("/_update_repair")
  1188. public ResponseJson updateRepairUI(HttpServletRequest request) throws Exception {
  1189. String customerId = request.getParameter("customerId");
  1190. if (!StringUtils.isNotEmpty(customerId)) {
  1191. return new ResponseJson(500, "该客诉信息不存在!", 500);
  1192. }
  1193. Repair repair = new Repair();
  1194. repair.setCustomerId(Integer.parseInt(customerId));
  1195. repair.setRepairState(1);
  1196. //获取维修详情和品质检测信息
  1197. repair = customerService.getRepairInfo(repair);
  1198. if (repair == null) {
  1199. return new ResponseJson(500, "该客诉没有维修信息!", 500);
  1200. } else {
  1201. ResponseJson rj = new ResponseJson(200, "查询成功", 200);
  1202. rj.addResponseKeyValue("repair", repair);
  1203. return rj;
  1204. }
  1205. }
  1206. /**
  1207. * 修改维修处理信息
  1208. *
  1209. * @param request
  1210. * @param repair
  1211. * @return
  1212. * @throws Exception
  1213. */
  1214. @ResponseBody
  1215. @RequiresPermissions("customer:update:repair")
  1216. @RequestMapping("/update_repair_info")
  1217. public ResponseJson updateRepairInfo(HttpServletRequest request, Repair repair) throws Exception {
  1218. if (!StringUtils.isNotEmpty(repair.getRepairId().toString())) {
  1219. return new ResponseJson(500, "该换新信息不能修改!", 500);
  1220. }
  1221. /* String closedProducts = request.getParameter("closed_products");
  1222. String closedFittings = request.getParameter("closed_fittings");*/
  1223. String provinceNumber = request.getParameter("repairProvinceNumber");
  1224. String cityNumber = request.getParameter("repairCityNumber");
  1225. String areaNumber = request.getParameter("repairAreaNumber");
  1226. String mergeAddress = request.getParameter("merge_address");
  1227. if (StringUtils.isNotEmpty(provinceNumber)) {
  1228. repair.setProvinceNumber(Integer.parseInt(provinceNumber));
  1229. }
  1230. if (StringUtils.isNotEmpty(cityNumber)) {
  1231. repair.setCityNumber(Integer.parseInt(cityNumber));
  1232. }
  1233. if (StringUtils.isNotEmpty(areaNumber)) {
  1234. repair.setAreaNumber(Integer.parseInt(areaNumber));
  1235. }
  1236. if (StringUtils.isNotEmpty(mergeAddress)) {
  1237. repair.setRepairSendMergeAddress(mergeAddress);
  1238. }
  1239. // if (StringUtils.isNotEmpty(repair.getRepairBackPostage().toString())) {
  1240. // repair.setRepairBackPostage(repair.getRepairBackPostage().intValue() * 100);
  1241. // }
  1242. /*if (!StringUtils.isNotEmpty(repair.getRepairBackEfastOrderId())) {
  1243. return new ResponseJson(500, "请输入efast订单号!", 500);
  1244. }*/
  1245. if (StringUtils.isNotEmpty(mergeAddress)) {
  1246. repair.setRepairSendMergeAddress(mergeAddress);
  1247. }
  1248. /*SalesOrder order = new SalesOrder();
  1249. order.setSalesOrderStatus(1);
  1250. order.setSalesOrderId(repair.getRepairBackEfastOrderId());
  1251. int count = salesOrderService.getOrderInfoCount(order);
  1252. //判断efast订单是否可查出有效数据
  1253. if (count == 0) {
  1254. return new ResponseJson(500, "该efast订单号无效,请重新输入!", 500);
  1255. }*/
  1256. if(repair.getRepairBackStatus() != null){
  1257. if(repair.getRepairBackStatus() != 1){
  1258. ComplaintSignclosedInfo cs = new ComplaintSignclosedInfo();
  1259. cs.setSignclosedCustomerId(repair.getCustomerId());
  1260. cs.setSignclosedLogistics(repair.getRepairBackLogisticsCompany());
  1261. cs.setSignclosedLogisticsNumber(repair.getRepairBackLogisticsNo());
  1262. complaintSignclosedInfoService.updateSignclosedByCustomerId(cs);
  1263. }
  1264. }
  1265. //修改维修信息
  1266. int num = repairService.updateRepairInfo(repair, null, null);
  1267. if (num > 0) {
  1268. return new ResponseJson(200, "修改成功!", 200);
  1269. } else {
  1270. return new ResponseJson(500, "修改失败!", 500);
  1271. }
  1272. }
  1273. /**
  1274. * 进入修改退货页面
  1275. *
  1276. * @param request
  1277. * @return
  1278. * @throws Exception
  1279. */
  1280. @RequiresPermissions("customer:update:backGoods")
  1281. @RequestMapping("/_to_update_book_goods")
  1282. public ModelAndView toUpdateBookGoods(HttpServletRequest request) throws Exception {
  1283. ModelAndView mv = new ModelAndView("cm/customer/update_back_goods");
  1284. String customerId = request.getParameter("customerId");
  1285. mv.addObject("customerId", customerId);
  1286. return mv;
  1287. }
  1288. /**
  1289. * 进入修改售后退货页面
  1290. *
  1291. * @param request
  1292. * @return
  1293. * @throws Exception
  1294. */
  1295. @ResponseBody
  1296. @RequiresPermissions("customer:update:backGoods")
  1297. @RequestMapping("/_update_back_goods")
  1298. public ResponseJson updateBackGoodsUI(HttpServletRequest request) throws Exception {
  1299. String customerId = request.getParameter("customerId");
  1300. if (!StringUtils.isNotEmpty(customerId)) {
  1301. return new ResponseJson(500, "该客诉信息不存在!", 500);
  1302. }
  1303. BackGoods backGoods = new BackGoods();
  1304. backGoods.setCustomerId(Integer.parseInt(customerId));
  1305. //获取售后退货信息
  1306. backGoods = customerService.getBackGoods(backGoods);
  1307. if (backGoods == null) {
  1308. return new ResponseJson(500, "该客诉没有售后退货信息!", 500);
  1309. } else {
  1310. ResponseJson rj = new ResponseJson(200, "查询成功", 200);
  1311. rj.addResponseKeyValue("backGoods", backGoods);
  1312. return rj;
  1313. }
  1314. }
  1315. /**
  1316. * 修改售后退货信息
  1317. *
  1318. * @param request
  1319. * @param backGoods
  1320. * @return
  1321. * @throws Exception
  1322. */
  1323. @ResponseBody
  1324. @RequiresPermissions("customer:update:backGoods")
  1325. @RequestMapping("/update_back_goods")
  1326. public ResponseJson updateBackGoods(HttpServletRequest request, BackGoods backGoods) throws Exception {
  1327. String closedProducts = request.getParameter("closed_products");
  1328. String closedFittings = request.getParameter("closed_fittings");
  1329. if (!StringUtils.isNotEmpty(backGoods.getBackGoodsId().toString())) {
  1330. return new ResponseJson(500, "该售后退货信息不能修改!", 500);
  1331. }
  1332. // if (StringUtils.isNotEmpty(backGoods.getBackGoodsBackPostage().toString())) {
  1333. // backGoods.setBackGoodsBackPostage(backGoods.getBackGoodsBackPostage().intValue() * 100);
  1334. // }
  1335. // if(backGoods.getBackGoodsBackStatus() != 1){
  1336. // ComplaintSignclosedInfo cs = new ComplaintSignclosedInfo();
  1337. // cs.setSignclosedCustomerId(backGoods.getCustomerId());
  1338. // cs.setSignclosedLogistics(backGoods.getBackGoodsBackLogisticsCompany());
  1339. // cs.setSignclosedLogisticsNumber(backGoods.getBackGoodsBackLogisticsNo());
  1340. // complaintSignclosedInfoService.updateSignclosedByCustomerId(cs);
  1341. // }
  1342. int num = backGoodsService.updateBackGoods(backGoods, closedProducts, closedFittings);
  1343. if (num > 0) {
  1344. return new ResponseJson(200, "修改成功!", 200);
  1345. } else {
  1346. return new ResponseJson(500, "修改失败!", 500);
  1347. }
  1348. }
  1349. /**
  1350. * 进入修改补寄页面
  1351. *
  1352. * @param request
  1353. * @return
  1354. * @throws Exception
  1355. */
  1356. @RequiresPermissions("customer:update:reissue")
  1357. @RequestMapping("/_to_update_reissue")
  1358. public ModelAndView toUpdateReissue(HttpServletRequest request) throws Exception {
  1359. ModelAndView mv = new ModelAndView("cm/customer/update_reissue");
  1360. String customerId = request.getParameter("customerId");
  1361. mv.addObject("customerId", customerId);
  1362. return mv;
  1363. }
  1364. /**
  1365. * 进入修改补寄信息页面
  1366. *
  1367. * @param request
  1368. * @return
  1369. */
  1370. @ResponseBody
  1371. @RequiresPermissions("customer:update:reissue")
  1372. @RequestMapping("/get_reissue_info")
  1373. public ResponseJson getReissueInfo(HttpServletRequest request) {
  1374. String customerId = request.getParameter("customerId");
  1375. if (!StringUtils.isNotEmpty(customerId)) {
  1376. return new ResponseJson(500, "该客诉信息不存在!", 500);
  1377. }
  1378. Reissue reissue = new Reissue();
  1379. reissue.setCustomerId(Integer.parseInt(customerId));
  1380. //获取售后补寄信息
  1381. reissue = customerService.getReissue(reissue);
  1382. if (reissue == null) {
  1383. return new ResponseJson(500, "该客诉没有售后退货信息!", 500);
  1384. } else {
  1385. ResponseJson rj = new ResponseJson(200, "查询成功", 200);
  1386. rj.addResponseKeyValue("reissue", reissue);
  1387. return rj;
  1388. }
  1389. }
  1390. /**
  1391. * 修改售后补寄信息
  1392. *
  1393. * @param request
  1394. * @param reissue
  1395. * @return
  1396. * @throws Exception
  1397. */
  1398. @ResponseBody
  1399. @RequiresPermissions("customer:update:reissue")
  1400. @RequestMapping("/update_reissue_info")
  1401. public ResponseJson updateReissueInfo(HttpServletRequest request, Reissue reissue) throws Exception {
  1402. String provinceNumber = request.getParameter("reissueProvinceNumber");
  1403. String cityNumber = request.getParameter("reissueCityNumber");
  1404. String areaNumber = request.getParameter("reissueAreaNumber");
  1405. String mergeAddress = request.getParameter("merge_address");
  1406. if (!StringUtils.isNotEmpty(reissue.getReissueId().toString())) {
  1407. return new ResponseJson(500, "该售后补寄信息不能修改!", 500);
  1408. }
  1409. if (StringUtils.isNotEmpty(provinceNumber)) {
  1410. reissue.setProvinceNumber(Integer.parseInt(provinceNumber));
  1411. }
  1412. if (StringUtils.isNotEmpty(cityNumber)) {
  1413. reissue.setCityNumber(Integer.parseInt(cityNumber));
  1414. }
  1415. if (StringUtils.isNotEmpty(areaNumber)) {
  1416. reissue.setAreaNumber(Integer.parseInt(areaNumber));
  1417. }
  1418. if (StringUtils.isNotEmpty(mergeAddress)) {
  1419. reissue.setReissueSendMergeAddress(mergeAddress);
  1420. }
  1421. //修改售后补寄信息
  1422. int num = reissueService.updateReissueInfo(reissue);
  1423. if (num > 0) {
  1424. return new ResponseJson(200, "修改成功!", 200);
  1425. } else {
  1426. return new ResponseJson(500, "修改失败!", 500);
  1427. }
  1428. }
  1429. /**
  1430. * 进入修改退货页面
  1431. *
  1432. * @param request
  1433. * @return
  1434. * @throws Exception
  1435. */
  1436. @RequiresPermissions("customer:update:noreason")
  1437. @RequestMapping("/_update_noreason_back")
  1438. public ModelAndView toUpdateNoreasonBack(HttpServletRequest request) throws Exception {
  1439. ModelAndView mv = new ModelAndView("cm/customer/update_noreason_back");
  1440. String customerId = request.getParameter("customerId");
  1441. mv.addObject("customerId", customerId);
  1442. return mv;
  1443. }
  1444. /**
  1445. * 获取无理由退货信息
  1446. *
  1447. * @param request
  1448. * @return
  1449. * @throws Exception
  1450. */
  1451. @ResponseBody
  1452. @RequiresPermissions("customer:update:noreason")
  1453. @RequestMapping("/get_noreason_back")
  1454. public ResponseJson getNoreasonBack(HttpServletRequest request) throws Exception {
  1455. String customerId = request.getParameter("customerId");
  1456. if (!StringUtils.isNotEmpty(customerId)) {
  1457. return new ResponseJson(500, "该客诉信息不存在!", 500);
  1458. }
  1459. NoreasonBack noreasonBack = new NoreasonBack();
  1460. noreasonBack.setCustomerId(Integer.parseInt(customerId));
  1461. noreasonBack.setNoreasonBackState(1);
  1462. //获取无理由退货信息
  1463. noreasonBack = customerService.getNoreasonBack(noreasonBack);
  1464. if (noreasonBack == null) {
  1465. return new ResponseJson(500, "该客诉没有无理由售后退货信息!", 500);
  1466. } else {
  1467. ResponseJson rj = new ResponseJson(200, "查询成功", 200);
  1468. rj.addResponseKeyValue("noreasonBack", noreasonBack);
  1469. return rj;
  1470. }
  1471. }
  1472. /**
  1473. * 修改售后无理由退货信息
  1474. *
  1475. * @param request
  1476. * @param noreasonBack
  1477. * @return
  1478. * @throws Exception
  1479. */
  1480. @ResponseBody
  1481. @RequiresPermissions("customer:update:noreason")
  1482. @RequestMapping("/update_noreason")
  1483. public ResponseJson updateNoreason(HttpServletRequest request, NoreasonBack noreasonBack) throws Exception {
  1484. String closedProducts = request.getParameter("closed_products");
  1485. String closedFittings = request.getParameter("closed_fittings");
  1486. if (!StringUtils.isNotEmpty(noreasonBack.getNoreasonBackId().toString())) {
  1487. return new ResponseJson(500, "该售后无理由退货信息不能修改!", 500);
  1488. }
  1489. // if (StringUtils.isNotEmpty(noreasonBack.getNoreasonBackBackPostage().toString())) {
  1490. // noreasonBack.setNoreasonBackBackPostage(noreasonBack.getNoreasonBackBackPostage().intValue() * 100);
  1491. // }
  1492. // if(noreasonBack.getNoreasonBackBackStatus() != 1){
  1493. // ComplaintSignclosedInfo cs = new ComplaintSignclosedInfo();
  1494. // cs.setSignclosedCustomerId(noreasonBack.getCustomerId());
  1495. // cs.setSignclosedLogistics(noreasonBack.getNoreasonBackBackLogisticsCompany());
  1496. // cs.setSignclosedLogisticsNumber(noreasonBack.getNoreasonBackBackLogisticsNo());
  1497. // complaintSignclosedInfoService.updateSignclosedByCustomerId(cs);
  1498. // }
  1499. int num = noreasonBackService.updateNoreasonBack(noreasonBack, closedProducts, closedFittings);
  1500. if (num > 0) {
  1501. return new ResponseJson(200, "修改成功!", 200);
  1502. } else {
  1503. return new ResponseJson(500, "修改失败!", 500);
  1504. }
  1505. }
  1506. }