ccjgmwz 3 years ago
parent
commit
8a748a2045

+ 1 - 1
winsea-haixin-platform-backend/src/main/resources/application-prod.yml

@@ -7,7 +7,7 @@ spring:
   datasource:
     driver-class-name: com.mysql.jdbc.Driver
     password: Ccj841968545
-    url: jdbc:mysql://47.100.3.209:3306/yiliangyiyun_test?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&useSSL=false&serverTimezone=Asia/Shanghai
+    url: jdbc:mysql://47.100.3.209:3306/ylyy?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&useSSL=false&serverTimezone=Asia/Shanghai
     username: root
   redis:
     database: 0

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

@@ -32,4 +32,11 @@ public interface PaymentManagementMapper extends BaseMapper<PaymentManagement> {
      */
     List<PaymentManagement> getListByCondition(Map<String, Object> pageView);
 
+    /**
+     * 查询客户销售吨数
+     *
+     * @param pageView
+     * @return
+     */
+    Float getCustomerCount(Map<String, Object> pageView);
 }

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

@@ -645,25 +645,16 @@ public class PaymentManagementServiceImpl extends ServiceImpl<PaymentManagementM
         if (paymentManagement.getGoodsName().contains("玉米")){
             paymentManagement.setGoodsName("玉米");
         }
-        List<PaymentManagement> paymentManagementList = this.selectList(new EntityWrapper<PaymentManagement>()
-                .like("goods_name", "%" +paymentManagement.getGoodsName()+"%")
-                .eq("customer_number_card", paymentManagement.getCustomerNumberCard())
-                .eq("comp_id", paymentManagement.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;
-        }
+        Map<String, Object> pageView = new HashMap<>();
+
+        //  公司ID
+        pageView.put("compId", paymentManagement.getCompId());
+        pageView.put("goodsName", paymentManagement.getGoodsName());
+        pageView.put("customerNumberCard", paymentManagement.getCustomerNumberCard());
+        pageView.put("createDate", year);
+        // 查询服务商总数
+        cumulant = baseMapper.getCustomerCount(pageView);
+
         return cumulant;
     }
 

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

@@ -239,4 +239,24 @@
             LIMIT ${startRecord}, ${pageSize}
         </if>
     </select>
+    <!-- 获得付款管理总数 -->
+    <select id="getCustomerCount" parameterType="Map" resultType="java.lang.Float">
+        SELECT
+        sum(case when a.type ='潮粮' then a.pure_weight else a.net_weight end)
+        FROM payment_management a
+        WHERE a.delete_flag = '0'
+        <if test="customerNumberCard != null and customerNumberCard != ''">
+            AND a.customer_number_card = #{customerNumberCard}
+        </if>
+        <if test="goodsName != null and goodsName != ''">
+            AND a.goods_name like CONCAT('%',#{goodsName},'%')
+        </if>
+        <if test="createDate != null">
+            AND (DATE_FORMAT(a.create_date,"%Y%m%d") &gt;=
+            DATE_FORMAT(#{createDate},"%Y%m%d"))
+        </if>
+        <if test="compId != null and compId != ''">
+            AND a.comp_id = #{compId}
+        </if>
+    </select>
 </mapper>