材料优化
This commit is contained in:
parent
b494a93711
commit
f0ba8ec37a
@ -79,13 +79,13 @@ public class XzMaterialController {
|
|||||||
public Result<IPage<XzMaterial>> queryPageList(@ApiIgnore @RequestBody Map<String, Object> map) {
|
public Result<IPage<XzMaterial>> queryPageList(@ApiIgnore @RequestBody Map<String, Object> map) {
|
||||||
QueryWrapper<XzMaterial> queryWrapper = QueryGenerator.initPageQueryWrapper(XzMaterial.class, map);
|
QueryWrapper<XzMaterial> queryWrapper = QueryGenerator.initPageQueryWrapper(XzMaterial.class, map);
|
||||||
Page<XzMaterial> page = PageUtil.getPage(map);
|
Page<XzMaterial> page = PageUtil.getPage(map);
|
||||||
IPage<XzMaterial> pageList = xzMaterialService.page(page, queryWrapper);
|
|
||||||
queryWrapper.orderByDesc("entry_time");
|
queryWrapper.orderByDesc("entry_time");
|
||||||
|
IPage<XzMaterial> pageList = xzMaterialService.page(page, queryWrapper);
|
||||||
if (pageList.getRecords().size() > 0) {
|
if (pageList.getRecords().size() > 0) {
|
||||||
List<EnterpriseInfo> enterpriseInfos = enterpriseInfoService.listByIds(pageList.getRecords().stream().map(r -> r.getEnterpriseId()).collect(Collectors.toSet()));
|
List<EnterpriseInfo> enterpriseInfos = enterpriseInfoService.listByIds(pageList.getRecords().stream().map(r -> r.getEnterpriseId()).collect(Collectors.toSet()));
|
||||||
for (XzMaterial record : pageList.getRecords()) {
|
for (XzMaterial record : pageList.getRecords()) {
|
||||||
for (EnterpriseInfo enterpriseInfo : enterpriseInfos) {
|
for (EnterpriseInfo enterpriseInfo : enterpriseInfos) {
|
||||||
if (record.getEnterpriseId().equals(enterpriseInfo.getId())) {
|
if (record.getEnterpriseId().equals(enterpriseInfo.getId().toString())) {
|
||||||
record.setEnterpriseName(enterpriseInfo.getEnterpriseName());
|
record.setEnterpriseName(enterpriseInfo.getEnterpriseName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -133,12 +133,14 @@ public class XzMaterialController {
|
|||||||
@ApiOperation(value = " 添加材料批次信息信息", notes = "添加材料批次信息信息", httpMethod = "POST")
|
@ApiOperation(value = " 添加材料批次信息信息", notes = "添加材料批次信息信息", httpMethod = "POST")
|
||||||
@PostMapping(value = "/save")
|
@PostMapping(value = "/save")
|
||||||
public Result<Object> save(@RequestBody JSONObject obj) {
|
public Result<Object> save(@RequestBody JSONObject obj) {
|
||||||
|
log.info("添加材料信息" + JSON.toJSONString(obj));
|
||||||
XzMaterial xzMaterial = new XzMaterial();
|
XzMaterial xzMaterial = new XzMaterial();
|
||||||
String [] param = {"name", "model", "specifications", "unit", "num", "remark"};
|
String [] param = {"name", "model", "specifications", "unit", "num", "remark"};
|
||||||
List<XzMaterialDetail> list = new ArrayList<>();
|
List<XzMaterialDetail> list = new ArrayList<>();
|
||||||
xzMaterial.setName(obj.getString("name"));
|
xzMaterial.setName(obj.getString("name"));
|
||||||
xzMaterial.setEntryTime(obj.getDate("entryTime"));
|
xzMaterial.setEntryTime(obj.getDate("entryTime"));
|
||||||
JSONArray detail = obj.getJSONArray("detail");
|
JSONArray detail = obj.getJSONArray("detail");
|
||||||
|
if (detail != null) {
|
||||||
for (int i = 0; i < detail.size(); i++) {
|
for (int i = 0; i < detail.size(); i++) {
|
||||||
JSONObject detailObj = new JSONObject();
|
JSONObject detailObj = new JSONObject();
|
||||||
JSONObject j = detail.getJSONObject(i);
|
JSONObject j = detail.getJSONObject(i);
|
||||||
@ -150,6 +152,7 @@ public class XzMaterialController {
|
|||||||
detailObj.put("projectSn", obj.getString("projectSn"));
|
detailObj.put("projectSn", obj.getString("projectSn"));
|
||||||
list.add(JSONObject.parseObject(JSON.toJSONString(detailObj), XzMaterialDetail.class));
|
list.add(JSONObject.parseObject(JSON.toJSONString(detailObj), XzMaterialDetail.class));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
xzMaterial.setProjectSn(obj.getString("projectSn"));
|
xzMaterial.setProjectSn(obj.getString("projectSn"));
|
||||||
List<String> enterpriseIds = (List<String>) obj.get("enterpriseId");
|
List<String> enterpriseIds = (List<String>) obj.get("enterpriseId");
|
||||||
if (enterpriseIds != null && enterpriseIds.size() >0) {
|
if (enterpriseIds != null && enterpriseIds.size() >0) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user