|
@@ -17,6 +17,7 @@ import com.hssx.pcbms.service.MaintainRecordService;
|
|
|
import com.hssx.pcbms.service.OperateRecordService;
|
|
|
import com.hssx.pcbms.util.*;
|
|
|
import com.sun.deploy.net.HttpResponse;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -26,6 +27,7 @@ import org.springframework.web.multipart.MultipartFile;
|
|
|
import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
+import java.time.LocalDate;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
@@ -40,6 +42,7 @@ import java.util.List;
|
|
|
* @since 2019-10-25
|
|
|
*/
|
|
|
@Service
|
|
|
+@Slf4j
|
|
|
public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements GoodsService {
|
|
|
@Resource
|
|
|
private GoodsMapper goodsMapper;
|
|
@@ -61,6 +64,10 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
private MaintainRecordMapper maintainRecordMapper;
|
|
|
@Resource
|
|
|
private GoodsTagsMapper goodsTagsMapper;
|
|
|
+ @Resource
|
|
|
+ private NewsNoticeMapper newsNoticeMapper;
|
|
|
+ @Resource
|
|
|
+ private NewsNoticeUserMapper newsNoticeUserMapper;
|
|
|
|
|
|
@Override
|
|
|
public HttpRespMsg add(GoodsVO goodsVO) {
|
|
@@ -435,8 +442,27 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
|
|
|
@Override
|
|
|
public HttpRespMsg goodsMaintainChecking(Goods goods, HttpServletResponse response) {
|
|
|
- List<Goods> goodsLists = goodsMapper.selectList(new QueryWrapper<>());
|
|
|
-
|
|
|
+ log.info("处理维护资产的定时任务启动了");
|
|
|
+// List<Goods> goodsLists = goodsMapper.selectList(new QueryWrapper<>());
|
|
|
+ List<GoodsVO> goodsLists = goodsMapper.getListBycondition(null, null, null);
|
|
|
+ String nowDate = DateTimeFormatter.ofPattern("yyyy-MM-dd").format(LocalDate.now());
|
|
|
+ for (GoodsVO good : goodsLists) {
|
|
|
+ if(nowDate.equals(good.getNextIndate())){
|
|
|
+ GoodsNo no = new GoodsNo();
|
|
|
+ no.setGoodsId(good.getId());
|
|
|
+ no.setIsMaintain(1);
|
|
|
+ //此处利用update配合修改条件和条件构造器来实现批量修改数据
|
|
|
+ goodsNoMapper.update(no, new QueryWrapper<GoodsNo>().eq("goods_id", good.getId()));
|
|
|
+ List<User> users = userMapper.selectOperateUsersListByCondition();
|
|
|
+ //条件通知消息
|
|
|
+ NewsNotice newsNotice = new NewsNotice();
|
|
|
+ String content = Constant.GOODS_MATAIN_CONTENT;
|
|
|
+ content = content.replace("name",good.getName()).replace("num",good.getGoodsNos().size()+good.getUnit());
|
|
|
+ newsNotice.setContent(content);
|
|
|
+ newsNoticeMapper.insert(newsNotice);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
return null;
|
|
|
}
|
|
|
|