|
@@ -1615,6 +1615,54 @@ public class CustomerServiceImpl implements CustomerService {
|
|
|
|
|
|
@Override
|
|
|
@Transactional
|
|
|
+ public String synchronizeSendbackInfo() {
|
|
|
+ List<CmRelation> cmRelationlist = cmRelationMapper.getCmRelationList(new CmRelation());
|
|
|
+ Integer num = 0;//成功个数
|
|
|
+ Integer oum = 0;//失败个数
|
|
|
+ try {
|
|
|
+ for (CmRelation cmRelation : cmRelationlist){
|
|
|
+ SendbackInfo sendbackInfo = new SendbackInfo();
|
|
|
+ sendbackInfo.setRelationId(cmRelation.getRelationId());
|
|
|
+ sendbackInfo.setSendbackLogisticsCompany(cmRelation.getRelationBackLogisticsCompany());
|
|
|
+ sendbackInfo.setSendbackLogisticsNo(cmRelation.getRelationBackLogisticsNo());
|
|
|
+ sendbackInfo.setSendbackName(cmRelation.getRelationBackName());
|
|
|
+ sendbackInfo.setSendbackTel(cmRelation.getRelationBackTel());
|
|
|
+ sendbackInfo.setSendbackStatus(cmRelation.getRelationBackStatus());
|
|
|
+ sendbackInfo.setSendbackSignTime(cmRelation.getRelationBackReceiptDate());
|
|
|
+ int s = customerInfoMapper.addSendbackInfo(sendbackInfo);
|
|
|
+ if(s > 0){
|
|
|
+ num++;
|
|
|
+ ClosedProdcue closedProdcue = new ClosedProdcue();
|
|
|
+ closedProdcue.setRelationId(cmRelation.getRelationId());
|
|
|
+ List<ClosedProdcue> listClosedProdcue = closedProdcueMapper.listclosedProdcue(closedProdcue);
|
|
|
+
|
|
|
+ List<SendbackItem> listSendbackItem = new ArrayList<>();
|
|
|
+ for(ClosedProdcue prodcue : listClosedProdcue){
|
|
|
+ SendbackItem sendbackItem = new SendbackItem();
|
|
|
+ sendbackItem.setSendbackId(sendbackInfo.getSendbackId());
|
|
|
+ sendbackItem.setSendbackProductId(prodcue.getProductId());
|
|
|
+ sendbackItem.setSendbackColorId(prodcue.getColorId());
|
|
|
+ sendbackItem.setSendbackProdcueNumber(prodcue.getClosedProdcueNumber());
|
|
|
+ sendbackItem.setSendbackProdcueNumber(prodcue.getClosedProdcueNumber());
|
|
|
+ listSendbackItem.add(sendbackItem);
|
|
|
+ }
|
|
|
+ if(listSendbackItem.size() > 0){
|
|
|
+ customerInfoMapper.addSendbackItemList(listSendbackItem);
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ oum++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ throw new RuntimeException("同步寄回信息失败");
|
|
|
+
|
|
|
+ }
|
|
|
+ return "同步成功:"+num+"个,失败:"+oum+"个";
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional
|
|
|
public SendbackInfo addSendbackInfo(SendbackInfo sendbackInfo) {
|
|
|
JSONArray jsonArray;
|
|
|
List<SendbackItem> sendbackItemList;
|