|
@@ -4,12 +4,10 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
import com.hssx.pcbms.constant.Constant;
|
|
|
-import com.hssx.pcbms.entity.Goods;
|
|
|
-import com.hssx.pcbms.entity.GoodsNo;
|
|
|
-import com.hssx.pcbms.entity.OperateRecord;
|
|
|
-import com.hssx.pcbms.entity.User;
|
|
|
+import com.hssx.pcbms.entity.*;
|
|
|
import com.hssx.pcbms.entity.vo.GoodsNoVO;
|
|
|
import com.hssx.pcbms.entity.vo.GoodsVO;
|
|
|
+import com.hssx.pcbms.entity.vo.MaintainRecordVO;
|
|
|
import com.hssx.pcbms.entity.vo.OperateRecordVO;
|
|
|
import com.hssx.pcbms.mapper.GoodsMapper;
|
|
|
import com.hssx.pcbms.mapper.GoodsNoMapper;
|
|
@@ -18,6 +16,7 @@ import com.hssx.pcbms.mapper.UserMapper;
|
|
|
import com.hssx.pcbms.service.GoodsNoService;
|
|
|
import com.hssx.pcbms.service.GoodsService;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.hssx.pcbms.service.MaintainRecordService;
|
|
|
import com.hssx.pcbms.service.OperateRecordService;
|
|
|
import com.hssx.pcbms.util.HttpRespMsg;
|
|
|
import com.hssx.pcbms.util.ListUtil;
|
|
@@ -57,6 +56,8 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
private UserMapper userMapper;
|
|
|
@Resource
|
|
|
private OperateRecordService operateRecordService;
|
|
|
+ @Resource
|
|
|
+ private MaintainRecordService maintainRecordService;
|
|
|
|
|
|
@Override
|
|
|
public HttpRespMsg add(GoodsVO goodsVO) {
|
|
@@ -245,26 +246,36 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public HttpRespMsg maintain(OperateRecordVO operateRecordVO) {
|
|
|
+ public HttpRespMsg maintain(MaintainRecordVO operateRecordVO) {
|
|
|
HttpRespMsg msg = new HttpRespMsg();
|
|
|
- OperateRecord operateRecord = new OperateRecord();
|
|
|
- List<OperateRecord> operateRecords = new ArrayList<>();
|
|
|
+ MaintainRecord operateRecord = new MaintainRecord();
|
|
|
+ List<MaintainRecord> operateRecords = new ArrayList<>();
|
|
|
if(null != operateRecordVO.getIds()){
|
|
|
List<Integer> idList = ListUtil.convertIntegerIdsArrayToList(operateRecordVO.getIds());
|
|
|
BeanUtils.copyProperties(operateRecordVO,operateRecord);
|
|
|
for (Integer id : idList) {
|
|
|
- operateRecord.setGoodNoId(id);
|
|
|
+ operateRecord.setGoodsNoId(id);
|
|
|
operateRecords.add(operateRecord);
|
|
|
}
|
|
|
- operateRecordService.saveBatch(operateRecords);
|
|
|
+ maintainRecordService.saveBatch(operateRecords);
|
|
|
//将原来待维护的状态更新为正常
|
|
|
- goodsNoMapper.update(null,new QueryWrapper<GoodsNo>().in("id",idList));
|
|
|
+ GoodsNo goodsNo = new GoodsNo();
|
|
|
+ goodsNo.setIsMaintain(0);
|
|
|
+ goodsNoMapper.update(goodsNo,new QueryWrapper<GoodsNo>().in("id",idList));
|
|
|
}else{
|
|
|
msg.setError("资产对应的编号id不存在");
|
|
|
}
|
|
|
return msg;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public HttpRespMsg isMaintainList(Goods goods) {
|
|
|
+ HttpRespMsg msg = new HttpRespMsg();
|
|
|
+ List<GoodsNo> goodsNoList = goodsNoMapper.selectList(new QueryWrapper<GoodsNo>().eq("goods_id", goods.getId()).eq("is_maintain", 1));//1-需要保养
|
|
|
+ msg.data = goodsNoList;
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
+
|
|
|
public static void main(String[] args) {
|
|
|
// String format = String.format("%04d", 0);
|
|
|
// System.out.println(format);
|