Commit 276bcc4f authored by litengwei's avatar litengwei

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

parents 3dfc4235 ccd69ce1
......@@ -27,4 +27,8 @@ public interface IDataDictionaryService {
List<DataDictionary> getChildList(String type, String group);
List<DataDictionary> getByParent(String parent);
List<DataDictionary> getByTypeAndDesc(String type, String group);
DataDictionary getByExtend(String groupId, String type);
}
......@@ -13,6 +13,7 @@ import com.yeejoin.amos.boot.biz.common.utils.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.util.Collection;
......@@ -176,4 +177,21 @@ public class DataDictionaryServiceImpl extends BaseService<DataDictionaryDto, Da
queryWrapper.orderByAsc("sort_num");
return this.list(queryWrapper);
}
@Override
public List<DataDictionary> getByTypeAndDesc(String type, String typeDesc) {
LambdaQueryWrapper<DataDictionary> wrapper = new LambdaQueryWrapper<>();
wrapper.likeRight(DataDictionary::getType,type);
wrapper.likeRight(DataDictionary::getTypeDesc,typeDesc);
return this.list(wrapper);
}
@Override
public DataDictionary getByExtend(String groupId, String type) {
LambdaQueryWrapper<DataDictionary> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(DataDictionary::getExtend, groupId);
wrapper.likeRight(DataDictionary::getType, type);
DataDictionary dataDictionary = dataDictionaryMapper.selectOne(wrapper);
return ObjectUtils.isEmpty(dataDictionary) ? new DataDictionary() : dataDictionary;
}
}
......@@ -30,18 +30,18 @@ public class MyBatisPlusCodeGeneratorTzs {
/**
* 拆分服务名 可根据实际拆分项目进行修改
*/
static String ShortName = "ymt";
static String ShortName = "tcm";
/**
* 项目api目录
*/
static String apiAddress = "/amos-boot-system-" + projectShortName + "/" + "amos-boot-module-ymt/" +
static String apiAddress = "/amos-boot-system-" + projectShortName + "/" + "amos-boot-module-" + ShortName + "/" +
"amos-boot-module-" + ShortName + "-api/";
/**
* 项目biz目录
*/
static String bizAddress = "/amos-boot-system-" + projectShortName + "/" + "amos-boot-module-ymt/" +
static String bizAddress = "/amos-boot-system-" + projectShortName + "/" + "amos-boot-module-" + ShortName + "/" +
"amos-boot-module-" + ShortName + "-biz/";
/**
......
......@@ -207,7 +207,7 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
// alertCalledDto.setRegionCode(elevator.getRegionCode());
// }
String voiceRecord = "";
VoiceRecordFile temp = voiceRecordFileServiceImpl.getOne(new LambdaQueryWrapper<VoiceRecordFile>().eq(VoiceRecordFile::getAlertId,id).eq(VoiceRecordFile::getAlertStageCode,"860").orderByAsc(VoiceRecordFile::getRecDate));
VoiceRecordFile temp = voiceRecordFileServiceImpl.getOne(new LambdaQueryWrapper<VoiceRecordFile>().eq(VoiceRecordFile::getAlertId,id).eq(VoiceRecordFile::getAlertStageCode,"860").orderByAsc(VoiceRecordFile::getTelStartTime).last("limit 1"));
if(temp != null) {
voiceRecord = temp.getFilePath();
}
......
......@@ -21,7 +21,7 @@ public class EquBaseInfoForWXModel {
private String county;
@ApiModelProperty(value = "单位内编号")
private String uesInnerCode;
private String useInnerCode;
}
......@@ -6,16 +6,28 @@ import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.app.api.dto.*;
import com.yeejoin.amos.boot.module.app.api.entity.*;
import com.yeejoin.amos.boot.module.app.api.dto.ESEquipmentCategoryDto;
import com.yeejoin.amos.boot.module.app.api.dto.EquInfoDto;
import com.yeejoin.amos.boot.module.app.api.dto.EquipExportDto;
import com.yeejoin.amos.boot.module.app.api.dto.EquipmentCategoryDto;
import com.yeejoin.amos.boot.module.app.api.dto.UseUnitCreditCodeCategoryDto;
import com.yeejoin.amos.boot.module.app.api.entity.CategoryOtherInfo;
import com.yeejoin.amos.boot.module.app.api.entity.EquipmentCategory;
import com.yeejoin.amos.boot.module.app.api.entity.EquipmentCategoryData;
import com.yeejoin.amos.boot.module.app.api.entity.SupervisoryCodeInfo;
import com.yeejoin.amos.boot.module.app.api.entity.UseInfo;
import com.yeejoin.amos.boot.module.app.api.enums.EquimentEnum;
import com.yeejoin.amos.boot.module.app.api.enums.EquipmentCategoryEnum;
import com.yeejoin.amos.boot.module.app.api.enums.EquipmentClassifityEnum;
import com.yeejoin.amos.boot.module.app.api.mapper.*;
import com.yeejoin.amos.boot.module.app.api.mapper.CategoryOtherInfoMapper;
import com.yeejoin.amos.boot.module.app.api.mapper.EquipmentCategoryDataMapper;
import com.yeejoin.amos.boot.module.app.api.mapper.EquipmentCategoryMapper;
import com.yeejoin.amos.boot.module.app.api.mapper.SuperviseInfoMapper;
import com.yeejoin.amos.boot.module.app.api.mapper.SupervisoryCodeInfoMapper;
import com.yeejoin.amos.boot.module.app.api.mapper.UseInfoMapper;
import com.yeejoin.amos.boot.module.app.api.service.IEquipmentCategoryService;
import com.yeejoin.amos.boot.module.app.api.vo.EquipExportVo;
import com.yeejoin.amos.boot.module.app.biz.dao.ESEquipmentCategory;
......@@ -46,15 +58,23 @@ import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StopWatch;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.DateUtil;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.io.IOException;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.StringJoiner;
import java.util.stream.Collectors;
import static com.alibaba.fastjson.JSON.toJSONString;
......@@ -1193,17 +1213,17 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
meBuilder.must(QueryBuilders.matchQuery("EQU_STATE", test));
boolMust.must(meBuilder);
}
if (!ObjectUtils.isEmpty(map.getString("STATUS"))) {
BoolQueryBuilder meBuilder = QueryBuilders.boolQuery();
String test = QueryParser.escape(map.getString("STATUS"));
if (test.contains("非")) {
meBuilder.must(QueryBuilders.matchPhraseQuery("STATUS", test.replace("非", "")));
boolMust.mustNot(meBuilder);
} else {
meBuilder.must(QueryBuilders.matchPhraseQuery("STATUS", test));
boolMust.must(meBuilder);
}
}
// if (!ObjectUtils.isEmpty(map.getString("STATUS"))) {
// BoolQueryBuilder meBuilder = QueryBuilders.boolQuery();
// String test = QueryParser.escape(map.getString("STATUS"));
// if (test.contains("非")) {
// meBuilder.must(QueryBuilders.matchPhraseQuery("STATUS", test.replace("非", "")));
// boolMust.mustNot(meBuilder);
// } else {
// meBuilder.must(QueryBuilders.matchPhraseQuery("STATUS", test));
// boolMust.must(meBuilder);
// }
// }
if (!ObjectUtils.isEmpty(map.getString("CLAIM_STATUS"))) {
BoolQueryBuilder meBuilder = QueryBuilders.boolQuery();
String test = QueryParser.escape(map.getString("CLAIM_STATUS"));
......
......@@ -316,7 +316,9 @@ public class TzsAppService {
if (!ValidationUtil.isEmpty(detailMapList)) {
map = detailMapList.iterator().next();
}
map.putAll(getQRCode(record));
if(!ObjectUtils.isEmpty(model.getResult().getRecords().get(0).get("SUPERVISORY_CODE"))){
map.putAll(getQRCode(model.getResult().getRecords().get(0).get("SUPERVISORY_CODE").toString()));
}
JSONArray jsonArray = new JSONArray();
JSONObject exFactoryJsonObject = new JSONObject();
......
......@@ -6,6 +6,7 @@ import lombok.Getter;
public enum CyclinderStatus {
NOHEGE("3139","不合格"),
NOT_UPLOAD("","未上传"),
HEGE("3140","合格");
private String code;
private String name;
......
......@@ -29,8 +29,10 @@ public interface CylCylinderFillingCheckMapper extends BaseMapper<CylinderFillin
List<CylinderInfo> getCylinderInfoList();
void updateBatch(@Param("sequenceNbrS") List<Long> sequenceNbrS);
List<CylinderFilling> queryUnSyncFilling();
boolean updataSyncFilling(List<String> appIds,List<String> fillingBeforeIds,List<String> sequenceCodes);
boolean updataSyncFilling(@Param("ids") List<Long> appIds);
boolean saveAndBatchInsert(@Param("list") List<CylinderFilling> list);
......@@ -40,5 +42,5 @@ public interface CylCylinderFillingCheckMapper extends BaseMapper<CylinderFillin
void batchInsertOrUpdate(@Param("list") List<CylinderFillingRecord> list);
void updateSyncState(@Param("appIds") List<String> appids, @Param("records")List<String> records);
void updateSyncState(@Param("ids") List<Long> ids);
}
......@@ -29,13 +29,13 @@ public interface TzCylinderMapper extends BaseMapper<CylinderInfo> {
List<TzCylinderInspectionDto> getTzCylinderInspectionDto(String sequenceCode, String appId);
List<TzCylinderFillingDto> getTzCylinderFillingDto(String sequenceCode);
List<TzCylinderFillingDto> getTzCylinderFillingDto(String sequenceCode, String appId);
TzCylinderBeforeCheckDto getTzCylinderBeforeCheck(String fillingBeforeId);
TzCylinderBeforeCheckDto getTzCylinderBeforeCheck(String appId, String fillingBeforeId);
List<TzCylinderCheckDto> getTzCylinderCheckItem();
TzCylinderAfterCheckDto getTzCylinderAfterCheck(String fillingCheckId);
TzCylinderAfterCheckDto getTzCylinderAfterCheck(String appId, String fillingCheckId);
List<TzCylinderCheckDto> getTzCylinderAfterCheckItem();
......
......@@ -62,7 +62,7 @@
<foreach collection="appIdList" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
and filling_record_id in
and filling_check_id in
<foreach collection="fillingCheckIdList" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
......@@ -71,24 +71,29 @@
<update id="updataSyncFilling">
update tm_cylinder_filling set sync_state = 3
<where>
<if test="appIds != null and appIds.size() > 0">
app_id in
<foreach collection="appIds" item="appId" index="index" open="(" close=")" separator=",">
#{appId}
</foreach>
</if>
<if test="fillingBeforeIds != null and fillingBeforeIds.size() > 0">
and filling_before_id in
<foreach collection="fillingBeforeIds" item="fillingBeforeId" index="index" open="(" close=")" separator=",">
#{fillingBeforeId}
</foreach>
</if>
<if test="sequenceCodes != null and sequenceCodes.size() > 0">
and sequence_code in
<foreach collection="sequenceCodes" item="sequenceCode" index="index" open="(" close=")" separator=",">
#{sequenceCode}
</foreach>
</if>
<!-- <if test="appIds != null and appIds.size() > 0">-->
<!-- app_id in-->
<!-- <foreach collection="appIds" item="appId" index="index" open="(" close=")" separator=",">-->
<!-- #{appId}-->
<!-- </foreach>-->
<!-- </if>-->
<!-- <if test="fillingBeforeIds != null and fillingBeforeIds.size() > 0">-->
<!-- and filling_before_id in-->
<!-- <foreach collection="fillingBeforeIds" item="fillingBeforeId" index="index" open="(" close=")" separator=",">-->
<!-- #{fillingBeforeId}-->
<!-- </foreach>-->
<!-- </if>-->
<!-- <if test="sequenceCodes != null and sequenceCodes.size() > 0">-->
<!-- and sequence_code in-->
<!-- <foreach collection="sequenceCodes" item="sequenceCode" index="index" open="(" close=")" separator=",">-->
<!-- #{sequenceCode}-->
<!-- </foreach>-->
<!-- </if>-->
sequence_nbr in
<foreach collection="ids" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</where>
</update>
......@@ -133,8 +138,7 @@
and cf.filling_before_id is not null
and cf.sequence_code is not null
and cf.app_id is not null
ORDER BY
cf.sync_date DESC
LIMIT 1000
</select>
<insert id="saveAndBatchInsert">
......@@ -169,8 +173,8 @@
#{item.sequenceNbr},
#{item.fillingBeforeId},
#{item.fillingUnitName},
#{item.isValid},
#{item.sequenceCode},
#{item.isValid},
#{item.same},
#{item.isRegulations},
#{item.isComplianceWithgbt},
......@@ -217,38 +221,29 @@
nonconformances = EXCLUDED.nonconformances
</insert>
<select id="selectCountTotal" resultType="java.lang.Long">
SELECT COUNT
( 1 )
SELECT
count(1)
FROM
(
SELECT
sequence_nbr
FROM
tm_cylinder_filling_record cfr
WHERE
sync_state != 3
tm_cylinder_filling_record cfr
WHERE
sync_state != 3
AND filling_record_id is not null
GROUP BY
cfr.app_id,
cfr.filling_record_id
)
</select>
<select id="fillingRecordSyncRecords"
resultType="com.yeejoin.amos.boot.module.cylinder.flc.api.entity.CylinderFillingRecord">
SELECT
cfr.*,
'3' sync_state_str,
CAST ((
( filling_record_id IS NOT NULL ) + ( filling_before_id IS NOT NULL ) + ( filling_check_id IS NOT NULL ) + ( filling_examine_id IS NOT NULL ) + ( filling_startTime IS NOT NULL ) + ( filling_endTime IS NOT NULL ) + ( filling_user IS NOT NULL ) + ( inspector_name IS NOT NULL ) + ( filling_quantity IS NOT NULL ) + ( temperature IS NOT NULL ) + ( abnormal IS NOT NULL )
) / 11 AS DECIMAL ( 10, 2 )) integrity
FROM tm_cylinder_filling_record cfr where sync_state !=3 and filling_record_id is not null
ORDER BY cfr.sync_date
LIMIT 5000
LIMIT 1000
</select>
<insert id="batchInsertOrUpdate" >
INSERT INTO tz_cylinder_filling_record_2210 (sequence_nbr,
INSERT INTO tz_cylinder_filling_record (sequence_nbr,
filling_record_id,
filling_starttime,
filling_endtime,
......@@ -318,14 +313,14 @@
<update id="updateSyncState">
update tm_cylinder_filling_record set sync_state = 3
<where>
app_id in
<foreach collection="appIds" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
and filling_record_id in
<foreach collection="records" item="item" index="index" open="(" close=")" separator=",">
sequence_nbr in
<foreach collection="ids" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
<!-- and filling_record_id in-->
<!-- <foreach collection="records" item="item" index="index" open="(" close=")" separator=",">-->
<!-- #{item}-->
<!-- </foreach>-->
</where>
</update>
</mapper>
......@@ -168,7 +168,7 @@
b.sequence_code AS sequenceCode,
b.app_id AS appId,
concat(b.app_id, b.sequence_code) AS appIdAndSequenceCode,
b.filling_unit_name AS fillingUnitName,
tcn.unit_name AS fillingUnitName,
af.inspector AS inspector,
af.inspection_date AS inspectionDateAfter,
af.check_results AS checkResult
......@@ -180,6 +180,7 @@
AND date_format ( b.inspection_date, '%Y-%m-%d' ) = date_format ( r.filling_startTime, '%Y-%m-%d' ) and b.sequence_code is not null AND b.app_id is not null
LEFT JOIN tz_cylinder_filling_check af ON af.filling_check_id = r.filling_check_id
AND date_format ( af.inspection_date, '%Y-%m-%d' ) = date_format ( r.filling_startTime, '%Y-%m-%d' )
LEFT JOIN tz_cylinder_unit tcn ON tcn.app_id = r.app_id
</select>
<select id="getCylinderFillingRecordTotal" resultType="java.lang.Integer">
......
......@@ -5,15 +5,12 @@
<select id="queryNumAndOutOfDateNum" resultType="java.util.Map">
SELECT
count( t.sequence_nbr ) AS cylinderNum,
l.expiry_date AS fillingPermitDate,
(select expiry_date from tz_base_unit_licence where unit_code = u.credit_code ORDER BY expiry_date desc limit 1) AS fillingPermitDate,
count( CASE WHEN i.next_inspection_date <![CDATA[ < ]]> now() THEN 1 END ) AS outOfDateNum
FROM
tz_cylinder_unit U
LEFT JOIN tz_cylinder_info AS t ON t.app_id = u.app_id
LEFT JOIN tz_cylinder_inspection AS i ON i.sequence_code = t.sequence_code
LEFT JOIN (SELECT * FROM tz_base_unit_licence
GROUP BY unit_code
ORDER BY expiry_date DESC) AS l ON l.unit_code = u.credit_code
WHERE
u.sequence_nbr = #{sequenceNbr}
GROUP BY u.sequence_nbr
......
......@@ -166,7 +166,8 @@
LEFT JOIN tz_cylinder_filling AS CF ON CF.filling_before_id = FR.filling_before_id
LEFT JOIN tz_cylinder_filling_check AS FC ON FC.filling_check_id = FR.filling_check_id
WHERE
CF.sequence_code = #{sequence_code}
CF.sequence_code = #{sequenceCode}
and FR.app_id = #{appId}
ORDER BY FR.filling_startTime DESC
</select>
......@@ -181,7 +182,7 @@
CF.have_security_documents,
CF.fill_before_item
FROM tz_cylinder_filling AS CF
WHERE CF.filling_before_id=#{fillingBeforeId}
WHERE CF.app_id=#{appId} and CF.filling_before_id=#{fillingBeforeId}
</select>
<select id="getTzCylinderCheckItem" resultType="com.yeejoin.amos.boot.module.cylinder.flc.api.dto.TzCylinderCheckDto">
......@@ -200,7 +201,7 @@
FC.abnormal_temperature,
FC.warning_sign
FROM tz_cylinder_filling_check AS FC
WHERE FC.filling_check_id=#{fillingCheckId}
WHERE FC.app_id=#{appId} and FC.filling_check_id=#{fillingCheckId}
</select>
<select id="getTzCylinderAfterCheckItem" resultType="com.yeejoin.amos.boot.module.cylinder.flc.api.dto.TzCylinderCheckDto">
......
......@@ -16,6 +16,7 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StopWatch;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import java.util.*;
......@@ -38,20 +39,21 @@ public class CylSyncServiceImpl {
private CylCylinderFillingCheckMapper cylCylinderFillingCheckMapper;
public void syncFillingCheckInfo() {
Integer totalSize = sourceFillingCheckServiceImpl.getFillCheckListTotal();
Integer times;
if (totalSize != 0) {
times = totalSize / 1000;
int last = totalSize % 1000;
if (last > 0) {
times++;
}
} else {
return;
}
for (int i = 0; i < times; i++) {
traverseSave();
}
// Integer totalSize = sourceFillingCheckServiceImpl.getFillCheckListTotal();
// Integer times;
// if (totalSize != 0) {
// times = totalSize / 1000;
// int last = totalSize % 1000;
// if (last > 0) {
// times++;
// }
// } else {
// return;
// }
// for (int i = 0; i < times; i++) {
// traverseSave();
// }
traverseSave();
}
@Transactional
......@@ -75,15 +77,16 @@ public class CylSyncServiceImpl {
fillingCheckIdList.add(e.getFillingCheckId());
appIdList.add(e.getAppId());
});
List<CylinderFillingCheck> clearList = Lists.newArrayList();
fillingChecks.stream().collect(Collectors.groupingBy(item -> item.getAppId() + "-" + item.getFillingCheckId(), Collectors.maxBy(Comparator.comparing(CylinderFillingCheck::getSyncDate)))).forEach((k,v) -> {
clearList.add(v.get());
});
// List<CylinderFillingCheck> clearList = Lists.newArrayList();
// fillingChecks.stream().collect(Collectors.groupingBy(item -> item.getAppId() + "-" + item.getFillingCheckId(), Collectors.maxBy(Comparator.comparing(CylinderFillingCheck::getSyncDate)))).forEach((k,v) -> {
// clearList.add(v.get());
// });
//1.更新或插入业务表
fillingCheckMapper.saveOrUpdateByCondition(clearList);
fillingCheckMapper.saveOrUpdateByCondition(fillingChecks);
//2.更新源表
sourceFillingCheckServiceImpl.updateBatch(appIdList, fillingCheckIdList);
traverseSave();
}
}
......@@ -124,10 +127,18 @@ public class CylSyncServiceImpl {
public Object fillingSync() {
try {
StopWatch stopWatch = new StopWatch();
stopWatch.start();
List<CylinderFilling> unSyncFilling = sourceFillingCheckServiceImpl.queryUnSyncFilling();
stopWatch.stop();
System.out.println("查询时间:"+stopWatch.getTotalTimeSeconds());
while (!unSyncFilling.isEmpty()) {
fillingDataProcessing(unSyncFilling);
StopWatch stopWatch1 = new StopWatch();
stopWatch1.start();
unSyncFilling = sourceFillingCheckServiceImpl.queryUnSyncFilling();
stopWatch1.stop();
System.out.println("查询2时间:"+stopWatch.getTotalTimeSeconds());
}
} catch (Exception ex) {
return "failed";
......@@ -137,13 +148,14 @@ public class CylSyncServiceImpl {
@Transactional(rollbackFor = {Exception.class})
public void fillingDataProcessing(List<CylinderFilling> data) {
List<String> appIds = new ArrayList<>();
List<String> fillingBeforeIds = new ArrayList<>();
List<String> sequenceCodes = new ArrayList<>();
// List<String> appIds = new ArrayList<>();
// List<String> fillingBeforeIds = new ArrayList<>();
// List<String> sequenceCodes = new ArrayList<>();
List<Long> ids = data.stream().map(CylinderFilling::getSequenceNbr).collect(Collectors.toList());
data.forEach(e -> {
appIds.add(e.getAppId());
fillingBeforeIds.add(e.getFillingBeforeId());
sequenceCodes.add(e.getSequenceCode());
// appIds.add(e.getAppId());
// fillingBeforeIds.add(e.getFillingBeforeId());
// sequenceCodes.add(e.getSequenceCode());
String isValid = e.getIsValid();
if (!ObjectUtil.isEmpty(isValid) && ("1".equals(isValid) || "0".equals(isValid))) {
CylDictEnum cylDictEnum = CylDictEnum.getEnum(Integer.valueOf(isValid), "isValid");
......@@ -201,35 +213,69 @@ public class CylSyncServiceImpl {
}
});
StopWatch stopWatch = new StopWatch();
stopWatch.start();
cylCylinderFillingCheckMapper.saveAndBatchInsert(data);
sourceFillingCheckServiceImpl.updataSyncFilling(appIds, fillingBeforeIds, sequenceCodes);
stopWatch.stop();
System.out.println("插入时间:"+ stopWatch.getTotalTimeSeconds());
StopWatch stopWatch1 = new StopWatch();
stopWatch1.start();
sourceFillingCheckServiceImpl.updataSyncFilling(ids);
stopWatch1.stop();
System.out.println("更新时间:"+ stopWatch1.getTotalTimeSeconds());
}
@Transactional
public String fillingRecordSync() {
Long count = sourceFillingCheckServiceImpl.fillingRecordSync();
Long times = 0L;
if (count != 0) {
times = count / 5000;
Long last = count % 5000;
if (last > 0) {
times++;
}
} else {
return "no data sync";
}
for (int i = 0; i < times; i++) {
// StopWatch stopWatch = new StopWatch();
// stopWatch.start();
// Long count = sourceFillingCheckServiceImpl.fillingRecordSync();
// stopWatch.stop();
// System.out.println("统计总数耗时:"+ stopWatch.getTotalTimeSeconds());
return fillingRecordMessage();
}
@Transactional
String fillingRecordMessage(){
// Long times = 0L;
// if (count != 0) {
// times = count / 1000;
// Long last = count % 1000;
// if (last > 0) {
// times++;
// }
// } else {
// return "no data sync";
// }
// times = 2L;
// for (int i = 0; i < times; i++) {
StopWatch stopWatch = new StopWatch();
stopWatch.start();
List<CylinderFillingRecord> cylinderFillingRecords = sourceFillingCheckServiceImpl.fillingRecordSyncRecords();
cylinderFillingRecords.forEach(item -> {
item.setAbnormal(item.getAbnormal() == 1 ? 3140 : 3139);
item.setSyncState(3);
});
List<String> appIds = cylinderFillingRecords.stream().map(CylinderFillingRecord::getAppId).collect(Collectors.toList());
List<String> records = cylinderFillingRecords.stream().map(CylinderFillingRecord::getFillingRecordId).collect(Collectors.toList());
cylCylinderFillingCheckMapper.batchInsertOrUpdate(cylinderFillingRecords);
sourceFillingCheckServiceImpl.updateSyncState(appIds, records);
}
stopWatch.stop();
System.out.println("查询1000条记录耗时:"+ stopWatch.getTotalTimeSeconds());
if (!ObjectUtils.isEmpty(cylinderFillingRecords)){
cylinderFillingRecords.forEach(item -> {
item.setAbnormal(item.getAbnormal() == 1 ? 3140 : 3139);
item.setSyncState(3);
});
// List<String> appIds = cylinderFillingRecords.stream().map(CylinderFillingRecord::getAppId).collect(Collectors.toList());
// List<String> records = cylinderFillingRecords.stream().map(CylinderFillingRecord::getFillingRecordId).collect(Collectors.toList());
List<Long> ids = cylinderFillingRecords.stream().map(CylinderFillingRecord::getSequenceNbr).collect(Collectors.toList());
StopWatch stopWatch1 = new StopWatch();
stopWatch1.start();
cylCylinderFillingCheckMapper.batchInsertOrUpdate(cylinderFillingRecords);
stopWatch1.stop();
System.out.println("插入数据耗时:"+ stopWatch1.getTotalTimeSeconds());
StopWatch stopWatch2 = new StopWatch();
stopWatch2.start();
sourceFillingCheckServiceImpl.updateSyncState(ids);
stopWatch2.stop();
System.out.println("修改数据耗时:"+ stopWatch2.getTotalTimeSeconds());
fillingRecordMessage();
}
return "ok";
}
}
......@@ -21,6 +21,7 @@ import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.elasticsearch.search.sort.SortOrder;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
......@@ -376,6 +377,7 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin
}
builder.query(boolMust);
builder.sort("sequenceNbr",SortOrder.DESC);
builder.from((pageNum - 1) * pageSize);
builder.size(pageSize);
builder.trackTotalHits(true);
......
......@@ -34,6 +34,7 @@ import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.elasticsearch.search.sort.SortOrder;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
......@@ -973,6 +974,7 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind
}
builder.query(boolMust);
builder.sort("sequenceNbr",SortOrder.DESC);
builder.from((pageNum - 1) * pageSize);
builder.size(pageSize);
builder.trackTotalHits(true);
......
......@@ -54,8 +54,8 @@ public class CylinderSyncServiceImpl {
return fillingCheckMapper.queryUnSyncFilling();
}
public boolean updataSyncFilling(List<String> appIds,List<String> fillingBeforeIds,List<String> sequenceCodes){
return fillingCheckMapper.updataSyncFilling(appIds, fillingBeforeIds, sequenceCodes);
public boolean updataSyncFilling(List<Long> ids){
return fillingCheckMapper.updataSyncFilling(ids);
}
public Long fillingRecordSync(){
......@@ -66,7 +66,7 @@ public class CylinderSyncServiceImpl {
return fillingCheckMapper.fillingRecordSyncRecords();
}
public void updateSyncState(List<String> appIds, List<String> records){
fillingCheckMapper.updateSyncState(appIds, records);
public void updateSyncState(List<Long> ids){
fillingCheckMapper.updateSyncState(ids);
}
}
\ No newline at end of file
......@@ -113,7 +113,7 @@ public class TzCylinderServiceImpl extends BaseService<TzCylinderInfoDto, Cylind
}
List<TzCylinderInspectionDto> tzCylinderInspectionDtoList = tzCylinderMapper
.getTzCylinderInspectionDto(sequenceCode, appId);
List<TzCylinderFillingDto> tzCylinderFillingDtoList = tzCylinderMapper.getTzCylinderFillingDto(sequenceCode);
List<TzCylinderFillingDto> tzCylinderFillingDtoList = tzCylinderMapper.getTzCylinderFillingDto(sequenceCode, appId);
/**
* 取气瓶追溯详情 充装前检查项 名称和结果列表
......@@ -132,7 +132,7 @@ public class TzCylinderServiceImpl extends BaseService<TzCylinderInfoDto, Cylind
}
List<TzCylinderCheckDto> tzCylinderCheckDtoListResult = new ArrayList<>();
TzCylinderBeforeCheckDto tzcylinderBeforeCheckDto = tzCylinderMapper
.getTzCylinderBeforeCheck(tzCylinderFillingDto.getFillingBeforeId());
.getTzCylinderBeforeCheck(appId, tzCylinderFillingDto.getFillingBeforeId());
JSONObject obj = JSONObject.parseObject(JSONObject.toJSONString(tzcylinderBeforeCheckDto));
for (String str : obj.keySet()) {
String explain = map.get(str);
......@@ -157,7 +157,7 @@ public class TzCylinderServiceImpl extends BaseService<TzCylinderInfoDto, Cylind
for (TzCylinderFillingDto tzCylinderFillingDto : tzCylinderFillingDtoList) {
List<TzCylinderCheckDto> tzCylinderAfterCheckDtoListResult = new ArrayList<>();
TzCylinderAfterCheckDto tzcylinderAfterCheckDto = tzCylinderMapper
.getTzCylinderAfterCheck(tzCylinderFillingDto.getFillingCheckId());
.getTzCylinderAfterCheck(appId, tzCylinderFillingDto.getFillingCheckId());;
if (!ValidationUtil.isEmpty(tzcylinderAfterCheckDto)) {
JSONObject obj = JSONObject.parseObject(JSONObject.toJSONString(tzcylinderAfterCheckDto));
for (String str : obj.keySet()) {
......@@ -183,8 +183,8 @@ public class TzCylinderServiceImpl extends BaseService<TzCylinderInfoDto, Cylind
}
for (TzCylinderFillingDto tzCylinderFillingDto : tzCylinderFillingDtoList) {
if (ValidationUtil.isEmpty(tzCylinderFillingDto.getTzCylinderAfterCheckDtoList())) { // 充装后复查记录没有默认不合格
tzCylinderFillingDto.setCheckResultsAfter(CyclinderStatus.NOHEGE.getName());
if (ValidationUtil.isEmpty(tzCylinderFillingDto.getTzCylinderAfterCheckDtoList())) { // 充装后复查记录没有默认未上传
tzCylinderFillingDto.setCheckResultsAfter(CyclinderStatus.NOT_UPLOAD.getName());
} else {
List<TzCylinderCheckDto> collect = tzCylinderFillingDto.getTzCylinderAfterCheckDtoList().stream().filter(dto -> dto.getResult().equals("0")).collect(Collectors.toList());
if (collect.size() != 0) {
......
......@@ -19,12 +19,12 @@ eureka.client.service-url.defaultZone=http://172.16.10.210:10001/eureka/
eureka.instance.prefer-ip-address=true
management.endpoint.health.show-details=always
management.endpoints.web.exposure.include=*
eureka.instance.health-check-url=http://172.16.3.89:${server.port}${server.servlet.context-path}/actuator/health
eureka.instance.health-check-url=http://172.16.3.17:${server.port}${server.servlet.context-path}/actuator/health
eureka.instance.metadata-map.management.context-path=${server.servlet.context-path}/actuator
eureka.instance.status-page-url=http://172.16.3.89:${server.port}${server.servlet.context-path}/actuator/info
eureka.instance.metadata-map.management.api-docs=http://172.16.3.89:${server.port}${server.servlet.context-path}/doc\
eureka.instance.status-page-url=http://172.16.3.17:${server.port}${server.servlet.context-path}/actuator/info
eureka.instance.metadata-map.management.api-docs=http://172.16.3.17:${server.port}${server.servlet.context-path}/doc\
.html
eureka.instance.ip-address=172.16.3.89
eureka.instance.ip-address=172.16.3.17
## ES properties:
elasticsearch.username=elastic
elasticsearch.password=a123456
......
spring.application.name=TZS-CYLINDER
server.servlet.context-path=/cylinder
server.port=11003
spring.profiles.active=dev
spring.profiles.active=cyl
spring.jackson.time-zone=GMT+8
spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
......
package com.yeejoin.amos.boot.module.tcm.api.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(value = "GroupAndPersonInfoDto", description = "用户组及组内用户相关信息")
public class GroupAndPersonInfoDto {
/**
* 组id
*/
@ApiModelProperty(value = "组id")
private Long groupId;
/**
* 组名称
*/
@ApiModelProperty(value = "组名称")
private String groupName;
/**
* 人员名称
*/
@ApiModelProperty(value = "人员名称")
private String userName;
/**
* 人员id
*/
@ApiModelProperty(value = "人员id")
private String userId;
/**
* 所在单位名称
*/
@ApiModelProperty(value = "所在单位名称")
private String unitName;
/**
* 所在单位统一信用代码
*/
@ApiModelProperty(value = "所在单位统一信用代码")
private String unitCode;
/**
* 所在单位unitOrgCode
*/
@ApiModelProperty(value = "所在单位unitOrgCode")
private String unitOrgCode;
/**
* 企业类型
*/
@ApiModelProperty(value = "企业类型")
private String unitType;
/**
* 企业类型编码
*/
@ApiModelProperty(value = "企业类型编码")
private String unitTypeCode;
/**
* 企业涉及设备类型
*/
@ApiModelProperty(value = "企业涉及设备类型")
private String equipCategory;
/**
* 企业涉及设备类型编码
*/
@ApiModelProperty(value = "企业涉及设备类型编码")
private String equipCategoryCode;
}
package com.yeejoin.amos.boot.module.tcm.api.dto;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
*
*
* @author system_generator
* @date 2023-10-27
*/
@Data
@ApiModel(value="TzsTwoStaffingCompanyDto", description="")
public class TzsTwoStaffingCompanyDto {
@ApiModelProperty(value = "监管单位ID")
private String sequenceNbr;
@ApiModelProperty(value = "监管单位名称")
private String superviseOrgName;
@ApiModelProperty(value = "监管单位orgCode")
private String superviseOrgCode;
@ApiModelProperty(value = "单位类型")
private String unitType;
@ApiModelProperty(value = "企业名称")
private String useUnit;
@ApiModelProperty(value = "企业编码")
private String useCode;
@ApiModelProperty(value = "企业类型")
private String mainCharger;
@ApiModelProperty(value = "完成配备")
private String completeNormal;
@ApiModelProperty(value = "使用单位完成配备")
private String useDone;
@ApiModelProperty(value = "生产单位完成配备")
private String productDone;
@ApiModelProperty(value = "使用且生产完成配备")
private String allDone;
//下述字段待定
@ApiModelProperty(value = "主要负责人数")
private String mainNum;
@ApiModelProperty(value = "安全总监数")
private String majordomoNum;
@ApiModelProperty(value = "安全员数")
private String safetyNum;
@ApiModelProperty(value = "质量安全总监数")
private String QualityMajNumber;
@ApiModelProperty(value = "质量安全员数")
private String QualitySafetyNum;
}
package com.yeejoin.amos.boot.module.tcm.api.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
*
*
* @author system_generator
* @date 2023-10-27
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value="TzsTwoStaffingDto", description="")
public class TzsTwoStaffingDto extends BaseDto {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "监管单位ID")
private String supervisoryUnitId;
@ApiModelProperty(value = "监管单位名称")
private String supervisoryUnitName;
@ApiModelProperty(value = "监管单位orgcode")
private String supervisoryUnitOrgcode;
@ApiModelProperty(value = "监管单位等级")
private String supervisoryUnitLevel;
@ApiModelProperty(value = "单位数")
private Integer numberOfUnits;
@ApiModelProperty(value = "已完成单位数")
private Integer numberOfCompletedUnits;
@ApiModelProperty(value = "完成比例")
private String completionRatio;
@ApiModelProperty(value = "已配备主要负责人单位数")
private Integer responsibleUnitsAllocateNumber;
@ApiModelProperty(value = "占比")
private String proportion;
@ApiModelProperty(value = "主要负责人数")
private Integer responsiblePersonsNumber;
@ApiModelProperty(value = "安全总监数")
private Integer safetyDirectorsNumber;
@ApiModelProperty(value = "安全员数")
private Integer safetyOfficersNumber;
@ApiModelProperty(value = "单位类型(1使用单位,2生产单位)")
private String unitType;
}
package com.yeejoin.amos.boot.module.tcm.api.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.Date;
/**
*
*
* @author system_generator
* @date 2023-10-27
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("tzs_two_staffing")
public class TzsTwoStaffing extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 监管单位ID
*/
@TableField("supervisory_unit_id")
private String supervisoryUnitId;
/**
* 监管单位名称
*/
@TableField("supervisory_unit_name")
private String supervisoryUnitName;
/**
* 监管单位orgcode
*/
@TableField("supervisory_unit_orgcode")
private String supervisoryUnitOrgcode;
/**
* 监管单位等级
*/
@TableField("supervisory_unit_level")
private String supervisoryUnitLevel;
/**
* 单位数
*/
@TableField("number_of_units")
private Integer numberOfUnits;
/**
* 已完成单位数
*/
@TableField("number_of_completed_units")
private Integer numberOfCompletedUnits;
/**
* 完成比例
*/
@TableField("completion_ratio")
private String completionRatio;
/**
* 已配备主要负责人单位数
*/
@TableField("responsible_units_allocate_number")
private Integer responsibleUnitsAllocateNumber;
/**
* 占比
*/
@TableField("proportion")
private String proportion;
/**
* 主要负责人数
*/
@TableField("responsible_persons_number")
private Integer responsiblePersonsNumber;
/**
* 安全总监数
*/
@TableField("safety_directors_number")
private Integer safetyDirectorsNumber;
/**
* 安全员数
*/
@TableField("safety_officers_number")
private Integer safetyOfficersNumber;
/**
* 单位类型(1使用单位,2生产单位)
*/
@TableField("unit_type")
private String unitType;
}
package com.yeejoin.amos.boot.module.tcm.api.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
@AllArgsConstructor
@Getter
public enum SupervisoryEnum {
/**
* 监管单位层级
*/
// 省
PROVINCE("headquarter","prefecture-level"),
// 市
CITY("prefecture-level", "county"),
// 区县
DISTRICT("county", "organization"),
// 所
PLACE("organization", "organization");
String level;
String nextLevel;
public static SupervisoryEnum getEnumByLevel(String level) {
for (SupervisoryEnum value : SupervisoryEnum.values()) {
if (value.getLevel().equals(level)) {
return value;
}
}
return null;
}
}
package com.yeejoin.amos.boot.module.tcm.api.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.HashMap;
import java.util.Map;
@AllArgsConstructor
@Getter
public enum UnitTypeEnum {
/**
* *注册单位类型
*/
sydw("使用单位", "1232"),
czdw("充装单位", "1231"),
jyjcjg("检验检测机构", "1233"),
azgzwxdw("安装改造维修单位", "1234"),
zzdw("制造单位", "1236"),
sjdw("设计单位", "1235"),
grzt("个人主体", "6599");
private String name;
private String code;
public static Map<String, String> getName = new HashMap<>();
public static Map<String, String> getCode = new HashMap<>();
static {
for (UnitTypeEnum e : UnitTypeEnum.values()) {
getName.put(e.code, e.name);
getCode.put(e.name, e.code);
}
}
}
package com.yeejoin.amos.boot.module.tcm.api.mapper;
import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
......@@ -8,6 +9,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.tcm.api.dto.EquEnterDto;
import com.yeejoin.amos.boot.module.tcm.api.dto.TzBaseEnterpriseInfoDto;
import com.yeejoin.amos.boot.module.tcm.api.entity.TzBaseEnterpriseInfo;
import org.apache.ibatis.annotations.Param;
/**
* 企业数据信息 Mapper 接口
......@@ -50,4 +52,6 @@ public interface TzBaseEnterpriseInfoMapper extends BaseMapper<TzBaseEnterpriseI
* @return
*/
List<TzBaseEnterpriseInfo> listNoQrCode();
List<Map<String, Object>> getEquipType(@Param("type")String type);
}
package com.yeejoin.amos.boot.module.tcm.api.mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.tcm.api.dto.TzsTwoStaffingCompanyDto;
import com.yeejoin.amos.boot.module.tcm.api.entity.TzsTwoStaffing;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* Mapper 接口
*
* @author system_generator
* @date 2023-10-27
*/
public interface TzsTwoStaffingMapper extends BaseMapper<TzsTwoStaffing> {
Page<TzsTwoStaffingCompanyDto> getCompanyList(@Param("page")Page<TzsTwoStaffingCompanyDto> page,
@Param("companyDto") TzsTwoStaffingCompanyDto companyDto,
@Param("orgCode") String orgCode);
List<TzsTwoStaffing> getListByOrgCode(@Param("orgCode")String orgCode, @Param("type")String type, @Param("level")String level);
}
......@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.tcm.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.tcm.api.dto.GroupAndPersonInfoDto;
import com.yeejoin.amos.boot.module.tcm.api.dto.TzsEquipListDto;
import com.yeejoin.amos.boot.module.tcm.api.dto.TzsUserInfoDto;
import com.yeejoin.amos.boot.module.tcm.api.entity.TzsUserInfo;
......@@ -23,4 +24,10 @@ public interface TzsUserInfoMapper extends BaseMapper<TzsUserInfo> {
@Param("companyCode") String companyCode,
@Param("userSeq") String userSeq,
@Param("dto") TzsEquipListDto dto);
List<TzsUserInfo> getUnitPersonInfo();
// List<String> selectUserIds();
List<GroupAndPersonInfoDto> getUnitInfoByUserIds(@Param("userIds")List<String> userIds);
}
package com.yeejoin.amos.boot.module.tcm.api.service;
import com.yeejoin.amos.boot.module.tcm.api.dto.TzsTwoStaffingCompanyDto;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.List;
import com.yeejoin.amos.boot.module.tcm.api.entity.TzsTwoStaffing;
import java.util.LinkedHashMap;
import java.util.List;
/**
* 接口类
*
* @author system_generator
* @date 2023-10-27
*/
public interface ITzsTwoStaffingService {
List<TzsTwoStaffing> getStatisticsMessage(List<LinkedHashMap> list, String type);
Page<TzsTwoStaffingCompanyDto> getCompanyList(String orgCode, TzsTwoStaffingCompanyDto companyDto,Page<TzsTwoStaffingCompanyDto> page);
}
......@@ -3,10 +3,12 @@ package com.yeejoin.amos.boot.module.tcm.api.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yeejoin.amos.boot.module.tcm.api.dto.GroupAndPersonInfoDto;
import com.yeejoin.amos.boot.module.tcm.api.dto.TzsEquipListDto;
import com.yeejoin.amos.boot.module.tcm.api.dto.TzsUserInfoDto;
import com.yeejoin.amos.boot.module.tcm.api.entity.TzsUserInfo;
import com.yeejoin.amos.boot.module.tcm.api.entity.TzsUserQualifications;
import com.yeejoin.amos.feign.privilege.model.GroupModel;
import java.util.List;
import java.util.Map;
......@@ -19,7 +21,7 @@ public interface ITzsUserInfoService extends IService<TzsUserInfo> {
void updateQualificationsMessage(String userId, List<TzsUserQualifications> list);
void deleteBatch(List<Long> ids);
void deleteBatch(Object[] ids);
Map<String, Object> getDetail(Long id);
......@@ -39,4 +41,14 @@ public interface ITzsUserInfoService extends IService<TzsUserInfo> {
Boolean equipBind(String type, String userSeq, String creditCode, Map<String,Object> map);
List<TzsUserInfo> getSafetyList(String companyCode);
List<Map<String,Object>> getGroupList();
Map<String,Object> getPersonType();
List<GroupAndPersonInfoDto> getGroupAndPersonInfo(Long groupId);
Boolean createUnitPerson();
// void testGroup();
}
......@@ -164,5 +164,13 @@
and use_code <![CDATA[<>]]> ''
limit 1000
</select>
<select id="getEquipType" resultType="java.util.Map">
SELECT * FROM "cb_data_dictionary"
<where>
<if test="type != null and type != ''">
type = #{type}
</if>
</where>
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.tcm.api.mapper.TzsTwoStaffingMapper">
<select id="getCompanyList" resultType="com.yeejoin.amos.boot.module.tcm.api.dto.TzsTwoStaffingCompanyDto">
SELECT
*
FROM
view_two_staffing
where
supervise_org_code like concat('%',#{orgCode},'%')
<if test="companyDto.unitType != '' and companyDto.unitType != null">
and unit_type like concat('%',#{companyDto.unitType},'%')
</if>
<if test="companyDto.useUnit != '' and companyDto.useUnit != null">
and use_unit like concat('%',#{companyDto.useUnit},'%')
</if>
<if test="companyDto.useCode != '' and companyDto.useCode != null">
and use_code like concat('%',#{companyDto.useCode},'%')
</if>
<if test="companyDto.completeNormal != '' and companyDto.completeNormal == 1 ">
and (useDone = '1' or productDone = '1')
</if>
<if test="companyDto.completeNormal != '' and companyDto.completeNormal == 0 ">
and useDone = '0' and productDone = '0'
</if>
</select>
<select id="getListByOrgCode" resultType="com.yeejoin.amos.boot.module.tcm.api.entity.TzsTwoStaffing">
select *
from tzs_two_staffing
where is_delete = 0
<if test="orgCode != '' and orgCode != null">
and supervisory_unit_orgcode like concat('%',#{orgCode},'%')
</if>
<if test="type != '' and type != null">
and unit_type = #{type}
</if>
<if test="level != '' and level != null">
and supervisory_unit_level = #{level}
</if>
</select>
</mapper>
......@@ -62,9 +62,9 @@
<select id="getArrangementStatistic" resultType="java.util.Map">
SELECT
(SELECT count(1) FROM "tzs_user_info" WHERE unit_code= #{companyCode} AND post_name like '%主要负责人%') principal,
(SELECT count(1) FROM "tzs_user_info" WHERE unit_code= #{companyCode} AND post_name like '%安全总监%') majordomo,
(SELECT count(1) FROM "tzs_user_info" WHERE unit_code= #{companyCode} AND post_name like '%安全员%') safety,
(SELECT count(1) FROM "tzs_user_info" WHERE unit_code= #{companyCode} AND post like '%6548%') principal,
(SELECT count(1) FROM "tzs_user_info" WHERE unit_code= #{companyCode} AND post like '%6547%') majordomo,
(SELECT count(1) FROM "tzs_user_info" WHERE unit_code= #{companyCode} AND post like '%6549%') safety,
(SELECT COUNT( * )
FROM
"idx_biz_jg_use_info" ibjui
......@@ -77,7 +77,7 @@
<select id="getAllEquipList" resultType="com.yeejoin.amos.boot.module.tcm.api.dto.TzsEquipListDto">
SELECT
ibjui."SEQUENCE_NBR" id,
distinct ibjui."SEQUENCE_NBR" id,
"USE_INNER_CODE" innerCode,
"USE_UNIT_NAME" unitName,
"USE_ORG_CODE" useOrgCode,
......@@ -130,8 +130,8 @@
<if test="dto.code96333 != '' and dto.code96333 != null">
and "CODE96333" like concat('%',#{dto.code96333},'%')
</if>
<if test="dto.userSeq != '' and dto.userSeq != null">
AND tue.user_seq = #{userSeq}
<if test="dto.safety != '' and dto.safety != null">
AND tue.user_seq = #{dto.safety}
</if>
<if test="dto.isNotBind != '' and dto.isNotBind != null and dto.isNotBind == 1">
AND ibjui."SEQUENCE_NBR" IN ( SELECT DISTINCT equip_id FROM tzs_user_equip WHERE credit_code = #{companyCode} )
......@@ -152,4 +152,53 @@
</if>
</select>
<select id="getUnitPersonInfo" resultType="com.yeejoin.amos.boot.module.tcm.api.entity.TzsUserInfo">
SELECT
admin_name as name ,
'344' certificateType,
admin_id_number certificateNum,
name unitName,
'UNLOCK' lockStatus,
unit_code,
admin_tel phone,
admin_user_id amosUserId,
admin_login_name amosUserName
FROM
"tz_flc_reg_unit_info"
</select>
<!-- <select id="selectUserIds" resultType="java.lang.String">-->
<!-- SELECT-->
<!-- amos_user_id-->
<!-- FROM-->
<!-- tzs_user_info tui-->
<!-- LEFT JOIN tz_base_enterprise_info tzei ON tui.unit_code = tzei.use_code-->
<!-- WHERE tui.is_delete = 'f'-->
<!-- AND tui.amos_user_id is NOT null-->
<!-- AND tzei.unit_type IS NOT NULL-->
<!-- GROUP BY tui.amos_user_id-->
<!-- </select>-->
<select id="getUnitInfoByUserIds" resultType="com.yeejoin.amos.boot.module.tcm.api.dto.GroupAndPersonInfoDto">
SELECT
tui.amos_user_id userId,
tui.amos_user_name userName,
tui.unit_name,
tui.unit_code,
replace(tzei.unit_type,'#', ',') unitType,
tzei.equip_category
FROM
tzs_user_info tui
LEFT JOIN tz_base_enterprise_info tzei ON tui.unit_code = tzei.use_code
<where>
tzei.equip_category is not null
<if test="userIds != null and userIds.size() > 0">
and amos_user_id in
<foreach item="item" collection="userIds" separator="," open="(" close=")" index="">
#{item}
</foreach>
</if>
</where>
</select>
</mapper>
\ No newline at end of file
......@@ -9,7 +9,10 @@ import com.yeejoin.amos.boot.module.tcm.api.dto.EquEnterDto;
import com.yeejoin.amos.boot.module.tcm.api.dto.TzBaseEnterpriseInfoDto;
import com.yeejoin.amos.boot.module.tcm.api.entity.PageParam;
import com.yeejoin.amos.boot.module.tcm.api.entity.TzBaseEnterpriseInfo;
import com.yeejoin.amos.boot.module.tcm.api.enums.EquipmentClassifityEnum;
import com.yeejoin.amos.boot.module.tcm.api.mapper.TzBaseEnterpriseInfoMapper;
import com.yeejoin.amos.boot.module.tcm.api.service.ITzBaseEnterpriseInfoService;
import com.yeejoin.amos.boot.module.tcm.biz.utils.JsonUtils;
import com.yeejoin.amos.component.feign.utils.FeignUtil;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.CompanyModel;
......@@ -18,6 +21,8 @@ import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.context.RequestContext;
......@@ -50,6 +55,11 @@ public class TzBaseEnterpriseInfoController {
@Autowired
RedisUtils redisUtils;
@Value("classpath:/json/equipCategory.json")
private Resource equipCategory;
@Autowired
private TzBaseEnterpriseInfoMapper tzBaseEnterpriseInfoMapper;
/**
* 新增企业数据信息
*
......@@ -243,4 +253,19 @@ public class TzBaseEnterpriseInfoController {
return ResponseHelper.buildResponse(iTzBaseEnterpriseInfoService.setLabel(enterpriseIds, enterpriseLabel));
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/getEnterpriseType", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "同步企业信息", notes = "同步企业信息")
public ResponseModel<List<Map<String, Object>>> getEnterpriseType() {
return ResponseHelper.buildResponse(tzBaseEnterpriseInfoMapper.getEquipType("UNIT_TYPE_NEW"));
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/getEquipType", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "同步企业信息", notes = "同步企业信息")
public ResponseModel<List<Map<String, Object>>> getEquipType() {
Map<String, List<Map<String, Object>>> resourceJson = JsonUtils.getResourceJson(equipCategory);
return ResponseHelper.buildResponse(resourceJson.get(EquipmentClassifityEnum.BDLS.getCode()));
}
}
package com.yeejoin.amos.boot.module.tcm.biz.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.alibaba.fastjson.JSON;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.tcm.api.dto.TzsEquipListDto;
import com.yeejoin.amos.boot.module.tcm.api.dto.TzsTwoStaffingCompanyDto;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.tcm.api.service.ITzsTwoStaffingService;
import com.yeejoin.amos.boot.module.tcm.biz.service.impl.TzsUserInfoServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.List;
import java.util.Map;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
@RestController
@Api(tags = "统计")
@RequestMapping(value = "/twoStaff")
public class TzsTwoStaffingController extends BaseController {
private static final String REGULATOR_UNIT_TREE = "REGULATOR_UNIT_TREE";
@Autowired
private ITzsTwoStaffingService tzsTwoStaffingService;
@Autowired
private TzsUserInfoServiceImpl tzsUserInfoServiceImpl;
@Autowired
RedisUtils redisUtils;
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getCompanyList")
@ApiOperation(httpMethod = "GET", value = "企业两员配备情况查询", notes = "企业两员配备情况查询")
public ResponseModel<IPage<TzsTwoStaffingCompanyDto>> getCompanyList(@RequestParam(value = "orgCode") String orgCode,
@RequestParam(value = "current") String current,
@RequestParam(value = "size") String size,
TzsTwoStaffingCompanyDto companyDto) {
Page<TzsTwoStaffingCompanyDto> page = new Page<>();
page.setCurrent(Long.parseLong(current));
page.setSize(Long.parseLong(size));
return ResponseHelper.buildResponse(tzsTwoStaffingService.getCompanyList(orgCode, companyDto,page));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getStatisticsMessage")
@ApiOperation(httpMethod = "GET", value = "监管单位统计信息", notes = "监管单位统计信息")
public ResponseModel<Object> getGroupAndPersonInfo(@RequestParam("sequenceNbr") String sequenceNbr,
@RequestParam("type") String type) {
List<LinkedHashMap> data = (List<LinkedHashMap>) redisUtils.get(REGULATOR_UNIT_TREE);
ArrayList<LinkedHashMap> result = new ArrayList<>();
List<LinkedHashMap> list = tzsUserInfoServiceImpl.screenData(result, data, sequenceNbr);
return ResponseHelper.buildResponse(tzsTwoStaffingService.getStatisticsMessage(list, type));
}
}
......@@ -2,20 +2,25 @@ package com.yeejoin.amos.boot.module.tcm.biz.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
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.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.tcm.api.dto.GroupAndPersonInfoDto;
import com.yeejoin.amos.boot.module.tcm.api.dto.TzsEquipListDto;
import com.yeejoin.amos.boot.module.tcm.api.dto.TzsUserInfoDto;
import com.yeejoin.amos.boot.module.tcm.api.entity.TzsUserInfo;
import com.yeejoin.amos.boot.module.tcm.api.mapper.TzsUserInfoMapper;
import com.yeejoin.amos.boot.module.tcm.api.service.ITzsUserInfoService;
import com.yeejoin.amos.boot.module.tcm.biz.service.impl.TzsUserInfoServiceImpl;
import com.yeejoin.amos.component.feign.utils.FeignUtil;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import com.yeejoin.amos.feign.privilege.model.GroupModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -28,9 +33,8 @@ import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
@RestController
@Api(tags = "用户信息Api")
......@@ -44,14 +48,35 @@ public class TzsUserInfoController extends BaseController {
private ITzsUserInfoService tzsUserInfoService;
@Autowired
private TzsUserInfoMapper tzsUserInfoMapper;
@Autowired
RedisUtils redisUtils;
private static final String REGULATOR_UNIT_TREE = "REGULATOR_UNIT_TREE";
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增人员信息", notes = "新增人员信息")
public ResponseModel<TzsUserInfoDto> save(@RequestBody JSONObject map) {
Map<String, Object> userInfo = (Map<String, Object>)map.get("userInfo");
TzsUserInfoDto tzsUserInfo = JSON.parseObject(JSON.toJSONString(userInfo), TzsUserInfoDto.class);
LambdaQueryWrapper<TzsUserInfo> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(TzsUserInfo::getCertificateType,tzsUserInfo.getCertificateType());
queryWrapper.eq(TzsUserInfo::getCertificateNum,tzsUserInfo.getCertificateNum());
TzsUserInfo certificateNum = tzsUserInfoMapper.selectOne(queryWrapper);
if(!ObjectUtils.isEmpty(certificateNum)){
throw new BadRequest("证件号码重复,请核对!");
}
LambdaQueryWrapper<TzsUserInfo> queryWrapper1 = new LambdaQueryWrapper<>();
queryWrapper1.eq(TzsUserInfo::getPhone,tzsUserInfo.getPhone());
TzsUserInfo phone = tzsUserInfoMapper.selectOne(queryWrapper1);
if(!ObjectUtils.isEmpty(phone)){
throw new BadRequest("联系电话重复,请核对!");
}
ReginParams reginParams = JSON.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
if (ObjectUtils.isEmpty(reginParams)) {
return null;
......@@ -82,6 +107,23 @@ public class TzsUserInfoController extends BaseController {
@RequestParam Long rowId) {
Map<String, Object> userInfo = (Map<String, Object>)map.get("userInfo");
TzsUserInfo tzsUserInfo = JSON.parseObject(JSON.toJSONString(userInfo), TzsUserInfo.class);
LambdaQueryWrapper<TzsUserInfo> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(TzsUserInfo::getCertificateType,tzsUserInfo.getCertificateType());
queryWrapper.eq(TzsUserInfo::getCertificateNum,tzsUserInfo.getCertificateNum());
queryWrapper.ne(TzsUserInfo::getSequenceNbr,rowId);
TzsUserInfo certificateNum = tzsUserInfoMapper.selectOne(queryWrapper);
if(!ObjectUtils.isEmpty(certificateNum)){
throw new BadRequest("证件号码重复,请核对!");
}
LambdaQueryWrapper<TzsUserInfo> queryWrapper1 = new LambdaQueryWrapper<>();
queryWrapper1.eq(TzsUserInfo::getPhone,tzsUserInfo.getPhone());
queryWrapper1.ne(TzsUserInfo::getSequenceNbr,rowId);
TzsUserInfo phone = tzsUserInfoMapper.selectOne(queryWrapper1);
if(!ObjectUtils.isEmpty(phone)){
throw new BadRequest("联系电话重复,请核对!");
}
ReginParams reginParams = JSON.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
if (ObjectUtils.isEmpty(reginParams)) {
return null;
......@@ -111,7 +153,22 @@ public class TzsUserInfoController extends BaseController {
@PostMapping(value = "/deleteBatch")
@ApiOperation(httpMethod = "POST", value = "批量删除", notes = "批量删除")
public ResponseModel<Object> deleteBatch(@RequestBody JSONObject map) {
List<Long> ids = (List<Long>) map.get("ids");
ReginParams reginParams = JSON.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
if (ObjectUtils.isEmpty(reginParams)) {
return null;
}
TzsUserInfo tzsUserInfo = tzsUserInfoMapper.selectOne(new QueryWrapper<TzsUserInfo>().eq("amos_user_id", reginParams.getUserModel().getUserId()));
Object[] ids = ((List<Long>) map.get("ids")).toArray();
Boolean flag = false;
for (Object id : ids) {
if (id.equals(tzsUserInfo.getSequenceNbr().toString())) {
flag = true;
break;
}
}
if (flag) {
throw new BadRequest("不能删除当前登录人所对应的数据,请取消勾选后再做删除处理");
}
tzsUserInfoService.deleteBatch(ids);
return ResponseHelper.buildResponse("ok");
}
......@@ -147,6 +204,14 @@ public class TzsUserInfoController extends BaseController {
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/createUnitPerson")
@ApiOperation(httpMethod = "GET", value = "给单位历史管理员添加两员配备默认数据", notes = "给单位历史管理员添加两员配备默认数据")
public ResponseModel<Object> createUnitPerson() {
return ResponseHelper.buildResponse(tzsUserInfoService.createUnitPerson());
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/BindAccount")
@ApiOperation(httpMethod = "POST", value = "人员绑定用户", notes = "人员绑定用户")
......@@ -229,4 +294,53 @@ public class TzsUserInfoController extends BaseController {
return ResponseHelper.buildResponse(tzsUserInfoService.getSafetyList(companyCode));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getGroupList")
@ApiOperation(httpMethod = "GET", value = "两个规定用户组列表查询", notes = "两个规定用户组列表查询")
public ResponseModel<List<Map<String, Object>>> getGroupList() {
return ResponseHelper.buildResponse(tzsUserInfoService.getGroupList());
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getPersonType")
@ApiOperation(httpMethod = "GET", value = "获取当前登录人人员类型", notes = "获取当前登录人人员类型")
public ResponseModel<Map<String,Object>> getPersonType() {
return ResponseHelper.buildResponse(tzsUserInfoService.getPersonType());
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getGroupAndPersonInfo")
@ApiOperation(httpMethod = "GET", value = "通过组id查询组及组内人员信息", notes = "通过组id查询组及组内人员信息")
public ResponseModel<List<GroupAndPersonInfoDto>> getGroupAndPersonInfo(@RequestParam(value = "groupId") Long groupId) {
return ResponseHelper.buildResponse(tzsUserInfoService.getGroupAndPersonInfo(groupId));
}
//
// @TycloudOperation(ApiLevel = UserType.AGENCY)
// @GetMapping(value = "/testGroup")
// @ApiOperation(httpMethod = "GET", value = "给组内添加人员", notes = "给组内添加人员")
// public ResponseModel<Object> testGroup() {
// tzsUserInfoService.testGroup();
// return ResponseHelper.buildResponse("ok");
// }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getTree")
@ApiOperation(httpMethod = "GET", value = "根据当前登录人获取监管机构", notes = "根据当前登录人获取监管机构")
public ResponseModel<Object> getGroupAndPersonInfo() {
ReginParams reginParams = JSON.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
if (ObjectUtils.isEmpty(reginParams)) {
return null;
}
Long id = reginParams.getCompany().getSequenceNbr();
List<LinkedHashMap> data = (List<LinkedHashMap>) redisUtils.get(REGULATOR_UNIT_TREE);
ArrayList<LinkedHashMap> result = new ArrayList<>();
return ResponseHelper.buildResponse(tzsUserInfoServiceImpl.screenData(result, data, id.toString()));
}
}
package com.yeejoin.amos.boot.module.tcm.biz.service.impl;
import com.yeejoin.amos.boot.module.tcm.api.dto.TzsTwoStaffingCompanyDto;
import com.yeejoin.amos.boot.module.tcm.api.entity.TzsTwoStaffing;
import com.yeejoin.amos.boot.module.tcm.api.enums.SupervisoryEnum;
import com.yeejoin.amos.boot.module.tcm.api.mapper.TzsTwoStaffingMapper;
import com.yeejoin.amos.boot.module.tcm.api.service.ITzsTwoStaffingService;
import com.yeejoin.amos.boot.module.tcm.api.dto.TzsTwoStaffingDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
/**
* 服务实现类
*
* @author system_generator
* @date 2023-10-27
*/
@Service
public class TzsTwoStaffingServiceImpl extends BaseService<TzsTwoStaffingDto, TzsTwoStaffing, TzsTwoStaffingMapper> implements ITzsTwoStaffingService {
@Autowired
TzsTwoStaffingMapper tzsTwoStaffingMapper;
/**
* 分页查询
*/
public Page<TzsTwoStaffingDto> queryForTzsTwoStaffingPage(Page<TzsTwoStaffingDto> page) {
return this.queryForPage(page, null, false);
}
/**
* 列表查询 示例
*/
public List<TzsTwoStaffingDto> queryForTzsTwoStaffingList() {
return this.queryForList("", false);
}
@Override
public List<TzsTwoStaffing> getStatisticsMessage(List<LinkedHashMap> list, String type) {
String orgCode = null;
String nextLevel = null;
if (!ObjectUtils.isEmpty(list) && !ObjectUtils.isEmpty(list.get(0))) {
orgCode = String.valueOf(list.get(0).get("orgCode"));
SupervisoryEnum enumByLevel = SupervisoryEnum.getEnumByLevel(String.valueOf(list.get(0).get("level")));
nextLevel = !ObjectUtils.isEmpty(enumByLevel) ? enumByLevel.getNextLevel() : null;
}
if (!ObjectUtils.isEmpty(orgCode)) {
List<TzsTwoStaffing> listByOrgCode = this.getBaseMapper().getListByOrgCode(orgCode, type, nextLevel);
TzsTwoStaffing tzsTwoStaffing = new TzsTwoStaffing();
tzsTwoStaffing.setSupervisoryUnitName("汇总");
listByOrgCode.stream().forEach(item -> {
tzsTwoStaffing.setNumberOfUnits(!ObjectUtils.isEmpty(tzsTwoStaffing.getNumberOfUnits()) ? tzsTwoStaffing.getNumberOfUnits() : 0);
tzsTwoStaffing.setNumberOfCompletedUnits(item.getNumberOfCompletedUnits() + (!ObjectUtils.isEmpty(tzsTwoStaffing.getNumberOfCompletedUnits()) ? tzsTwoStaffing.getNumberOfCompletedUnits() : 0));
tzsTwoStaffing.setResponsibleUnitsAllocateNumber(item.getResponsibleUnitsAllocateNumber() + (!ObjectUtils.isEmpty(tzsTwoStaffing.getResponsibleUnitsAllocateNumber()) ? tzsTwoStaffing.getResponsibleUnitsAllocateNumber() : 0));
});
if (ObjectUtils.isEmpty(tzsTwoStaffing.getNumberOfCompletedUnits()) || ObjectUtils.isEmpty(tzsTwoStaffing.getNumberOfUnits()) || tzsTwoStaffing.getNumberOfUnits() == 0 || tzsTwoStaffing.getNumberOfCompletedUnits() == 0) {
tzsTwoStaffing.setCompletionRatio("0");
} else {
tzsTwoStaffing.setCompletionRatio(String.valueOf(tzsTwoStaffing.getNumberOfCompletedUnits() / tzsTwoStaffing.getNumberOfUnits()));
}
if (ObjectUtils.isEmpty(tzsTwoStaffing.getResponsiblePersonsNumber()) || tzsTwoStaffing.getResponsiblePersonsNumber() == 0
|| ObjectUtils.isEmpty(tzsTwoStaffing.getNumberOfUnits()) || tzsTwoStaffing.getNumberOfUnits() == 0) {
tzsTwoStaffing.setProportion("0");
} else {
tzsTwoStaffing.setProportion(String.valueOf(tzsTwoStaffing.getResponsiblePersonsNumber() / tzsTwoStaffing.getNumberOfUnits()));
}
listByOrgCode.add(tzsTwoStaffing);
return listByOrgCode;
}
return null;
}
private List<LinkedHashMap> treeToList(List<LinkedHashMap> result, List<LinkedHashMap> list){
if (!ObjectUtils.isEmpty(list) && !ObjectUtils.isEmpty(list.get(0).get("children"))){
result.addAll((List<LinkedHashMap>)list.get(0).get("children"));
}else {
result.add(list.get(0));
}
return result;
}
@Override
public Page<TzsTwoStaffingCompanyDto> getCompanyList(String orgCode, TzsTwoStaffingCompanyDto companyDto, Page<TzsTwoStaffingCompanyDto> page) {
Page<TzsTwoStaffingCompanyDto> companyList = tzsTwoStaffingMapper.getCompanyList(page, companyDto, orgCode);
if(!ObjectUtils.isEmpty(companyList.getRecords())){
for (TzsTwoStaffingCompanyDto item : companyList.getRecords()) {
if (item.getUnitType().contains("使用单位") && (item.getUnitType().contains("充装单位")
|| item.getUnitType().contains("安装改造维修单位")
|| item.getUnitType().contains("制造单位")
|| item.getUnitType().contains("设计单位"))) {
item.setCompleteNormal(Integer.valueOf(item.getAllDone()) == 1 ? "是" : "否");
continue;
}
if (item.getUnitType().contains("使用单位")) {
item.setCompleteNormal(Integer.valueOf(item.getUseDone()) == 1 ? "是" : "否");
continue;
}
if (item.getUnitType().contains("充装单位")
|| item.getUnitType().contains("安装改造维修单位")
|| item.getUnitType().contains("制造单位")
|| item.getUnitType().contains("设计单位")) {
item.setCompleteNormal(Integer.valueOf(item.getProductDone()) == 1 ? "是" : "否");
continue;
}
}
}
return companyList;
}
}
\ No newline at end of file
package com.yeejoin.amos.boot.module.tcm.biz.service.impl;
import cn.hutool.json.ObjectMapper;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
......@@ -11,28 +10,30 @@ import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.tcm.api.dto.ESEquipmentCategoryDto;
import com.yeejoin.amos.boot.module.tcm.api.dto.GroupAndPersonInfoDto;
import com.yeejoin.amos.boot.module.tcm.api.dto.TzsEquipListDto;
import com.yeejoin.amos.boot.module.tcm.api.dto.TzsUserInfoDto;
import com.yeejoin.amos.boot.module.tcm.api.entity.*;
import com.yeejoin.amos.boot.module.tcm.api.enums.EquipmentClassifityEnum;
import com.yeejoin.amos.boot.module.tcm.api.enums.UnitTypeEnum;
import com.yeejoin.amos.boot.module.tcm.api.mapper.TzsUserEquipMapper;
import com.yeejoin.amos.boot.module.tcm.api.mapper.TzsUserInfoMapper;
import com.yeejoin.amos.boot.module.tcm.api.service.ITzsUserInfoService;
import com.yeejoin.amos.boot.module.tcm.api.vo.TzsUserInfoVo;
import com.yeejoin.amos.boot.module.tcm.api.vo.TzsUserQualificationsVo;
import com.yeejoin.amos.boot.module.tcm.flc.biz.service.impl.RegUnitInfoServiceImpl;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.component.feign.utils.FeignUtil;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import com.yeejoin.amos.feign.privilege.model.GroupModel;
import com.yeejoin.amos.feign.privilege.model.RoleModel;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StopWatch;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
......@@ -58,10 +59,6 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
@Autowired
private RedisUtils redisUtils;
@Autowired
RegUnitInfoServiceImpl regUnitInfoService;
@Autowired
TzBaseEnterpriseInfoServiceImpl baseEnterpriseInfoService;
......@@ -69,8 +66,11 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
private final String USER_ROLE = "QYRYJS";
//企业人员用户组
private final String ROLE_GROUP = "QYRYYHZ";
//两个规定用户组-对应企业人员的人员类型
//两个规定用户组-对应企业人员的人员类型前缀
private final String QYRYGW = "QYRYGW";
//两个规定用户组-对应企业人员的人员类型前缀
private final String QYRYGW_NAME = "两员配备-企业人员类型";
//平台用户锁定状态
private final String UNLOCK = "UNLOCK";
private final String LOCK = "LOCK";
......@@ -103,7 +103,7 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
}
LambdaQueryWrapper<DataDictionary> lambda = new QueryWrapper<DataDictionary>().lambda();
lambda.in(DataDictionary::getSequenceNbr, dictIds);
List<DataDictionary> dataDictionaries = regUnitInfoService.initAllDataDictionaryList();
List<DataDictionary> dataDictionaries = iDataDictionaryService.getByTypeAndDesc(QYRYGW, QYRYGW_NAME);
List<DataDictionary> postDataList = dataDictionaries.stream().filter(d -> dictIds.stream().anyMatch(id -> id.toString().equals(d.getSequenceNbr().toString()))).collect(Collectors.toList());
return postDataList.stream().map(DataDictionary::getName).collect(Collectors.joining(","));
}
......@@ -154,17 +154,21 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
}
@Override
public void deleteBatch(List<Long> ids) {
@Transactional(rollbackFor = Exception.class)
public void deleteBatch(Object[] ids1) {
LambdaQueryWrapper<TzsUserInfo> lambda = new QueryWrapper<TzsUserInfo>().lambda();
lambda.in(TzsUserInfo::getSequenceNbr, ids);
lambda.in(TzsUserInfo::getSequenceNbr, ids1);
TzsUserInfo tzsUserInfo = new TzsUserInfo();
tzsUserInfo.setIsDelete(true);
tzsUserInfoMapper.update(tzsUserInfo, lambda);
LambdaQueryWrapper<TzsUserQualifications> qualificationsLambda = new QueryWrapper<TzsUserQualifications>().lambda();
qualificationsLambda.in(TzsUserQualifications::getUserInfoId, ids);
TzsUserQualifications tzsUserQualifications = new TzsUserQualifications();
tzsUserQualifications.setIsDelete(true);
tzsUserQualificationsService.update(tzsUserQualifications, qualificationsLambda);
for (Object id : ids1) {
tzsUserEquipMapper.delete(new QueryWrapper<TzsUserEquip>().eq("user_seq", id));
}
// LambdaQueryWrapper<TzsUserQualifications> qualificationsLambda = new QueryWrapper<TzsUserQualifications>().lambda();
// qualificationsLambda.in(TzsUserQualifications::getUserInfoId, ids);
// TzsUserQualifications tzsUserQualifications = new TzsUserQualifications();
// tzsUserQualifications.setIsDelete(true);
// tzsUserQualificationsService.update(tzsUserQualifications, qualificationsLambda);
}
@Override
......@@ -405,6 +409,111 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
}
@Override
public List<Map<String, Object>> getGroupList() {
FeignClientResult<Collection<GroupModel>> collectionFeignClientResult = Privilege.groupClient.selectForList(1712370734598221825L, null);
Collection<GroupModel> GroupModelResult = collectionFeignClientResult.getResult();
List<GroupModel> collect = GroupModelResult.stream().filter(e -> "twoStipulate".equals(e.getGroupDesc())).collect(Collectors.toList());
List<Map<String, Object>> result = new ArrayList<>();
for (GroupModel groupModel : collect) {
Map<String, Object> map = new HashMap<>();
map.put("groupName", groupModel.getGroupName());
map.put("sequenceNbr", groupModel.getSequenceNbr());
result.add(map);
}
return result;
}
@Override
public Map<String, Object> getPersonType() {
ReginParams reginParams = JSON.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
if (ObjectUtils.isEmpty(reginParams)) {
return null;
}
String userId = reginParams.getUserModel().getUserId();
TzsUserInfo tzsUserInfo = tzsUserInfoMapper.selectOne(new QueryWrapper<TzsUserInfo>().eq("amos_user_id", userId));
Map<String, Object> result = new HashMap<>();
result.put("postName", tzsUserInfo.getPostName());
return result;
}
@Override
public List<GroupAndPersonInfoDto> getGroupAndPersonInfo(Long groupId) {
List<GroupAndPersonInfoDto> result = new ArrayList<>();
List<AgencyUserModel> agencyUserModelList = Privilege.groupUserClient.queryForList(groupId).getResult();
List<CompanyModel> companyModelList = Privilege.companyClient.queryForCompanyList(null, "company").getResult();
HashMap<String,Object> companyMap = new HashMap<>();
for (CompanyModel companyModel : companyModelList) {
companyMap.put(companyModel.getCompanyCode(), companyModel.getOrgCode());
}
StopWatch stopWatch = new StopWatch();
stopWatch.start();
List<String> UserIds = agencyUserModelList.stream().map(AgencyUserModel::getUserId).collect(Collectors.toList());
List<GroupAndPersonInfoDto> groupAndPersonInfoDtoList = tzsUserInfoMapper.getUnitInfoByUserIds(UserIds);
DataDictionary dataDictionary = iDataDictionaryService.getByExtend(groupId.toString(), QYRYGW);
for (GroupAndPersonInfoDto groupAndPersonInfoDto : groupAndPersonInfoDtoList) {
if (!ObjectUtils.isEmpty(groupAndPersonInfoDto)) {
groupAndPersonInfoDto.setGroupId(groupId);
groupAndPersonInfoDto.setGroupName(ObjectUtils.isEmpty(dataDictionary) ? null : dataDictionary.getName());
String unitOrgCode = String.valueOf(companyMap.get(groupAndPersonInfoDto.getUnitCode()));
groupAndPersonInfoDto.setUnitOrgCode("null".equals(unitOrgCode)? null: unitOrgCode);
String[] UnitType = groupAndPersonInfoDto.getUnitType().split(",");
if (UnitType.length > 0) {
StringBuilder unitTypeCode = new StringBuilder();
for (String s : UnitType) {
unitTypeCode.append(UnitTypeEnum.getCode.get(s)).append(",");
}
groupAndPersonInfoDto.setUnitTypeCode(unitTypeCode.substring(0, unitTypeCode.length() - 1));
} else {
groupAndPersonInfoDto.setUnitTypeCode(UnitTypeEnum.getCode.get(UnitType));
}
if (!ObjectUtils.isEmpty(groupAndPersonInfoDto.getEquipCategory())) {
String EquipCategory = groupAndPersonInfoDto.getEquipCategory()
.replace("[", "")
.replace("]", "")
.replace("\"", "");
List<String> equipCategoryList = Arrays.asList(EquipCategory.split(","));
if (equipCategoryList.size() > 0) {
StringBuilder equipCategoryCode = new StringBuilder();
StringBuilder equipCategory = new StringBuilder();
for (String s : equipCategoryList) {
equipCategoryCode.append(s).append(",");
equipCategory.append(EquipmentClassifityEnum.getName.get(s)).append(",");
}
groupAndPersonInfoDto.setEquipCategory(equipCategory.substring(0, equipCategory.length() - 1));
groupAndPersonInfoDto.setEquipCategoryCode(equipCategoryCode.substring(0, equipCategoryCode.length() - 1));
} else {
groupAndPersonInfoDto.setEquipCategory(EquipmentClassifityEnum.getName.get(equipCategoryList.get(0)));
groupAndPersonInfoDto.setEquipCategoryCode(equipCategoryList.get(0));
}
} else {
groupAndPersonInfoDto.setEquipCategory(null);
groupAndPersonInfoDto.setEquipCategoryCode(null);
}
result.add(groupAndPersonInfoDto);
}
}
stopWatch.stop();
System.out.printf("组装数据耗时%f秒/n", stopWatch.getTotalTimeSeconds());
return result;
}
@Override
public Boolean createUnitPerson() {
List<TzsUserInfo> result = tzsUserInfoMapper.getUnitPersonInfo();
return this.saveBatch(result);
}
// @Override
// public void testGroup() {
// List<String> userIds = tzsUserInfoMapper.selectUserIds();
// String groupSeq = "1712372080231608322";
// Privilege.groupUserClient.create(Long.valueOf(groupSeq), userIds);
// }
@Override
public List<Map<String, Object>> getUserType(String unitType) {
if (unitType.equals("pro")) {
return tzsUserInfoMapper.getUserType("QYRYGW-SCDW");
......@@ -415,4 +524,25 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
}
}
public List<LinkedHashMap> screenData(List<LinkedHashMap> result, List<LinkedHashMap> data, String id) {
if (!ObjectUtils.isEmpty(result)) {
return result;
}
List<LinkedHashMap> list = data.stream().filter(item -> item.get("sequenceNbr").toString().equals(id)).collect(Collectors.toList());
if (!ObjectUtils.isEmpty(list)) {
return list;
}
for (LinkedHashMap item : data) {
if (!ObjectUtils.isEmpty(item.get("children"))) {
List<LinkedHashMap> children = screenData(result, (List<LinkedHashMap>) item.get("children"), id);
if (!ObjectUtils.isEmpty(children)) {
result = children;
break;
}
}
}
return result;
}
}
......@@ -23,15 +23,14 @@ import com.yeejoin.amos.boot.module.tcm.api.dto.TzsBaseInstitutionDto;
import com.yeejoin.amos.boot.module.tcm.api.entity.BaseUnitLicence;
import com.yeejoin.amos.boot.module.tcm.api.entity.TzBaseEnterpriseInfo;
import com.yeejoin.amos.boot.module.tcm.api.entity.TzsBaseInstitution;
import com.yeejoin.amos.boot.module.tcm.api.entity.TzsUserInfo;
import com.yeejoin.amos.boot.module.tcm.api.enums.CompanyLevelEnum;
import com.yeejoin.amos.boot.module.tcm.api.enums.EnterpriseEnums;
import com.yeejoin.amos.boot.module.tcm.api.mapper.TzBaseEnterpriseInfoMapper;
import com.yeejoin.amos.boot.module.tcm.api.mapper.TzsBaseIndividualityMapper;
import com.yeejoin.amos.boot.module.tcm.api.mapper.TzsBaseInstitutionMapper;
import com.yeejoin.amos.boot.module.tcm.biz.service.impl.BaseUnitLicenceServiceImpl;
import com.yeejoin.amos.boot.module.tcm.biz.service.impl.EquipmentCategoryServiceImpl;
import com.yeejoin.amos.boot.module.tcm.biz.service.impl.StartPlatformTokenService;
import com.yeejoin.amos.boot.module.tcm.biz.service.impl.TzBaseEnterpriseInfoServiceImpl;
import com.yeejoin.amos.boot.module.tcm.api.mapper.TzsUserInfoMapper;
import com.yeejoin.amos.boot.module.tcm.biz.service.impl.*;
import com.yeejoin.amos.boot.module.tcm.biz.utils.RedisUtil;
import com.yeejoin.amos.boot.module.tcm.flc.api.dto.RegUnitIcDto;
import com.yeejoin.amos.boot.module.tcm.flc.api.dto.RegUnitInfoDto;
......@@ -144,6 +143,9 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
@Autowired
TzsBaseInstitutionMapper tzsBaseInstitutionMapper;
@Autowired
TzsUserInfoServiceImpl tzsUserInfoService;
private final Logger logger = LogManager.getLogger(RegUnitInfoServiceImpl.class);
/**
......@@ -833,6 +835,20 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
if (userResult == null || userResult.getResult() == null) {
throw new BadRequest("单位注册失败");
}
//同步创建为当前注册管理员添加两员配备人员信息
if (userResult.getStatus() == 200) {
TzsUserInfo tzsUserInfo = new TzsUserInfo();
tzsUserInfo.setName(regUnitInfo.getAdminName());
tzsUserInfo.setCertificateType("344");
tzsUserInfo.setLockStatus("UNLOCK");
tzsUserInfo.setCertificateNum(regUnitInfo.getAdminIdNumber());
tzsUserInfo.setUnitName(regUnitInfo.getName());
tzsUserInfo.setUnitCode(regUnitInfo.getUnitCode());
tzsUserInfo.setPhone(regUnitInfo.getAdminTel());
tzsUserInfo.setAmosUserId(userResult.getResult().getUserId());
tzsUserInfo.setAmosUserName(regUnitInfo.getAdminLoginName());
tzsUserInfoService.save(tzsUserInfo);
}
regUnitInfo.setAdminUserId(userResult.getResult().getUserId());
regUnitInfo.setAmosCompanySeq(companyInfo.getSequenceNbr().toString());
// 3.3 org_user 创建组织机构
......
......@@ -7,11 +7,11 @@ eureka.client.service-url.defaultZone=http://172.16.10.210:10001/eureka/
eureka.instance.prefer-ip-address=true
management.endpoint.health.show-details=always
management.endpoints.web.exposure.include=*
eureka.instance.health-check-url=http://172.16.3.34:${server.port}${server.servlet.context-path}/actuator/health
eureka.instance.health-check-url=http://172.16.3.17:${server.port}${server.servlet.context-path}/actuator/health
eureka.instance.metadata-map.management.context-path=${server.servlet.context-path}/actuator
eureka.instance.status-page-url=http://172.16.3.34:${server.port}${server.servlet.context-path}/actuator/info
eureka.instance.metadata-map.management.api-docs=http://172.16.3.34:${server.port}${server.servlet.context-path}/doc.html
eureka.instance.ip-address=172.16.3.34
eureka.instance.status-page-url=http://172.16.3.17:${server.port}${server.servlet.context-path}/actuator/info
eureka.instance.metadata-map.management.api-docs=http://172.16.3.17:${server.port}${server.servlet.context-path}/doc.html
eureka.instance.ip-address=172.16.3.17
## ES properties:
elasticsearch.username=elastic
elasticsearch.password=a123456
......
......@@ -88,5 +88,6 @@ public interface EquipmentCategoryMapper extends BaseMapper<EquipmentCategory> {
List<Map<String, Object>> getEquCategory(@Param("recordList") List<String> recordList);
List<String> selectXiXianNew();
}
......@@ -21,7 +21,7 @@ public interface IEquipmentCategoryService {
Page equipClaimOverview();
Map<String, String> createSupervisorCode(Map<String, Object> map, String record);
Map<String, String> createSupervisorCode(Map<String, Object> map);
List<LinkedHashMap> getTree();
List<LinkedHashMap> creatTree();
......@@ -42,5 +42,5 @@ public interface IEquipmentCategoryService {
ResponseModel submit(Map<String, Object> map);
void creatXiXian();
void creatXiXian(String type);
}
......@@ -569,12 +569,18 @@
<select id="selectWriteXiXian" resultType="java.lang.String">
SELECT
record
ibjoi."RECORD"
FROM
idx_biz_jg_other_info
"biz_jg_supervisory_code" bjsc
LEFT JOIN idx_biz_jg_other_info ibjoi ON bjsc.code96333 = ibjoi."CODE96333"
LEFT JOIN idx_biz_jg_supervision_info ibjsi ON ibjsi.record = ibjoi.record
WHERE
"CODE96333" IN ( SELECT code96333 FROM "biz_jg_supervisory_code" WHERE code96333 LIKE'31%' AND supervisory_code LIKE'D%' AND (status = '1' or status = '2') )
AND "CLAIM_STATUS" = '已认领';
ibjsi."ORG_BRANCH_CODE" LIKE'50*18667%'
AND ( bjsc.code96333 LIKE'31%' OR bjsc.code96333 LIKE'33%' )
AND bjsc.supervisory_code LIKE'D%'
AND ( bjsc.status = '1' OR bjsc.status = '2' )
AND create_status = 0
AND "CLAIM_STATUS" = '已认领'
</select>
<update id="clearCode">
......@@ -593,13 +599,18 @@
<select id="selectXiXian" resultType="java.lang.String">
SELECT
record
ibjoi."RECORD"
FROM
idx_biz_jg_other_info
idx_biz_jg_other_info ibjoi
LEFT JOIN idx_biz_jg_supervision_info ibjsi ON ibjsi.record = ibjoi.record
LEFT JOIN "biz_jg_supervisory_code" bjsc ON bjsc.supervisory_code = ibjoi."SUPERVISORY_CODE"
WHERE
"RECORD" IN ( SELECT "RECORD" FROM idx_biz_jg_supervision_info WHERE "ORG_BRANCH_CODE" LIKE'50*18667%' )
AND "CLAIM_STATUS" = '已认领'
AND ( "CODE96333" NOT LIKE'31%' OR "CODE96333" IS NULL );
ibjsi."ORG_BRANCH_CODE" LIKE'50*18667%'
AND ibjoi."SUPERVISORY_CODE" NOT LIKE'X%'
AND ( ibjoi."CODE96333" NOT LIKE'31%' OR ibjoi."CODE96333" IS NULL )
AND ( bjsc.status = '1' OR bjsc.status = '2' )
AND create_status = 1
AND "CLAIM_STATUS" = '已认领';
</select>
<delete id="clearSupervisoryCode">
......@@ -636,6 +647,37 @@
<delete id="clearSupervisoryCodeAndXiXian">
delete "biz_jg_supervisory_code" WHERE code96333 LIKE '31%' AND supervisory_code LIKE 'D%' AND (status = '1' or status = '2');
DELETE
"biz_jg_supervisory_code"
WHERE
code96333 IN (
SELECT
ibjoi."CODE96333"
FROM
"biz_jg_supervisory_code" bjsc
LEFT JOIN idx_biz_jg_other_info ibjoi ON bjsc.code96333 = ibjoi."CODE96333"
LEFT JOIN idx_biz_jg_supervision_info ibjsi ON ibjsi.record = ibjoi.record
WHERE
ibjsi."ORG_BRANCH_CODE" LIKE '50*18667%'
AND ( bjsc.code96333 LIKE '31%' OR bjsc.code96333 LIKE '33%' )
AND bjsc.supervisory_code LIKE 'D%'
AND ( bjsc.status = '1' OR bjsc.status = '2' )
AND create_status = 0
AND "CLAIM_STATUS" = '已认领'
);
</delete>
<select id="selectXiXianNew" resultType="java.lang.String">
SELECT
ibjoi."RECORD"
FROM
idx_biz_jg_other_info ibjoi
LEFT JOIN idx_biz_jg_supervision_info ibjsi ON ibjsi.record = ibjoi.record
LEFT JOIN "biz_jg_supervisory_code" bjsc ON bjsc.supervisory_code = ibjoi."SUPERVISORY_CODE"
WHERE
ibjsi."ORG_BRANCH_CODE" LIKE'50*18667%'
AND ibjoi."SUPERVISORY_CODE" NOT LIKE'X%'
AND ( ibjoi."CODE96333" NOT LIKE'31%' OR ibjoi."CODE96333" IS NULL )
AND "CLAIM_STATUS" = '已认领';
</select>
</mapper>
......@@ -217,7 +217,7 @@ public class EquipmentCategoryController extends BaseController {
@RequestMapping(value = "/createSupervisorCode", method = RequestMethod.POST)
@ApiOperation(httpMethod = "POST", value = "生成监管码和96333码", notes = "生成监管码和96333码")
public ResponseModel<Object> createSupervisorCode(@RequestBody Map<String,Object> map) {
return ResponseHelper.buildResponse(equipmentCategoryService.createSupervisorCode(map,null));
return ResponseHelper.buildResponse(equipmentCategoryService.createSupervisorCode(map));
}
/**
......@@ -307,8 +307,8 @@ public class EquipmentCategoryController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@GetMapping(value = "/creatXiXian")
@ApiOperation(httpMethod = "GET", value = "西咸存量数据处理功能", notes = "西咸存量数据处理功能")
public ResponseModel<Object> creatXiXian() {
equipmentCategoryService.creatXiXian();
public ResponseModel<Object> creatXiXian(@RequestParam String type) {
equipmentCategoryService.creatXiXian(type);
return ResponseHelper.buildResponse("ok");
}
......
......@@ -432,56 +432,30 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
* 生成监管码和电梯96333识别码
*/
@Override
public Map<String, String> createSupervisorCode(Map<String, Object> map, String record) {
String city, county, equipCategory;
EquInfoDto equInfoDto = new EquInfoDto();
if (ObjectUtils.isEmpty(record)) {
//获取对应行政区划
county = EquipmentCategoryEnum.XZQH.getCode();
city = map.get("regionCode").toString();
//获取对应设备分类
equipCategory = map.get("equCategory").toString();
} else {
equInfoDto = categoryOtherInfoMapper.selectEquipInfo(record);
//判断这条数据认领状态是否为已认领,否则直接返回
if (!ObjectUtils.isEmpty(equInfoDto) && EquipmentCategoryEnum.YRL.getName().equals(equInfoDto.getStatus())) {
city = equInfoDto.getCity();
county = equInfoDto.getCounty();
equipCategory = equInfoDto.getEquipCategory();
} else {
return new HashMap<>();
}
}
public Map<String, String> createSupervisorCode(Map<String, Object> map) {
String city, county, equipCategory,isNotXiXian;
//获取对应行政区划
city = String.valueOf(map.get("cityCode"));
county = String.valueOf(map.get("countyCode"));
//获取对应设备分类
equipCategory = String.valueOf(map.get("equCategory"));
if ("null".equals(equipCategory) || "null".equals(city) || "null".equals(county)) {
throw new BadRequest("请求参数不全,请查看参数中是否携带 cityCode、countyCode、equCategory 三个参数及对应值");
}
isNotXiXian = "null".equals(String.valueOf(map.get("isXiXian"))) ? "0" : "1";
//生成码
EquipmentCategoryServiceImpl categoryService = (EquipmentCategoryServiceImpl) AopContext.currentProxy();
Map<String, String> codeMap = categoryService.creatCode(null,city, county, equipCategory, null, null);
Map<String, String> codeMap = categoryService.creatCode(isNotXiXian, city, county, equipCategory, null, null);
if (ObjectUtils.isEmpty(codeMap)) {
return new HashMap<>();
throw new BadRequest("该请求参数未生成监管码或96333码,请核对参数");
}
log.info(record + "已生成对应监管码或96333电梯识别码");
String equState = EquipmentCategoryEnum.CSZT.getCode();
SupervisoryCodeInfo supervisoryCodeInfo = new SupervisoryCodeInfo();
supervisoryCodeInfo.setCode96333(codeMap.get("code96333"));
supervisoryCodeInfo.setSupervisoryCode(codeMap.get("superviseCode"));
supervisoryCodeInfo.setStatus(equState);
if (!ObjectUtils.isEmpty(record)) {
String supervisorCode, elevatorCode;
//设备状态为报废,对应电梯码作废
equState = EquipmentCategoryEnum.BF.getCode().equals(equInfoDto.getEquState()) ? EquipmentCategoryEnum.WSY.getCode() : EquipmentCategoryEnum.YSY.getCode();
supervisorCode = codeMap.get("superviseCode");
elevatorCode = EquipmentCategoryEnum.BF.getCode().equals(equInfoDto.getEquState()) ? null : codeMap.get("code96333");
List<CategoryOtherInfo> categoryOtherInfo = categoryOtherInfoMapper.selectList(new QueryWrapper<CategoryOtherInfo>().eq("SUPERVISORY_CODE", supervisorCode));
if (categoryOtherInfo.size() > 0) {
supervisoryCodeInfoMapper.update(supervisoryCodeInfo, new QueryWrapper<SupervisoryCodeInfo>().eq("supervisory_code", supervisoryCodeInfo.getSupervisoryCode()));
} else {
supervisoryCodeInfo.setStatus(equState);
supervisoryCodeInfoMapper.insert(supervisoryCodeInfo);
}
//修改源数据的电梯码
categoryOtherInfoMapper.updateSupervisorCode(supervisorCode, elevatorCode, record);
} else {
supervisoryCodeInfoMapper.insert(supervisoryCodeInfo);
}
supervisoryCodeInfoMapper.insert(supervisoryCodeInfo);
return codeMap;
}
......@@ -1527,6 +1501,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
} else if (EquipmentCategoryEnum.DRL.getName().equals(claimStatus)) {
supervisionMap.put("CODE96333", "null".equals(code96333) ? null : code96333);
map.put(supervision_form_id, supervisionMap);
supervisoryCodeInfo.setCode96333("null".equals(code96333) ? null : code96333);
//根据操作状态判断是调用新增还是修改接口
record = batchSubmitOrUpdate(map, registerForm, alias, isCopy, operateType, claimStatus);
} else {
......@@ -1570,51 +1545,58 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
}
@Override
public void creatXiXian() {
// 1查找以31开头的96333码对应的数据writeRecordList
public void creatXiXian(String type) {
// 1查找以31或者33开头且为用户手动录入的96333码对应的数据writeRecordList
List<String> writeRecordList = equipmentCategoryMapper.selectWriteXiXian();
// 1.1删除码表中以31开头的96333码对应的数据
equipmentCategoryMapper.clearSupervisoryCodeAndXiXian();
// 1.2将以31开头的96333码对应的数据的监管码清空
equipmentCategoryMapper.updateSupervisoryCode(writeRecordList);
if (!ObjectUtils.isEmpty(writeRecordList)) {
// 1.1删除码表中以31或者33开头且为用户手动录入
equipmentCategoryMapper.clearSupervisoryCodeAndXiXian();
// 1.2将以31或者33开头且为用户手动录入的96333码对应的数据的监管码清空
equipmentCategoryMapper.updateSupervisoryCode(writeRecordList);
}
// 2查找管辖机构为西咸,但96333码不为31开头的数据recordList
List<String> recordList = equipmentCategoryMapper.selectXiXian();
// 2.1删除码表中recordList对应的码数据
equipmentCategoryMapper.clearSupervisoryCode();
// 2.2清空业务表中recordList对应的96333码和监管码
equipmentCategoryMapper.clearCode(recordList);
List<String> recordList = !"new".equals(type) ? equipmentCategoryMapper.selectXiXian() : equipmentCategoryMapper.selectXiXianNew();
if(!ObjectUtils.isEmpty(recordList)){
// 2.1删除码表中recordList对应的码数据
equipmentCategoryMapper.clearSupervisoryCode();
// 2.2清空业务表中recordList对应的96333码和监管码
equipmentCategoryMapper.clearCode(recordList);
}
// 3 将recordList合并到writeRecordList
writeRecordList.addAll(recordList);
List<Map<String,Object>> equCategoryList= equipmentCategoryMapper.getEquCategory(writeRecordList);
// 4、生成对应的96333和监管码
for (Map<String, Object> map : equCategoryList) {
String code96333 = null;
String category = map.get("category").toString();
String supervisoryCode = createSupervisorCode("1", XIAN_YANG, null,category);
SupervisoryCodeInfo supervisoryCodeInfo = new SupervisoryCodeInfo();
supervisoryCodeInfo.setSupervisoryCode(supervisoryCode);
supervisoryCodeInfo.setStatus(EquipmentCategoryEnum.YSY.getCode());
if (category.startsWith("3")) {
if ("null".equals(map.get("code"))) {
code96333 = createElevatorCode("31");
supervisoryCodeInfo.setCreateStatus(CREATE);
} else {
supervisoryCodeInfo.setCreateStatus(NOT_CREATE);
code96333 = map.get("code").toString();
List<Map<String, Object>> equCategoryList = new ArrayList<>();
if (!ObjectUtils.isEmpty(writeRecordList)) {
equCategoryList = equipmentCategoryMapper.getEquCategory(writeRecordList);
// 4、生成对应的96333和监管码
for (Map<String, Object> map : equCategoryList) {
String code96333 = null;
String category = map.get("category").toString();
String supervisoryCode = createSupervisorCode("1", XIAN_YANG, null, category);
SupervisoryCodeInfo supervisoryCodeInfo = new SupervisoryCodeInfo();
supervisoryCodeInfo.setSupervisoryCode(supervisoryCode);
supervisoryCodeInfo.setStatus(EquipmentCategoryEnum.YSY.getCode());
if (category.startsWith("3")) {
if ("null".equals(map.get("code"))) {
code96333 = createElevatorCode("31");
supervisoryCodeInfo.setCreateStatus(CREATE);
} else {
supervisoryCodeInfo.setCreateStatus(NOT_CREATE);
code96333 = map.get("code").toString();
}
}
supervisoryCodeInfo.setCode96333(code96333);
//更新至码表
supervisoryCodeInfoMapper.insert(supervisoryCodeInfo);
CategoryOtherInfo categoryOtherInfo = new CategoryOtherInfo();
categoryOtherInfo.setCode(code96333);
categoryOtherInfo.setSupervisoryCode(supervisoryCode);
// 更新至业务表
categoryOtherInfoMapper.updateSupervisorCode(supervisoryCode, code96333, map.get("record").toString());
// 更新至一码通es
checkEsData(map.get("record").toString());
// 更新至电梯es
saveEsElevator2ES(map.get("record").toString());
}
supervisoryCodeInfo.setCode96333(code96333);
//更新至码表
supervisoryCodeInfoMapper.insert(supervisoryCodeInfo);
CategoryOtherInfo categoryOtherInfo = new CategoryOtherInfo();
categoryOtherInfo.setCode(code96333);
categoryOtherInfo.setSupervisoryCode(supervisoryCode);
// 更新至业务表
categoryOtherInfoMapper.updateSupervisorCode(supervisoryCode, code96333, map.get("record").toString());
// 更新至一码通es
checkEsData(map.get("record").toString());
// 更新至电梯es
saveEsElevator2ES(map.get("record").toString());
}
}
......
......@@ -44,7 +44,7 @@
<dependency>
<groupId>com.yeejoin</groupId>
<artifactId>amos-feign-privilege</artifactId>
<version>1.8.5</version>
<version>1.8.6</version>
</dependency>
<dependency>
......
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