Commit 6387c7be authored by DESKTOP-BQLVS7A\admin's avatar DESKTOP-BQLVS7A\admin

完善企业注册接口,增加许可证号和过期时间,以及增加区域代码拼接,解决企业管理区域内容重复bug

parent 41f6442e
...@@ -97,4 +97,10 @@ public class CompanyDto extends BaseDto { ...@@ -97,4 +97,10 @@ public class CompanyDto extends BaseDto {
@ApiModelProperty(value = "组织机构代码") @ApiModelProperty(value = "组织机构代码")
private String regionCode; private String regionCode;
private String regionCodeP;
private String regionCodeC;
private String regionCodeD;
} }
...@@ -19,11 +19,10 @@ import com.yeejoin.amos.boot.module.ugp.api.Enum.TaskTypeEnum; ...@@ -19,11 +19,10 @@ import com.yeejoin.amos.boot.module.ugp.api.Enum.TaskTypeEnum;
import com.yeejoin.amos.boot.module.ugp.api.constants.XJConstant; import com.yeejoin.amos.boot.module.ugp.api.constants.XJConstant;
import com.yeejoin.amos.boot.module.ugp.api.entity.Company; import com.yeejoin.amos.boot.module.ugp.api.entity.Company;
import com.yeejoin.amos.boot.module.ugp.api.entity.SuperviseRule; import com.yeejoin.amos.boot.module.ugp.api.entity.SuperviseRule;
import com.yeejoin.amos.boot.module.ugp.api.entity.UnitLicence;
import com.yeejoin.amos.boot.module.ugp.api.mapper.CompanyMapper; import com.yeejoin.amos.boot.module.ugp.api.mapper.CompanyMapper;
import com.yeejoin.amos.boot.module.ugp.biz.service.impl.OrgServiceImpl; import com.yeejoin.amos.boot.module.ugp.biz.service.impl.*;
import com.yeejoin.amos.boot.module.ugp.biz.service.impl.SuperviseRuleServiceImpl;
import com.yeejoin.amos.boot.module.ugp.biz.service.impl.TaskServiceImpl;
import com.yeejoin.amos.component.feign.model.FeignClientResult; import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.component.robot.AmosRequestContext; import com.yeejoin.amos.component.robot.AmosRequestContext;
...@@ -31,6 +30,7 @@ import com.yeejoin.amos.component.robot.AmosRequestContext; ...@@ -31,6 +30,7 @@ import com.yeejoin.amos.component.robot.AmosRequestContext;
import com.yeejoin.amos.feign.systemctl.Systemctl; import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.RegionModel; import com.yeejoin.amos.feign.systemctl.model.RegionModel;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -39,7 +39,6 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -39,7 +39,6 @@ import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import java.util.*; import java.util.*;
import com.yeejoin.amos.boot.module.ugp.biz.service.impl.CompanyServiceImpl;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import org.typroject.tyboot.core.foundation.context.RequestContext; import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
...@@ -75,6 +74,9 @@ public class CompanyController extends BaseController { ...@@ -75,6 +74,9 @@ public class CompanyController extends BaseController {
@Autowired @Autowired
OrgServiceImpl orgServiceImpl; OrgServiceImpl orgServiceImpl;
@Autowired
UnitLicenceServiceImpl unitLicenceService;
@Value("${amos.secret.key}") @Value("${amos.secret.key}")
String secretKey; String secretKey;
...@@ -112,27 +114,7 @@ public class CompanyController extends BaseController { ...@@ -112,27 +114,7 @@ public class CompanyController extends BaseController {
@PostMapping(value = "/save") @PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增企业信息表", notes = "新增企业信息表") @ApiOperation(httpMethod = "POST", value = "新增企业信息表", notes = "新增企业信息表")
public ResponseModel<CompanyDto> save(@RequestBody CompanyDto model) { public ResponseModel<CompanyDto> save(@RequestBody CompanyDto model) {
JSONArray jsonArray = model.getLincensePicUrl(); return ResponseHelper.buildResponse(companyServiceImpl.save(model));
List<String> adminLincensePic = new ArrayList<>();
for(Object o : jsonArray){
JSONObject object = JSON.parseObject(JSON.toJSONString(o));
String url = object.getString("url");
adminLincensePic.add(url);
}
model.setApproved(CompanyExamineEnum.企业审核.getNo());
model.setAdminLincensePic(JSON.toJSONString(adminLincensePic));
model.setRecDate(new Date());
model = companyServiceImpl.createWithModel(model);
//获取当前注册企业的区域规则
SuperviseRule superviseRule = superviseRuleService.getOne(new LambdaQueryWrapper<SuperviseRule>().eq(SuperviseRule::getAdminRegionCode,model.getRegionCode()));
List<Long> unitIds = new ArrayList<>();
unitIds.add(superviseRule.getSuperviseDeptId());
unitIds.add(superviseRule.getInspectionUnitId());
//新增企业审核任务信息
taskService.saveOrUpdateTask(null, false, TaskTypeEnum.企业审核.getKey(), new Date(), model.getSequenceNbr(), TaskTypeEnum.企业审核.getKey(), unitIds);
return ResponseHelper.buildResponse(model);
} }
......
package com.yeejoin.amos.boot.module.ugp.biz.service.impl; package com.yeejoin.amos.boot.module.ugp.biz.service.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams; import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.module.ugp.api.Enum.CompanyExamineEnum;
import com.yeejoin.amos.boot.module.ugp.api.Enum.OrgEnum; import com.yeejoin.amos.boot.module.ugp.api.Enum.OrgEnum;
import com.yeejoin.amos.boot.module.ugp.api.Enum.TaskTypeEnum; import com.yeejoin.amos.boot.module.ugp.api.Enum.TaskTypeEnum;
import com.yeejoin.amos.boot.module.ugp.api.entity.Company; import com.yeejoin.amos.boot.module.ugp.api.entity.Company;
import com.yeejoin.amos.boot.module.ugp.api.entity.SuperviseRule; import com.yeejoin.amos.boot.module.ugp.api.entity.SuperviseRule;
import com.yeejoin.amos.boot.module.ugp.api.entity.UnitLicence;
import com.yeejoin.amos.boot.module.ugp.api.mapper.CompanyMapper; import com.yeejoin.amos.boot.module.ugp.api.mapper.CompanyMapper;
import com.yeejoin.amos.boot.module.ugp.api.mapper.SuperviseRuleMapper; import com.yeejoin.amos.boot.module.ugp.api.mapper.SuperviseRuleMapper;
import com.yeejoin.amos.boot.module.ugp.api.service.ICompanyService; import com.yeejoin.amos.boot.module.ugp.api.service.ICompanyService;
...@@ -64,6 +67,12 @@ public class CompanyServiceImpl extends BaseService<CompanyDto, Company, Company ...@@ -64,6 +67,12 @@ public class CompanyServiceImpl extends BaseService<CompanyDto, Company, Company
@Autowired @Autowired
TaskServiceImpl taskService; TaskServiceImpl taskService;
@Autowired
UnitLicenceServiceImpl unitLicenceService;
@Autowired
CompanyServiceImpl companyServiceImpl;
/** /**
* 列表查询 示例 * 列表查询 示例
*/ */
...@@ -275,4 +284,54 @@ public class CompanyServiceImpl extends BaseService<CompanyDto, Company, Company ...@@ -275,4 +284,54 @@ public class CompanyServiceImpl extends BaseService<CompanyDto, Company, Company
public CompanyDto queryBySeq1(Long sequenceNbr) { public CompanyDto queryBySeq1(Long sequenceNbr) {
return companyMapper.queryBySeq1(sequenceNbr); return companyMapper.queryBySeq1(sequenceNbr);
} }
public CompanyDto save(CompanyDto model){
JSONArray jsonArray = model.getLincensePicUrl();
List<String> adminLincensePic = new ArrayList<>();
Company companys = new Company();
for(Object o : jsonArray){
JSONObject object = JSON.parseObject(JSON.toJSONString(o));
String url = object.getString("url");
adminLincensePic.add(url);
}
model.setApproved(CompanyExamineEnum.企业审核.getNo());
model.setAdminLincensePic(JSON.toJSONString(adminLincensePic));
model.setRecDate(new Date());
if (model.getType().equals(OrgEnum.监检机构.getKey())){
if (model.getRegionCode().equals(model.getRegionCodeD())){
model.setRegionCode(model.getRegionCodeC().concat("#").concat(model.getRegionCode()));
} else if (model.getRegionCode().equals(model.getRegionCodeC())) {
model.setRegionCode(model.getRegionCodeP().concat("#").concat(model.getRegionCode()));
}else {
model.setRegionCode(model.getRegionCode());
}
}
//添加许可证号和有效期
LambdaQueryWrapper<UnitLicence> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(UnitLicence::getUnitCode,model.getCreditCode());
if(!ValidationUtil.isEmpty(unitLicenceService.getOne(wrapper))){
List<UnitLicence> licencesLists = unitLicenceService.list(wrapper);
for (UnitLicence licencesList : licencesLists){
model.setLicenseNumber(licencesList.getCertNo());
model.setExpirationDate(licencesList.getExpiryDate());
}
}
//存入数据
model = companyServiceImpl.createWithModel(model);
//浅拷贝
BeanUtils.copyProperties(model,companys);
//获取当前注册企业的区域规则
String recgionCode = model.getRegionCode().substring(0,6);
SuperviseRule superviseRule = superviseRuleService.getOne(new LambdaQueryWrapper<SuperviseRule>().likeRight(SuperviseRule::getAdminRegionCode,recgionCode));
List<Long> unitIds = new ArrayList<>();
unitIds.add(superviseRule.getSuperviseDeptId());
unitIds.add(superviseRule.getInspectionUnitId());
//新增企业审核任务信息
taskService.saveOrUpdateTask(null, false, TaskTypeEnum.企业审核.getKey(), new Date(), model.getSequenceNbr(), TaskTypeEnum.企业审核.getKey(), unitIds);
return model;
}
} }
\ No newline at end of file
...@@ -14,7 +14,9 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -14,7 +14,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -37,6 +39,7 @@ public class UnitPersonServiceImpl implements IUnitPersonService { ...@@ -37,6 +39,7 @@ public class UnitPersonServiceImpl implements IUnitPersonService {
String companyKey = companyInformation.getType(); String companyKey = companyInformation.getType();
String regionCode = companyInformation.getRegionCode(); String regionCode = companyInformation.getRegionCode();
String unitName = ""; String unitName = "";
String unitForName = "";
if (companyKey.equals(OrgEnum.安装单位.getKey()) || companyKey.equals(OrgEnum.设计单位.getKey()) || companyKey.equals(OrgEnum.建设单位.getKey())) { if (companyKey.equals(OrgEnum.安装单位.getKey()) || companyKey.equals(OrgEnum.设计单位.getKey()) || companyKey.equals(OrgEnum.建设单位.getKey())) {
LambdaQueryWrapper<Company> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<Company> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(Company::getRegionCode, regionCode); wrapper.eq(Company::getRegionCode, regionCode);
...@@ -64,9 +67,11 @@ public class UnitPersonServiceImpl implements IUnitPersonService { ...@@ -64,9 +67,11 @@ public class UnitPersonServiceImpl implements IUnitPersonService {
if(unitName.equals("")){ if(unitName.equals("")){
unitName = unitName.concat(adminRegion.getAdminRegion()); unitName = unitName.concat(adminRegion.getAdminRegion());
} }else {
unitName = unitName.concat("、"+adminRegion.getAdminRegion()); unitName = unitName.concat("、"+adminRegion.getAdminRegion());
} }
}
} }
...@@ -75,19 +80,30 @@ public class UnitPersonServiceImpl implements IUnitPersonService { ...@@ -75,19 +80,30 @@ public class UnitPersonServiceImpl implements IUnitPersonService {
wrapper.eq(SuperviseRule::getInspectionUnitId, companySequenceNbr); wrapper.eq(SuperviseRule::getInspectionUnitId, companySequenceNbr);
List<SuperviseRule> adminRegions = superviseRuleMapper.selectList(wrapper); List<SuperviseRule> adminRegions = superviseRuleMapper.selectList(wrapper);
for (SuperviseRule adminRegion : adminRegions) { for (SuperviseRule adminRegion : adminRegions) {
if (!ValidationUtil.isEmpty(adminRegion.getAdminRegion())){ if (!ValidationUtil.isEmpty(adminRegion.getAdminRegion())) {
if(unitName.equals("")){ if(unitName.equals("")){
unitName = unitName.concat(adminRegion.getAdminRegion()); unitName = unitName.concat(adminRegion.getAdminRegion());
} }else {
unitName = unitName.concat("、"+adminRegion.getAdminRegion()); unitName = unitName.concat("、"+adminRegion.getAdminRegion());
} }
} }
}
}
Set<String> hashSet = new HashSet<>();
for (String unName : unitName.split("、")){
hashSet.add(unName);
}
for (String iName : hashSet){
if(unitForName.equals("")){
unitForName = unitForName+iName;
}else {
unitForName = unitForName.concat("、")+iName;
}
} }
return unitName; return unitForName;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment