zhangyuewww 3 anni fa
parent
commit
8d01a698d5

+ 10 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/controller/ExpenseInfoController.java

@@ -105,6 +105,16 @@ public class ExpenseInfoController {
     public List<ExpenseInfo> expenseChart(String compId, int year){
         return expenseInfoService.expenseChart(compId,year);
     }
+    /**
+     * 费用收支一览表
+     *
+     * @param compId
+     * @return
+     */
+    @GetMapping("/expenseList")
+    public List<ExpenseInfo> expenseList(String compId, String startDate, String endDate){
+        return expenseInfoService.expenseList(compId,startDate,endDate);
+    }
 
 }
 

+ 40 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/ExpenseInfo.java

@@ -218,6 +218,46 @@ public class ExpenseInfo extends BaseModel<ExpenseInfo> {
      */
     @TableField(exist = false)
     private String month;
+    /**
+     * 合同费用收入
+     */
+    @TableField(exist = false)
+    private String contractIn;
+    /**
+     * 合同费用支出
+     */
+    @TableField(exist = false)
+    private String contractOut;
+    /**
+     * 经营性收入
+     */
+    @TableField(exist = false)
+    private String managementIn;
+    /**
+     * 经营性支出
+     */
+    @TableField(exist = false)
+    private String managementOut;
+    /**
+     * 库点费用收入
+     */
+    @TableField(exist = false)
+    private String warehouseIn;
+    /**
+     * 库点费用支出
+     */
+    @TableField(exist = false)
+    private String warehouseOut;
+    /**
+     * 贸易利润
+     */
+    @TableField(exist = false)
+    private String profit;
+    /**
+     * 净利润
+     */
+    @TableField(exist = false)
+    private String netProfit;
     /**
      * 开始时间
      */

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

@@ -38,5 +38,12 @@ public interface ExpenseInfoMapper extends BaseMapper<ExpenseInfo> {
      * @return
      */
     List<ExpenseInfo> getExpenseChartListByCondition(Map<String, Object> pageView);
+    /**
+     * 根据条件查询费用收支一览表
+     *
+     * @param pageView
+     * @return
+     */
+    List<ExpenseInfo> getExpenseListByCondition(Map<String, Object> pageView);
 
 }

+ 6 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/IExpenseInfoService.java

@@ -70,4 +70,10 @@ public interface IExpenseInfoService extends IService<ExpenseInfo> {
      * @return
      */
     List<ExpenseInfo> expenseChart(String compId,int year);
+    /**
+     * 费用收支一览表
+     * @param compId
+     * @return
+     */
+    List<ExpenseInfo> expenseList(String compId,String startDate,String endDate);
 }

+ 16 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/ExpenseInfoServiceImpl.java

@@ -336,6 +336,22 @@ public class ExpenseInfoServiceImpl extends ServiceImpl<ExpenseInfoMapper, Expen
         return dataList;
     }
 
+    /**
+     * 费用收支一览表
+     * @param compId
+     * @return
+     */
+    @Override
+    public List<ExpenseInfo> expenseList(String compId, String startDate, String endDate) {
+        Map<String, Object> pageView = new HashMap<>();
+        //  公司ID
+        pageView.put("compId", compId);
+        pageView.put("startDate", startDate);
+        pageView.put("endDate", endDate);
+        List<ExpenseInfo> dataList = baseMapper.getExpenseListByCondition(pageView);
+        return dataList;
+    }
+
     private List<String> getResourceIdList() {
         User currentUser = AuthSecurityUtils.getCurrentUserInfo();
         // 当前登录人主要角色

+ 48 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/resources/mapper/ExpenseInfoMapper.xml

@@ -103,4 +103,52 @@
         ORDER BY
             MONTH ( a.create_date ) ASC
     </select>
+    <!-- 获得费用收支一览表 -->
+    <select id="getExpenseListByCondition" parameterType="Map"
+            resultType="com.yh.saas.plugin.yiliangyiyun.entity.ExpenseInfo">
+        SELECT
+        sum( b.amount_money ) as contractIn,
+        sum( c.amount_money ) as contractOut,
+        sum( d.amount_money ) as managementIn,
+        sum( e.amount_money ) as managementOut,
+        sum( f.amount_money ) as warehouseIn,
+        sum( g.amount_money ) as warehouseOut
+        FROM
+        expense_info a
+        LEFT JOIN expense_info b ON b.id = a.id
+        AND b.delete_flag = 0
+        AND b.expenses_type = '1'
+        AND b.purpose = '合同费用'
+        LEFT JOIN expense_info c ON c.id = a.id
+        AND c.delete_flag = 0
+        AND c.expenses_type = '2'
+        AND c.purpose = '合同费用'
+        LEFT JOIN expense_info d ON d.id = a.id
+        AND d.delete_flag = 0
+        AND d.expenses_type = '1'
+        AND d.purpose = '经营性费用'
+        LEFT JOIN expense_info e ON e.id = a.id
+        AND e.delete_flag = 0
+        AND e.expenses_type = '2'
+        AND e.purpose = '经营性费用'
+        LEFT JOIN expense_info f ON f.id = a.id
+        AND f.delete_flag = 0
+        AND f.expenses_type = '1'
+        AND f.purpose = '库点费用'
+        LEFT JOIN expense_info g ON g.id = a.id
+        AND g.delete_flag = 0
+        AND g.expenses_type = '2'
+        AND g.purpose = '库点费用'
+        WHERE
+        a.delete_flag = 0
+        AND a.comp_id= #{compId}
+        <if test="startDate != null">
+            AND (DATE_FORMAT(a.create_date ,"%Y%m%d") &gt;=
+            DATE_FORMAT(#{startDate},"%Y%m%d"))
+        </if>
+        <if test="endDate != null">
+            AND (DATE_FORMAT(a.create_date ,"%Y%m%d") &lt;=
+            DATE_FORMAT(#{endDate},"%Y%m%d"))
+        </if>
+    </select>
 </mapper>