|
|
@ -2,7 +2,10 @@ package cn.iocoder.yudao.module.bs.service.materiel;
|
|
|
|
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.bs.dal.dataobject.quotationsheet.QuotationSheetDO;
|
|
|
|
import cn.iocoder.yudao.module.bs.dal.dataobject.quotationsheet.QuotationSheetDO;
|
|
|
|
import cn.iocoder.yudao.module.bs.dal.mysql.quotationsheet.QuotationSheetMapper;
|
|
|
|
import cn.iocoder.yudao.module.bs.dal.mysql.quotationsheet.QuotationSheetMapper;
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
|
import com.github.yulichang.base.MPJBaseServiceImpl;
|
|
|
|
import com.github.yulichang.base.MPJBaseServiceImpl;
|
|
|
|
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
@ -34,6 +37,10 @@ public class MaterielServiceImpl extends MPJBaseServiceImpl<MaterielMapper, Mate
|
|
|
|
public Long createMateriel(MaterielCreateReqVO createReqVO) {
|
|
|
|
public Long createMateriel(MaterielCreateReqVO createReqVO) {
|
|
|
|
// 插入
|
|
|
|
// 插入
|
|
|
|
MaterielDO materiel = MaterielConvert.INSTANCE.convert(createReqVO);
|
|
|
|
MaterielDO materiel = MaterielConvert.INSTANCE.convert(createReqVO);
|
|
|
|
|
|
|
|
if (createReqVO.getExtendList()!=null){
|
|
|
|
|
|
|
|
materiel.setExtend(JSON.toJSONString(createReqVO.getExtendList()));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
materielMapper.insert(materiel);
|
|
|
|
materielMapper.insert(materiel);
|
|
|
|
// 返回
|
|
|
|
// 返回
|
|
|
|
return materiel.getId();
|
|
|
|
return materiel.getId();
|
|
|
@ -69,12 +76,48 @@ public class MaterielServiceImpl extends MPJBaseServiceImpl<MaterielMapper, Mate
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public List<MaterielDO> getMaterielList(Collection<Long> ids) {
|
|
|
|
public List<MaterielDO> getMaterielList(Collection<Long> ids) {
|
|
|
|
return materielMapper.selectBatchIds(ids);
|
|
|
|
List<MaterielDO> materielDOS = materielMapper.selectBatchIds(ids);
|
|
|
|
|
|
|
|
if (null!=materielDOS){
|
|
|
|
|
|
|
|
materielDOS.forEach(p->{
|
|
|
|
|
|
|
|
if (p.getExtend()!=null && !p.getExtend().equals("")){
|
|
|
|
|
|
|
|
p.setExtendList(JSON.parseArray(p.getExtend(),Object.class));
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
p.setExtendList(new ArrayList<>());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return materielDOS;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public PageResult<MaterielDO> getMaterielPage(MaterielPageReqVO pageReqVO) {
|
|
|
|
public PageResult<MaterielDO> getMaterielPage(MaterielPageReqVO pageReqVO) {
|
|
|
|
return materielMapper.selectPage(pageReqVO);
|
|
|
|
PageResult<MaterielDO> materielDOPageResult = materielMapper.selectPage(pageReqVO);
|
|
|
|
|
|
|
|
if (null!=materielDOPageResult.getList()){
|
|
|
|
|
|
|
|
materielDOPageResult.getList().forEach(p->{
|
|
|
|
|
|
|
|
if (p.getExtend()!=null && !p.getExtend().equals("")){
|
|
|
|
|
|
|
|
p.setExtendList(JSON.parseArray(p.getExtend(),Object.class));
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
p.setExtendList(new ArrayList<>());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return materielDOPageResult;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* String 转 List<Map<String,Object>
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public static List<Map<Object, Object>> getStrToListMap(String json){
|
|
|
|
|
|
|
|
List<Object> list = JSON.parseArray(json);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List< Map<Object,Object>> listw = new ArrayList<Map<Object,Object>>();
|
|
|
|
|
|
|
|
for (Object object : list){
|
|
|
|
|
|
|
|
Map<Object,Object> ageMap = new HashMap<Object,Object>();
|
|
|
|
|
|
|
|
Map <Object,Object> ret = (Map<Object, Object>) object;//取出list里面的值转为map
|
|
|
|
|
|
|
|
listw.add(ret);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return listw;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|