1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338 |
- package com.iamberry.rst.controllers.cm;
- import com.iamberry.rst.core.cm.*;
- import com.iamberry.rst.core.fm.ComplaintSignclosedInfo;
- import com.iamberry.rst.core.fm.ComplaintSmallClassInfo;
- import com.iamberry.rst.core.order.Product;
- import com.iamberry.rst.core.order.ProductColor;
- import com.iamberry.rst.core.order.ProductType;
- import com.iamberry.rst.core.page.PagedResult;
- import com.iamberry.rst.core.sys.Admin;
- import com.iamberry.rst.core.tools.LogisticsInfo;
- import com.iamberry.rst.faces.address.AddressService;
- import com.iamberry.rst.faces.cm.*;
- import com.iamberry.rst.faces.fm.ComplaintSignclosedInfoService;
- import com.iamberry.rst.faces.fm.ComplaintSmallClassInfoService;
- import com.iamberry.rst.faces.order.EfastOrderService;
- import com.iamberry.rst.faces.order.LogisticsInfoService;
- import com.iamberry.rst.faces.product.ProductService;
- import com.iamberry.rst.faces.sms.SmsService;
- import com.iamberry.rst.faces.sys.SysService;
- import com.iamberry.rst.util.SmsConfig;
- import com.iamberry.rst.utils.*;
- import com.iamberry.wechat.tools.NameUtils;
- import com.iamberry.wechat.tools.ResponseJson;
- import com.iamberry.wechat.tools.ResultInfo;
- import net.sf.json.JSONArray;
- import net.sf.json.JSONObject;
- import org.apache.commons.codec.binary.Base64;
- import org.apache.commons.lang.StringUtils;
- import org.apache.poi.hssf.usermodel.*;
- import org.apache.shiro.authz.annotation.RequiresPermissions;
- import org.slf4j.Logger;
- import org.slf4j.LoggerFactory;
- import org.springframework.beans.BeanUtils;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Controller;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RequestParam;
- import org.springframework.web.bind.annotation.ResponseBody;
- import org.springframework.web.servlet.ModelAndView;
- import javax.servlet.ServletOutputStream;
- import javax.servlet.http.HttpServletRequest;
- import javax.servlet.http.HttpServletResponse;
- import java.io.*;
- import java.text.MessageFormat;
- import java.text.SimpleDateFormat;
- import java.util.*;
- /**
- * Created by wxm
- */
- @Controller
- @RequestMapping("/admin/customer")
- public class AdminCustomerController {
- private Logger logger = LoggerFactory.getLogger(AdminCustomerController.class);
- @Autowired
- private CompanyInfoService companyInfoService;
- @Autowired
- private StoreInfoService storeInfoService;
- @Autowired
- private SalesOrderService salesOrderService;
- @Autowired
- private CustomerService customerService;
- @Autowired
- private ProductService productService;
- @Autowired
- private SysService sysService;
- @Autowired
- private ComplaintTypeInfoService complaintTypeInfoService;
- @Autowired
- private VisitService visitService;
- @Autowired
- private QuestionDescribeService questionDescribeService;
- @Autowired
- private ComplaintQuestionInfoService complaintQuestionInfoService;
- @Autowired
- private SmsService smsService;
- @Autowired
- private ComplaintSignclosedInfoService complaintSignclosedInfoService;
- @Autowired
- private ComplaintSmallClassInfoService complaintSmallClassInfoService;
- @Autowired
- private AddressService addressService;
- @Autowired
- private PostageService postageService;
- @Autowired
- private EfastOrderService efastOrderService;
- @Autowired
- private RelationOrderService relationOrderService;
- @Autowired
- private GenerateKeyUtil generateKeyUtil ;
- @Autowired
- private CmRelationService cmRelationService ;
- @Autowired
- private ProcMethodService procMethodService ;
- @Autowired
- private LogisticsInfoService logisticsInfoService;
- /**
- * 获取客诉列表
- *
- * @param request
- * @return
- */
- @RequiresPermissions("customer:list:customer")
- @RequestMapping("/_customer_list")
- public ModelAndView getCustomer(HttpServletRequest request, CustomerInfo customer,
- @RequestParam(value = "pageSize", defaultValue = "10", required = false) Integer pageSize,
- @RequestParam(value = "pageNO", defaultValue = "1", required = false) Integer pageNO,
- @RequestParam(value = "totalNum", defaultValue = "0", required = false) Integer totalNum) {
- ModelAndView mv = new ModelAndView("cm/customer/custome_list");
- // PagedResult<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);
- }
- 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);
- mv.addObject("listClosedProdcue",listClosedProdcue);
- mv.addObject("listSendbackInfo",listSendbackInfo);
- mv.addObject("logisticsInfoList",logisticsInfoList);
- mv.addObject("listPostageInfo", listPostageInfo);
- mv.addObject("procMethod", procMethod);
- mv.addObject("customerId", customerId);
- return mv;
- }
- /**
- * 查询客诉基本信息
- *
- * @param request
- * @return
- * @throws Exception
- */
- @ResponseBody
- @RequiresPermissions("customer:select:customer")
- @RequestMapping("/get_customer_info")
- public ResponseJson getCustomerInfo(HttpServletRequest request) throws Exception {
- String customerId = request.getParameter("customerId");
- if (!StringUtils.isNotEmpty(customerId)) {
- return new ResponseJson(500, "该客诉信息不存在!", 500);
- }
- CustomerInfo customerInfo = new CustomerInfo();
- customerInfo.setCustomerId(Integer.parseInt(customerId));
- Map<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());
- rj.addResponseKeyValue("cmRelation", cmRelation);
- rj.addResponseKeyValue("procMethod", procMethod);
- rj.addResponseKeyValue("customerCommon", map.get("customerCommon"));
- rj.addResponseKeyValue("customer", map.get("customer"));
- rj.addResponseKeyValue("orderList", map.get("orderList"));
- return rj;
- }
- /**
- * 查询客诉基本信息
- *
- * @param request
- * @return
- * @throws Exception
- */
- @ResponseBody
- @RequiresPermissions("customer:select:customer")
- @RequestMapping("/get_customer")
- public ResponseJson getCustomer(HttpServletRequest request) throws Exception {
- String customerId = request.getParameter("customerId");
- if (!StringUtils.isNotEmpty(customerId)) {
- return new ResponseJson(500, "该客诉信息不存在!", 500);
- }
- SalesOrder salesOrder = new SalesOrder();
- salesOrder.setSalesCustomerId(Integer.valueOf(customerId));
- List<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());
- //查询寄回产品
- 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);
- return mv;
- }
- /**
- * 获取售后详情
- *
- * @param request
- * @return
- */
- @ResponseBody
- @RequiresPermissions("customer:get:renewed")
- @RequestMapping("/get_cmRelation_info")
- public ResponseJson getRenewedInfo(HttpServletRequest request) throws Exception {
- String customerId = request.getParameter("customerId");
- if (!StringUtils.isNotEmpty(customerId)) {
- return new ResponseJson(500, "该客诉信息不存在!", 500);
- }
- CmRelation cmRelation = new CmRelation();
- cmRelation.setCustomerId(Integer.parseInt(customerId));
- //获取换新详情和检测信息
- cmRelation = customerService.getCmRelationInfo(cmRelation);
- if (cmRelation == null) {
- return new ResponseJson(500, "该客诉没有售后信息!", 500);
- } else {
- ResponseJson rj = new ResponseJson(200, "查询成功", 200);
- rj.addResponseKeyValue("cmRelation", cmRelation);
- return rj;
- }
- }
- /**
- * 修改处理信息
- *
- * @param request
- * @param cmRelation
- * @return
- * @throws Exception
- */
- @ResponseBody
- @RequiresPermissions("customer:update:renewed")
- @RequestMapping("/update_cmRelation_info")
- public ResponseJson updateRenewedInfo(HttpServletRequest request, CmRelation cmRelation) throws Exception {
- String mergeAddress = request.getParameter("merge_address");
- if (!StringUtils.isNotEmpty(cmRelation.getRelationId().toString())) {
- return new ResponseJson(500, "该售后信息不能修改!", 500);
- }
- if (StringUtils.isNotEmpty(mergeAddress)) {
- cmRelation.setRelationSendMergeAddress(mergeAddress);
- }
- if (cmRelation.getRelationBackStatus() != null) {
- if (cmRelation.getRelationBackStatus() != 1) {
- ComplaintSignclosedInfo cs = new ComplaintSignclosedInfo();
- cs.setSignclosedCustomerId(cmRelation.getCustomerId());
- cs.setSignclosedLogistics(cmRelation.getRelationBackLogisticsCompany());
- cs.setSignclosedLogisticsNumber(cmRelation.getRelationBackLogisticsNo());
- complaintSignclosedInfoService.updateSignclosedByCustomerId(cs);
- }
- }
- //修改售后信息
- int num = customerService.updateCmRelation(cmRelation);
- if (num > 0) {
- return new ResponseJson(200, "修改成功!", 200);
- } else {
- return new ResponseJson(500, "修改失败!", 500);
- }
- }
- /**
- * 查询未解决客诉数量
- */
- @ResponseBody
- @RequestMapping(value = "/selectNumberBacklog")
- public ResultMsg selectTodo(HttpServletRequest request) {
- ResultMsg msg = new ResultMsg();
- CustomerInfo customerInfo = new CustomerInfo();
- //获取登录员工id
- Admin admin = AdminUtils.getLoginAdmin();
- // customerInfo.setAdminId(admin.getAdminId());
- // customerInfo.setCustomerIsSolve(2);
- //未解决客诉数量
- // Integer notSolvedCustomer = customerService.selectNotSolvedCustomer(customerInfo);
- //需要向工厂确认所有已签收的产品数量
- // CustomerCommon customerCommon = new CustomerCommon();
- // customerCommon.setAdminId(admin.getAdminId());
- // customerCommon.setRelationBackStatus(4);
- // Integer amountReceivedCustomer = customerCommonService.listCustomerCommonByStatus(customerCommon);
- //需要填写Efast订单号的客诉数量
- // customerCommon.setRelationBackStatus(3);
- // Integer noEntryCustomer = customerCommonService.listCustomerCommonByStatus(customerCommon);
- //客诉录入后,三天后未寄回的客诉数量
- // customerCommon.setRelationBackStatus(1);
- // customerCommon.setRelationCreateTime(new Date());
- // Integer notSendCustomer = customerCommonService.listCustomerCommonByStatus(customerCommon);
- SalesOrder salesOrder = new SalesOrder();
- salesOrder.setSalesStatus(0); //未确认
- Integer toBeConfirmedOrder = salesOrderService.listSalesOrderNum(salesOrder);
- salesOrder = new SalesOrder();
- salesOrder.setSalesShippingStatus(0); //未发货
- Integer toBeAnnounced = salesOrderService.listSalesOrderNum(salesOrder);
- salesOrder.setSalesShippingStatus(11); //已通知配货
- Integer toBeDelivered = salesOrderService.listSalesOrderNum(salesOrder);
- Calendar calendar = Calendar.getInstance();
- calendar.set(Calendar.HOUR_OF_DAY,00);
- calendar.set(Calendar.MINUTE,00);
- calendar.set(Calendar.SECOND,01);
- salesOrder = new SalesOrder();
- salesOrder.setStartDate(calendar.getTime()); //startDate
- Calendar ca = Calendar.getInstance();
- ca.set(Calendar.HOUR_OF_DAY,23);
- ca.set(Calendar.MINUTE,59);
- ca.set(Calendar.SECOND,59);
- salesOrder.setEndDate(ca.getTime());
- Integer allToDayOrder = salesOrderService.listSalesOrderNum(salesOrder);
- Map<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;
- }
- }
- /**
- * 下载客诉信息 (2018-05-29)
- *
- * @param request
- * @param res
- * @param
- * @throws Exception
- */
- @RequestMapping("/download_customer_excel")
- public void downloadEfastOrderExcel(HttpServletRequest request, HttpServletResponse res) throws Exception {
- List<CustomerStatisticalInfo> customerList = customerService.listStatisticalCustomer();
- String[] cells = {
- "日期", "姓名", "联系电话", "类别", "来源入口",
- "问题类别", "小类名称", "客诉问题", "处理过程", "购买日期",
- "处理方式","处理结果", "销售公司", "销售渠道", "产品型号", "产品颜色",
- "产品数量", "寄回快递", "寄回单号", "签收日期",
- "状态", "寄出快递", "寄出快递", "开箱损", "二次客诉", "跟进客服", "工厂报价", "客户报价", "邮费信息"
- };
- List<CustomerStatisticalInfo> customerStatisticalInfoList = new ArrayList<>();
- SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
- for (CustomerStatisticalInfo customerInfo : customerList) {
- //新建一个容器
- CustomerStatisticalInfo customer = new CustomerStatisticalInfo();
- //将数据copy到新容器
- BeanUtils.copyProperties(customerInfo, customer);
- CustomerCommon customerCommon = new CustomerCommon();
- customerCommon.setCustomerId(customerInfo.getCustomerId());
- customerCommon.setRelationId(customerInfo.getRelationId());
- List<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);
- }
- }
- //导出订单Excel并下载
- customerExcel(request,res,cells,customerStatisticalInfoList);
- }
- /**
- * 导出订单Excel并下载
- * @param request
- * @param res
- * @param cells
- * @throws Exception
- */
- public void customerExcel(HttpServletRequest request,HttpServletResponse res,
- String[] cells,List<CustomerStatisticalInfo> customerList) throws Exception {
- //创建一个workbook,对应一个Excel文件
- HSSFWorkbook wb = new HSSFWorkbook();
- //在workbook中添加一个sheet,对应Excel中的一个sheet
- HSSFSheet sheet = wb.createSheet("导出订单");
- //在sheet中添加表头第0行,老版本poi对excel行数列数有限制short
- HSSFRow row = sheet.createRow((int) 0);
- //创建单元格,设置值表头,设置表头居中
- HSSFCellStyle style = wb.createCellStyle();
- //居中格式
- style.setAlignment(HSSFCellStyle.ALIGN_CENTER);
- //设置表头
- if (cells == null || cells.length == 0) {
- return;
- }
- //循环设置表头
- HSSFCell cell = null;
- for (int i = 0;i < cells.length;i++) {
- String name = cells[i];
- cell = row.createCell(i);
- cell.setCellValue(name);
- cell.setCellStyle(style);
- }
- SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
- for (int i = 0; i < customerList.size(); i++) {
- row = sheet.createRow((int) i + 1);
- CustomerStatisticalInfo customerStatisticalInfo = customerList.get(i);
- String createTime = "";
- if(customerStatisticalInfo.getCreateTime() != null){
- createTime = format.format(customerStatisticalInfo.getCreateTime());
- }
- String salesPayTime = "";
- if(customerStatisticalInfo.getSalesPayTime() != null ){
- salesPayTime = format.format(customerStatisticalInfo.getSalesPayTime());
- }
- String backLogisticsCompany = "";
- if(customerStatisticalInfo.getRelationBackLogisticsCompany() != null){
- backLogisticsCompany = KuaiDi100.replace(customerStatisticalInfo.getRelationBackLogisticsCompany());
- }
- String backStatus = "未知";
- if(customerStatisticalInfo.getRelationBackStatus() != null){
- if(customerStatisticalInfo.getRelationBackStatus().equals("1")){
- backStatus = "未寄回";
- }
- if(customerStatisticalInfo.getRelationBackStatus().equals("2")){
- backStatus = "已寄回";
- }
- if(customerStatisticalInfo.getRelationBackStatus().equals("3")){
- backStatus = "已收货";
- }
- }
- String sendLogisticsCompany = "";
- if(customerStatisticalInfo.getRelationSendLogisticsCompany() != null){
- sendLogisticsCompany = KuaiDi100.replace(customerStatisticalInfo.getRelationSendLogisticsCompany());
- }
- // 创建单元格,设置值
- row.createCell(0).setCellValue(createTime);
- row.createCell(1).setCellValue(customerStatisticalInfo.getCustomerName() == null ? null : customerStatisticalInfo.getCustomerName());
- row.createCell(2).setCellValue(customerStatisticalInfo.getCustomerTel() == null ? null : customerStatisticalInfo.getCustomerTel());
- row.createCell(3).setCellValue(customerStatisticalInfo.getCounselType() == null ? null : customerStatisticalInfo.getCounselType());
- row.createCell(4).setCellValue(customerStatisticalInfo.getSourceType() == null ? null : customerStatisticalInfo.getSourceType());
- row.createCell(5).setCellValue(customerStatisticalInfo.getComplaintClassName() == null ? null : customerStatisticalInfo.getComplaintClassName());
- row.createCell(6).setCellValue(customerStatisticalInfo.getSmallClassName() == null ? null : customerStatisticalInfo.getSmallClassName());
- row.createCell(7).setCellValue(customerStatisticalInfo.getDescribeTitle() == null ? null : customerStatisticalInfo.getDescribeTitle());
- row.createCell(8).setCellValue(customerStatisticalInfo.getDescribeHandleDesc() == null ? null : customerStatisticalInfo.getDescribeHandleDesc());
- row.createCell(9).setCellValue(salesPayTime);
- row.createCell(10).setCellValue(customerStatisticalInfo.getProcMethodName() == null ? null : customerStatisticalInfo.getProcMethodName());
- row.createCell(11).setCellValue(customerStatisticalInfo.getCustomerIsSolve() == null ? null : customerStatisticalInfo.getCustomerIsSolve());
- row.createCell(12).setCellValue(customerStatisticalInfo.getCompanyName() == null ? null : customerStatisticalInfo.getCompanyName());
- row.createCell(13).setCellValue(customerStatisticalInfo.getStoreName() == null ? null : customerStatisticalInfo.getStoreName());
- row.createCell(14).setCellValue(customerStatisticalInfo.getItemProductName() == null ? null : customerStatisticalInfo.getItemProductName());
- row.createCell(15).setCellValue(customerStatisticalInfo.getItemProductColor() == null ? null : customerStatisticalInfo.getItemProductColor());
- row.createCell(16).setCellValue(customerStatisticalInfo.getItemNum() == null ? null : customerStatisticalInfo.getItemNum());
- row.createCell(17).setCellValue(backLogisticsCompany);
- row.createCell(18).setCellValue(customerStatisticalInfo.getRelationBackLogisticsNo() == null ? null : customerStatisticalInfo.getRelationBackLogisticsNo());
- row.createCell(19).setCellValue(customerStatisticalInfo.getRelationBackReceiptDate() == null ? null : customerStatisticalInfo.getRelationBackReceiptDate());
- row.createCell(20).setCellValue(backStatus);
- row.createCell(21).setCellValue(sendLogisticsCompany);
- row.createCell(22).setCellValue(customerStatisticalInfo.getRelationSendLogisticsNo() == null ? null : customerStatisticalInfo.getRelationSendLogisticsNo());
- row.createCell(23).setCellValue(customerStatisticalInfo.getCustomerOutDamaged() == null ? null : customerStatisticalInfo.getCustomerOutDamaged());
- row.createCell(24).setCellValue(customerStatisticalInfo.getCustomerSecondaryCustomer() == null ? null : customerStatisticalInfo.getCustomerSecondaryCustomer());
- row.createCell(25).setCellValue(customerStatisticalInfo.getAdminName() == null ? null : customerStatisticalInfo.getAdminName());
- if(customerStatisticalInfo.getRelationFactoryCosts() == null){
- row.createCell(25).setCellValue("");
- }else{
- row.createCell(25).setCellValue(customerStatisticalInfo.getRelationFactoryCosts());
- }
- if(customerStatisticalInfo.getRelationCustomerCosts() == null){
- row.createCell(26).setCellValue("");
- }else{
- row.createCell(26).setCellValue(customerStatisticalInfo.getRelationCustomerCosts());
- }
- row.createCell(27).setCellValue(customerStatisticalInfo.getPostageString());
- }
- //下载导出订单Excel
- downloadCustomerExcel(res,wb);
- }
- /**
- * 下载导出客诉到Excel
- * @param res
- * @param wb
- * @throws Exception
- */
- public void downloadCustomerExcel(HttpServletResponse res, HSSFWorkbook wb) throws Exception{
- SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
- String fileName = format.format(new Date()) + "客诉报表";
- ByteArrayOutputStream os = new ByteArrayOutputStream();
- wb.write(os);
- byte[] content = os.toByteArray();
- InputStream is = new ByteArrayInputStream(content);
- // 设置response参数,可以打开下载页面
- res.reset();
- res.setContentType("application/vnd.ms-excel;charset=utf-8");
- res.setHeader("Content-Disposition", "attachment;filename="
- + new String((fileName + ".xls").getBytes(), "iso-8859-1"));
- ServletOutputStream out = res.getOutputStream();
- BufferedInputStream bis = null;
- BufferedOutputStream bos = null;
- try {
- bis = new BufferedInputStream(is);
- bos = new BufferedOutputStream(out);
- byte[] buff = new byte[2048];
- int bytesRead;
- // Simple read/write loop.
- while (-1 != (bytesRead = bis.read(buff, 0, buff.length))) {
- bos.write(buff, 0, bytesRead);
- }
- } catch (Exception e) {
- // TODO: handle exception
- e.printStackTrace();
- } finally {
- if (bis != null)
- bis.close();
- if (bos != null)
- bos.close();
- }
- }
- /**
- * 跳转到添加客诉页面
- *
- * @return
- */
- @RequiresPermissions("customer:statistical:customer")
- @RequestMapping(value = "/to_return_statistics")
- public ModelAndView toReturnStatistics(HttpServletRequest request) {
- ModelAndView mv = new ModelAndView("cm/report/return_statistics");
- //获取产品集合,用于页面选择产品
- ProductColor productColor = new ProductColor();
- List<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 < 1){
- return new ResponseJson(500, "删除失败", 500);
- }
- return rj;
- }
- /**
- * 同步邮费信息
- * @param request
- * @param
- * @return
- */
- /*@ResponseBody
- @RequestMapping("/synchronize_PostageInfo")*/
- public ResponseJson synchronizePostageInfo(HttpServletRequest request){
- String msg = customerService.synchronizePostageInfo();
- return new ResponseJson(200, msg, 200);
- }
- /**
- * 同步寄回信息
- * @param request
- * @param
- * @return
- */
- /*@ResponseBody
- @RequestMapping("/synchronizeSendbackInfo")*/
- public ResponseJson synchronizeSendbackInfo(HttpServletRequest request){
- String msg = customerService.synchronizeSendbackInfo();
- return new ResponseJson(200, msg, 200);
- }
- /**
- * 添加收费
- * @param request
- * @param informationInfo
- * @return
- */
- @ResponseBody
- @RequestMapping("/add_informationInfo")
- public ResponseJson addInformationInfo(HttpServletRequest request,InformationInfo informationInfo){
- ResponseJson rj = new ResponseJson(200, "添加成功", 200);
- if(informationInfo == null){
- return new ResponseJson(500, "添加失败,请检查参数!", 500);
- }
- /*signTime*/
- Integer msg = customerService.addInformationInfo(informationInfo);
- if(msg < 1){
- return new ResponseJson(500, "添加失败", 500);
- }
- InformationInfo info = customerService.getInformationInfo(informationInfo.getFeeId());
- rj.addResponseKeyValue("informationInfo",info);
- return rj;
- }
- /**
- * 修改收费
- * @param request
- * @param informationInfo
- * @return
- */
- @ResponseBody
- @RequestMapping("/update_informationInfo")
- public ResponseJson updateInformationInfo(HttpServletRequest request,InformationInfo informationInfo){
- ResponseJson rj = new ResponseJson(200, "修改成功", 200);
- if(informationInfo == null){
- return new ResponseJson(500, "修改失败,请检查参数!", 500);
- }
- /*signTime*/
- Integer msg = customerService.updateInformationInfo(informationInfo);
- if(msg < 1){
- return new ResponseJson(500, "修改失败", 500);
- }
- InformationInfo info = customerService.getInformationInfo(informationInfo.getFeeId());
- rj.addResponseKeyValue("informationInfo",info);
- return rj;
- }
- /**
- * 删除单个收费信息
- * @param request
- * @param feeId
- * @return
- */
- @ResponseBody
- @RequestMapping("/delete_informationInfo")
- public ResponseJson deleteInformationInfo(HttpServletRequest request,Integer feeId){
- ResponseJson rj = new ResponseJson(200, "删除成功", 200);
- if(feeId == null){
- return new ResponseJson(500, "删除失败,请检查参数!", 500);
- }
- Integer msg = customerService.delInformationInfo(feeId);
- if(msg < 1){
- return new ResponseJson(500, "删除失败", 500);
- }
- return rj;
- }
- /**
- * 查询单个收费信息
- * @param request
- * @param feeId
- * @return
- */
- @ResponseBody
- @RequestMapping("/get_informationInfo")
- public ResponseJson getInformationInfo(HttpServletRequest request,Integer feeId){
- ResponseJson rj = new ResponseJson(200, "查询成功", 200);
- if(feeId == null){
- return new ResponseJson(500, "查询成功,请检查参数!", 500);
- }
- InformationInfo informationInfo = customerService.getInformationInfo(feeId);
- if(informationInfo == null){
- return new ResponseJson(500, "查询成功", 500);
- }
- rj.addResponseKeyValue("informationInfo",informationInfo);
- return rj;
- }
- }
|