CustomerCommonUtil.java 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339
  1. package com.iamberry.rst.util;
  2. import com.iamberry.rst.core.cm.*;
  3. import java.util.ArrayList;
  4. import java.util.List;
  5. public class CustomerCommonUtil {
  6. /**
  7. * @param type 处理结果: 1:已解决 2:未解决 3:换新 4:维修 5:补发 6:退货 7:无理由退货
  8. * @return
  9. */
  10. public static Object getRelation(Integer type,CustomerCommon c){
  11. switch (type){
  12. case 3: //换新
  13. Renewed renewed = new Renewed();
  14. renewed.setRenewedId(c.getRelationId());
  15. renewed.setCustomerId(c.getCustomerId());
  16. renewed.setOrderId(c.getOrderId());
  17. renewed.setSignclosedId(c.getSignclosedId());
  18. renewed.setRenewedBackEfastOrderId(c.getRelationBackEfastOrderId());
  19. renewed.setRenewedBackStatus(c.getRelationBackStatus());
  20. renewed.setRenewedBackName(c.getRelationBackName());
  21. renewed.setRenewedBackTel(c.getRelationBackTel());
  22. renewed.setRenewedBackLogisticsCompany(c.getRelationBackLogisticsCompany());
  23. renewed.setRenewedBackLogisticsNo(c.getRelationBackLogisticsNo());
  24. renewed.setRenewedBackPostage(c.getRelationBackPostage());
  25. renewed.setRenewedBackMachineNo(c.getRelationBackMachineNo());
  26. renewed.setRenewedSendStatus(c.getRelationSendStatus());
  27. renewed.setRenewedSendName(c.getRelationSendName());
  28. renewed.setRenewedSendTel(c.getRelationSendTel());
  29. renewed.setProvinceNumber(c.getProvinceNumber());
  30. renewed.setCityNumber(c.getCityNumber());
  31. renewed.setAreaNumber(c.getAreaNumber());
  32. renewed.setRenewedSendMergeAddress(c.getRelationSendMergeAddress());
  33. renewed.setRenewedSendAddress(c.getRelationSendAddress());
  34. renewed.setRenewedSendLogisticsCompany(c.getRelationSendLogisticsCompany());
  35. renewed.setRenewedSendLogisticsNo(c.getRelationSendLogisticsNo());
  36. renewed.setRenewedDesc(c.getRelationDesc());
  37. renewed.setRenewedState(c.getRelationState());
  38. renewed.setRenewedAlipay(c.getRelationAlipay());
  39. renewed.setRenewedIsTransfer(c.getRelationIsTransfer());
  40. renewed.setRenewedCreateTime(c.getRelationCreateTime());
  41. renewed.setRenewedUpdateTime(c.getRelationUpdateTime());
  42. return renewed;
  43. case 4: //维修
  44. Repair repair = new Repair();
  45. repair.setRepairId(c.getRelationId());
  46. repair.setCustomerId(c.getCustomerId());
  47. repair.setOrderId(c.getOrderId());
  48. repair.setSignclosedId(c.getSignclosedId());
  49. repair.setRepairBackEfastOrderId( c.getRelationBackEfastOrderId());
  50. repair.setRepairBackStatus(c.getRelationBackStatus());
  51. repair.setRepairBackName(c.getRelationBackName());
  52. repair.setRepairBackTel(c.getRelationBackTel());
  53. repair.setRepairBackLogisticsCompany(c.getRelationBackLogisticsCompany());
  54. repair.setRepairBackLogisticsNo(c.getRelationBackLogisticsNo());
  55. repair.setRepairBackPostage(c.getRelationBackPostage());
  56. repair.setRepairBackMachineNo(c.getRelationBackMachineNo());
  57. repair.setRepairSendStatus(c.getRelationSendStatus());
  58. repair.setRepairSendName(c.getRelationSendName());
  59. repair.setRepairSendTel(c.getRelationSendTel());
  60. repair.setProvinceNumber(c.getProvinceNumber());
  61. repair.setCityNumber(c.getCityNumber());
  62. repair.setAreaNumber(c.getAreaNumber());
  63. repair.setRepairSendMergeAddress(c.getRelationSendMergeAddress());
  64. repair.setRepairSendAddress(c.getRelationSendAddress());
  65. repair.setRepairSendLogisticsCompany(c.getRelationSendLogisticsCompany());
  66. repair.setRepairSendLogisticsNo(c.getRelationSendLogisticsNo());
  67. repair.setRepairDesc(c.getRelationDesc());
  68. repair.setRepairState(c.getRelationState());
  69. repair.setRepairAlipay(c.getRelationAlipay());
  70. repair.setRepairIsTransfer(c.getRelationIsTransfer());
  71. repair.setRepairCreateTime(c.getRelationCreateTime());
  72. repair.setRepairUpdateTime(c.getRelationUpdateTime());
  73. return repair;
  74. case 5://补发
  75. Reissue reissue = new Reissue();
  76. reissue.setReissueId(c.getRelationId());
  77. reissue.setCustomerId(c.getCustomerId());
  78. reissue.setOrderId(c.getOrderId());
  79. reissue.setReissueBackEfastOrderId(c.getRelationBackEfastOrderId());
  80. reissue.setReissueSendStatus(c.getRelationSendStatus());
  81. reissue.setReissueSendName(c.getRelationSendName());
  82. reissue.setReissueSendTel(c.getRelationSendTel());
  83. reissue.setProvinceNumber(c.getProvinceNumber());
  84. reissue.setCityNumber(c.getCityNumber());
  85. reissue.setAreaNumber(c.getAreaNumber());
  86. reissue.setReissueSendMergeAddress(c.getRelationSendMergeAddress());
  87. reissue.setReissueSendAddress(c.getRelationSendAddress());
  88. reissue.setReissueSendLogisticsCompany(c.getRelationSendLogisticsCompany());
  89. reissue.setReissueSendLogisticsNo(c.getRelationSendLogisticsNo());
  90. reissue.setReissueDesc(c.getRelationDesc());
  91. reissue.setReissueState(c.getRelationState());
  92. reissue.setReissueCreateTime(c.getRelationCreateTime());
  93. reissue.setReissueUpdateTime(c.getRelationUpdateTime());
  94. return reissue;
  95. case 6://退货
  96. BackGoods backGoods = new BackGoods();
  97. backGoods.setBackGoodsId(c.getRelationId());
  98. backGoods.setCustomerId(c.getCustomerId());
  99. backGoods.setOrderId(c.getOrderId());
  100. backGoods.setSignclosedId(c.getSignclosedId());
  101. backGoods.setBackGoodsBackStatus(c.getRelationBackStatus());
  102. backGoods.setBackGoodsBackName(c.getRelationBackName());
  103. backGoods.setBackGoodsBackTel(c.getRelationBackTel());
  104. backGoods.setBackGoodsBackLogisticsCompany(c.getRelationBackLogisticsCompany());
  105. backGoods.setBackGoodsBackLogisticsNo(c.getRelationBackLogisticsNo());
  106. backGoods.setBackGoodsBackPostage(c.getRelationBackPostage());
  107. backGoods.setBackGoodsBackMachineNo(c.getRelationBackMachineNo());
  108. backGoods.setBackGoodsDesc(c.getRelationDesc());
  109. backGoods.setBackGoodsState(c.getRelationState());
  110. backGoods.setBackGoodsAlipay(c.getRelationAlipay());
  111. backGoods.setBackGoodsIsTransfer(c.getRelationIsTransfer());
  112. backGoods.setBackGoodsCreateTime(c.getRelationCreateTime());
  113. backGoods.setBackGoodsUpdateTime(c.getRelationUpdateTime());
  114. return backGoods;
  115. case 7://无理由退货
  116. NoreasonBack noreasonBack = new NoreasonBack();
  117. noreasonBack.setNoreasonBackId( c.getRelationId());
  118. noreasonBack.setCustomerId(c.getCustomerId());
  119. noreasonBack.setOrderId(c.getOrderId());
  120. noreasonBack.setSignclosedId(c.getSignclosedId());
  121. noreasonBack.setNoreasonBackBackStatus(c.getRelationBackStatus());
  122. noreasonBack.setNoreasonBackBackName(c.getRelationBackName());
  123. noreasonBack.setNoreasonBackBackTel(c.getRelationBackTel());
  124. noreasonBack.setNoreasonBackBackLogisticsCompany(c.getRelationBackLogisticsCompany());
  125. noreasonBack.setNoreasonBackBackLogisticsNo(c.getRelationBackLogisticsNo());
  126. noreasonBack.setNoreasonBackBackPostage(c.getRelationBackPostage());
  127. noreasonBack.setNoreasonBackBackMachineNo(c.getRelationBackMachineNo());
  128. noreasonBack.setNoreasonBackDesc(c.getRelationDesc());
  129. noreasonBack.setNoreasonBackState(c.getRelationState());
  130. noreasonBack.setNoreasonBackAlipay(c.getRelationAlipay());
  131. noreasonBack.setNoreasonBackIsTransfer(c.getRelationIsTransfer());
  132. noreasonBack.setNoreasonBackCreateTime(c.getRelationCreateTime());
  133. noreasonBack.setNoreasonBackUpdateTime(c.getRelationUpdateTime());
  134. return noreasonBack;
  135. default :
  136. return null;
  137. }
  138. }
  139. /**
  140. * 封装参数
  141. * @param solve 处理类型
  142. * @param object
  143. * @return
  144. */
  145. public static CustomerCommon getCustomerCommon(int solve, Object object) {
  146. if (object == null) {
  147. return null;
  148. }
  149. CustomerCommon customerCommon = new CustomerCommon();
  150. switch (solve) {
  151. case 3://换新
  152. Renewed renewed = (Renewed)object;
  153. customerCommon.setRelationId(renewed.getRenewedId());
  154. customerCommon.setCustomerId(renewed.getCustomerId());
  155. customerCommon.setOrderId(renewed.getOrderId());
  156. customerCommon.setSignclosedId(renewed.getSignclosedId());
  157. customerCommon.setRelationBackEfastOrderId(renewed.getRenewedBackEfastOrderId());
  158. customerCommon.setRelationBackStatus(renewed.getRenewedBackStatus());
  159. customerCommon.setRelationBackName(renewed.getRenewedBackName());
  160. customerCommon.setRelationBackTel(renewed.getRenewedBackTel());
  161. customerCommon.setRelationBackLogisticsCompany(renewed.getRenewedBackLogisticsCompany());
  162. customerCommon.setRelationBackLogisticsNo(renewed.getRenewedBackLogisticsNo());
  163. customerCommon.setRelationBackPostage(renewed.getRenewedBackPostage());
  164. customerCommon.setRelationBackMachineNo(renewed.getRenewedBackMachineNo());
  165. customerCommon.setRelationSendStatus(renewed.getRenewedSendStatus());
  166. customerCommon.setRelationSendName(renewed.getRenewedSendName());
  167. customerCommon.setRelationSendTel(renewed.getRenewedSendTel());
  168. customerCommon.setProvinceNumber(renewed.getProvinceNumber());
  169. customerCommon.setCityNumber(renewed.getCityNumber());
  170. customerCommon.setAreaNumber(renewed.getAreaNumber());
  171. customerCommon.setRelationSendMergeAddress(renewed.getRenewedSendMergeAddress());
  172. customerCommon.setRelationSendAddress(renewed.getRenewedSendAddress());
  173. customerCommon.setRelationSendLogisticsCompany(renewed.getRenewedSendLogisticsCompany());
  174. customerCommon.setRelationSendLogisticsNo(renewed.getRenewedSendLogisticsNo());
  175. customerCommon.setRelationDesc(renewed.getRenewedDesc());
  176. customerCommon.setRelationState(renewed.getRenewedState());
  177. customerCommon.setRelationAlipay(renewed.getRenewedAlipay());
  178. customerCommon.setRelationIsTransfer(renewed.getRenewedIsTransfer());
  179. customerCommon.setRelationCreateTime(renewed.getRenewedCreateTime());
  180. customerCommon.setRelationUpdateTime(renewed.getRenewedUpdateTime());
  181. customerCommon.setMaintenanceIsRepair(renewed.getMaintenanceIsRepair());
  182. break;
  183. case 4://维修
  184. Repair repair = (Repair)object;
  185. customerCommon.setRelationId(repair.getRepairId());
  186. customerCommon.setCustomerId(repair.getCustomerId());
  187. customerCommon.setOrderId(repair.getOrderId());
  188. customerCommon.setSignclosedId(repair.getSignclosedId());
  189. customerCommon.setRelationBackEfastOrderId(repair.getRepairBackEfastOrderId());
  190. customerCommon.setRelationBackStatus(repair.getRepairBackStatus());
  191. customerCommon.setRelationBackName(repair.getRepairBackName());
  192. customerCommon.setRelationBackTel(repair.getRepairBackTel());
  193. customerCommon.setRelationBackLogisticsCompany(repair.getRepairBackLogisticsCompany());
  194. customerCommon.setRelationBackLogisticsNo(repair.getRepairBackLogisticsNo());
  195. customerCommon.setRelationBackPostage(repair.getRepairBackPostage());
  196. customerCommon.setRelationBackMachineNo(repair.getRepairBackMachineNo());
  197. customerCommon.setRelationSendStatus(repair.getRepairSendStatus());
  198. customerCommon.setRelationSendName(repair.getRepairSendName());
  199. customerCommon.setRelationSendTel(repair.getRepairSendTel());
  200. customerCommon.setProvinceNumber(repair.getProvinceNumber());
  201. customerCommon.setCityNumber(repair.getCityNumber());
  202. customerCommon.setAreaNumber(repair.getAreaNumber());
  203. customerCommon.setRelationSendMergeAddress(repair.getRepairSendMergeAddress());
  204. customerCommon.setRelationSendAddress(repair.getRepairSendAddress());
  205. customerCommon.setRelationSendLogisticsCompany(repair.getRepairSendLogisticsCompany());
  206. customerCommon.setRelationSendLogisticsNo(repair.getRepairSendLogisticsNo());
  207. customerCommon.setRelationDesc(repair.getRepairDesc());
  208. customerCommon.setRelationState(repair.getRepairState());
  209. customerCommon.setRelationAlipay(repair.getRepairAlipay());
  210. customerCommon.setRelationIsTransfer(repair.getRepairIsTransfer());
  211. customerCommon.setRelationCreateTime(repair.getRepairCreateTime());
  212. customerCommon.setRelationUpdateTime(repair.getRepairUpdateTime());
  213. customerCommon.setMaintenanceIsRepair(repair.getMaintenanceIsRepair());
  214. customerCommon.setDetectState(repair.getDetectState());
  215. break;
  216. case 5://补发
  217. Reissue reissue = (Reissue)object;
  218. customerCommon.setRelationId(reissue.getReissueId());
  219. customerCommon.setCustomerId(reissue.getCustomerId());
  220. customerCommon.setOrderId(reissue.getOrderId());
  221. customerCommon.setRelationBackEfastOrderId(reissue.getReissueBackEfastOrderId());
  222. customerCommon.setRelationSendStatus(reissue.getReissueSendStatus());
  223. customerCommon.setRelationSendName(reissue.getReissueSendName());
  224. customerCommon.setRelationSendTel(reissue.getReissueSendTel());
  225. customerCommon.setProvinceNumber(reissue.getProvinceNumber());
  226. customerCommon.setCityNumber(reissue.getCityNumber());
  227. customerCommon.setAreaNumber(reissue.getAreaNumber());
  228. customerCommon.setRelationSendMergeAddress(reissue.getReissueSendMergeAddress());
  229. customerCommon.setRelationSendAddress(reissue.getReissueSendAddress());
  230. customerCommon.setRelationSendLogisticsCompany(reissue.getReissueSendLogisticsCompany());
  231. customerCommon.setRelationSendLogisticsNo(reissue.getReissueSendLogisticsNo());
  232. customerCommon.setRelationDesc(reissue.getReissueDesc());
  233. customerCommon.setRelationState(reissue.getReissueState());
  234. customerCommon.setRelationCreateTime(reissue.getReissueCreateTime());
  235. customerCommon.setRelationUpdateTime(reissue.getReissueUpdateTime());
  236. break;
  237. case 6://退货
  238. BackGoods backGoods = (BackGoods)object;
  239. customerCommon.setRelationId(backGoods.getBackGoodsId());
  240. customerCommon.setCustomerId(backGoods.getCustomerId());
  241. customerCommon.setOrderId(backGoods.getOrderId());
  242. customerCommon.setSignclosedId(backGoods.getSignclosedId());
  243. customerCommon.setRelationBackStatus(backGoods.getBackGoodsBackStatus());
  244. customerCommon.setRelationBackName(backGoods.getBackGoodsBackName());
  245. customerCommon.setRelationBackTel(backGoods.getBackGoodsBackTel());
  246. customerCommon.setRelationBackLogisticsCompany(backGoods.getBackGoodsBackLogisticsCompany());
  247. customerCommon.setRelationBackLogisticsNo(backGoods.getBackGoodsBackLogisticsNo());
  248. customerCommon.setRelationBackPostage(backGoods.getBackGoodsBackPostage());
  249. customerCommon.setRelationBackMachineNo(backGoods.getBackGoodsBackMachineNo());
  250. customerCommon.setRelationDesc(backGoods.getBackGoodsDesc());
  251. customerCommon.setRelationState(backGoods.getBackGoodsState());
  252. customerCommon.setRelationAlipay(backGoods.getBackGoodsAlipay());
  253. customerCommon.setRelationIsTransfer(backGoods.getBackGoodsIsTransfer());
  254. customerCommon.setRelationCreateTime(backGoods.getBackGoodsCreateTime());
  255. customerCommon.setRelationUpdateTime(backGoods.getBackGoodsUpdateTime());
  256. customerCommon.setDetectState(backGoods.getDetectState());
  257. break;
  258. case 7://无理由退货
  259. NoreasonBack noreasonBack = (NoreasonBack)object;
  260. customerCommon.setRelationId(noreasonBack.getNoreasonBackId());
  261. customerCommon.setCustomerId(noreasonBack.getCustomerId());
  262. customerCommon.setOrderId(noreasonBack.getOrderId());
  263. customerCommon.setSignclosedId(noreasonBack.getSignclosedId());
  264. customerCommon.setRelationBackStatus(noreasonBack.getNoreasonBackBackStatus());
  265. customerCommon.setRelationBackName(noreasonBack.getNoreasonBackBackName());
  266. customerCommon.setRelationBackTel(noreasonBack.getNoreasonBackBackTel());
  267. customerCommon.setRelationBackLogisticsCompany(noreasonBack.getNoreasonBackBackLogisticsCompany());
  268. customerCommon.setRelationBackLogisticsNo(noreasonBack.getNoreasonBackBackLogisticsNo());
  269. customerCommon.setRelationBackPostage(noreasonBack.getNoreasonBackBackPostage());
  270. customerCommon.setRelationBackMachineNo(noreasonBack.getNoreasonBackBackMachineNo());
  271. customerCommon.setRelationDesc(noreasonBack.getNoreasonBackDesc());
  272. customerCommon.setRelationState(noreasonBack.getNoreasonBackState());
  273. customerCommon.setRelationAlipay(noreasonBack.getNoreasonBackAlipay());
  274. customerCommon.setRelationIsTransfer(noreasonBack.getNoreasonBackIsTransfer());
  275. customerCommon.setRelationCreateTime(noreasonBack.getNoreasonBackCreateTime());
  276. customerCommon.setRelationUpdateTime(noreasonBack.getNoreasonBackUpdateTime());
  277. customerCommon.setDetectState(noreasonBack.getDetectState());
  278. break;
  279. default:
  280. customerCommon = null;
  281. break;
  282. }
  283. return customerCommon;
  284. }
  285. /**
  286. * 封装参数 list
  287. * @param solve 处理类型
  288. * @param relationList
  289. * @return
  290. */
  291. public static List<CustomerCommon> listToCustomerCommon(int solve,List<?> relationList){
  292. List<CustomerCommon> ccList = new ArrayList<>();
  293. for (Object relation : relationList){
  294. CustomerCommon cc = CustomerCommonUtil.getCustomerCommon(solve,relationList);
  295. ccList.add(cc);
  296. }
  297. return ccList;
  298. }
  299. /**
  300. * 将所有的寄回寄出中的类型改为 type
  301. * 售后类型 3:换新;4:维修;5:补发;6:退货;7:无理由退货
  302. * @param type
  303. */
  304. public static void setProduceOrFitting(Integer type,CustomerCommon cc){
  305. for (int i=0;i<cc.getSendProdcues().size();i++) {
  306. cc.getSendProdcues().get(i).setSendProduceType(type);
  307. cc.getSendProdcues().get(i).setRelationId(cc.getRelationId());
  308. }
  309. for (int i=0;i<cc.getSendFittings().size();i++) {
  310. cc.getSendFittings().get(i).setSendFittingType(type);
  311. cc.getSendFittings().get(i).setRelationId(cc.getRelationId());
  312. }
  313. for (int i=0;i<cc.getClosedProdcues().size();i++) {
  314. cc.getClosedProdcues().get(i).setClosedProdcueType(type);
  315. cc.getClosedProdcues().get(i).setRelationId(cc.getRelationId());
  316. }
  317. for (int i=0;i<cc.getClosedFittings().size();i++) {
  318. cc.getClosedFittings().get(i).setClosedFittingType(type);
  319. cc.getClosedFittings().get(i).setRelationId(cc.getRelationId());
  320. }
  321. }
  322. }