Commit 7b19b1ff authored by tianyiming's avatar tianyiming

一码通删除功能补全

parent 3ff9b26a
...@@ -36,7 +36,7 @@ public interface EquipmentCategoryMapper extends BaseMapper<EquipmentCategory> { ...@@ -36,7 +36,7 @@ public interface EquipmentCategoryMapper extends BaseMapper<EquipmentCategory> {
Map<String, Object> getCategoryAndDefineByRecord(@Param("record") String record); 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); List<Map<String, Object>> getCategoryData(String level, String orgCode, String companyCode);
......
...@@ -5,7 +5,6 @@ import com.yeejoin.amos.boot.module.tzs.api.entity.SuperviseInfo; ...@@ -5,7 +5,6 @@ import com.yeejoin.amos.boot.module.tzs.api.entity.SuperviseInfo;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 特种设备基本信息-监督管理信息 Mapper 接口 * 特种设备基本信息-监督管理信息 Mapper 接口
...@@ -17,7 +16,8 @@ public interface SuperviseInfoMapper extends BaseMapper<SuperviseInfo> { ...@@ -17,7 +16,8 @@ public interface SuperviseInfoMapper extends BaseMapper<SuperviseInfo> {
void updateRecordBatch(@Param("recordList") List<String> recordList); void updateRecordBatch(@Param("recordList") List<String> recordList);
List<Map<String, Object>> selectUnitCodeAndSuperviseCodeList(@Param("records") List<String> records); List<String> selectUnitCodeList(@Param("records") List<String> records);
List<String> selectSuperviseCodeList(@Param("records") List<String> records);
void deleteAll(); void deleteDataAll(@Param("records") List<String> records);
} }
...@@ -159,8 +159,11 @@ ...@@ -159,8 +159,11 @@
USE_UNIT_CREDIT_CODE is NOT NULL USE_UNIT_CREDIT_CODE is NOT NULL
AND USE_UNIT_CREDIT_CODE <![CDATA[ <> ]]> '' AND USE_UNIT_CREDIT_CODE <![CDATA[ <> ]]> ''
AND (lengthb(USE_UNIT_CREDIT_CODE)= 15 or lengthb(USE_UNIT_CREDIT_CODE)= 18) AND (lengthb(USE_UNIT_CREDIT_CODE)= 15 or lengthb(USE_UNIT_CREDIT_CODE)= 18)
<if test="unitCode !=null and unitCode != ''"> <if test="unitCodes !=null and unitCodes != ''">
and USE_UNIT_CREDIT_CODE = #{unitCode} and USE_UNIT_CREDIT_CODE in
<foreach collection="unitCodes" separator="," item="unitCode" open="(" close=")">
#{unitCode}
</foreach>
</if> </if>
GROUP BY use_code GROUP BY use_code
ORDER BY use_code ORDER BY use_code
......
...@@ -9,24 +9,100 @@ ...@@ -9,24 +9,100 @@
</foreach> </foreach>
</update> </update>
<select id="selectUnitCodeAndSuperviseCodeList" resultType="java.util.Map"> <select id="selectUnitCodeList" resultType="java.lang.String">
SELECT SELECT
USE_UNIT_CREDIT_CODE unitCode, DISTINCT ( USE_UNIT_CREDIT_CODE ) unitCode
SUPERVISORY_CODE code
FROM FROM
idx_biz_jg_use_info ui LEFT JOIN idx_biz_jg_other_info oi ON ui."RECORD" = oi."RECORD" idx_biz_jg_use_info ui
WHERE ui."RECORD" in WHERE ui."RECORD" in
<foreach collection="records" separator="," item="record" open="(" close=")"> <foreach collection="records" separator="," item="record" open="(" close=")">
#{record} #{record}
</foreach> </foreach>
</select> </select>
<delete id="deleteAll" > <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 delete from idx_biz_jg_use_info where "RECORD" in
<foreach collection="records" separator="," item="record" open="(" close=");"> <foreach collection="records" separator="," item="record" open="(" close=");">
#{record} #{record}
</foreach> </foreach>
delete from idx_biz_jg_other_info where "RECORD" = '102410241024'; delete from idx_biz_jg_design_info where "RECORD" in
delete from idx_biz_jg_register_info where "RECORD" = '102410241024'; <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> </delete>
</mapper> </mapper>
\ No newline at end of file
...@@ -255,7 +255,7 @@ public class EquipmentCategoryController extends BaseController { ...@@ -255,7 +255,7 @@ public class EquipmentCategoryController extends BaseController {
* *
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/deleteBatch", method = RequestMethod.POST) @RequestMapping(value = "/deleteBatch", method = RequestMethod.POST)
@ApiOperation(httpMethod = "POST", value = "批量删除一码通数据", notes = "批量删除一码通数据") @ApiOperation(httpMethod = "POST", value = "批量删除一码通数据", notes = "批量删除一码通数据")
public ResponseModel<Object> deleteBatch(@RequestBody Map<String,Object> map) { public ResponseModel<Object> deleteBatch(@RequestBody Map<String,Object> map) {
......
...@@ -47,6 +47,7 @@ import org.springframework.beans.factory.annotation.Value; ...@@ -47,6 +47,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource; import org.springframework.core.io.Resource;
import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.context.RequestContext; import org.typroject.tyboot.core.foundation.context.RequestContext;
...@@ -798,9 +799,9 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -798,9 +799,9 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
return getCategoryData(null); return getCategoryData(null);
} }
private List<EquipmentCategoryData> getCategoryData(String unitCode) { private List<EquipmentCategoryData> getCategoryData(List<String> unitCodes) {
List<EquipmentCategoryData> list = new ArrayList<>(); 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) { for (Map<String, Object> map : allUnitList) {
EquipmentCategoryData equipmentCategoryData = new EquipmentCategoryData(); EquipmentCategoryData equipmentCategoryData = new EquipmentCategoryData();
equipmentCategoryData.setOrgBranchCode(map.get("supervise_org_code").toString()); equipmentCategoryData.setOrgBranchCode(map.get("supervise_org_code").toString());
...@@ -855,26 +856,48 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -855,26 +856,48 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
if(ObjectUtils.isEmpty(unitCode)){ if(ObjectUtils.isEmpty(unitCode)){
return new EquipmentCategoryData(); 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); return equipmentCategoryData.get(0);
} }
@Override @Override
@Transactional(rollbackFor = Exception.class)
public List<String> deleteBatch(Map<String, Object> map) { public List<String> deleteBatch(Map<String, Object> map) {
Object recordList = map.get("recordList"); Object recordList = map.get("recordList");
List<String> records = new ArrayList<>(); List<String> records = new ArrayList<>();
List<ESEquipmentCategoryDto> list = new ArrayList<>();
if(recordList.toString().contains(",")){ if(recordList.toString().contains(",")){
for (String record : (List<String>) recordList) { for (String record : (List<String>) recordList) {
records.add(record); records.add(record);
ESEquipmentCategoryDto esEquipmentCategoryDto = new ESEquipmentCategoryDto();
esEquipmentCategoryDto.setSEQUENCE_NBR(record);
list.add(esEquipmentCategoryDto);
} }
} else { } else {
records.add(recordList.toString()); records.add(recordList.toString());
} ESEquipmentCategoryDto esEquipmentCategoryDto = new ESEquipmentCategoryDto();
List<Map<String,Object>> codeList = superviseInfoMapper.selectUnitCodeAndSuperviseCodeList(records); esEquipmentCategoryDto.setSEQUENCE_NBR(recordList.toString());
list.add(esEquipmentCategoryDto);
superviseInfoMapper.deleteAll(); }
//删除监管码表数据
return null; List<String> superviseCodeList = superviseInfoMapper.selectSuperviseCodeList(records);
if(!ObjectUtils.isEmpty(superviseCodeList)){
supervisoryCodeInfoMapper.delete(new QueryWrapper<SupervisoryCodeInfo>().in("supervisory_code", superviseCodeList));
}
//删除涉及的19张表的数据
superviseInfoMapper.deleteDataAll(records);
// 根据统一信用代码更新总览表
List<String> unitCodeList = superviseInfoMapper.selectUnitCodeList(records);
if(!ObjectUtils.isEmpty(unitCodeList)){
getCategoryData(unitCodeList);
}
//删除es中的数据
esEquipmentCategory.deleteAll(list);
return records;
} }
......
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