| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206 | package com.iamberry.rst.service.cm;import com.iamberry.rst.core.cm.*;import com.iamberry.rst.faces.cm.CustomerCommonService;import com.iamberry.rst.service.cm.mapper.*;import com.iamberry.rst.util.CustomerCommonUtil;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.stereotype.Service;import org.springframework.transaction.annotation.Transactional;import java.beans.Transient;import java.util.ArrayList;import java.util.List;@Servicepublic class CustomerCommonServiceImpl implements CustomerCommonService {    @Autowired    private CustomerCommonService customerCommonService;    @Autowired    private RepairMapper repairMapper;    @Autowired    private BackGoodsMapper backGoodsMapper;    @Autowired    private NoreasonBackMapper noreasonBackMapper;    @Autowired    private ReissueMapper reissueMapper;    @Autowired    private RenewedMapper renewedMapper;    @Autowired    private ClosedFittingMapper closedFittingMapper;    @Autowired    private ClosedProdcueMapper closedProdcueMapper;    @Autowired    private SendProdcueMapper sendProdcueMapper;    @Autowired    private SendFittingMapper sendFittingMapper;    @Autowired    private CustomerCommonMapper customerCommonMapper;    @Autowired    private CustomerInfoMapper customerInfoMapper;    @Autowired    private PostageMapper postageMapper;    @Autowired    private RelationOrderMapper relationOrderMapper;    @Autowired    private SalesOrderMapper salesOrderMapper;    @Override    public CustomerCommon getListProduceAndFitting(CustomerCommon customerCommon) {        ClosedProdcue closedProdcue = new ClosedProdcue();        closedProdcue.setClosedProdcueType(customerCommon.getCustomerIsSolve());        closedProdcue.setRelationId(customerCommon.getRelationId());        customerCommon.setClosedProdcues(closedProdcueMapper.listclosedProdcue(closedProdcue));        SendProdcue sendProdcue = new SendProdcue();        sendProdcue.setSendProduceType(customerCommon.getCustomerIsSolve());        sendProdcue.setRelationId(customerCommon.getRelationId());        customerCommon.setSendProdcues(sendProdcueMapper.listSendProdcue(sendProdcue));        return customerCommon;    }    @Override    public List<CustomerCommon> listCustomerCommon(CustomerCommon customerCommon) {        List<CustomerCommon> customerCommonList  = customerCommonMapper.listCustomerCommon(customerCommon);        for (CustomerCommon c : customerCommonList) {            RelationOrder relationOrder = new RelationOrder();            relationOrder.setRelationId(c.getRelationId());            relationOrder.setRelationType(c.getCustomerIsSolve());            List<RelationOrder> relationOrderList = relationOrderMapper.getRelationOrderList(relationOrder);            List<SalesOrder> orderList = new ArrayList<>();            for (RelationOrder ro : relationOrderList) {                SalesOrder salesOrder = salesOrderMapper.getSalesOrderById(ro.getSalesId());                if(salesOrder != null ){                    SalesOrderItem salesOrderItem = new SalesOrderItem();                    salesOrderItem.setItemOrderId(salesOrder.getSalesId());                    salesOrder.setSalesOrderItemList(salesOrderMapper.listSalesOrderItem(salesOrderItem));                    orderList.add(salesOrder);                }            }            c.setSalesOrderList(orderList);            SendProdcue sendProdcue  = new SendProdcue();            sendProdcue.setRelationId(c.getRelationId());            sendProdcue.setSendProduceType(c.getCustomerIsSolve()); //sendProduceType            List<SendProdcue> sendProdcueList = sendProdcueMapper.listSendProdcue(sendProdcue);            c.setSendProdcues(sendProdcueList);            ClosedProdcue closedProdcue = new ClosedProdcue();            closedProdcue.setRelationId(c.getRelationId());            closedProdcue.setClosedProdcueType(c.getCustomerIsSolve());            List<ClosedProdcue> closedProdcueList = closedProdcueMapper.listclosedProdcue(closedProdcue);            c.setClosedProdcues(closedProdcueList);        }//        List<CustomerCommon> customerCommonList = new ArrayList<>();//        /*换新*///        Renewed renewed = (Renewed)CustomerCommonUtil.getRelation(3,customerCommon);//        List<Renewed> renewedList = renewedMapper.listRenewed(renewed);//        customerCommonList.addAll(CustomerCommonUtil.listToCustomerCommon(3,renewedList));////         /*维修*///        Repair repair = (Repair)CustomerCommonUtil.getRelation(4,customerCommon);//        List<Repair> repairList = repairMapper.listRepair(repair);//        customerCommonList.addAll(CustomerCommonUtil.listToCustomerCommon(4,repairList));////        /*补发*///        Reissue reissue = (Reissue)CustomerCommonUtil.getRelation(5,customerCommon);//        List<Reissue> reissueList = reissueMapper.listReissue(reissue);//        customerCommonList.addAll(CustomerCommonUtil.listToCustomerCommon(5,reissueList));////        /*退货*///        BackGoods backGoods = (BackGoods)CustomerCommonUtil.getRelation(6,customerCommon);//        List<BackGoods> backGoodsList = backGoodsMapper.listBackGoods(backGoods);//        customerCommonList.addAll(CustomerCommonUtil.listToCustomerCommon(6,backGoodsList));////        /*无理由退货*///        NoreasonBack noreasonBack = (NoreasonBack)CustomerCommonUtil.getRelation(7,customerCommon);//        List<NoreasonBack> noreasonBackList = noreasonBackMapper.listNoreasonBack(noreasonBack);//        customerCommonList.addAll(CustomerCommonUtil.listToCustomerCommon(7,noreasonBackList));        return customerCommonList;    }    @Override    public Integer listCustomerCommonByStatus(CustomerCommon customerCommon) {        return customerCommonMapper.listCustomerCommonByStatus(customerCommon);    }    @Override    @Transactional    public Integer updateCustomerCommon(CustomerCommon customerCommon) {        Integer flag = 0;//        switch (customerCommon.getCustomerIsSolve()){//            case 3://                Renewed renewed = (Renewed)CustomerCommonUtil.getRelation(3,customerCommon);//                flag = renewedMapper.updateRenewedInfo(renewed);//                break;//            case 4://                Repair repair = (Repair)CustomerCommonUtil.getRelation(4,customerCommon);//                flag = repairMapper.updateRepairInfo(repair);//                break;//            case 5://                Reissue reissue = (Reissue)CustomerCommonUtil.getRelation(5,customerCommon);//                flag = reissueMapper.updateReissueInfo(reissue);//                break;//            case 6://                BackGoods backGoods = (BackGoods)CustomerCommonUtil.getRelation(6,customerCommon);//                flag = backGoodsMapper.updateBackGoods(backGoods);//                break;//            case 7://                NoreasonBack noreasonBack = (NoreasonBack)CustomerCommonUtil.getRelation(7,customerCommon);//                flag = noreasonBackMapper.updateNoreasonBack(noreasonBack);//                break;//            default://                flag = 0;//                break;//        }        return flag;    }    @Override    @Transactional    public Integer updateCommonAndAddPostage(CustomerCommon customerCommon) {        CustomerCommon newCc = new CustomerCommon();        newCc.setRelationId(customerCommon.getRelationId());        newCc.setRelationBackStatus(4);		//已签收        newCc.setCustomerIsSolve(customerCommon.getCustomerIsSolve());        Integer flag = customerCommonService.updateCustomerCommon(newCc);        if(flag < 1){            throw new RuntimeException("修改状态失败");        }//        CustomerInfo customerInfo = customerInfoMapper.getCustomerInfo(customerCommon.getCustomerId());//        if(customerInfo == null){//            throw new RuntimeException("查询客诉失败");//        }        //1:已解决  2:未解决 3:换新  4:维修 5:补发 6:退货 7:无理由退货//        if(customerCommon.getCustomerIsSolve() == 3 || customerCommon.getCustomerIsSolve() == 4//                || customerCommon.getCustomerIsSolve() == 6|| customerCommon.getCustomerIsSolve() == 7){//            if(customerCommon.getRelationIsTransfer() != 0){        //需要转邮费//                Postage postage = new Postage();//                postage.setAdminId(customerInfo.getAdminId());      //客服//                postage.setPostageCustomerStatus(1);            //待申请//                postage.setPostageOrderSource(customerInfo.getStoreId());   //店铺id//                postage.setPostageTreatmentMethod(customerCommon.getCustomerIsSolve()); //处理方式//                postage.setSalesOrderId(customerCommon.getSalesOrderId());       //efast订单号//                postage.setPostageClientName(customerCommon.getRelationBackName());//                postage.setPostageClientTel(customerCommon.getRelationBackTel());//                postage.setPostageClientAddress(customerCommon.getRelationSendAddress());//                postage.setPostageLogisticsCompany(customerCommon.getRelationBackLogisticsCompany());//                postage.setPostageLogisticsNo(customerCommon.getRelationBackLogisticsNo());//                postage.setPostageAmount(customerCommon.getRelationBackPostage());  //寄回邮费//                postage.setPostageAlipay(customerCommon.getRelationAlipay());   //支付宝账户//                postage.setPostageAlipayName(customerCommon.getRelationAlipayName());   //支付宝账号名称//                flag = postageMapper.savePostage(postage);//                if(flag < 1){//                    throw new RuntimeException("添加邮费转账失败");//                }//            }//        }        return flag;    }}
 |