|
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.jeeplus.core.query.QueryWrapperGenerator;
|
|
|
+import com.jeeplus.flowable.service.MyNoticeService;
|
|
|
import com.jeeplus.sys.service.dto.UserDTO;
|
|
|
import com.jeeplus.sys.utils.StringUtils;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
@@ -17,7 +18,9 @@ import com.jeeplus.test.materialManagement.collect.mapper.CollectBasicMapper;
|
|
|
import com.jeeplus.test.materialManagement.collect.mapper.CollectDetailedMapper;
|
|
|
import com.jeeplus.test.materialManagement.collect.service.dto.CollectDto;
|
|
|
import com.jeeplus.test.materialManagement.collect.service.dto.WareHouseSummaryDto;
|
|
|
+import com.jeeplus.test.materialManagement.wareHouse.domain.WareHouseDetailed;
|
|
|
import com.jeeplus.test.materialManagement.wareHouse.domain.WareHouseSummary;
|
|
|
+import com.jeeplus.test.materialManagement.wareHouse.mapper.WareHouseDetailedMapper;
|
|
|
import com.jeeplus.test.materialManagement.wareHouse.mapper.WareHouseSummaryMapper;
|
|
|
import com.jeeplus.test.mould.service.SerialnumTplService;
|
|
|
import com.jeeplus.test.oss.domain.WorkAttachment;
|
|
@@ -28,6 +31,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import javax.annotation.Resource;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.UUID;
|
|
@@ -57,8 +61,14 @@ public class CollectService {
|
|
|
private ContractInfoService infoService;
|
|
|
|
|
|
@Resource
|
|
|
+ private MyNoticeService myNoticeService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
private OssServiceMapper ossServiceMapper;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private WareHouseDetailedMapper wareHouseDetailedMapper;
|
|
|
+
|
|
|
public void updateStatusById(CollectDto dto) {
|
|
|
basicMapper.updateStatusById(dto.getId(), dto.getStatus());
|
|
|
}
|
|
@@ -100,14 +110,14 @@ public class CollectService {
|
|
|
|
|
|
}
|
|
|
|
|
|
- public String update(CollectDto dto, UserDTO userDTO) {
|
|
|
+ public String update(CollectDto dto, UserDTO userDTO) throws Exception {
|
|
|
// 修改基础信息
|
|
|
CollectBasic info = new CollectBasic();
|
|
|
BeanUtils.copyProperties(dto, info);
|
|
|
info.setUpdateBy(userDTO.getId());
|
|
|
info.setHandledBy(dto.getHandledById());
|
|
|
info.setUpdateDate(new Date());
|
|
|
- basicMapper.updateById(info);
|
|
|
+// basicMapper.updateById(info);
|
|
|
// 修改报销详情列表信息
|
|
|
// 删除原有数据
|
|
|
// LambdaQueryWrapper<MaterialDetailed> detailWrapper = new LambdaQueryWrapper<>();
|
|
@@ -173,12 +183,38 @@ public class CollectService {
|
|
|
//当流程结束的时候 修改入库汇总表的数量
|
|
|
if ( StringUtils.isNotEmpty(info.getStatus()) && info.getStatus().equals("5")){
|
|
|
//根据商品名称 及 领用类型查询汇总表修改改商品库存数量
|
|
|
- WareHouseSummary summaryInfo = summaryMapper.getInfoByTradeName(detailInfo.getGoodsName(), detailInfo.getCollectType());
|
|
|
+ /*WareHouseSummary summaryInfo = summaryMapper.getInfoByTradeName(detailInfo.getGoodsName(), detailInfo.getCollectType());
|
|
|
if (null != summaryInfo) {
|
|
|
String num = Double.parseDouble(summaryInfo.getTradeNumber())
|
|
|
- Double.parseDouble(detailInfo.getCollectNumber()) + "";
|
|
|
summaryInfo.setTradeNumber(num);
|
|
|
summaryMapper.updateById(summaryInfo);
|
|
|
+ }*/
|
|
|
+ //根据商品名称 及 领用类型查询入库表的商品入库数量
|
|
|
+ Double wareHouseNum = summaryMapper.getInfoByTradeName(detailInfo.getGoodsName(), detailInfo.getCollectType());
|
|
|
+ if (null != wareHouseNum) {
|
|
|
+ double num = wareHouseNum - Double.parseDouble(detailInfo.getCollectNumber());
|
|
|
+ //当小于5的时候发起通知
|
|
|
+ if (num < 5 ) {
|
|
|
+ SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
|
|
|
+ String day = format.format(new Date());
|
|
|
+ String title = userDTO.getLoginName() + " 在 " + day + " 发起了 [库存提醒]";
|
|
|
+ //向多个用户发起通知 徐珊、黄丽、杨娟、崇祝燕
|
|
|
+ String[] names = {"徐珊","黄丽","杨娟","崇祝燕"};
|
|
|
+ List<UserDTO> usersInfo = wareHouseDetailedMapper.getUsersInfo(names);
|
|
|
+ //获取目前领用流程的taskid,根据procInsId去查taskId
|
|
|
+ if (null != usersInfo) {
|
|
|
+ usersInfo.forEach(us->{
|
|
|
+ try {
|
|
|
+ //发送通知
|
|
|
+ myNoticeService.add("cs", title, "", "库存提醒", userDTO.getLoginName(), day,us.getLoginName(), us.getId());
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+// myNoticeService.add("", title, "", "库存提醒", userDTO.getLoginName(), day,"程倩", "1613087772650008578");
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -186,6 +222,7 @@ public class CollectService {
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+ basicMapper.updateById(info);
|
|
|
// 修改附件信息列表
|
|
|
if (CollectionUtils.isNotEmpty(dto.getFiles())) {
|
|
|
infoService.updateFiles(dto.getFiles(), userDTO, dto.getId());
|