|
@@ -3,10 +3,12 @@ package com.hssx.pcbms.service.impl;
|
|
|
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.vo.GoodsNoVO;
|
|
|
import com.hssx.pcbms.entity.vo.GoodsVO;
|
|
|
import com.hssx.pcbms.mapper.GoodsMapper;
|
|
|
import com.hssx.pcbms.mapper.GoodsNoMapper;
|
|
@@ -95,8 +97,9 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
|
|
|
@Override
|
|
|
public HttpRespMsg getList(PageUtil page, String keyName, Integer tagId) {
|
|
|
+ System.out.println("页数:"+page.getPageNum());
|
|
|
HttpRespMsg msg = new HttpRespMsg();
|
|
|
- PageHelper.startPage(page.getPageNum(), page.getPageSize());
|
|
|
+ PageHelper.startPage(page.getPageNum(),page.getPageSize());
|
|
|
List<GoodsVO> list = goodsMapper.getListBycondition(keyName, tagId);
|
|
|
PageInfo<GoodsVO> info = new PageInfo<>(list);
|
|
|
msg.data = info;
|
|
@@ -139,19 +142,55 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
goodsNoMapper.updateById(goodsNo);
|
|
|
//添加处置记录
|
|
|
OperateRecord operateRecord = new OperateRecord();
|
|
|
-// if(1==goodsNo.getState()){
|
|
|
-//
|
|
|
-// }else if(){
|
|
|
-//
|
|
|
-// }
|
|
|
-// String content = Constant.HANDLE_CONTENT.replace("oldState",)
|
|
|
-// operaterRecord.setContent();
|
|
|
+ String oldState = "";
|
|
|
+ String nowState = "";
|
|
|
+ if(no.getState()==0){
|
|
|
+ oldState="未用";
|
|
|
+ }else if(no.getState()==1){
|
|
|
+ oldState="在用";
|
|
|
+ User usering = userMapper.selectById(no.getUserId());
|
|
|
+ oldState = oldState+(usering.getName()+"/"+usering.getPhone());
|
|
|
+ }
|
|
|
+ if(goodsNo.getState()==0){
|
|
|
+ nowState="未用";
|
|
|
+ }else if(goodsNo.getState()==1){
|
|
|
+ nowState="在用";
|
|
|
+ User usering = userMapper.selectById(goodsNo.getUserId());
|
|
|
+ nowState = nowState+(usering.getName()+"/"+usering.getPhone());
|
|
|
+ }else if(goodsNo.getState()==3){
|
|
|
+ nowState="报废";
|
|
|
+ }
|
|
|
+ String content = Constant.HANDLE_CONTENT.replace("oldState",oldState).replace("newState",nowState);
|
|
|
+ operateRecord.setContent(content);
|
|
|
operateRecord.setGoodId(no.getGoodsId());
|
|
|
- operateRecord.setGoodNo(no.getModelNo());
|
|
|
+ operateRecord.setGoodNoId(no.getId());
|
|
|
operateRecord.setGoodState(goodsNo.getState());
|
|
|
operateRecord.setUserId(currentUserId);
|
|
|
operateRecord.setUserName(user.getName());
|
|
|
- return null;
|
|
|
+ operateRecordMapper.insert(operateRecord);
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public HttpRespMsg operateList(Goods goods) {
|
|
|
+ HttpRespMsg msg= new HttpRespMsg();
|
|
|
+ List<GoodsNoVO> list = operateRecordMapper.selectCondition(goods);
|
|
|
+ msg.data = list;
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public HttpRespMsg goodsNoDetailById(GoodsNo goodsNo) {
|
|
|
+ HttpRespMsg msg = new HttpRespMsg();
|
|
|
+ GoodsNo oldGoodsNo = goodsNoMapper.selectById(goodsNo.getId());
|
|
|
+ GoodsNoVO vo = new GoodsNoVO();
|
|
|
+ BeanUtils.copyProperties(oldGoodsNo,vo);
|
|
|
+ User user = userMapper.selectById(oldGoodsNo.getUserId());
|
|
|
+ if(user != null){
|
|
|
+ vo.setUsername(user.getName());
|
|
|
+ }
|
|
|
+ msg.data = vo;
|
|
|
+ return msg;
|
|
|
}
|
|
|
|
|
|
public static void main(String[] args) {
|