CustomerServiceImpl.java 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. package com.iamberry.rst.service.cm;
  2. import com.github.pagehelper.PageHelper;
  3. import com.iamberry.rst.core.cm.*;
  4. import com.iamberry.rst.core.page.PagedResult;
  5. import com.iamberry.rst.core.pts.PtsSupplier;
  6. import com.iamberry.rst.faces.cm.CustomerService;
  7. import com.iamberry.rst.service.cm.mapper.*;
  8. import com.iamberry.rst.util.PageUtil;
  9. import org.springframework.beans.factory.annotation.Autowired;
  10. import org.springframework.stereotype.Service;
  11. import java.util.List;
  12. @Service
  13. public class CustomerServiceImpl implements CustomerService {
  14. @Autowired
  15. private CustomerInfoMapper customerInfoMapper;
  16. @Autowired
  17. private RepairMapper repairMapper;
  18. @Autowired
  19. private BackGoodsMapper backGoodsMapper;
  20. @Autowired
  21. private NoreasonBackMapper noreasonBackMapper;
  22. @Autowired
  23. private ReissueMapper reissueMapper;
  24. @Autowired
  25. private RenewedMapper renewedMapper;
  26. @Autowired
  27. private ClosedFittingMapper closedFittingMapper;
  28. @Autowired
  29. private ClosedProdcueMapper closedProdcueMapper;
  30. @Override
  31. public CustomerInfo getCustomerInfo(Integer customerId) {
  32. return customerInfoMapper.getCustomerInfo(customerId);
  33. }
  34. @Override
  35. public Integer updateCustomerInfo(CustomerInfo record) {
  36. return customerInfoMapper.updateCustomerInfo(record);
  37. }
  38. @Override
  39. public PagedResult<CustomerInfo> listCustomer(int pageNO, int pageSize, CustomerInfo customerInfo, boolean isTotalNum) {
  40. PageHelper.startPage(pageNO, pageSize, isTotalNum);
  41. //查询客诉列表
  42. List<CustomerInfo> customerList = customerInfoMapper.listCustomer(customerInfo);
  43. //查询售后维修集合
  44. Repair repairInfo = new Repair();
  45. repairInfo.setRepairState(1);
  46. List<Repair> repairList = repairMapper.listRepair(repairInfo);
  47. //查询售后退货集合
  48. BackGoods backGoodsInfo = new BackGoods();
  49. backGoodsInfo.setBackGoodsState(1);
  50. List<BackGoods> backGoodsList = backGoodsMapper.listBackGoods(backGoodsInfo);
  51. //查询售后无理由退货集合
  52. NoreasonBack noreasonBackInfo = new NoreasonBack();
  53. noreasonBackInfo.setNoreasonBackState(1);
  54. List<NoreasonBack> noreasonBackList = noreasonBackMapper.listNoreasonBack(noreasonBackInfo);
  55. //查询售后补发集合
  56. Reissue reissueInfo = new Reissue();
  57. reissueInfo.setReissueState(1);
  58. List<Reissue> reissueList = reissueMapper.listReissue(reissueInfo);
  59. //查询售后换新集合
  60. Renewed renewedInfo = new Renewed();
  61. renewedInfo.setRenewedState(1);
  62. List<Renewed> renewedList = renewedMapper.listRenewed(renewedInfo);
  63. if (customerList != null && customerList.size() > 0) {
  64. for (CustomerInfo customer : customerList) {
  65. switch (customer.getCustomerIsSolve().intValue()) {
  66. case 3: //换新
  67. for (Renewed renewed : renewedList) {
  68. if (renewed.getCustomerId().intValue() == customer.getCustomerId()) {
  69. customer.setBackStatus(renewed.getRenewedBackStatus());
  70. customer.setSendStatus(renewed.getRenewedSendStatus());
  71. break;
  72. }
  73. }
  74. break;
  75. case 4: //维修
  76. for (Repair repair : repairList) {
  77. if (repair.getCustomerId().intValue() == customer.getCustomerId()) {
  78. customer.setBackStatus(repair.getRepairBackStatus());
  79. customer.setSendStatus(repair.getRepairSendStatus());
  80. break;
  81. }
  82. }
  83. break;
  84. case 5: //补发
  85. for (Reissue reissue : reissueList) {
  86. if (reissue.getCustomerId().intValue() == customer.getCustomerId()) {
  87. customer.setSendStatus(reissue.getReissueSendStatus());
  88. break;
  89. }
  90. }
  91. break;
  92. case 6: //退货
  93. for (BackGoods backGoods : backGoodsList) {
  94. if (backGoods.getCustomerId().intValue() == customer.getCustomerId()) {
  95. customer.setBackStatus(backGoods.getBackGoodsBackStatus());
  96. break;
  97. }
  98. }
  99. break;
  100. case 7: //无理由退货
  101. for (NoreasonBack noreasonBack : noreasonBackList) {
  102. if (noreasonBack.getCustomerId().intValue() == customer.getCustomerId()) {
  103. customer.setBackStatus(noreasonBack.getNoreasonBackBackStatus());
  104. break;
  105. }
  106. }
  107. break;
  108. }
  109. }
  110. }
  111. return PageUtil.getPage(customerList);
  112. }
  113. @Override
  114. public CustomerInfo getCustomerInfo(CustomerInfo customerInfo) {
  115. //查询客诉列表
  116. List<CustomerInfo> customerList = customerInfoMapper.listCustomer(customerInfo);
  117. if (customerList == null || customerList.size() == 0) {
  118. return null;
  119. }
  120. CustomerInfo customer = customerList.get(0);
  121. //查询售后维修集合
  122. Repair repairInfo = new Repair();
  123. repairInfo.setRepairState(1);
  124. List<Repair> repairList = repairMapper.listRepair(repairInfo);
  125. //查询售后退货集合
  126. BackGoods backGoodsInfo = new BackGoods();
  127. backGoodsInfo.setBackGoodsState(1);
  128. List<BackGoods> backGoodsList = backGoodsMapper.listBackGoods(backGoodsInfo);
  129. //查询售后无理由退货集合
  130. NoreasonBack noreasonBackInfo = new NoreasonBack();
  131. noreasonBackInfo.setNoreasonBackState(1);
  132. List<NoreasonBack> noreasonBackList = noreasonBackMapper.listNoreasonBack(noreasonBackInfo);
  133. //查询售后补发集合
  134. Reissue reissueInfo = new Reissue();
  135. reissueInfo.setReissueState(1);
  136. List<Reissue> reissueList = reissueMapper.listReissue(reissueInfo);
  137. return customer;
  138. }
  139. @Override
  140. public BackGoods getBackGoods(BackGoods backGoods) {
  141. //获取退货集合
  142. List<BackGoods> backList = backGoodsMapper.listBackGoods(backGoods);
  143. if (backList == null || backList.size() == 0) {
  144. return null;
  145. }
  146. BackGoods goods = backList.get(0);
  147. ClosedProdcue closedProdcue = new ClosedProdcue();
  148. closedProdcue.setRelationId(goods.getBackGoodsId());
  149. closedProdcue.setClosedProdcueType(6);
  150. //查询寄回产品集合
  151. List<ClosedProdcue> prodcueList = closedProdcueMapper.listclosedProdcue(closedProdcue);
  152. ClosedFitting fitting = new ClosedFitting();
  153. fitting.setRelationId(goods.getBackGoodsId());
  154. fitting.setClosedFittingType(6);
  155. //查询寄回配件集合
  156. List<ClosedFitting> fittingList = closedFittingMapper.listClosedFitting(fitting);
  157. if (prodcueList != null && prodcueList.size() > 0) {
  158. goods.setClosedProdcues(prodcueList);
  159. }
  160. if (fittingList != null && fittingList.size() > 0) {
  161. goods.setClosedFittings(fittingList);
  162. }
  163. return goods;
  164. }
  165. @Override
  166. public Reissue getReissue(Reissue reissue) {
  167. //查询售后补发信息
  168. List<Reissue> reissueList = reissueMapper.listReissue(reissue);
  169. if (reissueList == null || reissueList.size() == 0) {
  170. return null;
  171. }
  172. Reissue reissueInfo = reissueList.get(0);
  173. ClosedProdcue closedProdcue = new ClosedProdcue();
  174. closedProdcue.setRelationId(reissueInfo.getReissueId());
  175. closedProdcue.setClosedProdcueType(6);
  176. //查询寄回产品集合
  177. List<ClosedProdcue> prodcueList = closedProdcueMapper.listclosedProdcue(closedProdcue);
  178. ClosedFitting fitting = new ClosedFitting();
  179. fitting.setRelationId(reissueInfo.getReissueId());
  180. fitting.setClosedFittingType(6);
  181. //查询寄回配件集合
  182. List<ClosedFitting> fittingList = closedFittingMapper.listClosedFitting(fitting);
  183. if (prodcueList != null && prodcueList.size() > 0) {
  184. reissueInfo.setClosedProdcues(prodcueList);
  185. }
  186. if (fittingList != null && fittingList.size() > 0) {
  187. reissueInfo.setClosedFittings(fittingList);
  188. }
  189. return reissueInfo;
  190. }
  191. }