Commit bb4aaf83 authored by suhuiguang's avatar suhuiguang

refact(注册开通):流程调整

1.多次开通时,页面删除证书后,证书未删除 2.增加查询appId接口
parent 29b6ff5c
......@@ -3,7 +3,6 @@ package com.yeejoin.amos.boot.module.common.api.dto;
import com.alibaba.fastjson.JSONArray;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import com.yeejoin.amos.boot.biz.common.dto.DataDictionaryDto;
import com.yeejoin.amos.boot.module.common.api.entity.BaseEnterpriseCert;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -61,4 +60,6 @@ public class BaseEnterpriseCertDto extends BaseDto {
@ApiModelProperty(value = "机构类别")
private String agencyType;
@ApiModelProperty(value = "分类-哪个身份创建的证书")
private String unitType;
}
......@@ -87,4 +87,11 @@ public class BaseEnterpriseCert extends BaseEntity {
*/
@TableField("agency_type")
private String agencyType;
/**
* 分类-哪个身份创建的证书
*/
@TableField("unit_type")
private String unitType;
}
package com.yeejoin.amos.boot.module.jyjc.biz.controller;
import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.common.api.dto.BaseEnterpriseCertDto;
import com.yeejoin.amos.boot.module.jg.api.enums.CompanyTypeEnum;
import com.yeejoin.amos.boot.module.jyjc.api.dto.InspectionCompanyPublicityDto;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcOpeningApplication;
import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcOpeningApplicationModel;
......@@ -67,7 +65,7 @@ public class JyjcOpeningApplicationController extends BaseController {
// 详情保存逻辑
BeanUtil.copyProperties(jsonObject, jyjcOpeningApplicationModel);
}
if(jsonObject.containsKey("buniessInfo") && jsonObject.getJSONObject("buniessInfo") != null){
if (jsonObject.containsKey("buniessInfo") && jsonObject.getJSONObject("buniessInfo") != null) {
JSONObject businessInfo = jsonObject.getJSONObject("buniessInfo");
List<BaseEnterpriseCertDto> baseUnitLicences = businessInfo.getJSONArray("baseUnitLicences")
.toJavaList(BaseEnterpriseCertDto.class);
......@@ -87,7 +85,7 @@ public class JyjcOpeningApplicationController extends BaseController {
} else {
BeanUtil.copyProperties(jsonObject, model);
}
if(jsonObject.containsKey("buniessInfo") && jsonObject.getJSONObject("buniessInfo") != null){
if (jsonObject.containsKey("buniessInfo") && jsonObject.getJSONObject("buniessInfo") != null) {
JSONObject businessInfo = jsonObject.getJSONObject("buniessInfo"); // 注意拼写修正
List<BaseEnterpriseCertDto> baseUnitLicences = businessInfo.getJSONArray("baseUnitLicences")
.toJavaList(BaseEnterpriseCertDto.class);
......@@ -280,7 +278,7 @@ public class JyjcOpeningApplicationController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/v2/users")
@ApiOperation(httpMethod = "GET", value = "查询当前登录人、指定人员类型的人员map结构", notes = "查询当前登录人、指定人员类型的人员map结构,key为jyjcUserInfos代表检验检测人员,chargeUserInfos为检验检测区域负责人")
public ResponseModel<Map<String, List<TzsUserInfoVo>>> getBizUserInfosByUnitCodeV2(@ApiParam(value = "人员类型", allowableValues = "jy,jc,charge" , defaultValue = "jy,jc,charge") @RequestParam(required = false ,defaultValue = "jy,jc,charge") String personType) {
public ResponseModel<Map<String, List<TzsUserInfoVo>>> getBizUserInfosByUnitCodeV2(@ApiParam(value = "人员类型", allowableValues = "jy,jc,charge", defaultValue = "jy,jc,charge") @RequestParam(required = false, defaultValue = "jy,jc,charge") String personType) {
return ResponseHelper.buildResponse(jyjcOpeningApplicationServiceImpl.getUserListByUnitCodeAndPostV2(getCompanyCode(), personType));
}
......@@ -321,4 +319,11 @@ public class JyjcOpeningApplicationController extends BaseController {
jyjcOpeningApplicationServiceImpl.exportData(response, Arrays.asList(ids.split(",")));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getAppId")
@ApiOperation(httpMethod = "GET", value = "获取appId", notes = "获取appId")
public ResponseModel<String> getAppId(@RequestParam(value = "relationId") Long seq) {
String appId = jyjcOpeningApplicationServiceImpl.getAppIdBySeq(seq);
return ResponseHelper.buildResponse(appId);
}
}
......@@ -552,7 +552,12 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
private List<DataDictionaryDto> getBuildItemCode(Long sequenceNbr) {
List<BaseUnitLicence> baseUnitLicences = baseUnitLicenceMapper.selectList(new LambdaQueryWrapper<BaseUnitLicence>()
.eq(BaseUnitLicence::getEnterpriseCertSeq, sequenceNbr).select(BaseUnitLicence::getItemCode, BaseEntity::getSequenceNbr));
.eq(BaseUnitLicence::getEnterpriseCertSeq, sequenceNbr)
.select(BaseUnitLicence::getItemCode,
BaseEntity::getSequenceNbr,
BaseUnitLicence::getItemCode,
BaseUnitLicence::getItemCodeName,
BaseUnitLicence::getDictSeq));
return baseUnitLicences.stream().map(l->{
DataDictionaryDto dto = new DataDictionaryDto();
dto.setCode(l.getItemCode());
......@@ -820,6 +825,7 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
messageModel.setRoutePath(msgDetailPath);
messageModel.setCompanyType(companyType);
messageModel.setIsRead(false);
messageModel.setIsSendWeb(true);
messageFeignClient.create(messageModel);
}
......@@ -833,6 +839,7 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
certDtos.forEach(e -> {
BaseEnterpriseCert cert = new BaseEnterpriseCert();
BeanUtils.copyProperties(e, cert);
cert.setUnitType(Optional.ofNullable(OpenBizTypeEnumV2.getOneByCode(jyjcOpeningApplication.getOpenBizType())).map(OpenBizTypeEnumV2::getUnitType).orElse(null));
cert.setQualificationCertificateAttachment(e.getQualificationCertificateAttachment().toJSONString());
cert.setUnitCode(jyjcOpeningApplication.getUnitCode());
if (cert.getSequenceNbr() == null) {
......@@ -859,12 +866,25 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
});
certs.add(cert);
});
if (!enterpriseCertSeqs.isEmpty()) {
baseUnitLicenceMapper.delete(new LambdaQueryWrapper<BaseUnitLicence>().in(BaseUnitLicence::getEnterpriseCertSeq, enterpriseCertSeqs));
// 没修改前所有的证书(维度单位编码+单位类型)
List<Long> allCertSeqs = enterpriseCertService.list(new LambdaQueryWrapper<BaseEnterpriseCert>()
.eq(BaseEnterpriseCert::getUnitCode, jyjcOpeningApplication.getUnitCode())
.eq(BaseEnterpriseCert::getUnitType, Optional.ofNullable(OpenBizTypeEnumV2.getOneByCode(jyjcOpeningApplication.getOpenBizType()))
.map(OpenBizTypeEnumV2::getUnitType).orElse(null))).stream().map(BaseEnterpriseCert::getSequenceNbr).collect(Collectors.toList());
// 先删除证书下对应的资质
if (!allCertSeqs.isEmpty()) {
baseUnitLicenceMapper.delete(new LambdaQueryWrapper<BaseUnitLicence>().in(BaseUnitLicence::getEnterpriseCertSeq, allCertSeqs));
}
// 再删除掉页面已经删除的证书,保留未删除的
enterpriseCertService.remove(new LambdaQueryWrapper<BaseEnterpriseCert>()
.notIn(!enterpriseCertSeqs.isEmpty(), BaseEntity::getSequenceNbr, enterpriseCertSeqs)
.eq(BaseEnterpriseCert::getUnitCode, jyjcOpeningApplication.getUnitCode())
.eq(BaseEnterpriseCert::getUnitType, Optional.ofNullable(OpenBizTypeEnumV2.getOneByCode(jyjcOpeningApplication.getOpenBizType())).map(OpenBizTypeEnumV2::getUnitType).orElse(null)));
// 保存证书
if (!certs.isEmpty()) {
enterpriseCertService.saveOrUpdateBatch(certs);
}
// 保存资质
if (!licences.isEmpty()) {
licences.parallelStream().forEach(licence -> {
baseUnitLicenceMapper.insert(licence);
......@@ -1202,4 +1222,9 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
}
public String getAppIdBySeq(Long seq) {
TzBaseEnterpriseInfo baseEnterpriseInfo = tzBaseEnterpriseInfoMapper.selectOne(new LambdaQueryWrapper<TzBaseEnterpriseInfo>().eq(TzBaseEnterpriseInfo::getSequenceNbr, seq).select(BaseEntity::getSequenceNbr, TzBaseEnterpriseInfo::getAppId));
return baseEnterpriseInfo.getAppId();
}
}
\ No newline at end of file
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