Commit bcfc5c6e authored by tianbo's avatar tianbo

Merge remote-tracking branch 'origin/developer' into developer

# Conflicts: # amos-boot-system-tzs/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/biz/service/impl/EquipmentCategoryServiceImpl.java
parents e8b66cc2 d5b15548
......@@ -36,7 +36,7 @@ public interface EquipmentCategoryMapper extends BaseMapper<EquipmentCategory> {
Map<String, Object> getCategoryAndDefineByRecord(@Param("record") String record);
List<Map<String, Object>> getAllUnit(String unitCode);
List<Map<String, Object>> getAllUnit(@Param("unitCodes")List<String> unitCodes);
List<Map<String, Object>> getCategoryData(String level, String orgCode, String companyCode);
......
......@@ -15,4 +15,9 @@ import java.util.List;
public interface SuperviseInfoMapper extends BaseMapper<SuperviseInfo> {
void updateRecordBatch(@Param("recordList") List<String> recordList);
List<String> selectUnitCodeList(@Param("records") List<String> records);
List<String> selectSuperviseCodeList(@Param("records") List<String> records);
void deleteDataAll(@Param("records") List<String> records);
}
......@@ -41,4 +41,6 @@ public interface IEquipmentCategoryService {
List<EquipmentCategoryData> createEquipmentCategoryData();
EquipmentCategoryData updateEquipmentCategoryData(String id);
List<String> deleteBatch(Map<String, Object> map);
}
......@@ -159,8 +159,11 @@
USE_UNIT_CREDIT_CODE is NOT NULL
AND USE_UNIT_CREDIT_CODE <![CDATA[ <> ]]> ''
AND (lengthb(USE_UNIT_CREDIT_CODE)= 15 or lengthb(USE_UNIT_CREDIT_CODE)= 18)
<if test="unitCode !=null and unitCode != ''">
and USE_UNIT_CREDIT_CODE = #{unitCode}
<if test="unitCodes !=null and unitCodes.size>0">
and USE_UNIT_CREDIT_CODE in
<foreach collection="unitCodes" separator="," item="unitCode" open="(" close=")">
#{unitCode}
</foreach>
</if>
GROUP BY use_code
ORDER BY use_code
......
......@@ -8,4 +8,101 @@
#{record}
</foreach>
</update>
<select id="selectUnitCodeList" resultType="java.lang.String">
SELECT
DISTINCT ( USE_UNIT_CREDIT_CODE ) unitCode
FROM
idx_biz_jg_use_info ui
WHERE ui."RECORD" in
<foreach collection="records" separator="," item="record" open="(" close=")">
#{record}
</foreach>
</select>
<select id="selectSuperviseCodeList" resultType="java.lang.String">
SELECT
SUPERVISORY_CODE code
FROM
idx_biz_jg_other_info oi
WHERE oi."RECORD" in
<foreach collection="records" separator="," item="record" open="(" close=")">
#{record}
</foreach>
</select>
<delete id="deleteDataAll" >
delete from idx_biz_jg_use_info where "RECORD" in
<foreach collection="records" separator="," item="record" open="(" close=");">
#{record}
</foreach>
delete from idx_biz_jg_design_info where "RECORD" in
<foreach collection="records" separator="," item="record" open="(" close=");">
#{record}
</foreach>
delete from idx_biz_jg_factory_info where "RECORD" in
<foreach collection="records" separator="," item="record" open="(" close=");">
#{record}
</foreach>
delete from idx_biz_jg_construction_info where "RECORD" in
<foreach collection="records" separator="," item="record" open="(" close=");">
#{record}
</foreach>
delete from idx_biz_jg_register_info where "RECORD" in
<foreach collection="records" separator="," item="record" open="(" close=");">
#{record}
</foreach>
delete from idx_biz_jg_maintenance_record_info where "RECORD" in
<foreach collection="records" separator="," item="record" open="(" close=");">
#{record}
</foreach>
delete from idx_biz_jg_other_info where "RECORD" in
<foreach collection="records" separator="," item="record" open="(" close=");">
#{record}
</foreach>
delete from idx_biz_jg_inspection_detection_info where "RECORD" in
<foreach collection="records" separator="," item="record" open="(" close=");">
#{record}
</foreach>
delete from idx_biz_jg_tech_params_elevator where "RECORD" in
<foreach collection="records" separator="," item="record" open="(" close=");">
#{record}
</foreach>
delete from idx_biz_jg_tech_params_vehicle where "RECORD" in
<foreach collection="records" separator="," item="record" open="(" close=");">
#{record}
</foreach>
delete from idx_biz_jg_tech_params_ropeway where "RECORD" in
<foreach collection="records" separator="," item="record" open="(" close=");">
#{record}
</foreach>
delete from idx_biz_jg_tech_params_rides where "RECORD" in
<foreach collection="records" separator="," item="record" open="(" close=");">
#{record}
</foreach>
delete from idx_biz_jg_tech_params_boiler where "RECORD" in
<foreach collection="records" separator="," item="record" open="(" close=");">
#{record}
</foreach>
delete from idx_biz_jg_tech_params_vessel where "RECORD" in
<foreach collection="records" separator="," item="record" open="(" close=");">
#{record}
</foreach>
delete from idx_biz_jg_tech_params_pipeline where "RECORD" in
<foreach collection="records" separator="," item="record" open="(" close=");">
#{record}
</foreach>
delete from idx_biz_jg_tech_params_lifting where "RECORD" in
<foreach collection="records" separator="," item="record" open="(" close=");">
#{record}
</foreach>
delete from idx_biz_jg_main_parts where "RECORD" in
<foreach collection="records" separator="," item="record" open="(" close=");">
#{record}
</foreach>
delete from idx_biz_jg_protection_devices where "RECORD" in
<foreach collection="records" separator="," item="record" open="(" close=");">
#{record}
</foreach>
</delete>
</mapper>
\ No newline at end of file
......@@ -251,6 +251,19 @@ public class EquipmentCategoryController extends BaseController {
}
/**
* 批量一码通删除数据
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/deleteBatch", method = RequestMethod.POST)
@ApiOperation(httpMethod = "POST", value = "批量删除一码通数据", notes = "批量删除一码通数据")
public ResponseModel<Object> deleteBatch(@RequestBody Map<String,Object> map) {
return ResponseHelper.buildResponse(equipmentCategoryService.deleteBatch(map));
}
/**
* 获取管辖分局树
*
* @return
......
......@@ -56,6 +56,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.context.RequestContext;
......@@ -514,7 +515,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
}
}
}
} else {
} else { // 监管系统申请监管码
String supervisor = createSupervisorCode(city, county, equipCategory);
supervisorCode.append(supervisor);
if (equipCategory.startsWith("3") && !XIAN.equals(city)) {
......@@ -583,23 +584,26 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
Map<String, Object> elevatorMap = equipmentCategoryMapper.getAdministrativeDivision(EquipmentCategoryEnum.XZQHDT.getCode(), county);
String elevator = ObjectUtils.isEmpty(elevatorMap) ? equipmentCategoryMapper.getAdministrativeDivision(EquipmentCategoryEnum.XZQHDT.getCode(), city).get("code").toString() : elevatorMap.get("code").toString();
elevatorCode.append(elevator);
//获取行政区划区县、市是否存在历史96333电梯码
CategoryOtherInfo elevatorOtherInfo = categoryOtherInfoMapper.selectElevatorCode(elevatorCode.toString(), null);
//生成对应96333电梯码
if (!ObjectUtils.isEmpty(elevatorOtherInfo) && elevatorOtherInfo.getCode() != null) {
//获取补零位长度
String elevatorCode1 = elevatorOtherInfo.getCode().substring(2);
long num = Long.valueOf(elevatorCode1) + 1;
int numLength = String.valueOf(num).length();
int a = 5 - numLength;
StringBuilder zero = new StringBuilder();
for (int i = 0; i < a; i++) {
zero.append(EquipmentCategoryEnum.BLW.getCode());
}
zero.append(num);
elevatorCode.append(zero);
} else {
String initCode = elevatorCode + EquipmentCategoryEnum.getValue.get(elevatorCode.toString());
CategoryOtherInfo initSupervisoryCode = categoryOtherInfoMapper.queryInitCode(initCode); // 查询是否已经生成过初始值
if (ValidationUtil.isEmpty(initSupervisoryCode)) {
elevatorCode.append(EquipmentCategoryEnum.getValue.get(elevator));
} else {
//获取行政区划区县、市是否存在历史96333电梯码
CategoryOtherInfo elevatorOtherInfo = categoryOtherInfoMapper.selectElevatorCode(elevatorCode.toString(), null);
if (!ObjectUtils.isEmpty(elevatorOtherInfo) && elevatorOtherInfo.getCode() != null) {
//获取补零位长度
String elevatorCode1 = elevatorOtherInfo.getCode().substring(2);
long num = Long.parseLong(elevatorCode1) + 1;
int numLength = String.valueOf(num).length();
int a = 5 - numLength;
StringBuilder zero = new StringBuilder();
for (int i = 0; i < a; i++) {
zero.append(EquipmentCategoryEnum.BLW.getCode());
}
zero.append(num);
elevatorCode.append(zero);
}
}
return elevatorCode.toString();
}
......@@ -821,9 +825,9 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
return getCategoryData(null);
}
private List<EquipmentCategoryData> getCategoryData(String unitCode) {
private List<EquipmentCategoryData> getCategoryData(List<String> unitCodes) {
List<EquipmentCategoryData> list = new ArrayList<>();
List<Map<String, Object>> allUnitList = equipmentCategoryMapper.getAllUnit(unitCode);
List<Map<String, Object>> allUnitList = equipmentCategoryMapper.getAllUnit(unitCodes);
for (Map<String, Object> map : allUnitList) {
EquipmentCategoryData equipmentCategoryData = new EquipmentCategoryData();
equipmentCategoryData.setOrgBranchCode(map.get("supervise_org_code").toString());
......@@ -878,10 +882,50 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
if(ObjectUtils.isEmpty(unitCode)){
return new EquipmentCategoryData();
}
List<EquipmentCategoryData> equipmentCategoryData = getCategoryData(unitCode);
List<String> unitCodeList = new ArrayList<>();
unitCodeList.add(unitCode);
List<EquipmentCategoryData> equipmentCategoryData = getCategoryData(unitCodeList);
return equipmentCategoryData.get(0);
}
@Override
@Transactional(rollbackFor = Exception.class)
public List<String> deleteBatch(Map<String, Object> map) {
Object recordList = map.get("recordList");
List<String> records = new ArrayList<>();
List<ESEquipmentCategoryDto> list = new ArrayList<>();
if(recordList.toString().contains(",")){
for (String record : (List<String>) recordList) {
records.add(record);
ESEquipmentCategoryDto esEquipmentCategoryDto = new ESEquipmentCategoryDto();
esEquipmentCategoryDto.setSEQUENCE_NBR(record);
list.add(esEquipmentCategoryDto);
}
} else {
records.add(recordList.toString());
ESEquipmentCategoryDto esEquipmentCategoryDto = new ESEquipmentCategoryDto();
esEquipmentCategoryDto.setSEQUENCE_NBR(recordList.toString());
list.add(esEquipmentCategoryDto);
}
//删除监管码表数据
List<String> superviseCodeList = superviseInfoMapper.selectSuperviseCodeList(records);
List<String> unitCodeList = superviseInfoMapper.selectUnitCodeList(records);
if(!ObjectUtils.isEmpty(superviseCodeList)){
supervisoryCodeInfoMapper.delete(new QueryWrapper<SupervisoryCodeInfo>().in("supervisory_code", superviseCodeList));
}
//删除涉及的19张表的数据
superviseInfoMapper.deleteDataAll(records);
// 根据统一信用代码更新总览表
if(!ObjectUtils.isEmpty(unitCodeList)){
getCategoryData(unitCodeList);
}
//删除es中的数据
esEquipmentCategory.deleteAll(list);
return records;
}
//分页查询所有数据
public Page<Map<String, Object>> getAll(Map<String, Object> map) {
......
#DB properties:
spring.datasource.driver-class-name=cn.com.vastbase.Driver
spring.datasource.url=jdbc:vastbase://36.46.137.116:5432/per_tzs_amos_tzs_biz?currentSchema=amos_tzs_biz
spring.datasource.url=jdbc:vastbase://36.46.137.116:5432/per_tzs_amos_tzs_biz?currentSchema=amos_tzs_biz&allowMultiQueries=true
#spring.datasource.url=jdbc:vastbase://36.46.151.113:5432/tzs_amos_tzs_biz_init?currentSchema=amos_tzs_biz
spring.datasource.username=admin
spring.datasource.password=Yeejoin@2023
......@@ -40,14 +41,14 @@ eureka.instance.ip-address = 172.16.3.34
## ES properties:
biz.elasticsearch.port=9200
biz.elasticsearch.address=36.46.151.113
biz.elasticsearch.address=172.16.10.210
spring.data.elasticsearch.cluster-name=docker-cluster
spring.data.elasticsearch.cluster-nodes=${biz.elasticsearch.address}:9300
spring.elasticsearch.rest.uris=http://${biz.elasticsearch.address}:9200
elasticsearch.username= elastic
elasticsearch.password= 123456
elasticsearch.password= a123456
## unit(h)
......
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