Commit 2aabbf60 authored by suhuiguang's avatar suhuiguang

1.字典增加字段落code 和 name

2.数据脚本整理
parent 2638fced
...@@ -33,6 +33,9 @@ public class BaseUnitLicenceDto extends BaseDto { ...@@ -33,6 +33,9 @@ public class BaseUnitLicenceDto extends BaseDto {
@ApiModelProperty(value = "证书类型") @ApiModelProperty(value = "证书类型")
private String certType; private String certType;
@ApiModelProperty(value = "证书类型code")
private String certTypeCode;
@ApiModelProperty(value = "证书编号") @ApiModelProperty(value = "证书编号")
private String certNo; private String certNo;
...@@ -45,9 +48,18 @@ public class BaseUnitLicenceDto extends BaseDto { ...@@ -45,9 +48,18 @@ public class BaseUnitLicenceDto extends BaseDto {
@ApiModelProperty(value = "变更日期") @ApiModelProperty(value = "变更日期")
private Date changeDate; private Date changeDate;
@ApiModelProperty(value = "许可评审方式") @ApiModelProperty(value = "许可方式/许可状态")
private String applyType; private String applyType;
@ApiModelProperty(value = "许可方式/许可状态code")
private String applyTypeCode;
@ApiModelProperty(value = "许可评审方式")
private String appraisalType;
@ApiModelProperty(value = "许可评审方式code")
private String appraisalTypeCode;
@ApiModelProperty(value = "备注") @ApiModelProperty(value = "备注")
private String remark; private String remark;
...@@ -66,7 +78,16 @@ public class BaseUnitLicenceDto extends BaseDto { ...@@ -66,7 +78,16 @@ public class BaseUnitLicenceDto extends BaseDto {
@ApiModelProperty(value = "许可参数/充装介质名称") @ApiModelProperty(value = "许可参数/充装介质名称")
private String parameter; private String parameter;
@ApiModelProperty(value = "许可参数/充装介质code")
private String parameterCode;
@ApiModelProperty(value = "固定检验地址") @ApiModelProperty(value = "固定检验地址")
private String itemAddress; private String itemAddress;
@ApiModelProperty(value = "发证机关")
private String approvedOrgan;
@ApiModelProperty(value = "发证机关code")
private String approvedOrganCode;
} }
...@@ -46,6 +46,13 @@ public class BaseUnitLicence extends BaseEntity { ...@@ -46,6 +46,13 @@ public class BaseUnitLicence extends BaseEntity {
@TableField("cert_type") @TableField("cert_type")
private String certType; private String certType;
/**
* 证书类型code
*/
@TableField("cert_type_code")
private String certTypeCode;
/** /**
* 证书编号 * 证书编号
*/ */
...@@ -112,10 +119,27 @@ public class BaseUnitLicence extends BaseEntity { ...@@ -112,10 +119,27 @@ public class BaseUnitLicence extends BaseEntity {
@TableField("parameter") @TableField("parameter")
private String parameter; private String parameter;
/**
* 许可参数/充装介质code
*/
@TableField("parameterCode")
private String parameterCode;
/** /**
* 固定检验地址 * 固定检验地址
*/ */
@TableField("item_address") @TableField("item_address")
private String itemAddress; private String itemAddress;
/**
* 发证机关
*/
private String approvedOrgan;
/**
* 发证机关code
*/
private String approvedOrganCode;
} }
...@@ -33,10 +33,16 @@ public class RegUnitIcDto extends BaseDto { ...@@ -33,10 +33,16 @@ public class RegUnitIcDto extends BaseDto {
@ApiModelProperty(value = "登记机关") @ApiModelProperty(value = "登记机关")
private String registeredOrgan; private String registeredOrgan;
@ApiModelProperty(value = "登记机关编码")
private String registeredOrganCode;
@ApiModelProperty(value = "核准时间") @ApiModelProperty(value = "核准时间")
private Date approvedDate; private Date approvedDate;
@ApiModelProperty(value = "经状态:在业、吊销、注销、迁入、迁出、停业、清算") @ApiModelProperty(value = "经状态:在业、吊销、注销、迁入、迁出、停业、清算")
private String businessState; private String businessState;
@ApiModelProperty(value = "经营状态code")
private String businessStateCode;
} }
...@@ -112,6 +112,10 @@ public class RegUnitInfoDto extends BaseDto { ...@@ -112,6 +112,10 @@ public class RegUnitInfoDto extends BaseDto {
@ApiModelProperty(value = "行政许可") @ApiModelProperty(value = "行政许可")
private List<BaseUnitLicenceDto> unitLicences; private List<BaseUnitLicenceDto> unitLicences;
@ApiModelProperty(value = "机场单位id") @ApiModelProperty(value = "平台公司id,平台创建公司后更新")
private Long orgUserId; private String amosCompanySeq;
@ApiModelProperty(value = "平台用户id,平台创建用户后更新")
private String adminUserId;
} }
...@@ -42,21 +42,34 @@ public class RegUnitIc extends BaseEntity { ...@@ -42,21 +42,34 @@ public class RegUnitIc extends BaseEntity {
private String industryName; private String industryName;
/** /**
* 登记机关 * 登记机关名称
*/ */
@TableField("registered_organ") @TableField("registered_organ")
private String registeredOrgan; private String registeredOrgan;
/** /**
* 登记机关code
*/
@TableField("registered_organ_code")
private String registeredOrganCode;
/**
* 核准时间 * 核准时间
*/ */
@TableField("approved_date") @TableField("approved_date")
private Date approvedDate; private Date approvedDate;
/** /**
* 经验状态:在业、吊销、注销、迁入、迁出、停业、清算 * 经营状态名称:在业、吊销、注销、迁入、迁出、停业、清算
*/ */
@TableField("business_state") @TableField("business_state")
private String businessState; private String businessState;
/**
* 经营状态code
*/
@TableField("business_state_code")
private String businessStateCode;
} }
...@@ -183,7 +183,15 @@ public class RegUnitInfo extends BaseEntity { ...@@ -183,7 +183,15 @@ public class RegUnitInfo extends BaseEntity {
@TableField("state") @TableField("state")
private String state; private String state;
@TableField("org_user_id") /**
private Long orgUserId; * 平台公司id,平台创建公司后更新
*/
@TableField("amos_company_seq")
private String amosCompanySeq;
/**
* 平台用户id,平台创建用户后更新
*/
private String adminUserId;
} }
...@@ -43,4 +43,11 @@ public interface IRegUnitInfoService { ...@@ -43,4 +43,11 @@ public interface IRegUnitInfoService {
* @return 组织架构中单位级别为:省级、地市级、区县级的单位 * @return 组织架构中单位级别为:省级、地市级、区县级的单位
*/ */
Collection<CompanyModel> getManagementUnitTree(); Collection<CompanyModel> getManagementUnitTree();
/**
* 单位注销
* @param unitCode 单位唯一标识
* @return 是否成功
*/
Boolean unitLogOut(String unitCode);
} }
...@@ -22,6 +22,7 @@ import org.typroject.tyboot.core.restful.exception.instance.BadRequest; ...@@ -22,6 +22,7 @@ import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.ws.rs.DELETE;
import java.util.Collection; import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -150,4 +151,12 @@ public class RegUnitInfoController extends BaseController { ...@@ -150,4 +151,12 @@ public class RegUnitInfoController extends BaseController {
} }
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@DeleteMapping(value = "/{unitCode}/logOut")
@ApiOperation(httpMethod = "DELETE", value = "企业注销", notes = "企业注销")
public ResponseModel unitLogOut(@PathVariable String unitCode){
return ResponseHelper.buildResponse(iRegUnitInfoService.unitLogOut(unitCode));
}
} }
...@@ -28,6 +28,7 @@ import com.yeejoin.amos.feign.privilege.Privilege; ...@@ -28,6 +28,7 @@ import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.CompanyModel; import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import com.yeejoin.amos.feign.privilege.model.RoleModel; import com.yeejoin.amos.feign.privilege.model.RoleModel;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -66,14 +67,14 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI ...@@ -66,14 +67,14 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
TzBaseEnterpriseInfoServiceImpl tzBaseEnterpriseInfoService; TzBaseEnterpriseInfoServiceImpl tzBaseEnterpriseInfoService;
/** /**
* 使用单位的类型,数据来源:cb_data_dictionary code = 1051 * 使用单位的类型,数据来源:cb_data_dictionary code = 1232
*/ */
private static String USE_UNIT_TYPE_CODE = "1051"; private static String USE_UNIT_TYPE_CODE = "1232";
/** /**
* 单位类型,数据来源:cb_data_dictionary type = UNIT_TYPE * 单位类型,数据来源:cb_data_dictionary type = UNIT_TYPE
*/ */
private static String DICT_TYPE_UNIT_TYPE = "UNIT_TYPE"; private static String DICT_TYPE_UNIT_TYPE = "UNIT_TYPE_NEW";
@Override @Override
...@@ -105,7 +106,7 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI ...@@ -105,7 +106,7 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
if (UnitReviewStateEnum.NO_NEED_REVIEW.getCode().equals(model.getState())) { if (UnitReviewStateEnum.NO_NEED_REVIEW.getCode().equals(model.getState())) {
// 4.1 自动创建:调用平台进行创建单位、用户信息 // 4.1 自动创建:调用平台进行创建单位、用户信息
this.createCompanyAndUser(regUnitInfo); this.createCompanyAndUser(regUnitInfo);
// 4.2 todo 同步用户信息 需要吴江提交表相关代码 // 4.2 创建企业信息
this.createBaseEnterpriseInfo(model); this.createBaseEnterpriseInfo(model);
} }
this.save(regUnitInfo); this.save(regUnitInfo);
...@@ -127,12 +128,12 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI ...@@ -127,12 +128,12 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
baseEnterpriseInfo.setCity(regUnitInfo.getCity()); baseEnterpriseInfo.setCity(regUnitInfo.getCity());
baseEnterpriseInfo.setDistrict(regUnitInfo.getDistrict()); baseEnterpriseInfo.setDistrict(regUnitInfo.getDistrict());
baseEnterpriseInfo.setStreet(regUnitInfo.getStree()); baseEnterpriseInfo.setStreet(regUnitInfo.getStree());
baseEnterpriseInfo.setCommunity(regUnitInfo.getCommunity()) ; baseEnterpriseInfo.setCommunity(regUnitInfo.getCommunity());
baseEnterpriseInfo.setAddress(regUnitInfo.getAddress()) ; baseEnterpriseInfo.setAddress(regUnitInfo.getAddress());
baseEnterpriseInfo.setLegalPerson(regUnitInfo.getLegalPerson()) ; baseEnterpriseInfo.setLegalPerson(regUnitInfo.getLegalPerson());
baseEnterpriseInfo.setLegalPhone(regUnitInfo.getLegalPersonTel()) ; baseEnterpriseInfo.setLegalPhone(regUnitInfo.getLegalPersonTel());
baseEnterpriseInfo.setUseContact(regUnitInfo.getContactPerson()) ; baseEnterpriseInfo.setUseContact(regUnitInfo.getContactPerson());
baseEnterpriseInfo.setContactPhone(regUnitInfo.getContactPersonTel()) ; baseEnterpriseInfo.setContactPhone(regUnitInfo.getContactPersonTel());
baseEnterpriseInfo.setLongitude(regUnitInfo.getLongitude()); baseEnterpriseInfo.setLongitude(regUnitInfo.getLongitude());
baseEnterpriseInfo.setLatitude(regUnitInfo.getLatitude()); baseEnterpriseInfo.setLatitude(regUnitInfo.getLatitude());
baseEnterpriseInfo.setGoverningBody(regUnitInfo.getManagementUnit()); baseEnterpriseInfo.setGoverningBody(regUnitInfo.getManagementUnit());
...@@ -177,17 +178,46 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI ...@@ -177,17 +178,46 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
public Collection<CompanyModel> getManagementUnitTree() { public Collection<CompanyModel> getManagementUnitTree() {
// 组织架构中单位级别为:省级、地市级、区县级的单位 // 组织架构中单位级别为:省级、地市级、区县级的单位
Collection<CompanyModel> companyModels = Privilege.companyClient.companyTreeWithoutAuth().getResult(); Collection<CompanyModel> companyModels = Privilege.companyClient.companyTreeWithoutAuth().getResult();
return companyModels.stream().filter(c-> "headquarter".equals(c.getLevel()) || "prefecture-level".equals(c.getLevel()) || "county".equals(c.getLevel())).peek(n->{ return companyModels.stream().filter(c -> "headquarter".equals(c.getLevel()) || "prefecture-level".equals(c.getLevel()) || "county".equals(c.getLevel())).peek(n -> {
this.dealChildCompany(n.getChildren()); this.dealChildCompany(n.getChildren());
}).collect(Collectors.toList()); }).collect(Collectors.toList());
} }
private void dealChildCompany(Collection children){ @Override
children.stream().filter(n->{ @Transactional(rollbackFor = Exception.class)
CompanyModel c = JSONObject.parseObject(JSON.toJSONString(n),CompanyModel.class); public Boolean unitLogOut(String unitCode) {
RegUnitInfo regUnitInfo = this.getOne(new LambdaQueryWrapper<RegUnitInfo>().eq(RegUnitInfo::getUnitCode, unitCode));
if(regUnitInfo == null){
return Boolean.FALSE;
}
tzsAuthServiceImpl.setRequestContext();
String companyId = regUnitInfo.getAmosCompanySeq();
// 1.删除已经创建的 企业信息
if (StringUtils.isNotEmpty(companyId)) {
CompanyModel companyModel = Privilege.companyClient.seleteOne(Long.parseLong(companyId)).getResult();
if (companyModel != null) {
Privilege.companyClient.deleteCompany(companyId);
}
}
// 2.删除管理员账号
Privilege.agencyUserClient.multDeleteUser(regUnitInfo.getAdminUserId());
// 3.企业注册表删除
this.remove(new LambdaQueryWrapper<RegUnitInfo>().eq(RegUnitInfo::getUnitCode, unitCode));
// 4.工商信息表删除
regUnitIcService.remove(new LambdaQueryWrapper<RegUnitIc>().eq(RegUnitIc::getUnitCode, unitCode));
// 5.许可信息删除
baseUnitLicenceService.remove(new LambdaQueryWrapper<BaseUnitLicence>().eq(BaseUnitLicence::getUnitCode, unitCode));
// 6.企业数据信息 删除
tzBaseEnterpriseInfoService.remove(new LambdaQueryWrapper<TzBaseEnterpriseInfo>().eq(TzBaseEnterpriseInfo::getUseCode, unitCode));
return Boolean.TRUE;
}
private void dealChildCompany(Collection children) {
children.stream().filter(n -> {
CompanyModel c = JSONObject.parseObject(JSON.toJSONString(n), CompanyModel.class);
return "headquarter".equals(c.getLevel()) || "prefecture-level".equals(c.getLevel()) || "county".equals(c.getLevel()); return "headquarter".equals(c.getLevel()) || "prefecture-level".equals(c.getLevel()) || "county".equals(c.getLevel());
}).peek(n->{ }).peek(n -> {
CompanyModel c = JSONObject.parseObject(JSON.toJSONString(n),CompanyModel.class); CompanyModel c = JSONObject.parseObject(JSON.toJSONString(n), CompanyModel.class);
dealChildCompany(c.getChildren() != null ? new ArrayList() : c.getChildren()); dealChildCompany(c.getChildren() != null ? new ArrayList() : c.getChildren());
}).collect(Collectors.toList()); }).collect(Collectors.toList());
} }
...@@ -229,7 +259,7 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI ...@@ -229,7 +259,7 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
String unitTypeCode = regUnitInfo.getUnitTypeCode(); String unitTypeCode = regUnitInfo.getUnitTypeCode();
// 根据unitTypeCode 获取应用和角色 数据字典配置 // 根据unitTypeCode 获取应用和角色 数据字典配置
DataDictionary unitType = iDataDictionaryService.getOne(new LambdaQueryWrapper<DataDictionary>().eq(DataDictionary::getCode, unitTypeCode)); DataDictionary unitType = iDataDictionaryService.getOne(new LambdaQueryWrapper<DataDictionary>().eq(DataDictionary::getCode, unitTypeCode));
String appCode = unitType.getTypeDesc() != null ? unitType.getTypeDesc(): ""; String appCode = unitType.getTypeDesc() != null ? unitType.getTypeDesc() : "";
String[] appCodes = appCode.split(","); String[] appCodes = appCode.split(",");
Set<String> appCodesSet = new HashSet<>(); Set<String> appCodesSet = new HashSet<>();
Collections.addAll(appCodesSet, appCodes); Collections.addAll(appCodesSet, appCodes);
...@@ -268,6 +298,7 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI ...@@ -268,6 +298,7 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
org.setAmosOrgId(companyInfo.getSequenceNbr() + ""); org.setAmosOrgId(companyInfo.getSequenceNbr() + "");
org.setAmosOrgCode(companyInfo.getOrgCode()); org.setAmosOrgCode(companyInfo.getOrgCode());
iOrgUsrService.save(org); iOrgUsrService.save(org);
regUnitInfo.setOrgUserId(org.getSequenceNbr()); regUnitInfo.setAdminUserId(userResult.getResult().getUserId());
regUnitInfo.setAmosCompanySeq(companyInfo.getSequenceNbr().toString());
} }
} }
\ No newline at end of file
...@@ -7,4 +7,5 @@ ...@@ -7,4 +7,5 @@
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.4.xsd"> http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.4.xsd">
<include file="tzs-1.0.0.0.xml" relativeToChangelogFile="true"/> <include file="tzs-1.0.0.0.xml" relativeToChangelogFile="true"/>
<include file="tzs-1.0.0.1.xml" relativeToChangelogFile="true"/>
</databaseChangeLog> </databaseChangeLog>
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