ccjgmwz 3 gadi atpakaļ
vecāks
revīzija
6b6f4db1f3

+ 1 - 1
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/controller/AppVersionController.java

@@ -46,7 +46,7 @@ public class AppVersionController {
      */
     @GetMapping("/test")
     public void test() {
-//        geTuiUtils.pushByCid("推送测试","推送测试内容",userId);
+        geTuiUtils.pushByCid("推送测试","推送测试内容","84f62127b7384dcdbaeaddfe460329fc");
 //       List<CommonUser> list =   commonUserService.selectList(new EntityWrapper<>());
 //       for(CommonUser commonUser:list){
 //           commonUser.setPassword(Md5Crypt.md5Crypt("123456".getBytes(), "$1$" + commonUser.getPhone().substring(0, 7)));

+ 7 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/mapper/IdentityAuthenticationInfoMapper.java

@@ -31,5 +31,12 @@ public interface IdentityAuthenticationInfoMapper extends BaseMapper<IdentityAut
      * @return
      */
     Integer getIdentityCountByCondition(Map<String, Object> pageView);
+    /**
+     * 获取未达上限客户列表(自采客户)
+     *
+     * @param pageView
+     * @return
+     */
+    List<IdentityAuthenticationInfo> getIdentityInfoNotLimit(Map<String, Object> pageView);
 
 }

+ 71 - 59
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/IdentityAuthenticationInfoServiceImpl.java

@@ -474,73 +474,85 @@ public class IdentityAuthenticationInfoServiceImpl extends ServiceImpl<IdentityA
      */
     @Override
     public List<IdentityAuthenticationInfo> identityAuthenticationInfoCustomer(IdentityAuthenticationInfo identityAuthenticationInfo) {
-//        Map<String, Object> pageView = new HashMap<>();
-//        if(identityAuthenticationInfo.getCompId() == null || identityAuthenticationInfo.getCompId().isEmpty()){
-//            identityAuthenticationInfo.setCompId(AuthSecurityUtils.getStaffById(AuthSecurityUtils.getCurrentUserId()).getCompId());
-//        }
-//        //公司id
-//        pageView.put("compId", identityAuthenticationInfo.getCompId());
-//        pageView.put("authenticationStatusKey", identityAuthenticationInfo.getAuthenticationStatusKey());
-//        pageView.put("searchKeyWord", identityAuthenticationInfo.getSearchKeyWord());
-//        List<IdentityAuthenticationInfo> dataList = this.baseMapper.getIdentityInfoByCondition(pageView);
-//        return dataList;
+        Map<String, Object> pageView = new HashMap<>();
         if(identityAuthenticationInfo.getCompId() == null || identityAuthenticationInfo.getCompId().isEmpty()){
             identityAuthenticationInfo.setCompId(AuthSecurityUtils.getStaffById(AuthSecurityUtils.getCurrentUserId()).getCompId());
         }
-        Wrapper<IdentityAuthenticationInfo> identityAuthenticationInfoWrapper = new EntityWrapper<>();
-        identityAuthenticationInfoWrapper.eq("comp_id",identityAuthenticationInfo.getCompId())
-                .eq("cover","0")
-                .eq("authentication_status_key","7");
-        if (!StringUtils.isEmpty(identityAuthenticationInfo.getSearchKeyWord())) {
-            identityAuthenticationInfoWrapper.andNew("replace(" + "customer_name" + ",' ','')like {0} or "
-                    + "customer_phone" + " like {0} or "
-                    + "supplier" + " like {0}", "%" + identityAuthenticationInfo.getSearchKeyWord() + "%");
-        }
-        List<IdentityAuthenticationInfo> identityAuthenticationInfoList = this.selectList(identityAuthenticationInfoWrapper);
         PurchasePrice purchasePrice=purchasePriceService.selectOne(new EntityWrapper<PurchasePrice>()
                 .eq("warehouse_id",identityAuthenticationInfo.getWarehouseId())
                 .eq("goods_name",identityAuthenticationInfo.getGoodsName())
                 .eq("status","已通过"));
-        List<IdentityAuthenticationInfo> identityAuthenticationInfoListNew=new ArrayList<>();
-        if (CollectionUtils.isNotEmpty(identityAuthenticationInfoList)){
-            for (IdentityAuthenticationInfo identityAuthenticationInfo1:identityAuthenticationInfoList) {
-                Float cumulant = 0.0f;
-                //本年第一天零点
-                SimpleDateFormat now = new SimpleDateFormat("yyyy-01-01 00:00:00");
-                Calendar c = Calendar.getInstance();
-                c.setTime(new java.util.Date());
-                c.add(Calendar.YEAR, 0);
-                Date y = c.getTime();
-                String year = now.format(y);
-                if (identityAuthenticationInfo.getGoodsName().contains("玉米")) {
-                    identityAuthenticationInfo.setGoodsName("玉米");
-                }
-                List<PaymentManagement> paymentManagementList = paymentManagementService.selectList(new EntityWrapper<PaymentManagement>()
-                        .like("goods_name", "%" + identityAuthenticationInfo.getGoodsName() + "%")
-                        .eq("customer_number_card", identityAuthenticationInfo1.getCustomerNumberCard())
-                        .eq("comp_id", purchasePrice.getCompId())
-                        .ge("create_date", year));
-                if (!CollectionUtils.isEmpty(paymentManagementList)) {
-                    Float netWeight = 0f;
-                    for (PaymentManagement paymentManagement1 : paymentManagementList) {
-                        //干粮净重
-                        if ("干粮".equals(paymentManagement1.getType())) {
-                            netWeight = netWeight + (paymentManagement1.getNetWeight() != null ? paymentManagement1.getNetWeight() : 0f);
-                        }
-                        //潮粮纯重
-                        else if ("潮粮".equals(paymentManagement1.getType())) {
-                            netWeight = netWeight + (paymentManagement1.getPureWeight() != null ? paymentManagement1.getPureWeight() : 0f);
-                        }
-                    }
-                    cumulant = cumulant + netWeight;
-                }
-                if (cumulant > (purchasePrice.getSaleLimit() - 50)*1000) {
-                    identityAuthenticationInfoListNew.add(identityAuthenticationInfo1);
-                }
-            }
-            identityAuthenticationInfoList.removeAll(identityAuthenticationInfoListNew);
+        if (identityAuthenticationInfo.getGoodsName().contains("玉米")) {
+            identityAuthenticationInfo.setGoodsName("玉米");
         }
-        return identityAuthenticationInfoList;
+        SimpleDateFormat now = new SimpleDateFormat("yyyy-01-01 00:00:00");
+        Calendar c = Calendar.getInstance();
+        c.setTime(new java.util.Date());
+        c.add(Calendar.YEAR, 0);
+        Date y = c.getTime();
+        String year = now.format(y);
+        //公司id
+        pageView.put("compId", identityAuthenticationInfo.getCompId());
+        pageView.put("authenticationStatusKey", "7");
+        pageView.put("year", year);
+        pageView.put("goodsName",identityAuthenticationInfo.getGoodsName());
+        pageView.put("saleLimit", purchasePrice.getSaleLimit()*1000);
+        pageView.put("searchKeyWord", identityAuthenticationInfo.getSearchKeyWord());
+        List<IdentityAuthenticationInfo> dataList = this.baseMapper.getIdentityInfoNotLimit(pageView);
+        return dataList;
+//        if(identityAuthenticationInfo.getCompId() == null || identityAuthenticationInfo.getCompId().isEmpty()){
+//            identityAuthenticationInfo.setCompId(AuthSecurityUtils.getStaffById(AuthSecurityUtils.getCurrentUserId()).getCompId());
+//        }
+//        Wrapper<IdentityAuthenticationInfo> identityAuthenticationInfoWrapper = new EntityWrapper<>();
+//        identityAuthenticationInfoWrapper.eq("comp_id",identityAuthenticationInfo.getCompId())
+//                .eq("cover","0")
+//                .eq("authentication_status_key","7");
+//        if (!StringUtils.isEmpty(identityAuthenticationInfo.getSearchKeyWord())) {
+//            identityAuthenticationInfoWrapper.andNew("replace(" + "customer_name" + ",' ','')like {0} or "
+//                    + "customer_phone" + " like {0} or "
+//                    + "supplier" + " like {0}", "%" + identityAuthenticationInfo.getSearchKeyWord() + "%");
+//        }
+//        List<IdentityAuthenticationInfo> identityAuthenticationInfoList = this.selectList(identityAuthenticationInfoWrapper);
+//        List<IdentityAuthenticationInfo> identityAuthenticationInfoListNew=new ArrayList<>();
+//        if (CollectionUtils.isNotEmpty(identityAuthenticationInfoList)){
+//            for (IdentityAuthenticationInfo identityAuthenticationInfo1:identityAuthenticationInfoList) {
+//                Float cumulant = 0.0f;
+//                //本年第一天零点
+//                SimpleDateFormat now = new SimpleDateFormat("yyyy-01-01 00:00:00");
+//                Calendar c = Calendar.getInstance();
+//                c.setTime(new java.util.Date());
+//                c.add(Calendar.YEAR, 0);
+//                Date y = c.getTime();
+//                String year = now.format(y);
+//                if (identityAuthenticationInfo.getGoodsName().contains("玉米")) {
+//                    identityAuthenticationInfo.setGoodsName("玉米");
+//                }
+//                List<PaymentManagement> paymentManagementList = paymentManagementService.selectList(new EntityWrapper<PaymentManagement>()
+//                        .like("goods_name", "%" + identityAuthenticationInfo.getGoodsName() + "%")
+//                        .eq("customer_number_card", identityAuthenticationInfo1.getCustomerNumberCard())
+//                        .eq("comp_id", purchasePrice.getCompId())
+//                        .ge("create_date", year));
+//                if (!CollectionUtils.isEmpty(paymentManagementList)) {
+//                    Float netWeight = 0f;
+//                    for (PaymentManagement paymentManagement1 : paymentManagementList) {
+//                        //干粮净重
+//                        if ("干粮".equals(paymentManagement1.getType())) {
+//                            netWeight = netWeight + (paymentManagement1.getNetWeight() != null ? paymentManagement1.getNetWeight() : 0f);
+//                        }
+//                        //潮粮纯重
+//                        else if ("潮粮".equals(paymentManagement1.getType())) {
+//                            netWeight = netWeight + (paymentManagement1.getPureWeight() != null ? paymentManagement1.getPureWeight() : 0f);
+//                        }
+//                    }
+//                    cumulant = cumulant + netWeight;
+//                }
+//                if (cumulant > (purchasePrice.getSaleLimit() - 50)*1000) {
+//                    identityAuthenticationInfoListNew.add(identityAuthenticationInfo1);
+//                }
+//            }
+//            identityAuthenticationInfoList.removeAll(identityAuthenticationInfoListNew);
+//        }
+//        return identityAuthenticationInfoList;
     }
 
     /**

+ 4 - 1
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/PaymentManagementServiceImpl.java

@@ -631,6 +631,9 @@ public class PaymentManagementServiceImpl extends ServiceImpl<PaymentManagementM
 
     @Override
     public Float cumulant(PaymentManagement paymentManagement) {
+        if(paymentManagement.getCustomerNumberCard() == null || paymentManagement.getCustomerNumberCard().isEmpty()){
+            return 0f;
+        }
         Float cumulant = 0.0f;
         //本年第一天零点
         SimpleDateFormat now = new SimpleDateFormat("yyyy-01-01 00:00:00");
@@ -652,9 +655,9 @@ public class PaymentManagementServiceImpl extends ServiceImpl<PaymentManagementM
         pageView.put("goodsName", paymentManagement.getGoodsName());
         pageView.put("customerNumberCard", paymentManagement.getCustomerNumberCard());
         pageView.put("createDate", year);
+
         // 查询服务商总数
         cumulant = baseMapper.getCustomerCount(pageView);
-
         return cumulant;
     }
 

+ 58 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/resources/mapper/IdentityAuthenticationInfoMapper.xml

@@ -73,4 +73,62 @@
         group by
         a.id) t
     </select>
+    <!-- 获得客户列表 -->
+    <select id="getIdentityInfoNotLimit" parameterType="Map"
+            resultType="com.yh.saas.plugin.yiliangyiyun.entity.IdentityAuthenticationInfo">
+        SELECT * FROM (
+        SELECT
+        a.id as id,
+        a.customer_name as customerName,
+        a.customer_phone as customerPhone,
+        a.bank_card as bankCard,
+        a.bank_deposit as bankDeposit,
+        a.bank_deposit_branch as bankDepositBranch,
+        a.payee_name as payeeName,
+        a.payee_number_card as payeeNumberCard,
+        a.authentication_status_key as authenticationStatusKey,
+        case when a.delete_flag = '1' then '已删除'
+        when a.cover = '1' then '已覆盖'
+        else a.authentication_status end as authenticationStatus,
+        a.cover ,
+        a.customer_number_card as customerNumberCard,
+        a.payee_address_url as payeeAddressUrl,
+        a.card_address_url as cardAddressUrl,
+        a.comp_id as compId,
+        a.supplier,
+        (SELECT IFNULL(sum(case when p.type ='潮粮' then p.pure_weight else p.net_weight end),0)
+        FROM payment_management p
+        WHERE p.delete_flag = '0'
+        AND p.customer_number_card = a.customer_number_card
+        AND p.goods_name like CONCAT('%', #{goodsName},'%')
+        AND (DATE_FORMAT(p.create_date,"%Y%m%d") >=
+        DATE_FORMAT(#{year},"%Y%m%d"))
+        AND p.comp_id = b.com_id) as num
+        FROM identity_authentication_info a
+        left join
+        common_company_identity b
+        on
+        a.id = b.identity_id
+        and b.com_id=#{compId}
+        WHERE
+        a.customer_type_flag = '1'
+        and b.delete_flag = '0'
+        <if test="searchKeyWord != null and searchKeyWord != ''">
+            AND (lower(a.customer_name) like lower(CONCAT('%',#{searchKeyWord},'%'))
+            OR lower(a.customer_phone) like lower(CONCAT('%',#{searchKeyWord},'%'))
+            OR lower(a.supplier) like lower(CONCAT('%',#{searchKeyWord},'%')))
+        </if>
+        <if test="authenticationStatusKey != null and authenticationStatusKey != ''">
+            and a.authentication_status_key=#{authenticationStatusKey}
+        </if>
+        and a.cover=0
+        group by
+        a.id
+        ORDER BY a.update_date DESC
+        )
+        tt where tt.num - 50 &lt; #{saleLimit}
+        <if test="currentPage != null and currentPage != ''">
+            LIMIT ${startRecord}, ${pageSize}
+        </if>
+    </select>
 </mapper>

+ 1 - 1
winsea-haixin-plugin-yiliangyiyun/src/main/resources/mapper/PaymentManagementMapper.xml

@@ -242,7 +242,7 @@
     <!-- 获得付款管理总数 -->
     <select id="getCustomerCount" parameterType="Map" resultType="java.lang.Float">
         SELECT
-        sum(case when a.type ='潮粮' then a.pure_weight else a.net_weight end)
+        IFNULL(sum(case when a.type ='潮粮' then a.pure_weight else a.net_weight end),0)
         FROM payment_management a
         WHERE a.delete_flag = '0'
         <if test="customerNumberCard != null and customerNumberCard != ''">