浏览代码

BI大屏协议数接口修改

Sun 3 年之前
父节点
当前提交
b3c41d67ef

+ 37 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/agreement/TWarehouseAgreementController.java

@@ -0,0 +1,37 @@
+package com.ruoyi.web.controller.warehouse.agreement;
+
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.page.TableDataInfo;
+import com.ruoyi.warehouseBusiness.domain.TWarehouseAgreement;
+import com.ruoyi.warehouseBusiness.service.ITWarehouseAgreementService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 仓储费Controller
+ *
+ * @author ruoyi
+ * @date 2020-12-11
+ */
+@RestController
+@RequestMapping("/warehouseBusiness/agreement")
+public class TWarehouseAgreementController extends BaseController {
+    @Autowired
+    private ITWarehouseAgreementService tWarehouseAgreementService;
+
+    /**
+     * 查询协议提醒列表
+     */
+    @GetMapping("/list")
+    public TableDataInfo list(TWarehouseAgreement tWarehouseAgreement) {
+        startPage();
+        List<Map<String, Object>> list = tWarehouseAgreementService.selectTWarehouseAgreementList1(tWarehouseAgreement);
+        return getDataTable(list);
+    }
+
+}

+ 1 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/check/TWarehouseCheckItemsController.java

@@ -140,7 +140,7 @@ public class TWarehouseCheckItemsController extends BaseController
         if ("外部用户".equals(user.getDept().getDeptName())) {
             tWarehouseCheckItems.setfInspectorId(user.getUserId());
             if (StringUtils.isEmpty(tWarehouseCheckItems.getInspectionEndDate())) {
-                tWarehouseCheckItems.setInspectionEndDate(DateUtils.lastMonth() + "23:59:59");
+                tWarehouseCheckItems.setInspectionEndDate(DateUtils.offsetMonth(-1) + "23:59:59");
             }
         }
         startPage();

+ 4 - 4
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/reportManagement/TWarehousebillsitemsSummaryController.java

@@ -146,11 +146,11 @@ public class TWarehousebillsitemsSummaryController extends BaseController {
     }
 
     /**
-     * bi大屏当月协议数量
+     * bi大屏协议数量
      */
-    @GetMapping("/biMonthContractCount")
-    public AjaxResult biMonthContractCount() {
-        return AjaxResult.success(itCorpsService.biMonthContractCount());
+    @GetMapping("/biContractCount")
+    public AjaxResult biContractCount() {
+        return AjaxResult.success(itWarehouseAgreementService.biContractCount());
     }
 
     /**

+ 6 - 6
ruoyi-common/src/main/java/com/ruoyi/common/utils/DateUtils.java

@@ -444,12 +444,6 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
         return dateTime(cale.getTime());
     }
 
-    public static String lastMonth() {
-        Calendar cale = Calendar.getInstance();
-        cale.add(Calendar.MONTH, -1);
-        return dateTime(cale.getTime());
-    }
-
     public static String endOfLastMonth() {
         Calendar cale = Calendar.getInstance();
         cale.add(Calendar.MONTH, 0);
@@ -464,6 +458,12 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
         return dateTime(calendar.getTime());
     }
 
+    public static String offsetMonth(int num) {
+        Calendar cale = Calendar.getInstance();
+        cale.add(Calendar.MONTH, num);
+        return dateTime(cale.getTime());
+    }
+
     public static Date todayBegin() {
         Calendar calendar = new GregorianCalendar();
         calendar.set(Calendar.HOUR_OF_DAY, 0);

+ 0 - 7
ruoyi-warehouse/src/main/java/com/ruoyi/basicData/mapper/TCorpsMapper.java

@@ -162,11 +162,4 @@ public interface TCorpsMapper extends BaseMapper<TCorps> {
      */
     public Map<String, Object> biCustomerCount();
 
-    /**
-     * bi大屏当月协议数量
-     *
-     * @return
-     */
-    public Map<String, Object> biMonthContractCount(@Param("beginDate") String beginDate, @Param("endDate") String endDate);
-
 }

+ 0 - 7
ruoyi-warehouse/src/main/java/com/ruoyi/basicData/service/ITCorpsService.java

@@ -121,11 +121,4 @@ public interface ITCorpsService {
      */
     public Map<String, Object> biCustomerCount();
 
-    /**
-     * bi大屏当月协议数量
-     *
-     * @return
-     */
-    public Map<String, Object> biMonthContractCount();
-
 }

+ 0 - 12
ruoyi-warehouse/src/main/java/com/ruoyi/basicData/service/impl/TCorpsServiceImpl.java

@@ -387,16 +387,4 @@ public class TCorpsServiceImpl implements ITCorpsService {
         return tCorpsMapper.biCustomerCount();
     }
 
-    /**
-     * bi大屏当月协议数量
-     *
-     * @return
-     */
-    @Override
-    public Map<String, Object> biMonthContractCount() {
-        String beginDate = DateUtils.beginOfMonth() + " 00:00:00";
-        String endDate = DateUtils.endOfMonth() + "23:59:59";
-        return tCorpsMapper.biMonthContractCount(beginDate, endDate);
-    }
-
 }

+ 24 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/mapper/TWarehouseAgreementMapper.java

@@ -2,6 +2,7 @@ package com.ruoyi.warehouseBusiness.mapper;
 
 
 import com.ruoyi.warehouseBusiness.domain.TWarehouseAgreement;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 import java.util.Map;
@@ -69,4 +70,27 @@ public interface TWarehouseAgreementMapper {
     public int deleteTWarehouseAgreementByIds(Long[] fIds);
 
     List<TWarehouseAgreement> selectTWarehouseAgreementListOrderyByBeginDate(TWarehouseAgreement tWarehouseAgreement);
+
+    /**
+     * 协议提醒
+     *
+     * @param tWarehouseAgreement 仓储费
+     * @return 仓储费集合
+     */
+    public List<Map<String, Object>> agreementRemind(TWarehouseAgreement tWarehouseAgreement);
+
+    /**
+     * bi大屏协议数量
+     *
+     * @return
+     */
+    public Map<String, Object> biContractCount(@Param("beginDate") String beginDate, @Param("endDate") String endDate);
+
+    /**
+     * 仓储协议列表
+     *
+     * @return 仓储费集合
+     */
+    public List<Map<String, Object>> biContractList();
+
 }

+ 23 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/ITWarehouseAgreementService.java

@@ -71,4 +71,27 @@ public interface ITWarehouseAgreementService {
     public int deleteTWarehouseAgreementById(Long fId);
 
     public AjaxResult queryRemove(Long fId);
+
+    /**
+     * 协议提醒
+     *
+     * @param tWarehouseAgreement 仓储费
+     * @return 仓储费集合
+     */
+    public List<Map<String, Object>> agreementRemind(TWarehouseAgreement tWarehouseAgreement);
+
+    /**
+     * bi大屏协议数量
+     *
+     * @return
+     */
+    public Map<String, Object> biContractCount();
+
+    /**
+     * 仓储协议列表
+     *
+     * @return 仓储费集合
+     */
+    public List<Map<String, Object>> biContractList();
+
 }

+ 41 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/impl/TWarehouseAgreementServiceImpl.java

@@ -12,6 +12,7 @@ import com.ruoyi.basicData.mapper.TCorpsMapper;
 import com.ruoyi.basicData.mapper.TFeesMapper;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.domain.model.LoginUser;
+import com.ruoyi.common.exception.BaseException;
 import com.ruoyi.common.exception.WarehouseException;
 import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.common.utils.StringUtils;
@@ -673,4 +674,44 @@ public class TWarehouseAgreementServiceImpl implements ITWarehouseAgreementServi
         return money;
     }
 
+    /**
+     * 协议提醒
+     *
+     * @param tWarehouseAgreement 仓储费
+     * @return 仓储费集合
+     */
+    @Override
+    public List<Map<String, Object>> agreementRemind(TWarehouseAgreement tWarehouseAgreement) {
+        // 从参数里获取通知时间
+        SysConfig sysConfig = sysConfigMapper.checkConfigKeyUnique("data_print_title");
+        if (StringUtils.isNull(sysConfig)) {
+            throw new BaseException("系统参数异常,未找到协议到期提醒时间");
+        }
+        String days = sysConfig.getConfigValue();
+        return tWarehouseAgreementMapper.agreementRemind(tWarehouseAgreement);
+    }
+
+    /**
+     * bi大屏协议数量
+     *
+     * @return
+     */
+    @Override
+    public Map<String, Object> biContractCount() {
+        String beginDate = DateUtils.today() + " 00:00:00";
+        String endDate = DateUtils.offsetMonth(2) + "23:59:59";
+
+        return tWarehouseAgreementMapper.biContractCount(beginDate, endDate);
+    }
+
+    /**
+     * 仓储协议列表
+     *
+     * @return 仓储费集合
+     */
+    @Override
+    public List<Map<String, Object>> biContractList() {
+        return tWarehouseAgreementMapper.biContractList();
+    }
+
 }

+ 0 - 9
ruoyi-warehouse/src/main/resources/mapper/basicData/TCorpsMapper.xml

@@ -464,13 +464,4 @@
         where f_id in (select distinct f_corpid from t_whgenleg where f_qtyD != 0 and f_qtyblc != 0);
     </select>
 
-    <select id="biMonthContractCount" resultType="map">
-        select count(f_id) as customerCount
-        from t_corps
-        where
-            f_typename like '%客户%'
-            <if test="beginDate != null and beginDate != ''">and create_time &gt;= #{beginDate}</if>
-            <if test="endDate != null and endDate != ''">and create_time &lt; #{endDate}</if>
-    </select>
-
 </mapper>

+ 44 - 1
ruoyi-warehouse/src/main/resources/mapper/warehouseBusiness/TWarehouseAgreementMapper.xml

@@ -250,4 +250,47 @@
         </foreach>
     </delete>
 
-</mapper>
+    <select id="agreementRemind" parameterType="TWarehouseAgreement" resultType="Map">
+        select distinct
+            agre.f_id AS fId,
+            agre.f_feetypeid AS fFeetypeid,
+            corp.f_name AS fCorpid,
+            agre.f_contractno AS fContractno,
+            agre.f_begindate AS fBegindate,
+            agre.f_enddate AS fEnddate,
+            agre.create_by AS createBy,
+            agre.create_time AS createTime,
+            agre.remark AS remark
+        from t_warehouse_agreement agre
+        left join t_corps corp on corp.f_id = agre.f_corpid
+        where
+            agre.f_status = '0'
+            and datediff(date_format(agre.f_enddate, '%Y-%m-%d'), date_format(now(), '%Y-%m-%d')) &lt;= 60
+            <if test="value != null  and value != ''">
+                and datediff(date_format(agre.f_enddate, '%Y-%m-%d'), date_format(now(), '%Y-%m-%d')) &lt;= #{value}
+            </if>
+            <if test="fCorpid != null ">and agre.f_corpid = #{fCorpid}</if>
+            <if test="fContractno != null  and fContractno != ''">and agre.f_contractno = #{fContractno}</if>
+            <if test="fBegindate != null ">and agre.f_begindate = #{fBegindate}</if>
+            <if test="fEnddate != null ">and agre.f_enddate = #{fEnddate}</if>
+    </select>
+
+    <select id="biContractCount" resultType="map">
+        select count(f_id) as contractCount
+        from t_warehouse_agreement
+        where f_feetypeid = 0
+            <if test="beginDate != null and beginDate != ''">and f_enddate &gt;= #{beginDate}</if>
+            <if test="endDate != null and endDate != ''">and f_enddate &lt; #{endDate}</if>
+    </select>
+
+    <select id="biContractList" resultType="map">
+        select
+            tc.f_name AS customerName,
+            ta.f_begindate AS beginDate,
+            ta.f_enddate AS endDate
+        from t_warehouse_agreement ta left join t_corps tc on tc.f_id = ta.f_corpid
+        where ta.f_feetypeid = 0
+        order by ta.create_time desc
+    </select>
+
+</mapper>