|
|
@@ -1,13 +1,20 @@
|
|
|
package com.jpsoft.employment.modules.base.controller;
|
|
|
|
|
|
import com.github.pagehelper.Page;
|
|
|
+import com.jpsoft.employment.modules.base.dto.CompanyDTO;
|
|
|
+import com.jpsoft.employment.modules.base.entity.Company;
|
|
|
import com.jpsoft.employment.modules.base.entity.EnterpriseCertificationApprove;
|
|
|
+import com.jpsoft.employment.modules.base.service.CompanyService;
|
|
|
import com.jpsoft.employment.modules.base.service.EnterpriseCertificationApproveService;
|
|
|
import com.jpsoft.employment.modules.common.dto.MessageResult;
|
|
|
import com.jpsoft.employment.modules.common.dto.Sort;
|
|
|
import com.jpsoft.employment.modules.common.utils.PojoUtils;
|
|
|
+import com.jpsoft.employment.modules.sys.entity.User;
|
|
|
+import com.jpsoft.employment.modules.sys.service.UserService;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
+import net.sf.json.JSON;
|
|
|
+import net.sf.json.JSONObject;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
@@ -27,14 +34,22 @@ public class EnterpriseCertificationApproveController {
|
|
|
@Autowired
|
|
|
private EnterpriseCertificationApproveService enterpriseCertificationApproveService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private CompanyService companyService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private UserService userService;
|
|
|
+
|
|
|
@ApiOperation(value="创建空记录")
|
|
|
@GetMapping("create")
|
|
|
- public MessageResult<EnterpriseCertificationApprove> create(){
|
|
|
- MessageResult<EnterpriseCertificationApprove> msgResult = new MessageResult<>();
|
|
|
+ public MessageResult<Company> create(@RequestAttribute String subject){
|
|
|
+ MessageResult<Company> msgResult = new MessageResult<>();
|
|
|
+
|
|
|
+ User user = userService.get(subject);
|
|
|
|
|
|
- EnterpriseCertificationApprove enterpriseCertificationApprove = new EnterpriseCertificationApprove();
|
|
|
+ Company company = companyService.get(user.getCompanyId());
|
|
|
|
|
|
- msgResult.setData(enterpriseCertificationApprove);
|
|
|
+ msgResult.setData(company);
|
|
|
msgResult.setResult(true);
|
|
|
|
|
|
return msgResult;
|
|
|
@@ -42,20 +57,39 @@ public class EnterpriseCertificationApproveController {
|
|
|
|
|
|
@ApiOperation(value="添加信息")
|
|
|
@PostMapping("add")
|
|
|
- public MessageResult<EnterpriseCertificationApprove> add(@RequestBody EnterpriseCertificationApprove enterpriseCertificationApprove,@RequestAttribute String subject){
|
|
|
- MessageResult<EnterpriseCertificationApprove> msgResult = new MessageResult<>();
|
|
|
+ public MessageResult<Company> add(@RequestBody CompanyDTO dto, @RequestAttribute String subject){
|
|
|
+ MessageResult<Company> msgResult = new MessageResult<>();
|
|
|
|
|
|
try {
|
|
|
- enterpriseCertificationApprove.setId(UUID.randomUUID().toString());
|
|
|
- enterpriseCertificationApprove.setDelFlag(false);
|
|
|
- enterpriseCertificationApprove.setCreateBy(subject);
|
|
|
- enterpriseCertificationApprove.setCreateTime(new Date());
|
|
|
-
|
|
|
- int affectCount = enterpriseCertificationApproveService.insert(enterpriseCertificationApprove);
|
|
|
+
|
|
|
+ Company company = companyService.get(dto.getId());
|
|
|
+
|
|
|
+ company.setName(dto.getName());
|
|
|
+ company.setLogo(dto.getLogo());
|
|
|
+ company.setScale(dto.getScale());
|
|
|
+ company.setIndustry(dto.getIndustry());
|
|
|
+
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
+ jsonObject.put("province",dto.getProvince());
|
|
|
+ jsonObject.put("city",dto.getCity());
|
|
|
+ jsonObject.put("zone",dto.getZone());
|
|
|
+
|
|
|
+ company.setArea(jsonObject.toString());
|
|
|
+ company.setAddress(dto.getAddress());
|
|
|
+ company.setTel(dto.getTel());
|
|
|
+ company.setCreditCode(dto.getCreditCode());
|
|
|
+ company.setLegalPerson(dto.getLegalPerson());
|
|
|
+ company.setBusinessLicenseUrl(dto.getBusinessLicenseUrl());
|
|
|
+ company.setCreateBy(subject);
|
|
|
+ company.setCreateTime(new Date());
|
|
|
+ company.setIsCertification(false);
|
|
|
+
|
|
|
+
|
|
|
+ int affectCount = enterpriseCertificationApproveService.updateCompany(company);
|
|
|
|
|
|
if (affectCount > 0) {
|
|
|
msgResult.setResult(true);
|
|
|
- msgResult.setData(enterpriseCertificationApprove);
|
|
|
+ msgResult.setData(company);
|
|
|
} else {
|
|
|
msgResult.setResult(false);
|
|
|
msgResult.setMessage("数据库添加失败");
|