AdminCustomerController.java 108 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532
  1. package com.iamberry.rst.controllers.cm;
  2. import com.iamberry.rst.core.address.City;
  3. import com.iamberry.rst.core.address.District;
  4. import com.iamberry.rst.core.address.Province;
  5. import com.iamberry.rst.core.cm.*;
  6. import com.iamberry.rst.core.fm.ComplaintDetectInfo;
  7. import com.iamberry.rst.core.fm.ComplaintSignclosedInfo;
  8. import com.iamberry.rst.core.fm.ComplaintSmallClassInfo;
  9. import com.iamberry.rst.core.order.Product;
  10. import com.iamberry.rst.core.order.ProductColor;
  11. import com.iamberry.rst.core.order.ProductType;
  12. import com.iamberry.rst.core.page.PagedResult;
  13. import com.iamberry.rst.core.sys.Admin;
  14. import com.iamberry.rst.core.tools.LogisticsInfo;
  15. import com.iamberry.rst.faces.address.AddressService;
  16. import com.iamberry.rst.faces.cm.*;
  17. import com.iamberry.rst.faces.fm.ComplaintDetectInfoService;
  18. import com.iamberry.rst.faces.fm.ComplaintSignclosedInfoService;
  19. import com.iamberry.rst.faces.fm.ComplaintSmallClassInfoService;
  20. import com.iamberry.rst.faces.order.EfastOrderService;
  21. import com.iamberry.rst.faces.order.LogisticsInfoService;
  22. import com.iamberry.rst.faces.product.ProductService;
  23. import com.iamberry.rst.faces.sms.SmsService;
  24. import com.iamberry.rst.faces.sys.SysService;
  25. import com.iamberry.rst.util.SmsConfig;
  26. import com.iamberry.rst.utils.*;
  27. import com.iamberry.wechat.tools.NameUtils;
  28. import com.iamberry.wechat.tools.ResponseJson;
  29. import com.iamberry.wechat.tools.ResultInfo;
  30. import net.sf.json.JSONArray;
  31. import net.sf.json.JSONObject;
  32. import org.apache.commons.codec.binary.Base64;
  33. import org.apache.commons.lang.StringUtils;
  34. import org.apache.poi.hssf.usermodel.*;
  35. import org.apache.shiro.authz.annotation.RequiresPermissions;
  36. import org.slf4j.Logger;
  37. import org.slf4j.LoggerFactory;
  38. import org.springframework.beans.BeanUtils;
  39. import org.springframework.beans.factory.annotation.Autowired;
  40. import org.springframework.stereotype.Controller;
  41. import org.springframework.web.bind.annotation.RequestMapping;
  42. import org.springframework.web.bind.annotation.RequestParam;
  43. import org.springframework.web.bind.annotation.ResponseBody;
  44. import org.springframework.web.servlet.ModelAndView;
  45. import javax.servlet.ServletOutputStream;
  46. import javax.servlet.http.HttpServletRequest;
  47. import javax.servlet.http.HttpServletResponse;
  48. import java.io.*;
  49. import java.text.MessageFormat;
  50. import java.text.NumberFormat;
  51. import java.text.SimpleDateFormat;
  52. import java.util.*;
  53. /**
  54. * Created by wxm
  55. */
  56. @Controller
  57. @RequestMapping("/admin/customer")
  58. public class AdminCustomerController {
  59. private Logger logger = LoggerFactory.getLogger(AdminCustomerController.class);
  60. @Autowired
  61. private CompanyInfoService companyInfoService;
  62. @Autowired
  63. private StoreInfoService storeInfoService;
  64. @Autowired
  65. private SalesOrderService salesOrderService;
  66. @Autowired
  67. private CustomerService customerService;
  68. @Autowired
  69. private ProductService productService;
  70. @Autowired
  71. private SysService sysService;
  72. @Autowired
  73. private ComplaintTypeInfoService complaintTypeInfoService;
  74. @Autowired
  75. private VisitService visitService;
  76. @Autowired
  77. private QuestionDescribeService questionDescribeService;
  78. @Autowired
  79. private ComplaintQuestionInfoService complaintQuestionInfoService;
  80. @Autowired
  81. private SmsService smsService;
  82. @Autowired
  83. private ComplaintSignclosedInfoService complaintSignclosedInfoService;
  84. @Autowired
  85. private ComplaintSmallClassInfoService complaintSmallClassInfoService;
  86. @Autowired
  87. private AddressService addressService;
  88. @Autowired
  89. private PostageService postageService;
  90. @Autowired
  91. private EfastOrderService efastOrderService;
  92. @Autowired
  93. private RelationOrderService relationOrderService;
  94. @Autowired
  95. private GenerateKeyUtil generateKeyUtil ;
  96. @Autowired
  97. private CmRelationService cmRelationService ;
  98. @Autowired
  99. private ProcMethodService procMethodService ;
  100. @Autowired
  101. private LogisticsInfoService logisticsInfoService;
  102. @Autowired
  103. private ComplaintDetectInfoService complaintDetectInfoService;
  104. /**
  105. * 获取客诉列表
  106. *
  107. * @param request
  108. * @return
  109. */
  110. @RequiresPermissions("customer:list:customer")
  111. @RequestMapping("/_customer_list")
  112. public ModelAndView getCustomer(HttpServletRequest request, CustomerInfo customer,
  113. @RequestParam(value = "pageSize", defaultValue = "10", required = false) Integer pageSize,
  114. @RequestParam(value = "pageNO", defaultValue = "1", required = false) Integer pageNO,
  115. @RequestParam(value = "totalNum", defaultValue = "0", required = false) Integer totalNum) {
  116. ModelAndView mv = new ModelAndView("cm/customer/custome_list");
  117. // PagedResult<Customer> pagedResult = ptsBomService.listCustomer(pageNO, pageSize, ptsBom, totalNum == 0);
  118. // if (totalNum != 0) {
  119. // pagedResult.setTotal(totalNum);
  120. // }
  121. // //获取产品集合,用于页面选择产品
  122. // List<Produce> list = produceService.getProduceList();
  123. // mv.addObject("produceList", list);
  124. // StitchAttrUtil.getSa().setModelAndView(customer, mv, "/admin/bom/_bom_list", pagedResult);
  125. return mv;
  126. }
  127. /**
  128. * 跳转到添加客诉页面
  129. *
  130. * @return
  131. */
  132. @RequiresPermissions("customer:add:customer")
  133. @RequestMapping(value = "/to_add_customer")
  134. public ModelAndView toAddCustomer(HttpServletRequest request) {
  135. ModelAndView mv = new ModelAndView("cm/customer/add_customer");
  136. //获取产品集合,用于页面选择产品
  137. // List<Produce> produceList = produceService.getProduceList();
  138. // mv.addObject("produceList", produceList);
  139. return mv;
  140. }
  141. /**
  142. * 跳转到修改客诉页面
  143. *
  144. * @return
  145. */
  146. @RequiresPermissions("customer:update:customer")
  147. @RequestMapping(value = "/to_update_customer")
  148. public ModelAndView toUpdateCustomer(HttpServletRequest request, Integer customerId) {
  149. ModelAndView mv = new ModelAndView("cm/customer/update_customer");
  150. ProductType productType = new ProductType();
  151. //查询产品类型集合
  152. List<ProductType> typeList = productService.listProductType(productType);
  153. //查询客诉类型集合
  154. List<ComplaintTypeInfo> complaintTypeList = complaintTypeInfoService.listComplaintTypeInfo(new ComplaintTypeInfo());
  155. //查询跟进客服集合
  156. Admin admin = new Admin();
  157. admin.setAdminDept(3);
  158. admin.setAdminStatus(1);
  159. List<Admin> adminList = sysService.listSelectAdmin(admin);
  160. //获取登录人id
  161. Integer loginAdminId = AdminUtils.getLoginAdminId();
  162. //查询客诉基本信息
  163. CustomerInfo customerInfo = customerService.getCustomerInfo(customerId);
  164. /*查询处理方式*/
  165. CmRelation cmRelation = cmRelationService.getCmRelationByCustomerId(customerInfo.getCustomerId());
  166. /*获取寄出寄入产品*/
  167. cmRelationService.getSendAndBackProduct(cmRelation);
  168. /*处理方式*/
  169. ProcMethod procMethod = procMethodService.getProcMethodById(cmRelation.getProcMethodId());
  170. if (customerInfo.getTypeId() == 1 || (procMethod.getProcMethodIsSend()==2 && procMethod.getProcMethodIsBack() == 2)) {
  171. customerInfo.setIsNeedSelectOrder(2); //不需要订单
  172. } else {
  173. customerInfo.setIsNeedSelectOrder(1);
  174. }
  175. //setIsNeedSelectOrder
  176. if (customerInfo.getIsNeedSelectOrder() == 1 ) {
  177. RelationOrder relationOrder = new RelationOrder();
  178. relationOrder.setRelationId(cmRelation.getRelationId());
  179. List<RelationOrder> relationOrderList = relationOrderService.getRelationOrderList(relationOrder);
  180. String[] salesIds = new String[relationOrderList.size()];
  181. for (int k = 0; k < relationOrderList.size(); k++) {
  182. salesIds[k] = String.valueOf(relationOrderList.get(k).getSalesId());
  183. }
  184. if(salesIds!=null && salesIds.length > 0){
  185. SalesOrder so = new SalesOrder();
  186. so.setSalesIds(salesIds);
  187. List<SalesOrder> orderList = salesOrderService.listSalesOrder(so);
  188. for (SalesOrder sor : orderList) {
  189. SalesOrderItem salesOrderItem = new SalesOrderItem();
  190. salesOrderItem.setItemOrderId(sor.getSalesId());
  191. List<SalesOrderItem> salesOrderItemList = salesOrderService.listSalesOrderItem(salesOrderItem);
  192. sor.setSalesOrderItemList(salesOrderItemList);
  193. }
  194. mv.addObject("salesOrderList", orderList);
  195. }
  196. } else {
  197. mv.addObject("salesOrderList", null);
  198. }
  199. if ("2".equals(customerInfo.getCustomerIsVisit())) { //1:不需要回访 2:需要回访
  200. Visit visit = new Visit();
  201. visit.setCustomerId(customerInfo.getCustomerId());
  202. visit = visitService.getVisit(visit);
  203. mv.addObject("visit", visit);
  204. }
  205. //查询关联问题
  206. ComplaintQuestionInfo complaintQuestionInfo = complaintQuestionInfoService.getQuestionById(customerInfo.getQuestionId());
  207. //查询问题小类
  208. ComplaintSmallClassInfo complaintSmallClassInfo = new ComplaintSmallClassInfo();
  209. complaintSmallClassInfo.setComplaintId(complaintQuestionInfo.getComplaintId());
  210. List<ComplaintSmallClassInfo> complaintSmallClassInfoList = complaintSmallClassInfoService.listComplaintSmallClassInfo(complaintSmallClassInfo);
  211. //查询问题大类
  212. ComplaintTypeInfo complaintTypeInfo = new ComplaintTypeInfo();
  213. List<ComplaintTypeInfo> complaintTypeInfoList = complaintTypeInfoService.listComplaintTypeInfo(complaintTypeInfo);
  214. mv.addObject("cmRelation", cmRelation);
  215. mv.addObject("procMethod", procMethod);
  216. mv.addObject("customerInfo", customerInfo);
  217. mv.addObject("typeList", typeList);
  218. mv.addObject("complaintTypeList", complaintTypeList);
  219. mv.addObject("complaintTypeList", complaintTypeList);
  220. mv.addObject("adminList", adminList);
  221. mv.addObject("loginAdminId", loginAdminId);
  222. mv.addObject("complaintQuestionInfo", complaintQuestionInfo);
  223. mv.addObject("complaintSmallClassInfoList", complaintSmallClassInfoList);
  224. mv.addObject("complaintTypeInfoList", complaintTypeInfoList);
  225. return mv;
  226. }
  227. /**
  228. * 查询问题描述
  229. *
  230. * @return
  231. */
  232. @ResponseBody
  233. @RequiresPermissions("customer:add:customer")
  234. @RequestMapping(value = "/select_question_describe")
  235. public ResponseJson selectQuestionDescribe(HttpServletRequest request, Integer customerId) throws Exception {
  236. if (customerId == null || customerId == 0) {
  237. return new ResponseJson(500, "未获取到问题描述", 500);
  238. }
  239. //查询问题描述表
  240. QuestionDescribe questionDescribe = new QuestionDescribe();
  241. questionDescribe.setCustomerId(customerId);
  242. questionDescribe = questionDescribeService.listQuestionDescribe(questionDescribe).get(0);
  243. ResponseJson rj = new ResponseJson(200, "查询成功", 200);
  244. rj.addResponseKeyValue("questionDescribe", questionDescribe);
  245. return rj;
  246. }
  247. /**
  248. * 搜索订单列表弹出框
  249. *
  250. * @return
  251. */
  252. @RequiresPermissions("customer:add:customer")
  253. @RequestMapping(value = "/select_order")
  254. public ModelAndView selectOrder(HttpServletRequest request) {
  255. ModelAndView mv = new ModelAndView("cm/customer/order_list");
  256. //获取销售公司
  257. List<CompanyInfo> companyInfoList = companyInfoService.listCompanyInfo(new CompanyInfo());
  258. mv.addObject("companyInfoList", companyInfoList);
  259. return mv;
  260. }
  261. /**
  262. * 添加订单列表弹出框
  263. *
  264. * @return
  265. */
  266. @RequiresPermissions("customer:add:customer")
  267. @RequestMapping(value = "/add_order")
  268. public ModelAndView addOder(HttpServletRequest request) {
  269. ModelAndView mv = new ModelAndView("cm/customer/order_add");
  270. return mv;
  271. }
  272. /**
  273. * 添加订单
  274. *
  275. * @return
  276. */
  277. @ResponseBody
  278. @RequiresPermissions("customer:add:customer")
  279. @RequestMapping(value = "/add_order_info")
  280. public ResponseJson addOrderInfo(HttpServletRequest request, SalesOrder salesOrder, String itemJson) throws Exception {
  281. List<SalesOrderItem> list = new ArrayList<>();
  282. JSONArray jsonArray = JSONArray.fromObject(itemJson);
  283. list = (List) JSONArray.toCollection(jsonArray, SalesOrderItem.class);
  284. Integer salesAmount = 0;
  285. for (int i = 0; i < list.size(); i++) {
  286. SalesOrderItem salesOrderItem = list.get(i);
  287. if (salesOrderItem.getItemIsSource() == 1) { //产品来源 1:产品颜色表,2:配件表
  288. Product product = productService.getProductById(salesOrderItem.getItemColorId());
  289. ProductColor productColor = productService.getProduceColor(salesOrderItem.getItemColorId());
  290. salesOrderItem.setItemProductType(product.getProductType());
  291. salesOrderItem.setItemProductName(product.getProductName());
  292. salesOrderItem.setItemProductPic(productColor.getColorPicture());
  293. salesOrderItem.setItemProductColor(productColor.getColorName());
  294. salesOrderItem.setItemColorBar(productColor.getColorBar());
  295. salesOrderItem.setItemProductPrice(productColor.getColorPrice());
  296. salesOrderItem.setItemProductDiscount(productColor.getColorDiscount());
  297. salesOrderItem.setItemIsSource(1);
  298. salesAmount += productColor.getColorDiscount();
  299. }
  300. }
  301. salesOrder.setSalesOpenId("0");
  302. salesOrder.setSalesAmount(salesAmount);
  303. salesOrder.setSalesPayMoney(salesAmount);
  304. salesOrder.setSalesOrderStatus(1);
  305. salesOrder.setSalesCreateTime(new Date());
  306. //salesOrder.setSalesPayTime(new Date());
  307. salesOrder.setSalesLastMoney(salesAmount);
  308. salesOrder.setSalesWaitMoney(0);
  309. salesOrder.setSalesPayMoney(salesAmount);
  310. salesOrder.setSalesSalesTime(new Date());
  311. salesOrder.setSalesDiscountMoney(salesAmount);
  312. salesOrder.setSalesPledgeMoney(0);
  313. salesOrder.setSalesRemainDeposit(0);
  314. salesOrder.setSalesType(1);
  315. salesOrder.setSalesStatus(1);//确认状态:0(未确认)1(确认)2(挂起)3(作废)
  316. salesOrder.setSalesPayStatus(2); //已付款
  317. salesOrder.setSalesProcessStatus(0); //单据状态:0(正常单)1(问题单)
  318. salesOrder.setSalesIsSend(0); //0:否 1:是 是否通知配货
  319. salesOrder.setSalesIsLocked(0); //是否锁定 0:否 1:是
  320. salesOrder.setSalesIsSeparate(0); //是否缺货 0:否 1:是
  321. salesOrder.setSalesShippingFee(0); //邮费
  322. salesOrder.setSalesDeliver(2); // 已出库
  323. Integer adminId = AdminUtils.getLoginAdminId();
  324. String orderCode = GenerateKeyUtil.createOrderCode(adminId);
  325. salesOrder.setSalesDealCode(orderCode);
  326. salesOrder.setSalesOrderId(orderCode);
  327. salesOrder.setSalesBatchId(generateKeyUtil.getSalesBatchIdKS());
  328. //salesOrder = salesOrderService.addOrderAndIteminfo(salesOrder,list);
  329. salesOrder.setSalesOrderItemList(list);
  330. try {
  331. Integer flag = customerService.addOrder(salesOrder);
  332. } catch (RuntimeException e) {
  333. return new ResponseJson(500, "添加订单失败--" + e.getMessage(), 500);
  334. }
  335. Integer orderId = salesOrder.getSalesId();
  336. ResponseJson rj = new ResponseJson(200, "添加订单成功", 200);
  337. rj.addResponseKeyValue("orderId", orderId);
  338. return rj;
  339. }
  340. /**
  341. * 查询销售公司
  342. *
  343. * @return
  344. */
  345. @ResponseBody
  346. @RequiresPermissions("customer:add:customer")
  347. @RequestMapping(value = "/select_company")
  348. public ResponseJson getCompany(HttpServletRequest request) throws Exception {
  349. //获取销售公司
  350. List<CompanyInfo> companyInfoList = companyInfoService.listCompanyInfo(new CompanyInfo());
  351. ResponseJson rj = new ResponseJson(200, "查询成功", 200);
  352. rj.addResponseKeyValue("companyInfoList", companyInfoList);
  353. return rj;
  354. }
  355. /**
  356. * 获取店铺集合
  357. *
  358. * @param request
  359. * @param storeInfo
  360. * @return
  361. */
  362. @ResponseBody
  363. @RequiresPermissions("customer:add:customer")
  364. @RequestMapping(value = "/select_storeInfo")
  365. public ResponseJson listStoreInfo(HttpServletRequest request, StoreInfo storeInfo) {
  366. storeInfo.setStoreStatus(1);
  367. List<StoreInfo> storeInfoList = storeInfoService.listStore(storeInfo);
  368. if (storeInfoList == null || storeInfoList.size() < 1) {
  369. return new ResponseJson(500, "查询失败", 500);
  370. } else {
  371. ResponseJson rj = new ResponseJson(200, "查询成功", 200);
  372. rj.addResponseKeyValue("storeInfoList", storeInfoList);
  373. return rj;
  374. }
  375. }
  376. /**
  377. * 获取订单集合
  378. *
  379. * @param request
  380. * @param salesOrder
  381. * @return
  382. */
  383. @ResponseBody
  384. @RequiresPermissions("customer:add:customer")
  385. @RequestMapping(value = "/select_salesOrder")
  386. public ResponseJson listOrder(HttpServletRequest request, SalesOrder salesOrder, String ids,
  387. @RequestParam(value = "pageSize", defaultValue = "20", required = false) Integer pageSize,
  388. @RequestParam(value = "pageNO", defaultValue = "1", required = false) Integer pageNO,
  389. @RequestParam(value = "totalNum", defaultValue = "0", required = false) Integer totalNum) {
  390. if (ids != null && ids.indexOf("_") > -1) {
  391. String[] salesIds = ids.split("_");
  392. salesOrder.setSalesIds(salesIds);
  393. }
  394. //分页获取订单信息
  395. PagedResult<SalesOrder> pagedResult = salesOrderService.listSalesOrderPage(pageNO, pageSize, salesOrder, totalNum == 0);
  396. List<SalesOrder> salesOrderList = pagedResult.getDataList();
  397. for (SalesOrder so:salesOrderList) {
  398. if(so.getSalesOrderStatus() != 0){
  399. ProcMethod procMethod = procMethodService.getProcMethodById(so.getSalesOrderStatus());
  400. so.setSalesOrderStatusProcTypeName(procMethod.getProcTypeName());
  401. }
  402. }
  403. if (salesOrderList == null || salesOrderList.size() < 1) {
  404. return new ResponseJson(500, "查询失败", 500);
  405. } else {
  406. ResponseJson rj = new ResponseJson(200, "查询成功", 200);
  407. rj.addResponseKeyValue("salesOrderList", salesOrderList);
  408. return rj;
  409. }
  410. }
  411. /**
  412. * 分页查询客诉列表信息
  413. *
  414. * @param request
  415. * @param customerInfo
  416. * @param pageSize
  417. * @param pageNO
  418. * @param totalNum
  419. * @return
  420. * @throws Exception
  421. */
  422. @RequiresPermissions("customer:select:customer")
  423. @RequestMapping("/select_customer_list")
  424. public ModelAndView selectCustomerList(HttpServletRequest request, CustomerInfo customerInfo,
  425. @RequestParam(value = "isFirst", defaultValue = "2", required = false) Integer isFirst,
  426. @RequestParam(value = "pageSize", defaultValue = "10", required = false) Integer pageSize,
  427. @RequestParam(value = "pageNO", defaultValue = "1", required = false) Integer pageNO,
  428. @RequestParam(value = "totalNum", defaultValue = "0", required = false) Integer totalNum) throws Exception {
  429. ModelAndView mv = new ModelAndView("cm/customer/custome_list");
  430. /*if (customerInfo.getAdminId() == null && isFirst == 1) {
  431. //获取登录员工id
  432. Integer adminId = AdminUtils.getLoginAdminId();
  433. customerInfo.setAdminId(adminId);
  434. }*/
  435. PagedResult<CustomerInfo> pagedResult = customerService.listCustomer(pageNO, pageSize, customerInfo, totalNum == 0);
  436. if (totalNum != 0) {
  437. pagedResult.setTotal(totalNum);
  438. }
  439. //查询寄出状态
  440. if(pagedResult.getDataList().size() > 0){
  441. for(CustomerInfo info : pagedResult.getDataList()){
  442. if(info.getSalesOrderList().size() > 0){
  443. info.setSendStatus(info.getSalesOrderList().get(0).getSalesStatus());
  444. }
  445. }
  446. }
  447. ProductType productType = new ProductType();
  448. //查询产品类型集合
  449. List<ProductType> typeList = productService.listProductType(productType);
  450. //查询客诉类型集合
  451. List<ComplaintTypeInfo> complaintTypeList = complaintTypeInfoService.listComplaintTypeInfo(new ComplaintTypeInfo());
  452. //查询客诉类型集合
  453. List<ComplaintSmallClassInfo> complaintSmallClassInfoList = complaintSmallClassInfoService.listComplaintSmallClassInfo(new ComplaintSmallClassInfo());
  454. //查询处理类型
  455. List<ProcType> procTypeList = customerService.listProcType();
  456. //店铺(销售渠道)
  457. List<StoreInfo> listStoreInfo = storeInfoService.listStore(new StoreInfo());
  458. //查询问题集合 第 30 条bug
  459. // List<QuestionDescribe> questionDescribeList = questionDescribeService.listQuestionDescribe(new QuestionDescribe());
  460. //查询跟进客服集合
  461. Admin admin = new Admin();
  462. admin.setAdminDept(3);
  463. admin.setAdminStatus(1);
  464. List<Admin> adminList = sysService.listSelectAdmin(admin);
  465. //获取登录人id
  466. Integer loginAdminId = AdminUtils.getLoginAdminId();
  467. mv.addObject("complaintSmallClassInfoList", complaintSmallClassInfoList);
  468. mv.addObject("loginAdminId", loginAdminId);
  469. mv.addObject("typeList", typeList);
  470. mv.addObject("complaintTypeList", complaintTypeList);
  471. mv.addObject("adminList", adminList);
  472. mv.addObject("procTypeList", procTypeList);
  473. mv.addObject("listStoreInfo", listStoreInfo);
  474. customerInfo.setVisit(null);
  475. customerInfo.setCustomerCommon(null);
  476. customerInfo.setComplaintDetectList(null);
  477. StitchAttrUtil sa = StitchAttrUtil.getSa();
  478. sa.addDatePro("yyyy-MM-dd", "startTime", "endTime");
  479. sa.setModelAndView(customerInfo, mv, "/admin/customer/select_customer_list", pagedResult);
  480. return mv;
  481. }
  482. /**
  483. * 进入客诉基本信息页面
  484. *
  485. * @param request
  486. * @return
  487. * @throws Exception
  488. */
  489. @RequiresPermissions("customer:select:customer")
  490. @RequestMapping("/_customer_info")
  491. public ModelAndView toCustomerInfo(HttpServletRequest request) throws Exception {
  492. ModelAndView mv = new ModelAndView("cm/customer/custome_detail");
  493. String customerId = request.getParameter("customerId");
  494. CmRelation cmRelation = new CmRelation();
  495. cmRelation.setCustomerId(Integer.valueOf(customerId));
  496. cmRelation = customerService.getCmRelationInfo(cmRelation);
  497. ProcMethod procMethod = customerService.getProcMethod(cmRelation.getProcMethodId());
  498. List<LogisticsInfo>logisticsInfoList = logisticsInfoService.getLogisticsInfoList(new LogisticsInfo());
  499. List<PostageInfo> listPostageInfo = customerService.listPostageInfo(cmRelation.getRelationId());
  500. List<SendbackInfo> listSendbackInfo = customerService.listSendbackInfo(cmRelation.getRelationId());
  501. //查询寄回产品
  502. ClosedProdcue record = new ClosedProdcue();
  503. record.setRelationId(cmRelation.getRelationId());
  504. List <ClosedProdcue> listClosedProdcue = customerService.listclosedProdcue(record);
  505. SalesOrder salesOrder = new SalesOrder();
  506. salesOrder.setSalesCustomerId(cmRelation.getCustomerId());
  507. List<SalesOrder> salesOrderList = salesOrderService.salesOrderListAndItem(salesOrder);
  508. mv.addObject("listClosedProdcue",listClosedProdcue);
  509. mv.addObject("listSendbackInfo",listSendbackInfo);
  510. mv.addObject("logisticsInfoList",logisticsInfoList);
  511. mv.addObject("listPostageInfo", listPostageInfo);
  512. mv.addObject("procMethod", procMethod);
  513. mv.addObject("customerId", customerId);
  514. mv.addObject("salesOrderList", salesOrderList);
  515. return mv;
  516. }
  517. /**
  518. * 查询客诉基本信息
  519. *
  520. * @param request
  521. * @return
  522. * @throws Exception
  523. */
  524. @ResponseBody
  525. @RequiresPermissions("customer:select:customer")
  526. @RequestMapping("/get_customer_info")
  527. public ResponseJson getCustomerInfo(HttpServletRequest request) throws Exception {
  528. String customerId = request.getParameter("customerId");
  529. if (!StringUtils.isNotEmpty(customerId)) {
  530. return new ResponseJson(500, "该客诉信息不存在!", 500);
  531. }
  532. CustomerInfo customerInfo = new CustomerInfo();
  533. customerInfo.setCustomerId(Integer.parseInt(customerId));
  534. Map<String, Object> map = customerService.getCustomerInfo(customerInfo);
  535. ResponseJson rj = new ResponseJson(200, "修改成功!", 200);
  536. //查询处理方式信息
  537. CmRelation cmRelation = new CmRelation();
  538. cmRelation.setCustomerId(customerInfo.getCustomerId());
  539. cmRelation = customerService.getCmRelationInfo(cmRelation);
  540. ProcMethod procMethod = customerService.getProcMethod(cmRelation.getProcMethodId());
  541. CustomerInfo ci = (CustomerInfo) map.get("customer");
  542. if(ci != null){
  543. if(ci.getCustomerProvinceId() != null && !"".equals(ci.getCustomerProvinceId())){
  544. Province province = new Province();
  545. province.setProvinceId(Integer.valueOf(ci.getCustomerProvinceId()));
  546. List<Province> provinceList = addressService.listProvince(province);
  547. ci.setCustomerProvinceName(provinceList.get(0).getProvince());
  548. }else{
  549. ci.setCustomerProvinceName("");
  550. }
  551. if(ci.getCustomerCityId() != null && !"".equals(ci.getCustomerCityId())){
  552. City city = new City();
  553. city.setCityId(Integer.valueOf(ci.getCustomerCityId()));
  554. List<City> cityList = addressService.listCity(city);
  555. ci.setCustomerCityName(cityList.get(0).getCity());
  556. }else{
  557. ci.setCustomerCityName("");
  558. }
  559. if(ci.getCustomerDistrictId() != null && !"".equals(ci.getCustomerDistrictId())){
  560. District district = new District();
  561. district.setDistrictId(Integer.valueOf(ci.getCustomerDistrictId()));
  562. List<District> districtList = addressService.listDistrict(district);
  563. ci.setCustomerDistrictName(districtList.get(0).getDistrict());
  564. }else{
  565. ci.setCustomerDistrictName("");
  566. }
  567. }
  568. rj.addResponseKeyValue("cmRelation", cmRelation);
  569. rj.addResponseKeyValue("procMethod", procMethod);
  570. rj.addResponseKeyValue("customerCommon", map.get("customerCommon"));
  571. rj.addResponseKeyValue("customer", map.get("customer"));
  572. rj.addResponseKeyValue("orderList", map.get("orderList"));
  573. rj.addResponseKeyValue("colorIds", map.get("colorIds"));
  574. return rj;
  575. }
  576. /**
  577. * 查询客诉基本信息
  578. *
  579. * @param request
  580. * @return
  581. * @throws Exception
  582. */
  583. @ResponseBody
  584. @RequiresPermissions("customer:select:customer")
  585. @RequestMapping("/get_customer")
  586. public ResponseJson getCustomer(HttpServletRequest request) throws Exception {
  587. String customerId = request.getParameter("customerId");
  588. if (!StringUtils.isNotEmpty(customerId)) {
  589. return new ResponseJson(500, "该客诉信息不存在!", 500);
  590. }
  591. SalesOrder salesOrder = new SalesOrder();
  592. salesOrder.setSalesCustomerId(Integer.valueOf(customerId));
  593. List<SalesOrder> salesOrderList = salesOrderService.salesOrderListAndItem(salesOrder);
  594. ResponseJson rj = ResponseJson.getSUCCESS();
  595. rj.addResponseKeyValue("salesOrderList", salesOrderList);
  596. return rj;
  597. }
  598. /**
  599. * 进入添加回访页面
  600. *
  601. * @param request
  602. * @return
  603. * @throws Exception
  604. */
  605. @RequiresPermissions("customer:select:customer")
  606. @RequestMapping("/_add_visit")
  607. public ModelAndView toAddVisit(HttpServletRequest request) throws Exception {
  608. ModelAndView mv = new ModelAndView("cm/customer/add_visit");
  609. String customerId = request.getParameter("customerId");
  610. //查询跟进客服集合
  611. Admin admin = new Admin();
  612. admin.setAdminDept(3);
  613. admin.setAdminStatus(1);
  614. List<Admin> adminList = sysService.listSelectAdmin(admin);
  615. //获取登录人id
  616. Integer loginAdminId = AdminUtils.getLoginAdminId();
  617. mv.addObject("loginAdminId", loginAdminId);
  618. mv.addObject("customerId", customerId);
  619. mv.addObject("adminList", adminList);
  620. return mv;
  621. }
  622. /**
  623. * 添加回访信息
  624. *
  625. * @param request
  626. * @param visit
  627. * @return
  628. */
  629. @ResponseBody
  630. @RequiresPermissions("customer:add:visit")
  631. @RequestMapping("/add_visit_info")
  632. public ResponseJson addVisitInfo(HttpServletRequest request, Visit visit) throws Exception {
  633. String visitAdminId = request.getParameter("visitAdminId");
  634. if (!StringUtils.isNotEmpty(visitAdminId)) {
  635. return new ResponseJson(500, "请选择回访人!", 500);
  636. }
  637. Integer loginAdminId = AdminUtils.getLoginAdminId();
  638. visit.setAdminId(loginAdminId);
  639. visit.setDesignatedAdminId(Integer.parseInt(visitAdminId));
  640. visit.setVisitStatus(1);
  641. visit.setVisitCreateTime(new Date());
  642. int num = visitService.addVisitInfo(visit, visit.getCustomerId());
  643. if (num > 0) {
  644. return new ResponseJson(200, "修改成功!", 200);
  645. } else {
  646. return new ResponseJson(500, "修改失败!", 500);
  647. }
  648. }
  649. /**
  650. * 修改客诉状态为已解决
  651. *
  652. * @param request
  653. * @return
  654. */
  655. @ResponseBody
  656. @RequiresPermissions("customer:update:customerIsSolve")
  657. @RequestMapping("/update_customerIsSolve")
  658. public ResponseJson updateCustomerIsSolve(HttpServletRequest request) throws Exception {
  659. String customerId = request.getParameter("customerId");
  660. if (!StringUtils.isNotEmpty(customerId)) {
  661. return new ResponseJson(500, "该客诉信息不存在!", 500);
  662. }
  663. //根据id获取客诉信息
  664. CustomerInfo customer = customerService.getCustomerInfo(Integer.parseInt(customerId));
  665. if (customer == null) {
  666. return new ResponseJson(500, "该客诉信息不存在!", 500);
  667. }
  668. if (customer.getCustomerIsSolve().intValue() != 2) {
  669. return new ResponseJson(500, "该客诉信息不能修改为已解决状态!", 500);
  670. }
  671. CustomerInfo customerInfo = new CustomerInfo();
  672. customerInfo.setCustomerId(Integer.parseInt(customerId));
  673. customerInfo.setCustomerIsSolve(1);
  674. //修改客诉信息
  675. int num = customerService.updateCustomerInfo(customerInfo);
  676. if (num > 0) {
  677. return new ResponseJson(200, "修改成功!", 200);
  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("/select_sys_admin")
  691. public ResponseJson selectSysAdmin(HttpServletRequest request) throws Exception {
  692. ResponseJson rj = new ResponseJson(200, "修改成功!", 200);
  693. Integer adminId = AdminUtils.getLoginAdminId();
  694. Admin admin = new Admin();
  695. admin.setAdminDept(3);
  696. admin.setAdminStatus(1);
  697. List<Admin> adminList = sysService.listSelectAdmin(admin);
  698. if (adminList.size() > 0) {
  699. rj.addResponseKeyValue("adminList", adminList);
  700. rj.addResponseKeyValue("adminId", adminId);
  701. return rj;
  702. } else {
  703. return new ResponseJson(500, "查询失败!", 500);
  704. }
  705. }
  706. /**
  707. * 查询产品类型
  708. *
  709. * @param request
  710. * @return
  711. */
  712. @ResponseBody
  713. @RequiresPermissions("customer:add:customer")
  714. @RequestMapping("/select_produce_type")
  715. public ResponseJson selectProduceType(HttpServletRequest request) throws Exception {
  716. ResponseJson rj = new ResponseJson(200, "修改成功!", 200);
  717. ProductType productType = new ProductType();
  718. productType.setTypeStatus(1);
  719. List<ProductType> productTypeList = productService.listProductType(productType);
  720. if (productTypeList != null && productTypeList.size() > 0) {
  721. rj.addResponseKeyValue("productTypeList", productTypeList);
  722. return rj;
  723. } else {
  724. return new ResponseJson(500, "查询失败!", 500);
  725. }
  726. }
  727. /**
  728. * 查询产品
  729. *
  730. * @param request
  731. * @return
  732. */
  733. @ResponseBody
  734. @RequiresPermissions("customer:add:customer")
  735. @RequestMapping("/select_produce")
  736. public ResponseJson selectProduce(HttpServletRequest request) {
  737. ResponseJson rj = new ResponseJson(200, "查询成功!", 200);
  738. Product product = new Product();
  739. List<Product> productList = productService.listProduce(product);
  740. for (Product pro : productList) {
  741. ProductColor productColor = new ProductColor();
  742. productColor.setColorProductId(pro.getProductId());
  743. List<ProductColor> productColorList = productService.listProduceColor(productColor);
  744. pro.setColorList(productColorList);
  745. }
  746. if (productList != null && productList.size() > 0) {
  747. rj.addResponseKeyValue("productList", productList);
  748. return rj;
  749. } else {
  750. return new ResponseJson(500, "查询失败!", 500);
  751. }
  752. }
  753. /**
  754. * 添加客诉
  755. *
  756. * @param request
  757. * @return
  758. */
  759. @ResponseBody
  760. @RequiresPermissions("customer:add:customer")
  761. @RequestMapping("/save_customer")
  762. public ResponseJson addCustomer(HttpServletRequest request, CustomerInfo customerInfo, SalesOrder salesOrder, CmRelation cmRelation,
  763. String sendProdcuesJson,String closedProdcuesJson) throws Exception {
  764. ResponseJson rjx = this.isValiData(customerInfo);
  765. if (rjx.getResultCode() == 500) {
  766. return rjx;
  767. }
  768. if(customerInfo.getCustomerTel() != null && !"".equals(customerInfo.getCustomerTel())){
  769. customerInfo.setCustomerTel(customerInfo.getCustomerTel().trim());
  770. }
  771. if(cmRelation.getRelationBackTel() != null && !"".equals(cmRelation.getRelationBackTel())){
  772. cmRelation.setRelationBackTel(cmRelation.getRelationBackTel().trim());
  773. }
  774. if(cmRelation.getRelationSendTel() != null && !"".equals(cmRelation.getRelationSendTel())){
  775. cmRelation.setRelationSendTel(cmRelation.getRelationSendTel().trim());
  776. }
  777. Integer customerIsSolve = customerInfo.getCustomerIsSolve(); //处理类型
  778. String phone = customerInfo.getCustomerTel(); //手机号码
  779. Integer typeCompany = customerInfo.getTypeCompany(); // 所属商城 1:美国watero; 2:上朵电动牙刷 3:优尼雅净水机
  780. Integer flag = 0;
  781. if (customerInfo.getIsNeedSelectOrder() == 1) { ////1:需要有订单 2:不需要有订单
  782. JSONArray jsonArray;
  783. List<SendProdcue> sendProdcueList;
  784. List<ClosedProdcue> closedProdcueList;
  785. jsonArray = JSONArray.fromObject(sendProdcuesJson);
  786. sendProdcueList = (List) JSONArray.toCollection(jsonArray, SendProdcue.class);
  787. jsonArray = JSONArray.fromObject(closedProdcuesJson);
  788. closedProdcueList = (List) JSONArray.toCollection(jsonArray, ClosedProdcue.class);
  789. cmRelation.setSendProdcues(sendProdcueList);
  790. cmRelation.setClosedProdcues(closedProdcueList);
  791. }
  792. customerInfo.setCmRelation(cmRelation);
  793. String orderId = "";
  794. if (customerInfo.getCustomerIsSolve() == 3 || customerInfo.getCustomerIsSolve() == 4 || customerInfo.getCustomerIsSolve() == 5) {
  795. Integer adminId = AdminUtils.getLoginAdminId();
  796. orderId = OrderNoUtil.createOrderCode(adminId);
  797. }
  798. customerInfo.setTransactionNumber(orderId);
  799. Integer customerId = customerInfo.getCustomerId();
  800. logger.info("-----------------添加客诉开始----------------------");
  801. try {
  802. flag = customerService.saveCustomerInfo(customerInfo, salesOrder);
  803. } catch (RuntimeException e) {
  804. e.printStackTrace();
  805. return new ResponseJson(500, e.getMessage(), 500);
  806. } catch (Exception e) {
  807. e.printStackTrace();
  808. return new ResponseJson(500, "添加失败", 500);
  809. }
  810. customerId = customerInfo.getCustomerId();
  811. logger.info("-----------------添加客诉结束----------------------");
  812. if (flag < 1) {
  813. return new ResponseJson(500, "添加客诉失败!", 500);
  814. }
  815. String msg = "";
  816. //处理结果: 1:已解决 2:未解决 3:换新 4:维修 5:补发 6:退货 7:无理由退货
  817. if (customerIsSolve == 3 || customerIsSolve == 4 || customerIsSolve == 5 || customerIsSolve == 6 || customerIsSolve == 7) {
  818. String solveMsg = "";
  819. switch (customerIsSolve) {
  820. case 3:
  821. solveMsg = "为您更换新机";
  822. break;
  823. case 4:
  824. solveMsg = "为您维修机器";
  825. break;
  826. case 5:
  827. solveMsg = "为您补发产品";
  828. break;
  829. case 6:
  830. solveMsg = "为您办理退货";
  831. break;
  832. case 7:
  833. solveMsg = "为您办理退货";
  834. break;
  835. }
  836. String addCustomerSuccessMsg = "";
  837. String typeMsg = "";
  838. switch (typeCompany) {
  839. case 1:
  840. addCustomerSuccessMsg = SmsConfig.ADD_CUSTOMER_SUCCESS_WATERO;
  841. typeMsg = "美国WaterO售后";
  842. break;
  843. case 2:
  844. addCustomerSuccessMsg = SmsConfig.ADD_CUSTOMER_SUCCESS_SHANGDUO;
  845. typeMsg = "上朵售后";
  846. break;
  847. case 3:
  848. addCustomerSuccessMsg = SmsConfig.ADD_CUSTOMER_SUCCESS_YULIA;
  849. typeMsg = "YULIA售后";
  850. break;
  851. case 4:
  852. addCustomerSuccessMsg = SmsConfig.ADD_CUSTOMER_SUCCESS_AIBERLE;
  853. typeMsg = "爱贝源售后";
  854. break;
  855. }
  856. // Object [] msg = new Object[]{solveMsg,typeMsg};
  857. // String text = MessageFormat.format(addCustomerSuccessMsg, msg);
  858. // logger.info("添加客诉成功后,给 "+ phone +" 手机用户发送短信:" + text );
  859. // String result = smsService.sendOtherCMS(phone, text);
  860. //
  861. // if (!"SUCCESS".equals(result)) {
  862. // return new ResponseJson(505, "添加客诉发送短信失败,失败原因:" + result + "<br>客诉信息发送失败并不影响客诉添加。客诉编号为:"+ customerId, 505);
  863. // }
  864. msg = ",请前往Efast进行换货/退货操作。";
  865. }
  866. return new ResponseJson(200, "录入客诉成功!客诉编号:" + customerId + msg, 200);
  867. }
  868. /**
  869. * 修改客诉
  870. *
  871. * @param request
  872. * @return
  873. */
  874. @ResponseBody
  875. @RequiresPermissions("customer:update:customer")
  876. @RequestMapping("/update_customer")
  877. public ResponseJson updateCustomer(HttpServletRequest request, CustomerInfo customerInfo, SalesOrder salesOrder, CmRelation cmRelation,
  878. String sendProdcuesJson, String closedProdcuesJson) throws Exception {
  879. ResponseJson rjx = this.isValiData(customerInfo);
  880. if (rjx.getResultCode() == 500) {
  881. return rjx;
  882. }
  883. Integer flag = 0;
  884. if(customerInfo.getCustomerTel() != null && !"".equals(customerInfo.getCustomerTel())){
  885. customerInfo.setCustomerTel(customerInfo.getCustomerTel().trim());
  886. }
  887. if(cmRelation.getRelationBackTel() != null && !"".equals(cmRelation.getRelationBackTel())){
  888. cmRelation.setRelationBackTel(cmRelation.getRelationBackTel().trim());
  889. }
  890. if(cmRelation.getRelationSendTel() != null && !"".equals(cmRelation.getRelationSendTel())){
  891. cmRelation.setRelationSendTel(cmRelation.getRelationSendTel().trim());
  892. }
  893. Integer customerIsSolve = customerInfo.getCustomerIsSolve(); //处理类型
  894. String phone = customerInfo.getCustomerTel(); //手机号码
  895. Integer typeCompany = customerInfo.getTypeCompany(); // 所属商城 1:美国watero; 2:上朵电动牙刷 3:优尼雅净水机
  896. if (customerInfo.getIsNeedSelectOrder() == 1) {
  897. JSONArray jsonArray;
  898. List<SendProdcue> sendProdcueList;
  899. List<ClosedProdcue> closedProdcueList;
  900. jsonArray = JSONArray.fromObject(sendProdcuesJson);
  901. sendProdcueList = (List) JSONArray.toCollection(jsonArray, SendProdcue.class);
  902. jsonArray = JSONArray.fromObject(closedProdcuesJson);
  903. closedProdcueList = (List) JSONArray.toCollection(jsonArray, ClosedProdcue.class);
  904. cmRelation.setSendProdcues(sendProdcueList);
  905. cmRelation.setClosedProdcues(closedProdcueList);
  906. }
  907. String orderId = "";
  908. if (customerInfo.getCustomerIsSolve() == 3 || customerInfo.getCustomerIsSolve() == 4 || customerInfo.getCustomerIsSolve() == 5) {
  909. Integer adminId = AdminUtils.getLoginAdminId();
  910. orderId = OrderNoUtil.createOrderCode(adminId);
  911. }
  912. customerInfo.setTransactionNumber(orderId);
  913. customerInfo.setCmRelation(cmRelation);
  914. Integer customerId = customerInfo.getCustomerId();
  915. logger.info("-----------------修改客诉开始----------------------");
  916. try {
  917. flag = customerService.updateCustomerInfo(customerInfo, salesOrder);
  918. } catch (RuntimeException e) {
  919. e.printStackTrace();
  920. return new ResponseJson(500, e.getMessage(), 500);
  921. } catch (Exception e) {
  922. e.printStackTrace();
  923. return new ResponseJson(500, "修改失败", 500);
  924. }
  925. customerId = customerInfo.getCustomerId();
  926. logger.info("-----------------修改客诉结束----------------------");
  927. if (flag < 1) {
  928. return new ResponseJson(500, "修改客诉失败!", 500);
  929. }
  930. return new ResponseJson(200, "修改客诉成功!客诉编号为:" + customerId, 200);
  931. }
  932. /**
  933. * 验证方法
  934. *
  935. * @param customerInfo
  936. * @return
  937. */
  938. public ResponseJson isValiData(CustomerInfo customerInfo) {
  939. ResponseJson rj = new ResponseJson();
  940. if (customerInfo.getAdminId() == null) {
  941. return new ResponseJson(500, "未填写客诉id", 500);
  942. }
  943. return rj;
  944. }
  945. /**
  946. * 发送短信
  947. *
  948. * @param request
  949. * @return
  950. */
  951. @ResponseBody
  952. @RequiresPermissions("customer:add:customer")
  953. @RequestMapping("/send_phone_sms")
  954. public ResponseJson sendPhoneSms(HttpServletRequest request, String type, String phone, Integer typeCompany, ComplaintQuestionInfo complaintQuestionInfo) throws Exception {
  955. String url = NameUtils.getConfig("website");
  956. Integer flag = 1;
  957. if (typeCompany == null || typeCompany == 0) {
  958. return new ResponseJson(500, "未获取到产品类型!", 500);
  959. }
  960. String con = "";
  961. if (type != null && !"".equals(type)) {
  962. if ("p".equals(type)) { //problem" 问题处理; mailAddress:邮寄地址;
  963. if (complaintQuestionInfo.getQuestionId() == null || "".equals(complaintQuestionInfo.getQuestionId())) {
  964. complaintQuestionInfo.setQuestionState(1);
  965. complaintQuestionInfo.setQuestionIsQcDetect(0);
  966. complaintQuestionInfo = complaintQuestionInfoService.insertBackInfo(complaintQuestionInfo);
  967. } else {
  968. complaintQuestionInfo.setSmallClassId(null); //不能修改小类类型
  969. flag = complaintQuestionInfoService.updateQuestionById(complaintQuestionInfo);
  970. if (flag < 1) {
  971. return new ResponseJson(500, "问题修改失败!", 500);
  972. }
  973. }
  974. url += "/" + complaintQuestionInfo.getQuestionId() + "/" + typeCompany;
  975. switch (typeCompany) {
  976. case 1:
  977. con = SmsConfig.SEND_PRODUCT_SEND_WATERO;
  978. break;
  979. case 2:
  980. con = SmsConfig.SEND_PRODUCT_SEND_SHANGDUO;
  981. break;
  982. case 3:
  983. con = SmsConfig.SEND_PRODUCT_SEND_YULIA;
  984. break;
  985. case 4:
  986. con = SmsConfig.SEND_PRODUCT_SEND_AIBERLE;
  987. break;
  988. }
  989. } else if ("m".equals(type)) {
  990. if (complaintQuestionInfo.getQuestionId() == null) {
  991. return new ResponseJson(500, "未获取到邮寄信息!", 500);
  992. }
  993. complaintQuestionInfo.setQuestionName(null);
  994. complaintQuestionInfo.setSmallClassId(null);
  995. url += "/5/0";
  996. switch (typeCompany) {
  997. case 1:
  998. con = SmsConfig.SEND_PRODUCT_SMS_WATERO;
  999. break;
  1000. case 2:
  1001. con = SmsConfig.SEND_PRODUCT_SMS_SHANGDUO;
  1002. break;
  1003. case 3:
  1004. con = SmsConfig.SEND_PRODUCT_SMS_YULIA;
  1005. break;
  1006. case 4:
  1007. con = SmsConfig.SEND_PRODUCT_SMS_AIBERLE;
  1008. break;
  1009. }
  1010. }
  1011. }
  1012. String userPhone = encodePhoneNumber(phone);
  1013. String text = MessageFormat.format(con, url);
  1014. logger.info("给 " + phone + " 手机用户发送短信:" + text);
  1015. String result = smsService.sendOtherCMS(phone, text);
  1016. if ("SUCCESS".equals(result)) {
  1017. return new ResponseJson(200, "发送短信成功!", 200);
  1018. } else {
  1019. return new ResponseJson(500, "发送短信失败,失败原因:" + result, 500);
  1020. }
  1021. }
  1022. String encodePhoneNumber(String number) {
  1023. int encnum = Integer.parseInt(number.substring(2));
  1024. int prefix = (number.charAt(1) - '2') / 2; // '3'=>0, '5'=>1, '[67]'=>2, '8'=>3
  1025. encnum |= (prefix <<= 30);
  1026. final byte[] raw = new byte[4];
  1027. raw[0] = (byte) (encnum >>> 24);
  1028. raw[1] = (byte) (encnum >>> 16);
  1029. raw[2] = (byte) (encnum >>> 8);
  1030. raw[3] = (byte) encnum;
  1031. return Base64.encodeBase64URLSafeString(raw);
  1032. }
  1033. /**
  1034. * 进入回访完成页面
  1035. *
  1036. * @param request
  1037. * @return
  1038. * @throws Exception
  1039. */
  1040. @RequiresPermissions("customer:update:visit")
  1041. @RequestMapping("/_update_visit_info")
  1042. public ModelAndView toUpdateVisitFinish(HttpServletRequest request) throws Exception {
  1043. ModelAndView mv = new ModelAndView("cm/customer/visit_finish");
  1044. String customerId = request.getParameter("customerId");
  1045. mv.addObject("customerId", customerId);
  1046. return mv;
  1047. }
  1048. /**
  1049. * 添加回访完成内容
  1050. *
  1051. * @param request
  1052. * @param visit
  1053. * @return
  1054. */
  1055. @ResponseBody
  1056. @RequiresPermissions("customer:update:visit")
  1057. @RequestMapping("/update_visit_finish")
  1058. public ResponseJson updateVisitFinish(HttpServletRequest request, Visit visit) throws Exception {
  1059. String customerId = request.getParameter("finish_customerId");
  1060. if (!StringUtils.isNotEmpty(customerId)) {
  1061. return new ResponseJson(500, "该客诉信息不存在!", 500);
  1062. }
  1063. visit.setCustomerId(Integer.parseInt(customerId));
  1064. visit.setVisitStatus(2);
  1065. //修改回访信息内容
  1066. int num = visitService.updateVisit(visit);
  1067. if (num > 0) {
  1068. return new ResponseJson(200, "添加成功!", 200);
  1069. } else {
  1070. return new ResponseJson(500, "添加失败!", 500);
  1071. }
  1072. }
  1073. /**
  1074. * 进入回访信息详情
  1075. *
  1076. * @param request
  1077. * @return
  1078. * @throws Exception
  1079. */
  1080. @RequiresPermissions("customer:get:visit")
  1081. @RequestMapping("/_visit_info")
  1082. public ModelAndView toVisitInfo(HttpServletRequest request) throws Exception {
  1083. ModelAndView mv = new ModelAndView("cm/customer/visit_detail");
  1084. String customerId = request.getParameter("customerId");
  1085. // 1:未回访,2:已回访
  1086. String num = request.getParameter("num");
  1087. if (!StringUtils.isNotEmpty(num)) {
  1088. num = "2";
  1089. }
  1090. mv.addObject("customerId", customerId);
  1091. mv.addObject("num", num);
  1092. return mv;
  1093. }
  1094. /**
  1095. * 获取回访信息详情
  1096. *
  1097. * @param request
  1098. * @return
  1099. */
  1100. @ResponseBody
  1101. @RequiresPermissions("customer:get:visit")
  1102. @RequestMapping("/get_visit_info")
  1103. public ResponseJson getVisitInfo(HttpServletRequest request) throws Exception {
  1104. String customerId = request.getParameter("customerId");
  1105. if (!StringUtils.isNotEmpty(customerId)) {
  1106. return new ResponseJson(500, "该客诉信息不存在!", 500);
  1107. }
  1108. Visit visit = new Visit();
  1109. visit.setCustomerId(Integer.parseInt(customerId));
  1110. //查询回访信息集合
  1111. List<Visit> visitList = visitService.listVisit(visit);
  1112. if (visitList == null || visitList.size() == 0) {
  1113. return new ResponseJson(500, "该客诉没有回访信息!", 500);
  1114. }
  1115. visit = visitList.get(0);
  1116. ResponseJson rj = new ResponseJson(200, "查询成功", 200);
  1117. rj.addResponseKeyValue("visit", visit);
  1118. return rj;
  1119. }
  1120. /**
  1121. * 进入问题描述页面
  1122. *
  1123. * @param request
  1124. * @return
  1125. * @throws Exception
  1126. */
  1127. @RequiresPermissions("customer:get:describe")
  1128. @RequestMapping("/_question_describe")
  1129. public ModelAndView toQuestionDescribe(HttpServletRequest request) throws Exception {
  1130. ModelAndView mv = new ModelAndView("cm/customer/describe_detail");
  1131. String customerId = request.getParameter("customerId");
  1132. mv.addObject("customerId", customerId);
  1133. return mv;
  1134. }
  1135. /**
  1136. * 获取问题描述信息
  1137. *
  1138. * @param request
  1139. * @return
  1140. */
  1141. @ResponseBody
  1142. @RequiresPermissions("customer:get:describe")
  1143. @RequestMapping("/get_describe_info")
  1144. public ResponseJson getDescribeInfo(HttpServletRequest request) throws Exception {
  1145. String customerId = request.getParameter("customerId");
  1146. if (!StringUtils.isNotEmpty(customerId)) {
  1147. return new ResponseJson(500, "该客诉信息不存在!", 500);
  1148. }
  1149. QuestionDescribe describe = new QuestionDescribe();
  1150. describe.setCustomerId(Integer.parseInt(customerId));
  1151. //查询问题集合
  1152. List<QuestionDescribe> questionList = questionDescribeService.listQuestionDescribe(describe);
  1153. if (questionList == null || questionList.size() == 0) {
  1154. return new ResponseJson(500, "该客诉信息没有问题描述!", 500);
  1155. }
  1156. describe = questionList.get(0);
  1157. CustomerInfo customerInfo = customerService.getCustomerInfo(Integer.parseInt(customerId));
  1158. ResponseJson rj = new ResponseJson(200, "查询成功", 200);
  1159. rj.addResponseKeyValue("describe", describe);
  1160. rj.addResponseKeyValue("customerInfo", customerInfo);
  1161. return rj;
  1162. }
  1163. /**
  1164. * 进入修改售后处理信息页面
  1165. *
  1166. * @param request
  1167. * @return
  1168. * @throws Exception
  1169. */
  1170. @RequiresPermissions("customer:update:renewed")
  1171. @RequestMapping("/_update_relation")
  1172. public ModelAndView toUpdateRenewed(HttpServletRequest request) throws Exception {
  1173. ModelAndView mv = new ModelAndView("cm/customer/update_relation");
  1174. String customerId = request.getParameter("customerId");
  1175. CmRelation cmRelation = new CmRelation();
  1176. cmRelation.setCustomerId(Integer.valueOf(customerId));
  1177. cmRelation = customerService.getCmRelationInfo(cmRelation);
  1178. ProcMethod procMethod = customerService.getProcMethod(cmRelation.getProcMethodId());
  1179. List<LogisticsInfo>logisticsInfoList = logisticsInfoService.getLogisticsInfoList(new LogisticsInfo());
  1180. List<PostageInfo> listPostageInfo = customerService.listPostageInfo(cmRelation.getRelationId());
  1181. List<SendbackInfo> listSendbackInfo = customerService.listSendbackInfo(cmRelation.getRelationId());
  1182. List<InformationInfo> listInformationInfo = customerService.listInformationInfo(cmRelation.getRelationId());
  1183. ComplaintDetectInfo detectInfo = new ComplaintDetectInfo();
  1184. detectInfo.setCustomerId(Integer.valueOf(customerId));
  1185. List<ComplaintDetectInfo> detectList = complaintDetectInfoService.listComplaintDetect(detectInfo);
  1186. ComplaintSignclosedInfo complaintSignclosedInfo = new ComplaintSignclosedInfo();
  1187. complaintSignclosedInfo.setSignclosedCustomerId(Integer.valueOf(customerId));
  1188. List<ComplaintSignclosedInfo> signclosedList = complaintSignclosedInfoService.listSignclosed(complaintSignclosedInfo);
  1189. //查询寄回产品
  1190. ClosedProdcue record = new ClosedProdcue();
  1191. record.setRelationId(cmRelation.getRelationId());
  1192. List <ClosedProdcue> listClosedProdcue = customerService.listclosedProdcue(record);
  1193. mv.addObject("listInformationInfo",listInformationInfo);
  1194. mv.addObject("listClosedProdcue",listClosedProdcue);
  1195. mv.addObject("listSendbackInfo",listSendbackInfo);
  1196. mv.addObject("logisticsInfoList",logisticsInfoList);
  1197. mv.addObject("listPostageInfo", listPostageInfo);
  1198. mv.addObject("procMethod", procMethod);
  1199. mv.addObject("customerId", customerId);
  1200. mv.addObject("detectList", detectList);
  1201. mv.addObject("signclosedList", signclosedList);
  1202. return mv;
  1203. }
  1204. /**
  1205. * 获取售后详情
  1206. *
  1207. * @param request
  1208. * @return
  1209. */
  1210. @ResponseBody
  1211. @RequiresPermissions("customer:get:renewed")
  1212. @RequestMapping("/get_cmRelation_info")
  1213. public ResponseJson getRenewedInfo(HttpServletRequest request) throws Exception {
  1214. String customerId = request.getParameter("customerId");
  1215. if (!StringUtils.isNotEmpty(customerId)) {
  1216. return new ResponseJson(500, "该客诉信息不存在!", 500);
  1217. }
  1218. CmRelation cmRelation = new CmRelation();
  1219. cmRelation.setCustomerId(Integer.parseInt(customerId));
  1220. //获取换新详情和检测信息
  1221. cmRelation = customerService.getCmRelationInfo(cmRelation);
  1222. if (cmRelation == null) {
  1223. return new ResponseJson(500, "该客诉没有售后信息!", 500);
  1224. } else {
  1225. //查询寄出状态
  1226. SalesOrder salesOrder = new SalesOrder();
  1227. salesOrder.setSalesCustomerId(Integer.valueOf(customerId));
  1228. List<SalesOrder> salesOrderList = salesOrderService.salesOrderListAndItem(salesOrder);
  1229. if(salesOrderList.size() > 0){
  1230. cmRelation.setRelationSendStatus(salesOrderList.get(0).getSalesStatus());
  1231. }else{
  1232. cmRelation.setRelationSendStatus(0);
  1233. }
  1234. ResponseJson rj = new ResponseJson(200, "查询成功", 200);
  1235. rj.addResponseKeyValue("cmRelation", cmRelation);
  1236. return rj;
  1237. }
  1238. }
  1239. /**
  1240. * 修改处理信息
  1241. *
  1242. * @param request
  1243. * @param cmRelation
  1244. * @return
  1245. * @throws Exception
  1246. */
  1247. @ResponseBody
  1248. @RequiresPermissions("customer:update:renewed")
  1249. @RequestMapping("/update_cmRelation_info")
  1250. public ResponseJson updateRenewedInfo(HttpServletRequest request, CmRelation cmRelation) throws Exception {
  1251. String mergeAddress = request.getParameter("merge_address");
  1252. if (!StringUtils.isNotEmpty(cmRelation.getRelationId().toString())) {
  1253. return new ResponseJson(500, "该售后信息不能修改!", 500);
  1254. }
  1255. if (StringUtils.isNotEmpty(mergeAddress)) {
  1256. cmRelation.setRelationSendMergeAddress(mergeAddress);
  1257. }
  1258. if (cmRelation.getRelationBackStatus() != null) {
  1259. if (cmRelation.getRelationBackStatus() != 1) {
  1260. ComplaintSignclosedInfo cs = new ComplaintSignclosedInfo();
  1261. cs.setSignclosedCustomerId(cmRelation.getCustomerId());
  1262. cs.setSignclosedLogistics(cmRelation.getRelationBackLogisticsCompany());
  1263. cs.setSignclosedLogisticsNumber(cmRelation.getRelationBackLogisticsNo());
  1264. complaintSignclosedInfoService.updateSignclosedByCustomerId(cs);
  1265. }
  1266. }
  1267. //修改售后信息
  1268. int num = customerService.updateCmRelation(cmRelation);
  1269. if (num > 0) {
  1270. return new ResponseJson(200, "修改成功!", 200);
  1271. } else {
  1272. return new ResponseJson(500, "修改失败!", 500);
  1273. }
  1274. }
  1275. /**
  1276. * 查询未解决客诉数量
  1277. */
  1278. @ResponseBody
  1279. @RequestMapping(value = "/selectNumberBacklog")
  1280. public ResultMsg selectTodo(HttpServletRequest request) {
  1281. ResultMsg msg = new ResultMsg();
  1282. CustomerInfo customerInfo = new CustomerInfo();
  1283. //获取登录员工id
  1284. Admin admin = AdminUtils.getLoginAdmin();
  1285. // customerInfo.setAdminId(admin.getAdminId());
  1286. // customerInfo.setCustomerIsSolve(2);
  1287. //未解决客诉数量
  1288. // Integer notSolvedCustomer = customerService.selectNotSolvedCustomer(customerInfo);
  1289. //需要向工厂确认所有已签收的产品数量
  1290. // CustomerCommon customerCommon = new CustomerCommon();
  1291. // customerCommon.setAdminId(admin.getAdminId());
  1292. // customerCommon.setRelationBackStatus(4);
  1293. // Integer amountReceivedCustomer = customerCommonService.listCustomerCommonByStatus(customerCommon);
  1294. //需要填写Efast订单号的客诉数量
  1295. // customerCommon.setRelationBackStatus(3);
  1296. // Integer noEntryCustomer = customerCommonService.listCustomerCommonByStatus(customerCommon);
  1297. //客诉录入后,三天后未寄回的客诉数量
  1298. // customerCommon.setRelationBackStatus(1);
  1299. // customerCommon.setRelationCreateTime(new Date());
  1300. // Integer notSendCustomer = customerCommonService.listCustomerCommonByStatus(customerCommon);
  1301. SalesOrder salesOrder = new SalesOrder();
  1302. salesOrder.setSalesStatus(0); //未确认
  1303. Integer toBeConfirmedOrder = salesOrderService.listSalesOrderNum(salesOrder);
  1304. salesOrder = new SalesOrder();
  1305. salesOrder.setSalesShippingStatus(0); //未发货
  1306. Integer toBeAnnounced = salesOrderService.listSalesOrderNum(salesOrder);
  1307. salesOrder.setSalesShippingStatus(11); //已通知配货
  1308. Integer toBeDelivered = salesOrderService.listSalesOrderNum(salesOrder);
  1309. Calendar calendar = Calendar.getInstance();
  1310. calendar.set(Calendar.HOUR_OF_DAY,00);
  1311. calendar.set(Calendar.MINUTE,00);
  1312. calendar.set(Calendar.SECOND,01);
  1313. salesOrder = new SalesOrder();
  1314. salesOrder.setStartDate(calendar.getTime()); //startDate
  1315. Calendar ca = Calendar.getInstance();
  1316. ca.set(Calendar.HOUR_OF_DAY,23);
  1317. ca.set(Calendar.MINUTE,59);
  1318. ca.set(Calendar.SECOND,59);
  1319. salesOrder.setEndDate(ca.getTime());
  1320. Integer allToDayOrder = salesOrderService.listSalesOrderNum(salesOrder);
  1321. Map<String, Integer> numberMap = new HashMap<>();
  1322. numberMap.put("toBeConfirmedOrder", toBeConfirmedOrder);
  1323. numberMap.put("toBeAnnounced", toBeAnnounced);
  1324. numberMap.put("toBeDelivered", toBeDelivered);
  1325. numberMap.put("allToDayOrder", allToDayOrder);
  1326. // numberMap.put("notSolvedCustomer", notSolvedCustomer);
  1327. // numberMap.put("amountReceivedCustomer", amountReceivedCustomer);
  1328. // numberMap.put("noEntryCustomer", noEntryCustomer);
  1329. // numberMap.put("notSendCustomer", notSendCustomer);
  1330. numberMap.put("adminDept", admin.getAdminDept());
  1331. msg.setResultCode(ResultInfo.SUCCESSCODE);
  1332. msg.setStatus(true);
  1333. msg.setData(numberMap);
  1334. return msg;
  1335. }
  1336. // /**
  1337. // * 根据微信昵称/姓名/电话查询客诉
  1338. // *
  1339. // * @param request
  1340. // * @return
  1341. // */
  1342. // @ResponseBody
  1343. // @RequiresPermissions("customer:list:customer")
  1344. // @RequestMapping("/get_custoner_info")
  1345. // public ResponseJson getCustonerInfo(HttpServletRequest request, CustomerCommon customerCommon) throws Exception {
  1346. // if (customerCommon == null) {
  1347. // return new ResponseJson(500, "参数错误!", 500);
  1348. // }
  1349. // List<CustomerCommon> customerCommonList = customerCommonService.listCustomerCommon(customerCommon);
  1350. // if (customerCommonList.size() < 1) {
  1351. // return new ResponseJson(500, "不存在相关客诉信息!", 500);
  1352. // } else {
  1353. // ResponseJson rj = new ResponseJson(200, "查询成功", 200);
  1354. // rj.addResponseKeyValue("customer", customerCommonList.get(0));
  1355. // return rj;
  1356. // }
  1357. // }
  1358. /**
  1359. * 申请邮费
  1360. *
  1361. * @return
  1362. */
  1363. @ResponseBody
  1364. @RequiresPermissions("customer:applyPostage:customer")
  1365. @RequestMapping(value = "/apply_postage")
  1366. public ResponseJson applyPostage(HttpServletRequest request, Integer customerId) throws Exception {
  1367. CustomerInfo customerInfo = customerService.getCustomerInfo(customerId);
  1368. if (customerInfo == null) {
  1369. return new ResponseJson(500, "未获取到客诉", 500);
  1370. }
  1371. CmRelation cmRelation = cmRelationService.getCmRelationByCustomerId(customerId);
  1372. if (cmRelation.getRelationBackStatus() == 1) { //1:未寄回 2:已寄回 3:已收货 4:已签收待确认
  1373. return new ResponseJson(500, "请修改寄回状态,并填写寄回信息", 500);
  1374. }
  1375. if (cmRelation.getRelationBackStatus() == 2) { //1:未寄回 2:已寄回 3:已收货 4:已签收待确认
  1376. return new ResponseJson(500, "产品正在寄回中!", 500);
  1377. }
  1378. if (cmRelation.getRelationIsTransfer() == 0) { //relationIsTransfer 是否需要转账邮费 0:不需要 10:需要转账
  1379. return new ResponseJson(500, "请修改邮费转账状态,并填写邮费信息", 500);
  1380. }
  1381. if (cmRelation.getRelationBackPostage() == null || cmRelation.getRelationBackPostage() == 0 //relationBackPostage
  1382. || cmRelation.getRelationAlipay() == null || cmRelation.getRelationAlipayName() == null) {
  1383. return new ResponseJson(500, "请填写邮费信息", 500);
  1384. }
  1385. if (customerInfo.getCompanyId() == null || customerInfo.getCompanyId() == 0) {
  1386. return new ResponseJson(500, "未正确选择销售公司", 500);
  1387. }
  1388. Postage age = new Postage();
  1389. age.setCustomerId(customerInfo.getCustomerId()); //客诉id
  1390. List<Postage> postageList = postageService.listPostage(age);
  1391. if (postageList != null && postageList.size() > 0) {
  1392. return new ResponseJson(500, "该条客诉已在申请邮费中了", 500);
  1393. }
  1394. ResponseJson rj = new ResponseJson(200, "可以申请邮费", 200);
  1395. rj.addResponseKeyValue("customerCommon", cmRelation);
  1396. rj.addResponseKeyValue("customerInfo", customerInfo);
  1397. return rj;
  1398. }
  1399. /**
  1400. * 申请邮费
  1401. *
  1402. * @return
  1403. */
  1404. @ResponseBody
  1405. @RequiresPermissions("customer:applyPostage:customer")
  1406. @RequestMapping(value = "/add_postage")
  1407. public ResponseJson addPostage(HttpServletRequest request, Integer customerId, String postageLogisticsImg) throws Exception {
  1408. CustomerInfo customerInfo = customerService.getCustomerInfo(customerId);
  1409. if (customerInfo == null) {
  1410. return new ResponseJson(500, "未获取到客诉", 500);
  1411. }
  1412. CmRelation cmRelation = cmRelationService.getCmRelationByCustomerId(customerId);
  1413. if (cmRelation.getRelationBackStatus() == 1) { //1:未寄回 2:已寄回 3:已收货 4:已签收待确认
  1414. return new ResponseJson(500, "请修改寄回状态,并填写寄回信息", 500);
  1415. }
  1416. if (cmRelation.getRelationBackStatus() == 2) { //1:未寄回 2:已寄回 3:已收货 4:已签收待确认
  1417. return new ResponseJson(500, "产品正在寄回中!", 500);
  1418. }
  1419. if (cmRelation.getRelationIsTransfer() == 0) { //relationIsTransfer 是否需要转账邮费 0:不需要 10:需要转账
  1420. return new ResponseJson(500, "请修改邮费转账状态,并填写邮费信息", 500);
  1421. }
  1422. if (cmRelation.getRelationBackPostage() == null || cmRelation.getRelationBackPostage() == 0 //relationBackPostage
  1423. || cmRelation.getRelationAlipay() == null || cmRelation.getRelationAlipayName() == null) {
  1424. return new ResponseJson(500, "请填写邮费信息", 500);
  1425. }
  1426. if (customerInfo.getCompanyId() == null || customerInfo.getCompanyId() == 0) {
  1427. return new ResponseJson(500, "未正确选择销售公司", 500);
  1428. }
  1429. Postage age = new Postage();
  1430. age.setCustomerId(customerInfo.getCustomerId()); //客诉id
  1431. List<Postage> postageList = postageService.listPostage(age);
  1432. if (postageList != null && postageList.size() > 0) {
  1433. return new ResponseJson(500, "该条客诉已在申请邮费中了", 500);
  1434. }
  1435. String orderId = "";
  1436. for (SalesOrder salesOrder : cmRelation.getSalesOrderList()) {
  1437. if ("".equals(orderId)) {
  1438. orderId = salesOrder.getSalesOrderId();
  1439. } else {
  1440. orderId += "," + salesOrder.getSalesOrderId();
  1441. }
  1442. }
  1443. Integer flag = 0;
  1444. Postage postage = new Postage();
  1445. postage.setCompanyId(customerInfo.getCompanyId()); //销售公司
  1446. postage.setAdminId(customerInfo.getAdminId()); //客服
  1447. postage.setCustomerId(customerInfo.getCustomerId()); //客诉id
  1448. postage.setPostageCustomerStatus(2); //------考虑手动点, 直接变为申请中
  1449. postage.setPostageManagerStatus(1); //------考虑手动点, 直接变为申请中
  1450. postage.setPostageOrderSource(customerInfo.getStoreId()); //店铺id
  1451. // postage.setPostageTreatmentMethod(cmRelation.getProcMethodId()); //处理方式
  1452. postage.setSalesOrderId(orderId); //efast订单号
  1453. postage.setPostageClientName(cmRelation.getRelationBackName());
  1454. postage.setPostageClientTel(cmRelation.getRelationBackTel());
  1455. postage.setPostageClientAddress(cmRelation.getRelationSendAddress());
  1456. postage.setPostageLogisticsCompany(cmRelation.getRelationBackLogisticsCompany());
  1457. postage.setPostageLogisticsNo(cmRelation.getRelationBackLogisticsNo());
  1458. postage.setPostageAmount(cmRelation.getRelationBackPostage()); //寄回邮费
  1459. postage.setPostageAlipay(cmRelation.getRelationAlipay()); //支付宝账户
  1460. postage.setPostageAlipayName(cmRelation.getRelationAlipayName()); //支付宝账号名称
  1461. postage.setPostageLogisticsImg(postageLogisticsImg);
  1462. flag = postageService.savePostage(postage);
  1463. if (flag < 1) {
  1464. return new ResponseJson(500, "申请失败", 500);
  1465. }
  1466. ResponseJson rj = new ResponseJson(200, "申请成功,请前往邮费转账列表查看", 200);
  1467. return rj;
  1468. }
  1469. /**
  1470. * 根据客诉id查询产品类型
  1471. *
  1472. * @param request
  1473. * @return
  1474. * @throws Exception
  1475. */
  1476. @ResponseBody
  1477. @RequestMapping("/getProductType")
  1478. public ResponseJson getProductType(HttpServletRequest request) throws Exception {
  1479. String customerId = request.getParameter("customerId");
  1480. if (!StringUtils.isNotEmpty(customerId)) {
  1481. return new ResponseJson(500, "查询产品类型失败!", 500);
  1482. }
  1483. //查询客诉产品类型
  1484. ProductType productType = productService.getProductType(Integer.valueOf(customerId));
  1485. if (productType == null) {
  1486. return new ResponseJson(500, "未找到产品类型!", 500);
  1487. } else {
  1488. ResponseJson rj = new ResponseJson(200, "查询成功", 200);
  1489. rj.addResponseKeyValue("productType", productType);
  1490. return rj;
  1491. }
  1492. }
  1493. /**
  1494. * 根据客户信息查询旧的客诉信息
  1495. *
  1496. * @param request
  1497. * @return
  1498. * @throws Exception
  1499. */
  1500. @ResponseBody
  1501. @RequestMapping("/selectOnCustomer")
  1502. public ResponseJson listOnCustomer(HttpServletRequest request, CustomerInfo customerInfo) throws Exception {
  1503. if (customerInfo == null) {
  1504. return new ResponseJson(500, "查询客诉失败!", 500);
  1505. }
  1506. List<CustomerInfo> onCustomerList = customerService.listOnCustomer(customerInfo);
  1507. if (onCustomerList.size() == 0) {
  1508. return new ResponseJson(500, "未找到客诉!", 500);
  1509. } else {
  1510. ResponseJson rj = new ResponseJson(200, "查询成功", 200);
  1511. rj.addResponseKeyValue("onCustomerList", onCustomerList);
  1512. return rj;
  1513. }
  1514. }
  1515. /**
  1516. * 根据efast订单号查询efast订单物流信息
  1517. *
  1518. * @param request
  1519. * @return
  1520. * @throws Exception
  1521. */
  1522. @ResponseBody
  1523. @RequestMapping("/getefastOrder")
  1524. public ResponseJson getEfastOrderInfo(HttpServletRequest request, String efastOrderId) throws Exception {
  1525. if (efastOrderId == null) {
  1526. return new ResponseJson(500, "查询失败!", 500);
  1527. }
  1528. JSONObject orderInfo = efastOrderService.getOrderFormEfastByOrderId(efastOrderId);
  1529. if (orderInfo == null) {
  1530. return new ResponseJson(500, "查询失败!", 500);
  1531. } else if (!orderInfo.has("orders")) {
  1532. return new ResponseJson(500, "查询失败!", 500);
  1533. } else {
  1534. ResponseJson rj = new ResponseJson(200, "查询成功", 200);
  1535. rj.addResponseKeyValue("orderInfo", orderInfo.toString());
  1536. return rj;
  1537. }
  1538. }
  1539. /**
  1540. * 进入下载客诉页面
  1541. *
  1542. * @param request
  1543. * @param res
  1544. * @param
  1545. * @throws Exception
  1546. */
  1547. @ResponseBody
  1548. @RequestMapping("/to_download_customer_excel")
  1549. public ModelAndView toDownloadCustomerExcel(HttpServletRequest request, HttpServletResponse res, CustomerInfo customerInfo) throws Exception {
  1550. ModelAndView mv = new ModelAndView("cm/customer/download_customer");
  1551. Admin admin = AdminUtils.getLoginAdmin();
  1552. //获取销售公司
  1553. List<CompanyInfo> companyInfoList = companyInfoService.listCompanyInfo(new CompanyInfo());
  1554. //查询店铺
  1555. StoreInfo storeInfo = new StoreInfo();
  1556. storeInfo.setCompanyId(companyInfoList.get(0).getCompanyId());
  1557. List<StoreInfo> storeList = storeInfoService.listStore(storeInfo);
  1558. //查询处理类型
  1559. List<ProcType> procTypeList = customerService.listProcType();
  1560. //查询登录人下载客诉记录
  1561. DownloadProgressInfo downloadProgressInfo = new DownloadProgressInfo();
  1562. downloadProgressInfo.setDownloadAdminId(admin.getAdminId());
  1563. List<DownloadProgressInfo> listDownloadProgressInfo = customerService.listDownloadProgressInfo(downloadProgressInfo);
  1564. mv.addObject("listDownloadProgressInfo",listDownloadProgressInfo);
  1565. mv.addObject("companyInfoList",companyInfoList);
  1566. mv.addObject("storeList",storeList);
  1567. mv.addObject("procTypeList",procTypeList);
  1568. return mv;
  1569. }
  1570. /**
  1571. * 查询下载客诉信息 (2018-05-29)
  1572. *
  1573. * @param request
  1574. * @param res
  1575. * @param
  1576. * @throws Exception
  1577. */
  1578. @ResponseBody
  1579. @RequestMapping("/list_download_customer_excel")
  1580. public ResponseJson listdownloadEfastOrderExcel(HttpServletRequest request, HttpServletResponse res) throws Exception {
  1581. Admin admin = AdminUtils.getLoginAdmin();
  1582. //查询登录人下载客诉记录
  1583. DownloadProgressInfo downloadProgressInfo = new DownloadProgressInfo();
  1584. /*downloadProgressInfo.setDownloadStatus(1);*/
  1585. downloadProgressInfo.setDownloadAdminId(admin.getAdminId());
  1586. List<DownloadProgressInfo> listDownloadProgressInfo = customerService.listDownloadProgressInfo(downloadProgressInfo);
  1587. ResponseJson rj = new ResponseJson(200, "查询成功", 200);
  1588. rj.addResponseKeyValue("listDownloadProgressInfo", listDownloadProgressInfo);
  1589. return rj;
  1590. }
  1591. /**
  1592. * 下载客诉信息 (2018-05-29)
  1593. *
  1594. * @param request
  1595. * @param res
  1596. * @param
  1597. * @throws Exception
  1598. */
  1599. @ResponseBody
  1600. @RequestMapping("/download_customer_excel")
  1601. public ResponseJson downloadEfastOrderExcel(HttpServletRequest request, HttpServletResponse res, CustomerInfo customerInfo) throws Exception {
  1602. String path = request.getSession().getServletContext().getRealPath("/");
  1603. new Thread(new Mythread(path,customerInfo)).start();
  1604. return new ResponseJson(200, "查询成功", 200);
  1605. }
  1606. class Mythread extends Thread{
  1607. private String path;
  1608. private CustomerInfo customerInfo;
  1609. public Mythread(String path,CustomerInfo customerInfo) {
  1610. this.path=path;
  1611. this.customerInfo=customerInfo;
  1612. }
  1613. @Override
  1614. public void run(){
  1615. Admin admin = AdminUtils.getLoginAdmin();
  1616. //添加一条下载记录
  1617. DownloadProgressInfo downloadProgressInfo = new DownloadProgressInfo();
  1618. downloadProgressInfo.setDownloadAdminId(admin.getAdminId());
  1619. downloadProgressInfo.setDownloadProgress("00.00");
  1620. downloadProgressInfo.setDownloadStatus(1);
  1621. customerService.addDownloadProgressInfo(downloadProgressInfo);
  1622. //循环一次的时间(毫秒)
  1623. long cycleOne = 0;
  1624. long cycleOnes = 0;
  1625. int s = 0;
  1626. List<CustomerStatisticalInfo> customerList = customerService.listStatisticalCustomer(customerInfo);
  1627. String[] cells = {
  1628. "日期", "姓名", "联系电话", "类别", "来源入口",
  1629. "问题类别", "小类名称", "客诉问题", "处理过程", "购买日期",
  1630. "处理方式","处理结果", "销售公司", "销售渠道", "产品型号", "产品颜色",
  1631. "产品数量", "寄回快递", "寄回单号", "签收日期",
  1632. "状态", "寄出快递", "寄出快递", "开箱损", "二次客诉", "跟进客服", "工厂报价", "客户报价", "邮费信息"
  1633. };
  1634. List<CustomerStatisticalInfo> customerStatisticalInfoList = new ArrayList<>();
  1635. for (CustomerStatisticalInfo customerInfo : customerList) {
  1636. long startTime=System.currentTimeMillis(); //获取开始时间
  1637. s++;
  1638. //新建一个容器
  1639. CustomerStatisticalInfo customer = new CustomerStatisticalInfo();
  1640. //将数据copy到新容器
  1641. BeanUtils.copyProperties(customerInfo, customer);
  1642. CustomerCommon customerCommon = new CustomerCommon();
  1643. customerCommon.setCustomerId(customerInfo.getCustomerId());
  1644. customerCommon.setRelationId(customerInfo.getRelationId());
  1645. List<CustomerCommon> listCustomerCommon = customerService.listCustomerCommons(customerCommon);
  1646. if(listCustomerCommon.size() > 0) {
  1647. for (CustomerCommon common : listCustomerCommon) {
  1648. if (common.getSalesOrderList().size() > 0) {
  1649. for (SalesOrder salesOrder : common.getSalesOrderList()) {
  1650. if (salesOrder.getSalesOrderItemList().size() > 0) {
  1651. for (SalesOrderItem salesOrderItem : salesOrder.getSalesOrderItemList()) {
  1652. //将数据copy到新容器
  1653. CustomerStatisticalInfo customers = new CustomerStatisticalInfo();
  1654. BeanUtils.copyProperties(customer, customers);
  1655. customers.setRelationBackLogisticsCompany(customerInfo.getRelationBackLogisticsCompany());
  1656. customers.setRelationBackLogisticsNo(customerInfo.getRelationBackLogisticsNo());
  1657. customers.setRelationSendLogisticsCompany(customerInfo.getRelationSendLogisticsCompany());
  1658. customers.setRelationSendLogisticsNo(customerInfo.getRelationSendLogisticsNo());
  1659. customers.setRelationBackStatus(String.valueOf(customerInfo.getRelationBackStatus()));
  1660. if(customerInfo.getRelationBackReceiptDate() == null){
  1661. customers.setRelationBackReceiptDate(null);
  1662. }else{
  1663. customers.setRelationBackReceiptDate(customerInfo.getRelationBackReceiptDate());
  1664. }
  1665. customers.setSalesPayTime(salesOrder.getSalesPayTime());
  1666. customers.setItemProductName(salesOrderItem.getItemProductName());
  1667. customers.setItemProductColor(salesOrderItem.getItemProductColor());
  1668. customers.setItemNum(String.valueOf(salesOrderItem.getItemNum()));
  1669. customers.setRelationFactoryCosts(customerInfo.getRelationFactoryCosts());
  1670. customers.setRelationCustomerCosts(customerInfo.getRelationCustomerCosts());
  1671. String postageString = "";
  1672. //查询邮费信息
  1673. List<PostageInfo> listPostageInfo = customerService.listPostageInfo(customers.getRelationId());
  1674. if(listPostageInfo.size() > 0){
  1675. for(PostageInfo postageInfo : listPostageInfo){
  1676. String state = "";
  1677. if(postageInfo.getPostageStatus() == 1){
  1678. state = "未申请";
  1679. }
  1680. if(postageInfo.getPostageStatus() == 2){
  1681. state = "已申请(待转账)";
  1682. }
  1683. if(postageInfo.getPostageStatus() == 3){
  1684. state = "已转账";
  1685. }
  1686. postageString = postageString+"状态:"+state+" ,金额:"+postageInfo.getPostageAmount()/100+" ,支付宝账号:"+postageInfo.getPostageAlipay()+";";
  1687. }
  1688. }
  1689. customers.setPostageString(postageString);
  1690. customerStatisticalInfoList.add(customers);
  1691. }
  1692. } else {
  1693. customerStatisticalInfoList.add(customer);
  1694. }
  1695. }
  1696. } else {
  1697. customerStatisticalInfoList.add(customer);
  1698. }
  1699. }
  1700. }else{
  1701. customerStatisticalInfoList.add(customer);
  1702. }
  1703. long endTime=System.currentTimeMillis(); //获取结束时间
  1704. NumberFormat numberFormat = NumberFormat.getInstance();
  1705. float percentage = (float) s / (float) customerList.size() * 100;
  1706. String result = numberFormat.format(percentage);
  1707. if(s == 1){
  1708. cycleOne = endTime - startTime;
  1709. SimpleDateFormat sdf3=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  1710. cycleOnes = cycleOne * customerList.size();
  1711. //修改预计下载完成时间
  1712. downloadProgressInfo.setDownloadDate(sdf3.format(new Date().getTime()+cycleOnes));
  1713. downloadProgressInfo.setDownloadProgress(result);
  1714. customerService.updateDownloadProgressInfo(downloadProgressInfo);
  1715. }else{
  1716. numberFormat.setMaximumFractionDigits(2);
  1717. downloadProgressInfo.setDownloadProgress(result);
  1718. customerService.updateDownloadProgressInfo(downloadProgressInfo);
  1719. }
  1720. }
  1721. //导出订单Excel并下载
  1722. try {
  1723. customerExcel(cells,customerStatisticalInfoList,downloadProgressInfo,path);
  1724. } catch (Exception e) {
  1725. e.printStackTrace();
  1726. }
  1727. }
  1728. }
  1729. /**
  1730. * 导出订单Excel并下载
  1731. * @param cells
  1732. * @throws Exception
  1733. */
  1734. public void customerExcel(String[] cells,List<CustomerStatisticalInfo> customerList,
  1735. DownloadProgressInfo downloadProgressInfo,String path) throws Exception {
  1736. //创建一个workbook,对应一个Excel文件
  1737. HSSFWorkbook wb = new HSSFWorkbook();
  1738. //在workbook中添加一个sheet,对应Excel中的一个sheet
  1739. HSSFSheet sheet = wb.createSheet("导出订单");
  1740. //在sheet中添加表头第0行,老版本poi对excel行数列数有限制short
  1741. HSSFRow row = sheet.createRow((int) 0);
  1742. //创建单元格,设置值表头,设置表头居中
  1743. HSSFCellStyle style = wb.createCellStyle();
  1744. //居中格式
  1745. style.setAlignment(HSSFCellStyle.ALIGN_CENTER);
  1746. //设置表头
  1747. if (cells == null || cells.length == 0) {
  1748. return;
  1749. }
  1750. //循环设置表头
  1751. HSSFCell cell = null;
  1752. for (int i = 0;i < cells.length;i++) {
  1753. String name = cells[i];
  1754. cell = row.createCell(i);
  1755. cell.setCellValue(name);
  1756. cell.setCellStyle(style);
  1757. }
  1758. SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
  1759. for (int i = 0; i < customerList.size(); i++) {
  1760. row = sheet.createRow((int) i + 1);
  1761. CustomerStatisticalInfo customerStatisticalInfo = customerList.get(i);
  1762. String createTime = "";
  1763. if(customerStatisticalInfo.getCreateTime() != null){
  1764. createTime = format.format(customerStatisticalInfo.getCreateTime());
  1765. }
  1766. String salesPayTime = "";
  1767. if(customerStatisticalInfo.getSalesPayTime() != null ){
  1768. salesPayTime = format.format(customerStatisticalInfo.getSalesPayTime());
  1769. }
  1770. String backLogisticsCompany = "";
  1771. if(customerStatisticalInfo.getRelationBackLogisticsCompany() != null){
  1772. backLogisticsCompany = KuaiDi100.replace(customerStatisticalInfo.getRelationBackLogisticsCompany());
  1773. }
  1774. String backStatus = "未知";
  1775. if(customerStatisticalInfo.getRelationBackStatus() != null){
  1776. if(customerStatisticalInfo.getRelationBackStatus().equals("1")){
  1777. backStatus = "未寄回";
  1778. }
  1779. if(customerStatisticalInfo.getRelationBackStatus().equals("2")){
  1780. backStatus = "已寄回";
  1781. }
  1782. if(customerStatisticalInfo.getRelationBackStatus().equals("3")){
  1783. backStatus = "已收货";
  1784. }
  1785. }
  1786. String sendLogisticsCompany = "";
  1787. if(customerStatisticalInfo.getRelationSendLogisticsCompany() != null){
  1788. sendLogisticsCompany = KuaiDi100.replace(customerStatisticalInfo.getRelationSendLogisticsCompany());
  1789. }
  1790. // 创建单元格,设置值
  1791. row.createCell(0).setCellValue(createTime);
  1792. row.createCell(1).setCellValue(customerStatisticalInfo.getCustomerName() == null ? null : customerStatisticalInfo.getCustomerName());
  1793. row.createCell(2).setCellValue(customerStatisticalInfo.getCustomerTel() == null ? null : customerStatisticalInfo.getCustomerTel());
  1794. row.createCell(3).setCellValue(customerStatisticalInfo.getCounselType() == null ? null : customerStatisticalInfo.getCounselType());
  1795. row.createCell(4).setCellValue(customerStatisticalInfo.getSourceType() == null ? null : customerStatisticalInfo.getSourceType());
  1796. row.createCell(5).setCellValue(customerStatisticalInfo.getComplaintClassName() == null ? null : customerStatisticalInfo.getComplaintClassName());
  1797. row.createCell(6).setCellValue(customerStatisticalInfo.getSmallClassName() == null ? null : customerStatisticalInfo.getSmallClassName());
  1798. row.createCell(7).setCellValue(customerStatisticalInfo.getDescribeTitle() == null ? null : customerStatisticalInfo.getDescribeTitle());
  1799. row.createCell(8).setCellValue(customerStatisticalInfo.getDescribeHandleDesc() == null ? null : customerStatisticalInfo.getDescribeHandleDesc());
  1800. row.createCell(9).setCellValue(salesPayTime);
  1801. row.createCell(10).setCellValue(customerStatisticalInfo.getProcMethodName() == null ? null : customerStatisticalInfo.getProcMethodName());
  1802. row.createCell(11).setCellValue(customerStatisticalInfo.getCustomerIsSolve() == null ? null : customerStatisticalInfo.getCustomerIsSolve());
  1803. row.createCell(12).setCellValue(customerStatisticalInfo.getCompanyName() == null ? null : customerStatisticalInfo.getCompanyName());
  1804. row.createCell(13).setCellValue(customerStatisticalInfo.getStoreName() == null ? null : customerStatisticalInfo.getStoreName());
  1805. row.createCell(14).setCellValue(customerStatisticalInfo.getItemProductName() == null ? null : customerStatisticalInfo.getItemProductName());
  1806. row.createCell(15).setCellValue(customerStatisticalInfo.getItemProductColor() == null ? null : customerStatisticalInfo.getItemProductColor());
  1807. row.createCell(16).setCellValue(customerStatisticalInfo.getItemNum() == null ? null : customerStatisticalInfo.getItemNum());
  1808. row.createCell(17).setCellValue(backLogisticsCompany);
  1809. row.createCell(18).setCellValue(customerStatisticalInfo.getRelationBackLogisticsNo() == null ? null : customerStatisticalInfo.getRelationBackLogisticsNo());
  1810. row.createCell(19).setCellValue(customerStatisticalInfo.getRelationBackReceiptDate() == null ? null : customerStatisticalInfo.getRelationBackReceiptDate());
  1811. row.createCell(20).setCellValue(backStatus);
  1812. row.createCell(21).setCellValue(sendLogisticsCompany);
  1813. row.createCell(22).setCellValue(customerStatisticalInfo.getRelationSendLogisticsNo() == null ? null : customerStatisticalInfo.getRelationSendLogisticsNo());
  1814. row.createCell(23).setCellValue(customerStatisticalInfo.getCustomerOutDamaged() == null ? null : customerStatisticalInfo.getCustomerOutDamaged());
  1815. row.createCell(24).setCellValue(customerStatisticalInfo.getCustomerSecondaryCustomer() == null ? null : customerStatisticalInfo.getCustomerSecondaryCustomer());
  1816. row.createCell(25).setCellValue(customerStatisticalInfo.getAdminName() == null ? null : customerStatisticalInfo.getAdminName());
  1817. if(customerStatisticalInfo.getRelationFactoryCosts() == null){
  1818. row.createCell(25).setCellValue("");
  1819. }else{
  1820. row.createCell(25).setCellValue(customerStatisticalInfo.getRelationFactoryCosts());
  1821. }
  1822. if(customerStatisticalInfo.getRelationCustomerCosts() == null){
  1823. row.createCell(26).setCellValue("");
  1824. }else{
  1825. row.createCell(26).setCellValue(customerStatisticalInfo.getRelationCustomerCosts());
  1826. }
  1827. row.createCell(27).setCellValue(customerStatisticalInfo.getPostageString());
  1828. }
  1829. //下载导出订单Excel
  1830. downloadCustomerExcel(wb,downloadProgressInfo,path);
  1831. }
  1832. /**
  1833. * 下载导出客诉到本地
  1834. * @param wb
  1835. * @throws Exception
  1836. */
  1837. public void downloadCustomerExcel(HSSFWorkbook wb,DownloadProgressInfo downloadProgressInfo,String path) throws Exception{
  1838. SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
  1839. String fileName = format.format(new Date()) + "客诉报表";
  1840. try {
  1841. FileOutputStream fout = new FileOutputStream(path+"/common/customerExcel/"+fileName+downloadProgressInfo.getDownloadId()+".xls");
  1842. wb.write(fout);
  1843. fout.close();
  1844. } catch (Exception e) {
  1845. e.printStackTrace();
  1846. }
  1847. downloadProgressInfo.setDownloadStatus(2);
  1848. downloadProgressInfo.setDownloadUrl("\\common\\customerExcel\\"+fileName+downloadProgressInfo.getDownloadId()+".xls");
  1849. customerService.updateDownloadProgressInfo(downloadProgressInfo);
  1850. }
  1851. /**
  1852. * 下载导出客诉到Excel
  1853. * @param res
  1854. * @param wb
  1855. * @throws Exception
  1856. */
  1857. public void downloadCustomerExcel(HttpServletResponse res, HSSFWorkbook wb) throws Exception{
  1858. SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
  1859. String fileName = format.format(new Date()) + "客诉报表";
  1860. ByteArrayOutputStream os = new ByteArrayOutputStream();
  1861. wb.write(os);
  1862. byte[] content = os.toByteArray();
  1863. InputStream is = new ByteArrayInputStream(content);
  1864. // 设置response参数,可以打开下载页面
  1865. res.reset();
  1866. res.setContentType("application/vnd.ms-excel;charset=utf-8");
  1867. res.setHeader("Content-Disposition", "attachment;filename="
  1868. + new String((fileName + ".xls").getBytes(), "iso-8859-1"));
  1869. ServletOutputStream out = res.getOutputStream();
  1870. BufferedInputStream bis = null;
  1871. BufferedOutputStream bos = null;
  1872. try {
  1873. bis = new BufferedInputStream(is);
  1874. bos = new BufferedOutputStream(out);
  1875. byte[] buff = new byte[2048];
  1876. int bytesRead;
  1877. // Simple read/write loop.
  1878. while (-1 != (bytesRead = bis.read(buff, 0, buff.length))) {
  1879. bos.write(buff, 0, bytesRead);
  1880. }
  1881. } catch (Exception e) {
  1882. // TODO: handle exception
  1883. e.printStackTrace();
  1884. } finally {
  1885. if (bis != null)
  1886. bis.close();
  1887. if (bos != null)
  1888. bos.close();
  1889. }
  1890. }
  1891. /**
  1892. * 跳转到添加客诉页面
  1893. *
  1894. * @return
  1895. */
  1896. @RequiresPermissions("customer:statistical:customer")
  1897. @RequestMapping(value = "/to_return_statistics")
  1898. public ModelAndView toReturnStatistics(HttpServletRequest request) {
  1899. ModelAndView mv = new ModelAndView("cm/report/return_statistics");
  1900. //获取产品集合,用于页面选择产品
  1901. ProductColor productColor = new ProductColor();
  1902. List<ProductColor> productColorList = productService.listproductAndColor(productColor);
  1903. mv.addObject("productColorList", productColorList);
  1904. //查询店铺
  1905. StoreInfo storeInfo = new StoreInfo();
  1906. List<StoreInfo> storeList = storeInfoService.listStore(storeInfo);
  1907. mv.addObject("storeList", storeList);
  1908. return mv;
  1909. }
  1910. /**
  1911. * 退换货统计
  1912. * @param request
  1913. * @param salesOrder
  1914. * @return
  1915. */
  1916. @ResponseBody
  1917. @RequestMapping("/return_statistics")
  1918. public ResponseJson returnStatistics(HttpServletRequest request,SalesOrder salesOrder){
  1919. if(salesOrder.getStartDate() == null){
  1920. Date now = new Date();
  1921. Calendar c = Calendar.getInstance();
  1922. c.setTime(now);
  1923. c.set(Calendar.DAY_OF_YEAR, 1);
  1924. c.set(Calendar.HOUR, 0);
  1925. c.set(Calendar.MINUTE, 0);
  1926. c.set(Calendar.SECOND, 0);
  1927. salesOrder.setStartDate(c.getTime());
  1928. c.add(Calendar.YEAR, 1);
  1929. c.set(Calendar.DAY_OF_YEAR, -1);
  1930. c.set(Calendar.HOUR, 23);
  1931. c.set(Calendar.MINUTE, 59);
  1932. c.set(Calendar.SECOND, 59);
  1933. salesOrder.setEndDate(c.getTime());
  1934. }
  1935. if(salesOrder.getItemColorBar() != null && !salesOrder.getItemColorBar().equals("")){
  1936. List<String> listColorBar = Arrays.asList(salesOrder.getItemColorBar().split(","));
  1937. salesOrder.setListColorBar(listColorBar);
  1938. }
  1939. /*销售总数*/
  1940. List<ReturnStatisticsInfo> listTotalSales = customerService.salesTotalSales(salesOrder);
  1941. /*总换货*/
  1942. List<ReturnStatisticsInfo> listTotalExchange = customerService.salesTotalExchange(salesOrder);
  1943. /*总退货*/
  1944. List<ReturnStatisticsInfo> listTotalReturn = customerService.salesTotalReturn(salesOrder);
  1945. /*二次换货*/
  1946. List<ReturnStatisticsInfo> listSecondaryChangeNew = customerService.salesSecondaryChangeNew(salesOrder);
  1947. /*二次换新退货*/
  1948. List<ReturnStatisticsInfo> listReturnForSecond = customerService.salesReturnForSecond(salesOrder);
  1949. /*封装数据*/
  1950. List<ReturnStatisticsInfo> listReturnStatisticsInfo = new ArrayList<>();
  1951. boolean isThereAre = false;
  1952. for (int i = 1;i<=12;i++){
  1953. ReturnStatisticsInfo returnStatisticsInfo = new ReturnStatisticsInfo();
  1954. for(int j = 0;j< listTotalSales.size(); j++){
  1955. if(i == listTotalSales.get(j).getMonths()){
  1956. returnStatisticsInfo.setMonths(i);
  1957. returnStatisticsInfo.setTotalSales(listTotalSales.get(j).getNum());
  1958. isThereAre = true;
  1959. }
  1960. }
  1961. if(!isThereAre){
  1962. returnStatisticsInfo.setMonths(i);
  1963. returnStatisticsInfo.setTotalSales(0);
  1964. }
  1965. isThereAre = false;
  1966. listReturnStatisticsInfo.add(returnStatisticsInfo);
  1967. }
  1968. for(int i = 0;i<listReturnStatisticsInfo.size();i++){
  1969. for(int j = 0;j< listTotalExchange.size(); j++){
  1970. if(i+1 == listTotalExchange.get(j).getMonths()){
  1971. listReturnStatisticsInfo.get(i).setTotalExchange(listTotalExchange.get(j).getNum());
  1972. isThereAre = true;
  1973. }
  1974. }
  1975. if(!isThereAre){
  1976. listReturnStatisticsInfo.get(i).setTotalExchange(0);
  1977. }
  1978. isThereAre = false;
  1979. for(int j = 0;j< listTotalReturn.size(); j++){
  1980. if(i+1 == listTotalReturn.get(j).getMonths()){
  1981. listReturnStatisticsInfo.get(i).setTotalReturn(listTotalReturn.get(j).getNum());
  1982. isThereAre = true;
  1983. }
  1984. }
  1985. if(!isThereAre){
  1986. listReturnStatisticsInfo.get(i).setTotalReturn(0);
  1987. }
  1988. isThereAre = false;
  1989. for(int j = 0;j< listSecondaryChangeNew.size(); j++){
  1990. if(i+1 == listSecondaryChangeNew.get(j).getMonths()){
  1991. listReturnStatisticsInfo.get(i).setSecondaryChangeNew(listSecondaryChangeNew.get(j).getNum());
  1992. isThereAre = true;
  1993. }
  1994. }
  1995. if(!isThereAre){
  1996. listReturnStatisticsInfo.get(i).setSecondaryChangeNew(0);
  1997. }
  1998. isThereAre = false;
  1999. for(int j = 0;j< listReturnForSecond.size(); j++){
  2000. if(i+1 == listReturnForSecond.get(j).getMonths()){
  2001. listReturnStatisticsInfo.get(i).setReturnForSecond(listReturnForSecond.get(j).getNum());
  2002. isThereAre = true;
  2003. }
  2004. }
  2005. if(!isThereAre){
  2006. listReturnStatisticsInfo.get(i).setReturnForSecond(0);
  2007. }
  2008. isThereAre = false;
  2009. }
  2010. ResponseJson rj = new ResponseJson(200, "查询成功", 200);
  2011. rj.addResponseKeyValue("listReturnStatisticsInfo", listReturnStatisticsInfo);
  2012. return rj;
  2013. }
  2014. @RequestMapping("/to_add_customer_list")
  2015. public ModelAndView toAddCustomerList(HttpServletRequest request) throws Exception {
  2016. ModelAndView mv = new ModelAndView("cm/customer/add_custome_list");
  2017. return mv;
  2018. }
  2019. @ResponseBody
  2020. @RequestMapping("/add_customer_list")
  2021. public ResponseJson addCustomerList(HttpServletRequest request, CustomerInfo customer,
  2022. @RequestParam(value = "pageSize", defaultValue = "10", required = false) Integer pageSize,
  2023. @RequestParam(value = "pageNO", defaultValue = "1", required = false) Integer pageNO,
  2024. @RequestParam(value = "totalNum", defaultValue = "0", required = false) Integer totalNum) throws Exception {
  2025. PagedResult<CustomerInfo> pagedResult = customerService.listCustomer(pageNO, pageSize, customer, totalNum == 0);
  2026. if (totalNum != 0) {
  2027. pagedResult.setTotal(totalNum);
  2028. }
  2029. //
  2030. // //查询产品类型集合
  2031. // List<ProductType> typeList = productService.listProductType(new ProductType());
  2032. // //查询客诉类型集合
  2033. // List<ComplaintTypeInfo> complaintTypeList = complaintTypeInfoService.listComplaintTypeInfo(new ComplaintTypeInfo());
  2034. // //查询客诉类型集合
  2035. // List<ComplaintSmallClassInfo> complaintSmallClassInfoList = complaintSmallClassInfoService.listComplaintSmallClassInfo(new ComplaintSmallClassInfo());
  2036. //查询跟进客服集合
  2037. Admin admin = new Admin();
  2038. admin.setAdminDept(3);
  2039. admin.setAdminStatus(1);
  2040. List<Admin> adminList = sysService.listSelectAdmin(admin);
  2041. ResponseJson rj = ResponseJson.getSUCCESS();
  2042. // rj.addResponseKeyValue("typeList",typeList);
  2043. // rj.addResponseKeyValue("complaintTypeList",complaintTypeList);
  2044. // rj.addResponseKeyValue("complaintSmallClassInfoList",complaintSmallClassInfoList);
  2045. rj.addResponseKeyValue("adminList",adminList);
  2046. rj.addResponseKeyValue("customerList",pagedResult.getDataList());
  2047. return rj;
  2048. }
  2049. /**
  2050. * 获取邮费信息
  2051. * @param request
  2052. * @param postageId
  2053. * @return
  2054. */
  2055. @ResponseBody
  2056. @RequestMapping("/get_PostageInfo")
  2057. public ResponseJson getPostageInfo(HttpServletRequest request,Integer postageId){
  2058. ResponseJson rj = new ResponseJson(200, "查询成功", 200);
  2059. if(postageId == null){
  2060. return new ResponseJson(500, "查询失败!", 500);
  2061. }
  2062. PostageInfo postageInfo = customerService.getPostageInfo(postageId);
  2063. rj.addResponseKeyValue("postageInfo",postageInfo);
  2064. return rj;
  2065. }
  2066. /**
  2067. * 添加邮费信息
  2068. * @param request
  2069. * @param postageInfo
  2070. * @return
  2071. */
  2072. @ResponseBody
  2073. @RequestMapping("/add_PostageInfo")
  2074. public ResponseJson addPostageInfo(HttpServletRequest request,PostageInfo postageInfo){
  2075. ResponseJson rj = new ResponseJson(200, "添加成功", 200);
  2076. if(postageInfo == null){
  2077. return new ResponseJson(500, "添加失败,请检查参数!", 500);
  2078. }
  2079. Integer msg = customerService.addPostageInfo(postageInfo);
  2080. if(msg < 1){
  2081. return new ResponseJson(500, "添加失败", 500);
  2082. }
  2083. rj.addResponseKeyValue("postageInfo",postageInfo);
  2084. return rj;
  2085. }
  2086. /**
  2087. * 修改邮费信息
  2088. * @param request
  2089. * @param postageInfo
  2090. * @return
  2091. */
  2092. @ResponseBody
  2093. @RequestMapping("/update_PostageInfo")
  2094. public ResponseJson updatePostageInfo(HttpServletRequest request,PostageInfo postageInfo){
  2095. ResponseJson rj = new ResponseJson(200, "修改成功", 200);
  2096. if(postageInfo == null){
  2097. return new ResponseJson(500, "修改失败,请检查参数!", 500);
  2098. }
  2099. Integer msg = customerService.updatePostageInfo(postageInfo);
  2100. if(msg < 1){
  2101. return new ResponseJson(500, "修改失败", 500);
  2102. }
  2103. rj.addResponseKeyValue("postageInfo",postageInfo);
  2104. return rj;
  2105. }
  2106. /**
  2107. * 删除邮费信息
  2108. * @param request
  2109. * @param postageId
  2110. * @return
  2111. */
  2112. @ResponseBody
  2113. @RequestMapping("/delete_PostageInfo")
  2114. public ResponseJson deletePostageInfo(HttpServletRequest request,Integer postageId){
  2115. ResponseJson rj = new ResponseJson(200, "删除成功", 200);
  2116. if(postageId == null){
  2117. return new ResponseJson(500, "删除失败,请检查参数!", 500);
  2118. }
  2119. Integer msg = customerService.deletePostageInfo(postageId);
  2120. if(msg < 1){
  2121. return new ResponseJson(500, "删除失败", 500);
  2122. }
  2123. return rj;
  2124. }
  2125. /**
  2126. * 获取寄回信息
  2127. * @param request
  2128. * @param sendbackId
  2129. * @return
  2130. */
  2131. @ResponseBody
  2132. @RequestMapping("/get_SendbackInfo")
  2133. public ResponseJson getSendbackInfo(HttpServletRequest request,Integer sendbackId){
  2134. ResponseJson rj = new ResponseJson(200, "查询成功", 200);
  2135. if(sendbackId == null){
  2136. return new ResponseJson(500, "查询失败!", 500);
  2137. }
  2138. SendbackInfo sendbackInfo = customerService.getSendbackInfo(sendbackId);
  2139. rj.addResponseKeyValue("sendbackInfo",sendbackInfo);
  2140. return rj;
  2141. }
  2142. /**
  2143. * 添加寄回信息
  2144. * @param request
  2145. * @param sendbackInfo
  2146. * @return
  2147. */
  2148. @ResponseBody
  2149. @RequestMapping("/add_SendbackInfo")
  2150. public ResponseJson addSendbackInfo(HttpServletRequest request,SendbackInfo sendbackInfo){
  2151. ResponseJson rj = new ResponseJson(200, "添加成功", 200);
  2152. if(sendbackInfo == null){
  2153. return new ResponseJson(500, "添加失败,请检查参数!", 500);
  2154. }
  2155. /*signTime*/
  2156. SendbackInfo info = customerService.addSendbackInfo(sendbackInfo);
  2157. if(info == null){
  2158. return new ResponseJson(500, "添加失败", 500);
  2159. }
  2160. SendbackInfo info1 = customerService.getSendbackInfo(sendbackInfo.getSendbackId());
  2161. rj.addResponseKeyValue("sendbackInfo",info1);
  2162. return rj;
  2163. }
  2164. /**
  2165. * 修改寄回信息
  2166. * @param request
  2167. * @param sendbackInfo
  2168. * @return
  2169. */
  2170. @ResponseBody
  2171. @RequestMapping("/update_SendbackInfo")
  2172. public ResponseJson updateSendbackInfo(HttpServletRequest request,SendbackInfo sendbackInfo){
  2173. ResponseJson rj = new ResponseJson(200, "修改成功", 200);
  2174. if(sendbackInfo == null){
  2175. return new ResponseJson(500, "修改失败,请检查参数!", 500);
  2176. }
  2177. SendbackInfo info = customerService.updateSendbackInfo(sendbackInfo);
  2178. if(info == null){
  2179. return new ResponseJson(500, "修改失败", 500);
  2180. }
  2181. SendbackInfo info1 = customerService.getSendbackInfo(sendbackInfo.getSendbackId());
  2182. rj.addResponseKeyValue("sendbackInfo",info1);
  2183. return rj;
  2184. }
  2185. /**
  2186. * 修改寄回状态为已签收
  2187. * @param request
  2188. * @param sendbackInfo
  2189. * @return
  2190. */
  2191. @ResponseBody
  2192. @RequestMapping("/update_SendbackStatus")
  2193. public ResponseJson updateSendbackStatus(HttpServletRequest request,SendbackInfo sendbackInfo){
  2194. ResponseJson rj = new ResponseJson(200, "修改成功", 200);
  2195. if(sendbackInfo == null){
  2196. return new ResponseJson(500, "修改失败,请检查参数!", 500);
  2197. }
  2198. if(customerService.updateSendbackStatus(sendbackInfo) < 1){
  2199. return new ResponseJson(500, "修改失败", 500);
  2200. }
  2201. SendbackInfo info1 = customerService.getSendbackInfo(sendbackInfo.getSendbackId());
  2202. rj.addResponseKeyValue("sendbackInfo",info1);
  2203. return rj;
  2204. }
  2205. /**
  2206. * 删除单个寄回信息
  2207. * @param request
  2208. * @param sendbackId
  2209. * @return
  2210. */
  2211. @ResponseBody
  2212. @RequestMapping("/delete_SendbackInfo")
  2213. public ResponseJson deleteSendbackInfo(HttpServletRequest request,Integer sendbackId){
  2214. ResponseJson rj = new ResponseJson(200, "删除成功", 200);
  2215. if(sendbackId == null){
  2216. return new ResponseJson(500, "删除失败,请检查参数!", 500);
  2217. }
  2218. Integer msg = customerService.deleteSendbackInfo(sendbackId);
  2219. if(msg > 0){
  2220. complaintSignclosedInfoService.delSignclosedBySendbackId(sendbackId);
  2221. }else{
  2222. return new ResponseJson(500, "删除失败", 500);
  2223. }
  2224. return rj;
  2225. }
  2226. /**
  2227. * 同步邮费信息
  2228. * @param request
  2229. * @param
  2230. * @return
  2231. */
  2232. /*@ResponseBody
  2233. @RequestMapping("/synchronize_PostageInfo")*/
  2234. public ResponseJson synchronizePostageInfo(HttpServletRequest request){
  2235. String msg = customerService.synchronizePostageInfo();
  2236. return new ResponseJson(200, msg, 200);
  2237. }
  2238. /**
  2239. * 同步寄回信息
  2240. * @param request
  2241. * @param
  2242. * @return
  2243. */
  2244. /*@ResponseBody
  2245. @RequestMapping("/synchronizeSendbackInfo")*/
  2246. public ResponseJson synchronizeSendbackInfo(HttpServletRequest request){
  2247. String msg = customerService.synchronizeSendbackInfo();
  2248. return new ResponseJson(200, msg, 200);
  2249. }
  2250. /**
  2251. * 添加收费
  2252. * @param request
  2253. * @param informationInfo
  2254. * @return
  2255. */
  2256. @ResponseBody
  2257. @RequestMapping("/add_informationInfo")
  2258. public ResponseJson addInformationInfo(HttpServletRequest request,InformationInfo informationInfo){
  2259. ResponseJson rj = new ResponseJson(200, "添加成功", 200);
  2260. if(informationInfo == null){
  2261. return new ResponseJson(500, "添加失败,请检查参数!", 500);
  2262. }
  2263. /*signTime*/
  2264. Integer msg = customerService.addInformationInfo(informationInfo);
  2265. if(msg < 1){
  2266. return new ResponseJson(500, "添加失败", 500);
  2267. }
  2268. InformationInfo info = customerService.getInformationInfo(informationInfo.getFeeId());
  2269. rj.addResponseKeyValue("informationInfo",info);
  2270. return rj;
  2271. }
  2272. /**
  2273. * 修改收费
  2274. * @param request
  2275. * @param informationInfo
  2276. * @return
  2277. */
  2278. @ResponseBody
  2279. @RequestMapping("/update_informationInfo")
  2280. public ResponseJson updateInformationInfo(HttpServletRequest request,InformationInfo informationInfo){
  2281. ResponseJson rj = new ResponseJson(200, "修改成功", 200);
  2282. if(informationInfo == null){
  2283. return new ResponseJson(500, "修改失败,请检查参数!", 500);
  2284. }
  2285. /*signTime*/
  2286. Integer msg = customerService.updateInformationInfo(informationInfo);
  2287. if(msg < 1){
  2288. return new ResponseJson(500, "修改失败", 500);
  2289. }
  2290. InformationInfo info = customerService.getInformationInfo(informationInfo.getFeeId());
  2291. rj.addResponseKeyValue("informationInfo",info);
  2292. return rj;
  2293. }
  2294. /**
  2295. * 删除单个收费信息
  2296. * @param request
  2297. * @param feeId
  2298. * @return
  2299. */
  2300. @ResponseBody
  2301. @RequestMapping("/delete_informationInfo")
  2302. public ResponseJson deleteInformationInfo(HttpServletRequest request,Integer feeId){
  2303. ResponseJson rj = new ResponseJson(200, "删除成功", 200);
  2304. if(feeId == null){
  2305. return new ResponseJson(500, "删除失败,请检查参数!", 500);
  2306. }
  2307. Integer msg = customerService.delInformationInfo(feeId);
  2308. if(msg < 1){
  2309. return new ResponseJson(500, "删除失败", 500);
  2310. }
  2311. return rj;
  2312. }
  2313. /**
  2314. * 查询单个收费信息
  2315. * @param request
  2316. * @param feeId
  2317. * @return
  2318. */
  2319. @ResponseBody
  2320. @RequestMapping("/get_informationInfo")
  2321. public ResponseJson getInformationInfo(HttpServletRequest request,Integer feeId){
  2322. ResponseJson rj = new ResponseJson(200, "查询成功", 200);
  2323. if(feeId == null){
  2324. return new ResponseJson(500, "查询成功,请检查参数!", 500);
  2325. }
  2326. InformationInfo informationInfo = customerService.getInformationInfo(feeId);
  2327. if(informationInfo == null){
  2328. return new ResponseJson(500, "查询成功", 500);
  2329. }
  2330. rj.addResponseKeyValue("informationInfo",informationInfo);
  2331. return rj;
  2332. }
  2333. }