renkang
2025-01-13 8e19529ac1eb0843e0c3a0b76d35aa9ff6fe2032
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwStocktakingServiceImpl.java
@@ -14,6 +14,8 @@
import com.doumee.dao.business.YwStocktakingRecordMapper;
import com.doumee.dao.business.YwWarehouseMapper;
import com.doumee.dao.business.model.*;
import com.doumee.dao.system.join.NoticesJoinMapper;
import com.doumee.dao.system.model.Notices;
import com.doumee.service.business.YwStocktakingService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
@@ -56,6 +58,9 @@
    private YwWarehouseMapper ywWarehouseMapper;
    @Autowired
    private NoticesJoinMapper noticesJoinMapper;
    @Autowired
    private RedisTemplate<String, Object> redisTemplate;
    
    @Override
@@ -85,6 +90,20 @@
        ywStocktaking.setStatus(Constants.ZERO);
        ywStocktaking.setCode(getNextCode());
        ywStocktakingMapper.insert(ywStocktaking);
        //添加待办信息
        Notices notices = new Notices();
        notices.setCreateDate(new Date());
        notices.setCreator(ywStocktaking.getCreator());
        notices.setIsdeleted(Constants.ZERO);
        notices.setParam1(DateUtil.formatDate(ywStocktaking.getPlanDate(),"yyyy-MM-dd"));
        notices.setTitle("盘点待办");
        notices.setContent("["+ywStocktaking.getName()+"]将在["+notices.getParam1()+"]进行盘点,请按时执行");
        notices.setObjId(ywStocktaking.getId());
        notices.setObjType(Constants.ZERO);
        notices.setType(notices.getObjType());
        notices.setUserId(ywStocktaking.getUserId());
        notices.setStatus(Constants.ZERO);
        noticesJoinMapper.insert(notices);
        return ywStocktaking.getId();
    }
@@ -101,6 +120,12 @@
                    .set(YwStocktaking::getEditDate,DateUtil.getCurrDateTime())
                    .set(YwStocktaking::getEditor,loginUserInfo.getId())
                    .eq(YwStocktaking::getId,id)
            );
            //标记待办删除
            noticesJoinMapper.update(null,new UpdateWrapper<Notices>().lambda().set(Notices::getIsdeleted,Constants.ONE)
                    .eq(Notices::getIsdeleted,Constants.ZERO)
                    .eq(Notices::getObjType,Constants.ZERO)
                    .eq(Notices::getObjId,id)
            );
        }else{
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"盘点单状态已流转,无法进行该操作");
@@ -121,6 +146,12 @@
                    .set(YwStocktaking::getCancelUserId,loginUserInfo.getId())
                    .set(YwStocktaking::getEditor,loginUserInfo.getId())
                    .set(YwStocktaking::getStatus,Constants.THREE).eq(YwStocktaking::getId,id));
            //标记待办删除
            noticesJoinMapper.update(null,new UpdateWrapper<Notices>().lambda().set(Notices::getIsdeleted,Constants.ONE)
                    .eq(Notices::getIsdeleted,Constants.ZERO)
                    .eq(Notices::getObjType,Constants.ZERO)
                    .eq(Notices::getObjId,id)
            );
        }else{
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"盘点单状态已流转,无法进行该操作");
        }
@@ -144,6 +175,15 @@
                    .set(YwStocktaking::getEditor,loginUserInfo.getId())
                    .set(YwStocktaking::getStatus,Constants.ONE)
                    .eq(YwStocktaking::getId,model.getId()));
            //标记待办已处理
            noticesJoinMapper.update(null,new UpdateWrapper<Notices>().lambda()
                    .set(Notices::getStatus,Constants.ONE)
                    .eq(Notices::getIsdeleted,Constants.ZERO)
                    .eq(Notices::getObjType,Constants.ZERO)
                    .eq(Notices::getObjId,id)
            );
            //生成当前仓库下所有的资产信息
            List<YwStock> stockList = ywStockMapper.selectList(new QueryWrapper<YwStock>().lambda().eq(YwStock::getIsdeleted,Constants.ZERO).eq(YwStock::getWarehouseId,model.getWarehouseId()));
            if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(stockList)){
@@ -256,6 +296,32 @@
        ywStocktaking.setEditDate(new Date());
        ywStocktaking.setCode(null);
        ywStocktakingMapper.updateById(ywStocktaking);
        //标记待办已处理
        noticesJoinMapper.update(null,new UpdateWrapper<Notices>().lambda()
                .set(Notices::getStatus,Constants.ONE)
                .eq(Notices::getIsdeleted,Constants.ZERO)
                .eq(Notices::getObjType,Constants.ZERO)
                .eq(Notices::getObjId,ywStocktaking.getId())
        );
        //添加待办信息
        Notices notices = new Notices();
        notices.setCreateDate(new Date());
        notices.setCreator(ywStocktaking.getCreator());
        notices.setIsdeleted(Constants.ZERO);
        notices.setParam1(DateUtil.formatDate(ywStocktaking.getPlanDate(),"yyyy-MM-dd"));
        notices.setTitle("盘点待办");
        notices.setContent("["+ywStocktaking.getName()+"]将在["+notices.getParam1()+"]进行盘点,请按时执行");
        notices.setObjId(ywStocktaking.getId());
        notices.setObjType(Constants.ZERO);
        notices.setType(notices.getObjType());
        notices.setUserId(ywStocktaking.getUserId());
        notices.setStatus(Constants.ZERO);
        noticesJoinMapper.insert(notices);
    }
    @Override