保存加工单接口修改,新增其他服务接口调用

This commit is contained in:
hy2250089 2020-01-06 17:10:51 +08:00
parent d65b3113a6
commit 957a7ac495
2 changed files with 49 additions and 10 deletions

View File

@ -198,8 +198,9 @@ public class ProductProcessServiceImpl extends AbstractService<ProductProcess, I
List<ProcessHo> processHoList = productProcessHo.getProcessHoList();
List<MtAloneProcess> processList;
List<ProcessMaterials> processMaterialsList;
if(null != processHoList) {
if((null!=processHoList) && (0!=processHoList.size())) {
processList = new ArrayList<MtAloneProcess>(processHoList.size());
processMaterialsList = new ArrayList<ProcessMaterials>();
for (ProcessHo processHo : processHoList) {
MtAloneProcess process = new MtAloneProcess();
BeanUtils.copyProperties(processHo, process);
@ -213,15 +214,8 @@ public class ProductProcessServiceImpl extends AbstractService<ProductProcess, I
process.setCompanyId(currentUser.getCompanyId());
processList.add(process);
}
processService.save(processList);
processMaterialsList = new ArrayList<ProcessMaterials>();
for (int i=0; i<processList.size(); i++) {
MtAloneProcess process = processList.get(i);
ProcessHo processHo = processHoList.get(i);
List<ProcessMaterialsVo> processMaterialsVoList = processHo.getProcessMaterialsVoList();
if(null != processMaterialsVoList) {
if((null!=processMaterialsVoList) && (0!=processMaterialsVoList.size())){
for (ProcessMaterialsVo processMaterialsVo : processMaterialsVoList) {
ProcessMaterials processMaterials = new ProcessMaterials();
BeanUtils.copyProperties(processMaterialsVo, processMaterials);
@ -238,7 +232,10 @@ public class ProductProcessServiceImpl extends AbstractService<ProductProcess, I
}
}
}
processMaterialsService.save(processMaterialsList);
processService.save(processList);
if (0 != processMaterialsList.size())
processMaterialsService.save(processMaterialsList);
}
}

View File

@ -0,0 +1,42 @@
package com.deer.wms.produce.manage.web;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.deer.wms.intercept.annotation.User;
import com.deer.wms.intercept.common.data.CurrentUser;
import com.deer.wms.produce.manage.model.*;
import com.deer.wms.project.seed.core.result.Result;
import com.deer.wms.project.seed.core.result.ResultGenerator;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;
import springfox.documentation.annotations.ApiIgnore;
import java.util.ArrayList;
import java.util.List;
/**
* Created by on 2019/09/09.
*/
@Api(description = "其他服务接口")
@RestController
@RequestMapping("/other/service")
public class OtherServiceController {
@Autowired
private RestTemplate restTemplate;
//获取所有客户
@GetMapping
public Result getClients() {
JSONObject jsonObject = restTemplate.getForObject("http://132.232.34.114:9060/wms/client/manages/list/new", JSONObject.class);
JSONObject data = jsonObject.getJSONObject("data");
JSONArray listJson = data.getJSONArray("list");
List list = JSON.parseObject(listJson.toJSONString(), ArrayList.class);
return ResultGenerator.genSuccessResult(list);
}
}