Browse Source

杰生重构

home 2 years ago
parent
commit
a56e3c68e2

+ 2 - 0
hx-service/storage-restructure/src/main/java/com/fjhx/controller/contract/ContractDetailsController.java

@@ -20,4 +20,6 @@ public class ContractDetailsController {
     @Autowired
     private ContractDetailsService contractDetailsService;
 
+
+
 }

+ 2 - 0
hx-service/storage-restructure/src/main/java/com/fjhx/controller/contract/ContractPayController.java

@@ -95,5 +95,7 @@ public class ContractPayController {
     }
 
 
+
+
 }
 

+ 13 - 3
hx-service/storage-restructure/src/main/java/com/fjhx/controller/water/WaterDetailController.java

@@ -1,8 +1,6 @@
 package com.fjhx.controller.water;
 
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.fjhx.entity.water.WaterDetail;
-import com.fjhx.params.water.WaterDetailVo;
+import com.fjhx.base.Condition;
 import com.fjhx.service.water.WaterDetailService;
 import org.springblade.core.tool.api.R;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -11,6 +9,7 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -28,5 +27,16 @@ public class WaterDetailController {
     @Autowired
     private WaterDetailService waterDetailService;
 
+    /**
+     * 根据申购单id获取入库明细
+     * TODO
+     */
+    @PostMapping("/getInQuantityByApplyPurchaseId")
+    public R getInQuantityByApplyPurchaseDetailsId(@RequestBody Condition condition) {
+        List<Map<String, Object>> result = waterDetailService.getInQuantityByApplyPurchaseDetailsId(condition);
+        return R.success(result);
+    }
+
+
 }
 

+ 1 - 0
hx-service/storage-restructure/src/main/java/com/fjhx/mapper/contract/ContractPayMapper.xml

@@ -23,6 +23,7 @@
                cd.quantity,
                cd.price,
                cd.apply_purchase_id                                                    applyPurchaseId,
+               cd.apply_purchase_details_id                                            applyPurchaseDetailsId,
                c.amount_money                                                          amountMoney,
                c.adjust_amount                                                         adjustAmount,
                c.had_pay_amount                                                        hadPayAmount,

+ 6 - 0
hx-service/storage-restructure/src/main/java/com/fjhx/mapper/water/WaterDetailMapper.java

@@ -2,6 +2,10 @@ package com.fjhx.mapper.water;
 
 import com.fjhx.entity.water.WaterDetail;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+import java.util.Map;
 
 /**
  * <p>
@@ -13,4 +17,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface WaterDetailMapper extends BaseMapper<WaterDetail> {
 
+    List<Map<String, Object>> getInQuantityByApplyPurchaseDetailsId(@Param("applyPurchaseDetailsId") Long applyPurchaseDetailsId);
+
 }

+ 10 - 0
hx-service/storage-restructure/src/main/java/com/fjhx/mapper/water/WaterDetailMapper.xml

@@ -2,4 +2,14 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.fjhx.mapper.water.WaterDetailMapper">
 
+    <select id="getInQuantityByApplyPurchaseDetailsId" resultType="java.util.Map">
+        select sum(wd.quantity)    quantity,
+               min(wd.create_time) createTime,
+               wd.oper_user_id     operUserId
+        from water_batch wb
+                 inner join water_detail wd on wb.id = wd.water_batch_id and wd.type = 10
+        where wb.apply_purchase_details_id = #{applyPurchaseDetailsId}
+        group by wb.id
+    </select>
+
 </mapper>

+ 4 - 0
hx-service/storage-restructure/src/main/java/com/fjhx/service/water/WaterDetailService.java

@@ -1,11 +1,13 @@
 package com.fjhx.service.water;
 
+import com.fjhx.base.Condition;
 import com.fjhx.entity.water.WaterDetail;
 import com.fjhx.entity.water.WaterTag;
 import com.fjhx.base.StorageBaseService;
 import com.fjhx.params.water.WaterVo;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * <p>
@@ -19,4 +21,6 @@ public interface WaterDetailService extends StorageBaseService<WaterDetail> {
 
     void add(WaterVo waterVo, List<WaterTag> waterTagList);
 
+    List<Map<String, Object>> getInQuantityByApplyPurchaseDetailsId(Condition condition);
+
 }

+ 18 - 0
hx-service/storage-restructure/src/main/java/com/fjhx/service/water/impl/WaterDetailServiceImpl.java

@@ -1,15 +1,19 @@
 package com.fjhx.service.water.impl;
 
+import cn.hutool.core.convert.Convert;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fjhx.base.Condition;
 import com.fjhx.entity.water.WaterDetail;
 import com.fjhx.entity.water.WaterTag;
 import com.fjhx.mapper.water.WaterDetailMapper;
 import com.fjhx.params.water.WaterVo;
 import com.fjhx.service.water.WaterDetailService;
+import com.fjhx.utils.UserClientUtil;
 import org.springframework.stereotype.Service;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
 
 /**
  * <p>
@@ -46,4 +50,18 @@ public class WaterDetailServiceImpl extends ServiceImpl<WaterDetailMapper, Water
         saveBatch(waterDetailList);
     }
 
+    @Override
+    public List<Map<String, Object>> getInQuantityByApplyPurchaseDetailsId(Condition condition) {
+        Long applyPurchaseDetailsId = condition.getLong("applyPurchaseDetailsId");
+        List<Map<String, Object>> list = baseMapper.getInQuantityByApplyPurchaseDetailsId(applyPurchaseDetailsId);
+
+        Map<Long, String> userMap = UserClientUtil.getUserNameMapFunctionLong(list, item -> Convert.toLong(item.get("operUserId")));
+
+        for (Map<String, Object> map : list) {
+            map.put("operUserName", userMap.get(Convert.toLong(map.get("operUserId"))));
+        }
+
+        return list;
+    }
+
 }