瀏覽代碼

杰生重构

home 2 年之前
父節點
當前提交
411553f235

+ 1 - 0
hx-common/common-client-util/src/main/java/com/fjhx/utils/UserClientUtil.java

@@ -75,6 +75,7 @@ public class UserClientUtil {
      * 赋值用户名称
      */
     public static void setUserName(List<Map<String, Object>> mapList, String getUserIdStr, String setUserNameStr) {
+        if (mapList.size() == 0) return;
         Map<Long, String> userNameMap = UserClientUtil.getUserNameMap(mapList, item -> item.get(getUserIdStr));
         for (Map<String, Object> item : mapList) {
             item.put(setUserNameStr, userNameMap.get(Convert.toLong(item.get(getUserIdStr))));

+ 4 - 9
hx-service-api/storage-restructure-api/src/main/java/com/fjhx/entity/check/CheckInfo.java

@@ -1,14 +1,14 @@
 package com.fjhx.entity.check;
 
-import java.util.Date;
-
 import com.baomidou.mybatisplus.annotation.FieldFill;
-import com.fjhx.base.StorageBaseEntity;
-import com.baomidou.mybatisplus.annotation.TableLogic;
 import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.fjhx.base.StorageBaseEntity;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
+import java.util.Date;
+
 /**
  * <p>
  * 盘点
@@ -43,11 +43,6 @@ public class CheckInfo extends StorageBaseEntity {
     private Integer peopleCheckResult;
 
     /**
-     * 发起人id
-     */
-    private Long taskUserId;
-
-    /**
      * 操作人id
      */
     private Long operUserId;

+ 2 - 4
hx-service-api/storage-restructure-api/src/main/java/com/fjhx/entity/check/CheckTag.java

@@ -1,9 +1,7 @@
 package com.fjhx.entity.check;
 
 import java.math.BigDecimal;
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.Version;
-import com.baomidou.mybatisplus.annotation.TableId;
+
 import com.baomidou.mybatisplus.annotation.FieldFill;
 import com.fjhx.base.StorageBaseEntity;
 import com.baomidou.mybatisplus.annotation.TableLogic;
@@ -32,7 +30,7 @@ public class CheckTag extends StorageBaseEntity {
     /**
      * 标签id
      */
-    private Long stockTagId;
+    private Long waterTagId;
 
     /**
      * 物料数量

+ 99 - 1
hx-service/storage-restructure/src/main/java/com/fjhx/controller/check/CheckController.java

@@ -46,12 +46,110 @@ public class CheckController {
         return R.success(result);
     }
 
-
     @PostMapping("/submit")
     public R submit(@RequestBody CheckDetailVo checkDetailVo) {
         checkInfoService.submit(checkDetailVo);
         return R.success();
     }
 
+    /**
+     * 库存管理盘点记录 月统计
+     */
+    @PostMapping("monthlyStatistics")
+    public R monthlyStatistics(@RequestBody Condition condition) {
+        Map<String, Object> result = checkInfoService.monthlyStatistics(condition);
+        return R.success(result);
+    }
+
+    /**
+     * 库存管理盘点记录 月统计
+     */
+    @PostMapping("count")
+    public R count(@RequestBody Condition condition) {
+        Long count = checkInfoService.getCount(condition);
+        return R.success(count);
+    }
+
+    /**
+     * 库存管理盘点记录 按仓库统计盘点次数
+     */
+    @PostMapping("houseCount")
+    public R houseCount(@RequestBody Condition condition) {
+        List<Map<String, Object>> result = checkInfoService.houseCount(condition);
+        return R.success(result);
+    }
+
+    /**
+     * 库存管理盘点记录 按盘点类型统计盘点次数
+     */
+    @PostMapping("typeCount")
+    public R typeCount(@RequestBody Condition condition) {
+        Map<String, Object> result = checkInfoService.typeCount(condition);
+        return R.success(result);
+    }
+
+    /**
+     * 库存管理盘点记录 按盘点结果统计盘点次数
+     */
+    @PostMapping("peopleCheckResultCount")
+    public R peopleCheckResultCount(@RequestBody Condition condition) {
+        Map<String, Object> result = checkInfoService.peopleCheckResultCount(condition);
+        return R.success(result);
+    }
+
+    /**
+     * 库存管理盘点记录 分页
+     */
+    @PostMapping("webPage")
+    public R webPage(@RequestBody Condition condition) {
+        Page<Map<String, Object>> result = checkInfoService.webPage(condition);
+        return R.success(result);
+    }
+
+    /**
+     * 库存管理盘点记录 按盘点人统计盘点次数
+     */
+    @PostMapping("userCount")
+    public R userCount(@RequestBody Condition condition) {
+        List<Map<String, Object>> result = checkInfoService.userCount(condition);
+        return R.success(result);
+    }
+
+    /**
+     * 库存管理盘点记录 异常标签工艺类型统计
+     */
+    @PostMapping("errorTagTechnologyTypeCount")
+    public R errorTagTechnologyTypeCount(@RequestBody Condition condition) {
+        List<Map<String, Object>> result = checkInfoService.errorTagTechnologyTypeCount(condition);
+        return R.success(result);
+    }
+
+    /**
+     * 库存管理盘点记录 异常标签用途统计
+     */
+    @PostMapping("errorTagPurposeCount")
+    public R errorTagPurposeCount(@RequestBody Condition condition) {
+        List<Map<String, Object>> result = checkInfoService.errorTagPurposeCount(condition);
+        return R.success(result);
+    }
+
+    /**
+     * 库存管理盘点记录 异常标签处理类型统计
+     */
+    @PostMapping("errorTagHandleTypeCount")
+    public R errorTagHandleTypeCount(@RequestBody Condition condition) {
+        List<Map<String, Object>> result = checkInfoService.errorTagHandleTypeCount(condition);
+        return R.success(result);
+    }
+
+    /**
+     * 库存管理盘点记录 异常标签处理类型统计
+     */
+    @PostMapping("errorTagPage")
+    public R errorTagPage(@RequestBody Condition condition) {
+        Page<Map<String, Object>> result = checkInfoService.errorTagPage(condition);
+        return R.success(result);
+    }
+
 }
 

+ 15 - 0
hx-service/storage-restructure/src/main/java/com/fjhx/mapper/check/CheckInfoMapper.java

@@ -6,6 +6,7 @@ import com.fjhx.entity.check.CheckInfo;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Param;
 
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -20,4 +21,18 @@ public interface CheckInfoMapper extends BaseMapper<CheckInfo> {
 
     Page<Map<String, Object>> getPage(@Param("page") Page<Object> page, @Param("ew") QueryWrapper<Object> wrapper);
 
+    Map<String, Object> monthlyStatistics(@Param("ew") QueryWrapper<Object> wrapper);
+
+    List<Map<String, Object>> houseCount(@Param("ew") QueryWrapper<Object> wrapper);
+
+    Page<Map<String, Object>> webPage(@Param("page") Page<Object> page, @Param("ew") QueryWrapper<Object> wrapper);
+
+    List<Map<String, Object>> errorTagTechnologyTypeCount(@Param("ew") QueryWrapper<Object> wrapper);
+
+    List<Map<String, Object>> errorTagPurposeCount(@Param("ew") QueryWrapper<Object> wrapper);
+
+    List<Map<String, Object>> errorTagHandleTypeCount(@Param("ew") QueryWrapper<Object> wrapper);
+
+    Page<Map<String, Object>> errorTagPage(@Param("page") Page<Object> page, @Param("ew") QueryWrapper<Object> wrapper);
+
 }

+ 105 - 0
hx-service/storage-restructure/src/main/java/com/fjhx/mapper/check/CheckInfoMapper.xml

@@ -14,9 +14,114 @@
                cd.stock_house_id,
                cd.material_id
         from check_detail cd
+                 left join check_info ci on ci.id = cd.check_id
                  left join material m on cd.material_id = m.id
                  left join stock_house sh on cd.stock_house_id = sh.id
             ${ew.customSqlSegment}
     </select>
 
+    <select id="monthlyStatistics" resultType="java.util.LinkedHashMap">
+        select ifnull(sum(if(ci.type = 1, 1, 0)), 0)          automaticCheckCount,
+               ifnull(sum(if(ci.type = 2, 1, 0)), 0)          userCheckCount,
+               ifnull(sum(distinct ci.oper_user_id), 0)       checkUserCount,
+               ifnull(sum(if(ct.tag_status = 0, 1, 0)), 0)    normalTagCount,
+               ifnull(sum(if(ct.tag_status &gt; 0, 1, 0)), 0) errorTagCount,
+               (select count(distinct cd2.material_id)
+                from check_info ci2
+                         inner join check_detail cd2 ON ci2.id = cd2.check_id
+                where cd2.check_result = 1)                   normalMaterialCount,
+               (select count(distinct cd2.material_id)
+                from check_info ci2
+                         inner join check_detail cd2 ON ci2.id = cd2.check_id
+                where cd2.check_result = 0)                   errorMaterialCount,
+               ifnull(sum(wt.price * wt.quantity), 0)         money
+        from check_info ci
+                 left join check_detail cd on ci.id = cd.check_id
+                 left join check_tag ct on cd.id = ct.check_detail_id
+                 left join water_tag wt on ct.water_tag_id = wt.id
+            ${ew.customSqlSegment}
+    </select>
+
+    <select id="houseCount" resultType="java.util.Map">
+        select sh.id               houseId,
+               sh.name             houseName,
+               ifnull(ci.count, 0) count
+        from stock_house sh
+                 left join (
+            select ci.stock_house_id,
+                   count(0) count
+            from check_info ci
+                ${ew.customSqlSegment}
+        ) ci on sh.id = ci.stock_house_id
+    </select>
+
+    <select id="webPage" resultType="java.util.LinkedHashMap">
+        select ci.id,
+               ci.create_time,
+               ci.begin_time,
+               ci.type,
+               sh.name                               houseName,
+               if(ci.check_result = 1, 3, ci.status) status,
+               ci.people_check_result,
+               ci.end_time,
+               ci.oper_user_id
+        from check_info ci
+                 left join stock_house sh on sh.id = ci.stock_house_id
+            ${ew.customSqlSegment}
+    </select>
+
+    <select id="errorTagTechnologyTypeCount" resultType="java.util.Map">
+        select m.technology_type,
+               count(0) count
+        from check_info ci
+                 inner join check_detail cd on ci.id = cd.check_id
+                 inner join check_tag ct on cd.id = ct.check_detail_id
+                 inner join water_tag wt on ct.water_tag_id = wt.id
+                 inner join material m on wt.material_id = m.id
+            ${ew.customSqlSegment}
+    </select>
+
+    <select id="errorTagPurposeCount" resultType="java.util.Map">
+        select m.purpose,
+               count(0) count
+        from check_info ci
+                 inner join check_detail cd on ci.id = cd.check_id
+                 inner join check_tag ct on cd.id = ct.check_detail_id
+                 inner join water_tag wt on ct.water_tag_id = wt.id
+                 inner join material m on wt.material_id = m.id
+            ${ew.customSqlSegment}
+    </select>
+
+    <select id="errorTagHandleTypeCount" resultType="java.util.Map">
+        select ct.handle_type,
+               count(0) count
+        from check_info ci
+                 inner join check_detail cd on ci.id = cd.check_id
+                 inner join check_tag ct on cd.id = ct.check_detail_id
+                 inner join water_tag wt on ct.water_tag_id = wt.id
+                 inner join material m on wt.material_id = m.id
+            ${ew.customSqlSegment}
+    </select>
+    <select id="errorTagPage" resultType="java.util.LinkedHashMap">
+        select sh.name                                                     houseName,
+               m.code                                                      materialCode,
+               m.name                                                      materialName,
+               m.purpose,
+               wt.rfid_code,
+               wt.quantity,
+               ct.tag_status,
+               ct.handle_type,
+               if(ct.handle_type = 11, wt.quantity * wt.price,
+                  if(ct.handle_type = 21, - wt.quantity * wt.price, null)) money,
+               ci.create_time,
+               ci.oper_user_id
+        from check_info ci
+                 inner join stock_house sh on ci.stock_house_id = sh.id
+                 inner join check_detail cd on ci.id = cd.check_id
+                 inner join check_tag ct on cd.id = ct.check_detail_id
+                 inner join water_tag wt on ct.water_tag_id = wt.id
+                 inner join material m on wt.material_id = m.id
+            ${ew.customSqlSegment}
+    </select>
+
 </mapper>

+ 58 - 0
hx-service/storage-restructure/src/main/java/com/fjhx/service/check/CheckInfoService.java

@@ -6,6 +6,7 @@ import com.fjhx.base.StorageBaseService;
 import com.fjhx.entity.check.CheckInfo;
 import com.fjhx.params.check.CheckDetailVo;
 
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -33,4 +34,61 @@ public interface CheckInfoService extends StorageBaseService<CheckInfo> {
      */
     void submit(CheckDetailVo checkDetailVo);
 
+    /**
+     * 库存管理盘点记录 按月统计
+     */
+    Map<String, Object> monthlyStatistics(Condition condition);
+
+    /**
+     * 根据年月获取盘点条数
+     */
+    Long getCount(Condition condition);
+
+    /**
+     * 按仓库统计盘点次数
+     */
+    List<Map<String, Object>> houseCount(Condition condition);
+
+    /**
+     * 按盘点类型统计盘点次数
+     *
+     * @return
+     */
+    Map<String, Object> typeCount(Condition condition);
+
+    /**
+     * 按盘点结果统计盘点次数
+     */
+    Map<String, Object> peopleCheckResultCount(Condition condition);
+
+    /**
+     * 分页
+     */
+    Page<Map<String, Object>> webPage(Condition condition);
+
+    /**
+     * 按盘点人统计盘点次数
+     */
+    List<Map<String, Object>> userCount(Condition condition);
+
+    /**
+     * 异常标签工艺类型统计
+     */
+    List<Map<String, Object>> errorTagTechnologyTypeCount(Condition condition);
+
+    /**
+     * 异常标签用途统计
+     */
+    List<Map<String, Object>> errorTagPurposeCount(Condition condition);
+
+    /**
+     * 异常标签处理类型统计
+     */
+    List<Map<String, Object>> errorTagHandleTypeCount(Condition condition);
+
+    /**
+     * 异常标签分页
+     */
+    Page<Map<String, Object>> errorTagPage(Condition condition);
+
 }

+ 187 - 12
hx-service/storage-restructure/src/main/java/com/fjhx/service/check/impl/CheckInfoServiceImpl.java

@@ -24,6 +24,7 @@ import com.fjhx.service.check.CheckInfoService;
 import com.fjhx.service.check.CheckTagService;
 import com.fjhx.service.stock.StockService;
 import com.fjhx.service.water.WaterTagService;
+import com.fjhx.utils.UserClientUtil;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.utils.ThreadUtil;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -66,15 +67,17 @@ public class CheckInfoServiceImpl extends ServiceImpl<CheckInfoMapper, CheckInfo
     @Override
     public synchronized void automaticCheck() {
 
+        // 发起标签扫描
         JSONObject data = new JSONObject();
         data.put("instructions", "test");
         data.put("type", 2);
         data.put("flag", "automaticCheck");
-
         WebSocketServer.sendInfo(WebSocketConstant.WEB_STOCK_PROGRAM, WebSocketConstant.OPERATING_UPPER_COMPUTER, data);
 
+        // 扫描10分钟
         ThreadUtil.sleep(1000 * 60 * 10);
 
+        // 关闭扫描标签
         data.clear();
         data.put("type", 9);
         WebSocketServer.sendInfo(WebSocketConstant.WEB_STOCK_PROGRAM, WebSocketConstant.OPERATING_UPPER_COMPUTER, data);
@@ -82,6 +85,7 @@ public class CheckInfoServiceImpl extends ServiceImpl<CheckInfoMapper, CheckInfo
         // 获取在库标签
         List<WaterTag> list = getInHouseWaterTag();
 
+        // 获取扫描到的去重标签
         List<String> rfidList = RFID_LIST.stream().distinct().collect(Collectors.toList());
         RFID_LIST.clear();
 
@@ -102,11 +106,13 @@ public class CheckInfoServiceImpl extends ServiceImpl<CheckInfoMapper, CheckInfo
     public Page<Map<String, Object>> getPage(Condition condition) {
         String keyword = condition.getKeyword();
         Integer status = condition.getStatus();
+        Integer type = condition.getType();
 
         QueryWrapper<Object> wrapper = Wrappers.query();
         wrapper.and(ObjectUtil.isNotEmpty(keyword),
                         q -> q.like("m.name", keyword).or().like("m.code", keyword))
-                .eq(ObjectUtil.isNotEmpty(status), "cd.complete_check", status);
+                .eq(ObjectUtil.isNotEmpty(status), "cd.complete_check", status)
+                .eq(ObjectUtil.isNotEmpty(type), "ci.type", type);
 
         return baseMapper.getPage(condition.getPage(), wrapper);
     }
@@ -122,7 +128,7 @@ public class CheckInfoServiceImpl extends ServiceImpl<CheckInfoMapper, CheckInfo
         List<CheckTag> checkTagList = checkDetailVo.getCheckTagList();
         checkTagService.saveBatch(checkTagList);
 
-        // 检测是否完成全部质检
+        // 检测是否完成全部盘点
         synchronized (this) {
             Long count = checkDetailService.count(q -> q
                     .eq(CheckDetail::getCheckId, checkDetailVo.getCheckId())
@@ -130,33 +136,201 @@ public class CheckInfoServiceImpl extends ServiceImpl<CheckInfoMapper, CheckInfo
 
             // 盘点完成
             if (count == 0) {
-
-                Long errorCount = checkDetailService.count(q -> q
-                        .eq(CheckDetail::getCheckId, checkDetailVo.getCheckId())
-                        .eq(CheckDetail::getCheckResult, StatusConstant.NO));
-
                 update(q -> q
                         .eq(StorageBaseEntity::getId, checkDetailVo.getCheckId())
                         .set(CheckInfo::getStatus, 2)
-                        .set(CheckInfo::getPeopleCheckResult, errorCount == 0 ? 1 : 0)
+                        .set(checkDetailVo.getCheckResult() == 0, CheckInfo::getPeopleCheckResult, 0)
                         .set(CheckInfo::getOperUserId, AuthUtil.getUserId())
                         .set(CheckInfo::getEndTime, new Date())
                         .set(StorageBaseEntity::getUpdateTime, new Date())
                         .set(StorageBaseEntity::getUpdateUser, AuthUtil.getUserId())
                 );
-
             } else {
                 update(q -> q
                         .eq(StorageBaseEntity::getId, checkDetailVo.getCheckId())
                         .set(CheckInfo::getStatus, 1)
+                        .set(checkDetailVo.getCheckResult() == 0, CheckInfo::getPeopleCheckResult, 0)
+                        .set(CheckInfo::getOperUserId, AuthUtil.getUserId())
                         .set(StorageBaseEntity::getUpdateTime, new Date())
                         .set(StorageBaseEntity::getUpdateUser, AuthUtil.getUserId())
                 );
             }
+        }
+    }
 
+    @Override
+    public Map<String, Object> monthlyStatistics(Condition condition) {
+        Date beginTime = condition.getBeginTime();
+        Date endTime = condition.getEndTime();
 
-        }
+        QueryWrapper<Object> wrapper = Wrappers.query().between("ci.create_time", beginTime, endTime);
+
+        return baseMapper.monthlyStatistics(wrapper);
+    }
+
+    @Override
+    public Long getCount(Condition condition) {
+        return count(q -> q.between(StorageBaseEntity::getCreateTime, condition.getBeginTime(), condition.getEndTime()));
+    }
+
+    @Override
+    public List<Map<String, Object>> houseCount(Condition condition) {
+        Date beginTime = condition.getBeginTime();
+        Date endTime = condition.getEndTime();
+        Integer type = condition.getType();
+        Integer peopleCheckResult = condition.getInt("peopleCheckResult");
+
+        QueryWrapper<Object> wrapper = Wrappers.query()
+                .between("ci.create_time", beginTime, endTime)
+                .eq(ObjectUtil.isNotEmpty(type), "ci.type", type)
+                .eq(ObjectUtil.isNotEmpty(peopleCheckResult), "ci.people_check_result", peopleCheckResult)
+                .groupBy("ci.stock_house_id");
+
+        return baseMapper.houseCount(wrapper);
+    }
+
+    @Override
+    public Map<String, Object> typeCount(Condition condition) {
+        Date beginTime = condition.getBeginTime();
+        Date endTime = condition.getEndTime();
+        Long houseId = condition.getLong("houseId");
+        Integer peopleCheckResult = condition.getInt("peopleCheckResult");
+
+        return getMap(Wrappers.<CheckInfo>query()
+                .select(
+                        "ifnull(sum(if(type = 1, 1, 0)), 0) automaticCheckCount",
+                        "ifnull(sum(if(type = 2, 1, 0)), 0) userCheckCount"
+                )
+                .lambda()
+                .between(StorageBaseEntity::getCreateTime, beginTime, endTime)
+                .eq(ObjectUtil.isNotEmpty(peopleCheckResult), CheckInfo::getPeopleCheckResult, peopleCheckResult)
+                .eq(ObjectUtil.isNotEmpty(houseId), CheckInfo::getStockHouseId, houseId)
+        );
+    }
 
+    @Override
+    public Map<String, Object> peopleCheckResultCount(Condition condition) {
+        Date beginTime = condition.getBeginTime();
+        Date endTime = condition.getEndTime();
+        Long houseId = condition.getLong("houseId");
+        Integer type = condition.getType();
+
+        return getMap(Wrappers.<CheckInfo>query()
+                .select(
+                        "ifnull(sum(if(people_check_result = 1, 1, 0)), 0) normalCount",
+                        "ifnull(sum(if(people_check_result = 0, 1, 0)), 0) errorCount"
+                )
+                .lambda()
+                .between(StorageBaseEntity::getCreateTime, beginTime, endTime)
+                .eq(ObjectUtil.isNotEmpty(type), CheckInfo::getType, type)
+                .eq(ObjectUtil.isNotEmpty(houseId), CheckInfo::getStockHouseId, houseId)
+        );
+    }
+
+    @Override
+    public Page<Map<String, Object>> webPage(Condition condition) {
+        Date beginTime = condition.getBeginTime();
+        Date endTime = condition.getEndTime();
+        Integer type = condition.getType();
+        Integer peopleCheckResult = condition.getInt("peopleCheckResult");
+        Long houseId = condition.getLong("houseId");
+
+        QueryWrapper<Object> wrapper = Wrappers.query()
+                .between("ci.create_time", beginTime, endTime)
+                .eq(ObjectUtil.isNotEmpty(type), "ci.type", type)
+                .eq(ObjectUtil.isNotEmpty(peopleCheckResult), "ci.people_check_result", peopleCheckResult)
+                .eq(ObjectUtil.isNotEmpty(houseId), "ci.stock_house_id", houseId);
+
+        Page<Map<String, Object>> page = baseMapper.webPage(condition.getPage(), wrapper);
+        UserClientUtil.setUserName(page.getRecords(), "operUserId", "operUserName");
+        return page;
+    }
+
+    @Override
+    public List<Map<String, Object>> userCount(Condition condition) {
+        Date beginTime = condition.getBeginTime();
+        Date endTime = condition.getEndTime();
+
+        List<Map<String, Object>> list = listMaps(Wrappers.<CheckInfo>query()
+                .select(
+                        "oper_user_id",
+                        "count(0) count"
+                )
+                .lambda()
+                .isNotNull(CheckInfo::getOperUserId)
+                .between(StorageBaseEntity::getCreateTime, beginTime, endTime)
+                .groupBy(CheckInfo::getOperUserId)
+        );
+        UserClientUtil.setUserName(list, "operUserId", "operUserName");
+        return list;
+    }
+
+    @Override
+    public List<Map<String, Object>> errorTagTechnologyTypeCount(Condition condition) {
+        Date beginTime = condition.getBeginTime();
+        Date endTime = condition.getEndTime();
+
+        QueryWrapper<Object> wrapper = Wrappers.query()
+                .between("ci.create_time", beginTime, endTime)
+                .ne("ct.tag_status", 0)
+                .groupBy("m.technology_type")
+                .orderByAsc("m.technology_type");
+
+        return baseMapper.errorTagTechnologyTypeCount(wrapper);
+    }
+
+    @Override
+    public List<Map<String, Object>> errorTagPurposeCount(Condition condition) {
+        Date beginTime = condition.getBeginTime();
+        Date endTime = condition.getEndTime();
+        Integer technologyType = condition.getInt("technologyType");
+
+        QueryWrapper<Object> wrapper = Wrappers.query()
+                .between("ci.create_time", beginTime, endTime)
+                .ne("ct.tag_status", 0)
+                .eq(ObjectUtil.isNotEmpty(technologyType), "m.technology_type", technologyType)
+                .groupBy("m.purpose");
+
+        return baseMapper.errorTagPurposeCount(wrapper);
+    }
+
+    @Override
+    public List<Map<String, Object>> errorTagHandleTypeCount(Condition condition) {
+        Date beginTime = condition.getBeginTime();
+        Date endTime = condition.getEndTime();
+        Integer technologyType = condition.getInt("technologyType");
+        String purpose = condition.getStr("purpose");
+
+        QueryWrapper<Object> wrapper = Wrappers.query()
+                .between("ci.create_time", beginTime, endTime)
+                .ne("ct.tag_status", 0)
+                .eq(ObjectUtil.isNotEmpty(technologyType), "m.technology_type", technologyType)
+                .eq(ObjectUtil.isNotEmpty(purpose), "m.purpose", purpose)
+                .groupBy("ct.handle_type");
+
+        return baseMapper.errorTagHandleTypeCount(wrapper);
+
+    }
+
+    @Override
+    public Page<Map<String, Object>> errorTagPage(Condition condition) {
+        Date beginTime = condition.getBeginTime();
+        Date endTime = condition.getEndTime();
+        Integer technologyType = condition.getInt("technologyType");
+        String purpose = condition.getStr("purpose");
+        Integer handleType = condition.getInt("handleType");
+
+        QueryWrapper<Object> wrapper = Wrappers.query()
+                .between("ci.create_time", beginTime, endTime)
+                .ne("ct.tag_status", 0)
+                .eq(ObjectUtil.isNotEmpty(technologyType), "m.technology_type", technologyType)
+                .eq(ObjectUtil.isNotEmpty(purpose), "m.purpose", purpose)
+                .eq(ObjectUtil.isNotEmpty(handleType), "ct.handle_type", handleType);
+
+        Page<Map<String, Object>> page = baseMapper.errorTagPage(condition.getPage(), wrapper);
+
+        UserClientUtil.setUserName(page.getRecords(), "operUserId", "operUserName");
+        return page;
     }
 
     /**
@@ -189,7 +363,7 @@ public class CheckInfoServiceImpl extends ServiceImpl<CheckInfoMapper, CheckInfo
 
         // 不在库存,但扫描到rfid
         errorMaterialIdList.addAll(
-                waterTagService.list(Wrappers.<WaterTag>lambdaQuery()
+                waterTagService.list(q -> q
                                 .select(WaterTag::getMaterialId)
                                 .in(WaterTag::getRfidCode, rfidList)
                                 .eq(WaterTag::getUseStatus, StatusConstant.YES))
@@ -207,6 +381,7 @@ public class CheckInfoServiceImpl extends ServiceImpl<CheckInfoMapper, CheckInfo
         checkInfo.setCheckResult(errorMaterialId.size() == 0 ? 1 : 0);
         checkInfo.setType(1);
         checkInfo.setStatus(0);
+        checkInfo.setPeopleCheckResult(1);
         checkInfo.setStockHouseId(HouseConstant.GROUND_FLOOR_ID);
         checkInfo.setBeginTime(new Date());
         save(checkInfo);

+ 5 - 0
hx-service/storage/pom.xml

@@ -38,6 +38,11 @@
             <artifactId>blade-user-api</artifactId>
         </dependency>
 
+        <dependency>
+            <groupId>com.fjhx</groupId>
+            <artifactId>common-websocket</artifactId>
+        </dependency>
+
     </dependencies>
 
 </project>

+ 82 - 0
hx-service/storage/src/main/java/com/fjhx/listener/WebSocketEventListener.java

@@ -0,0 +1,82 @@
+package com.fjhx.listener;
+
+import com.alibaba.fastjson.JSONObject;
+import com.fjhx.entity.MessageEntity;
+import com.fjhx.event.WebSocketOnMessageEvent;
+import com.fjhx.event.WebSocketOnOpenEvent;
+import com.fjhx.service.WebSocketServer;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.context.event.EventListener;
+import org.springframework.stereotype.Component;
+
+@Slf4j
+@Component
+public class WebSocketEventListener {
+
+    /**
+     * 上位机userId
+     */
+    String WEB_STOCK_PROGRAM = "webStockProgram";
+
+    /**
+     * 转发userId key
+     */
+    String FORWARD_USER_ID = "forwardUserId";
+
+    /**
+     * 转发sessionId key
+     */
+    String FORWARD_SESSION_ID = "forwardSessionId";
+
+    /**
+     * 初始化返回
+     */
+    final int ON_OPEN_TYPE = 1;
+
+    /**
+     * 操作上位机
+     */
+    final int OPERATING_UPPER_COMPUTER = 2;
+
+    /**
+     * 推送rfid
+     */
+    final int PUSH_RFID = 3;
+
+
+    @EventListener
+    public void onMessageListener(WebSocketOnOpenEvent event) {
+        WebSocketServer source = event.getSource();
+        JSONObject jsonObject = new JSONObject();
+        source.sendMessage(ON_OPEN_TYPE, jsonObject);
+    }
+
+
+    @EventListener
+    public void onMessageListener(WebSocketOnMessageEvent event) {
+        WebSocketServer webSocketServer = event.getSource();
+        String message = event.getMessage();
+
+        System.err.println(message);
+
+        MessageEntity sendEntity = JSONObject.parseObject(message, MessageEntity.class);
+
+        Integer type = sendEntity.getType();
+        JSONObject data = sendEntity.getData();
+
+        switch (type) {
+            case OPERATING_UPPER_COMPUTER:
+                data.put(FORWARD_USER_ID, webSocketServer.getUserId());
+                data.put(FORWARD_SESSION_ID, webSocketServer.getSessionId());
+                WebSocketServer.sendInfo(WEB_STOCK_PROGRAM, type, data);
+                break;
+
+            case PUSH_RFID:
+                WebSocketServer.sendInfo(sendEntity.getUserId(), sendEntity.getSessionId(), type, data);
+                break;
+        }
+
+    }
+
+
+}

+ 1 - 1
hx-service/storage/src/main/java/com/fjhx/stock/service/impl/StockBackPlanServiceImpl.java

@@ -417,7 +417,7 @@ public class StockBackPlanServiceImpl extends ServiceImpl<StockBackPlanMapper, S
 
     private void returnWarehouseA008(Date beginDate, Map<String, StockBackPlanDetails> stockBackPlanMap) {
         List<Map<String, Object>> backList = baseMapper.getReturnWarehouse(Wrappers.query()
-                .ge("sb.checker_time", DateUtil.format(beginDate, "yyyy-MM-dd 10:00:00"))
+                .ge("sb.operation_time", DateUtil.format(beginDate, "yyyy-MM-dd 10:00:00"))
                 .eq("uu.IsDelete", 0)
                 .eq("uu.DepartmentID", "A008")
                 .isNotNull("uu.JobNo")