瀏覽代碼

对账从表字段、客户分析接口

sunhz 3 年之前
父節點
當前提交
6ccec88c41

+ 11 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/warehouseBusiness/TWarehouseInStockController.java

@@ -413,4 +413,15 @@ public class TWarehouseInStockController extends BaseController {
         return itWarehouseBillsService.quickOperation(warehousebillsDTO, loginUser);
     }
 
+
+    @GetMapping("/corpAnalysis")
+    public AjaxResult corpAnalysis() {
+        return itWarehouseBillsService.corpAnalysis();
+    }
+
+    @GetMapping("/inactiveCorpList")
+    public AjaxResult inactiveCorpList(Integer type) {
+        return itWarehouseBillsService.inactiveCorpList(type);
+    }
+
 }

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

@@ -501,4 +501,25 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
         return calendar.getTime();
     }
 
+    public static String getDayOfYear(int type, int year) {
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+        Calendar calendar = Calendar.getInstance();
+        calendar.add(Calendar.YEAR, year);
+        if (type == 0) {
+            return sdf.format(calendar.getTime()) + " 00:00:00";
+        }
+        return sdf.format(calendar.getTime()) + " 23:59:59";
+    }
+
+    public static String getDayOfMonth(int type, int month) {
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+        Calendar calendar = Calendar.getInstance();
+        calendar.add(Calendar.MONTH, month);
+        if (type == 0) {
+            calendar.add(Calendar.DATE, 1);
+            return sdf.format(calendar.getTime()) + " 00:00:00";
+        }
+        return sdf.format(calendar.getTime()) + " 23:59:59";
+    }
+
 }

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

@@ -171,4 +171,6 @@ public interface TCorpsMapper extends BaseMapper<TCorps> {
      */
     public List<Map<String, Object>> biCustomerList(@Param("external") String external);
 
+    public int getCorpCount();
+
 }

+ 27 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/finance/domain/TFeeDo.java

@@ -48,6 +48,11 @@ public class TFeeDo extends BaseEntity {
     private Long fSrcid;
 
     /**
+     * 来源单据编号
+     */
+    private String fSrcBillno;
+
+    /**
      * 来源行号
      */
     @Excel(name = "来源行号")
@@ -111,6 +116,12 @@ public class TFeeDo extends BaseEntity {
      */
     @Excel(name = "备注")
     private String fRemarks;
+
+    /**
+     * 发票号
+     */
+    private String fInvoiceNo;
+
     //币别
     private String fCurrency;
     //汇率
@@ -285,6 +296,22 @@ public class TFeeDo extends BaseEntity {
         return fSrcid;
     }
 
+    public String getfSrcBillno() {
+        return fSrcBillno;
+    }
+
+    public void setfSrcBillno(String fSrcBillno) {
+        this.fSrcBillno = fSrcBillno;
+    }
+
+    public String getfInvoiceNo() {
+        return fInvoiceNo;
+    }
+
+    public void setfInvoiceNo(String fInvoiceNo) {
+        this.fInvoiceNo = fInvoiceNo;
+    }
+
     public void setfSrclineno(Long fSrclineno) {
         this.fSrclineno = fSrclineno;
     }

+ 9 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/finance/domain/TWareHouseFees.java

@@ -99,6 +99,8 @@ public class TWareHouseFees extends BaseEntity {
 
     private Integer groupBy;
 
+    private String fBillno;
+
     //业务类型 1代表凯和
     private Integer fTypeid;
     //系统类型 1 仓储 2 车队 3 凯和
@@ -250,6 +252,13 @@ public class TWareHouseFees extends BaseEntity {
         this.groupBy = groupBy;
     }
 
+    public String getfBillno() {
+        return fBillno;
+    }
+
+    public void setfBillno(String fBillno) {
+        this.fBillno = fBillno;
+    }
 
     /**
      * 查询时间区间 对账日期

+ 11 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/mapper/TWarehouseBillsMapper.java

@@ -316,4 +316,15 @@ public interface TWarehouseBillsMapper extends BaseMapper<TWarehouseBills> {
      * @return
      */
     public List<Map<String, Object>> inAndOutStockList(@Param("external") String external);
+
+    /**
+     * 活跃客户列表
+     */
+    public int getActiveCorpCount(@Param("beginTime") String beginTime, @Param("endTime") String endTime);
+
+    /**
+     * 活跃客户列表
+     */
+    public List<Map<String, Object>> getInactiveCorpList(@Param("beginTime") String beginTime, @Param("endTime") String endTime);
+
 }

+ 13 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/ITWarehouseBillsService.java

@@ -841,4 +841,17 @@ public interface ITWarehouseBillsService {
      */
     public void updateMessage(Long fid);
 
+    /**
+     * 客户分析
+     */
+    AjaxResult corpAnalysis();
+
+    /**
+     * 不活跃客户列表
+     *
+     * @param type 时间周期
+     * @return 列表
+     */
+    AjaxResult inactiveCorpList(Integer type);
+
 }

+ 60 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/impl/TWarehouseBillsServiceImpl.java

@@ -8311,4 +8311,64 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
             });
         }
     }
+
+    @Override
+    public AjaxResult corpAnalysis() {
+        return AjaxResult.success(new HashMap<String, Object>() {{
+            this.put("all", tCorpsMapper.getCorpCount());
+
+            this.put("active", tWarehouseBillsMapper.getActiveCorpCount(DateUtils.getDayOfYear(0, -1), DateUtils.getDayOfYear(1, 0)));
+
+            this.put("series", new ArrayList<Map<String, Object>>() {{
+                this.add(new HashMap<String, Object>() {{
+                    this.put("data", new ArrayList<Map<String, Object>>() {{
+                        this.add(new HashMap<String, Object>() {{
+                            this.put("name", "1-3个月");
+                            this.put("value", tWarehouseBillsMapper.getActiveCorpCount(DateUtils.getDayOfMonth(0, -4), DateUtils.getDayOfMonth(1, -2)));
+                        }});
+                        this.add(new HashMap<String, Object>() {{
+                            this.put("name", "3-6个月");
+                            this.put("value", tWarehouseBillsMapper.getActiveCorpCount(DateUtils.getDayOfMonth(0, -7), DateUtils.getDayOfMonth(1, -4)));
+                        }});
+                        this.add(new HashMap<String, Object>() {{
+                            this.put("name", "6-12个月");
+                            this.put("value", tWarehouseBillsMapper.getActiveCorpCount(DateUtils.getDayOfMonth(0, -13), DateUtils.getDayOfMonth(1, -7)));
+                        }});
+                        this.add(new HashMap<String, Object>() {{
+                            this.put("name", "12-24个月");
+                            this.put("value", tWarehouseBillsMapper.getActiveCorpCount(DateUtils.getDayOfMonth(0, -25), DateUtils.getDayOfMonth(1, -13)));
+                        }});
+                        this.add(new HashMap<String, Object>() {{
+                            this.put("name", "24个月以上");
+                            this.put("value", tWarehouseBillsMapper.getActiveCorpCount(null, DateUtils.getDayOfMonth(1, -25)));
+                        }});
+                    }});
+                }});
+            }});
+        }});
+    }
+
+    @Override
+    public AjaxResult inactiveCorpList(Integer type) {
+        String beginTime = null;
+        String endTime;
+        if (type == 1) {
+            beginTime = DateUtils.getDayOfMonth(0, -4);
+            endTime = DateUtils.getDayOfMonth(0, -2);
+        } else if (type == 2) {
+            beginTime = DateUtils.getDayOfMonth(0, -7);
+            endTime = DateUtils.getDayOfMonth(0, -4);
+        } else if (type == 3) {
+            beginTime = DateUtils.getDayOfMonth(0, -13);
+            endTime = DateUtils.getDayOfMonth(0, -7);
+        } else if (type == 4) {
+            beginTime = DateUtils.getDayOfMonth(0, -25);
+            endTime = DateUtils.getDayOfMonth(0, -13);
+        } else {
+            endTime = DateUtils.getDayOfMonth(0, -25);
+        }
+        return AjaxResult.success(tWarehouseBillsMapper.getInactiveCorpList(beginTime, endTime));
+    }
+
+
 }

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

@@ -481,4 +481,8 @@
         order by convert(f_name using gbk)
     </select>
 
+    <select id="getCorpCount" resultType="int">
+        select count(f_id) from t_corps where f_typename like '%客户%'
+    </select>
+
 </mapper>

+ 13 - 1
ruoyi-warehouse/src/main/resources/mapper/finance/TFeeDoMapper.xml

@@ -10,6 +10,8 @@
         <result property="fActId" column="f_act_id"/>
         <result property="fLineno" column="f_lineno"/>
         <result property="fSrcid" column="f_srcid"/>
+        <result property="fSrcBillno" column="f_src_billno"/>
+        <result property="fInvoiceNo" column="f_invoice_no"/>
         <result property="fSrclineno" column="f_srclineno"/>
         <result property="fSrcpid" column="f_srcpid"/>
         <result property="fSrcdc" column="f_srcdc"/>
@@ -28,7 +30,7 @@
     </resultMap>
 
     <sql id="selectTFeeDoVo">
-        select f_id, f_pid, f_act_id, f_lineno, f_srcid, f_srclineno, f_srcpid, f_srcdc, f_feeid, f_amtdr, f_amt, f_status, del_flag, create_by, f_amt_stl, create_time, f_amt_blc, update_by, update_time, f_remarks from t_fee_do
+        select f_id, f_pid, f_act_id, f_lineno, f_srcid, f_src_billno, f_invoice_no, f_srclineno, f_srcpid, f_srcdc, f_feeid, f_amtdr, f_amt, f_status, del_flag, create_by, f_amt_stl, create_time, f_amt_blc, update_by, update_time, f_remarks from t_fee_do
     </sql>
 
     <select id="selectTFeeDoList" parameterType="TFeeDo" resultMap="TFeeDoResult">
@@ -38,6 +40,8 @@
             <if test="fActId != null ">and f_act_id = #{fActId}</if>
             <if test="fLineno != null ">and f_lineno = #{fLineno}</if>
             <if test="fSrcid != null ">and f_srcid = #{fSrcid}</if>
+            <if test="fSrcBillno != null ">and f_src_billno = #{fSrcBillno}</if>
+            <if test="fInvoiceNo != null ">and f_invoice_no = #{fInvoiceNo}</if>
             <if test="fSrclineno != null ">and f_srclineno = #{fSrclineno}</if>
             <if test="fSrcpid != null ">and f_srcpid = #{fSrcpid}</if>
             <if test="fSrcdc != null  and fSrcdc != ''">and f_srcdc = #{fSrcdc}</if>
@@ -62,6 +66,8 @@
             td.f_act_id,
             td.f_lineno,
             td.f_srcid,
+            td.f_src_billno,
+            td.f_invoice_no,
             td.f_srclineno,
             td.f_srcpid,
             td.f_srcdc,
@@ -122,6 +128,8 @@
             <if test="fActId != null">f_act_id,</if>
             <if test="fLineno != null">f_lineno,</if>
             <if test="fSrcid != null">f_srcid,</if>
+            <if test="fSrcBillno != null ">f_src_billno,</if>
+            <if test="fInvoiceNo != null ">f_invoice_no,</if>
             <if test="fSrclineno != null">f_srclineno,</if>
             <if test="fSrcpid != null">f_srcpid,</if>
             <if test="fSrcdc != null">f_srcdc,</if>
@@ -144,6 +152,8 @@
             <if test="fActId != null">#{fActId},</if>
             <if test="fLineno != null">#{fLineno},</if>
             <if test="fSrcid != null">#{fSrcid},</if>
+            <if test="fSrcBillno != null ">#{fSrcBillno},</if>
+            <if test="fInvoiceNo != null ">#{fInvoiceNo},</if>
             <if test="fSrclineno != null">#{fSrclineno},</if>
             <if test="fSrcpid != null">#{fSrcpid},</if>
             <if test="fSrcdc != null">#{fSrcdc},</if>
@@ -169,6 +179,8 @@
             <if test="fActId != null">f_act_id = #{fActId},</if>
             <if test="fLineno != null">f_lineno = #{fLineno},</if>
             <if test="fSrcid != null">f_srcid = #{fSrcid},</if>
+            <if test="fSrcBillno != null ">f_src_billno = #{fSrcBillno},</if>
+            <if test="fInvoiceNo != null ">f_invoice_no = #{fInvoiceNo},</if>
             <if test="fSrclineno != null">f_srclineno = #{fSrclineno},</if>
             <if test="fSrcpid != null">f_srcpid = #{fSrcpid},</if>
             <if test="fSrcdc != null">f_srcdc = #{fSrcdc},</if>

+ 4 - 0
ruoyi-warehouse/src/main/resources/mapper/finance/TFeeMapper.xml

@@ -1242,6 +1242,7 @@
         c.f_name AS fName,
         c.f_name AS fFeesName,
         t.f_bscorpno AS fBscorpno,
+        t.f_billno AS fBillno,
         w.f_mblno AS fMblno,
         w.f_product_name AS fProductName,
         w.f_bsdate AS fBsdate,
@@ -1288,6 +1289,9 @@
             <if test="map.tWareHouseFees.fToCorpid != null  and map.tWareHouseFees.fToCorpid != ''">and w.f_corpid =
                 #{map.tWareHouseFees.fToCorpid}
             </if>
+            <if test="map.tWareHouseFees.fBillno != null  and map.tWareHouseFees.fBillno != ''">and t.f_billno =
+                #{map.tWareHouseFees.fBillno}
+            </if>
             <if test="map.tWareHouseFees.fMblno != null  and map.tWareHouseFees.fMblno != ''">and w.f_mblno like
                 concat('%', #{map.tWareHouseFees.fMblno}, '%')
             </if>

+ 33 - 0
ruoyi-warehouse/src/main/resources/mapper/warehouseBusiness/TWarehousebillsMapper.xml

@@ -3143,4 +3143,37 @@
             </if>
         order by tb.f_bsdate desc
     </select>
+
+    <select id="getActiveCorpCount" resultType="int">
+        select count(fName) from (
+            select t1.f_bsdate as fBsdate, t3.f_name as fName
+            from t_warehousebillsitems t1
+                left join t_warehousebills t2 on t2.f_id = t1.f_pid
+                left join t_corps t3 on t3.f_id = t2.f_corpid
+            where t1.f_billtype = 'SJRK'
+                and t1.f_billstatus = 40
+            group by fName
+        ) temp
+        <where>
+            <if test="beginTime != null and beginTime != ''">and fBsdate &gt;= #{beginTime}</if>
+            <if test="endTime != null and endTime != ''">and fBsdate &lt;= #{endTime}</if>
+        </where>
+    </select>
+
+    <select id="getInactiveCorpList" resultType="map">
+        select * from (
+            select t1.f_bsdate as fBsdate, t3.f_name as fName
+            from t_warehousebillsitems t1
+                left join t_warehousebills t2 on t2.f_id = t1.f_pid
+                left join t_corps t3 on t3.f_id = t2.f_corpid
+            where t1.f_billtype = 'SJRK'
+                and t1.f_billstatus = 40
+            group by fName
+        ) temp
+        <where>
+            <if test="beginTime != null and beginTime != ''">and fBsdate &gt;= #{beginTime}</if>
+            <if test="endTime != null and endTime != ''">and fBsdate &lt;= #{endTime}</if>
+        </where>
+        order by fBsdate desc
+    </select>
 </mapper>