|
@@ -5,10 +5,7 @@ import com.github.pagehelper.PageHelper;
|
|
import com.github.pagehelper.PageInfo;
|
|
import com.github.pagehelper.PageInfo;
|
|
import com.hssx.pcbms.constant.Constant;
|
|
import com.hssx.pcbms.constant.Constant;
|
|
import com.hssx.pcbms.entity.*;
|
|
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.entity.vo.*;
|
|
import com.hssx.pcbms.mapper.*;
|
|
import com.hssx.pcbms.mapper.*;
|
|
import com.hssx.pcbms.service.GoodsNoService;
|
|
import com.hssx.pcbms.service.GoodsNoService;
|
|
import com.hssx.pcbms.service.GoodsService;
|
|
import com.hssx.pcbms.service.GoodsService;
|
|
@@ -21,15 +18,15 @@ import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.util.CollectionUtils;
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
import java.time.LocalDate;
|
|
import java.time.LocalDate;
|
|
import java.time.format.DateTimeFormatter;
|
|
import java.time.format.DateTimeFormatter;
|
|
-import java.util.ArrayList;
|
|
|
|
-import java.util.Date;
|
|
|
|
-import java.util.List;
|
|
|
|
|
|
+import java.util.*;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
/**
|
|
* <p>
|
|
* <p>
|
|
@@ -66,6 +63,8 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
private NewsNoticeMapper newsNoticeMapper;
|
|
private NewsNoticeMapper newsNoticeMapper;
|
|
@Resource
|
|
@Resource
|
|
private NewsNoticeUserMapper newsNoticeUserMapper;
|
|
private NewsNoticeUserMapper newsNoticeUserMapper;
|
|
|
|
+ @Resource
|
|
|
|
+ private RacksEquipmentMapper racksEquipmentMapper;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public HttpRespMsg add(GoodsVO goodsVO) {
|
|
public HttpRespMsg add(GoodsVO goodsVO) {
|
|
@@ -108,6 +107,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public HttpRespMsg getList(PageUtil page, String keyName, Integer tagId, Integer uid) {
|
|
public HttpRespMsg getList(PageUtil page, String keyName, Integer tagId, Integer uid) {
|
|
|
|
+ System.out.println(tagId);
|
|
HttpRespMsg msg = new HttpRespMsg();
|
|
HttpRespMsg msg = new HttpRespMsg();
|
|
PageHelper.startPage(page.getPageNum(), page.getPageSize());
|
|
PageHelper.startPage(page.getPageNum(), page.getPageSize());
|
|
List<GoodsVO> list = new ArrayList<>();
|
|
List<GoodsVO> list = new ArrayList<>();
|
|
@@ -137,9 +137,23 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
// return msg;
|
|
// return msg;
|
|
// }
|
|
// }
|
|
// }else{
|
|
// }else{
|
|
|
|
+ Integer goodType = 0;
|
|
|
|
+ if(tagId !=null){
|
|
|
|
+ if(tagId==-1){
|
|
|
|
+ goodType = 1;
|
|
|
|
+ }else if(tagId==-2){
|
|
|
|
+ goodType = 2;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if(goodType==0){
|
|
list = goodsMapper.getListBycondition(keyName, tagId, uid);
|
|
list = goodsMapper.getListBycondition(keyName, tagId, uid);
|
|
PageInfo<GoodsVO> info = new PageInfo<>(list);
|
|
PageInfo<GoodsVO> info = new PageInfo<>(list);
|
|
msg.data = info;
|
|
msg.data = info;
|
|
|
|
+ }else{
|
|
|
|
+ list = goodsMapper.getRackListBycondition(keyName, tagId, uid,goodType);
|
|
|
|
+ PageInfo<GoodsVO> info = new PageInfo<>(list);
|
|
|
|
+ msg.data = info;
|
|
|
|
+ }
|
|
// }
|
|
// }
|
|
return msg;
|
|
return msg;
|
|
}
|
|
}
|
|
@@ -167,9 +181,23 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
@Override
|
|
@Override
|
|
public HttpRespMsg getDetail(Integer id) {
|
|
public HttpRespMsg getDetail(Integer id) {
|
|
HttpRespMsg msg = new HttpRespMsg();
|
|
HttpRespMsg msg = new HttpRespMsg();
|
|
- GoodsVO vo = goodsMapper.getDetail(id);
|
|
|
|
- msg.data = vo;
|
|
|
|
- return msg;
|
|
|
|
|
|
+ Goods goods = goodsMapper.selectById(id);
|
|
|
|
+ Map<String,Object> map = new HashMap<>();
|
|
|
|
+ if(goods.getGoodType()!=0){
|
|
|
|
+ List<Integer> equipmentIds = racksEquipmentMapper.selectList(new QueryWrapper<RacksEquipment>().eq("rack_goods_id", id)).stream().map(RacksEquipment::getEquipmentGoodsId).collect(Collectors.toList());
|
|
|
|
+ if(equipmentIds.size()>0){
|
|
|
|
+ List<GoodsVO> list = goodsMapper.getEuipmentList(equipmentIds);
|
|
|
|
+ GoodsVO vo = goodsMapper.getDetail(id);
|
|
|
|
+ map.put("rack",vo);
|
|
|
|
+ map.put("equipments",list);
|
|
|
|
+ }
|
|
|
|
+ msg.data = map;
|
|
|
|
+ return msg;
|
|
|
|
+ }else{
|
|
|
|
+ GoodsVO vo = goodsMapper.getDetail(id);
|
|
|
|
+ msg.data = vo;
|
|
|
|
+ return msg;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -509,8 +537,10 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
public static void main(String[] args) {
|
|
public static void main(String[] args) {
|
|
// String format = String.format("%04d", 0);
|
|
// String format = String.format("%04d", 0);
|
|
// System.out.println(format);
|
|
// System.out.println(format);
|
|
- System.out.println("QWE-ASDF0001".substring(0, "QWE-ASDF0001".length() - 4));
|
|
|
|
- System.out.println("QWE-ASDF0001".substring("QWE-ASDF0001".length() - 4));
|
|
|
|
- System.out.println(Integer.parseInt("0001"));
|
|
|
|
|
|
+// System.out.println("QWE-ASDF0001".substring(0, "QWE-ASDF0001".length() - 4));
|
|
|
|
+// System.out.println("QWE-ASDF0001".substring("QWE-ASDF0001".length() - 4));
|
|
|
|
+// System.out.println(Integer.parseInt("0001"));
|
|
|
|
+ List<Integer> list = new ArrayList<>();
|
|
|
|
+ System.out.println(list.stream().map(a ->a).collect(Collectors.toList()));
|
|
}
|
|
}
|
|
}
|
|
}
|