|  | @@ -1,22 +1,9 @@
 | 
	
		
			
				|  |  |  package com.iamberry.rst.controllers.customer;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -import com.iamberry.rst.controllers.cm.AdminCustomerController;
 | 
	
		
			
				|  |  | -import com.iamberry.rst.core.cm.*;
 | 
	
		
			
				|  |  | -import com.iamberry.rst.core.order.ProductType;
 | 
	
		
			
				|  |  | -import com.iamberry.rst.core.sys.Admin;
 | 
	
		
			
				|  |  | -import com.iamberry.rst.faces.address.AddressService;
 | 
	
		
			
				|  |  | -import com.iamberry.rst.faces.cm.*;
 | 
	
		
			
				|  |  | -import com.iamberry.rst.faces.customer.CustomerBasicService;
 | 
	
		
			
				|  |  | -import com.iamberry.rst.faces.order.EfastOrderService;
 | 
	
		
			
				|  |  | -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.CustomerCommonUtil;
 | 
	
		
			
				|  |  | -import com.iamberry.rst.util.SmsConfig;
 | 
	
		
			
				|  |  | -import com.iamberry.rst.utils.AdminUtils;
 | 
	
		
			
				|  |  | -import com.iamberry.rst.utils.OrderNoUtil;
 | 
	
		
			
				|  |  | +import com.iamberry.rst.core.customer.*;
 | 
	
		
			
				|  |  | +import com.iamberry.rst.faces.customer.CustomerBasicInfoSaveService;
 | 
	
		
			
				|  |  |  import com.iamberry.wechat.tools.ResponseJson;
 | 
	
		
			
				|  |  | -import net.sf.json.JSONArray;
 | 
	
		
			
				|  |  | +import org.apache.commons.lang.StringUtils;
 | 
	
		
			
				|  |  |  import org.apache.shiro.authz.annotation.RequiresPermissions;
 | 
	
		
			
				|  |  |  import org.slf4j.Logger;
 | 
	
		
			
				|  |  |  import org.slf4j.LoggerFactory;
 | 
	
	
		
			
				|  | @@ -25,73 +12,26 @@ import org.springframework.stereotype.Controller;
 | 
	
		
			
				|  |  |  import org.springframework.web.bind.annotation.RequestMapping;
 | 
	
		
			
				|  |  |  import org.springframework.web.bind.annotation.ResponseBody;
 | 
	
		
			
				|  |  |  import org.springframework.web.servlet.ModelAndView;
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |  import javax.servlet.http.HttpServletRequest;
 | 
	
		
			
				|  |  |  import java.util.ArrayList;
 | 
	
		
			
				|  |  |  import java.util.List;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  @Controller
 | 
	
		
			
				|  |  |  @RequestMapping("/admin/CustomerBasic")
 | 
	
		
			
				|  |  |  public class CustomerBasicInfoSaveController {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      private Logger logger = LoggerFactory.getLogger(CustomerBasicInfoSaveController.class);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  | -    private CustomerBasicService customerBasicService;
 | 
	
		
			
				|  |  | -    @Autowired
 | 
	
		
			
				|  |  | -    private CompanyInfoService companyInfoService;
 | 
	
		
			
				|  |  | -    @Autowired
 | 
	
		
			
				|  |  | -    private StoreInfoService storeInfoService;
 | 
	
		
			
				|  |  | -    @Autowired
 | 
	
		
			
				|  |  | -    private SalesOrderService salesOrderService;
 | 
	
		
			
				|  |  | -    @Autowired
 | 
	
		
			
				|  |  | -    private CustomerService customerService;
 | 
	
		
			
				|  |  | -    @Autowired
 | 
	
		
			
				|  |  | -    private ProductService productService;
 | 
	
		
			
				|  |  | -    @Autowired
 | 
	
		
			
				|  |  | -    private SysService sysService;
 | 
	
		
			
				|  |  | -    @Autowired
 | 
	
		
			
				|  |  | -    private ComplaintTypeInfoService complaintTypeInfoService;
 | 
	
		
			
				|  |  | -    @Autowired
 | 
	
		
			
				|  |  | -    private VisitService visitService;
 | 
	
		
			
				|  |  | -    @Autowired
 | 
	
		
			
				|  |  | -    private QuestionDescribeService questionDescribeService;
 | 
	
		
			
				|  |  | -    @Autowired
 | 
	
		
			
				|  |  | -    private RenewedService renewedService;
 | 
	
		
			
				|  |  | -    @Autowired
 | 
	
		
			
				|  |  | -    private RepairService repairService;
 | 
	
		
			
				|  |  | -    @Autowired
 | 
	
		
			
				|  |  | -    private BackGoodsService backGoodsService;
 | 
	
		
			
				|  |  | -    @Autowired
 | 
	
		
			
				|  |  | -    private FittingsInfoService fittingsInfoService;
 | 
	
		
			
				|  |  | -    @Autowired
 | 
	
		
			
				|  |  | -    private ReissueService reissueService;
 | 
	
		
			
				|  |  | -    @Autowired
 | 
	
		
			
				|  |  | -    private NoreasonBackService noreasonBackService;
 | 
	
		
			
				|  |  | -    @Autowired
 | 
	
		
			
				|  |  | -    private ComplaintQuestionInfoService complaintQuestionInfoService;
 | 
	
		
			
				|  |  | -    @Autowired
 | 
	
		
			
				|  |  | -    private SmsService smsService;
 | 
	
		
			
				|  |  | -    @Autowired
 | 
	
		
			
				|  |  | -    private ComplaintSignclosedInfoService complaintSignclosedInfoService;
 | 
	
		
			
				|  |  | -    @Autowired
 | 
	
		
			
				|  |  | -    private ComplaintSmallClassInfoService complaintSmallClassInfoService;
 | 
	
		
			
				|  |  | -    @Autowired
 | 
	
		
			
				|  |  | -    private CustomerCommonService customerCommonService;
 | 
	
		
			
				|  |  | -    @Autowired
 | 
	
		
			
				|  |  | -    private AddressService addressService;
 | 
	
		
			
				|  |  | -    @Autowired
 | 
	
		
			
				|  |  | -    private PostageService postageService;
 | 
	
		
			
				|  |  | -    @Autowired
 | 
	
		
			
				|  |  | -    private EfastOrderService efastOrderService;
 | 
	
		
			
				|  |  | -    @Autowired
 | 
	
		
			
				|  |  | -    private RelationOrderService relationOrderService;
 | 
	
		
			
				|  |  | +    private CustomerBasicInfoSaveService customerBasicInfoSaveService;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  |       * 跳转到添加客户信息页面
 | 
	
		
			
				|  |  |       *
 | 
	
		
			
				|  |  |       * @return
 | 
	
		
			
				|  |  |       */
 | 
	
		
			
				|  |  | -    @RequiresPermissions("customer:add:customer")
 | 
	
		
			
				|  |  | +    @RequiresPermissions("customer:add:customerInfo")
 | 
	
		
			
				|  |  |      @RequestMapping(value = "/save_customer_info")
 | 
	
		
			
				|  |  |      public ModelAndView toAddCustomer(HttpServletRequest request) {
 | 
	
		
			
				|  |  |          ModelAndView mv = new ModelAndView("customerInfoAdmin/save_customer_info");
 | 
	
	
		
			
				|  | @@ -101,301 +41,94 @@ public class CustomerBasicInfoSaveController {
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  |       * 添加客户信息
 | 
	
		
			
				|  |  |       * @param request
 | 
	
		
			
				|  |  | -     * @param customerInfo
 | 
	
		
			
				|  |  | -     * @param salesOrder
 | 
	
		
			
				|  |  | -     * @param customerCommon
 | 
	
		
			
				|  |  | -     * @param sendProdcuesJson
 | 
	
		
			
				|  |  | -     * @param sendFittingsJson
 | 
	
		
			
				|  |  | -     * @param closedProdcuesJson
 | 
	
		
			
				|  |  | -     * @param closedFittingsJson
 | 
	
		
			
				|  |  | +     * @param customerBasicInfo
 | 
	
		
			
				|  |  | +     * @param dockedContactInfo
 | 
	
		
			
				|  |  | +     * @param channelSaleInfo
 | 
	
		
			
				|  |  | +     * @param billingInfo
 | 
	
		
			
				|  |  | +     * @param ticketOpeningInfo
 | 
	
		
			
				|  |  |       * @return
 | 
	
		
			
				|  |  |       * @throws Exception
 | 
	
		
			
				|  |  |       */
 | 
	
		
			
				|  |  |      @ResponseBody
 | 
	
		
			
				|  |  | -    @RequiresPermissions("customer:add:customer")
 | 
	
		
			
				|  |  | +    @RequiresPermissions("customer:add:customerInfo")
 | 
	
		
			
				|  |  |      @RequestMapping("/save_customer")
 | 
	
		
			
				|  |  | -    public ResponseJson addCustomer(HttpServletRequest request, CustomerInfo customerInfo, SalesOrder salesOrder, CustomerCommon customerCommon,
 | 
	
		
			
				|  |  | -                                    String sendProdcuesJson, String sendFittingsJson, String closedProdcuesJson, String closedFittingsJson) throws Exception {
 | 
	
		
			
				|  |  | -        ResponseJson rjx = this.isValiData(customerInfo);
 | 
	
		
			
				|  |  | +    public ResponseJson saveCustomerBasicInfo(HttpServletRequest request, CustomerBasicInfo customerBasicInfo, DockedContactInfo dockedContactInfo, ChannelSaleInfo channelSaleInfo,
 | 
	
		
			
				|  |  | +                                    BillingInfo billingInfo, TicketOpeningInfo ticketOpeningInfo) throws Exception {
 | 
	
		
			
				|  |  | +        //注意:DockedContactInfo、ChannelSaleInfo可能为多个,需修改
 | 
	
		
			
				|  |  | +        ResponseJson rjx = this.isValiData(customerBasicInfo);
 | 
	
		
			
				|  |  | +        Boolean isSaveSuccess = false;//是否保存成功标识
 | 
	
		
			
				|  |  |          if(rjx.getResultCode() == 500){
 | 
	
		
			
				|  |  |              return rjx;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        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<SendFitting> sendFittingList;
 | 
	
		
			
				|  |  | -            List<ClosedProdcue> closedProdcueList;
 | 
	
		
			
				|  |  | -            List<ClosedFitting> closedFittingList;
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -            jsonArray = JSONArray.fromObject(sendProdcuesJson);
 | 
	
		
			
				|  |  | -            sendProdcueList = (List) JSONArray.toCollection(jsonArray, SendProdcue.class);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -            jsonArray = JSONArray.fromObject(sendFittingsJson);
 | 
	
		
			
				|  |  | -            sendFittingList = (List) JSONArray.toCollection(jsonArray, SendFitting.class);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -            jsonArray = JSONArray.fromObject(closedProdcuesJson);
 | 
	
		
			
				|  |  | -            closedProdcueList = (List) JSONArray.toCollection(jsonArray, ClosedProdcue.class);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -            jsonArray = JSONArray.fromObject(closedFittingsJson);
 | 
	
		
			
				|  |  | -            closedFittingList = (List) JSONArray.toCollection(jsonArray, ClosedFitting.class);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -            customerCommon.setSendProdcues(sendProdcueList);
 | 
	
		
			
				|  |  | -            customerCommon.setSendFittings(sendFittingList);
 | 
	
		
			
				|  |  | -            customerCommon.setClosedProdcues(closedProdcueList);
 | 
	
		
			
				|  |  | -            customerCommon.setClosedFittings(closedFittingList);
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        customerInfo.setCustomerCommon(customerCommon);
 | 
	
		
			
				|  |  | -        String orderId = "";
 | 
	
		
			
				|  |  | -        if (customerInfo.getCustomerIsSolve() == 3 || customerInfo.getCustomerIsSolve() == 4 || customerInfo.getCustomerIsSolve() == 5) {
 | 
	
		
			
				|  |  | -            Integer adminId = AdminUtils.getLoginAdminId();
 | 
	
		
			
				|  |  | -            orderId = OrderNoUtil.createOrderCode(adminId);
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -        customerInfo.setTransactionNumber(orderId);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        Integer customerId = customerInfo.getCustomerId();
 | 
	
		
			
				|  |  | -        logger.info("-----------------添加客诉开始----------------------");
 | 
	
		
			
				|  |  | +        logger.info("-----------------添加客户信息开始----------------------");
 | 
	
		
			
				|  |  |          try {
 | 
	
		
			
				|  |  | -            flag = customerService.saveCustomerInfo(customerInfo, salesOrder);
 | 
	
		
			
				|  |  | +            customerBasicInfoSaveService.saveCustomerBasicInfo(customerBasicInfo,dockedContactInfo,channelSaleInfo,billingInfo,ticketOpeningInfo);
 | 
	
		
			
				|  |  | +            isSaveSuccess = true;
 | 
	
		
			
				|  |  |          } catch (RuntimeException e) {
 | 
	
		
			
				|  |  | +            isSaveSuccess = false;
 | 
	
		
			
				|  |  |              return new ResponseJson(500, e.getMessage(), 500);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        customerId = customerInfo.getCustomerId();
 | 
	
		
			
				|  |  | -        logger.info("-----------------添加客诉结束----------------------");
 | 
	
		
			
				|  |  | -        if (flag < 1) {
 | 
	
		
			
				|  |  | -            return new ResponseJson(500, "添加客诉失败!", 500);
 | 
	
		
			
				|  |  | +        logger.info("-----------------添加客户信息结束----------------------");
 | 
	
		
			
				|  |  | +        if (!isSaveSuccess) {
 | 
	
		
			
				|  |  | +            return new ResponseJson(500, "添加客户信息失败!", 500);
 | 
	
		
			
				|  |  | +        }else{
 | 
	
		
			
				|  |  | +            return new ResponseJson(200, "添加客户信息成功!", 200);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        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;
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | -            msg = ",请前往Efast进行换货/退货操作。";
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -        return new ResponseJson(200, "录入客诉成功!客诉编号:" + customerId + msg, 200);
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  |       * 跳转到修改客户信息页面
 | 
	
		
			
				|  |  |       *
 | 
	
		
			
				|  |  |       * @return
 | 
	
		
			
				|  |  |       */
 | 
	
		
			
				|  |  | -    @RequiresPermissions("customer:update:customer")
 | 
	
		
			
				|  |  | +    @RequiresPermissions("customer:update:customerInfo")
 | 
	
		
			
				|  |  |      @RequestMapping(value = "/update_customer_info")
 | 
	
		
			
				|  |  | -    public ModelAndView updateCustomerInfo(HttpServletRequest request,Integer customerId) {
 | 
	
		
			
				|  |  | +    public ModelAndView updateCustomerInfo(HttpServletRequest request) throws Exception{
 | 
	
		
			
				|  |  |          ModelAndView mv = new ModelAndView("customerInfoAdmin/update_customer_info");
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        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);
 | 
	
		
			
				|  |  | -        /*客诉信息处理-stast*/
 | 
	
		
			
				|  |  | -        //对于区域处理
 | 
	
		
			
				|  |  | -        if(customerInfo!=null && customerInfo.getCustomerArea() != null){
 | 
	
		
			
				|  |  | -//            String[] customerAreaAndCity = customerInfo.getCustomerArea().split("-");
 | 
	
		
			
				|  |  | -//            customerInfo.setProvinceName(customerAreaAndCity[0]);
 | 
	
		
			
				|  |  | -//            City city
 | 
	
		
			
				|  |  | -//            addressService.listCity(customerAreaAndCity[0]);
 | 
	
		
			
				|  |  | -//            customerInfo.setCityName(customerAreaAndCity[0]);
 | 
	
		
			
				|  |  | +        String customerId = request.getParameter("customerId");
 | 
	
		
			
				|  |  | +        boolean isSuccess = false;
 | 
	
		
			
				|  |  | +        if (!StringUtils.isNotEmpty(customerId)) {
 | 
	
		
			
				|  |  | +            return mv;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        /*客诉信息处理-end*/
 | 
	
		
			
				|  |  | -        CustomerCommon customerCommon = new CustomerCommon();
 | 
	
		
			
				|  |  | -        if(customerInfo.getCustomerIsSolve() != null){
 | 
	
		
			
				|  |  | -            switch (customerInfo.getCustomerIsSolve()){   //处理结果: 1:已解决  2:未解决 3:换新  4:维修 5:补发 6:退货 7:无理由退货
 | 
	
		
			
				|  |  | -                case 3://获取换新
 | 
	
		
			
				|  |  | -                    Renewed renewed = new Renewed();
 | 
	
		
			
				|  |  | -                    renewed.setCustomerId(customerInfo.getCustomerId());
 | 
	
		
			
				|  |  | -                    renewed = renewedService.getRenewed(renewed);
 | 
	
		
			
				|  |  | -                    customerCommon = CustomerCommonUtil.getCustomerCommon(3,renewed);
 | 
	
		
			
				|  |  | -                    break;
 | 
	
		
			
				|  |  | -                case 4://维修
 | 
	
		
			
				|  |  | -                    Repair repair = new Repair();
 | 
	
		
			
				|  |  | -                    repair.setCustomerId(customerInfo.getCustomerId());
 | 
	
		
			
				|  |  | -                    repair = repairService.getRepair(repair);
 | 
	
		
			
				|  |  | -                    customerCommon = CustomerCommonUtil.getCustomerCommon(4,repair);
 | 
	
		
			
				|  |  | -                    break;
 | 
	
		
			
				|  |  | -                case 5:
 | 
	
		
			
				|  |  | -                    Reissue reissue = new  Reissue();
 | 
	
		
			
				|  |  | -                    reissue.setCustomerId(customerInfo.getCustomerId());
 | 
	
		
			
				|  |  | -                    reissue = reissueService.getReissue(reissue);
 | 
	
		
			
				|  |  | -                    customerCommon = CustomerCommonUtil.getCustomerCommon(5,reissue);
 | 
	
		
			
				|  |  | -                    break;
 | 
	
		
			
				|  |  | -                case 6:
 | 
	
		
			
				|  |  | -                    BackGoods backGoods = new  BackGoods();
 | 
	
		
			
				|  |  | -                    backGoods.setCustomerId(customerInfo.getCustomerId());
 | 
	
		
			
				|  |  | -                    backGoods = backGoodsService.getBackGoods(backGoods);
 | 
	
		
			
				|  |  | -                    customerCommon = CustomerCommonUtil.getCustomerCommon(6,backGoods);
 | 
	
		
			
				|  |  | -                    break;
 | 
	
		
			
				|  |  | -                case 7:
 | 
	
		
			
				|  |  | -                    NoreasonBack noreasonBack = new  NoreasonBack();
 | 
	
		
			
				|  |  | -                    noreasonBack.setCustomerId(customerInfo.getCustomerId());
 | 
	
		
			
				|  |  | -                    noreasonBack = noreasonBackService.getNoreasonBack(noreasonBack);
 | 
	
		
			
				|  |  | -                    customerCommon = CustomerCommonUtil.getCustomerCommon(7,noreasonBack);
 | 
	
		
			
				|  |  | -                    break;
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -            /*查询所有需要寄入寄出的产品*/
 | 
	
		
			
				|  |  | -            customerCommon.setCustomerIsSolve(customerInfo.getCustomerIsSolve());
 | 
	
		
			
				|  |  | -            customerCommon = customerCommonService.getListProduceAndFitting(customerCommon);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -            // 2018/4/18  页面只会给寄回的赋值,在处理方式为补发的情况下,寄出需要赋值到寄回当中
 | 
	
		
			
				|  |  | -            if(customerInfo.getCustomerIsSolve() == 5){
 | 
	
		
			
				|  |  | -                //售后寄回产品表
 | 
	
		
			
				|  |  | -                List<ClosedProdcue> closedProdcues = new ArrayList<ClosedProdcue>();
 | 
	
		
			
				|  |  | -                for (SendProdcue sendProdcue : customerCommon.getSendProdcues()) {
 | 
	
		
			
				|  |  | -                    ClosedProdcue closedProdcue = new ClosedProdcue();
 | 
	
		
			
				|  |  | -                    closedProdcue.setRelationId(sendProdcue.getRelationId());
 | 
	
		
			
				|  |  | -                    closedProdcue.setProductType(sendProdcue.getProductType());
 | 
	
		
			
				|  |  | -                    closedProdcue.setProductId(sendProdcue.getProductId());
 | 
	
		
			
				|  |  | -                    closedProdcue.setColorId(sendProdcue.getColorId());
 | 
	
		
			
				|  |  | -                    closedProdcue.setClosedProductName(sendProdcue.getSendProduceName());
 | 
	
		
			
				|  |  | -                    closedProdcue.setClosedColorName(sendProdcue.getSendColorName());
 | 
	
		
			
				|  |  | -                    closedProdcue.setClosedProdcueNumber(sendProdcue.getSendProdcueNumber());
 | 
	
		
			
				|  |  | -                    closedProdcues.add(closedProdcue);
 | 
	
		
			
				|  |  | -                }
 | 
	
		
			
				|  |  | -                //售后寄回产品配件表
 | 
	
		
			
				|  |  | -                List<ClosedFitting> closedFittings = new ArrayList<ClosedFitting>();
 | 
	
		
			
				|  |  | -                for (SendFitting sendFitting : customerCommon.getSendFittings()) {
 | 
	
		
			
				|  |  | -                    ClosedFitting closedFitting = new ClosedFitting();
 | 
	
		
			
				|  |  | -                    closedFitting.setRelationId(sendFitting.getRelationId());
 | 
	
		
			
				|  |  | -                    closedFitting.setClosedFittingType(sendFitting.getSendFittingType());
 | 
	
		
			
				|  |  | -                    closedFitting.setProductId(sendFitting.getProductId());
 | 
	
		
			
				|  |  | -                    closedFitting.setFittingsId(sendFitting.getFittingsId());
 | 
	
		
			
				|  |  | -                    closedFitting.setClosedProductName(sendFitting.getSendProductName());
 | 
	
		
			
				|  |  | -                    closedFitting.setClosedFittingsName(sendFitting.getSendFittingsName());
 | 
	
		
			
				|  |  | -                    closedFitting.setClosedFittingNumber(sendFitting.getSendFittingNumber());
 | 
	
		
			
				|  |  | -                    closedFittings.add(closedFitting);
 | 
	
		
			
				|  |  | -                }
 | 
	
		
			
				|  |  | -                customerCommon.setClosedProdcues(closedProdcues);
 | 
	
		
			
				|  |  | -                customerCommon.setClosedFittings(closedFittings);
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | -            mv.addObject("customerCommon", customerCommon);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -            if(customerInfo.getTypeId() == 1){
 | 
	
		
			
				|  |  | -                customerInfo.setIsNeedSelectOrder(2);       //不需要订单
 | 
	
		
			
				|  |  | -            }else{
 | 
	
		
			
				|  |  | -                customerInfo.setIsNeedSelectOrder(1);
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -            if(customerInfo.getTypeId() != 1 && (customerInfo.getCustomerIsSolve() == 3 || customerInfo.getCustomerIsSolve() == 4 || customerInfo.getCustomerIsSolve() == 5 ||
 | 
	
		
			
				|  |  | -                    customerInfo.getCustomerIsSolve() == 6 || customerInfo.getCustomerIsSolve() == 7)){
 | 
	
		
			
				|  |  | -                RelationOrder relationOrder = new RelationOrder();
 | 
	
		
			
				|  |  | -                relationOrder.setRelationType(customerCommon.getCustomerIsSolve());
 | 
	
		
			
				|  |  | -                relationOrder.setRelationId(customerCommon.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());
 | 
	
		
			
				|  |  | -                }
 | 
	
		
			
				|  |  | -                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);
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | +        int queryCustomerId = Integer.valueOf(customerId);
 | 
	
		
			
				|  |  | +        CustomerBasicInfo customerBasicInfo = new CustomerBasicInfo();
 | 
	
		
			
				|  |  | +        List<DockedContactInfo> dockedContactInfoList = new ArrayList<DockedContactInfo>();
 | 
	
		
			
				|  |  | +        List<ChannelSaleInfo> channelSaleInfoList = new ArrayList<ChannelSaleInfo>();
 | 
	
		
			
				|  |  | +        BillingInfo billingInfo = new BillingInfo();
 | 
	
		
			
				|  |  | +        TicketOpeningInfo ticketOpeningInfo = new TicketOpeningInfo();
 | 
	
		
			
				|  |  | +        try {
 | 
	
		
			
				|  |  | +            customerBasicInfo = customerBasicInfoSaveService.queryCustomerBasicInfoByCustomerId(queryCustomerId);
 | 
	
		
			
				|  |  | +            dockedContactInfoList = customerBasicInfoSaveService.queryDockedContactInfoListByCustomerId(queryCustomerId);
 | 
	
		
			
				|  |  | +            channelSaleInfoList = customerBasicInfoSaveService.queryChannelSaleInfoListByCustomerId(queryCustomerId);
 | 
	
		
			
				|  |  | +            billingInfo = customerBasicInfoSaveService.queryBillingInfoByCustomerId(queryCustomerId);
 | 
	
		
			
				|  |  | +            ticketOpeningInfo = customerBasicInfoSaveService.queryTicketOpeningInfoByCustomerId(queryCustomerId);
 | 
	
		
			
				|  |  | +            isSuccess = true;
 | 
	
		
			
				|  |  | +        }catch (Exception e){
 | 
	
		
			
				|  |  | +            isSuccess = false;
 | 
	
		
			
				|  |  | +            logger.error("跳转修改页面失败:"+e.getMessage());
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        if ("2".equals(customerInfo.getCustomerIsVisit())){ //1:不需要回访  2:需要回访
 | 
	
		
			
				|  |  | -            Visit visit = new Visit();
 | 
	
		
			
				|  |  | -            visit.setCustomerId(customerInfo.getCustomerId());
 | 
	
		
			
				|  |  | -            visit = visitService.getVisit(visit);
 | 
	
		
			
				|  |  | -            mv.addObject("visit", visit);
 | 
	
		
			
				|  |  | +        if(!isSuccess){
 | 
	
		
			
				|  |  | +            return mv;
 | 
	
		
			
				|  |  | +        }else{
 | 
	
		
			
				|  |  | +            mv.addObject("customerBasicInfo", customerBasicInfo);
 | 
	
		
			
				|  |  | +            mv.addObject("dockedContactInfoList", dockedContactInfoList);
 | 
	
		
			
				|  |  | +            mv.addObject("channelSaleInfoList", channelSaleInfoList);
 | 
	
		
			
				|  |  | +            mv.addObject("billingInfo", billingInfo);
 | 
	
		
			
				|  |  | +            mv.addObject("ticketOpeningInfo", ticketOpeningInfo);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        //查询关联问题
 | 
	
		
			
				|  |  | -        ComplaintQuestionInfo complaintQuestionInfo = complaintQuestionInfoService.getQuestionById(customerInfo.getQuestionId());
 | 
	
		
			
				|  |  | -        //查询问题小类
 | 
	
		
			
				|  |  | -        ComplaintSmallClassInfo complaintSmallClassInfo = new ComplaintSmallClassInfo();
 | 
	
		
			
				|  |  | -        complaintSmallClassInfo.setComplaintId(complaintQuestionInfo.getComplaintId());
 | 
	
		
			
				|  |  | -        List<ComplaintSmallClassInfo> complaintSmallClassInfoList = complaintSmallClassInfoService.listComplaintSmallClassInfo(complaintSmallClassInfo);
 | 
	
		
			
				|  |  | -        //查询问题大类
 | 
	
		
			
				|  |  | -        ComplaintTypeInfo complaintTypeInfo = new ComplaintTypeInfo();
 | 
	
		
			
				|  |  | -        List<ComplaintTypeInfo> complaintTypeInfoList = complaintTypeInfoService.listComplaintTypeInfo(complaintTypeInfo);
 | 
	
		
			
				|  |  | -        mv.addObject("customerInfo", customerInfo);
 | 
	
		
			
				|  |  | -        mv.addObject("typeList", typeList);
 | 
	
		
			
				|  |  | -        mv.addObject("complaintTypeList", complaintTypeList);
 | 
	
		
			
				|  |  | -        mv.addObject("complaintTypeList", complaintTypeList);
 | 
	
		
			
				|  |  | -        mv.addObject("adminList", adminList);
 | 
	
		
			
				|  |  | -        mv.addObject("loginAdminId", loginAdminId);
 | 
	
		
			
				|  |  | -        mv.addObject("complaintQuestionInfo", complaintQuestionInfo);
 | 
	
		
			
				|  |  | -        mv.addObject("complaintSmallClassInfoList", complaintSmallClassInfoList);
 | 
	
		
			
				|  |  | -        mv.addObject("complaintTypeInfoList", complaintTypeInfoList);
 | 
	
		
			
				|  |  |          return mv;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    //方法
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  |       * 验证方法
 | 
	
		
			
				|  |  |       *
 | 
	
		
			
				|  |  | -     * @param customerInfo
 | 
	
		
			
				|  |  | +     * @param customerBasicInfo
 | 
	
		
			
				|  |  |       * @return
 | 
	
		
			
				|  |  |       */
 | 
	
		
			
				|  |  | -    public ResponseJson isValiData(CustomerInfo customerInfo) {
 | 
	
		
			
				|  |  | +    public ResponseJson isValiData(CustomerBasicInfo customerBasicInfo) {
 | 
	
		
			
				|  |  |          ResponseJson rj = new ResponseJson();
 | 
	
		
			
				|  |  | -        if(customerInfo.getAdminId() == null){
 | 
	
		
			
				|  |  | -            return new ResponseJson(500, "未填写客诉id", 500);
 | 
	
		
			
				|  |  | +        if(customerBasicInfo == null){
 | 
	
		
			
				|  |  | +            return new ResponseJson(500, "未填写客户基本信息", 500);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          return rj;
 | 
	
		
			
				|  |  |      }
 |