Browse Source

问题修改

xiaochen 2 years ago
parent
commit
3a9ff0e2b7

+ 12 - 0
src/main/java/com/tld/controller/QueryListController.java

@@ -281,6 +281,18 @@ public class QueryListController {
     public Map<String, Object> getProcurementScreen(ReceiveGoods receiveGoods){
         return queryListService.getProcurementScreen(receiveGoods);
     }
+    
+    /** 
+    * @Description: 首页展示内容
+    * @Param: receiveGoods 参数
+    * @return: 返回结果
+    * @Author: XiaoChen
+    * @Date: 2023/5/4
+    */
+    @GetMapping("getDisplayContent")
+    public Map<String, Object> getDisplayContent(ReceiveGoods receiveGoods){
+        return queryListService.getDisplayContent(receiveGoods);
+    }
 
 }
 

+ 3 - 0
src/main/java/com/tld/mapper/ErrorMapper.java

@@ -16,4 +16,7 @@ public interface ErrorMapper {
     void delError(String id);
 
     void updateError(String id);
+
+    Integer getErrorListAmount(Error error);
+
 }

+ 2 - 0
src/main/java/com/tld/service/QueryListService.java

@@ -61,4 +61,6 @@ public interface QueryListService {
     Map<String, Object> getProcurementScreen(ReceiveGoods receiveGoods);
 
     Map<String, Object> reserveWarningNotToken(Inventory inventory);
+
+    Map<String, Object> getDisplayContent(ReceiveGoods receiveGoods);
 }

+ 44 - 0
src/main/java/com/tld/service/impl/QueryListServiceImpl.java

@@ -729,4 +729,48 @@ public class QueryListServiceImpl implements QueryListService {
         }
         return map;
     }
+
+    /**
+     * @Description: 首页展示内容
+     * @Param: receiveGoods 参数
+     * @return: 返回结果
+     * @Author: XiaoChen
+     * @Date: 2023/5/4
+     */
+    @Override
+    public Map<String, Object> getDisplayContent(ReceiveGoods receiveGoods) {
+        Map<String, Object> map = new HashMap<>();
+        try{
+            Map<String, Object> map1 = new HashMap<>();
+            Inventory inventory = new Inventory();
+            //查询呆滞品总数量
+            Integer deadStockAmount = 0 ;
+            List<Map<String, Object>> deadStock  = queryListMapper.dullGoods(inventory);
+            for (Map<String, Object> stringObjectMap : deadStock) {
+                Object amount = stringObjectMap.get("amount");
+                deadStockAmount = deadStockAmount + Double.valueOf( amount.toString() ).intValue();
+            }
+            //查询库存预警总数量
+            Integer earlyWarningAmount = 0 ;
+            List<Map<String, Object>> earlyWarning = queryListMapper.reserveWarnings(inventory);
+            for (Map<String, Object> stringObjectMap : earlyWarning) {
+                Object amount = stringObjectMap.get("amount");
+                earlyWarningAmount = earlyWarningAmount + Double.valueOf(amount.toString()).intValue() ;
+            }
+            //gs错误总数量
+            Error error = new Error();
+            error.setTransmissionType("1");
+            Integer  ErrorListAmount = errorMapper.getErrorListAmount(error);
+            map1.put("deadStockAmount",deadStockAmount);//呆滞品总数量
+            map1.put("earlyWarningAmount",earlyWarningAmount);//库存预警总数量
+            map1.put("ErrorListAmount",ErrorListAmount);//库存预警总数量
+            map.put("data", map1);
+            map.put("msg", "200");
+        } catch (Exception e){
+            e.printStackTrace();
+            map.put("msg", "500");
+            map.put("errMsg", "服务器请求异常,请稍后再试");
+        }
+        return map;
+    }
 }

+ 4 - 0
src/main/resources/mapper/ErrorMapper.xml

@@ -78,6 +78,10 @@
         </trim>
         ORDER BY scrq DESC
     </select>
+    <!--查询gs错误条数-->
+    <select id="getErrorListAmount" resultType="java.lang.Integer">
+        select COUNT(*) from tld_error where transmission_type = '1'
+    </select>
 
     <delete id="delError">
         delete from tld_error where id = #{id}