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