|
|
|
|
@ -21,6 +21,7 @@ import com.spire.doc.documents.Paragraph; |
|
|
|
|
import io.swagger.annotations.Api; |
|
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
|
import oracle.jdbc.proxy.annotation.Post; |
|
|
|
|
import org.apache.commons.lang.math.RandomUtils; |
|
|
|
|
import org.apache.poi.ss.usermodel.Workbook; |
|
|
|
|
import org.apache.poi.xwpf.usermodel.XWPFDocument; |
|
|
|
|
import org.springblade.common.utils.ZipCompressUtil; |
|
|
|
|
@ -1612,6 +1613,8 @@ public class EntrustController extends BladeController { |
|
|
|
|
@PostMapping("/conserve") |
|
|
|
|
public Entrust conserve(@RequestBody Entrust entrust) { |
|
|
|
|
// 委托单入库
|
|
|
|
|
|
|
|
|
|
// 采样单位相关
|
|
|
|
|
Long entrustCustomerId = entrust.getEntrustCustomerId(); |
|
|
|
|
String entrustCustomerName = entrust.getEntrustCustomerName(); |
|
|
|
|
if (entrustCustomerName == null || "".equals(entrustCustomerName)) { |
|
|
|
|
@ -1619,7 +1622,52 @@ public class EntrustController extends BladeController { |
|
|
|
|
EntrustCustomer byId = customerService.getById(entrustCustomerId); |
|
|
|
|
entrust.setEntrustCustomerName(byId.getName()); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
// 如果受检单位的id没值,但名称有值,需要:1.将受检单位入库,2.将新的受检单位的id和给到委托单的受检单位字段上
|
|
|
|
|
if (entrustCustomerId == null || "".equals(entrustCustomerId)) { |
|
|
|
|
// 1
|
|
|
|
|
EntrustCustomer customer = new EntrustCustomer(); |
|
|
|
|
long customerId = RandomUtils.nextLong(); |
|
|
|
|
customer.setId(customerId); |
|
|
|
|
customer.setName(entrustCustomerName); |
|
|
|
|
customer.setAddress(entrust.getCustomeAddress()); |
|
|
|
|
customer.setEmail(entrust.getPostalCode()); |
|
|
|
|
customer.setPhone(entrust.getPhone()); |
|
|
|
|
customer.setFax(entrust.getFacsimile()); |
|
|
|
|
customer.setFullName(entrust.getSubmittedBy()); |
|
|
|
|
customer.setStatus(1); |
|
|
|
|
customerService.save(customer); |
|
|
|
|
// 2
|
|
|
|
|
entrust.setEntrustCustomerId(customerId); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 采样单位相关
|
|
|
|
|
Long entrustTakeCompanyId = entrust.getTakeCompanyId(); |
|
|
|
|
String takeCompany = entrust.getTakeCompany(); |
|
|
|
|
if (takeCompany == null || "".equals(takeCompany)) { |
|
|
|
|
if (entrustTakeCompanyId != null) { |
|
|
|
|
EntrustCustomer byId = customerService.getById(entrustTakeCompanyId); |
|
|
|
|
entrust.setEntrustCustomerName(byId.getName()); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
// 如果采样单位的id没值,但名称有值,需要:1.将受检单位入库,2.将新的采样单位的id和给到委托单的采样单位字段上
|
|
|
|
|
if (entrustTakeCompanyId == null || "".equals(entrustTakeCompanyId)) { |
|
|
|
|
// 1
|
|
|
|
|
EntrustCustomer takeCompanyObj = new EntrustCustomer(); |
|
|
|
|
long takeCompanyId = RandomUtils.nextLong(); |
|
|
|
|
takeCompanyObj.setId(takeCompanyId); |
|
|
|
|
takeCompanyObj.setName(takeCompany); |
|
|
|
|
takeCompanyObj.setAddress(entrust.getTakeCompanyAddress()); |
|
|
|
|
takeCompanyObj.setPhone(entrust.getTakePhone()); |
|
|
|
|
takeCompanyObj.setFullName(entrust.getTakePerson()); |
|
|
|
|
takeCompanyObj.setStatus(2); |
|
|
|
|
customerService.save(takeCompanyObj); |
|
|
|
|
// 2
|
|
|
|
|
entrust.setTakeCompanyId(takeCompanyId); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (entrust.getSampleReceiverId() != null && !"".equals(entrust.getSampleReceiverId())) { |
|
|
|
|
R<User> userR = userClient.userInfoById(Long.valueOf(entrust.getSampleReceiverId())); |
|
|
|
|
User data = userR.getData(); |
|
|
|
|
|