Browse Source

曲靖三岔河

chengxiaowen 1 tuần trước cách đây
mục cha
commit
b8d5594ead

+ 16 - 16
src/main/java/com/poteviohealth/cgp/statistics/mapper/QujingOrderMapper.java

@@ -135,7 +135,7 @@ public interface QujingOrderMapper extends BaseMapper<Order>{
      * @param dbName
      * @return
      */
-    List<IntegralProduct> integralProductList(@Param("dbName") String dbName, @Param("supplierId") Integer supplierId);
+    List<IntegralProduct> integralProductList(@Param("dbName") String dbName, @Param("operatorId") Integer operatorId, @Param("supplierId") Integer supplierId);
 
     /**
      * 获取商户
@@ -152,23 +152,23 @@ public interface QujingOrderMapper extends BaseMapper<Order>{
      */
     List<Product> queryIntegralProduct(@Param("dbName") String dbName, @Param("operatorId") Integer operatorId, @Param("supplierId") Integer supplierId);
 
-    /**
-     * 获取有积分记录的运营商
-     * @param dbName
-     * @return
-     */
-    List<Integer> getIntegralCardAccOperatorIdList(@Param("dbName") String dbName,@Param("supplierId") Integer supplierId);
+//    /**
+//     * 获取有积分记录的运营商
+//     * @param dbName
+//     * @return
+//     */
+//    List<Integer> getIntegralCardAccOperatorIdList(@Param("dbName") String dbName,@Param("supplierId") Integer supplierId);
 
-    /**
-     * 获取有积分记录的运营商
-     * @param dbName
-     * @return
-     */
-    List<Integer> getIntegralCardDetailOperatorIdList(@Param("dbName") String dbName, @Param("supplierId") Integer supplierId);
+//    /**
+//     * 获取有积分记录的运营商
+//     * @param dbName
+//     * @return
+//     */
+//    List<Integer> getIntegralCardDetailOperatorIdList(@Param("dbName") String dbName, @Param("supplierId") Integer supplierId);
 
-    List<Order> listAll();
+    List<Order> listAll(@Param("supplierId")Integer supplierId);
 
-    void saveOrder(@Param("o") Order o);
+    void saveOrder(@Param("o") Order o,@Param("supplierId")Integer supplierId);
 
-    void updateOrder(@Param("o") Order o);
+    void updateOrder(@Param("o") Order o,@Param("supplierId")Integer supplierId);
 }

+ 24 - 24
src/main/java/com/poteviohealth/cgp/statistics/service/impl/QujingOrderServiceImpl.java

@@ -50,7 +50,7 @@ public class QujingOrderServiceImpl implements IQujingOrderService {
     public void statisticsOrder(String dateTime, Integer operatorId, Integer supplierId){
         try {
             //检查区域,没有的新增
-            List<Order> list = baseMapper.listAll();
+            List<Order> list = baseMapper.listAll(supplierId);
            /* Date date = new Date();
             if(StringUtils.isNotEmpty(dateTime)){
                 date = DateUtils.parseDate(dateTime,"yyyy-MM-dd HH:mm:ss");
@@ -61,7 +61,7 @@ public class QujingOrderServiceImpl implements IQujingOrderService {
                 List<Integer> ids = Lists.newArrayList();
                 List<Order> newOrderList = Lists.newArrayList();
                 if(list.size()>0){
-                    ids = list.stream().map(o->o.getAreaId()).collect(Collectors.toList());
+                    ids = list.stream().map(Order::getAreaId).collect(Collectors.toList());
                 }
                 for (AreaDTO areaDTO : areaList) {
                     if(!ids.contains(areaDTO.getId())){
@@ -71,7 +71,7 @@ public class QujingOrderServiceImpl implements IQujingOrderService {
                         order.setAreaName(areaDTO.getName());
                         order.setTreePath(areaDTO.getTreePath());
                         order.setSourceLevel(areaDTO.getLevel());
-                        Integer size = 0;
+                        int size = 0;
                         switch (order.getSourceLevel()){
                             case 1:
                                 size =4;
@@ -91,9 +91,9 @@ public class QujingOrderServiceImpl implements IQujingOrderService {
                     }
                 }
                 for(Order o:newOrderList) {
-                    baseMapper.saveOrder(o);
+                    baseMapper.saveOrder(o,supplierId);
                 }
-                list = baseMapper.listAll();
+                list = baseMapper.listAll(supplierId);
             }
             Map<Integer,List<Order>> maps = list.stream().collect(Collectors.groupingBy(Order::getAreaId));
 
@@ -140,14 +140,14 @@ public class QujingOrderServiceImpl implements IQujingOrderService {
                 log.info("---更新商户积分数据结束---");
 
                 log.info("---客户积分开始获取---");
-                changeCustomerIntegral(maps,supplierId);
+                changeCustomerIntegral(maps,operatorId, supplierId);
                 log.info("---客户积分结束获取---");
                 log.info("---积分流水开始获取---");
-                changeTransIntegral(maps,supplierId);
+                changeTransIntegral(maps,operatorId, supplierId);
                 log.info("---积分流水结束获取---");
 //                this.saveOrUpdateBatch(list);
                 for (Order o:list){
-                    baseMapper.updateOrder(o);
+                    baseMapper.updateOrder(o,supplierId);
                 }
             }
             log.info("完成----");
@@ -479,16 +479,16 @@ public class QujingOrderServiceImpl implements IQujingOrderService {
         }
     }
 
-    private List<SubsidyCustomerFace> integralCustomer(Integer supplierId){
+    private List<SubsidyCustomerFace> integralCustomer(Integer operatorId, Integer supplierId){
         List<SubsidyCustomerFace> returnList = Lists.newArrayList();
-        List<Integer> operationIds =  baseMapper.getIntegralCardAccOperatorIdList(dbName,supplierId);
+//        List<Integer> operationIds =  baseMapper.getIntegralCardAccOperatorIdList(dbName,supplierId);
 
-        List<IntegralTrans> detailsCustomer = Lists.newArrayList();
+        List<IntegralTrans> detailsCustomer;
 
-        for (Integer operationId : operationIds) {
+//        for (Integer operationId : operationIds) {
             //获取积分数据
-            detailsCustomer.addAll(baseMapper.integralCustomerList(operationId,dbName,supplierId));
-        }
+            detailsCustomer= baseMapper.integralCustomerList(operatorId,dbName,supplierId);
+//        }
 
         log.info("---处理积分客户数据开始----");
         if(!detailsCustomer.isEmpty()){
@@ -537,8 +537,8 @@ public class QujingOrderServiceImpl implements IQujingOrderService {
         }
     }
 
-    private void changeCustomerIntegral(Map<Integer, List<Order>> maps,Integer supplierId) {
-        List<SubsidyCustomerFace> integralList = this.integralCustomer(supplierId);
+    private void changeCustomerIntegral(Map<Integer, List<Order>> maps,Integer operatorId, Integer supplierId) {
+        List<SubsidyCustomerFace> integralList = this.integralCustomer(operatorId, supplierId);
         for (SubsidyCustomerFace subsidyCustomerFace : integralList) {
             List<Order> orders = maps.get(subsidyCustomerFace.getAreaId());
             if (CollectionUtils.isEmpty(orders)) {
@@ -558,14 +558,14 @@ public class QujingOrderServiceImpl implements IQujingOrderService {
     }
 
 
-    private List<SubsidyCustomerFace> integralTrans(Integer supplierId){
+    private List<SubsidyCustomerFace> integralTrans(Integer operatorId, Integer supplierId){
         List<SubsidyCustomerFace> returnList = Lists.newArrayList();
-        List<Integer> operationIds = baseMapper.getIntegralCardDetailOperatorIdList(dbName,supplierId);
-        List<IntegralTrans> detailsTrans = Lists.newArrayList();
-        for (Integer operationId : operationIds) {
+//        List<Integer> operationIds = baseMapper.getIntegralCardDetailOperatorIdList(dbName,supplierId);
+        List<IntegralTrans> detailsTrans ;
+//        for (Integer operationId : operationIds) {
             //获取积分数据
-            detailsTrans.addAll(baseMapper.integralTransList(operationId,dbName,supplierId));
-        }
+            detailsTrans=baseMapper.integralTransList(operatorId,dbName,supplierId);
+//        }
 
         log.info("---处理流水数据开始----");
         Map<Integer,List<IntegralTrans>> streetTransMaps = detailsTrans.stream().filter(i->i.getStreetId() != null).collect(Collectors.groupingBy(IntegralTrans::getStreetId));
@@ -673,8 +673,8 @@ public class QujingOrderServiceImpl implements IQujingOrderService {
         return monthList;
     }
 
-    private void changeTransIntegral(Map<Integer, List<Order>> maps, Integer supplierId) {
-        List<SubsidyCustomerFace> integralList = this.integralTrans(supplierId);
+    private void changeTransIntegral(Map<Integer, List<Order>> maps, Integer operatorId, Integer supplierId) {
+        List<SubsidyCustomerFace> integralList = this.integralTrans(operatorId, supplierId);
 
         for (SubsidyCustomerFace subsidyCustomerFace : integralList) {
             List<Order> orders = maps.get(subsidyCustomerFace.getAreaId());

+ 12 - 11
src/main/resources/mapper/statistics/QujingOrderMapper.xml

@@ -3,7 +3,7 @@
 <mapper namespace="com.poteviohealth.cgp.statistics.mapper.QujingOrderMapper">
     <insert id="saveOrder">
 			INSERT INTO qj_face_order (id, created_date, modified_date, change_date, yn, 
-			operator_id, region_area_code, source_level, area_id, area_name, 
+			operator_id, supplier_id, region_area_code, source_level, area_id, area_name,
 			tree_path, customer_num, customer_service_num, customer_government_num, customer_society_num, 
 			customer_rate, customer_list, employee_num, employee_list, visit_num, 
 			visit_rate, satisfaction_rate, qualified_rate, order_num, order_num_month, 
@@ -14,7 +14,7 @@
 			customer_age_list, all_station_num, all_customer_num, service_customer_num, point_grant_wm, 
 			point_exchange_wm, point_month_data_wm, point_grant_yl, point_month_data_yl) 
 			VALUES (NULL, now(), now(), NULL, 0, 
-			NULL, #{o.regionAreaCode}, #{o.sourceLevel}, #{o.areaId}, #{o.areaName}, 
+			#{o.operatorId}, #{supplierId}, #{o.regionAreaCode}, #{o.sourceLevel}, #{o.areaId}, #{o.areaName},
 			#{o.treePath}, #{o.customerNum}, #{o.customerServiceNum}, #{o.customerGovernmentNum}, #{o.customerSocietyNum}, 
 			#{o.customerRate}, #{o.customerList}, #{o.employeeNum}, #{o.employeeList}, #{o.visitNum}, 
 			#{o.visitRate}, #{o.satisfactionRate}, #{o.qualifiedRate}, #{o.orderNum}, #{o.orderNumMonth}, 
@@ -257,6 +257,7 @@
 
     <select id="integralProductList" resultType="com.poteviohealth.cgp.statistics.model.outdto.IntegralProduct">
         select merchant_id from ${dbName}_customer.c_integral_product where yn =0 and type = 0 and own_review = 1
+        and operator_id = #{operatorId}
     </select>
 
     <select id="getStationMerchantList"
@@ -270,17 +271,17 @@
         where operator_id = #{operatorId} and  yn = 0 and own_status = 1 and tags like '%8962319%' and provider_id = #{supplierId}
     </select>
 
-    <select id="getIntegralCardAccOperatorIdList" resultType="java.lang.Integer">
-        select operator_id from ${dbName}_finance.c_card_acc_detail
-        where yn = 0 and type = 2 and enable = 1 and supplier_id = #{supplierId} group by operator_id
-    </select>
+<!--    <select id="getIntegralCardAccOperatorIdList" resultType="java.lang.Integer">-->
+<!--        select operator_id from ${dbName}_finance.c_card_acc_detail-->
+<!--        where yn = 0 and type = 2 and enable = 1 and supplier_id = #{supplierId} group by operator_id-->
+<!--    </select>-->
 
-    <select id="getIntegralCardDetailOperatorIdList" resultType="java.lang.Integer">
-        select operator_id from ${dbName}_finance.c_card_acc_detail
-        where yn = 0 and type = 2 and enable = 1 and supplier_id = #{supplierId} group by operator_id
-    </select>
+<!--    <select id="getIntegralCardDetailOperatorIdList" resultType="java.lang.Integer">-->
+<!--        select operator_id from ${dbName}_finance.c_card_acc_detail-->
+<!--        where yn = 0 and type = 2 and enable = 1 and supplier_id = #{supplierId} group by operator_id-->
+<!--    </select>-->
 
     <select id="listAll" resultType="com.poteviohealth.cgp.statistics.model.Order">
-        select * from qj_face_order where yn = 0
+        select * from qj_face_order where yn = 0 and supplier_id = #{supplierId}
     </select>
 </mapper>