Compare commits
2 Commits
5531797462
...
7e7c063b94
| Author | SHA1 | Date |
|---|---|---|
|
|
7e7c063b94 | |
|
|
dfff500352 |
|
|
@ -1,12 +1,16 @@
|
|||
package org.qinan.safetyeval.app.change.convertor;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.Named;
|
||||
import org.qinan.safetyeval.client.co.QualFilingChangeAggregationCO;
|
||||
import org.qinan.safetyeval.client.dto.QualFilingChangeAddCmd;
|
||||
import org.qinan.safetyeval.domain.entity.QualFilingChangeEntity;
|
||||
import org.qinan.safetyeval.domain.entity.QualFilingEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 备案变更基本信息命令转换
|
||||
*
|
||||
|
|
@ -21,6 +25,7 @@ public interface QualFilingChangeCmdConvertor {
|
|||
* @param qualFilingChangeAddCmd
|
||||
* @return
|
||||
*/
|
||||
@Mapping(target = "businessScope", source = "businessScope", qualifiedByName = "listToJsonString")
|
||||
QualFilingChangeEntity convertCmdToE(QualFilingChangeAddCmd qualFilingChangeAddCmd);
|
||||
|
||||
/**
|
||||
|
|
@ -41,5 +46,16 @@ public interface QualFilingChangeCmdConvertor {
|
|||
* @param changeEntity changeEntity
|
||||
* @return QualFilingChangeAggregationCO
|
||||
*/
|
||||
@Mapping(target = "businessScope", source = "businessScope", qualifiedByName = "jsonStringToList")
|
||||
QualFilingChangeAggregationCO convertChangeEToQualFilingChangeAggregationCO(QualFilingChangeEntity changeEntity);
|
||||
|
||||
@Named("listToJsonString")
|
||||
default String listToJsonString(List<String> list) {
|
||||
return list == null ? null : JSON.toJSONString(list);
|
||||
}
|
||||
|
||||
@Named("jsonStringToList")
|
||||
default List<String> jsonStringToList(String json) {
|
||||
return json == null || json.isEmpty() ? null : JSON.parseArray(json, String.class);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package org.qinan.safetyeval.app.executor;
|
|||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import org.qinan.safetyeval.app.change.convertor.*;
|
||||
import org.qinan.safetyeval.app.orchestrator.QualFilingOrchestrator;
|
||||
import org.qinan.safetyeval.client.api.QualFilingChangeApi;
|
||||
|
|
@ -99,7 +100,7 @@ public class QualFilingChangeExecutor implements QualFilingChangeApi {
|
|||
entity.setFilingUnitTypeCode(cmd.getFilingUnitTypeCode());
|
||||
entity.setFilingUnitTypeName(cmd.getFilingUnitTypeName());
|
||||
entity.setFilingNo(cmd.getFilingNo());
|
||||
entity.setBusinessScope(cmd.getBusinessScope());
|
||||
entity.setBusinessScope(JSON.toJSONString(cmd.getBusinessScope()));
|
||||
entity.setRegisterAddress(cmd.getRegisterAddress());
|
||||
entity.setOfficeAddress(cmd.getOfficeAddress());
|
||||
entity.setCreditCode(cmd.getCreditCode());
|
||||
|
|
@ -137,7 +138,7 @@ public class QualFilingChangeExecutor implements QualFilingChangeApi {
|
|||
entity.setFilingUnitTypeCode(cmd.getFilingUnitTypeCode());
|
||||
entity.setFilingUnitTypeName(cmd.getFilingUnitTypeName());
|
||||
entity.setFilingNo(cmd.getFilingNo());
|
||||
entity.setBusinessScope(cmd.getBusinessScope());
|
||||
entity.setBusinessScope(JSON.toJSONString(cmd.getBusinessScope()));
|
||||
entity.setRegisterAddress(cmd.getRegisterAddress());
|
||||
entity.setOfficeAddress(cmd.getOfficeAddress());
|
||||
entity.setCreditCode(cmd.getCreditCode());
|
||||
|
|
@ -650,7 +651,7 @@ public class QualFilingChangeExecutor implements QualFilingChangeApi {
|
|||
co.setFilingUnitTypeCode(entity.getFilingUnitTypeCode());
|
||||
co.setFilingUnitTypeName(entity.getFilingUnitTypeName());
|
||||
co.setFilingNo(entity.getFilingNo());
|
||||
co.setBusinessScope(entity.getBusinessScope());
|
||||
co.setBusinessScope(JSON.parseArray(entity.getBusinessScope(), String.class));
|
||||
co.setRegisterAddress(entity.getRegisterAddress());
|
||||
co.setOfficeAddress(entity.getOfficeAddress());
|
||||
co.setCreditCode(entity.getCreditCode());
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package org.qinan.safetyeval.app.executor;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import org.qinan.safetyeval.app.orchestrator.QualFilingOrchestrator;
|
||||
import org.qinan.safetyeval.client.api.QualFilingApi;
|
||||
import org.qinan.safetyeval.client.change.request.QualFilingCommitmentChangeAddCmd;
|
||||
|
|
@ -68,7 +69,7 @@ public class QualFilingExecutor implements QualFilingApi {
|
|||
entity.setFilingUnitTypeCode(cmd.getFilingUnitTypeCode());
|
||||
entity.setFilingUnitTypeName(cmd.getFilingUnitTypeName());
|
||||
entity.setFilingNo(cmd.getFilingNo());
|
||||
entity.setBusinessScope(cmd.getBusinessScope());
|
||||
entity.setBusinessScope(JSON.toJSONString(cmd.getBusinessScope()));
|
||||
entity.setRegisterAddress(cmd.getRegisterAddress());
|
||||
entity.setOfficeAddress(cmd.getOfficeAddress());
|
||||
entity.setCreditCode(cmd.getCreditCode());
|
||||
|
|
@ -167,6 +168,7 @@ public class QualFilingExecutor implements QualFilingApi {
|
|||
// 拷贝基本信息
|
||||
QualFilingEntity entity = new QualFilingEntity();
|
||||
BeanUtils.copyProperties(cmd.getQualFilingAddCmd(),entity);
|
||||
entity.setBusinessScope(JSON.toJSONString(cmd.getQualFilingAddCmd().getBusinessScope()));
|
||||
//备案承诺书
|
||||
QualFilingCommitmentEntity commitmentEntity = new QualFilingCommitmentEntity();
|
||||
BeanUtils.copyProperties(cmd.getQualFilingCommitmentAddCmd(),commitmentEntity);
|
||||
|
|
@ -213,6 +215,7 @@ public class QualFilingExecutor implements QualFilingApi {
|
|||
QualFilingDO qualFilingDO = qualFilingMapper.selectById(cmd.getFilingId());
|
||||
QualFilingChangeAddCmd qualFilingChangeAddCmd = new QualFilingChangeAddCmd();
|
||||
BeanUtils.copyProperties(qualFilingDO, qualFilingChangeAddCmd, "id");
|
||||
qualFilingChangeAddCmd.setBusinessScope(JSON.parseArray(qualFilingDO.getBusinessScope(), String.class));
|
||||
qualFilingChangeAddCmd.setFilingId(qualFilingDO.getId());
|
||||
cmdSync.setQualFilingChangeAddCmd(qualFilingChangeAddCmd);
|
||||
// 备案承诺书
|
||||
|
|
@ -267,7 +270,7 @@ public class QualFilingExecutor implements QualFilingApi {
|
|||
co.setFilingUnitTypeCode(entity.getFilingUnitTypeCode());
|
||||
co.setFilingUnitTypeName(entity.getFilingUnitTypeName());
|
||||
co.setFilingNo(entity.getFilingNo());
|
||||
co.setBusinessScope(entity.getBusinessScope());
|
||||
co.setBusinessScope(JSON.parseArray(entity.getBusinessScope(), String.class));
|
||||
co.setRegisterAddress(entity.getRegisterAddress());
|
||||
co.setOfficeAddress(entity.getOfficeAddress());
|
||||
co.setCreditCode(entity.getCreditCode());
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
package org.qinan.safetyeval.app.orchestrator;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import org.qinan.safetyeval.app.support.*;
|
||||
import org.qinan.safetyeval.client.co.*;
|
||||
import org.qinan.safetyeval.client.dto.QualFilingModifyCmd;
|
||||
|
|
@ -616,7 +618,7 @@ public class QualFilingOrchestrator {
|
|||
entity.setFilingNo(cmd.getFilingNo());
|
||||
}
|
||||
if (cmd.getBusinessScope() != null) {
|
||||
entity.setBusinessScope(cmd.getBusinessScope());
|
||||
entity.setBusinessScope(JSONUtil.toJsonStr(cmd.getBusinessScope()));
|
||||
}
|
||||
if (cmd.getRegisterAddress() != null) {
|
||||
entity.setRegisterAddress(cmd.getRegisterAddress());
|
||||
|
|
@ -692,7 +694,7 @@ public class QualFilingOrchestrator {
|
|||
co.setFilingUnitTypeCode(entity.getFilingUnitTypeCode());
|
||||
co.setFilingUnitTypeName(entity.getFilingUnitTypeName());
|
||||
co.setFilingNo(entity.getFilingNo());
|
||||
co.setBusinessScope(entity.getBusinessScope());
|
||||
co.setBusinessScope(JSON.parseArray(entity.getBusinessScope(), String.class));
|
||||
co.setRegisterAddress(entity.getRegisterAddress());
|
||||
co.setOfficeAddress(entity.getOfficeAddress());
|
||||
co.setCreditCode(entity.getCreditCode());
|
||||
|
|
|
|||
|
|
@ -3,9 +3,11 @@ package org.qinan.safetyeval.client.co;
|
|||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.qinan.safetyeval.domain.constant.IndustryEnum;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 资质备案申请CO(Client Object)
|
||||
|
|
@ -37,7 +39,7 @@ public class QualFilingCO {
|
|||
private String filingNo;
|
||||
|
||||
@ApiModelProperty(value = "经营范围")
|
||||
private String businessScope;
|
||||
private List<String> businessScope;
|
||||
|
||||
@ApiModelProperty(value = "注册地址")
|
||||
private String registerAddress;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
package org.qinan.safetyeval.client.co;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
|
|
@ -43,7 +45,7 @@ public class QualFilingChangeCO {
|
|||
private String filingNo;
|
||||
|
||||
@ApiModelProperty(value = "经营范围")
|
||||
private String businessScope;
|
||||
private List<String> businessScope;
|
||||
|
||||
@ApiModelProperty(value = "注册地址")
|
||||
private String registerAddress;
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModelProperty;
|
|||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 资质备案申请新增命令
|
||||
|
|
@ -35,7 +36,7 @@ public class QualFilingAddCmd {
|
|||
private String filingNo;
|
||||
|
||||
@ApiModelProperty(value = "备案安全评价业务范围")
|
||||
private String businessScope;
|
||||
private List<String> businessScope;
|
||||
|
||||
@ApiModelProperty(value = "注册地址")
|
||||
private String registerAddress;
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import javax.validation.constraints.Max;
|
|||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 备案变更新增命令
|
||||
|
|
@ -54,8 +55,7 @@ public class QualFilingChangeAddCmd {
|
|||
private String filingNo;
|
||||
|
||||
@ApiModelProperty(value = "备案安全评价业务范围")
|
||||
@Size(max = 512, message = "备案安全评价业务范围不能超过512个字符")
|
||||
private String businessScope;
|
||||
private List<String> businessScope;
|
||||
|
||||
@ApiModelProperty(value = "注册地址")
|
||||
@Size(max = 128, message = "注册地址不能超过128个字符")
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@ package org.qinan.safetyeval.client.dto;
|
|||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
|
|
@ -37,7 +39,7 @@ public class QualFilingChangeModifyCmd {
|
|||
private String filingNo;
|
||||
|
||||
@ApiModelProperty(value = "备案安全评价业务范围")
|
||||
private String businessScope;
|
||||
private List<String> businessScope;
|
||||
|
||||
@ApiModelProperty(value = "注册地址")
|
||||
private String registerAddress;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package org.qinan.safetyeval.client.dto;
|
|||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
|
|
@ -34,7 +35,7 @@ public class QualFilingModifyCmd {
|
|||
private String filingNo;
|
||||
|
||||
@ApiModelProperty(value = "备案安全评价业务范围")
|
||||
private String businessScope;
|
||||
private List<String> businessScope;
|
||||
|
||||
@ApiModelProperty(value = "注册地址")
|
||||
private String registerAddress;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,54 @@
|
|||
package org.qinan.safetyeval.infrastructure.handler;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import org.apache.ibatis.type.BaseTypeHandler;
|
||||
import org.apache.ibatis.type.JdbcType;
|
||||
import org.apache.ibatis.type.MappedJdbcTypes;
|
||||
import org.apache.ibatis.type.MappedTypes;
|
||||
|
||||
import java.sql.CallableStatement;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* MyBatis TypeHandler: 在数据库的 varchar/text 列中以 JSON 数组字符串形式存储 List<String>。
|
||||
* <p>
|
||||
* 入库: List<String> -> JSON.toJSONString -> String
|
||||
* 出库: String -> JSON.parseArray -> List<String>
|
||||
*
|
||||
* @author safety-eval
|
||||
*/
|
||||
@MappedJdbcTypes(JdbcType.VARCHAR)
|
||||
@MappedTypes(List.class)
|
||||
public class JsonStringListTypeHandler extends BaseTypeHandler<List<String>> {
|
||||
|
||||
@Override
|
||||
public void setNonNullParameter(PreparedStatement ps, int i, List<String> parameter, JdbcType jdbcType) throws SQLException {
|
||||
ps.setString(i, JSON.toJSONString(parameter));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getNullableResult(ResultSet rs, String columnName) throws SQLException {
|
||||
return parse(rs.getString(columnName));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getNullableResult(ResultSet rs, int columnIndex) throws SQLException {
|
||||
return parse(rs.getString(columnIndex));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {
|
||||
return parse(cs.getString(columnIndex));
|
||||
}
|
||||
|
||||
private List<String> parse(String json) {
|
||||
if (json == null || json.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return JSON.parseArray(json, String.class);
|
||||
}
|
||||
}
|
||||
|
|
@ -53,7 +53,13 @@
|
|||
`id`, `org_id`, `filing_territory_code`, `filing_territory_name`, `filing_unit_name`, `filing_unit_type_code`, `filing_unit_type_name`, `filing_no`, `business_scope`, `register_address`, `office_address`, `credit_code`, `qual_cert_no`, `legal_person_phone`, `contact_phone`, `info_disclosure_url`, `fixed_asset_amount`, `archive_room_area`, `fulltime_evaluator_count`, `registered_engineer_count`, `workplace_area`, `unit_intro`, `attachment_url`, `origin_filing_id`, `reject_reason`, `submit_time`, `approve_time`, `filing_status_code`, `filing_status_name`, `apply_type_code`, `apply_type_name`, `delete_enum`, `remarks`, `create_name`, `update_name`, `tenant_id`, `version`, `create_time`, `update_time`, `create_id`, `update_id`, `env`
|
||||
</sql>
|
||||
|
||||
<select id="qualificationMonitoringPage" resultType="org.qinan.safetyeval.client.co.QualFilingCO">
|
||||
<!-- CO查询映射结果(business_scope 以 JSON 数组字符串存储,出库时转换为 List<String>) -->
|
||||
<resultMap id="QualFilingCOResultMap" type="org.qinan.safetyeval.client.co.QualFilingCO" autoMapping="true">
|
||||
<result column="business_scope" property="businessScope"
|
||||
typeHandler="org.qinan.safetyeval.infrastructure.handler.JsonStringListTypeHandler"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="qualificationMonitoringPage" resultMap="QualFilingCOResultMap">
|
||||
select info.credit_code as creditCode, info.unit_name as unitName, filing.* from org_info as info
|
||||
left join qual_filing as filing on info.id = filing.org_id
|
||||
where 1=1
|
||||
|
|
|
|||
Loading…
Reference in New Issue