材料优化
This commit is contained in:
parent
86724b9c0c
commit
b494a93711
@ -127,27 +127,25 @@ public class XzMaterialController {
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "材料批次信息管理", operType = "新增", operDesc = "添加材料批次信息信息")
|
||||
@ApiOperation(value = " 添加材料批次信息信息", notes = "添加材料批次信息信息", httpMethod = "POST")
|
||||
@PostMapping(value = "/save")
|
||||
public Result<Object> save(@RequestBody String map) {
|
||||
JSONObject obj = JSONObject.parseObject(map);
|
||||
public Result<Object> save(@RequestBody JSONObject obj) {
|
||||
XzMaterial xzMaterial = new XzMaterial();
|
||||
String [] param = {"name", "specifications", "num", "remark", "model", "unit"};
|
||||
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");
|
||||
for (Object d : detail) {
|
||||
for (int i = 0; i < detail.size(); i++) {
|
||||
JSONObject detailObj = new JSONObject();
|
||||
JSONObject j = JSONObject.parseObject(d.toString());
|
||||
int i = 0;
|
||||
JSONObject j = detail.getJSONObject(i);
|
||||
int k = 0;
|
||||
for (String s : j.keySet()) {
|
||||
detailObj.put(param[i], j.get(s));
|
||||
i++;
|
||||
detailObj.put(param[k], j.get(s));
|
||||
k++;
|
||||
}
|
||||
detailObj.put("projectSn", obj.getString("projectSn"));
|
||||
list.add(JSONObject.parseObject(JSON.toJSONString(detailObj), XzMaterialDetail.class));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user