123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204 |
- package com.iamberry.rst.service.cm;
- import com.github.pagehelper.PageHelper;
- import com.iamberry.rst.core.cm.*;
- import com.iamberry.rst.core.page.PagedResult;
- import com.iamberry.rst.core.pts.PtsSupplier;
- import com.iamberry.rst.faces.cm.CustomerService;
- import com.iamberry.rst.service.cm.mapper.*;
- import com.iamberry.rst.util.PageUtil;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Service;
- import java.util.List;
- @Service
- public class CustomerServiceImpl implements CustomerService {
- @Autowired
- private CustomerInfoMapper customerInfoMapper;
- @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;
- @Override
- public CustomerInfo getCustomerInfo(Integer customerId) {
- return customerInfoMapper.getCustomerInfo(customerId);
- }
- @Override
- public Integer updateCustomerInfo(CustomerInfo record) {
- return customerInfoMapper.updateCustomerInfo(record);
- }
- @Override
- public PagedResult<CustomerInfo> listCustomer(int pageNO, int pageSize, CustomerInfo customerInfo, boolean isTotalNum) {
- PageHelper.startPage(pageNO, pageSize, isTotalNum);
- //查询客诉列表
- List<CustomerInfo> customerList = customerInfoMapper.listCustomer(customerInfo);
- //查询售后维修集合
- Repair repairInfo = new Repair();
- repairInfo.setRepairState(1);
- List<Repair> repairList = repairMapper.listRepair(repairInfo);
- //查询售后退货集合
- BackGoods backGoodsInfo = new BackGoods();
- backGoodsInfo.setBackGoodsState(1);
- List<BackGoods> backGoodsList = backGoodsMapper.listBackGoods(backGoodsInfo);
- //查询售后无理由退货集合
- NoreasonBack noreasonBackInfo = new NoreasonBack();
- noreasonBackInfo.setNoreasonBackState(1);
- List<NoreasonBack> noreasonBackList = noreasonBackMapper.listNoreasonBack(noreasonBackInfo);
- //查询售后补发集合
- Reissue reissueInfo = new Reissue();
- reissueInfo.setReissueState(1);
- List<Reissue> reissueList = reissueMapper.listReissue(reissueInfo);
- //查询售后换新集合
- Renewed renewedInfo = new Renewed();
- renewedInfo.setRenewedState(1);
- List<Renewed> renewedList = renewedMapper.listRenewed(renewedInfo);
- if (customerList != null && customerList.size() > 0) {
- for (CustomerInfo customer : customerList) {
- switch (customer.getCustomerIsSolve().intValue()) {
- case 3: //换新
- for (Renewed renewed : renewedList) {
- if (renewed.getCustomerId().intValue() == customer.getCustomerId()) {
- customer.setBackStatus(renewed.getRenewedBackStatus());
- customer.setSendStatus(renewed.getRenewedSendStatus());
- break;
- }
- }
- break;
- case 4: //维修
- for (Repair repair : repairList) {
- if (repair.getCustomerId().intValue() == customer.getCustomerId()) {
- customer.setBackStatus(repair.getRepairBackStatus());
- customer.setSendStatus(repair.getRepairSendStatus());
- break;
- }
- }
- break;
- case 5: //补发
- for (Reissue reissue : reissueList) {
- if (reissue.getCustomerId().intValue() == customer.getCustomerId()) {
- customer.setSendStatus(reissue.getReissueSendStatus());
- break;
- }
- }
- break;
- case 6: //退货
- for (BackGoods backGoods : backGoodsList) {
- if (backGoods.getCustomerId().intValue() == customer.getCustomerId()) {
- customer.setBackStatus(backGoods.getBackGoodsBackStatus());
- break;
- }
- }
- break;
- case 7: //无理由退货
- for (NoreasonBack noreasonBack : noreasonBackList) {
- if (noreasonBack.getCustomerId().intValue() == customer.getCustomerId()) {
- customer.setBackStatus(noreasonBack.getNoreasonBackBackStatus());
- break;
- }
- }
- break;
- }
- }
- }
- return PageUtil.getPage(customerList);
- }
- @Override
- public CustomerInfo getCustomerInfo(CustomerInfo customerInfo) {
- //查询客诉列表
- List<CustomerInfo> customerList = customerInfoMapper.listCustomer(customerInfo);
- if (customerList == null || customerList.size() == 0) {
- return null;
- }
- CustomerInfo customer = customerList.get(0);
- //查询售后维修集合
- Repair repairInfo = new Repair();
- repairInfo.setRepairState(1);
- List<Repair> repairList = repairMapper.listRepair(repairInfo);
- //查询售后退货集合
- BackGoods backGoodsInfo = new BackGoods();
- backGoodsInfo.setBackGoodsState(1);
- List<BackGoods> backGoodsList = backGoodsMapper.listBackGoods(backGoodsInfo);
- //查询售后无理由退货集合
- NoreasonBack noreasonBackInfo = new NoreasonBack();
- noreasonBackInfo.setNoreasonBackState(1);
- List<NoreasonBack> noreasonBackList = noreasonBackMapper.listNoreasonBack(noreasonBackInfo);
- //查询售后补发集合
- Reissue reissueInfo = new Reissue();
- reissueInfo.setReissueState(1);
- List<Reissue> reissueList = reissueMapper.listReissue(reissueInfo);
- return customer;
- }
- @Override
- public BackGoods getBackGoods(BackGoods backGoods) {
- //获取退货集合
- List<BackGoods> backList = backGoodsMapper.listBackGoods(backGoods);
- if (backList == null || backList.size() == 0) {
- return null;
- }
- BackGoods goods = backList.get(0);
- ClosedProdcue closedProdcue = new ClosedProdcue();
- closedProdcue.setRelationId(goods.getBackGoodsId());
- closedProdcue.setClosedProdcueType(6);
- //查询寄回产品集合
- List<ClosedProdcue> prodcueList = closedProdcueMapper.listclosedProdcue(closedProdcue);
- ClosedFitting fitting = new ClosedFitting();
- fitting.setRelationId(goods.getBackGoodsId());
- fitting.setClosedFittingType(6);
- //查询寄回配件集合
- List<ClosedFitting> fittingList = closedFittingMapper.listClosedFitting(fitting);
- if (prodcueList != null && prodcueList.size() > 0) {
- goods.setClosedProdcues(prodcueList);
- }
- if (fittingList != null && fittingList.size() > 0) {
- goods.setClosedFittings(fittingList);
- }
- return goods;
- }
- @Override
- public Reissue getReissue(Reissue reissue) {
- //查询售后补发信息
- List<Reissue> reissueList = reissueMapper.listReissue(reissue);
- if (reissueList == null || reissueList.size() == 0) {
- return null;
- }
- Reissue reissueInfo = reissueList.get(0);
- ClosedProdcue closedProdcue = new ClosedProdcue();
- closedProdcue.setRelationId(reissueInfo.getReissueId());
- closedProdcue.setClosedProdcueType(6);
- //查询寄回产品集合
- List<ClosedProdcue> prodcueList = closedProdcueMapper.listclosedProdcue(closedProdcue);
- ClosedFitting fitting = new ClosedFitting();
- fitting.setRelationId(reissueInfo.getReissueId());
- fitting.setClosedFittingType(6);
- //查询寄回配件集合
- List<ClosedFitting> fittingList = closedFittingMapper.listClosedFitting(fitting);
- if (prodcueList != null && prodcueList.size() > 0) {
- reissueInfo.setClosedProdcues(prodcueList);
- }
- if (fittingList != null && fittingList.size() > 0) {
- reissueInfo.setClosedFittings(fittingList);
- }
- return reissueInfo;
- }
- }
|