Browse Source

Merge branch 'master' of http://git.iamberry.com/hexiugang/iamberry-common-parent

liujiankang 7 years ago
parent
commit
088a8235a0

+ 2 - 1
watero-rst-core/src/main/java/com.iamberry.rst.core/cm/CustomerCommon.java

@@ -21,7 +21,8 @@ public class CustomerCommon implements Serializable {
     private Integer signclosedId;
     //发出Efast订单号 
     private String relationBackEfastOrderId;
-    //寄回状态  1:未寄回  2:已寄回  3:已收货 
+    // TODO: 2018/3/23  寄回状态变更顺序: 1 -> 2  -> 4  -> 3
+    //寄回状态  1:未寄回  2:已寄回  3:已收货  4:已签收待确认
     private Integer relationBackStatus;
     //寄回人姓名 
     private String relationBackName;

+ 2 - 2
watero-rst-interface/src/main/java/com/iamberry/rst/faces/cm/CustomerCommonService.java

@@ -13,10 +13,10 @@ public interface CustomerCommonService {
     CustomerCommon getListProduceAndFitting(CustomerCommon customerCommon);
 
     /**
-     * 按照处理状态,获取所有的处理内容
+     * 获取换新,维修,表的状态
      * @param customerCommon
      * @return
      */
-    List<CustomerCommon> ListCustomerCommon(CustomerCommon customerCommon);
+    List<CustomerCommon> listCustomerCommon(CustomerCommon customerCommon);
 
 }

+ 31 - 27
watero-rst-service/src/main/java/com/iamberry/rst/service/cm/CustomerCommonServiceImpl.java

@@ -34,6 +34,9 @@ public class CustomerCommonServiceImpl implements CustomerCommonService {
     @Autowired
     private SendFittingMapper sendFittingMapper;
 
+    @Autowired
+    private CustomerCommonMapper customerCommonMapper;
+
     @Override
     public CustomerCommon getListProduceAndFitting(CustomerCommon customerCommon) {
         ClosedFitting closedFitting = new ClosedFitting();
@@ -60,33 +63,34 @@ public class CustomerCommonServiceImpl implements CustomerCommonService {
     }
 
     @Override
-    public List<CustomerCommon> ListCustomerCommon(CustomerCommon customerCommon) {
-        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));
+    public List<CustomerCommon> listCustomerCommon(CustomerCommon customerCommon) {
+        List<CustomerCommon> customerCommonList  = customerCommonMapper.listCustomerCommon(customerCommon);
+
+//        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;
     }

+ 16 - 0
watero-rst-service/src/main/java/com/iamberry/rst/service/cm/mapper/CustomerCommonMapper.java

@@ -0,0 +1,16 @@
+package com.iamberry.rst.service.cm.mapper;
+
+import com.iamberry.rst.core.cm.CustomerCommon;
+
+import java.util.List;
+
+public interface CustomerCommonMapper {
+
+    /**
+     * 获取换新,维修,补发,退后等信息
+     * @param customerCommon
+     * @return
+     */
+    List<CustomerCommon> listCustomerCommon(CustomerCommon customerCommon);
+}
+

+ 63 - 0
watero-rst-service/src/main/java/com/iamberry/rst/service/cm/mapper/customerCommonMapper.xml

@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="com.iamberry.rst.service.cm.mapper.CustomerCommonMapper">
+
+    <select id="listCustomerCommon" parameterType="CustomerCommon" resultType="CustomerCommon">
+        SELECT cc.*
+        FROM (
+            SELECT
+                '3' AS customerIsSolve,
+                renewed_id AS relationId,
+                customer_id AS customerId,
+                renewed_back_status  AS relationBackStatus,
+                renewed_back_logistics_company AS relationBackLogisticsCompany,
+                renewed_back_logistics_no AS relationBackLogisticsNo
+            FROM tb_rst_renewed
+            UNION ALL
+            SELECT
+                '4' AS customerIsSolve,
+                repair_id AS relationId,
+                customer_id AS customerId,
+                repair_back_status  AS relationBackStatus,
+                repair_back_logistics_company AS relationBackLogisticsCompany,
+                repair_back_logistics_no AS relationBackLogisticsNo
+            FROM tb_rst_repair
+            UNION ALL
+            SELECT
+                '5' AS customerIsSolve,
+                reissue_id AS relationId,
+                customer_id AS customerId,
+                NULL  AS relationBackStatus,
+                NULL AS relationBackLogisticsCompany,
+                NULL AS relationBackLogisticsNo
+            FROM tb_rst_reissue
+            UNION ALL
+            SELECT
+                '6' AS customerIsSolve,
+                back_goods_id AS relationId,
+                customer_id AS customerId,
+                back_goods_back_status  AS relationBackStatus,
+                back_goods_back_logistics_company AS relationBackLogisticsCompany,
+                back_goods_back_logistics_no AS relationBackLogisticsNo
+            FROM tb_rst_back_goods
+            UNION ALL
+            SELECT
+                '7' AS customerIsSolve,
+                noreason_back_id AS relationId,
+                customer_id AS customerId,
+                noreason_back_back_status  AS relationBackStatus,
+                noreason_back_back_logistics_company AS relationBackLogisticsCompany,
+                noreason_back_back_logistics_no AS relationBackLogisticsNo
+            FROM tb_rst_noreason_back
+        )cc
+        <where>
+            <if test="customerId != null and customerId != ''">
+                AND cc.customerId = #{customerId}
+            </if>
+            <if test="relationBackStatus != null and relationBackStatus != ''">
+                AND cc.relationBackStatus = #{relationBackStatus}
+            </if>
+        </where>
+  </select>
+
+</mapper>

+ 33 - 0
watero-rst-web/src/main/java/com/iamberry/rst/controllers/mq/MQTask.java

@@ -74,6 +74,11 @@ public class MQTask implements InitializingBean {
 	private CustomerService customerService;
 	@Autowired
 	private SysConfigService sysConfigService;
+	@Autowired
+	private CustomerCommonService customerCommonService;
+	@Autowired
+	private KuaiDi100 kuaidi100;
+
 
 
 
@@ -417,4 +422,32 @@ public class MQTask implements InitializingBean {
 		map.put("district",districtList.get(0).getDistrict());
 		return map;
 	}
+
+
+	/**客诉系统  自动追踪发货信息**/
+//	@Scheduled(cron = "0 0/30 * * * ?")//每30分钟执行一次
+		@Scheduled(cron = "0 0/3 * * * ?")//每三分钟执行一次
+	public void syncSendBackCustomer()throws Exception{
+		CustomerCommon customerCommon = new CustomerCommon();
+		customerCommon.setRelationBackStatus(2);
+		List<CustomerCommon> customerCommonList = customerCommonService.listCustomerCommon(customerCommon);
+		for(int i=0;i<customerCommonList.size();i++){
+			CustomerCommon cc = customerCommonList.get(i);
+			if(!StringUtils.isEmpty(cc.getRelationBackLogisticsCompany()) && StringUtils.isEmpty(cc.getRelationBackLogisticsNo())){
+				JSONObject rst = kuaidi100.getExpressInfo(cc.getRelationBackLogisticsCompany(),cc.getRelationBackLogisticsNo());
+				if(rst.has("state") && rst.getInt("state") == 3){
+				}
+			}
+		}
+
+	}
+
+
+	public static void main(String[] args) {
+		KuaiDi100 kuaiDi100 = new KuaiDi100();
+		JSONObject rst = kuaiDi100.getExpressInfo("sto","3347947142695");
+
+	}
+
+
 }

+ 2 - 0
watero-rst-web/src/main/resources/watero-rst-orm.xml

@@ -80,6 +80,7 @@
 		<typeAlias type="com.iamberry.rst.core.cm.SignclosedProductInfo" alias="SignclosedProductInfo"/>
 		<typeAlias type="com.iamberry.rst.core.cm.StoreInfo" alias="StoreInfo"/>
 		<typeAlias type="com.iamberry.rst.core.cm.Visit" alias="Visit"/>
+		<typeAlias type="com.iamberry.rst.core.cm.CustomerCommon" alias="CustomerCommon"/>
 
 		<typeAlias type="com.iamberry.rst.core.sys.SysConfig" alias="SysConfig"/>
 
@@ -139,6 +140,7 @@
 		<mapper resource="com/iamberry/rst/service/cm/mapper/fittingsInfoMapper.xml"/>
 		<mapper resource="com/iamberry/rst/service/cm/mapper/salesOrderMapper.xml"/>
 		<mapper resource="com/iamberry/rst/service/cm/mapper/storeInfoMapper.xml"/>
+		<mapper resource="com/iamberry/rst/service/cm/mapper/customerCommonMapper.xml"/>
 
 		<mapper resource="com/iamberry/rst/service/address/mapper/addressMapper.xml"/>