材料优化

This commit is contained in:
pengjie 2024-04-27 16:34:26 +08:00
parent b494a93711
commit f0ba8ec37a

View File

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