gongdecai 3 lat temu
rodzic
commit
6973e0adcd

+ 3 - 2
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/controller/BiInfoController.java

@@ -61,6 +61,8 @@ public class BiInfoController {
     private IWarehouseBaseInfoService warehouseBaseInfoService;
     @Autowired
     private IWeighingManagementService weighingManagementService;
+    @Autowired
+    private IStockSaleReceiptReportService stockSaleReceiptReportService;
     private String companyId;
 
     /**
@@ -166,8 +168,7 @@ public class BiInfoController {
      */
     private List<BiViewInfo> getMoney(List<BiViewInfo> biViewInfos,String seachMoth) {
 
-
-        return biViewInfos;
+        return stockSaleReceiptReportService.getMoney(biViewInfos, seachMoth);
     }
 
     /**

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

@@ -32,4 +32,8 @@ public interface StockSaleReceiptReportMapper extends BaseMapper<StockSaleReceip
      * @return
      */
     List<StockSaleReceiptReport> getListByCondition(Map<String, Object> pageView);
+
+    String getAmonutIn(Map<String, Object> pageView);
+    String getAmonutOut(Map<String, Object> pageView);
+    String getAmonutMao(Map<String, Object> pageView);
 }

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

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.plugins.Page;
 import com.yh.saas.plugin.yiliangyiyun.entity.ContractManagementInfo;
 import com.yh.saas.plugin.yiliangyiyun.entity.StockSaleReceiptReport;
 import com.baomidou.mybatisplus.service.IService;
+import com.yh.saas.plugin.yiliangyiyun.entity.view.BiViewInfo;
 
 import java.util.List;
 
@@ -59,4 +60,10 @@ public interface IStockSaleReceiptReportService extends IService<StockSaleReceip
      * @param stockSaleReceiptReport
      */
     String openInvoiceList(StockSaleReceiptReport stockSaleReceiptReport);
+
+
+    /**
+     * 统计
+     */
+    List<BiViewInfo> getMoney(List<BiViewInfo> biViewInfos, String seachMoth);
 }

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

@@ -11,6 +11,7 @@ import com.winsea.svc.base.security.entity.User;
 import com.winsea.svc.base.security.util.AuthSecurityUtils;
 import com.yh.saas.plugin.yiliangyiyun.constant.StatusEnum;
 import com.yh.saas.plugin.yiliangyiyun.entity.*;
+import com.yh.saas.plugin.yiliangyiyun.entity.view.BiViewInfo;
 import com.yh.saas.plugin.yiliangyiyun.mapper.StockSaleReceiptReportMapper;
 import com.yh.saas.plugin.yiliangyiyun.service.*;
 import com.baomidou.mybatisplus.service.impl.ServiceImpl;
@@ -20,6 +21,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
 
+import java.text.DecimalFormat;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -363,4 +365,45 @@ public class StockSaleReceiptReportServiceImpl extends ServiceImpl<StockSaleRece
         return roleResourceService.getBindResourcesByUserId(currentUser.getUserId()).stream()
                 .map(CommonRoleResource::getResourceId).collect(Collectors.toList());
     }
+
+
+
+
+
+    /**
+     * 获取收入、支出、毛利润
+     *
+     * @return
+     */
+    @Override
+    public List<BiViewInfo> getMoney(List<BiViewInfo> biViewInfos, String seachMoth) {
+        Map<String, Object> pageView = new HashMap<>();
+        pageView.put("seachMoth",seachMoth);
+        pageView.put("compId", AuthSecurityUtils.getCurrentUserInfo().getCompId());
+        String  amonutIn = baseMapper.getAmonutIn(pageView);
+        String  amonutout = baseMapper.getAmonutOut(pageView);
+        String  amonutMao = baseMapper.getAmonutMao(pageView);
+        DecimalFormat df = new DecimalFormat("#.00");
+        BiViewInfo biViewInfo = new BiViewInfo();
+        BiViewInfo biViewInfo1 = new BiViewInfo();
+        BiViewInfo biViewInfo2 = new BiViewInfo();
+        BiViewInfo biViewInfo3 = new BiViewInfo();
+        biViewInfo1.setName("毛利润");
+        biViewInfo1.setCount(df.format(amonutMao));
+        biViewInfo2.setName("收入");
+        biViewInfo2.setCount(df.format(amonutIn));
+        biViewInfo3.setName("支出");
+        biViewInfo3.setCount(df.format(amonutout));
+        List<BiViewInfo> biViewInfoList = new ArrayList<>();
+        biViewInfoList.add(biViewInfo1);
+        biViewInfoList.add(biViewInfo2);
+        biViewInfoList.add(biViewInfo3);
+        biViewInfo.setBiType("利润");
+        biViewInfo.setBiViewInfoList(biViewInfoList);
+        biViewInfos.add(biViewInfo);
+
+
+        return biViewInfos;
+    }
+
 }

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

@@ -62,7 +62,7 @@
         collection_screenshot as collectionScreenshot,
         collection_date as collectionDate,
         already_invoice as alreadyInvoice,
-        warehouse_name  as warehouseName,
+        warehouse_name as warehouseName,
         status,
         approve_status as approveStatus,
         status_flag as statusFlag,
@@ -101,4 +101,82 @@
             LIMIT ${startRecord}, ${pageSize}
         </if>
     </select>
+
+
+    <select id="getAmonutIn" parameterType="Map"
+            resultType="java.lang.String">
+       SELECT
+	sum(amount_ing_receivable) as amount
+FROM
+	stock_sale_receipt_report s
+WHERE
+	s.delete_flag = 0
+	AND s.comp_id = #{compId}
+	AND s.delivery_date like CONCAT('%',#{seachMoth},'%')
+    </select>
+
+    <select id="getAmonutOut" parameterType="Map"
+            resultType="java.lang.String">
+       SELECT
+	IFNULL( sum( s.amount_ing_payable ), 0 ) + IFNULL((
+		SELECT
+			sum( p.amount_ing_payable )
+		FROM
+			payment_management p
+		WHERE
+			p.delete_flag = 0
+			AND p.comp_id = #{compId}
+			AND p.create_date like CONCAT('%',#{seachMoth},'%')
+			),
+		0
+		) + IFNULL((
+		SELECT
+			sum( amount )
+		FROM
+			inventory_cost_info i
+		WHERE
+			i.delete_flag = 0
+			AND i.comp_id = #{compId}
+			AND i.create_date like CONCAT('%',#{seachMoth},'%')
+		),
+		0
+	)
+	+ IFNULL((
+		SELECT
+			sum( sale_cost )
+		FROM
+			stock_sale_receipt_report s
+		WHERE
+			s.delete_flag = 0
+			AND s.comp_id = #{compId}
+			AND s.delivery_date like CONCAT('%',#{seachMoth},'%')
+		),
+		0
+	)  as aa
+FROM
+	stock_purchase_receipt_report s
+WHERE
+	s.delete_flag = 0
+	AND s.comp_id = #{compId}
+	AND s.warehousing_date like CONCAT('%',#{seachMoth},'%')
+    </select>
+
+
+    <select id="getAmonutMao" parameterType="Map"
+            resultType="java.lang.String">
+      SELECT
+	sum(
+	a.amount_ing_receivable - IFNULL( IFNULL( a.cost, w.cost ), 0 )* a.net_weight - IFNULL( a.sale_cost, 0 )) AS lirun
+FROM
+	stock_sale_receipt_report a
+	LEFT JOIN warehouse_cost w ON w.comp_id = a.comp_id
+	AND w.delete_flag = 0
+	AND w.warehouse_name = a.warehouse_name
+	AND w.calculate_date = DATE_SUB( a.delivery_date, INTERVAL 1 DAY )
+WHERE
+	1 = 1
+	AND a.delete_flag = 0
+		AND a.delivery_date like CONCAT('%',#{seachMoth},'%')
+    </select>
+
 </mapper>