Commit 282cf5b7 authored by tianbo's avatar tianbo

Merge branch 'develop_tzs_register' of…

Merge branch 'develop_tzs_register' of http://39.98.45.134:8090/moa/amos-boot-biz into develop_tzs_register
parents 2845ccb3 38f0d238
......@@ -6,6 +6,7 @@ import lombok.Getter;
public enum CyclinderStatus {
NOHEGE("3139","不合格"),
NOT_UPLOAD("","未上传"),
HEGE("3140","合格");
private String code;
private String name;
......
......@@ -29,10 +29,12 @@ public interface CylCylinderFillingCheckMapper extends BaseMapper<CylinderFillin
List<CylinderInfo> getCylinderInfoList();
void updateBatch(@Param("sequenceNbrS") List<Long> sequenceNbrS);
List<CylinderFilling> queryUnSyncFilling();
void updataSyncFilling(List<String> appIds,List<String> fillingBeforeIds,List<String> sequenceCodes);
void batchInsert(@Param("list") List<CylinderFilling> list);
boolean updataSyncFilling(@Param("ids") List<Long> appIds);
boolean saveAndBatchInsert(@Param("list") List<CylinderFilling> list);
Long selectCountTotal();
......@@ -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);
}
......@@ -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,16 +71,27 @@
<update id="updataSyncFilling">
update tm_cylinder_filling set sync_state = 3
<where>
app_id in
<foreach collection="appIds" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
and filling_before_id in
<foreach collection="fillingBeforeIds" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
and sequence_code in
<foreach collection="sequenceCodes" item="item" index="index" open="(" close=")" separator=",">
<!-- <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>
......@@ -122,13 +133,17 @@
) / 16 AS DECIMAL(10, 2)
) integrity
FROM tm_cylinder_filling cf
WHERE cf.sync_state != 3
ORDER BY
cf.sync_date DESC
LIMIT 10
WHERE
cf.sync_state != 3
and cf.filling_before_id is not null
and cf.sequence_code is not null
and cf.app_id is not null
LIMIT 1000
</select>
<insert id="batchInsert">
INSERT INTO tz_cylinder_filling (
<insert id="saveAndBatchInsert">
INSERT INTO "amos_tzs_biz"."tz_cylinder_filling"
(
sequence_nbr,
filling_before_id,
filling_unit_name,
......@@ -158,8 +173,8 @@
#{item.sequenceNbr},
#{item.fillingBeforeId},
#{item.fillingUnitName},
#{item.isValid},
#{item.sequenceCode},
#{item.isValid},
#{item.same},
#{item.isRegulations},
#{item.isComplianceWithgbt},
......@@ -171,7 +186,7 @@
#{item.recDate},
#{item.recUserId},
#{item.syncDate},
#{item.syncState},
'3',
#{item.appId},
#{item.integrity},
#{item.creditCode},
......@@ -206,38 +221,29 @@
nonconformances = EXCLUDED.nonconformances
</insert>
<select id="selectCountTotal" resultType="java.lang.Long">
SELECT COUNT
( 1 )
FROM
(
SELECT
sequence_nbr
count(1)
FROM
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,
......@@ -307,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>
......@@ -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,21 +39,22 @@ 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++) {
// 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
public void traverseSave() {
......@@ -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,11 +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";
......@@ -136,67 +146,135 @@ public class CylSyncServiceImpl {
return "success";
}
@Transactional
@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 -> {
CylinderFilling clf = new CylinderFilling();
BeanUtils.copyProperties(e, clf);
appIds.add(e.getAppId());
fillingBeforeIds.add(e.getFillingBeforeId());
sequenceCodes.add(e.getSequenceCode());
if (!ObjectUtil.isEmpty(e.getIsValid()) && ("1" == e.getIsValid() || "0" == e.getIsValid())){
e.setIsValid(CylDictEnum.getEnum(Integer.valueOf(e.getIsValid()), "isValid").getSeqNbr().toString());
// 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");
if (cylDictEnum != null) {
e.setIsValid(cylDictEnum.getSeqNbr().toString());
}
if(!ObjectUtil.isEmpty(e.getSame()) && (1==e.getSame() || 0== e.getSame())){
e.setSame(CylDictEnum.getEnum(e.getSame(), "same").getSeqNbr());
}
if(!ObjectUtil.isEmpty(e.getIsRegulations()) && (1==e.getIsRegulations() || 0== e.getIsRegulations())){
e.setIsRegulations(CylDictEnum.getEnum(e.getIsRegulations(), "isRegulations").getSeqNbr());
Integer same = e.getSame();
if (!ObjectUtil.isEmpty(same) && (1 == same || 0 == same)) {
CylDictEnum cylDictEnum = CylDictEnum.getEnum(same, "same");
if (cylDictEnum != null) {
e.setSame(cylDictEnum.getSeqNbr());
}
if(!ObjectUtil.isEmpty(e.getIsComplianceWithgbt()) && (1==e.getIsComplianceWithgbt() || 0== e.getIsComplianceWithgbt())){
e.setIsComplianceWithgbt(CylDictEnum.getEnum(e.getIsComplianceWithgbt(), "isComplianceWithGBT").getSeqNbr());
}
if(!ObjectUtil.isEmpty(e.getHaveStillPressure()) && (1==e.getHaveStillPressure() || 0== e.getHaveStillPressure())){
e.setHaveStillPressure(CylDictEnum.getEnum(e.getHaveStillPressure(), "haveStillPressure").getSeqNbr());
Integer isRegulations = e.getIsRegulations();
if (!ObjectUtil.isEmpty(isRegulations) && (1 == isRegulations || 0 == isRegulations)) {
CylDictEnum cylDictEnum = CylDictEnum.getEnum(isRegulations, "isRegulations");
if (cylDictEnum != null) {
e.setIsRegulations(cylDictEnum.getSeqNbr());
}
}
if (!ObjectUtil.isEmpty(e.getIsComplete()) && (1==e.getIsComplete() || 0== e.getIsComplete())){
e.setIsComplete(CylDictEnum.getEnum(e.getIsComplete(), "isComplete").getSeqNbr());
Integer isComplianceWithgbt = e.getIsComplianceWithgbt();
if (!ObjectUtil.isEmpty(isComplianceWithgbt) && (1 == isComplianceWithgbt || 0 == isComplianceWithgbt)) {
CylDictEnum cylDictEnum = CylDictEnum.getEnum(isComplianceWithgbt, "isComplianceWithGBT");
if (cylDictEnum != null) {
e.setIsComplianceWithgbt(cylDictEnum.getSeqNbr());
}
}
Integer haveStillPressure = e.getHaveStillPressure();
if (!ObjectUtil.isEmpty(haveStillPressure) && (1 == haveStillPressure || 0 == haveStillPressure)) {
CylDictEnum cylDictEnum = CylDictEnum.getEnum(haveStillPressure, "haveStillPressure");
if (cylDictEnum != null) {
e.setHaveStillPressure(cylDictEnum.getSeqNbr());
}
if (!ObjectUtil.isEmpty(e.getHaveSecurityDocuments()) && (1==e.getHaveSecurityDocuments() || 0== e.getHaveSecurityDocuments())){
e.setHaveSecurityDocuments(CylDictEnum.getEnum(e.getHaveSecurityDocuments(), "SecurityDocuments").getSeqNbr());
}
Integer isComplete = e.getIsComplete();
if (!ObjectUtil.isEmpty(isComplete) && (1 == isComplete || 0 == isComplete)) {
CylDictEnum cylDictEnum = CylDictEnum.getEnum(isComplete, "isComplete");
if (cylDictEnum != null) {
e.setIsComplete(cylDictEnum.getSeqNbr());
}
}
Integer haveSecurityDocuments = e.getHaveSecurityDocuments();
if (!ObjectUtil.isEmpty(haveSecurityDocuments) && (1 == haveSecurityDocuments || 0 == haveSecurityDocuments)) {
CylDictEnum cylDictEnum = CylDictEnum.getEnum(haveSecurityDocuments, "SecurityDocuments");
if (cylDictEnum != null) {
e.setHaveSecurityDocuments(cylDictEnum.getSeqNbr());
}
}
});
sourceFillingCheckServiceImpl.updataSyncFilling(appIds, fillingBeforeIds, sequenceCodes);
cylCylinderFillingCheckMapper.batchInsert(data);
StopWatch stopWatch = new StopWatch();
stopWatch.start();
cylCylinderFillingCheckMapper.saveAndBatchInsert(data);
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++;
// StopWatch stopWatch = new StopWatch();
// stopWatch.start();
// Long count = sourceFillingCheckServiceImpl.fillingRecordSync();
// stopWatch.stop();
// System.out.println("统计总数耗时:"+ stopWatch.getTotalTimeSeconds());
return fillingRecordMessage();
}
} else {
return "no data sync";
}
for (int i = 0; i < times; i++) {
@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();
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<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);
sourceFillingCheckServiceImpl.updateSyncState(appIds, records);
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";
}
......
......@@ -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 void updataSyncFilling(List<String> appIds,List<String> fillingBeforeIds,List<String> sequenceCodes){
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
......@@ -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;
/**
* 企业类型
*/
@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.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);
}
}
}
......@@ -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,6 @@ public interface TzsUserInfoMapper extends BaseMapper<TzsUserInfo> {
@Param("companyCode") String companyCode,
@Param("userSeq") String userSeq,
@Param("dto") TzsEquipListDto dto);
GroupAndPersonInfoDto getUnitInfoByUserId(String userId);
}
......@@ -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;
......@@ -39,4 +41,10 @@ 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);
}
......@@ -152,4 +152,17 @@
</if>
</select>
<select id="getUnitInfoByUserId" resultType="com.yeejoin.amos.boot.module.tcm.api.dto.GroupAndPersonInfoDto">
SELECT
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
amos_user_id = #{userId}
</select>
</mapper>
\ No newline at end of file
......@@ -8,6 +8,7 @@ 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;
......@@ -16,6 +17,7 @@ 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;
......@@ -229,4 +231,30 @@ 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));
}
}
......@@ -12,10 +12,12 @@ 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;
......@@ -27,6 +29,7 @@ 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;
......@@ -405,6 +408,83 @@ 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();
if (!ObjectUtils.isEmpty(agencyUserModelList) && agencyUserModelList.size() > 0) {
for (AgencyUserModel agencyUserModel : agencyUserModelList) {
GroupAndPersonInfoDto groupAndPersonInfoDto = new GroupAndPersonInfoDto();
groupAndPersonInfoDto = tzsUserInfoMapper.getUnitInfoByUserId(agencyUserModel.getUserId());
groupAndPersonInfoDto.setGroupId(groupId);
String groupName = Privilege.groupClient.seleteOne(groupId).getResult().getGroupName();
groupAndPersonInfoDto.setGroupName(groupName);
groupAndPersonInfoDto.setUserId(agencyUserModel.getUserId());
groupAndPersonInfoDto.setUserName(agencyUserModel.getRealName());
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));
}
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));
}
result.add(groupAndPersonInfoDto);
}
}
return result;
}
@Override
public List<Map<String, Object>> getUserType(String unitType) {
if (unitType.equals("pro")) {
return tzsUserInfoMapper.getUserType("QYRYGW-SCDW");
......
......@@ -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
......
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