diff --git a/epmet-auth/src/main/java/com/epmet/controller/ThirdLoginController.java b/epmet-auth/src/main/java/com/epmet/controller/ThirdLoginController.java index 44ca89df30..3f23ee88c8 100644 --- a/epmet-auth/src/main/java/com/epmet/controller/ThirdLoginController.java +++ b/epmet-auth/src/main/java/com/epmet/controller/ThirdLoginController.java @@ -9,10 +9,7 @@ import com.epmet.dto.result.UserTokenResultDTO; import com.epmet.service.ThirdLoginService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import java.util.List; @@ -219,4 +216,16 @@ public class ThirdLoginController { ValidatorUtils.validateEntity(formDTO); return new Result().ok(thirdLoginService.govLoginInternalDing(formDTO)); } + + /** + * 根据免登授权码, 获取登录用户身份 + * + * @param authCode 烟台认证中心 授权码 + * @return + */ + @PostMapping("sso-govlogin-yantai/{authCode}") + public Result yantaiSSOLogin(@PathVariable(value = "authCode") String authCode) { + return new Result().ok(thirdLoginService.yanTaiSSOLogin(authCode)); + } + } diff --git a/epmet-auth/src/main/java/com/epmet/service/ThirdLoginService.java b/epmet-auth/src/main/java/com/epmet/service/ThirdLoginService.java index dff5e129e5..f939656023 100644 --- a/epmet-auth/src/main/java/com/epmet/service/ThirdLoginService.java +++ b/epmet-auth/src/main/java/com/epmet/service/ThirdLoginService.java @@ -117,4 +117,11 @@ public interface ThirdLoginService { * @return */ UserTokenResultDTO govLoginInternalDing(DingAppLoginMdFormDTO formDTO); + + /** + * desc:烟台sso根据authCode 获取本系统token + * @param authCode + * @return + */ + UserTokenResultDTO yanTaiSSOLogin(String authCode); } diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/GovWebServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/GovWebServiceImpl.java index 92e1de27a5..91828cb561 100644 --- a/epmet-auth/src/main/java/com/epmet/service/impl/GovWebServiceImpl.java +++ b/epmet-auth/src/main/java/com/epmet/service/impl/GovWebServiceImpl.java @@ -95,6 +95,7 @@ public class GovWebServiceImpl implements GovWebService, ResultDataResolver { //5.生成token存到redis并返回 UserTokenResultDTO userTokenResultDTO = new UserTokenResultDTO(); + userTokenResultDTO.setCustomerId(formDTO.getCustomerId()); userTokenResultDTO.setToken(this.packagingUserToken(formDTO, resultDTO.getUserId())); return userTokenResultDTO; diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java index 447e2cb1d5..3d2c2ebee0 100644 --- a/epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java +++ b/epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java @@ -27,6 +27,8 @@ import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.security.password.PasswordUtils; import com.epmet.commons.tools.security.user.LoginUserUtil; import com.epmet.commons.tools.utils.*; +import com.epmet.commons.tools.utils.api.yt.YantaiApi; +import com.epmet.commons.tools.utils.api.yt.YantaiSSOUser; import com.epmet.commons.tools.validator.PhoneValidatorUtils; import com.epmet.constant.AuthHttpUrlConstant; import com.epmet.constant.SmsTemplateConstant; @@ -35,10 +37,7 @@ import com.epmet.dto.dingres.DingUserDetailDTO; import com.epmet.dto.dingres.V2UserGetuserinfoResDTO; import com.epmet.dto.form.*; import com.epmet.dto.result.*; -import com.epmet.feign.EpmetMessageOpenFeignClient; -import com.epmet.feign.EpmetUserFeignClient; -import com.epmet.feign.EpmetUserOpenFeignClient; -import com.epmet.feign.GovOrgOpenFeignClient; +import com.epmet.feign.*; import com.epmet.jwt.JwtTokenProperties; import com.epmet.jwt.JwtTokenUtils; import com.epmet.redis.CaptchaRedis; @@ -98,6 +97,8 @@ public class ThirdLoginServiceImpl implements ThirdLoginService, ResultDataResol private EpmetUserFeignClient epmetUserFeignClient; @Autowired private GovWebService govWebService; + @Autowired + private ThirdOpenFeignClient thirdOpenFeignClient; /** * @param formDTO @@ -1078,6 +1079,20 @@ public class ThirdLoginServiceImpl implements ThirdLoginService, ResultDataResol return govWebService.loginByThirdPlatform(loginGovParam); } + @Override + public UserTokenResultDTO yanTaiSSOLogin(String authCode) { + YantaiSSOUser ssoUserInfo = YantaiApi.getLoginToken(authCode); + if (ssoUserInfo== null){ + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"登录失败-sso获取用户失败","登录失败-sso获取用户失败"); + } + + GovWebLoginFormDTO loginGovParam = new GovWebLoginFormDTO(); + loginGovParam.setCustomerId("1535072605621841922"); + loginGovParam.setPhone(ssoUserInfo.getMobile()); + + return govWebService.loginByThirdPlatform(loginGovParam); + } + /** * 最原始的企业内部应用开发,不授权给产品服务商 * @param miniAppId diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/commondto/IcEventComDTO.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/commondto/IcEventComDTO.java new file mode 100644 index 0000000000..529bc6c34a --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/commondto/IcEventComDTO.java @@ -0,0 +1,38 @@ +package com.epmet.commons.tools.dto.commondto; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description + * @Author yzm + * @Date 2022/10/11 13:08 + */ +@Data +public class IcEventComDTO implements Serializable { + private static final long serialVersionUID = -5166489408303997740L; + /** + * 事件Id + */ + private String icEventId; + /** + * 事件内容 + */ + private String eventContent; + /** + * 处理中:processing;已办结:closed_case + */ + private String status; + + /** + * 0:已回复 1:已转项目 2:已转需求3:转议题 + */ + private String operationType; + + /** + * 项目、需求ID、议题id + */ + private String operationId; +} + diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/commondto/TopicInfoComDTO.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/commondto/TopicInfoComDTO.java new file mode 100644 index 0000000000..65c001b97f --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/commondto/TopicInfoComDTO.java @@ -0,0 +1,65 @@ +package com.epmet.commons.tools.dto.commondto; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @Description + * @Author yzm + * @Date 2022/10/11 13:06 + */ +@Data +public class TopicInfoComDTO implements Serializable { + private static final long serialVersionUID = 4242861917113716511L; + /** + * 话题id + */ + private String topicId; + + /** + * 话题内容 + */ + private String topicContent; + + /** + * 图片列表 + */ + private List topicImgs; + + /** + * 话题语音-2022.10.10 + */ + private List topicVoices; + + /** + * 话题发表人(山东路168-尹女士) + */ + private String publishedUser; + + /** + * 话题发表时间 (时间戳 毫秒级) + */ + private Long publishedTime; + + + private String releaseTime; + + /** + * 小组类型(ordinary:楼院小组 branch:支部小组) + */ + private String groupType; + + /** + * 话题所属小组id + */ + private String groupId; + + /** + * 话题所属小组名称 + */ + private String groupName; + +} + diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/YtHsjcResDTO.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/YtHsjcResDTO.java index 4dcf8869a1..001c7fe0ae 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/YtHsjcResDTO.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/YtHsjcResDTO.java @@ -6,7 +6,7 @@ import java.util.List; /** - * @Description + * @Description 核酸结果查询 * @Author yzm * @Date 2022/9/26 17:04 */ diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java index 49ab921e0f..63f27f195b 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java @@ -537,6 +537,14 @@ public class RedisKeys { return rootPrefix.concat("gov:staff:").concat(customerId).concat(StrConstant.COLON).concat(staffId); } + public static String getCustomerAllStaffInfoKey(String customerId) { + return rootPrefix.concat("gov:allCustomerStaff:").concat(customerId).concat(StrConstant.COLON).concat("*"); + } + + public static String getCustomerStaffInfoKeyByMobile(String customerId,String mobile) { + return rootPrefix.concat("gov:allCustomerStaff:").concat(customerId).concat(StrConstant.COLON).concat(mobile); + } + /** * @description 网格信息 * diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerOrgRedis.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerOrgRedis.java index 7cb132b0f5..23a7f1dd3c 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerOrgRedis.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerOrgRedis.java @@ -57,7 +57,6 @@ public class CustomerOrgRedis { public static GridInfoCache getGridInfo(String gridId){ String key = RedisKeys.getGridInfoKey(gridId); Map grid = customerOrgRedis.redisUtils.hGetAll(key); - log.info("grid is {}", JSON.toJSONString(grid)); if (!CollectionUtils.isEmpty(grid)) { return ConvertUtils.mapToEntity(grid, GridInfoCache.class); } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerStaffRedis.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerStaffRedis.java index 37904be02b..66abe790f3 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerStaffRedis.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerStaffRedis.java @@ -9,6 +9,7 @@ import com.epmet.commons.tools.feign.CommonAggFeignClient; import com.epmet.commons.tools.redis.RedisKeys; import com.epmet.commons.tools.redis.RedisUtils; import com.epmet.commons.tools.redis.common.bean.CustomerStaffInfoCache; +import com.epmet.commons.tools.redis.common.bean.CustomerStaffInfoDTOCache; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; import lombok.extern.slf4j.Slf4j; @@ -138,4 +139,32 @@ public class CustomerStaffRedis { return customerStaffRedis.redisUtils.delete(key); } + /** + * Desc: 拉取烟台用户时使用。 + * 根据客户ID 手机号获取工作人员信息,没有返回null + * @param customerId + * @param mobile + * @author zxc + * @date 2022/10/19 14:18 + */ + public static CustomerStaffInfoDTOCache getStaffInfoByMobile(String customerId, String mobile){ + String key = RedisKeys.getCustomerStaffInfoKeyByMobile(customerId, mobile); + Map roleMap = customerStaffRedis.redisUtils.hGetAll(key); + if (!CollectionUtils.isEmpty(roleMap)) { + return ConvertUtils.mapToEntity(roleMap, CustomerStaffInfoDTOCache.class); + } + return null; + } + + /** + * Desc: 【烟台用】删除所有工作人员信息 + * @param customerId + * @author zxc + * @date 2022/10/19 14:28 + */ + public static void delAllCustomerStaff(String customerId){ + String key = RedisKeys.getCustomerAllStaffInfoKey(customerId); + customerStaffRedis.redisUtils.deleteByPattern(key); + } + } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/CustomerStaffInfoDTOCache.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/CustomerStaffInfoDTOCache.java new file mode 100644 index 0000000000..70d5da942a --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/CustomerStaffInfoDTOCache.java @@ -0,0 +1,133 @@ +package com.epmet.commons.tools.redis.common.bean; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * @Author zxc + * @DateTime 2022/10/19 14:26 + * @DESC + */ +@Data +public class CustomerStaffInfoDTOCache implements Serializable { + + private static final long serialVersionUID = 6967736754443092229L; + + + /** + * ID + */ + private String id; + + /** + * 关联User表的主键Id + */ + private String userId; + + /** + * 账户 + */ + private String userAccount; + + /** + * 真实姓名 + */ + private String realName; + + /** + * 性别0.未知,1男,2.女 + */ + private Integer gender; + + /** + * 邮箱 + */ + private String email; + + /** + * 手机号-唯一键 + */ + private String mobile; + + /** + * 地址 + */ + private String address; + + /** + * 删除标识 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + + /** + * fulltime专职parttime兼职 + */ + private String workType; + + /** + * 头像 + */ + private String headPhoto; + + /** + * inactive未激活,active已激活 + */ + private String activeFlag; + + /** + * 激活时间 + */ + private Date activeTime; + + /** + * 未禁用enable,已禁用diabled + */ + private String enableFlag; + + /** + * 客户id + */ + private String customerId; + + /** + * 角色名称 + */ + private String roleName; + + /** + * 登录密码 + */ + private String password; + + /** + * 身份证号 + */ + private String idCard; +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/ScanContentUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/ScanContentUtils.java index 6427301a18..e04227d5dc 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/ScanContentUtils.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/ScanContentUtils.java @@ -3,6 +3,7 @@ package com.epmet.commons.tools.utils; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.TypeReference; import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.enums.EnvEnum; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.scan.param.*; @@ -16,6 +17,7 @@ import org.springframework.util.CollectionUtils; import java.util.ArrayList; import java.util.List; +import java.util.stream.Collectors; /** * 扫描内容工具类 @@ -31,6 +33,15 @@ public class ScanContentUtils { * @return */ public static Result imgSyncScan(String url, ImgScanParamDTO param) { + //start 测试环境停机了,先这样改试试 + EnvEnum currentEnv = EnvEnum.getCurrentEnv(); + if(EnvEnum.LOCAL.getCode().equals(currentEnv.getCode())||EnvEnum.DEV.getCode().equals(currentEnv.getCode())){ + SyncScanResult syncScanResult=new SyncScanResult(); + syncScanResult.setSuccessDataIds(param.getTasks().stream().map(c -> c.getDataId()).collect(Collectors.toList())); + syncScanResult.setAllPass(true); + return new Result().ok(syncScanResult); + }//end + log.debug("imgSyncScan param:{}", JSON.toJSONString(param)); if (StringUtils.isBlank(url) || param == null) { throw new RenException("参数错误"); @@ -57,6 +68,15 @@ public class ScanContentUtils { * @return */ public static Result textSyncScan(String url, TextScanParamDTO param) { + //start 测试环境停机了,先这样改试试 + EnvEnum currentEnv = EnvEnum.getCurrentEnv(); + if(EnvEnum.LOCAL.getCode().equals(currentEnv.getCode())||EnvEnum.DEV.getCode().equals(currentEnv.getCode())){ + SyncScanResult syncScanResult=new SyncScanResult(); + syncScanResult.setSuccessDataIds(param.getTasks().stream().map(c -> c.getDataId()).collect(Collectors.toList())); + syncScanResult.setAllPass(true); + return new Result().ok(syncScanResult); + }//end + log.debug("textSyncScan param:{}", JSON.toJSONString(param)); if (StringUtils.isBlank(url) || param == null) { throw new RenException("参数错误"); diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/api/yt/OrgData.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/api/yt/OrgData.java new file mode 100644 index 0000000000..b5b7e96e09 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/api/yt/OrgData.java @@ -0,0 +1,92 @@ + +package com.epmet.commons.tools.utils.api.yt; + +import lombok.Data; + +import java.io.Serializable; + +/** + * desc:组织机构数据 实体类 + * @author liujianjun + */ +@Data +public class OrgData implements Serializable { + + /** + * 联系人姓名 + */ + private String contact; + /** + * 联系电话号码 + */ + private String contactTelephoneNumber; + + /** + * 详细地址 + */ + private String detailAddress; + + /** + * 组织机构第一名称 + */ + private String firstNameOfOrganization; + + /** + * 组织机构全称 + */ + private String nameOfOrganization; + + /** + * 排序号码 + */ + private String orderNumber; + + /** + * 组织机构简称 + */ + private String organizatioNabbreviation; + + /** + * 组织机构ID + */ + private String organizationId; + + /** + * 组织机构级别 + */ + private String organizationLevel; + + /** + * 组织机构路径 + */ + private String organizationPath; + + /** + * 组织机构类型 + */ + private String organizationType; + /** + * 注册类型 + */ + private String registrationType; + /** + * 统一社会信用代码 + */ + private String unifiedSocialCreditId; + + /** + * 上级ID + */ + private String pid; + + /** + * orgId全路径 + */ + private String pids; + + /** + * 上级组织名 + */ + private String parentOrgName; + +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/api/yt/SM4UtilsForYanTai.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/api/yt/SM4UtilsForYanTai.java new file mode 100644 index 0000000000..6c2ca8c60a --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/api/yt/SM4UtilsForYanTai.java @@ -0,0 +1,199 @@ +package com.epmet.commons.tools.utils.api.yt; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.apache.commons.codec.binary.Base64; +import org.bouncycastle.jce.provider.BouncyCastleProvider; + +import javax.crypto.BadPaddingException; +import javax.crypto.Cipher; +import javax.crypto.IllegalBlockSizeException; +import javax.crypto.SecretKey; +import javax.crypto.spec.SecretKeySpec; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.security.InvalidKeyException; +import java.security.Security; + +/** + * 烟台的认证中心-国密sm4加解密 + */ +public class SM4UtilsForYanTai { + private static String SM4_KEY = "yaweisoftware@xy"; + //编码格式 + private static final Charset encryptCharset = StandardCharsets.UTF_8; + + public enum Algorithm { + SM4("SM4","SM4","国密四,key长16byte"); + private String keyAlgorithm; + private String transformation; + private String description;//描述 + Algorithm(String keyAlgorithm, String transformation, String description) { + this.keyAlgorithm = keyAlgorithm; + this.transformation = transformation; + this.description = description; + } + public String getKeyAlgorithm() { + return this.keyAlgorithm; + } + public String getTransformation() { + return this.transformation; + } + public String getDescription() { + return this.description; + } + } + + private static final String PROVIDER_NAME = "BC"; + static { + Security.addProvider(new BouncyCastleProvider()); + } + + /** + * 自定字符串产生密钥 + * @param algorithm 加解密算法 + * @param keyStr 密钥字符串 + * @param charset 编码字符集 + * @return 密钥 + */ + public static SecretKey genKeyByStr(Algorithm algorithm, String keyStr, Charset charset) { + return readKeyFromBytes(algorithm, keyStr.getBytes(charset)); + } + + /** + * 根据指定字节数组产生密钥 + * @param algorithm 加解密算法 + * @param keyBytes 密钥字节数组 + * @return 密钥 + */ + public static SecretKey readKeyFromBytes(Algorithm algorithm, byte[] keyBytes) { + return new SecretKeySpec(keyBytes, algorithm.getKeyAlgorithm()); + } + + /****************************加密*********************************/ + /** + * 加密字符串,并进行base64编码 + * @param algorithm 加解密算法 + * @param key 密钥 + * @param data 明文 + * @param charset 编码字符集 + * @return 密文 + * @throws InvalidKeyException 密钥错误 + */ + public static String encryptBase64(Algorithm algorithm, SecretKey key, String data, Charset charset) throws InvalidKeyException { + return Base64.encodeBase64String(encrypt(algorithm, key, data.getBytes(charset))); + } + + /** + * 加密字节数组 + * @param algorithm 加解密算法 + * @param key 密钥 + * @param data 明文 + * @return 密文 + * @throws InvalidKeyException 密钥错误 + */ + public static byte[] encrypt(Algorithm algorithm, SecretKey key, byte[] data) throws InvalidKeyException { + try { + return cipherDoFinal(algorithm, Cipher.ENCRYPT_MODE, key, data); + } catch (BadPaddingException e) { + throw new RuntimeException(e);//明文没有具体格式要求,不会出错。所以这个异常不需要外部捕获。 + } + } + + /** + * 加解密字节数组 + * @param algorithm 加解密算法 + * @param opmode 操作:1加密,2解密 + * @param key 密钥 + * @param data 数据 + * @throws InvalidKeyException 密钥错误 + * @throws BadPaddingException 解密密文错误(加密模式没有) + */ + private static byte[] cipherDoFinal(Algorithm algorithm, int opmode, SecretKey key, byte[] data) throws InvalidKeyException, BadPaddingException { + Cipher cipher; + try { + cipher = Cipher.getInstance(algorithm.getTransformation(), PROVIDER_NAME); + } catch (Exception e) { + //NoSuchAlgorithmException:加密算法名是本工具类提供的,如果错了业务没有办法处理。所以这个异常不需要外部捕获。 + //NoSuchProviderException:Provider是本工具类提供的,如果错了业务没有办法处理。所以这个异常不需要外部捕获。 + //NoSuchPaddingException:没有特定的填充机制,与环境有关,业务没有办法处理。所以这个异常不需要外部捕获。 + throw new RuntimeException(e); + } + cipher.init(opmode, key); + try { + return cipher.doFinal(data); + } catch (IllegalBlockSizeException e) { + throw new RuntimeException(e);//业务不需要将数据分块(好像由底层处理了),如果错了业务没有办法处理。所以这个异常不需要外部捕获。 + } + } + + /****************************解密*********************************/ + /** + * 对字符串先进行base64解码,再解密 + * @param algorithm 加解密算法 + * @param key 密钥 + * @param data 密文 + * @param charset 编码字符集 + * @return 明文 + * @throws InvalidKeyException 密钥错误 + * @throws BadPaddingException 密文错误 + */ + public static String decryptBase64(Algorithm algorithm, SecretKey key, String data, Charset charset) + throws InvalidKeyException, BadPaddingException { + return new String(decrypt(algorithm, key, Base64.decodeBase64(data)), charset); + } + + /** + * 解密字节数组 + * @param algorithm 加解密算法 + * @param key 密钥 + * @param data 密文 + * @return 明文 + * @throws InvalidKeyException 密钥错误 + * @throws BadPaddingException 密文错误 + */ + public static byte[] decrypt(Algorithm algorithm, SecretKey key, byte[] data) throws InvalidKeyException, BadPaddingException { + return cipherDoFinal(algorithm, Cipher.DECRYPT_MODE, key, data); + } + + public static String Encrypt(String data) throws InvalidKeyException { + SecretKey key = genKeyByStr(Algorithm.SM4, SM4_KEY, encryptCharset); + return encryptBase64(Algorithm.SM4, key, data, encryptCharset); + } + public static String Decrypt(String data) throws BadPaddingException, InvalidKeyException { + SecretKey key = genKeyByStr(Algorithm.SM4, SM4_KEY, encryptCharset); + return decryptBase64(Algorithm.SM4, key, data, encryptCharset); + } + //加密 + public static String dealEncryptData(Object data) throws JsonProcessingException, InvalidKeyException { + ObjectMapper objectMapper = new ObjectMapper(); + String dataString = ""; + try { + if(data instanceof String){ + dataString = (String) data; + }else { + dataString = objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(data); + } + String dataEncrypt = Encrypt(dataString); + return dataEncrypt; + }catch (Exception e){ + return dataString; + } + } + //解密 + public static String dealDecryptData(Object data) throws JsonProcessingException, BadPaddingException, InvalidKeyException { + String dataString = ""; + try { + ObjectMapper objectMapper = new ObjectMapper(); + if (data instanceof String) { + dataString = (String) data; + } else { + dataString = objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(data); + } + String dataDecrypt = Decrypt(dataString); + return dataDecrypt; + }catch (Exception e){ + return dataString; + } + } +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/api/yt/TestMs4.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/api/yt/TestMs4.java new file mode 100644 index 0000000000..1a9853705d --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/api/yt/TestMs4.java @@ -0,0 +1,184 @@ +package com.epmet.commons.tools.utils.api.yt; + + +import org.bouncycastle.jce.provider.BouncyCastleProvider; +import org.bouncycastle.pqc.math.linearalgebra.ByteUtils; + +import javax.crypto.Cipher; +import javax.crypto.KeyGenerator; +import javax.crypto.spec.SecretKeySpec; +import java.security.*; +import java.util.Arrays; + +/** + * sm4加密算法工具类 + * + * @explain sm4加密、解密与加密结果验证 可逆算法 + * @Autor:jingyao + */ +public class TestMs4 { + static { + Security.addProvider(new BouncyCastleProvider()); + } + + private static final String ENCODING = "UTF-8"; + public static final String ALGORITHM_NAME = "SM4"; + // 加密算法/分组加密模式/分组填充方式 + // PKCS5Padding-以8个字节为一组进行分组加密 + // 定义分组加密模式使用:PKCS5Padding + public static final String ALGORITHM_NAME_ECB_PADDING = "SM4/ECB/PKCS5Padding"; + // 128-32位16进制;256-64位16进制 + public static final int DEFAULT_KEY_SIZE = 128; + + /** + * 生成ECB暗号 + * + * @param algorithmName 算法名称 + * @param mode 模式 + * @param key + * @return + * @throws Exception + * @explain ECB模式(电子密码本模式:Electronic codebook) + */ + private static Cipher generateEcbCipher(String algorithmName, int mode, byte[] key) throws Exception { + Cipher cipher = Cipher.getInstance(algorithmName, BouncyCastleProvider.PROVIDER_NAME); + Key sm4Key = new SecretKeySpec(key, ALGORITHM_NAME); + cipher.init(mode, sm4Key); + return cipher; + } + + /** + * 自动生成密钥 + * + * @return + * @throws NoSuchAlgorithmException + * @throws NoSuchProviderException + * @explain + */ + public static byte[] generateKey() throws Exception { + return generateKey(DEFAULT_KEY_SIZE); + } + + + //加密****************************************** + + /** + * @param keySize + * @return + * @throws Exception + * @explain 系统产生秘钥 + */ + public static byte[] generateKey(int keySize) throws Exception { + KeyGenerator kg = KeyGenerator.getInstance(ALGORITHM_NAME, BouncyCastleProvider.PROVIDER_NAME); + kg.init(keySize, new SecureRandom()); + return kg.generateKey().getEncoded(); + } + + /** + * sm4加密 + * + * @param hexKey 16进制密钥(忽略大小写) + * @param paramStr 待加密字符串 + * @return 返回16进制的加密字符串 + * @throws Exception + * @explain 加密模式:ECB 密文长度不固定,会随着被加密字符串长度的变化而变化 + */ + public static String encryptEcb(String hexKey, String paramStr) throws Exception { + String cipherText = ""; + // 16进制字符串-->byte[] + byte[] keyData = ByteUtils.fromHexString(hexKey); + // String-->byte[] + byte[] srcData = paramStr.getBytes(ENCODING); + // 加密后的数组 + byte[] cipherArray = encrypt_Ecb_Padding(keyData, srcData); + // byte[]-->hexString + cipherText = ByteUtils.toHexString(cipherArray); + return cipherText; + } + + /** + * 加密模式之Ecb + * + * @param key + * @param data + * @return + * @throws Exception + */ + public static byte[] encrypt_Ecb_Padding(byte[] key, byte[] data) throws Exception { + Cipher cipher = generateEcbCipher(ALGORITHM_NAME_ECB_PADDING, Cipher.ENCRYPT_MODE, key);//声称Ecb暗号,通过第二个参数判断加密还是解密 + return cipher.doFinal(data); + } + + //解密**************************************** + + /** + * sm4解密 + * + * @param hexKey 16进制密钥 + * @param cipherText 16进制的加密字符串(忽略大小写) + * @return 解密后的字符串 + * @throws Exception + * @explain 解密模式:采用ECB + */ + public static String decryptEcb(String hexKey, String cipherText) throws Exception { + // 用于接收解密后的字符串 + String decryptStr = ""; + // hexString-->byte[] + byte[] keyData = ByteUtils.fromHexString(hexKey); + // hexString-->byte[] + byte[] cipherData = ByteUtils.fromHexString(cipherText); + // 解密 + byte[] srcData = decrypt_Ecb_Padding(keyData, cipherData); + // byte[]-->String + decryptStr = new String(srcData, ENCODING); + return decryptStr; + } + + /** + * 解密 + * + * @param key + * @param cipherText + * @return + * @throws Exception + * @explain + */ + public static byte[] decrypt_Ecb_Padding(byte[] key, byte[] cipherText) throws Exception { + Cipher cipher = generateEcbCipher(ALGORITHM_NAME_ECB_PADDING, Cipher.DECRYPT_MODE, key);//生成Ecb暗号,通过第二个参数判断加密还是解密 + return cipher.doFinal(cipherText); + } + + /** + * 校验加密前后的字符串是否为同一数据 + * + * @param hexKey 16进制密钥(忽略大小写) + * @param cipherText 16进制加密后的字符串 + * @param paramStr 加密前的字符串 + * @return 是否为同一数据 + * @throws Exception + * @explain + */ + public static boolean verifyEcb(String hexKey, String cipherText, String paramStr) throws Exception { + // 用于接收校验结果 + boolean flag = false; + // hexString-->byte[] + byte[] keyData = ByteUtils.fromHexString(hexKey); + // 将16进制字符串转换成数组 + byte[] cipherData = ByteUtils.fromHexString(cipherText); + // 解密 + byte[] decryptData = decrypt_Ecb_Padding(keyData, cipherData); + // 将原字符串转换成byte[] + byte[] srcData = paramStr.getBytes(ENCODING); + // 判断2个数组是否一致 + flag = Arrays.equals(decryptData, srcData); + return flag; + } + + public static void main(String[] args) throws Exception { + String text = "5d22ea44c7599a48f0d4446b1b7fbb4bb8353922df437d39c3a38549c0f2549cbd021ada00a8be83027ae06203c3daea2eedc5bd0875c7e509c7049045c5349577f2c21bcec328a5ea0bf341191e5bdba978566dddd16f1cf1928ff5cbd826dd33289fb45a8a04585f1f24ab04f59426371a5a0a0f2ee3e7b00d2bdfba7810524ce4c33130eda077546fa4c4191d0117f7a44e1cadac6c69a7d437653be1f958a459e0f025d471e09ab4636c38013032948ffb0827040ed6f3436be090f545186928a7b0b2bfc65782452606607ce8555ba130caacad73998da704428a07276a2699889c9872eebba5de8b72cdbe88705483293b00ab3ecb3aa57d283a4ecab40b71bc0a10e9ec626f07b2293255349fb2270d37e81c5c3d0de0b0f0706ed1872f60f039ce2e51effc39aef9747d67457e072cf3170a9c19589c1bab1a7d9d80"; + String s = TestMs4.decryptEcb("dbcff4c9f4774e6cb56080f279149d59", text); + System.out.println(s); + } + +} + diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/api/yt/UserData.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/api/yt/UserData.java new file mode 100644 index 0000000000..b7d3abca4e --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/api/yt/UserData.java @@ -0,0 +1,50 @@ + +package com.epmet.commons.tools.utils.api.yt; + +import lombok.Data; + +import java.io.Serializable; + +/** + * desc:认证中心-用户信息 + * @author liujianjun + */ +@Data +public class UserData implements Serializable { + + /** + * 性别:todo 不知道是什么值 + */ + private String gender; + /** + * 手机号码 + */ + private String mobileTelephoneNumber; + private String orderNumber; + /** + * 职务 + */ + private String position; + /** + * 职级 + */ + private String positionLevel; + /** + * 电话号码 + */ + private String telephoneNumber; + /** + * 用户编码/id + */ + private String userGuid; + /** + * 用户姓名 + */ + private String userName; + /** + * 人员路径 + */ + private String userPath; + + +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/api/yt/YantaiApi.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/api/yt/YantaiApi.java new file mode 100644 index 0000000000..8cf49c6410 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/api/yt/YantaiApi.java @@ -0,0 +1,327 @@ +package com.epmet.commons.tools.utils.api.yt; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; +import com.epmet.commons.tools.utils.HttpClientManager; +import com.epmet.commons.tools.utils.Result; +import com.fasterxml.jackson.core.JsonProcessingException; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.jetbrains.annotations.NotNull; + +import javax.crypto.BadPaddingException; +import java.security.InvalidKeyException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * desc: + * + * @author: LiuJanJun + * @date: 2022/10/17 3:57 下午 + * @version: 1.0 + */ +@Slf4j +public class YantaiApi { + private static final String SSO_SERVER = "http://172.20.46.155:8080/sso/"; + /** + * 相当于 appKey + */ + private static final String CLIENT_ID = "1000009"; + /** + * 相当于 appSecret 用于解密 他们重定向回来的code 解密他们的token 获取用户嘻嘻 + */ + private static final String CLIENT_SECRET = "a1f9879119bc4080ab5575f832b7d98b"; + /** + * 调用sso后台api接口的 秘钥 + */ + private static final String SSO_API_TOKEN = "iJCDUgCBV/Zk5FkkaxLypA=="; + /** + * 政务网地址 + */ + private static final String SSO_BACKGROUND_SERVER_URL = "http://172.20.46.155:8082/"; + /** + * 互联网地址 + */ + //private static final String SSO_BACKGROUND_SERVER_URL = "http://120.220.248.247:8081/"; + + /** + * desc:根据组织id获取本级组织信息 + * + * @param organizationId + * @return + */ + public static OrgData getOuInfoByOuGuid(String organizationId) { + try { + if (StringUtils.isBlank(organizationId)) { + throw new EpmetException(EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getCode(), EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getMsg(), EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getMsg()); + } + //加密 + String organizationIdEn = SM4UtilsForYanTai.dealEncryptData(organizationId); + //pwd = URLEncoder.encode(pwd, "UTF-8"); + String url = SSO_BACKGROUND_SERVER_URL + "person/ouinfo/getOuInfoByOuGuid"; + + Map paramMap = new HashMap<>(); + paramMap.put("organizationId",organizationIdEn); + + log.info("getOuInfoByOuGuid request param:{} url:{}",paramMap, url); + Result result = HttpClientManager.getInstance().sendGet(url, paramMap, getApiHeaderMap()); + log.info("getOuInfoByOuGuid request result:{}", result); + if (!result.success()){ + return new OrgData(); + } + JSONObject jsonObject = JSONObject.parseObject(result.getData()); + String secondCode = jsonObject.getString("code"); + String secondMessage = jsonObject.getString("message"); + if (!"200".equals(secondCode)) { + log.warn("getOuInfoByOuGuid 接口错误"); + return new OrgData(); + } + //解密 + String data = SM4UtilsForYanTai.dealDecryptData(jsonObject.getString("data")); + OrgData orgData = JSON.parseObject(data, OrgData.class); + log.info("getChildOuInfoByGuid request real result:{}", JSON.toJSONString(orgData)); + return orgData; + } catch (Exception e) { + log.error("getChildOuInfoByGuid exception", e); + } + return new OrgData(); + } + + /** + * desc:根据组织id获取下级组织 + * + * @param organizationId + * @return + */ + public static List getChildOuInfoByGuid(String organizationId) { + try { + if (StringUtils.isBlank(organizationId)) { + throw new EpmetException(EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getCode(), EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getMsg(), EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getMsg()); + } + //加密 + String organizationIdEn = SM4UtilsForYanTai.dealEncryptData(organizationId); + //pwd = URLEncoder.encode(pwd, "UTF-8"); + String url = SSO_BACKGROUND_SERVER_URL + "person/ouinfo/getChildOuInfoByGuid"; + + Map paramMap = new HashMap<>(); + paramMap.put("organizationId",organizationIdEn); + + log.info("getChildOuInfoByGuid request param:{} url:{}",paramMap, url); + Result result = HttpClientManager.getInstance().sendGet(url, paramMap, getApiHeaderMap()); + log.info("getChildOuInfoByGuid request result:{}", result); + if (!result.success()){ + return new ArrayList<>(); + } + JSONObject jsonObject = JSONObject.parseObject(result.getData()); + String secondCode = jsonObject.getString("code"); + String secondMessage = jsonObject.getString("message"); + if (!"200".equals(secondCode)) { + log.warn("getChildOuInfoByGuid 接口错误"); + return new ArrayList<>(); + } + //解密 + String data = SM4UtilsForYanTai.dealDecryptData(jsonObject.getString("data")); + List orgData = JSON.parseArray(data, OrgData.class); + log.info("getChildOuInfoByGuid request real result:{}", JSON.toJSONString(orgData)); + return orgData; + } catch (Exception e) { + log.error("getChildOuInfoByGuid exception", e); + } + return new ArrayList<>(); + } + + /** + * desc:根据组织id获取下级组织 + * + * @param organizationId + * @return + */ + public static List getUserByOuGuid(String organizationId) { + try { + if (StringUtils.isBlank(organizationId)) { + throw new EpmetException(EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getCode(), EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getMsg(), EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getMsg()); + } + //加密 + String organizationIdEn = SM4UtilsForYanTai.dealEncryptData(organizationId); + //pwd = URLEncoder.encode(pwd, "UTF-8"); + String url = SSO_BACKGROUND_SERVER_URL + "person/userInfo/getUserByOuGuid"; + + + Map paramMap = new HashMap<>(); + paramMap.put("organizationId",organizationIdEn); + log.info("getUserByOuGuid request param: url:{},param:{}", url, paramMap); + Result result = HttpClientManager.getInstance().sendGet(url, paramMap, getApiHeaderMap()); + log.info("getUserByOuGuid request result:{}", result); + if (!result.success()){ + return new ArrayList<>(); + } + JSONObject jsonObject = JSONObject.parseObject(result.getData()); + String secondCode = jsonObject.getString("code"); + String secondMessage = jsonObject.getString("message"); + if (!"200".equals(secondCode)) { + log.warn("getUserByOuGuid 接口错误"); + return new ArrayList<>(); + } + //解密 + String data = SM4UtilsForYanTai.dealDecryptData(jsonObject.getString("data")); + List userData = JSON.parseArray(data, UserData.class); + log.info("getUserByOuGuid request real result:{}", JSON.toJSONString(userData)); + return userData; + } catch (Exception e) { + log.error("getUserByOuGuid exception", e); + } + return new ArrayList<>(); + } + + /** + * desc:根据组织id获取下级组织 + * + * @param code + * @return + */ + public static YantaiSSOUser getLoginToken(String code) { + try { + if (StringUtils.isBlank(code)) { + throw new EpmetException(EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getCode(), EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getMsg(), EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getMsg()); + } + //加密 + String organizationIdEn = SM4UtilsForYanTai.dealEncryptData(code); + //pwd = URLEncoder.encode(pwd, "UTF-8"); + log.info("getLoginToken加密组织Id = " + organizationIdEn); + String url = SSO_SERVER + "logintoken?client_id=" + CLIENT_ID + "&client_code=" + code; + + Map headerMap = new HashMap<>(); + Map paramMap = new HashMap<>(); + log.info("getUserByOuGuid request param: url:{},header:{}", url, headerMap); + Result result = HttpClientManager.getInstance().sendGet(url, paramMap, headerMap); + if (!result.success() || StringUtils.isBlank(result.getData())) { + log.info("getUserByOuGuid fail result:{}", JSON.toJSONString(result)); + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取token为空", "获取token为空"); + } + log.info("getUserByOuGuid request result:{}", result); + JSONObject jsonObject = JSONObject.parseObject(result.getData()); + //解密 + String errcode = jsonObject.getString("errcode"); + if (!NumConstant.ZERO_STR.equals(errcode)) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取token失败", "获取token失败"); + } + String sencondData = jsonObject.getString("data"); + log.info("getLoginToken jiami data:{}", sencondData); + //String data = SM4UtilsForYanTai.dealDecryptData(sencondData); + + + String data = TestMs4.decryptEcb(CLIENT_SECRET, sencondData); + log.info("getLoginToken jiemi data:{}", sencondData); + YantaiSSOUser userData = JSON.parseObject(data, YantaiSSOUser.class); + log.info("getUserByOuGuid request real result:{}", JSON.toJSONString(userData)); + String userInfoMobile = getUserInfoMobile(userData.getUserGuid()); + userData.setMobile(userInfoMobile); + return userData; + } catch (Exception e) { + log.error("getUserByOuGuid exception", e); + } + return null; + } + + public static String getUserInfoMobile(String userId) { + try { + + String userIdEn = SM4UtilsForYanTai.dealEncryptData(userId); + + String serverUrl = SSO_BACKGROUND_SERVER_URL + "person/userInfo/getUserByUserGuid"; + //String serverUrl = "http://120.220.248.247:8081/person/userInfo/getUserByUserGuid"; + Map param = new HashMap<>(); + param.put("userGuid", userIdEn); + + Result result = HttpClientManager.getInstance().sendGet(serverUrl, param, getApiHeaderMap()); + System.out.println(JSON.toJSONString(result)); + if (!result.success() || StringUtils.isBlank(result.getData())) { + log.info("getUserInfoMobile fail result:{}", JSON.toJSONString(result)); + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取用户信息失败", "获取用户信息失败"); + } + String data = result.getData(); + log.info("getUserInfoMobile jiami data:{}", JSON.parseObject(data)); + JSONObject jsonObject = JSON.parseObject(data); + String secondCode = jsonObject.getString("code"); + String secondMessage = jsonObject.getString("message"); + if (!"200".equals(secondCode)) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取人员信息接口返回失败" + secondMessage, "获取人员信息接口返回失败" + secondMessage); + } + String data1 = SM4UtilsForYanTai.dealDecryptData(jsonObject.getString("data")); + String telephoneNumber = JSON.parseObject(data1).getString("mobileTelephoneNumber"); + log.info("getUserInfoMobile jiemi data:{}", telephoneNumber); + return telephoneNumber; + } catch (Exception e) { + log.error("getUserInfoMobile exception", e); + } + return null; + } + + @NotNull + private static Map getApiHeaderMap() { + Map headerMap = new HashMap<>(); + try { + JSONObject token = new JSONObject(); + token.put("token", SSO_API_TOKEN); + // token.put("token","iJCDUgCBV/Zk5FkkaxLypA=="); + token.put("expiration", System.currentTimeMillis()); + + String tokanStr = SM4UtilsForYanTai.dealEncryptData(token.toString()); + headerMap.put("Authorization", "Bearer " + tokanStr); + } catch (Exception e) { + log.error("getApiHeaderMap exception", e); + } + return headerMap; + } + + public static void main(String[] args) throws BadPaddingException, InvalidKeyException, JsonProcessingException { + + //testGetUserByUserId(); + + //code只能用一次 + //getLoginToken("0d554bccfbac4be3846d643252daf92b"); + + String organizationId = "44e05de9-34fa-48f6-b89f-02838d792cf9"; + OrgData ouInfoByOuGuid = getOuInfoByOuGuid(organizationId); + System.out.println("ouInfoByOuGuid:"+JSON.toJSONString(ouInfoByOuGuid)); + List childOuInfoByGuid = getChildOuInfoByGuid(organizationId); + System.out.println("childOuInfoByGuid:"+JSON.toJSONString(childOuInfoByGuid)); + //先用他说的有人的组织id联调 + //String orgId = "2b271845-ed51-48aa-9935-00b9e7e06311"; + //orgId = "2b271845-ed51-48aa-9935-00b9e7e05778"; + List userByOuGuid = getUserByOuGuid(organizationId); + System.out.println("getUserByOuGuid:"+JSON.toJSONString(userByOuGuid)); + + Map apiHeaderMap = getApiHeaderMap(); + System.out.println(apiHeaderMap); + //testGetUserByUserId(); + } + + private static void testGetUserByUserId() throws JsonProcessingException, InvalidKeyException, BadPaddingException { + String testUserId = "0ffd76e2-27b5-4b33-be9a-186f9f878bf1"; + + String serverUrl = SSO_BACKGROUND_SERVER_URL +"person/userInfo/getUserByUserGuid"; + //String serverUrl = "http://120.220.248.247:8081/person/userInfo/getUserByUserGuid"; + Map param = new HashMap<>(); + param.put("userGuid", SM4UtilsForYanTai.dealEncryptData(testUserId)); + Result stringResult = HttpClientManager.getInstance().sendGet(serverUrl, param, getApiHeaderMap()); + System.out.println(JSON.toJSONString(stringResult)); + + String data = stringResult.getData(); + JSONObject jsonObject = JSON.parseObject(data); + String secondCode = jsonObject.getString("code"); + String secondMessage = jsonObject.getString("message"); + System.out.println(secondCode); + System.out.println(secondMessage); + String data1 = SM4UtilsForYanTai.dealDecryptData(jsonObject.getString("data")); + System.out.println("======" + data1); + String s = SM4UtilsForYanTai.dealDecryptData("EsOeQX+A8+GG26lzLnuKeuylkBDRFcTbF+gE/jURIzddlVI8RToQQhzK4EHy0WfpS/L4dSAJC93UyVLJhj+r/pup2RFq/GjpH7Md+1Mjg3dM+eyDuGql71bUrldQwJXYnHrQm3Mn7tk5m2eLhEVNkFvdELjuy3Kg8YihZXf2Sox+kxtmK4DSIn/gxhVCoUneWeL0cA6JGHI6jNuq97rzgcNK3Mwen8MxOoWP3n3r+kIpwZCwIlL70MrBjIZ6FHIhcxpqL82gpLSe1K0TFgeWw+9PMo1yv4cGZn7rU86TDlQFoDP86dVa1jrBoyUmW/vvLXrMKwfBaiv9/EUzcCLZWYxEwH93n0X/NYCYem3pfv4uXk5A7/D+Npgj9OKCEIz0ROn0UW5NiXI5Vibz0dywaq4sfsR/LiwjV81QOGY9tsHzN2+MnyTVpQg1l7looNnq1j+wwLneS0aDmbTqBLEn/baph/Hnr2L/9HYpWfXkhz93XRNAdsbxhXdG5ZIiJSwNasHinPR3e2Hmn/02GOsBPFUifbyNUtslt4RS/gwboonBoXz8wrmXi+PfzUXwN8f2CKdBNEHl72USp70NtBSJUPAkHdXZEQPgGRped63Z9GA="); + System.out.println("sssssss:" + s); + } +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/api/yt/YantaiSSOUser.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/api/yt/YantaiSSOUser.java new file mode 100644 index 0000000000..d2285ce0f3 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/api/yt/YantaiSSOUser.java @@ -0,0 +1,35 @@ + +package com.epmet.commons.tools.utils.api.yt; + +import lombok.Data; + +import java.io.Serializable; + +/** + * sso:认证中心 用户信息 + * @author liujianjun + */ +@Data +public class YantaiSSOUser implements Serializable { + + private static final long serialVersionUID = -2794280342919451106L; + + /** + * 他说这个是手机号 + */ + private String clientId; + private String departmentCode; + private String expirationTime; + private String ip; + private String issueTime; + private String registerGuid; + private String registerName; + private String userGuid; + private String userName; + + /** + * 二次请求结果 + */ + private String mobile; + +} diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govissue/IssueApplicationDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govissue/IssueApplicationDTO.java index 4565baf59c..a6a7f8f18c 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govissue/IssueApplicationDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govissue/IssueApplicationDTO.java @@ -73,6 +73,8 @@ public class IssueApplicationDTO implements Serializable { * 网格ID 居民端议题对应一个网格Id */ private String gridId; + private String orgId; + private String orgIdPath; /** * 审核通过后对应的 议题id diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govissue/result/IssueListResultDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govissue/result/IssueListResultDTO.java index f1561c2a1b..32186f5212 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govissue/result/IssueListResultDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govissue/result/IssueListResultDTO.java @@ -108,7 +108,10 @@ public class IssueListResultDTO implements Serializable { @JsonIgnore private String applyStatus; - + /** + * 来源类型 话题:resi_topic;直接立议题:issue;事件:ic_event + */ + private String sourceType; public IssueListResultDTO() { this.issueId = ""; this.issueTitle = ""; @@ -129,5 +132,6 @@ public class IssueListResultDTO implements Serializable { this.projectId = ""; this.issueClosedTime = 0L; this.issueApplicationId = ""; + this.sourceType=""; } } diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/form/StaffDetailV2FormDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/form/StaffDetailV2FormDTO.java index 4a63e5c8ee..ea1763af18 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/form/StaffDetailV2FormDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/form/StaffDetailV2FormDTO.java @@ -42,5 +42,10 @@ public class StaffDetailV2FormDTO implements Serializable { private String orgType = ""; //职责名称列表 private List roles; + /** + * 数字社区里的角色名称 + */ + private List szsqRoles; + private String customerId; } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/govissue/IssueApplicationEntity.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/govissue/IssueApplicationEntity.java index 1e6671bfa7..ff45b8a88c 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/govissue/IssueApplicationEntity.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/govissue/IssueApplicationEntity.java @@ -70,6 +70,9 @@ public class IssueApplicationEntity extends BaseEpmetEntity { */ private String gridId; + private String orgId; + private String orgIdPath; + /** * 审核通过后对应的 议题id */ diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java index 79f949b525..bbde669a5c 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java @@ -10,6 +10,8 @@ import com.epmet.commons.tools.dto.form.IdAndNameDTO; import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; import com.epmet.commons.tools.enums.OrgTypeEnum; import com.epmet.commons.tools.exception.EpmetException; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.redis.common.CustomerIcHouseRedis; import com.epmet.commons.tools.redis.common.CustomerResiUserRedis; @@ -20,6 +22,7 @@ import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.IpUtils; +import com.epmet.commons.tools.utils.Result; import com.epmet.constant.BadgeConstant; import com.epmet.constant.NeighborhoodConstant; import com.epmet.constant.OrgInfoConstant; @@ -55,8 +58,11 @@ import com.epmet.dto.UserBaseInfoDTO; import com.epmet.dto.form.DetailByTypeFormDTO; import com.epmet.dto.form.SystemMsgFormDTO; import com.epmet.dto.result.DetailByTypeResultDTO; +import com.epmet.dto.form.GetStaffExistRoleFormDTO; +import com.epmet.dto.result.NewUserRoleResultDTO; import com.epmet.dto.result.StaffRoleResultDTO; import com.epmet.feign.EpmetMessageOpenFeignClient; +import com.epmet.feign.GovAccessFeignClient; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import lombok.extern.slf4j.Slf4j; @@ -117,6 +123,8 @@ public class EpmetUserServiceImpl implements EpmetUserService { private IcPointNucleicMonitoringDao pointNucleicMonitoringDao; @Autowired private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient; + @Autowired + private GovAccessFeignClient govAccessFeignClient; /** * @Description 根据UserIds查询 @@ -733,7 +741,8 @@ public class EpmetUserServiceImpl implements EpmetUserService { //基本信息 CustomerStaffDTO dto = customerStaffDao.selectByStaffId(staffId); if (null == dto) { - return result; + // return result; + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"customer_staff is null staffId:"+staffId,"未查询到工作人员基础信息"); } //角色信息 List list = staffRoleDao.selectByStaffId(staffId); @@ -743,7 +752,16 @@ public class EpmetUserServiceImpl implements EpmetUserService { result.setName(dto.getRealName()); result.setGender(dto.getGender().toString()); result.setRoles(list); - + // 获取数字社区里的新角色 + GetStaffExistRoleFormDTO getStaffExistRoleFormDTO = new GetStaffExistRoleFormDTO(); + getStaffExistRoleFormDTO.setStaffId(staffId); + getStaffExistRoleFormDTO.setCustomerId(dto.getCustomerId()); + Result> staffExistRole = govAccessFeignClient.getStaffExistRole(getStaffExistRoleFormDTO); + if (staffExistRole.success()&&CollectionUtils.isNotEmpty(staffExistRole.getData())){ + // 过滤selected=true的 + List szsqRoles=staffExistRole.getData().stream().filter(t->t.getSelected()).map(m -> m.getRoleName()).distinct().collect(Collectors.toList()); + result.setSzsqRoles(szsqRoles); + } return result; } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java index d2ee934888..7265e9bcae 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java @@ -504,8 +504,9 @@ public class GovOrgServiceImpl implements GovOrgService { public StaffDetailV2FormDTO staffDetailV2(StaffDetailV2ResultDTO formDTO) { //1.查询工作人员基本信息、角色信息 StaffDetailV2FormDTO result = epmetUserService.selectByStaffId(formDTO.getStaffId()); - if (null == result) { - return new StaffDetailV2FormDTO(); + if (null == result||StringUtils.isBlank(result.getStaffId())) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"customer_staff is null staffId:"+formDTO.getStaffId(),"未查询到工作人员基本信息"); + // return new StaffDetailV2FormDTO(); } //2.查询工作人员注册组织关系信息 @@ -513,7 +514,7 @@ public class GovOrgServiceImpl implements GovOrgService { staffIdList.add(formDTO.getStaffId()); List list = customerAgencyDao.selelctStaffOrg(staffIdList); if (null == list || list.size() < NumConstant.ONE) { - throw new RenException("未查询到工作人员注册组织信息"); + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"未查询到工作人员注册组织信息","未查询到工作人员所属组织信息"); } //3.封装数据并返回 diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govissue/IssueApplicationDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govissue/IssueApplicationDao.xml index 08db0e9088..fdd1ff4c5f 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govissue/IssueApplicationDao.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govissue/IssueApplicationDao.xml @@ -12,7 +12,12 @@ ia.TOPIC_ID, iah.REASON AS rejectedReason, ia.grid_id, - ia.apply_status + ia.apply_status, + ( + case when ia.TOPIC_ID is not null then 'resi_topic' + else '' + end + ) as sourceType FROM issue_application_history iah LEFT JOIN issue_application ia ON iah.ISSUE_APPLICATION_ID = ia.ID AND ia.APPLY_STATUS = 'rejected' WHERE ia.DEL_FLAG = 0 @@ -31,7 +36,12 @@ ISSUE_TITLE, UNIX_TIMESTAMP(CREATED_TIME) AS auditingTime, TOPIC_ID, - grid_id + grid_id, + ( + case when TOPIC_ID is not null then 'resi_topic' + else '' + end + ) as sourceType FROM issue_application WHERE DEL_FLAG = 0 AND ( diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govissue/IssueDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govissue/IssueDao.xml index 495473205c..82c3c09f32 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govissue/IssueDao.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govissue/IssueDao.xml @@ -12,7 +12,8 @@ ISSUE_TITLE AS issueTitle , UNIX_TIMESTAMP(CREATED_TIME) AS createTime, SUGGESTION, - grid_id + grid_id, + SOURCE_TYPE as sourceType FROM issue WHERE DEL_FLAG = '0' AND ISSUE_STATUS = #{issueStatus} @@ -30,7 +31,8 @@ SUGGESTION , UNIX_TIMESTAMP(SHIFTED_TIME) AS shiftProjectTime, grid_id, - issue_title + issue_title, + SOURCE_TYPE as sourceType FROM issue WHERE DEL_FLAG = '0' AND ISSUE_STATUS = 'shift_project' diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/GetListSocietyOrgFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/GetListSocietyOrgFormDTO.java index 9f0357a1d7..f13cef1bb6 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/GetListSocietyOrgFormDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/GetListSocietyOrgFormDTO.java @@ -57,4 +57,9 @@ public class GetListSocietyOrgFormDTO implements Serializable { //token中userId所属组织Id private String agencyId; + /** + * resi:居民端 + */ + private String app; + } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java index 27d88957b5..168d343a79 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java @@ -173,6 +173,7 @@ public interface EpmetHeartOpenFeignClient { /** * desc:根据来源id 删除需求 只删主表 + * 服务需求相关表都删除:ic_user_demand_rec、ic_user_demand_service、ic_user_demand_satisfaction、ic_user_demand_operate_log * @param originId * @param origin * @return diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcSocietyOrgController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcSocietyOrgController.java index 3267ef36bb..89159c015b 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcSocietyOrgController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcSocietyOrgController.java @@ -142,6 +142,7 @@ public class IcSocietyOrgController implements ResultDataResolver { public Result getList(@LoginUser TokenDto tokenDto, @RequestBody GetListSocietyOrgFormDTO formDTO) { formDTO.setCustomerId(tokenDto.getCustomerId()); formDTO.setStaffId(tokenDto.getUserId()); + formDTO.setApp(tokenDto.getApp()); return new Result().ok(societyOrgService.getList(formDTO)); } @@ -171,7 +172,7 @@ public class IcSocietyOrgController implements ResultDataResolver { // formDTO.setIsPage(false); // GetListSocietyOrgResultDTO list = societyOrgService.getList(formDTO); // ExcelUtils.exportExcelToTarget(response, null, list.getList(), IcSocietyOrgExportExcel.class); - + formDTO.setApp(tokenDto.getApp()); formDTO.setCustomerId(tokenDto.getCustomerId()); formDTO.setStaffId(tokenDto.getUserId()); formDTO.setIsPage(false); diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcUserDemandRecController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcUserDemandRecController.java index 99894e3165..6c294e4608 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcUserDemandRecController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcUserDemandRecController.java @@ -398,6 +398,7 @@ public class IcUserDemandRecController implements ResultDataResolver { /** * desc:根据来源id 删除需求 只删主表 + * 2022.10.12:删除服务需求:ic_user_demand_rec、ic_user_demand_service、ic_user_demand_satisfaction、ic_user_demand_operate_log * @param originId * @param origin * @return diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcUserDemandRecService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcUserDemandRecService.java index ce4b03c9b7..68d30ddc19 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcUserDemandRecService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcUserDemandRecService.java @@ -268,6 +268,7 @@ public interface IcUserDemandRecService extends BaseService liveRecList(TokenDto tokenDto,Map map) { if (!map.containsKey("actId") || StringUtils.isEmpty(map.get("actId"))) { logger.warn("传参中没有actId,或者actId为空,userId:" + tokenDto.getUserId() + "客户id:" + tokenDto.getCustomerId()); - throw new RenException("actId不能为空"); + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"actId不能为空","活动id不能为空"); } // 数据汇总 ResiActLiveRecResultDTO resultDto = new ResiActLiveRecResultDTO(); diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcSocietyOrgServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcSocietyOrgServiceImpl.java index 063064f9cd..013ea62d1c 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcSocietyOrgServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcSocietyOrgServiceImpl.java @@ -19,6 +19,7 @@ package com.epmet.service.impl; import com.alibaba.excel.EasyExcel; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.AppClientConstant; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; import com.epmet.commons.tools.exception.EpmetErrorCode; @@ -148,10 +149,10 @@ public class IcSocietyOrgServiceImpl extends BaseServiceImpl wrapper = new LambdaUpdateWrapper(); - wrapper.eq(IcUserDemandRecEntity::getOriginId, originId) - .eq(IcUserDemandRecEntity::getOrigin,origin) - .set(IcUserDemandRecEntity::getUpdatedTime,new Date()) - .set(IcUserDemandRecEntity::getCreatedBy,loginUserUtil.getLoginUserId()) - .set(IcUserDemandRecEntity::getDelFlag,NumConstant.ONE_STR); - return baseDao.update(null, wrapper); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper(); + queryWrapper.eq(IcUserDemandRecEntity::getOrigin,origin).eq(IcUserDemandRecEntity::getOriginId,originId); + IcUserDemandRecEntity recEntity = baseDao.selectOne(queryWrapper); + if (null == recEntity) { + return 0; + } + //删除服务需求 + deleteUserDemand(Arrays.asList(recEntity.getId())); + return 1; + } + + /** + * 删除服务需求 + * ic_user_demand_rec、ic_user_demand_service、ic_user_demand_satisfaction、ic_user_demand_operate_log + * @param ids + */ + @Transactional(rollbackFor = Exception.class) + public void deleteUserDemand(List ids) { + Date nowTime = new Date(); + String currentUserId = loginUserUtil.getLoginUserId(); + for (String id : ids) { + LambdaUpdateWrapper wrapper = new LambdaUpdateWrapper(); + wrapper.eq(IcUserDemandRecEntity::getId, id) + .set(IcUserDemandRecEntity::getUpdatedTime, nowTime) + .set(IcUserDemandRecEntity::getUpdatedBy, currentUserId) + .set(IcUserDemandRecEntity::getDelFlag, NumConstant.ONE_STR); + baseDao.update(null, wrapper); + + LambdaUpdateWrapper serviceWrapper = new LambdaUpdateWrapper(); + serviceWrapper.eq(IcUserDemandServiceEntity::getDemandRecId, id) + .set(IcUserDemandServiceEntity::getUpdatedTime, nowTime) + .set(IcUserDemandServiceEntity::getUpdatedBy, currentUserId) + .set(IcUserDemandServiceEntity::getDelFlag, NumConstant.ONE_STR); + demandServiceDao.update(null, serviceWrapper); + + LambdaUpdateWrapper statWrapper = new LambdaUpdateWrapper(); + statWrapper.eq(IcUserDemandSatisfactionEntity::getDemandRecId, id) + .set(IcUserDemandSatisfactionEntity::getUpdatedTime, nowTime) + .set(IcUserDemandSatisfactionEntity::getUpdatedBy, currentUserId) + .set(IcUserDemandSatisfactionEntity::getDelFlag, NumConstant.ONE_STR); + demandSatisfactionDao.update(null, statWrapper); + + LambdaUpdateWrapper logWrapper = new LambdaUpdateWrapper(); + logWrapper.eq(IcUserDemandOperateLogEntity::getDemandRecId, id) + .set(IcUserDemandOperateLogEntity::getUpdatedTime, nowTime) + .set(IcUserDemandOperateLogEntity::getUpdatedBy, currentUserId) + .set(IcUserDemandOperateLogEntity::getDelFlag, NumConstant.ONE_STR); + operateLogDao.update(null, logWrapper); + } } /** @@ -563,6 +612,7 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl yanTaiOrgInfo = thirdOpenFeignClient.getYanTaiOrgInfo("44e05de9-34fa-48f6-b89f-02838d792cf9"); + if (yanTaiOrgInfo.success()) { + log.info("yt拉取组织信息定时任务执行成功"); + } else { + log.error("yt拉取组织信息定时任务执行失败:" + yanTaiOrgInfo.getMsg()); + } + + Result yanTaiUserInfo = thirdOpenFeignClient.getYanTaiUserInfo("44e05de9-34fa-48f6-b89f-02838d792cf9"); + if (yanTaiUserInfo.success()) { + log.info("yt拉取用户信息定时任务执行成功"); + } else { + log.error("yt拉取用户信息定时任务执行失败:" + yanTaiUserInfo.getMsg()); + } + } +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/DataSyncOrgDataDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/DataSyncOrgDataDTO.java new file mode 100644 index 0000000000..fd5f9121c7 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/DataSyncOrgDataDTO.java @@ -0,0 +1,139 @@ +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-10-18 + */ +@Data +public class DataSyncOrgDataDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键ID + */ + private String id; + + /** + * 联系人姓名 + */ + private String contact; + + /** + * 联系电话号码 + */ + private String contacttelephoneNumber; + + /** + * 详细地址 + */ + private String detailAddress; + + /** + * 组织机构第一名称 + */ + private String firstnameofOrganization; + + /** + * 组织机构全称 + */ + private String nameofOrganization; + + /** + * 排序号码 + */ + private String orderNumber; + + /** + * 组织机构简称 + */ + private String organizatioNabbreviation; + + /** + * 组织机构ID + */ + private String organizationId; + + /** + * 组织机构级别 + */ + private String organizationLevel; + + /** + * 组织机构路径 + */ + private String organizationPath; + + /** + * 组织机构类型 + */ + private String organizationType; + + /** + * 注册类型 + */ + private String registrationType; + + /** + * 统一社会信用代码 + */ + private String unifiedsocialcreditId; + + /** + * 删除标识 0.未删除 1.已删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + + /** + * 客户id;烟台id + */ + private String customerId; + + /** + * 上级组织机构id:ORGANIZATION_ID; 根级组织赋值0 + */ + private String pid; + + /** + * 上级组织机构名称:ORGANIZATIO_NABBREVIATION + */ + private String parentOrgName; + + /** + * 所有上级组织。不包含本身! + */ + private String pids; + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/DataSyncUserDataDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/DataSyncUserDataDTO.java new file mode 100644 index 0000000000..291d40d7de --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/DataSyncUserDataDTO.java @@ -0,0 +1,124 @@ +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-10-18 + */ +@Data +public class DataSyncUserDataDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键ID + */ + private String id; + + /** + * 性别:0未知1男2女 + */ + private String gender; + + /** + * 手机号码 + */ + private String mobileTelephoneNumber; + + /** + * 排序号码 + */ + private String orderNumber; + + /** + * 职务 + */ + private String position; + + /** + * 职级 + */ + private String positionLevel; + + /** + * 电话号码 + */ + private String telephoneNumber; + + /** + * 统一用户编码 + */ + private String userGuid; + + /** + * 用户姓名 + */ + private String userName; + + /** + * 人员路径 + */ + private String userPath; + + /** + * data_sync_org_data.组织机构ID; + */ + private String organizationId; + + /** + * 删除标识 0.未删除 1.已删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + + /** + * 客户id + */ + private String customerId; + + /** + * 0未创建、1已创建 + */ + private String status; + + /** + * customer_staff.userId + */ + private String staffId; + + /** + * 备注;目前为空 + */ + private String remark; + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/yantai/YtSyncStaffIdFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/yantai/YtSyncStaffIdFormDTO.java new file mode 100644 index 0000000000..522f2926ee --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/yantai/YtSyncStaffIdFormDTO.java @@ -0,0 +1,36 @@ +package com.epmet.dto.form.yantai; + +import com.epmet.commons.tools.validator.group.AddGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * @Description 工作端新增完用户后,需要调用此接口,更新data_sync_user_data + * @Author yzm + * @Date 2022/10/18 13:54 + */ +@Data +public class YtSyncStaffIdFormDTO { + /** + * 客户ID + */ + @NotBlank(message = "customerId不能为空",groups = AddGroup.class) + private String customerId; + /** + * 人员ID + */ + @NotBlank(message = "staffId不能为空",groups = AddGroup.class) + private String staffId; + + @NotBlank(message = "name不能为空",groups = AddGroup.class) + private String name; + + @NotBlank(message = "mobile不能为空",groups = AddGroup.class) + private String mobile; + + @NotBlank(message = "当前操作人id不能为空",groups = AddGroup.class) + private String operUserId; + +} + diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/yantai/YtUserPageFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/yantai/YtUserPageFormDTO.java new file mode 100644 index 0000000000..6a3ddda553 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/yantai/YtUserPageFormDTO.java @@ -0,0 +1,36 @@ +package com.epmet.dto.form.yantai; + +import com.epmet.commons.tools.dto.form.PageFormDTO; +import lombok.Data; + +/** + * @Description 运营端,统一认证 列表查询入参 + * @Author yzm + * @Date 2022/10/18 11:12 + */ +@Data +public class YtUserPageFormDTO extends PageFormDTO { + /** + * 0本机 + * 1本级及下级 + */ + private String type; + /** + * 组织id + * data_sync_org_data.ORGANIZATION_ID + */ + private String orgId; + /** + * 姓名 + */ + private String name; + /** + * 手机号 + */ + private String mobile; + /** + * 0未创建、已创建 + */ + private String status; +} + diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/yantai/DataSyncOrgDataDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/yantai/DataSyncOrgDataDTO.java new file mode 100644 index 0000000000..1a3b19a855 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/yantai/DataSyncOrgDataDTO.java @@ -0,0 +1,23 @@ +package com.epmet.dto.result.yantai; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description + * @Author yzm + * @Date 2022/10/18 14:21 + */ +@Data +public class DataSyncOrgDataDTO implements Serializable { + private static final long serialVersionUID = -3011177998045994250L; + private String orgId; + private String orgName; + private String pid; + /** + * true代表有下级 + */ + private Boolean haveChild; +} + diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/yantai/YtUserPageResDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/yantai/YtUserPageResDTO.java new file mode 100644 index 0000000000..38da48f7a9 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/yantai/YtUserPageResDTO.java @@ -0,0 +1,56 @@ +package com.epmet.dto.result.yantai; + +import lombok.Data; + +/** + * @Description 运营端,统一认证 列表返参 + * @Author yzm + * @Date 2022/10/18 11:53 + */ +@Data +public class YtUserPageResDTO { + /** + * 统一用户编码 + */ + private String userGuid; + /** + * data_sync_org_data.组织机构ID; + */ + private String organizationId; + /** + * XXX-XXX + */ + private String orgName; + /** + * 用户姓名 + */ + private String userName; + + /** + * 电话号码 + */ + private String telephoneNumber; + + /** + * 性别:0未知1男2女 + */ + private String gender; + + /** + * 0未创建、已创建 + */ + private String status; + + /** + * customer_staff.userId + */ + private String staffId; + + /** + * 备注;目前为空 + */ + private String remark; + + private String customerId; +} + diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/EpmetThirdOpenFeignClient.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/EpmetThirdOpenFeignClient.java index f0fef19e58..0638d340be 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/EpmetThirdOpenFeignClient.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/EpmetThirdOpenFeignClient.java @@ -5,6 +5,7 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.dto.form.BlockChainCreateProjectFormDTO; import com.epmet.dto.form.BlockChainProcessProjectFormDTO; import com.epmet.dto.form.ProjectApplyAssistFormDTO; +import com.epmet.dto.form.yantai.YtSyncStaffIdFormDTO; import com.epmet.dto.result.ProjectAssistResult; import com.epmet.dto.result.UploadFileResultDTO; import com.epmet.feign.fallback.EpmetThirdOpenFeignClientFallbackFactory; @@ -75,6 +76,9 @@ public interface EpmetThirdOpenFeignClient { @PostMapping("/third/blockchain/project/process") Result blockChainProcessProject(@RequestBody BlockChainProcessProjectFormDTO input); + @PostMapping("/third/dataSync/update-staff") + Result dataSyncUpdateStaff(@RequestBody YtSyncStaffIdFormDTO ytSyncStaffIdFormDTO); + class MultipartSupportConfig { @Autowired diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/ThirdOpenFeignClient.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/ThirdOpenFeignClient.java index 7b19e3efde..1f0f16c314 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/ThirdOpenFeignClient.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/ThirdOpenFeignClient.java @@ -8,6 +8,7 @@ import com.epmet.feign.fallback.ThirdOpenFeignClientFallbackFactory; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestParam; import java.util.List; @@ -69,4 +70,23 @@ public interface ThirdOpenFeignClient { */ @PostMapping("/third/blockchain/project/process") Result blockChainProcessProject(@RequestBody BlockChainProcessProjectFormDTO input); + + /** + * Desc: 从统一认证中心 拉取组织信息 + * @param orgId + * @author zxc + * @date 2022/10/18 16:50 + */ + @PostMapping("/third/dataSync/yanTai/sync/org") + Result getYanTaiOrgInfo(@RequestParam("orgId") String orgId); + + /** + * Desc: 从统一认证中心 拉取用户信息 + * @param orgId + * @author zxc + * @date 2022/10/18 16:50 + */ + @PostMapping("/third/dataSync/yanTai/sync/user") + Result getYanTaiUserInfo(@RequestParam("orgId") String orgId); + } diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/fallback/EpmetThirdOpenFeignClientFallback.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/fallback/EpmetThirdOpenFeignClientFallback.java index ebf63b3e49..ec7901a7a1 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/fallback/EpmetThirdOpenFeignClientFallback.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/fallback/EpmetThirdOpenFeignClientFallback.java @@ -6,6 +6,7 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.dto.form.BlockChainCreateProjectFormDTO; import com.epmet.dto.form.BlockChainProcessProjectFormDTO; import com.epmet.dto.form.ProjectApplyAssistFormDTO; +import com.epmet.dto.form.yantai.YtSyncStaffIdFormDTO; import com.epmet.dto.result.ProjectAssistResult; import com.epmet.dto.result.UploadFileResultDTO; import com.epmet.feign.EpmetThirdOpenFeignClient; @@ -57,4 +58,8 @@ public class EpmetThirdOpenFeignClientFallback implements EpmetThirdOpenFeignCli return ModuleUtils.feignConError(ServiceConstant.EPMET_THIRD_SERVER, "processProject", input); } + @Override + public Result dataSyncUpdateStaff(YtSyncStaffIdFormDTO ytSyncStaffIdFormDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_THIRD_SERVER, "updateStaff", ytSyncStaffIdFormDTO); + } } diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/fallback/ThirdOpenFeignClientFallback.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/fallback/ThirdOpenFeignClientFallback.java index 973342dc57..006122b075 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/fallback/ThirdOpenFeignClientFallback.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/fallback/ThirdOpenFeignClientFallback.java @@ -40,4 +40,14 @@ public class ThirdOpenFeignClientFallback implements ThirdOpenFeignClient { public Result blockChainProcessProject(BlockChainProcessProjectFormDTO input) { return ModuleUtils.feignConError(ServiceConstant.EPMET_THIRD_SERVER, "blockChainProcessProject", input); } + + @Override + public Result getYanTaiOrgInfo(String orgId) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_THIRD_SERVER, "getYanTaiOrgInfo", orgId); + } + + @Override + public Result getYanTaiUserInfo(String orgId) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_THIRD_SERVER, "getYanTaiUserInfo", orgId); + } } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/YanTaiConstant.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/YanTaiConstant.java new file mode 100644 index 0000000000..74e1d13560 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/YanTaiConstant.java @@ -0,0 +1,12 @@ +package com.epmet.constant; + +/** + * @Author zxc + * @DateTime 2022/10/18 16:43 + * @DESC + */ +public interface YanTaiConstant { + + String YT_CUSTOMER_ID = "1535072605621841922"; + +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/yantai/DataSyncUserAndOrgController.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/yantai/DataSyncUserAndOrgController.java new file mode 100644 index 0000000000..80f3a2f056 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/yantai/DataSyncUserAndOrgController.java @@ -0,0 +1,84 @@ +package com.epmet.controller.yantai; + +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.dto.form.yantai.YtSyncStaffIdFormDTO; +import com.epmet.dto.form.yantai.YtUserPageFormDTO; +import com.epmet.dto.result.yantai.DataSyncOrgDataDTO; +import com.epmet.dto.result.yantai.YtUserPageResDTO; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * desc: 从各个平台-同步用户和组织数据到本地 用于生成本系统账号 + * + * @author LiuJanJun + * @date 2022/10/17 3:41 下午 + */ +@RestController +@RequestMapping("dataSync") +public class DataSyncUserAndOrgController { + + @Autowired + private DataSyncUserAndOrgService dataSyncUserAndOrgService; + + /** + * desc:从统一认证中心 拉取用户信息 + * @return + */ + @PostMapping("yanTai/sync/user") + public Result getYanTaiUserInfo(@RequestParam("orgId")String orgId) { + Boolean flag = dataSyncUserAndOrgService.yanTaiSyncUser(orgId); + return new Result().ok(flag); + } + + /** + * desc:从统一认证中心 拉取组织信息 + * @return + */ + @PostMapping("yanTai/sync/org") + public Result getYanTaiOrgInfo(@RequestParam("orgId")String orgId) { + Boolean extJson = dataSyncUserAndOrgService.yanTaiSyncOrg(orgId); + return new Result().ok(extJson); + } + + + /** + * 运营端,统一认证 列表查询 + * + * @param formDTO + * @return + */ + @PostMapping("page-user") + public Result> pageUser(@RequestBody YtUserPageFormDTO formDTO) { + return new Result>().ok(dataSyncUserAndOrgService.pageUser(formDTO)); + } + + /** + * 工作端新增完用户后,需要调用此接口,更新data_sync_user_data + * + * @param formDTO + * @return + */ + @PostMapping("update-staff") + public Result updateStaff(@RequestBody YtSyncStaffIdFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, AddGroup.class); + dataSyncUserAndOrgService.updateStaff(formDTO.getCustomerId(),formDTO.getOperUserId(),formDTO.getStaffId(),formDTO.getName(),formDTO.getMobile()); + return new Result(); + } + + /** + * 运营端,统一认证 列表查询条件 那颗树 调用此接口 + * @param formDTO + * @return + */ + @PostMapping("ytorglist") + public Result> ytOrgList(@RequestBody YtUserPageFormDTO formDTO){ + List list=dataSyncUserAndOrgService.ytOrgList(formDTO.getOrgId()); + return new Result>().ok(list); + } +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/yantai/DataSyncUserAndOrgService.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/yantai/DataSyncUserAndOrgService.java new file mode 100644 index 0000000000..eedd580077 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/yantai/DataSyncUserAndOrgService.java @@ -0,0 +1,41 @@ +package com.epmet.controller.yantai; + +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.form.yantai.YtUserPageFormDTO; +import com.epmet.dto.result.yantai.DataSyncOrgDataDTO; +import com.epmet.dto.result.yantai.YtUserPageResDTO; + +import java.util.List; + +/** + * @author liujianjun + */ +public interface DataSyncUserAndOrgService { + Boolean yanTaiSyncUser(String organizationId); + + Boolean yanTaiSyncOrg(String organizationId); + + /** + * 运营端-统一认证 + * 用户列表 + * @param formDTO + * @return + */ + PageData pageUser(YtUserPageFormDTO formDTO); + + /** + * 工作端新增完用户后,需要调用此接口,更新data_sync_user_data + * @param customerId + * @param staffId + * @param name + * @param mobile + */ + int updateStaff(String customerId,String operUserId, String staffId, String name, String mobile); + + /** + * 根据组织id查询下级组织 + * @param pid + * @return + */ + List ytOrgList(String pid); +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/yantai/DataSyncUserAndOrgServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/yantai/DataSyncUserAndOrgServiceImpl.java new file mode 100644 index 0000000000..16d281ed0c --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/yantai/DataSyncUserAndOrgServiceImpl.java @@ -0,0 +1,202 @@ +package com.epmet.controller.yantai; + +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.redis.common.CustomerStaffRedis; +import com.epmet.commons.tools.redis.common.bean.CustomerStaffInfoDTOCache; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.api.yt.OrgData; +import com.epmet.commons.tools.utils.api.yt.UserData; +import com.epmet.commons.tools.utils.api.yt.YantaiApi; +import com.epmet.dao.yantai.DataSyncOrgDataDao; +import com.epmet.dao.yantai.DataSyncUserDataDao; +import com.epmet.dto.CustomerStaffDTO; +import com.epmet.dto.form.yantai.YtUserPageFormDTO; +import com.epmet.dto.result.yantai.DataSyncOrgDataDTO; +import com.epmet.dto.result.yantai.YtUserPageResDTO; +import com.epmet.entity.yantai.DataSyncOrgDataEntity; +import com.epmet.entity.yantai.DataSyncUserDataEntity; +import com.epmet.feign.EpmetUserOpenFeignClient; +import com.epmet.service.DataSyncOrgDataService; +import com.epmet.service.DataSyncUserDataService; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +import static com.epmet.constant.YanTaiConstant.YT_CUSTOMER_ID; + +/** + * desc:烟台 从认证中心同步组织和用户信息 到本地 + * + * @author: LiuJanJun + * @date: 2022/10/17 3:42 下午 + * @version: 1.0 + */ +@Service +@Slf4j +public class DataSyncUserAndOrgServiceImpl implements DataSyncUserAndOrgService { + @Autowired + private DataSyncUserDataDao dataSyncUserDataDao; + @Autowired + private DataSyncOrgDataDao dataSyncOrgDataDao; + @Autowired + private DataSyncOrgDataService dataSyncOrgDataService; + @Autowired + private DataSyncUserDataService dataSyncUserDataService; + @Autowired + private EpmetUserOpenFeignClient epmetUserOpenFeignClient; + + /** + * Desc: 从org表查询组织,在根据组织去查询用户 + * @param organizationId + * @author zxc + * @date 2022/10/19 13:27 + */ + @Override + public Boolean yanTaiSyncUser(String organizationId) { + String customerId = YT_CUSTOMER_ID; + // 先删除 旧数据 + Integer delSize = NumConstant.ZERO; + do { + delSize = dataSyncUserDataService.deleteByCustomerId(customerId); + }while (null != delSize && delSize == NumConstant.ONE_THOUSAND); + // 缓存初始化staffs + epmetUserOpenFeignClient.allCustomerStaffInCache(customerId); + Integer no = NumConstant.ONE; + Integer size; + do { + // 分批获取org + PageInfo pageInfo = PageHelper.startPage(no, NumConstant.ONE_HUNDRED).doSelectPageInfo(() -> dataSyncOrgDataDao.getAllList(customerId)); + size = pageInfo.getList().size(); + if (CollectionUtils.isNotEmpty(pageInfo.getList())){ + List needInsert = new ArrayList<>(); + pageInfo.getList().forEach(org -> { + // 根据org查用户 + List data = YantaiApi.getUserByOuGuid(org.getOrganizationId()); + if (CollectionUtils.isNotEmpty(data)){ + for (UserData u : data) { + CustomerStaffInfoDTOCache staffInfo = CustomerStaffRedis.getStaffInfoByMobile(customerId, u.getMobileTelephoneNumber()); + DataSyncUserDataEntity entity = ConvertUtils.sourceToTarget(u, DataSyncUserDataEntity.class); + entity.setOrganizationId(org.getOrganizationId()); + entity.setCustomerId(customerId); + entity.setRemark(""); + if (null == staffInfo){ + entity.setStatus(NumConstant.ZERO_STR); + entity.setStaffId(""); + }else { + CustomerStaffInfoCacheResult staffInfo1 = CustomerStaffRedis.getStaffInfo(customerId, staffInfo.getUserId()); + entity.setStatus(NumConstant.ONE_STR); + entity.setStaffId(staffInfo.getUserId()); + } + needInsert.add(entity); + } + } + }); + dataSyncUserDataService.insertBatch(needInsert,NumConstant.FIVE_HUNDRED); + } + no++; + }while (size == NumConstant.ONE_HUNDRED); + // 删除staffs缓存 + CustomerStaffRedis.delAllCustomerStaff(customerId); + return false; + } + + @Override + public Boolean yanTaiSyncOrg(String organizationId) { + // 先删除 旧数据 + Integer delSize = NumConstant.ZERO; + do { + delSize = dataSyncOrgDataService.deleteByCustomerId(YT_CUSTOMER_ID); + }while (null != delSize && delSize == NumConstant.ONE_THOUSAND); + List needInsert = new ArrayList<>(); + // 根组织 + OrgData rootOrg = YantaiApi.getOuInfoByOuGuid(organizationId); + if (null == rootOrg){ + log.error("未查询到根组织:"+organizationId); + return true; + } + rootOrg.setPid(""); + rootOrg.setPids(""); + rootOrg.setNameOfOrganization(""); + needInsert.add(rootOrg); + List data = YantaiApi.getChildOuInfoByGuid(organizationId); + if (CollectionUtils.isNotEmpty(data)){ + data.forEach(d -> { + d.setPid(organizationId); + d.setPids(organizationId.concat(":").concat(d.getOrganizationId())); + d.setNameOfOrganization(rootOrg.getNameOfOrganization()); + needInsert.add(d); + disposeYanTaiSyncOrg(d,needInsert); + }); + List entities = needInsert.stream().map(m -> { + DataSyncOrgDataEntity entity = ConvertUtils.sourceToTarget(m, DataSyncOrgDataEntity.class); + entity.setCustomerId(YT_CUSTOMER_ID); + return entity; + }).collect(Collectors.toList()); + dataSyncOrgDataService.insertBatch(entities, NumConstant.ONE_HUNDRED); + } + return false; + } + + public void disposeYanTaiSyncOrg(OrgData orgData, List needInsert){ + List data = YantaiApi.getChildOuInfoByGuid(orgData.getOrganizationId()); + if (CollectionUtils.isNotEmpty(data)){ + data.forEach(d -> { + d.setPid(orgData.getOrganizationId()); + d.setPids(orgData.getPids().concat(":").concat(d.getOrganizationId())); + d.setNameOfOrganization(orgData.getNameOfOrganization()); + needInsert.add(d); + disposeYanTaiSyncOrg(d,needInsert); + }); + } + } + + + /** + * 运营端-统一认证 + * 用户列表 + * + * @param formDTO + * @return + */ + @Override + public PageData pageUser(YtUserPageFormDTO formDTO) { + PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage()); + List list = dataSyncUserDataDao.pageUser(formDTO); + PageInfo pageInfo = new PageInfo<>(list); + return new PageData<>(list, pageInfo.getTotal()); + } + + /** + * 工作端新增完用户后,需要调用此接口,更新data_sync_user_data + * + * @param customerId + * @param staffId + * @param name + * @param mobile + */ + @Override + public int updateStaff(String customerId, String operUserId,String staffId, String name, String mobile) { + return dataSyncUserDataDao.updateStaff(customerId,operUserId,staffId,name,mobile); + } + + /** + * 根据组织id查询下级组织 + * + * @param pid + * @return + */ + @Override + public List ytOrgList(String pid) { + List list=dataSyncOrgDataDao.queryList(pid); + return list; + } +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/yantai/SM4UtilsForYanTai.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/yantai/SM4UtilsForYanTai.java new file mode 100644 index 0000000000..35d90d20ca --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/yantai/SM4UtilsForYanTai.java @@ -0,0 +1,199 @@ +package com.epmet.controller.yantai; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.apache.commons.codec.binary.Base64; +import org.bouncycastle.jce.provider.BouncyCastleProvider; + +import javax.crypto.BadPaddingException; +import javax.crypto.Cipher; +import javax.crypto.IllegalBlockSizeException; +import javax.crypto.SecretKey; +import javax.crypto.spec.SecretKeySpec; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.security.InvalidKeyException; +import java.security.Security; + +/** + * 烟台的认证中心-国密sm4加解密 + */ +public class SM4UtilsForYanTai { + private static String SM4_KEY = "yaweisoftware@xy"; + //编码格式 + private static final Charset encryptCharset = StandardCharsets.UTF_8; + + public enum Algorithm { + SM4("SM4","SM4","国密四,key长16byte"); + private String keyAlgorithm; + private String transformation; + private String description;//描述 + Algorithm(String keyAlgorithm, String transformation, String description) { + this.keyAlgorithm = keyAlgorithm; + this.transformation = transformation; + this.description = description; + } + public String getKeyAlgorithm() { + return this.keyAlgorithm; + } + public String getTransformation() { + return this.transformation; + } + public String getDescription() { + return this.description; + } + } + + private static final String PROVIDER_NAME = "BC"; + static { + Security.addProvider(new BouncyCastleProvider()); + } + + /** + * 自定字符串产生密钥 + * @param algorithm 加解密算法 + * @param keyStr 密钥字符串 + * @param charset 编码字符集 + * @return 密钥 + */ + public static SecretKey genKeyByStr(Algorithm algorithm, String keyStr, Charset charset) { + return readKeyFromBytes(algorithm, keyStr.getBytes(charset)); + } + + /** + * 根据指定字节数组产生密钥 + * @param algorithm 加解密算法 + * @param keyBytes 密钥字节数组 + * @return 密钥 + */ + public static SecretKey readKeyFromBytes(Algorithm algorithm, byte[] keyBytes) { + return new SecretKeySpec(keyBytes, algorithm.getKeyAlgorithm()); + } + + /****************************加密*********************************/ + /** + * 加密字符串,并进行base64编码 + * @param algorithm 加解密算法 + * @param key 密钥 + * @param data 明文 + * @param charset 编码字符集 + * @return 密文 + * @throws InvalidKeyException 密钥错误 + */ + public static String encryptBase64(Algorithm algorithm, SecretKey key, String data, Charset charset) throws InvalidKeyException { + return Base64.encodeBase64String(encrypt(algorithm, key, data.getBytes(charset))); + } + + /** + * 加密字节数组 + * @param algorithm 加解密算法 + * @param key 密钥 + * @param data 明文 + * @return 密文 + * @throws InvalidKeyException 密钥错误 + */ + public static byte[] encrypt(Algorithm algorithm, SecretKey key, byte[] data) throws InvalidKeyException { + try { + return cipherDoFinal(algorithm, Cipher.ENCRYPT_MODE, key, data); + } catch (BadPaddingException e) { + throw new RuntimeException(e);//明文没有具体格式要求,不会出错。所以这个异常不需要外部捕获。 + } + } + + /** + * 加解密字节数组 + * @param algorithm 加解密算法 + * @param opmode 操作:1加密,2解密 + * @param key 密钥 + * @param data 数据 + * @throws InvalidKeyException 密钥错误 + * @throws BadPaddingException 解密密文错误(加密模式没有) + */ + private static byte[] cipherDoFinal(Algorithm algorithm, int opmode, SecretKey key, byte[] data) throws InvalidKeyException, BadPaddingException { + Cipher cipher; + try { + cipher = Cipher.getInstance(algorithm.getTransformation(), PROVIDER_NAME); + } catch (Exception e) { + //NoSuchAlgorithmException:加密算法名是本工具类提供的,如果错了业务没有办法处理。所以这个异常不需要外部捕获。 + //NoSuchProviderException:Provider是本工具类提供的,如果错了业务没有办法处理。所以这个异常不需要外部捕获。 + //NoSuchPaddingException:没有特定的填充机制,与环境有关,业务没有办法处理。所以这个异常不需要外部捕获。 + throw new RuntimeException(e); + } + cipher.init(opmode, key); + try { + return cipher.doFinal(data); + } catch (IllegalBlockSizeException e) { + throw new RuntimeException(e);//业务不需要将数据分块(好像由底层处理了),如果错了业务没有办法处理。所以这个异常不需要外部捕获。 + } + } + + /****************************解密*********************************/ + /** + * 对字符串先进行base64解码,再解密 + * @param algorithm 加解密算法 + * @param key 密钥 + * @param data 密文 + * @param charset 编码字符集 + * @return 明文 + * @throws InvalidKeyException 密钥错误 + * @throws BadPaddingException 密文错误 + */ + public static String decryptBase64(Algorithm algorithm, SecretKey key, String data, Charset charset) + throws InvalidKeyException, BadPaddingException { + return new String(decrypt(algorithm, key, Base64.decodeBase64(data)), charset); + } + + /** + * 解密字节数组 + * @param algorithm 加解密算法 + * @param key 密钥 + * @param data 密文 + * @return 明文 + * @throws InvalidKeyException 密钥错误 + * @throws BadPaddingException 密文错误 + */ + public static byte[] decrypt(Algorithm algorithm, SecretKey key, byte[] data) throws InvalidKeyException, BadPaddingException { + return cipherDoFinal(algorithm, Cipher.DECRYPT_MODE, key, data); + } + + public static String Encrypt(String data) throws InvalidKeyException { + SecretKey key = genKeyByStr(Algorithm.SM4, SM4_KEY, encryptCharset); + return encryptBase64(Algorithm.SM4, key, data, encryptCharset); + } + public static String Decrypt(String data) throws BadPaddingException, InvalidKeyException { + SecretKey key = genKeyByStr(Algorithm.SM4, SM4_KEY, encryptCharset); + return decryptBase64(Algorithm.SM4, key, data, encryptCharset); + } + //加密 + public static String dealEncryptData(Object data) throws JsonProcessingException, InvalidKeyException { + ObjectMapper objectMapper = new ObjectMapper(); + String dataString = ""; + try { + if(data instanceof String){ + dataString = (String) data; + }else { + dataString = objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(data); + } + String dataEncrypt = Encrypt(dataString); + return dataEncrypt; + }catch (Exception e){ + return dataString; + } + } + //解密 + public static String dealDecryptData(Object data) throws JsonProcessingException, BadPaddingException, InvalidKeyException { + String dataString = ""; + try { + ObjectMapper objectMapper = new ObjectMapper(); + if (data instanceof String) { + dataString = (String) data; + } else { + dataString = objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(data); + } + String dataDecrypt = Decrypt(dataString); + return dataDecrypt; + }catch (Exception e){ + return dataString; + } + } +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/yantai/DataSyncOrgDataDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/yantai/DataSyncOrgDataDao.java new file mode 100644 index 0000000000..b9f2a0eca4 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/yantai/DataSyncOrgDataDao.java @@ -0,0 +1,29 @@ +package com.epmet.dao.yantai; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.result.yantai.DataSyncOrgDataDTO; +import com.epmet.entity.yantai.DataSyncOrgDataEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-10-18 + */ +@Mapper +public interface DataSyncOrgDataDao extends BaseDao { + /** + * 根据pid查询下一级组织列表 + * @param pid + * @return + */ + List queryList(@Param("pid") String pid); + + List getAllList(@Param("customerId") String customerId); + + Integer deleteByCustomerId(@Param("customerId")String customerId); +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/yantai/DataSyncUserDataDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/yantai/DataSyncUserDataDao.java new file mode 100644 index 0000000000..b36d45240b --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/yantai/DataSyncUserDataDao.java @@ -0,0 +1,44 @@ +package com.epmet.dao.yantai; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.form.yantai.YtUserPageFormDTO; +import com.epmet.dto.result.yantai.YtUserPageResDTO; +import com.epmet.entity.yantai.DataSyncUserDataEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-10-18 + */ +@Mapper +public interface DataSyncUserDataDao extends BaseDao { + /** + * 运营端,统一认证 列表查询 + * @param formDTO + * @return + */ + List pageUser(YtUserPageFormDTO formDTO); + + /** + * 更新data_sync_user_data 为已创建、记录staffId + * @param customerId + * @param operUserId + * @param staffId + * @param name + * @param mobile + * @return + */ + int updateStaff(@Param("customerId") String customerId, + @Param("operUserId")String operUserId, + @Param("staffId")String staffId, + @Param("name")String name, + @Param("mobile")String mobile); + + Integer deleteByCustomerId(@Param("customerId")String customerId); + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/yantai/DataSyncOrgDataEntity.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/yantai/DataSyncOrgDataEntity.java new file mode 100644 index 0000000000..5c46e0b939 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/yantai/DataSyncOrgDataEntity.java @@ -0,0 +1,106 @@ +package com.epmet.entity.yantai; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-10-18 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("data_sync_org_data") +public class DataSyncOrgDataEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 联系人姓名 + */ + private String contact; + + /** + * 联系电话号码 + */ + private String contacttelephoneNumber; + + /** + * 详细地址 + */ + private String detailAddress; + + /** + * 组织机构第一名称 + */ + private String firstnameofOrganization; + + /** + * 组织机构全称 + */ + private String nameofOrganization; + + /** + * 排序号码 + */ + private String orderNumber; + + /** + * 组织机构简称 + */ + private String organizatioNabbreviation; + + /** + * 组织机构ID + */ + private String organizationId; + + /** + * 组织机构级别 + */ + private String organizationLevel; + + /** + * 组织机构路径 + */ + private String organizationPath; + + /** + * 组织机构类型 + */ + private String organizationType; + + /** + * 注册类型 + */ + private String registrationType; + + /** + * 统一社会信用代码 + */ + private String unifiedsocialcreditId; + + /** + * 客户id;烟台id + */ + private String customerId; + + /** + * 上级组织机构id:ORGANIZATION_ID; 根级组织赋值0 + */ + private String pid; + + /** + * 上级组织机构名称:ORGANIZATIO_NABBREVIATION + */ + private String parentOrgName; + + /** + * 所有上级组织。不包含本身! + */ + private String pids; + +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/yantai/DataSyncUserDataEntity.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/yantai/DataSyncUserDataEntity.java new file mode 100644 index 0000000000..e0fa956f32 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/yantai/DataSyncUserDataEntity.java @@ -0,0 +1,91 @@ +package com.epmet.entity.yantai; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-10-18 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("data_sync_user_data") +public class DataSyncUserDataEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 性别:0未知1男2女 + */ + private String gender; + + /** + * 手机号码 + */ + private String mobileTelephoneNumber; + + /** + * 排序号码 + */ + private String orderNumber; + + /** + * 职务 + */ + private String position; + + /** + * 职级 + */ + private String positionLevel; + + /** + * 电话号码 + */ + private String telephoneNumber; + + /** + * 统一用户编码 + */ + private String userGuid; + + /** + * 用户姓名 + */ + private String userName; + + /** + * 人员路径 + */ + private String userPath; + + /** + * data_sync_org_data.组织机构ID; + */ + private String organizationId; + + /** + * 客户id + */ + private String customerId; + + /** + * 0未创建、已创建 + */ + private String status; + + /** + * customer_staff.userId + */ + private String staffId; + + /** + * 备注;目前为空 + */ + private String remark; + +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/DataSyncOrgDataService.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/DataSyncOrgDataService.java new file mode 100644 index 0000000000..72b77a4888 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/DataSyncOrgDataService.java @@ -0,0 +1,80 @@ +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.DataSyncOrgDataDTO; +import com.epmet.entity.yantai.DataSyncOrgDataEntity; + +import java.util.List; +import java.util.Map; + +/** + * + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-10-18 + */ +public interface DataSyncOrgDataService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2022-10-18 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2022-10-18 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return DataSyncOrgDataDTO + * @author generator + * @date 2022-10-18 + */ + DataSyncOrgDataDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2022-10-18 + */ + void save(DataSyncOrgDataDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2022-10-18 + */ + void update(DataSyncOrgDataDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2022-10-18 + */ + void delete(String[] ids); + + Integer deleteByCustomerId(String customerId); +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/DataSyncUserDataService.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/DataSyncUserDataService.java new file mode 100644 index 0000000000..b9f9fe8acf --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/DataSyncUserDataService.java @@ -0,0 +1,80 @@ +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.DataSyncUserDataDTO; +import com.epmet.entity.yantai.DataSyncUserDataEntity; + +import java.util.List; +import java.util.Map; + +/** + * + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-10-18 + */ +public interface DataSyncUserDataService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2022-10-18 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2022-10-18 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return DataSyncUserDataDTO + * @author generator + * @date 2022-10-18 + */ + DataSyncUserDataDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2022-10-18 + */ + void save(DataSyncUserDataDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2022-10-18 + */ + void update(DataSyncUserDataDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2022-10-18 + */ + void delete(String[] ids); + + Integer deleteByCustomerId(String customerId); +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/DataSyncOrgDataServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/DataSyncOrgDataServiceImpl.java new file mode 100644 index 0000000000..057d51885b --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/DataSyncOrgDataServiceImpl.java @@ -0,0 +1,89 @@ +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.dao.yantai.DataSyncOrgDataDao; +import com.epmet.dto.DataSyncOrgDataDTO; +import com.epmet.entity.yantai.DataSyncOrgDataEntity; +import com.epmet.service.DataSyncOrgDataService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-10-18 + */ +@Service +public class DataSyncOrgDataServiceImpl extends BaseServiceImpl implements DataSyncOrgDataService { + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, DataSyncOrgDataDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, DataSyncOrgDataDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public DataSyncOrgDataDTO get(String id) { + DataSyncOrgDataEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, DataSyncOrgDataDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(DataSyncOrgDataDTO dto) { + DataSyncOrgDataEntity entity = ConvertUtils.sourceToTarget(dto, DataSyncOrgDataEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(DataSyncOrgDataDTO dto) { + DataSyncOrgDataEntity entity = ConvertUtils.sourceToTarget(dto, DataSyncOrgDataEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Integer deleteByCustomerId(String customerId) { + return baseDao.deleteByCustomerId(customerId); + } + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/DataSyncUserDataServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/DataSyncUserDataServiceImpl.java new file mode 100644 index 0000000000..1b77490e52 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/DataSyncUserDataServiceImpl.java @@ -0,0 +1,88 @@ +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.dao.yantai.DataSyncUserDataDao; +import com.epmet.dto.DataSyncUserDataDTO; +import com.epmet.entity.yantai.DataSyncUserDataEntity; +import com.epmet.service.DataSyncUserDataService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-10-18 + */ +@Service +public class DataSyncUserDataServiceImpl extends BaseServiceImpl implements DataSyncUserDataService { + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, DataSyncUserDataDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, DataSyncUserDataDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public DataSyncUserDataDTO get(String id) { + DataSyncUserDataEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, DataSyncUserDataDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(DataSyncUserDataDTO dto) { + DataSyncUserDataEntity entity = ConvertUtils.sourceToTarget(dto, DataSyncUserDataEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(DataSyncUserDataDTO dto) { + DataSyncUserDataEntity entity = ConvertUtils.sourceToTarget(dto, DataSyncUserDataEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + @Override + public Integer deleteByCustomerId(String customerId) { + return null; + } + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/db/migration/V0.0.17__yt_sync_organduser.sql b/epmet-module/epmet-third/epmet-third-server/src/main/resources/db/migration/V0.0.17__yt_sync_organduser.sql new file mode 100644 index 0000000000..5249bca97b --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/db/migration/V0.0.17__yt_sync_organduser.sql @@ -0,0 +1,52 @@ +CREATE TABLE `data_sync_org_data` ( + `ID` varchar(64) NOT NULL COMMENT '主键ID', + `CONTACT` varchar(64) DEFAULT NULL COMMENT '联系人姓名', + `CONTACTTELEPHONE_NUMBER` varchar(64) DEFAULT NULL COMMENT '联系电话号码', + `DETAIL_ADDRESS` varchar(64) DEFAULT NULL COMMENT '详细地址', + `FIRSTNAMEOF_ORGANIZATION` varchar(64) DEFAULT NULL COMMENT '组织机构第一名称', + `NAMEOF_ORGANIZATION` varchar(64) DEFAULT NULL COMMENT '组织机构全称', + `ORDER_NUMBER` varchar(64) DEFAULT NULL COMMENT '排序号码', + `ORGANIZATIO_NABBREVIATION` varchar(64) NOT NULL COMMENT '组织机构简称', + `ORGANIZATION_ID` varchar(64) NOT NULL COMMENT '组织机构ID', + `ORGANIZATION_LEVEL` varchar(64) DEFAULT NULL COMMENT '组织机构级别', + `ORGANIZATION_PATH` varchar(256) NOT NULL COMMENT '组织机构路径', + `ORGANIZATION_TYPE` varchar(64) DEFAULT NULL COMMENT '组织机构类型', + `REGISTRATION_TYPE` varchar(64) DEFAULT NULL COMMENT '注册类型', + `UNIFIEDSOCIALCREDIT_ID` varchar(64) DEFAULT NULL COMMENT '统一社会信用代码', + `DEL_FLAG` int(11) NOT NULL DEFAULT '0' COMMENT '删除标识 0.未删除 1.已删除', + `REVISION` int(11) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户id;烟台id', + `PID` varchar(64) NOT NULL COMMENT '上级组织机构id:ORGANIZATION_ID; 根级组织赋值0', + `PARENT_ORG_NAME` varchar(64) DEFAULT NULL COMMENT '上一级组织机构名称:ORGANIZATIO_NABBREVIATION', + `PIDS` varchar(255) DEFAULT NULL COMMENT '所有上级组织。不包含本身!如果是根组织,此列为空串', + PRIMARY KEY (`ID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +CREATE TABLE `data_sync_user_data` ( + `ID` varchar(64) NOT NULL COMMENT '主键ID', + `GENDER` varchar(64) DEFAULT NULL COMMENT '性别:0未知1男2女', + `MOBILE_TELEPHONE_NUMBER` varchar(64) NOT NULL COMMENT '手机号码', + `ORDER_NUMBER` varchar(64) DEFAULT NULL COMMENT '排序号码', + `POSITION` varchar(64) DEFAULT NULL COMMENT '职务', + `POSITION_LEVEL` varchar(64) DEFAULT NULL COMMENT '职级', + `TELEPHONE_NUMBER` varchar(64) DEFAULT NULL COMMENT '电话号码', + `USER_GUID` varchar(64) DEFAULT NULL COMMENT '统一用户编码', + `USER_NAME` varchar(64) NOT NULL COMMENT '用户姓名', + `USER_PATH` varchar(128) DEFAULT NULL COMMENT '人员路径', + `ORGANIZATION_ID` varchar(64) NOT NULL COMMENT 'data_sync_org_data.组织机构ID;', + `DEL_FLAG` int(11) NOT NULL DEFAULT '0' COMMENT '删除标识 0.未删除 1.已删除', + `REVISION` int(11) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户id', + `STATUS` varchar(1) DEFAULT '0' COMMENT '0未创建、1已创建', + `STAFF_ID` varchar(64) DEFAULT NULL COMMENT 'customer_staff.userId,已创建的此列不能为空', + `REMARK` varchar(255) DEFAULT NULL COMMENT '备注;目前为空', + PRIMARY KEY (`ID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/db/migration/V0.0.18__yt_alter_sync.sql b/epmet-module/epmet-third/epmet-third-server/src/main/resources/db/migration/V0.0.18__yt_alter_sync.sql new file mode 100644 index 0000000000..930f3df2e4 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/db/migration/V0.0.18__yt_alter_sync.sql @@ -0,0 +1,4 @@ +alter table data_sync_org_data modify column PIDS varchar(1024) comment '所有上级组织。不包含本身!如果是根组织,此列为空串'; + +CREATE INDEX idx_data_sync_orgid on data_sync_org_data(ORGANIZATION_ID); +CREATE INDEX idx_data_sync_userorgid on data_sync_user_data(ORGANIZATION_ID); \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/logback-spring.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/logback-spring.xml index c95ac8b0f3..f8e2164fb7 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/logback-spring.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/logback-spring.xml @@ -140,10 +140,9 @@ - + - @@ -158,7 +157,7 @@ - + diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/yantai/DataSyncOrgDataDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/yantai/DataSyncOrgDataDao.xml new file mode 100644 index 0000000000..b92833402c --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/yantai/DataSyncOrgDataDao.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + delete from data_sync_org_data + where customer_id = #{customerId} + and del_flag = 0 + limit 1000 + + + + + \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/yantai/DataSyncUserDataDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/yantai/DataSyncUserDataDao.xml new file mode 100644 index 0000000000..f063d4e31c --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/yantai/DataSyncUserDataDao.xml @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + delete from data_sync_user_data + where customer_id = #{customerId} + and del_flag = 0 + limit 1000 + + + + + + + UPDATE data_sync_user_data + SET UPDATED_BY = #{operUserId}, + UPDATED_TIME = NOW(), + `STATUS` = '1', + STAFF_ID = #{staffId}, + CUSTOMER_ID = #{customerId} + WHERE + MOBILE_TELEPHONE_NUMBER = #{mobile} + AND USER_NAME = #{name} + AND del_flag = '0' + + \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueApplicationDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueApplicationDTO.java index fd0cdff40e..1138c33c7b 100644 --- a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueApplicationDTO.java +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueApplicationDTO.java @@ -73,6 +73,8 @@ public class IssueApplicationDTO implements Serializable { * 网格ID 居民端议题对应一个网格Id */ private String gridId; + private String orgId; + private String orgIdPath; /** * 审核通过后对应的 议题id @@ -130,4 +132,16 @@ public class IssueApplicationDTO implements Serializable { */ private Long latestTime; + private String address; + + /** + * 经度 + */ + private String longitude; + + /** + * 纬度 + */ + private String latitude; + } \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueAttachmentDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueAttachmentDTO.java new file mode 100644 index 0000000000..d9d7f2b723 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueAttachmentDTO.java @@ -0,0 +1,116 @@ +package com.epmet.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * issue库附件表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-09-30 + */ +@Data +public class IssueAttachmentDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户ID + */ + private String customerId; + + /** + * 业务id + */ + private String businessId; + + /** + * 议题:issue + */ + private String attachTo; + + /** + * 附件名 + */ + private String name; + + /** + * 文件格式(JPG、PNG、PDF、JPEG、BMP、MP4、WMA、M4A、MP3、DOC、DOCX、XLS) + */ + private String format; + + /** + * 附件类型((图片 - image、 视频 - video、 语音 - voice、 文档 - doc)) + */ + private String type; + + /** + * 附件地址 + */ + private String url; + + /** + * 排序字段 + */ + private Integer sort; + + /** + * 附件状态(审核中:auditing; +auto_passed: 自动通过; +review:结果不确定,需要人工审核; +block: 结果违规; +rejected:人工审核驳回; +approved:人工审核通过) +现在图片是同步审核的,所以图片只有auto_passed一种状态 + */ + private String status; + + /** + * 失败原因 + */ + private String reason; + + /** + * 语音或视频时长,秒 + */ + private Integer duration; + + /** + * 删除标记 0:未删除,1:已删除 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueDTO.java index 5e7a6c8fdb..487ca68aee 100644 --- a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueDTO.java +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueDTO.java @@ -19,8 +19,10 @@ package com.epmet.dto; import lombok.Data; +import javax.validation.constraints.NotBlank; import java.io.Serializable; import java.util.Date; +import java.util.List; /** @@ -34,6 +36,8 @@ public class IssueDTO implements Serializable { private static final long serialVersionUID = 1L; + public interface IssueForm{} + /** * 议题ID */ @@ -45,7 +49,7 @@ public class IssueDTO implements Serializable { private String issueStatus; /** - * 来源类型 eg:resi_topic + * 来源类型 话题:resi_topic;直接立议题:issue;事件:ic_event */ private String sourceType; @@ -67,12 +71,14 @@ public class IssueDTO implements Serializable { /** * 议题名称 最多20字 */ - private String issueTitle; + @NotBlank(message = "issueTitle不能为空",groups = IssueForm.class) + private String issueTitle; /** * 建议 最多1000字 */ - private String suggestion; + @NotBlank(message = "suggestion不能为空",groups = IssueForm.class) + private String suggestion; /** * 客户ID @@ -82,7 +88,8 @@ public class IssueDTO implements Serializable { /** * 网格ID 居民端议题对应一个网格Id */ - private String gridId; + @NotBlank(message = "gridId不能为空",groups = IssueForm.class) + private String gridId; /** * 所属机关 【数据权限-非必填】11:22:33(agencyId)数据权限控制 @@ -160,4 +167,23 @@ public class IssueDTO implements Serializable { private String projectId; private String issueId; + + /** + * 地址 + */ + @NotBlank(message = "address不能为空",groups = IssueForm.class) + private String address; + + /** + * 经度 + */ + private String longitude; + + /** + * 纬度 + */ + private String latitude; + private String userId; + + private List attachmentList; } \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/AllIssueListFormDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/AllIssueListFormDTO.java new file mode 100644 index 0000000000..619ae8baad --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/AllIssueListFormDTO.java @@ -0,0 +1,26 @@ +package com.epmet.dto.form; + +import com.epmet.commons.tools.dto.form.PageFormDTO; +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2022/10/9 16:52 + * @DESC + */ +@Data +public class AllIssueListFormDTO extends PageFormDTO implements Serializable { + + private static final long serialVersionUID = -9150357859854770833L; + + private String startTime; + private String endTime; + private String issueStatus; + private String issueTitle; + private String orgId; + private String orgType; + private String customerId; + private String userId; +} diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/AuditListFormDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/AuditListFormDTO.java new file mode 100644 index 0000000000..0fefeb06d2 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/AuditListFormDTO.java @@ -0,0 +1,31 @@ +package com.epmet.dto.form; + +import com.epmet.commons.tools.dto.form.PageFormDTO; +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2022/10/9 17:07 + * @DESC + */ +@Data +public class AuditListFormDTO extends PageFormDTO implements Serializable { + + private static final long serialVersionUID = 5924913199706972596L; + + private String startTime; + private String endTime; + private String issueTitle; + private String orgId; + private String orgType; + + /** + * under_auditing:待审核;rejected:驳回; + */ + private String applyStatus; + + private String customerId; + private String userId; +} diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/CloseIssueFormDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/CloseIssueFormDTO.java index d633a49564..eee04a2b61 100644 --- a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/CloseIssueFormDTO.java +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/CloseIssueFormDTO.java @@ -17,11 +17,17 @@ public class CloseIssueFormDTO implements Serializable { @NotBlank(message = "议题Id不能为空") private String issueId; + /** + * resolved已解决 + * unresolved未解决 + */ @NotBlank(message = "解决状态不能为空") private String resolveType; @NotBlank(message = "关闭理由不能为空") @Length(max=1000,message = "手机号不能超过1000位") private String closeReason; + + private String currentUserId; } diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/DelIssueFormDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/DelIssueFormDTO.java new file mode 100644 index 0000000000..5bfd830570 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/DelIssueFormDTO.java @@ -0,0 +1,25 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import java.util.List; + +/** + * @Description + * @Author yzm + * @Date 2022/10/12 11:00 + */ +@Data +public class DelIssueFormDTO { + @NotBlank(message = "customerId不能为空") + private String customerId; + @NotBlank(message = "userId不能为空") + private String userId; + @Valid + @NotEmpty(message = "issueIds不能为空") + private List issueIds; +} + diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/IssueCategoryTagListFormDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/IssueCategoryTagListFormDTO.java index d9339a0e97..3c2caa5909 100644 --- a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/IssueCategoryTagListFormDTO.java +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/IssueCategoryTagListFormDTO.java @@ -15,7 +15,8 @@ public class IssueCategoryTagListFormDTO implements Serializable { private static final long serialVersionUID = 2599592072265715951L; @NotBlank(message = "议题ID不能为空",groups = {ProjectCategoryTagListFormDTO.CategoryTag.class}) private String issueId; - + @NotBlank(message = "customerId不能为空",groups = {ProjectCategoryTagListFormDTO.CategoryTag.class}) + private String customerId; public interface CategoryTag{} } diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/PublishIssueFormDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/PublishIssueFormDTO.java new file mode 100644 index 0000000000..a965c22ed4 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/PublishIssueFormDTO.java @@ -0,0 +1,123 @@ +package com.epmet.dto.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.Date; + +/** + * @Description + * @Author yzm + * @Date 2022/10/10 9:32 + */ +@Data +public class PublishIssueFormDTO implements Serializable { + private static final long serialVersionUID = 1713711343683095564L; + + public interface AddUserShowGroup extends CustomerClientShowGroup { + } + + /** + * 议题状态 表决中:voting 已转项目:shift_project 已关闭:closed + */ + @NotBlank(message = "议题状态不能为空", groups = AddUserShowGroup.class) + private String issueStatus; + + /** + * 来源类型 话题:resi_topic;直接立议题:issue;事件:ic_event + */ + @NotBlank(message = "议题来源不能为空", groups = AddUserShowGroup.class) + private String sourceType; + + /** + * 来源ID eg:2223232(当SOURCE_TYPE为"resi_topic"时,这里指话题的ID) + */ + private String sourceId; + + /** + * 议题名称 最多20字 + */ + @NotBlank(message = "issueTitle不能为空", groups = AddUserShowGroup.class) + private String issueTitle; + + /** + * 建议 最多1000字 + */ + @NotBlank(message = "suggestion不能为空", groups = AddUserShowGroup.class) + private String suggestion; + + /** + * 客户ID + */ + @NotBlank(message = "customerId不能为空", groups = AddUserShowGroup.class) + private String customerId; + + /** + * 网格ID 居民端议题对应一个网格Id + */ + @NotBlank(message = "gridId不能为空", groups = AddUserShowGroup.class) + private String gridId; + + /** + * 所属机关 【数据权限-非必填】11:22:33(agencyId)数据权限控制 + */ + @NotBlank(message = "orgIdPath不能为空", groups = AddUserShowGroup.class) + private String orgIdPath; + + /** + * 组织ID 【数据权限-非必填】agencyId + */ + @NotBlank(message = "orgId不能为空", groups = AddUserShowGroup.class) + private String orgId; + + /** + * 表决发起日期(转议题日期) + */ + @NotNull(message = "表决发起日期(转议题日期)不能为空", groups = AddUserShowGroup.class) + private Date decidedTime; + + /** + * 地址 + */ + @NotBlank(message = "address不能为空", groups = AddUserShowGroup.class) + private String address; + + /** + * 经度 + */ + @NotBlank(message = "经度不能为空", groups = AddUserShowGroup.class) + private String longitude; + + /** + * 纬度 + */ + @NotBlank(message = "纬度不能为空", groups = AddUserShowGroup.class) + private String latitude; + + /** + * 创建人 + */ + @NotBlank(message = "议题发起人(createdBy)不能为空", groups = AddUserShowGroup.class) + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + + private String eventReportUserName; +} + diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/SelectIssueVotingDetailFormDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/SelectIssueVotingDetailFormDTO.java index fb51463348..d0f2ad3c41 100644 --- a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/SelectIssueVotingDetailFormDTO.java +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/SelectIssueVotingDetailFormDTO.java @@ -17,4 +17,9 @@ public class SelectIssueVotingDetailFormDTO implements Serializable { private String issueId; private String gridId; + + /** + * 来源类型 不为空的时候根据类型处理 + */ + private String sourceType; } diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/VoteFormDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/VoteFormDTO.java index 44655fbb8b..b3816f3a24 100644 --- a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/VoteFormDTO.java +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/VoteFormDTO.java @@ -28,5 +28,11 @@ public class VoteFormDTO implements Serializable { */ private String createdBy; + /** + * 当 sourceType = issue 时,是直接创建议题,无需加入小组即可表决 + * 默认为resi_topic + */ + private String sourceType = "resi_topic"; + } diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/AllIssueListResultDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/AllIssueListResultDTO.java new file mode 100644 index 0000000000..0efcb2566a --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/AllIssueListResultDTO.java @@ -0,0 +1,64 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * @Author zxc + * @DateTime 2022/10/9 16:49 + * @DESC + */ +@Data +public class AllIssueListResultDTO implements Serializable { + + private static final long serialVersionUID = -3447913619727610107L; + + /** + * 所属网格 + */ + private String gridName; + private String gridId; + private String orgId; + + /** + * 议题标题 + */ + private String issueTitle; + + /** + * 议题建议 + */ + private String suggestion; + + /** + * 议题创建时间 + */ + private String createdTime; + + /** + * 支持数 + */ + private Integer supportCount; + + /** + * 反对数 + */ + private Integer oppositionCount; + + /** + * 议题状态 + */ + private String issueStatus; + private String issueStatusName; + private String issueId; + + /** + * 来源类型 话题:resi_topic;直接立议题:issue;事件:ic_event + */ + private String sourceType; + + private Date decidedTime; + private Date votingDeadline; +} diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/AuditListResultDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/AuditListResultDTO.java new file mode 100644 index 0000000000..5878ca9864 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/AuditListResultDTO.java @@ -0,0 +1,41 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2022/10/9 17:04 + * @DESC + */ +@Data +public class AuditListResultDTO implements Serializable { + + private static final long serialVersionUID = -9143726703244316997L; + + + /** + * 所属网格 + */ + private String gridName; + private String gridId; + private String orgId; + + /** + * 议题标题 + */ + private String issueTitle; + + /** + * 议题建议 + */ + private String suggestion; + + private String applyStatus; + private String applyStatusName; + + private String applyTime; + + private String issueApplicationId; +} diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/ClosedIssueListResultDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/ClosedIssueListResultDTO.java index 08bfdca9e6..68b2b4367e 100644 --- a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/ClosedIssueListResultDTO.java +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/ClosedIssueListResultDTO.java @@ -3,6 +3,7 @@ package com.epmet.dto.result; import lombok.Data; import java.io.Serializable; +import java.util.List; /** * @Description @@ -38,4 +39,15 @@ public class ClosedIssueListResultDTO implements Serializable { * 话题id */ private String sourceId; + + /** + * 来源类型 话题:resi_topic;直接立议题:issue; + */ + private String sourceType; + + /** + * 发布议题的图片 + */ + private List issueImgs; + } diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/GovIssueDetailResultDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/GovIssueDetailResultDTO.java index 5d87d13144..c82a6a79ce 100644 --- a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/GovIssueDetailResultDTO.java +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/GovIssueDetailResultDTO.java @@ -1,5 +1,6 @@ package com.epmet.dto.result; +import com.epmet.commons.tools.constant.NumConstant; import lombok.Data; import java.io.Serializable; @@ -53,6 +54,7 @@ public class GovIssueDetailResultDTO implements Serializable { * 议题来源 例如 resi_topic * */ private String sourceType; + private String sourceId; /** * 当议题没有转成详情时此项为"" @@ -64,4 +66,16 @@ public class GovIssueDetailResultDTO implements Serializable { * */ private Long votingDeadline; + public GovIssueDetailResultDTO() { + this.issueTitle = ""; + this.issueStatus = ""; + this.topicInfo = new GovTopicOfIssueInfoResultDTO(); + this.issuePublisherMobile = ""; + this.issueSuggestion = ""; + this.belongsGridName = ""; + this.issueInitiator = ""; + this.sourceType = ""; + this.projectId = ""; + this.votingDeadline = NumConstant.ZERO_L; + } } diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/GovTopicOfIssueInfoResultDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/GovTopicOfIssueInfoResultDTO.java index 1ddcdd85da..40fe5ceafa 100644 --- a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/GovTopicOfIssueInfoResultDTO.java +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/GovTopicOfIssueInfoResultDTO.java @@ -1,8 +1,10 @@ package com.epmet.dto.result; +import com.epmet.commons.tools.constant.NumConstant; import lombok.Data; import java.io.Serializable; +import java.util.ArrayList; import java.util.List; /** @@ -53,4 +55,15 @@ public class GovTopicOfIssueInfoResultDTO implements Serializable { * 话题所属小组名称 */ private String groupName; + + public GovTopicOfIssueInfoResultDTO() { + this.topicId = ""; + this.topicContent = ""; + this.photoList = new ArrayList<>(); + this.topicPublisher = ""; + this.topicPublishTime = NumConstant.ZERO_L; + this.topicPublisherMobile = ""; + this.groupId = ""; + this.groupName = ""; + } } diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/IssueAdvanceResDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/IssueAdvanceResDTO.java new file mode 100644 index 0000000000..9fa5741fe3 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/IssueAdvanceResDTO.java @@ -0,0 +1,21 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.util.List; + +/** + * @Description 议题的处理进展(包含转项目后的进展)内部服务之间调用 + * @Author yzm + * @Date 2022/10/11 9:43 + */ +@Data +public class IssueAdvanceResDTO { + private String issueId; + /** + * 议题状态(voting 已转项目:shift_project 已关闭:closed) + */ + private String issueStatus; + private List processList; +} + diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/IssueProfileDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/IssueProfileDTO.java new file mode 100644 index 0000000000..ce7311130c --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/IssueProfileDTO.java @@ -0,0 +1,27 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.util.List; + +/** + * @Description + * @Author yzm + * @Date 2022/10/8 12:58 + */ +@Data +public class IssueProfileDTO { + private String issueId; + private String sourceId; + private String longitude; + private String latitude; + /** + * 来源类型 话题:resi_topic;直接立议题:issue;事件:ic_event + */ + private String issueSourceType; + /** + * 发布议题的图片 + */ + private List issueImgs; +} + diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/IssueResultDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/IssueResultDTO.java index f63ea2d492..c87d9e5f51 100644 --- a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/IssueResultDTO.java +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/IssueResultDTO.java @@ -5,6 +5,7 @@ import lombok.Data; import java.io.Serializable; import java.util.Date; +import java.util.List; /** * @Author zxc @@ -15,7 +16,7 @@ import java.util.Date; public class IssueResultDTO implements Serializable { private static final long serialVersionUID = -1L; - + private String issueId; /** * 议题标题 */ @@ -53,4 +54,16 @@ public class IssueResultDTO implements Serializable { @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Date shiftIssueTime; + + /** + * 来源类型 话题:resi_topic;直接立议题:issue; + */ + private String sourceType; + + private String sourceId; + + /** + * 发布议题的图片 + */ + private List issueImgs; } diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/MyPubIssuesAuditingResultDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/MyPubIssuesAuditingResultDTO.java index 4af11fb3f2..e666b9b9cb 100644 --- a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/MyPubIssuesAuditingResultDTO.java +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/MyPubIssuesAuditingResultDTO.java @@ -50,4 +50,6 @@ public class MyPubIssuesAuditingResultDTO implements Serializable { @JsonIgnore private String topicId; + private String sourceType; + } diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/ProcessListResultDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/ProcessListResultDTO.java index 05b17f9d57..731a1e5b57 100644 --- a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/ProcessListResultDTO.java +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/ProcessListResultDTO.java @@ -5,7 +5,7 @@ import lombok.Data; import java.io.Serializable; /** - * @Author zxc + * @Author zxc 就是他issue * 议题处理进展 */ @Data @@ -37,5 +37,6 @@ public class ProcessListResultDTO implements Serializable { * 进展id(操作记录表id) */ private String processId; + private String type; } diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/ProcessListResultDTOBak.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/ProcessListResultDTOBak.java new file mode 100644 index 0000000000..d3e8b4ed84 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/ProcessListResultDTOBak.java @@ -0,0 +1,39 @@ +package com.epmet.dto.result; + +import lombok.Data; + +/** + * @Description + * @Author yzm + * @Date 2022/10/11 11:13 + */ +@Data +public class ProcessListResultDTOBak { + + /** + * 处理进展名称(表决中、转项目、流转中已结案、已关闭) + */ + private String processName; + + /** + * 已转项目进展记录时间 + */ + private Long processTime; + + /** + * 处理部门(处理人所属的机关单位名称) + */ + private String departmentName; + + /** + * 进展说明 + */ + private String progressDesc; + + /** + * 进展id(操作记录表id) + */ + private String processId; + private String type; +} + diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/VotingIssueListResultDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/VotingIssueListResultDTO.java index 2ac18595ea..038d40a90d 100644 --- a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/VotingIssueListResultDTO.java +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/VotingIssueListResultDTO.java @@ -3,6 +3,7 @@ package com.epmet.dto.result; import lombok.Data; import java.io.Serializable; +import java.util.List; /** * @Description 政府端/居民段查看表决中议题列表返参 @@ -18,7 +19,10 @@ public class VotingIssueListResultDTO implements Serializable { * 议题发布时间 * */ private Long issuePublishTime; - + /** + * 议题发布时间 + */ + private String issuePublishTimeStr; /** * 议题Id * */ @@ -38,4 +42,14 @@ public class VotingIssueListResultDTO implements Serializable { * 来源话题的id */ private String sourceId; + + /** + * 来源类型 话题:resi_topic;直接立议题:issue; + */ + private String sourceType; + + /** + * 发布议题的图片 + */ + private List issueImgs; } diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/feign/GovIssueOpenFeignClient.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/feign/GovIssueOpenFeignClient.java index 2392e4d2fa..097dbeba8c 100644 --- a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/feign/GovIssueOpenFeignClient.java +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/feign/GovIssueOpenFeignClient.java @@ -34,7 +34,7 @@ import java.util.Map; * @date 2020/6/4 13:37 */ @FeignClient(name = ServiceConstant.GOV_ISSUE_SERVER, fallbackFactory = GovIssueOpenFeignClientFallBackFactory.class) -//@FeignClient(name = ServiceConstant.GOV_ISSUE_SERVER, fallbackFactory = GovIssueOpenFeignClientFallBackFactory.class,url = "localhost:8101") +// @FeignClient(name = ServiceConstant.GOV_ISSUE_SERVER, fallbackFactory = GovIssueOpenFeignClientFallBackFactory.class,url = "localhost:8101") public interface GovIssueOpenFeignClient { /** @@ -336,7 +336,11 @@ public interface GovIssueOpenFeignClient { @PostMapping(value = "/gov/issue/issueprojectcategorydict/getprojectcategory") Result> getProjectCategory(@RequestBody List list); - + /** + * 调用此方法建议分页!!!! + * @param formDTO + * @return + */ @PostMapping("/gov/issue/issue/unresolvedlist") Result> getUnresolvedList(@RequestBody ShiftProjectListFromDTO formDTO); @@ -395,4 +399,37 @@ public interface GovIssueOpenFeignClient { @PostMapping(value = "/gov/issue/issueprojectcategorydict/first/{customerId}") Result> queryFirstCategory(@PathVariable("customerId") String customerId); + + /** + * 根据议题ids查询议题简要信息 + * @param issueIds + * @return + */ + @PostMapping("/gov/issue/issue/getIssueProfile") + Result> getIssueProfile(@RequestBody List issueIds); + + /** + * 事件转议题 + * @param issueFormDTO + * @return + */ + @PostMapping("/gov/issue/issue/publishIssue") + Result publishIssue(@RequestBody PublishIssueFormDTO issueFormDTO); + + /** + * 议题处理进展:(只包含发起议题、关闭议题) + * @param formDTO + * @return + */ + @PostMapping("/gov/issue/issueprocess/issueprocess") + Result queryIssueProcess(@RequestBody IssueIdFormDTO formDTO); + + /** + * 删除事件时,事件转了议题,调用此方法,删除议题 + * 批量删除议题(议题如果转了项目,此方法不删除项目!) + * @param delIssueFormDTO + * @return 删除的议题中,转为了项目,返回议题id,上层再单独去删除项目 + */ + @PostMapping("/gov/issue/issue/deleteIssueInternal") + Result> deleteIssueInternal(@RequestBody DelIssueFormDTO delIssueFormDTO); } diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/feign/fallback/GovIssueOpenFeignClientFallBack.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/feign/fallback/GovIssueOpenFeignClientFallBack.java index be2f187945..b76d3ce734 100644 --- a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/feign/fallback/GovIssueOpenFeignClientFallBack.java +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/feign/fallback/GovIssueOpenFeignClientFallBack.java @@ -332,5 +332,48 @@ public class GovIssueOpenFeignClientFallBack implements GovIssueOpenFeignClient return ModuleUtils.feignConError(ServiceConstant.GOV_ISSUE_SERVER, "queryFirstCategory", customerId); } + /** + * 根据议题ids查询议题简要信息 + * + * @param issueIds + * @return + */ + @Override + public Result> getIssueProfile(List issueIds) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ISSUE_SERVER, "getIssueProfile", issueIds); + } + + /** + * 事件转议题 + * + * @param issueFormDTO + * @return + */ + @Override + public Result publishIssue(PublishIssueFormDTO issueFormDTO) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ISSUE_SERVER, "publishIssue", issueFormDTO); + } + /** + * 议题处理进展,(只包含发起议题、关闭议题) + * + * @param formDTO + * @return + */ + @Override + public Result queryIssueProcess(IssueIdFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ISSUE_SERVER, "queryIssueProcess", formDTO); + } + + /** + * 删除事件时,事件转了议题,调用此方法,删除议题 + * 批量删除议题(议题如果转了项目,此方法不删除项目!) + * + * @param delIssueFormDTO + * @return 删除的议题中,转为了项目,返回项目id,上层再单独去删除项目 + */ + @Override + public Result> deleteIssueInternal(DelIssueFormDTO delIssueFormDTO) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ISSUE_SERVER, "deleteIssueInternal", delIssueFormDTO); + } } diff --git a/epmet-module/gov-issue/gov-issue-server/pom.xml b/epmet-module/gov-issue/gov-issue-server/pom.xml index 7741561d9f..db38938089 100644 --- a/epmet-module/gov-issue/gov-issue-server/pom.xml +++ b/epmet-module/gov-issue/gov-issue-server/pom.xml @@ -179,7 +179,9 @@ callerRunsPolicy false - https://epmet-dev.elinkservice.cn/api/epmetscan/api + + + https://epmet-open.elinkservice.cn/api/epmetscan/api https://oapi.dingtalk.com/robot/send?access_token=e894e5690f9d6a527722974c71548ff6c0fe29bd956589a09e21b16442a35ed4 diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/constant/UserMessageConstant.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/constant/UserMessageConstant.java index 2a0cf7b35f..8cb2d2d0da 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/constant/UserMessageConstant.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/constant/UserMessageConstant.java @@ -36,4 +36,9 @@ public interface UserMessageConstant { */ String PROJECT_RESOLVED_MSG = "您收到一条【%s】的新信息,请您尽快处理。"; + /** + * 议题转项目消息模板 + */ + String PUB_ISSUE_SHIFT_PROJECT_MSG = "您发表的议题\"%s\"的问题,已由%s部门处理,请查看。"; + } diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueAuditController.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueAuditController.java index 8317eb8ab0..25f4af86f9 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueAuditController.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueAuditController.java @@ -2,16 +2,15 @@ package com.epmet.controller; import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.annotation.RequirePermission; +import com.epmet.commons.tools.dto.form.PageFormDTO; import com.epmet.commons.tools.enums.RequirePermissionEnum; +import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.constant.IssueConstant; import com.epmet.dto.form.*; -import com.epmet.dto.result.ApplicationDetailWorkResultDTO; -import com.epmet.dto.result.ApplicationHistoryResDTO; -import com.epmet.dto.result.ApplicationHistoryWorkResultDTO; -import com.epmet.dto.result.IssueApplicationResDTO; +import com.epmet.dto.result.*; import com.epmet.service.IssueApplicationHistoryService; import com.epmet.service.IssueApplicationService; import com.epmet.service.IssueService; @@ -21,6 +20,8 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; import java.util.List; /** @@ -130,4 +131,38 @@ public class IssueAuditController { public Result audit(@LoginUser TokenDto token, @RequestBody IssueAuditionFormDTO param){ return new Result().ok(issueService.audit(token,param)); } + + /** + * Desc: 审核列表 + * @param formDTO + * @param tokenDto + * @author zxc + * @date 2022/10/9 17:11 + */ + @PostMapping("auditList") + public Result> auditList(@RequestBody AuditListFormDTO formDTO, @LoginUser TokenDto tokenDto){ + ValidatorUtils.validateEntity(formDTO, PageFormDTO.AddUserInternalGroup.class); + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setUserId(tokenDto.getUserId()); + return new Result>().ok(issueApplicationService.auditList(formDTO)); + } + + @PostMapping("auditListExport") + public void auditListExport(@RequestBody AuditListFormDTO formDTO, @LoginUser TokenDto tokenDto, HttpServletResponse response) throws IOException { + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setUserId(tokenDto.getUserId()); + issueApplicationService.auditListExport(formDTO,response); + } + + /** + * Desc: 补全议题审核表历史数据 + * @param + * @author zxc + * @date 2022/10/10 10:55 + */ + @PostMapping("initIssueApplicationHistoryData") + public Result initIssueApplicationHistoryData(){ + issueApplicationService.initIssueApplicationHistoryData(); + return new Result(); + } } diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueCategoryController.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueCategoryController.java index 6f459a71ad..6df8e177c3 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueCategoryController.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueCategoryController.java @@ -106,7 +106,8 @@ public class IssueCategoryController { * @Author sun **/ @PostMapping("categorytaglist") - public Result categoryTagList(@RequestBody IssueCategoryTagListFormDTO formDTO) { + public Result categoryTagList(@LoginUser TokenDto tokenDto,@RequestBody IssueCategoryTagListFormDTO formDTO) { + formDTO.setCustomerId(tokenDto.getCustomerId()); ValidatorUtils.validateEntity(formDTO, IssueCategoryTagListFormDTO.CategoryTag.class); return new Result().ok(issueCategoryService.categoryTagList(formDTO)); } diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueController.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueController.java index ec49c3bb81..efb1ede9f1 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueController.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueController.java @@ -1,6 +1,8 @@ package com.epmet.controller; import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.dto.form.PageFormDTO; +import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; @@ -13,9 +15,12 @@ import com.epmet.resi.group.dto.group.result.GroupShiftProjectListResultDTO; import com.epmet.resi.group.dto.group.result.GroupVotingListResultDTO; import com.epmet.resi.group.dto.topic.form.TopicInfoFormDTO; import com.epmet.service.IssueService; +import org.apache.commons.collections4.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; import java.util.List; /** @@ -280,7 +285,11 @@ public class IssueController { return new Result>().ok(issueService.canEvaluateProjectCountBatch(issueIds)); } - + /** + * 无需解决:结案选择无需解决的项目、关闭选择无需解决的议题 + * @param formDTO + * @return + */ @PostMapping("unresolvedlist") public Result> getUnresolvedList(@RequestBody ShiftProjectListFromDTO formDTO){ return new Result>().ok(issueService.getUnResolvedList(formDTO)); @@ -333,5 +342,78 @@ public class IssueController { return new Result().ok(issueService.issueAuditReset(gridId)); } + /** + * Desc: 创建议题【直接创建】 + * @param formDTO + * @author zxc + * @date 2022/10/8 09:03 + */ + @PostMapping("createIssue") + public Result createIssue(@LoginUser TokenDto tokenDto,@RequestBody IssueDTO formDTO){ + formDTO.setUserId(tokenDto.getUserId()); + formDTO.setCustomerId(tokenDto.getCustomerId()); + ValidatorUtils.validateEntity(formDTO,IssueDTO.IssueForm.class); + issueService.createIssue(formDTO); + return new Result(); + } + + /** + * 根据议题ids查询议题简要信息 + * @param issueIds + * @return + */ + @PostMapping("getIssueProfile") + public Result> getIssueProfile(@RequestBody List issueIds) { + if (CollectionUtils.isEmpty(issueIds)) { + return new Result<>(); + } + return new Result>().ok(issueService.getIssueProfile(issueIds)); + } + + /** + * Desc: 查询所有议题 + * @param formDTO + * @param tokenDto + * @author zxc + * @date 2022/10/9 16:59 + */ + @PostMapping("allIssueList") + public Result> allIssueList(@RequestBody AllIssueListFormDTO formDTO, @LoginUser TokenDto tokenDto){ + ValidatorUtils.validateEntity(formDTO, PageFormDTO.AddUserInternalGroup.class); + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setUserId(tokenDto.getUserId()); + return new Result>().ok(issueService.allIssueList(formDTO)); + } + + @PostMapping("allIssueListExport") + public void allIssueListExport(@RequestBody AllIssueListFormDTO formDTO, @LoginUser TokenDto tokenDto, HttpServletResponse response) throws IOException { + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setUserId(tokenDto.getUserId()); + issueService.allIssueListExport(formDTO,response); + } + + /** + * 发布议题 + * 事件转议题 + * @param issueFormDTO + * @return + */ + @PostMapping("publishIssue") + public Result publishIssue(@RequestBody PublishIssueFormDTO issueFormDTO) { + ValidatorUtils.validateEntity(issueFormDTO, PublishIssueFormDTO.AddUserShowGroup.class); + return new Result().ok(issueService.publishIssue(issueFormDTO)); + } + + /** + * 删除事件时,事件转了议题,调用此方法,删除议题 + * 批量删除议题(议题如果转了项目,此方法不删除项目!) + * @param delIssueFormDTO + * @return 删除的议题中,转为了项目,返回项目id,上层再单独去删除项目 + */ + @PostMapping("deleteIssueInternal") + public Result> deleteIssueInternal(@RequestBody DelIssueFormDTO delIssueFormDTO){ + ValidatorUtils.validateEntity(delIssueFormDTO); + return new Result>().ok(issueService.deleteIssueInternal(delIssueFormDTO)); + } } diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueManageController.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueManageController.java index a77e531b26..ec413629df 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueManageController.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueManageController.java @@ -43,8 +43,9 @@ public class IssueManageController { * @Description 议题管理-关闭议题 **/ @PostMapping("closeissue") - @RequirePermission(requirePermission = RequirePermissionEnum.WORK_GRASSROOTS_ISSUE_CLOSE) + // @RequirePermission(requirePermission = RequirePermissionEnum.WORK_GRASSROOTS_ISSUE_CLOSE) public Result closeIssue(@LoginUser TokenDto tokenDTO, @RequestBody CloseIssueFormDTO formDTO) { + formDTO.setCurrentUserId(tokenDTO.getUserId()); ValidatorUtils.validateEntity(formDTO); issueService.closeIssue(formDTO); return new Result(); @@ -88,6 +89,11 @@ public class IssueManageController { return new Result().ok(issueVoteStatisticalService.votingTrend(issueId)); } + @PostMapping("votingTrendV2") + public Result votingTrendV2(@RequestBody IssueIdFormDTO issueId){ + return new Result().ok(issueVoteStatisticalService.votingTrendV2(issueId)); + } + /** * @Description 满意度评价列表——已关闭 * @param formDTO @@ -196,6 +202,7 @@ public class IssueManageController { @PostMapping("progress") @RequirePermission(requirePermission = RequirePermissionEnum.WORK_GRASSROOTS_ISSUE_DETAIL) public Result> processList(@RequestBody IssueIdFormDTO issueId){ + ValidatorUtils.validateEntity(issueId); return new Result>().ok(issueProcessService.processList(issueId)); } diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueProcessController.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueProcessController.java index 737b187ad1..5250066ed8 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueProcessController.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueProcessController.java @@ -27,6 +27,7 @@ import com.epmet.commons.tools.validator.group.DefaultGroup; import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.dto.IssueProcessDTO; import com.epmet.dto.form.IssueIdFormDTO; +import com.epmet.dto.result.IssueAdvanceResDTO; import com.epmet.dto.result.ProcessListResultDTO; import com.epmet.excel.IssueProcessExcel; import com.epmet.service.IssueProcessService; @@ -103,4 +104,13 @@ public class IssueProcessController { return new Result>().ok(issueProcessService.processList(issueId)); } + /** + * 议题的处理进展,(只包含发起议题、关闭议题) + * @param issueId + * @return + */ + @PostMapping("issueprocess") + public Result queryIssueProcess(@RequestBody IssueIdFormDTO issueId){ + return new Result().ok(issueProcessService.queryIssueProcess(issueId)); + } } diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueApplicationDao.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueApplicationDao.java index 33296076b6..4f2ede6325 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueApplicationDao.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueApplicationDao.java @@ -19,8 +19,10 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.IssueApplicationDTO; +import com.epmet.dto.form.AuditListFormDTO; import com.epmet.dto.form.IssueAppQueryFormDTO; import com.epmet.dto.form.UserPubAuditingIssueFormDTO; +import com.epmet.dto.result.AuditListResultDTO; import com.epmet.dto.result.IssueApplicationResDTO; import com.epmet.dto.result.UserPubAuditingIssueResDTO; import com.epmet.entity.IssueApplicationEntity; @@ -74,4 +76,28 @@ public interface IssueApplicationDao extends BaseDao { */ List selectTopicIdList(@Param("topicIdList") List topicIdList); + /** + * Desc: 待审核,驳回列表 + * @param formDTO + * @author zxc + * @date 2022/10/10 13:42 + */ + List auditList(AuditListFormDTO formDTO); + + /** + * Desc: 补全数据 + * @param + * @author zxc + * @date 2022/10/10 13:42 + */ + List initIssueApplicationHistoryData(); + + /** + * Desc: 批量更新议题审核组织信息 + * @param list + * @author zxc + * @date 2022/10/10 13:42 + */ + void updateIssueApplication(List list); + } \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueAttachmentDao.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueAttachmentDao.java new file mode 100644 index 0000000000..828bea698e --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueAttachmentDao.java @@ -0,0 +1,16 @@ +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.IssueAttachmentEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * issue库附件表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-09-30 + */ +@Mapper +public interface IssueAttachmentDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueCategoryDao.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueCategoryDao.java index 650e4ac227..42fb7ca9bf 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueCategoryDao.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueCategoryDao.java @@ -42,7 +42,7 @@ public interface IssueCategoryDao extends BaseDao { * @Description 查询议题绑定的分类名称,按排序升序 * @Author sun **/ - List selectIssueCategoryList(@Param("issueId") String issueId); + List selectIssueCategoryList(@Param("customerId")String customerId,@Param("issueId") String issueId); /** * @param formDTO diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueDao.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueDao.java index 1c5ae213ee..ce3dc28a1c 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueDao.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueDao.java @@ -308,4 +308,12 @@ public interface IssueDao extends BaseDao { */ Integer selectAuditIssue(@Param("gridId")String gridId); + /** + * 根据议题ids查询议题简要信息 + * @param issueIds + * @return + */ + List selectIssueProfile(@Param("issueIds") List issueIds); + + List allIssueList(AllIssueListFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueApplicationEntity.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueApplicationEntity.java index 8ec3f59be1..f61f5e6917 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueApplicationEntity.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueApplicationEntity.java @@ -70,6 +70,9 @@ public class IssueApplicationEntity extends BaseEpmetEntity { */ private String gridId; + private String orgId; + private String orgIdPath; + /** * 审核通过后对应的 议题id */ @@ -85,4 +88,16 @@ public class IssueApplicationEntity extends BaseEpmetEntity { */ private String approveStaffId; + private String address; + + /** + * 经度 + */ + private String longitude; + + /** + * 纬度 + */ + private String latitude; + } diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueAttachmentEntity.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueAttachmentEntity.java new file mode 100644 index 0000000000..b7016bd587 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueAttachmentEntity.java @@ -0,0 +1,82 @@ +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * issue库附件表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-09-30 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("issue_attachment") +public class IssueAttachmentEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 业务id + */ + private String businessId; + + /** + * 议题:issue + */ + private String attachTo; + + /** + * 附件名 + */ + private String name; + + /** + * 文件格式(JPG、PNG、PDF、JPEG、BMP、MP4、WMA、M4A、MP3、DOC、DOCX、XLS) + */ + private String format; + + /** + * 附件类型((图片 - image、 视频 - video、 语音 - voice、 文档 - doc)) + */ + private String type; + + /** + * 附件地址 + */ + private String url; + + /** + * 排序字段 + */ + private Integer sort; + + /** + * 附件状态(审核中:auditing; +auto_passed: 自动通过; +review:结果不确定,需要人工审核; +block: 结果违规; +rejected:人工审核驳回; +approved:人工审核通过) +现在图片是同步审核的,所以图片只有auto_passed一种状态 + */ + private String status; + + /** + * 失败原因 + */ + private String reason; + + /** + * 语音或视频时长,秒 + */ + private Integer duration; + +} diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueEntity.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueEntity.java index fa33418bc6..7f47f3cfa1 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueEntity.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueEntity.java @@ -43,7 +43,7 @@ public class IssueEntity extends BaseEpmetEntity { private String issueStatus; /** - * 来源类型 eg:resi_topic + * 来源类型 话题:resi_topic;直接立议题:issue;事件:ic_event */ private String sourceType; @@ -112,4 +112,19 @@ public class IssueEntity extends BaseEpmetEntity { */ private Date closedTime; + /** + * 地址 + */ + private String address; + + /** + * 经度 + */ + private String longitude; + + /** + * 纬度 + */ + private String latitude; + } diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/excel/AllIssueListExportExcel.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/excel/AllIssueListExportExcel.java new file mode 100644 index 0000000000..5a4a508506 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/excel/AllIssueListExportExcel.java @@ -0,0 +1,42 @@ +package com.epmet.excel; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.write.style.ColumnWidth; +import lombok.Data; + +/** + * @Author zxc + * @DateTime 2022/10/11 16:30 + * @DESC + */ +@Data +public class AllIssueListExportExcel { + + @ExcelProperty(value = "所属网格") + @ColumnWidth(20) + private String gridName; + + @ExcelProperty(value = "议题标题") + @ColumnWidth(20) + private String issueTitle; + + @ExcelProperty(value = "议题建议") + @ColumnWidth(20) + private String suggestion; + + @ExcelProperty(value = "议题创建时间") + @ColumnWidth(20) + private String createdTime; + + @ExcelProperty(value = "支持数") + @ColumnWidth(20) + private Integer supportCount; + + @ExcelProperty(value = "反对数") + @ColumnWidth(20) + private Integer oppositionCount; + + @ExcelProperty(value = "议题状态") + @ColumnWidth(20) + private String issueStatusName; +} diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/excel/AuditListExportExcel.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/excel/AuditListExportExcel.java new file mode 100644 index 0000000000..f6aac9792c --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/excel/AuditListExportExcel.java @@ -0,0 +1,34 @@ +package com.epmet.excel; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.write.style.ColumnWidth; +import lombok.Data; + +/** + * @Author zxc + * @DateTime 2022/10/11 16:45 + * @DESC + */ +@Data +public class AuditListExportExcel { + + @ExcelProperty(value = "所属网格") + @ColumnWidth(20) + private String gridName; + + @ExcelProperty(value = "议题标题") + @ColumnWidth(20) + private String issueTitle; + + @ExcelProperty(value = "议题建议") + @ColumnWidth(20) + private String suggestion; + + @ExcelProperty(value = "状态") + @ColumnWidth(20) + private String applyStatusName; + + @ExcelProperty(value = "提交审核时间") + @ColumnWidth(20) + private String applyTime; +} diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/feign/GovProjectFeignClient.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/feign/GovProjectFeignClient.java index 38331b5780..d0e29cf063 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/feign/GovProjectFeignClient.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/feign/GovProjectFeignClient.java @@ -2,11 +2,9 @@ package com.epmet.feign; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.Result; -import com.epmet.dto.form.ProcessProjectIdFormDTO; import com.epmet.dto.form.ShiftProjectFormDTO; import com.epmet.dto.form.ShiftProjectsFromDTO; import com.epmet.dto.result.IssueProjectResultDTO; -import com.epmet.dto.result.ProcessListResultDTO; import com.epmet.dto.result.ShiftProjectResultDTO; import com.epmet.feign.fallback.GovProjectFeignClientFallBack; import org.springframework.cloud.openfeign.FeignClient; @@ -43,9 +41,9 @@ public interface GovProjectFeignClient { /** * @Description 议题处理进展——已转项目 - * @param formDTO + * @param formDTO 该方法已经放到了GovProjectOpenFeignClient * @author zxc - */ + *//* @PostMapping("/gov/project/projectprocess/projectprocesslist") - Result> projectProcessList(@RequestBody ProcessProjectIdFormDTO formDTO); + Result> projectProcessList(@RequestBody ProcessProjectIdFormDTO formDTO);*/ } diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/feign/fallback/GovProjectFeignClientFallBack.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/feign/fallback/GovProjectFeignClientFallBack.java index c8185fa47e..a120f582ac 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/feign/fallback/GovProjectFeignClientFallBack.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/feign/fallback/GovProjectFeignClientFallBack.java @@ -3,11 +3,9 @@ package com.epmet.feign.fallback; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.ModuleUtils; import com.epmet.commons.tools.utils.Result; -import com.epmet.dto.form.ProcessProjectIdFormDTO; import com.epmet.dto.form.ShiftProjectFormDTO; import com.epmet.dto.form.ShiftProjectsFromDTO; import com.epmet.dto.result.IssueProjectResultDTO; -import com.epmet.dto.result.ProcessListResultDTO; import com.epmet.dto.result.ShiftProjectResultDTO; import com.epmet.feign.GovProjectFeignClient; import org.springframework.stereotype.Component; @@ -26,10 +24,11 @@ public class GovProjectFeignClientFallBack implements GovProjectFeignClient { return ModuleUtils.feignConError(ServiceConstant.GOV_PROJECT_SERVER, "getProjectByIssue", fromDTO); } - @Override + //该方法已经放到了GovProjectOpenFeignClient + /*@Override public Result> projectProcessList(ProcessProjectIdFormDTO formDTO) { return ModuleUtils.feignConError(ServiceConstant.GOV_PROJECT_SERVER, "projectProcessList", formDTO); - } + }*/ @Override public Result issueShiftProject(ShiftProjectFormDTO formDTO) { diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueApplicationService.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueApplicationService.java index aecc10b0b5..5b00541fb0 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueApplicationService.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueApplicationService.java @@ -20,8 +20,10 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; import com.epmet.dto.IssueApplicationDTO; +import com.epmet.dto.form.AuditListFormDTO; import com.epmet.dto.form.IssueAppQueryFormDTO; import com.epmet.dto.form.UserPubAuditingIssueFormDTO; +import com.epmet.dto.result.AuditListResultDTO; import com.epmet.dto.result.IssueApplicationResDTO; import com.epmet.dto.result.UserPubAuditingIssueResDTO; import com.epmet.entity.IssueApplicationEntity; @@ -32,6 +34,8 @@ import com.epmet.resi.group.dto.group.result.ApplicationDetailResultDTO; import com.epmet.resi.group.dto.group.result.ApplicationHistoryResultDTO; import com.epmet.resi.group.dto.group.result.ApplicationListResultDTO; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; import java.util.List; import java.util.Map; @@ -150,4 +154,9 @@ public interface IssueApplicationService extends BaseService notIssueToTopicIds(List topicIdList); + + PageData auditList(AuditListFormDTO formDTO); + void auditListExport(AuditListFormDTO formDTO, HttpServletResponse response) throws IOException; + + void initIssueApplicationHistoryData(); } \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueAttachmentService.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueAttachmentService.java new file mode 100644 index 0000000000..1ca53e2103 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueAttachmentService.java @@ -0,0 +1,78 @@ +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.IssueAttachmentDTO; +import com.epmet.entity.IssueAttachmentEntity; + +import java.util.List; +import java.util.Map; + +/** + * issue库附件表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-09-30 + */ +public interface IssueAttachmentService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2022-09-30 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2022-09-30 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return IssueAttachmentDTO + * @author generator + * @date 2022-09-30 + */ + IssueAttachmentDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2022-09-30 + */ + void save(IssueAttachmentDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2022-09-30 + */ + void update(IssueAttachmentDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2022-09-30 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueCategoryService.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueCategoryService.java index 5717b27db0..489470c850 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueCategoryService.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueCategoryService.java @@ -27,6 +27,7 @@ import com.epmet.dto.result.IssueCategoryTagListResultDTO; import com.epmet.dto.result.ProjectCategoryTagResultDTO; import com.epmet.entity.IssueCategoryEntity; +import java.util.Date; import java.util.List; import java.util.Map; @@ -132,4 +133,5 @@ public interface IssueCategoryService extends BaseService { **/ void saveCategory(IssueSaveCategoryFormDTO formDTO); + void delByIssueId(String issueId, String userId, Date delTime); } \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueProcessService.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueProcessService.java index b3b8a300ab..025d10baca 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueProcessService.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueProcessService.java @@ -21,6 +21,7 @@ import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; import com.epmet.dto.IssueProcessDTO; import com.epmet.dto.form.IssueIdFormDTO; +import com.epmet.dto.result.IssueAdvanceResDTO; import com.epmet.dto.result.ProcessListResultDTO; import com.epmet.entity.IssueProcessEntity; @@ -109,4 +110,11 @@ public interface IssueProcessService extends BaseService { * @date 2020.05.13 16:42 **/ int insertOne(IssueProcessDTO issueProcessDTO); + + /** + * 议题的处理进展,(只包含发起议题、关闭议题) + * @param issueId + * @return + */ + IssueAdvanceResDTO queryIssueProcess(IssueIdFormDTO issueId); } diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueService.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueService.java index 1296374261..4ccd839e72 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueService.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueService.java @@ -14,6 +14,8 @@ import com.epmet.resi.group.dto.group.result.GroupShiftProjectListResultDTO; import com.epmet.resi.group.dto.group.result.GroupVotingListResultDTO; import com.epmet.resi.group.dto.topic.form.TopicInfoFormDTO; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; import java.util.List; import java.util.Map; import java.util.Set; @@ -343,6 +345,7 @@ public interface IssueService extends BaseService { /** * 无需解决解决列表 + * 无需解决:结案选择无需解决的项目、关闭选择无需解决的议题 * @author zhaoqifeng * @date 2021/7/27 16:58 * @param fromDTO @@ -384,4 +387,43 @@ public interface IssueService extends BaseService { */ Boolean issueAuditReset(String gridId); + /** + * Desc: 创建议题【直接创建】 + * @param issueDTO + * @author zxc + * @date 2022/10/8 09:03 + */ + void createIssue(IssueDTO issueDTO); + + /** + * 根据议题ids查询议题简要信息 + * @param issueIds + * @return + */ + List getIssueProfile(List issueIds); + + /** + * Desc: 查询所有议题 + * @param formDTO + * @author zxc + * @date 2022/10/9 16:58 + */ + PageData allIssueList(AllIssueListFormDTO formDTO); + void allIssueListExport(AllIssueListFormDTO formDTO, HttpServletResponse response) throws IOException; + + /** + * 发布议题 + * 事件转议题 + * @param issueFormDTO + * @return + */ + IssueDTO publishIssue(PublishIssueFormDTO issueFormDTO); + + /** + * 删除事件时,事件转了议题,调用此方法,删除议题 + * 批量删除议题(议题如果转了项目,此方法不删除项目!) + * @param delIssueFormDTO + * @return 删除的议题中,转为了项目,返回议题id,上层再单独去删除项目 + */ + List deleteIssueInternal(DelIssueFormDTO delIssueFormDTO); } diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueTagsService.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueTagsService.java index b7970e8793..a99f1a96c7 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueTagsService.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueTagsService.java @@ -26,6 +26,7 @@ import com.epmet.dto.form.IssueTagsSaveFormDTO; import com.epmet.dto.result.AddTagResultDTO; import com.epmet.entity.IssueTagsEntity; +import java.util.Date; import java.util.List; import java.util.Map; @@ -122,4 +123,6 @@ public interface IssueTagsService extends BaseService { * @date 2020/12/10 上午9:37 */ void issueTagSave(IssueTagsSaveFormDTO form, TokenDto tokenDto); + + void delByIssueId(String issueId, String userId, Date delTime); } \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueVoteStatisticalService.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueVoteStatisticalService.java index a1aec7c5f1..d9f8c8c7dc 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueVoteStatisticalService.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueVoteStatisticalService.java @@ -28,6 +28,7 @@ import com.epmet.dto.result.EvaluationListResultDTO; import com.epmet.dto.result.MyPartIssuesResultDTO; import com.epmet.dto.result.VoteResultDTO; import com.epmet.dto.result.VotingTrendResultDTO; +import com.epmet.entity.IssueEntity; import com.epmet.entity.IssueVoteStatisticalEntity; import java.util.List; @@ -115,6 +116,7 @@ public interface IssueVoteStatisticalService extends BaseService page(Map params) { @@ -136,6 +140,8 @@ public class IssueApplicationHistoryServiceImpl extends BaseServiceImpl result = resiGroupOpenFeignClient.applicationDetail(formDTO); if (!result.success()){ throw new RenException("工作端查询待审核||已驳回 申请详情失败......"); diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueApplicationServiceImpl.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueApplicationServiceImpl.java index 074b7bcd39..7332720abd 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueApplicationServiceImpl.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueApplicationServiceImpl.java @@ -17,19 +17,39 @@ package com.epmet.service.impl; +import com.alibaba.excel.EasyExcel; +import com.alibaba.excel.ExcelWriter; +import com.alibaba.excel.write.metadata.WriteSheet; +import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.redis.common.CustomerOrgRedis; +import com.epmet.commons.tools.redis.common.CustomerStaffRedis; +import com.epmet.commons.tools.redis.common.bean.GridInfoCache; import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.DateUtils; +import com.epmet.commons.tools.utils.ExcelUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.utils.poi.excel.handler.FreezeAndFilter; import com.epmet.dao.IssueApplicationDao; import com.epmet.dto.IssueApplicationDTO; +import com.epmet.dto.form.AuditListFormDTO; import com.epmet.dto.form.IssueAppQueryFormDTO; import com.epmet.dto.form.UserPubAuditingIssueFormDTO; +import com.epmet.dto.result.AllIssueListResultDTO; +import com.epmet.dto.result.AuditListResultDTO; import com.epmet.dto.result.IssueApplicationResDTO; import com.epmet.dto.result.UserPubAuditingIssueResDTO; import com.epmet.entity.IssueApplicationEntity; +import com.epmet.excel.AllIssueListExportExcel; +import com.epmet.excel.AuditListExportExcel; import com.epmet.resi.group.dto.group.form.ApplicationDetailFormDTO; import com.epmet.resi.group.dto.group.form.ApplicationHistoryFormDTO; import com.epmet.resi.group.dto.group.form.ApplicationListFormDTO; @@ -39,13 +59,17 @@ import com.epmet.resi.group.dto.group.result.ApplicationListResultDTO; import com.epmet.service.IssueApplicationService; import com.epmet.utils.ModuleConstants; import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.Arrays; -import java.util.List; -import java.util.Map; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.io.PrintWriter; +import java.util.*; /** * 话题转议题申请表 @@ -54,6 +78,7 @@ import java.util.Map; * @since v1.0.0 2020-11-17 */ @Service +@Slf4j public class IssueApplicationServiceImpl extends BaseServiceImpl implements IssueApplicationService { @Override @@ -186,4 +211,98 @@ public class IssueApplicationServiceImpl extends BaseServiceImpl auditList(AuditListFormDTO formDTO) { + if (StringUtils.isBlank(formDTO.getOrgId())){ + CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getUserId()); + if (null == staffInfo){ + throw new EpmetException("查询工作人员信息失败:"+formDTO.getUserId()); + } + formDTO.setOrgId(staffInfo.getAgencyId()); + formDTO.setOrgType(ModuleConstants.ISSUE_PROCESS_ORG_TYPE_AGENCY); + } + PageData result = new PageData<>(new ArrayList(),NumConstant.ZERO_L); + if (formDTO.getIsPage()){ + PageInfo pageInfo = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()).doSelectPageInfo(() -> baseDao.auditList(formDTO)); + result.setList(pageInfo.getList()); + result.setTotal(Integer.valueOf(String.valueOf(pageInfo.getTotal()))); + }else { + List auditListResultDTOS = baseDao.auditList(formDTO); + result.setList(auditListResultDTOS); + result.setTotal(auditListResultDTOS.size()); + } + if (CollectionUtils.isNotEmpty(result.getList())){ + result.getList().forEach(l -> { + GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(l.getGridId()); + if(null == gridInfo){ + throw new EpmetException("查询网格信息失败:"+l.getGridId()); + } + l.setGridName(gridInfo.getGridNamePath()); + }); + } + return result; + } + + @Override + public void auditListExport(AuditListFormDTO formDTO, HttpServletResponse response) throws IOException { + ExcelWriter excelWriter = null; + formDTO.setPageNo(NumConstant.ONE); + formDTO.setPageSize(NumConstant.TEN_THOUSAND); + try { + String fileName = "议题审核列表" + DateUtils.format(new Date()) + ".xlsx"; + excelWriter = EasyExcel.write(ExcelUtils.getOutputStreamForExcel(fileName, response), AuditListExportExcel.class).build(); + WriteSheet writeSheet = EasyExcel.writerSheet("Sheet1").registerWriteHandler(new FreezeAndFilter()).build(); + List list = null; + do { + PageData data = auditList(formDTO); + list = ConvertUtils.sourceToTarget(data.getList(), AuditListExportExcel.class); + formDTO.setPageNo(formDTO.getPageNo() + NumConstant.ONE); + excelWriter.write(list, writeSheet); + } while (CollectionUtils.isNotEmpty(list) && list.size() == formDTO.getPageSize()); + } catch (EpmetException e) { + response.reset(); + response.setCharacterEncoding("UTF-8"); + response.setHeader("content-type", "application/json; charset=UTF-8"); + PrintWriter printWriter = response.getWriter(); + Result result = new Result<>().error(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),e.getMsg()); + printWriter.write(JSON.toJSONString(result)); + printWriter.close(); + } catch (Exception e) { + log.error("export exception", e); + } finally { + if (excelWriter != null) { + excelWriter.finish(); + } + } + } + + @Override + public void initIssueApplicationHistoryData() { + Integer no = NumConstant.ONE; + Integer size; + do { + PageInfo pageInfo = PageHelper.startPage(no, NumConstant.ONE_HUNDRED).doSelectPageInfo(() -> baseDao.initIssueApplicationHistoryData()); + List list = pageInfo.getList(); + size = list.size(); + if (CollectionUtils.isNotEmpty(list)){ + for (IssueApplicationDTO l : list) { + GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(l.getGridId()); + if (null == gridInfo){ + log.warn("查询网格信息失败:"+l.getGridId()); + continue; + } + l.setOrgId(gridInfo.getPid()); + l.setOrgIdPath(gridInfo.getPids()); + } + updateIssueApplication(list); + } + no++; + }while (size.compareTo(NumConstant.ONE_HUNDRED) == NumConstant.ZERO); + } + + @Transactional(rollbackFor = Exception.class) + public void updateIssueApplication(List list){ + baseDao.updateIssueApplication(list); + } + } diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueAttachmentServiceImpl.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueAttachmentServiceImpl.java new file mode 100644 index 0000000000..e9d0c69b54 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueAttachmentServiceImpl.java @@ -0,0 +1,82 @@ +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.dao.IssueAttachmentDao; +import com.epmet.dto.IssueAttachmentDTO; +import com.epmet.entity.IssueAttachmentEntity; +import com.epmet.service.IssueAttachmentService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * issue库附件表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-09-30 + */ +@Service +public class IssueAttachmentServiceImpl extends BaseServiceImpl implements IssueAttachmentService { + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, IssueAttachmentDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, IssueAttachmentDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public IssueAttachmentDTO get(String id) { + IssueAttachmentEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, IssueAttachmentDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(IssueAttachmentDTO dto) { + IssueAttachmentEntity entity = ConvertUtils.sourceToTarget(dto, IssueAttachmentEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(IssueAttachmentDTO dto) { + IssueAttachmentEntity entity = ConvertUtils.sourceToTarget(dto, IssueAttachmentEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueCategoryServiceImpl.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueCategoryServiceImpl.java index c86e5d926d..2fda58fd28 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueCategoryServiceImpl.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueCategoryServiceImpl.java @@ -18,6 +18,7 @@ package com.epmet.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.FieldConstant; @@ -44,10 +45,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.stream.Collectors; /** @@ -130,7 +128,7 @@ public class IssueCategoryServiceImpl extends BaseServiceImpl categoryList = baseDao.selectIssueCategoryList(formDTO.getIssueId()); + List categoryList = baseDao.selectIssueCategoryList(formDTO.getCustomerId(),formDTO.getIssueId()); if (categoryList.size() > NumConstant.ZERO) { resultDTO.setCategoryList(categoryList); } @@ -224,4 +222,13 @@ public class IssueCategoryServiceImpl extends BaseServiceImpl wrapper = new LambdaUpdateWrapper(); + wrapper.eq(IssueCategoryEntity::getIssueId, issueId) + .set(IssueCategoryEntity::getUpdatedTime, delTime) + .set(IssueCategoryEntity::getUpdatedBy, userId) + .set(IssueCategoryEntity::getDelFlag, NumConstant.ONE_STR); + baseDao.update(null, wrapper); + } } \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueProcessServiceImpl.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueProcessServiceImpl.java index 5e47cc5a4a..b53f885c0f 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueProcessServiceImpl.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueProcessServiceImpl.java @@ -21,6 +21,8 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; @@ -32,9 +34,12 @@ import com.epmet.dto.IssueDTO; import com.epmet.dto.IssueProcessDTO; import com.epmet.dto.form.IssueIdFormDTO; import com.epmet.dto.form.ProcessProjectIdFormDTO; +import com.epmet.dto.result.IssueAdvanceResDTO; import com.epmet.dto.result.ProcessListResultDTO; +import com.epmet.dto.result.ProcessListResultDTOBak; +import com.epmet.dto.result.ProjectProcessListResultDTO; import com.epmet.entity.IssueProcessEntity; -import com.epmet.feign.GovProjectFeignClient; +import com.epmet.feign.GovProjectOpenFeignClient; import com.epmet.service.IssueProcessService; import com.epmet.service.IssueService; import org.apache.commons.lang3.StringUtils; @@ -60,11 +65,11 @@ public class IssueProcessServiceImpl extends BaseServiceImpl page(Map params) { @@ -140,33 +145,61 @@ public class IssueProcessServiceImpl extends BaseServiceImpl processList(IssueIdFormDTO issueId) { List listResult = new ArrayList(); IssueDTO issueDTO = issueService.get(issueId.getIssueId()); + if(null==issueDTO){ + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"议题不存在","议题不存在"); + } String issueStatus = issueDTO.getIssueStatus(); if (issueStatus.equals(IssueConstant.ISSUE_CLOSED)){ //已关闭——处理进展 listResult = baseDao.issueProcess(issueId); + return listResult; }else if (issueStatus.equals(IssueConstant.ISSUE_SHIFT_PROJECT)){ //已转项目——处理进展 String projectId = issueProjectRelationDao.selectProjectIdByIssueId(issueId.getIssueId()); if (!StringUtils.isBlank(projectId)) { ProcessProjectIdFormDTO formDTO = new ProcessProjectIdFormDTO(); formDTO.setProjectId(projectId); - Result> resultDTO = govProjectFeignClient.projectProcessList(formDTO); + Result> resultDTO = govProjectOpenFeignClient.projectProcessList(formDTO); if (!resultDTO.success()){ throw new RenException(IssueConstant.PROJECT_PROCESS_LIST_FAILURE); } if (!CollectionUtils.isEmpty(resultDTO.getData())){ - listResult = resultDTO.getData(); - } - //转议题信息 - ProcessListResultDTO issueProcessResultDTO = issueProcessDao.issueBeginInfo(issueId); - if (null != issueProcessResultDTO) { - listResult.add(issueProcessResultDTO); + listResult.addAll(ConvertUtils.sourceToTarget(resultDTO.getData(),ProcessListResultDTO.class)); } } - }else { - return new ArrayList<>(); + } + //转议题信息 + ProcessListResultDTO issueProcessResultDTO = issueProcessDao.issueBeginInfo(issueId); + if (null != issueProcessResultDTO) { + listResult.add(issueProcessResultDTO); } return listResult; } + /** + * 议题处理进展(只包含发起议题、关闭议题) + * + * @param issueId + * @return + */ + @Override + public IssueAdvanceResDTO queryIssueProcess(IssueIdFormDTO issueId) { + IssueDTO issueDTO = issueService.get(issueId.getIssueId()); + List processList=new ArrayList<>(); + if (issueDTO.getIssueStatus().equals(IssueConstant.ISSUE_CLOSED)){ + //已关闭——处理进展 + processList = baseDao.issueProcess(issueId); + }else{ + //转议题信息 + ProcessListResultDTO issueProcessResultDTO = issueProcessDao.issueBeginInfo(issueId); + if (null != issueProcessResultDTO) { + processList.add(issueProcessResultDTO); + } + } + IssueAdvanceResDTO issueAdvanceResDTO=new IssueAdvanceResDTO(); + issueAdvanceResDTO.setIssueId(issueDTO.getId()); + issueAdvanceResDTO.setIssueStatus(issueDTO.getIssueStatus()); + issueAdvanceResDTO.setProcessList(ConvertUtils.sourceToTarget(processList, ProcessListResultDTOBak.class)); + return issueAdvanceResDTO; + } } diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueSatisfactionDetailServiceImpl.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueSatisfactionDetailServiceImpl.java index 99cc85eecf..2ae8d5e288 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueSatisfactionDetailServiceImpl.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueSatisfactionDetailServiceImpl.java @@ -178,10 +178,9 @@ public class IssueSatisfactionDetailServiceImpl extends BaseServiceImpl imp private IssueVoteDetailService issueVoteDetailService; @Autowired private DistributedLock distributedLock; + @Autowired + private IssueAttachmentService issueAttachmentService; @Value("${openapi.scan.server.url}") private String scanApiUrl; @Value("${openapi.scan.method.textSyncScan}") private String textSyncScanMethod; + @Value("${openapi.scan.method.imgSyncScan}") + private String imgSyncScanMethod; @Override public PageData page(Map params) { @@ -209,13 +228,8 @@ public class IssueServiceImpl extends BaseServiceImpl imp //议题信息 IssueResultDTO issueResult = issueDao.issueDetail(issueDetail); if (null != issueResult && StringUtils.isNotBlank(issueResult.getGridId())) { - BelongGridNameFormDTO formDTO = new BelongGridNameFormDTO(); - formDTO.setGridId(issueResult.getGridId()); - Result result = govOrgOpenFeignClient.getGridNameByGridId(formDTO); - logger.info("根据网格id查询网格名称接口返参:" + JSON.toJSONString(result)); - if (result.success() && null != result.getData()) { - issueResult.setGridName(result.getData().getBelongsGridName()); - } + GridInfoCache gridInfoCache = CustomerOrgRedis.getGridInfo(issueResult.getGridId()); + issueResult.setGridName(null != gridInfoCache ? gridInfoCache.getGridNamePath() : StrConstant.EPMETY_STR); } return issueResult; } @@ -376,8 +390,11 @@ public class IssueServiceImpl extends BaseServiceImpl imp result.setAuditSwitch(ifOpen ? ModuleConstants.AUDIT_SWITCH_OPEN : ModuleConstants.AUDIT_SWITCH_CLOSE); //2.居民端组长提交议题审核 - - //默认打开 + GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(param.getGridId()); + if (null == gridInfo){ + throw new EpmetException("查询网格信息失败:"+param.getGridId()); + } + //默认打开 //2.1查询是否存在application记录 Map applicationParam = new HashMap<>(); applicationParam.put(ModuleConstants.FIELD_JAVA_TOPIC_ID, param.getTopicId()); @@ -390,6 +407,8 @@ public class IssueServiceImpl extends BaseServiceImpl imp if(ifOpen) { //首次提交 新增application IssueApplicationDTO newApplication = ConvertUtils.sourceToTarget(param, IssueApplicationDTO.class); + newApplication.setOrgId(gridInfo.getPid()); + newApplication.setOrgIdPath(gridInfo.getPids()); newApplication.setApplyStatus(defaultStatusUnderAuditing); newApplication.setId(UUID.randomUUID().toString().replace("-", "")); applicationService.save(newApplication); @@ -558,8 +577,6 @@ public class IssueServiceImpl extends BaseServiceImpl imp app2update.setIssueId(issueResult.getIssueId()); } - }else { - throw new RenException(topicInfo.getInternalMsg()); } @@ -591,7 +608,7 @@ public class IssueServiceImpl extends BaseServiceImpl imp boolean flag = SendMqMsgUtil.build().openFeignClient(epmetMessageOpenFeignClient) .sendGroupAchievementMqMsg(new GroupAchievementMQMsg(application.getCustomerId(), application.getGroupId(), AchievementTypeEnum.TOISSUE.getCode())); if (!flag) { - logger.error("发送(小组成就)系统消息到message服务失败"); + logger.warn("发送(小组成就)系统消息到message服务失败"); } return app2update.getIssueId(); } @@ -606,7 +623,8 @@ public class IssueServiceImpl extends BaseServiceImpl imp @Override public List votingList(CommonIssueListFormDTO issueListForm) { PageHelper.startPage(issueListForm.getPageNo(), issueListForm.getPageSize(), issueListForm.getIsPage()); - return baseDao.selectVotingList(issueListForm); + List resultList=baseDao.selectVotingList(issueListForm); + return resultList; } /** @@ -619,7 +637,8 @@ public class IssueServiceImpl extends BaseServiceImpl imp @Override public List closedList(CommonIssueListFormDTO issueListForm) { PageHelper.startPage(issueListForm.getPageNo(), issueListForm.getPageSize(), issueListForm.getIsPage()); - return baseDao.selectClosedList(issueListForm); + List resultDTOList=baseDao.selectClosedList(issueListForm); + return resultDTOList; } /** @@ -633,7 +652,11 @@ public class IssueServiceImpl extends BaseServiceImpl imp public GovIssueDetailResultDTO issueDetailGov(IssueDetailFormDTO issueParam) { //1.得到议题信息 IssueEntity issueDetail = selectById(issueParam.getIssueId()); - + GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(issueDetail.getGridId()); + if(null == gridInfo){ + throw new EpmetException("查询网格信息失败"+issueDetail.getGridId()); + } + GovIssueDetailResultDTO issueInfo = new GovIssueDetailResultDTO(); //2.1如果此条议题来源自话题 if(StringUtils.equals(ModuleConstants.ISSUE_FROM_TOPIC,issueDetail.getSourceType())){ GovTopicIssueInfoFormDTO topicParam = new GovTopicIssueInfoFormDTO(); @@ -645,10 +668,11 @@ public class IssueServiceImpl extends BaseServiceImpl imp resiGroupFeignClient.topicInfoForIssueDetailGov(topicParam); if(topicResult.success() && null != topicResult.getData()){ GovTopicOfIssueInfoResultDTO topicInfo = ConvertUtils.sourceToTarget(topicResult.getData(),GovTopicOfIssueInfoResultDTO.class); - GovIssueDetailResultDTO issueInfo = ConvertUtils.sourceToTarget(topicResult.getData(),GovIssueDetailResultDTO.class); + issueInfo = ConvertUtils.sourceToTarget(topicResult.getData(),GovIssueDetailResultDTO.class); issueInfo.setIssueStatus(issueDetail.getIssueStatus()); issueInfo.setIssueSuggestion(issueDetail.getSuggestion()); issueInfo.setIssueTitle(issueDetail.getIssueTitle()); + issueInfo.setSourceId(issueDetail.getSourceId()); issueInfo.setVotingDeadline(null == issueDetail.getVotingDeadline() ? NumConstant.ZERO_L : issueDetail.getVotingDeadline().getTime()/NumConstant.ONE_THOUSAND); issueInfo.setTopicInfo(topicInfo); @@ -660,6 +684,29 @@ public class IssueServiceImpl extends BaseServiceImpl imp return issueInfo; } //查询话题失败异常 + }else if (ModuleConstants.ISSUE.equals(issueDetail.getSourceType())){ + issueInfo = ConvertUtils.sourceToTarget(issueDetail,GovIssueDetailResultDTO.class); + issueInfo.setIssueSuggestion(issueDetail.getSuggestion()); + Result> userResult = userOpenFeignClient.queryUserBaseInfo(Arrays.asList(issueDetail.getCreatedBy())); + if (!userResult.success() || CollectionUtils.isEmpty(userResult.getData())){ + throw new EpmetException("查询居民信息失败"); + } + UserBaseInfoResultDTO user = userResult.getData().get(NumConstant.ZERO); + issueInfo.setIssueInitiator(user.getShowName()); + issueInfo.setIssuePublisherMobile(user.getMobile()); + issueInfo.setBelongsGridName(gridInfo.getGridNamePath()); + return issueInfo; + }else { + issueInfo = ConvertUtils.sourceToTarget(issueDetail,GovIssueDetailResultDTO.class); + issueInfo.setIssueSuggestion(issueDetail.getSuggestion()); + CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(issueDetail.getCustomerId(), issueDetail.getCreatedBy()); + if (null == staffInfo){ + throw new EpmetException("查询工作人员信息失败:"+issueDetail.getCreatedBy()); + } + issueInfo.setIssueInitiator(staffInfo.getRealName()); + issueInfo.setIssuePublisherMobile(staffInfo.getMobile()); + issueInfo.setBelongsGridName(gridInfo.getGridNamePath()); + return issueInfo; } return null; @@ -675,50 +722,37 @@ public class IssueServiceImpl extends BaseServiceImpl imp @Transactional(rollbackFor = Exception.class) public void closeIssue(CloseIssueFormDTO formDTO) { //公开回复内容审核 - if (StringUtils.isNotBlank(formDTO.getCloseReason())) { - TextScanParamDTO textScanParamDTO = new TextScanParamDTO(); - TextTaskDTO taskDTO = new TextTaskDTO(); - taskDTO.setDataId(UUID.randomUUID().toString().replace("-", "")); - taskDTO.setContent(formDTO.getCloseReason()); - textScanParamDTO.getTasks().add(taskDTO); - Result textSyncScanResult = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO); - if (!textSyncScanResult.success()){ - throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); - } else { - if (!textSyncScanResult.getData().isAllPass()) { - throw new RenException(EpmetErrorCode.TEXT_SCAN_FAILED.getCode()); - } - } - } + checkCloseReason(formDTO.getCloseReason()); - Date date = new Date(); + Date nowTime = new Date(); //1:更新议题详情表数据 IssueEntity entity = baseDao.selectById(formDTO.getIssueId()); if (null == entity) { - throw new RenException(IssueConstant.SELECT_EXCEPTION); + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),IssueConstant.SELECT_EXCEPTION,"议题不存在"); } if (IssueConstant.ISSUE_CLOSED.equals(entity.getIssueStatus())) { - throw new RenException(IssueConstant.OPERATION_EXCEPTION); + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),IssueConstant.OPERATION_EXCEPTION,"议题不存在"); } entity.setIssueStatus(IssueConstant.ISSUE_CLOSED); entity.setCloseReason(formDTO.getCloseReason()); entity.setResolveType(formDTO.getResolveType()); - entity.setVotingDeadline(date); - entity.setClosedTime(date); + entity.setVotingDeadline(nowTime); + entity.setClosedTime(nowTime); if (baseDao.updateById(entity) < NumConstant.ONE) { throw new RenException(IssueConstant.UPPDATE_EXCEPTION); } //2:调用gov-org服务,查询组织网格名称 - AgencyGridResultDTO agencyGridResultDTO = new AgencyGridResultDTO(); + /*AgencyGridResultDTO agencyGridResultDTO = new AgencyGridResultDTO(); agencyGridResultDTO.setAgencyId(entity.getOrgId()); agencyGridResultDTO.setGridId(entity.getGridId()); Result resultDTO = govOrgFeignClient.getAgencyAndGrid(agencyGridResultDTO); if (!resultDTO.success() || null == resultDTO.getData()) { throw new RenException(IssueConstant.SELECT_GOV_ORG_EXCEPTION); } - agencyGridResultDTO = resultDTO.getData(); - + agencyGridResultDTO = resultDTO.getData();*/ + //上面代码注释,改用缓存 + GridInfoCache gridInfoCache=CustomerOrgRedis.getGridInfo(entity.getGridId()); //3:议题进展记录表新增数据 IssueProcessEntity processEntity = new IssueProcessEntity(); processEntity.setIssueId(formDTO.getIssueId()); @@ -726,30 +760,28 @@ public class IssueServiceImpl extends BaseServiceImpl imp processEntity.setOrgType(IssueConstant.ISSUE_GRID); processEntity.setOrgId(entity.getGridId()); processEntity.setOperationExplain(formDTO.getCloseReason()); - processEntity.setOrgName(agencyGridResultDTO.getAgencyName() + "-" + agencyGridResultDTO.getGridName()); + // processEntity.setOrgName(agencyGridResultDTO.getAgencyName() + "-" + agencyGridResultDTO.getGridName()); + processEntity.setOrgName(gridInfoCache.getGridNamePath()); + processEntity.setCreatedTime(nowTime); + processEntity.setUpdatedTime(nowTime); + processEntity.setCustomerId(entity.getCustomerId()); issueProcessDao.insert(processEntity); //4:调用epmet-message服务,给居民端话题创建人和议题发起人发送消息 - //4.1:调用resi-group查询话题创建人数据(目前议题来源只有来自话题) - Result resultTopicDTO = resiGroupFeignClient.getTopicById(entity.getSourceId()); - if (!resultTopicDTO.success() || null == resultTopicDTO.getData()) { - throw new RenException(IssueConstant.SELECT_TOPIC_EXCEPTION); - } - ResiTopicDTO topicDTO = resultTopicDTO.getData(); - //4.2:创建消息模板 - String messageContent = ""; - if (IssueConstant.ISSUE_RESOLVED.equals(formDTO.getResolveType())) { - messageContent = String.format(UserMessageConstant.ISSUE_RESOLVED_MSG, topicDTO.getTopicContent(), formDTO.getCloseReason()); - } else if (IssueConstant.ISSUE_UNRESOLVED.equals(formDTO.getResolveType())) { - messageContent = String.format(UserMessageConstant.ISSUE_UNRESOLVED_MSG, topicDTO.getTopicContent(), formDTO.getCloseReason()); - } - //4.3:调用服务,发送消息 - if (!saveUserMessageList(topicDTO, messageContent, entity).success()) { - throw new RenException(IssueConstant.SAVE_MSG_EXCEPTION); - } - //4.4:2020.10.26 添加推送微信订阅消息功能 sun - if (!saveWxmpMessageList(topicDTO, messageContent, entity).success()) { - logger.error("议题关闭,推送微信订阅消息失败!"); + if (entity.getSourceType().equals(ModuleConstants.ISSUE_FROM_TOPIC)){ + //4.1:调用resi-group查询话题创建人数据(目前议题来源只有来自话题) + sendToTopicAndShiftIssueResiUser(entity.getSourceId(),formDTO.getResolveType(),entity,formDTO.getCloseReason()); + }else if(entity.getSourceType().equals("ic_event")){ + ColseProjectOrDemandFormDTO colseProjectOrDemandFormDTO=new ColseProjectOrDemandFormDTO(); + colseProjectOrDemandFormDTO.setCustomerId(entity.getCustomerId()); + colseProjectOrDemandFormDTO.setIcEventId(entity.getSourceId()); + colseProjectOrDemandFormDTO.setType("issue"); + colseProjectOrDemandFormDTO.setUserId(formDTO.getCurrentUserId()); + colseProjectOrDemandFormDTO.setCloseCaseTime(nowTime); + Result result = govProjectOpenFeignClient.closeProjectOrDemand(colseProjectOrDemandFormDTO); + if (!result.success()) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"议题关闭异常,该议题来源于事件,回写事件信息失败","议题关闭异常:事件办结异常"); + } } try { @@ -757,12 +789,57 @@ public class IssueServiceImpl extends BaseServiceImpl imp SelectIssueVotingDetailFormDTO dto = new SelectIssueVotingDetailFormDTO(); dto.setGridId(entity.getGridId()); dto.setIssueId(formDTO.getIssueId()); + dto.setSourceType(entity.getSourceType()); issueVoteDetailService.updateVote(dto); }catch (RenException e){ logger.error(e.getInternalMsg()); } } + /** + * 议题关闭时,填写的关闭理由,走内容审核 + * @param closeReason + */ + private void checkCloseReason(String closeReason) { + if (StringUtils.isNotBlank(closeReason)) { + TextScanParamDTO textScanParamDTO = new TextScanParamDTO(); + TextTaskDTO taskDTO = new TextTaskDTO(); + taskDTO.setDataId(UUID.randomUUID().toString().replace("-", "")); + taskDTO.setContent(closeReason); + textScanParamDTO.getTasks().add(taskDTO); + Result textSyncScanResult = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO); + if (!textSyncScanResult.success()) { + throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); + } else { + if (!textSyncScanResult.getData().isAllPass()) { + throw new RenException(EpmetErrorCode.TEXT_SCAN_FAILED.getCode()); + } + } + } + } + + private void sendToTopicAndShiftIssueResiUser(String topicId,String resolveType,IssueEntity issueEntity,String closeReason) { + Result resultTopicDTO = resiGroupFeignClient.getTopicById(topicId); + if (resultTopicDTO.success() &&null != resultTopicDTO.getData()) { + ResiTopicDTO topicDTO = resultTopicDTO.getData(); + //4.2:创建消息模板 + String messageContent = ""; + if (IssueConstant.ISSUE_RESOLVED.equals(resolveType)) { + messageContent = String.format(UserMessageConstant.ISSUE_RESOLVED_MSG, topicDTO.getTopicContent(), closeReason); + } else if (IssueConstant.ISSUE_UNRESOLVED.equals(resolveType)) { + messageContent = String.format(UserMessageConstant.ISSUE_UNRESOLVED_MSG, topicDTO.getTopicContent(), closeReason); + } + //4.3:调用服务,发送消息 + if (!saveUserMessageList(topicDTO, messageContent, issueEntity).success()) { + throw new RenException(IssueConstant.SAVE_MSG_EXCEPTION); + } + //4.4:2020.10.26 添加推送微信订阅消息功能 sun + if (!saveWxmpMessageList(topicDTO, messageContent, issueEntity).success()) { + logger.warn("议题关闭,推送微信订阅消息失败!"); + } + } + } + /** * @Description 关闭议题时给话题创建人和议题发起人发送消息 * @author sun @@ -938,7 +1015,7 @@ public class IssueServiceImpl extends BaseServiceImpl imp } try{ - issueVoteStatisticalService.syncVotingCacheToDbByParams(formDTO.getIssueId(),entity.getGridId(),null); + issueVoteStatisticalService.syncVotingCacheToDbByParams(entity,null); }catch(RenException e){ logger.error(e.getInternalMsg()); } @@ -1005,18 +1082,21 @@ public class IssueServiceImpl extends BaseServiceImpl imp //因需要保证议题表中的转项目时间与创建项目时间一致 因此先新增项目数据再更新议题数据 //2:调用resi-group查询话题创建人数据(目前议题来源只有来自话题),为了到项目服务初始数据以及发送消息使用 - Result resultTopicDTO = resiGroupFeignClient.getTopicById(entity.getSourceId()); - if (!resultTopicDTO.success() || null == resultTopicDTO.getData()) { - throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),IssueConstant.SELECT_TOPIC_EXCEPTION,IssueConstant.SELECT_TOPIC_EXCEPTION); + if("resi_topic".equals(entity.getSourceType())){ + Result resultTopicDTO = resiGroupFeignClient.getTopicById(entity.getSourceId()); + if (!resultTopicDTO.success() || null == resultTopicDTO.getData()) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),IssueConstant.SELECT_TOPIC_EXCEPTION,IssueConstant.SELECT_TOPIC_EXCEPTION); + } + ResiTopicDTO topicDTO = resultTopicDTO.getData(); + formDTO.setTopicDTO(topicDTO); } - ResiTopicDTO topicDTO = resultTopicDTO.getData(); - formDTO.setTopicDTO(topicDTO); //3:调用gov-project服务,新增项目各业务表初始数据 formDTO.setCategoryList(categoryList); formDTO.setGridId(entity.getGridId()); List tagList = issueTagsService.getTagsByIssue(formDTO.getIssueId()); formDTO.setTagList(tagList); + // 议题转项目!!!!!!!!!!!!在这步 Result resultDTO = govProjectFeignClient.issueShiftProject(formDTO); if (!resultDTO.success() || null == resultDTO.getData()) { logger.error(resultDTO.getInternalMsg()); @@ -1065,9 +1145,9 @@ public class IssueServiceImpl extends BaseServiceImpl imp //6:缓存中网格下表决中的议题总数减1 govIssueRedis.subtractWorkGrassrootsIssueRedDotValue(entity.getGridId()); try{ - issueVoteStatisticalService.syncVotingCacheToDbByParams(formDTO.getIssueId(),entity.getGridId(),null); + issueVoteStatisticalService.syncVotingCacheToDbByParams(entity,null); }catch(RenException e){ - logger.error(e.getInternalMsg()); + logger.error("subtractWorkGrassrootsIssueRedDotValue报错:"+e.getInternalMsg()); } @@ -1104,32 +1184,50 @@ public class IssueServiceImpl extends BaseServiceImpl imp List msgList = new ArrayList<>(); //1:创建话题发起人、议题发表人消息对象 - UserMessageFormDTO msgDTO = new UserMessageFormDTO(); - msgDTO.setCustomerId(entity.getCustomerId()); - msgDTO.setGridId(entity.getGridId()); - msgDTO.setApp(AppClientConstant.APP_RESI); - msgDTO.setTitle(UserMessageConstant.ISSUE_TITLE); - String topicIssueMessage = String.format(UserMessageConstant.ISSUE_SHIFT_PROJECT_MSG, formDTO.getTopicDTO().getTopicContent(), issueProjectResultDTO.getOrgName()); - msgDTO.setMessageContent(topicIssueMessage); - msgDTO.setReadFlag(ReadFlagConstant.UN_READ); - msgDTO.setUserId(formDTO.getTopicDTO().getCreatedBy()); + if ("resi_topic".equals(entity.getSourceType()) && null != formDTO.getTopicDTO()) { + UserMessageFormDTO msgDTO = new UserMessageFormDTO(); + msgDTO.setCustomerId(entity.getCustomerId()); + msgDTO.setGridId(entity.getGridId()); + msgDTO.setApp(AppClientConstant.APP_RESI); + msgDTO.setTitle(UserMessageConstant.ISSUE_TITLE); + String topicIssueMessage = String.format(UserMessageConstant.ISSUE_SHIFT_PROJECT_MSG, formDTO.getTopicDTO().getTopicContent(), issueProjectResultDTO.getOrgName()); + msgDTO.setMessageContent(topicIssueMessage); + msgDTO.setReadFlag(ReadFlagConstant.UN_READ); + msgDTO.setUserId(formDTO.getTopicDTO().getCreatedBy()); - //21.09.10:记录消息类型和对应的业务id - msgDTO.setMessageType(UserMessageTypeConstant.ISSUE_SHIFT_PROJECT); - msgDTO.setTargetId(entity.getId()); + //21.09.10:记录消息类型和对应的业务id + msgDTO.setMessageType(UserMessageTypeConstant.ISSUE_SHIFT_PROJECT); + msgDTO.setTargetId(entity.getId()); - msgList.add(msgDTO); - //话题人和议题人是同一个人时则只发送一条居民消息 - if (!formDTO.getTopicDTO().getCreatedBy().equals(entity.getCreatedBy())) { - UserMessageFormDTO msgIssue = ConvertUtils.sourceToTarget(msgDTO, UserMessageFormDTO.class); - msgIssue.setUserId(entity.getCreatedBy()); + msgList.add(msgDTO); - //21.09.10:记录消息类型和对应的业务id - msgIssue.setMessageType(UserMessageTypeConstant.ISSUE_SHIFT_PROJECT); - msgIssue.setTargetId(entity.getId()); + //话题人和议题人是同一个人时则只发送一条居民消息 + if (!formDTO.getTopicDTO().getCreatedBy().equals(entity.getCreatedBy())) { + UserMessageFormDTO msgIssue = ConvertUtils.sourceToTarget(msgDTO, UserMessageFormDTO.class); + msgIssue.setUserId(entity.getCreatedBy()); - msgList.add(msgIssue); + //21.09.10:记录消息类型和对应的业务id + msgIssue.setMessageType(UserMessageTypeConstant.ISSUE_SHIFT_PROJECT); + msgIssue.setTargetId(entity.getId()); + + msgList.add(msgIssue); + } + }else{ + //居民端发布的议题,只给议题发布人发送消息 + UserMessageFormDTO msgDTO = new UserMessageFormDTO(); + msgDTO.setCustomerId(entity.getCustomerId()); + msgDTO.setGridId(entity.getGridId()); + msgDTO.setApp(AppClientConstant.APP_RESI); + msgDTO.setTitle(UserMessageConstant.ISSUE_TITLE); + String issueMessage = String.format(UserMessageConstant.PUB_ISSUE_SHIFT_PROJECT_MSG, entity.getIssueTitle(), issueProjectResultDTO.getOrgName()); + msgDTO.setMessageContent(issueMessage); + msgDTO.setReadFlag(ReadFlagConstant.UN_READ); + msgDTO.setUserId(entity.getCreatedBy()); + msgDTO.setMessageType(UserMessageTypeConstant.ISSUE_SHIFT_PROJECT); + msgDTO.setTargetId(entity.getId()); + msgList.add(msgDTO); } + //2:创建项目工作人员消息对象 String projectStaffMessage = String.format(UserMessageConstant.PROJECT_RESOLVED_MSG, entity.getIssueTitle()); //所选人员如果即在部门下又在网格下则只发一条消息 @@ -1161,20 +1259,34 @@ public class IssueServiceImpl extends BaseServiceImpl imp */ private Result wxmpShiftProjectMessage(IssueProjectResultDTO issueProjectResultDTO, ShiftProjectFormDTO formDTO, IssueEntity entity) { List msgList = new ArrayList<>(); - //1:创建话题发起人、议题发表人消息对象 - WxSubscribeMessageFormDTO msgDTO = new WxSubscribeMessageFormDTO(); - msgDTO.setCustomerId(entity.getCustomerId()); - msgDTO.setClientType(AppClientConstant.APP_RESI); - msgDTO.setUserId(formDTO.getTopicDTO().getCreatedBy()); - msgDTO.setBehaviorType(UserMessageConstant.WXMP_ISSUE_TITLE); - String topicIssueMessage = String.format(UserMessageConstant.ISSUE_SHIFT_PROJECT_MSG, formDTO.getTopicDTO().getTopicContent(), issueProjectResultDTO.getOrgName()); - msgDTO.setMessageContent(topicIssueMessage); - msgDTO.setMessageTime(new Date()); - msgDTO.setGridId(entity.getGridId()); - msgList.add(msgDTO); - //话题人和议题人是同一个人时则只发送一条居民消息 - if (!formDTO.getTopicDTO().getCreatedBy().equals(entity.getCreatedBy())) { - WxSubscribeMessageFormDTO msgIssue = ConvertUtils.sourceToTarget(msgDTO, WxSubscribeMessageFormDTO.class); + if ("resi_topic".equals(entity.getSourceType()) && null != formDTO.getTopicDTO()) { + //1:创建话题发起人、议题发表人消息对象 + WxSubscribeMessageFormDTO msgDTO = new WxSubscribeMessageFormDTO(); + msgDTO.setCustomerId(entity.getCustomerId()); + msgDTO.setClientType(AppClientConstant.APP_RESI); + msgDTO.setUserId(formDTO.getTopicDTO().getCreatedBy()); + msgDTO.setBehaviorType(UserMessageConstant.WXMP_ISSUE_TITLE); + String topicIssueMessage = String.format(UserMessageConstant.ISSUE_SHIFT_PROJECT_MSG, formDTO.getTopicDTO().getTopicContent(), issueProjectResultDTO.getOrgName()); + msgDTO.setMessageContent(topicIssueMessage); + msgDTO.setMessageTime(new Date()); + msgDTO.setGridId(entity.getGridId()); + msgList.add(msgDTO); + //话题人和议题人是同一个人时则只发送一条居民消息 + if (!formDTO.getTopicDTO().getCreatedBy().equals(entity.getCreatedBy())) { + WxSubscribeMessageFormDTO msgIssue = ConvertUtils.sourceToTarget(msgDTO, WxSubscribeMessageFormDTO.class); + msgIssue.setUserId(entity.getCreatedBy()); + msgList.add(msgIssue); + } + }else{ + //只给议题发布人发送微信消息 + WxSubscribeMessageFormDTO msgIssue = new WxSubscribeMessageFormDTO(); + msgIssue.setCustomerId(entity.getCustomerId()); + msgIssue.setClientType(AppClientConstant.APP_RESI); + msgIssue.setBehaviorType(UserMessageConstant.WXMP_ISSUE_TITLE); + String topicIssueMessage = String.format(UserMessageConstant.PUB_ISSUE_SHIFT_PROJECT_MSG, entity.getIssueTitle(), issueProjectResultDTO.getOrgName()); + msgIssue.setMessageContent(topicIssueMessage); + msgIssue.setMessageTime(new Date()); + msgIssue.setGridId(entity.getGridId()); msgIssue.setUserId(entity.getCreatedBy()); msgList.add(msgIssue); } @@ -1342,11 +1454,11 @@ public class IssueServiceImpl extends BaseServiceImpl imp throw new RenException("查询议题来源网格名称失败......"); } list.forEach(l -> gridNameList.getData().stream().filter(o -> l.getGridId().equals(o.getGridId())).forEach(o -> l.setTopicReleaseGridName(o.getGridName()))); - Result> groupNameList = resiGroupOpenFeignClient.selectGroupInfo(new GroupInfoFormDTO(list.stream().map(m -> m.getTopicId()).collect(Collectors.toList()))); + Result> groupNameList = resiGroupOpenFeignClient.selectGroupInfo(new GroupInfoFormDTO(list.stream().filter(l -> l.getSourceType().equals(ModuleConstants.ISSUE_FROM_TOPIC)).map(m -> m.getTopicId()).collect(Collectors.toList()))); if (!groupNameList.success()){ throw new RenException("查询议题来源小组名称失败......"); } - list.forEach(l -> groupNameList.getData().stream().filter(g -> l.getTopicId().equals(g.getTopicId())).forEach(g -> l.setTopicReleaseGroupName(g.getTopicGroupName()))); + list.forEach(l -> groupNameList.getData().stream().filter(g -> org.apache.commons.lang3.StringUtils.isNotBlank(l.getTopicId()) && l.getTopicId().equals(g.getTopicId())).forEach(g -> l.setTopicReleaseGroupName(g.getTopicGroupName()))); } return list; } @@ -1500,12 +1612,14 @@ public class IssueServiceImpl extends BaseServiceImpl imp if (!CollectionUtils.isEmpty(votedCount)){ userIds.addAll(votedCount); } - // 话题创建者 - Result topicCreatedUser = resiGroupOpenFeignClient.topicCreatedUser(issueEntity.getSourceId()); - if (!topicCreatedUser.success()){ - throw new RenException("【查询话题创建者失败】["+topicCreatedUser.getMsg()+"]"); + if("resi_topic".equals(issueEntity.getSourceType())){ + // 话题创建者 + Result topicCreatedUser = resiGroupOpenFeignClient.topicCreatedUser(issueEntity.getSourceId()); + if (!topicCreatedUser.success()){ + throw new RenException("【查询话题创建者失败】["+topicCreatedUser.getMsg()+"]"); + } + userIds.add(topicCreatedUser.getData()); } - userIds.add(topicCreatedUser.getData()); // 去重 return userIds.stream().distinct().collect(Collectors.toList()); } @@ -1572,7 +1686,7 @@ public class IssueServiceImpl extends BaseServiceImpl imp /** * 无需解决解决列表 - * + * 无需解决:结案选择无需解决的项目、关闭选择无需解决的议题 * @param fromDTO * @return java.util.List * @author zhaoqifeng @@ -1581,28 +1695,56 @@ public class IssueServiceImpl extends BaseServiceImpl imp @Override public List getUnResolvedList(ShiftProjectListFromDTO fromDTO) { List resultList = new ArrayList<>(); + List allList = new ArrayList<>(); + //1、该网格下已关闭且无需解决的议题 List issueList = baseDao.selectUnResolvedList(fromDTO.getGridId()); if (CollectionUtils.isNotEmpty(issueList)) { - resultList.addAll(issueList); + allList.addAll(issueList); } + //2、来源于议题的项目,结案无需解决的项目 List projectList = govProjectOpenFeignClient.getUnResolvedList(fromDTO).getData(); if (CollectionUtils.isNotEmpty(projectList)) { - resultList.addAll(projectList); + allList.addAll(projectList); } - if (CollectionUtils.isNotEmpty(resultList)) { - resultList = resultList.stream().sorted(Comparator.comparing(UnResolvedResultDTO::getClosedTime).reversed()).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(allList)) { + allList = allList.stream().sorted(Comparator.comparing(UnResolvedResultDTO::getClosedTime).reversed()).collect(Collectors.toList()); if (fromDTO.getIsPage()) { int fromIndex = (fromDTO.getPageNo() - NumConstant.ONE) * fromDTO.getPageSize(); int toIndex = fromDTO.getPageNo() * fromDTO.getPageSize(); - if (fromIndex >= resultList.size()) { + if (fromIndex >= allList.size()) { return new ArrayList<>(); } - if (toIndex > resultList.size()) { - toIndex = resultList.size(); + if (toIndex > allList.size()) { + toIndex = allList.size(); } - resultList = resultList.subList(fromIndex, toIndex); + resultList = allList.subList(fromIndex, toIndex); } } + //重新查询一下所有议题的来源类型, 且来源于事件的议题,赋值icEventInfo + List issueIds=resultList.stream().map(i -> i.getIssueId()).collect(Collectors.toList()); + List issueEntityList = CollectionUtils.isEmpty(issueIds) ? new ArrayList<>() : baseDao.selectBatchIds(issueIds); + if(CollectionUtils.isNotEmpty(issueEntityList)){ + Map eventMap=new HashMap<>(); + // 来源于事件的 + List icEventIds = issueEntityList.stream().filter(t -> t.getSourceType().equals("ic_event")).map(i -> i.getSourceId()).collect(Collectors.toList()); + if (!org.springframework.util.CollectionUtils.isEmpty(icEventIds)) { + Result> eventInfoRes = govProjectOpenFeignClient.batchSelectById(icEventIds); + if (eventInfoRes.success() && !org.springframework.util.CollectionUtils.isEmpty(eventInfoRes.getData())) { + eventMap = eventInfoRes.getData().stream().collect(Collectors.toMap(IcEventDTO::getId, o -> o, (o1, o2) -> o1)); + } + } + Map issueMap=issueEntityList.stream().collect(Collectors.toMap(IssueEntity::getId, o -> o, (o1, o2) -> o1)); + Map finalEventMap = eventMap; + resultList.forEach(vi -> { + vi.setIssueSourceType(null != issueMap.get(vi.getIssueId()) ? issueMap.get(vi.getIssueId()).getSourceType() : StrConstant.EPMETY_STR); + IcEventDTO event = finalEventMap.get(vi.getSourceId()); + if (null != event) { + IcEventComDTO eventComDTO = ConvertUtils.sourceToTarget(event, IcEventComDTO.class); + eventComDTO.setIcEventId(event.getId()); + vi.setIcEventInfo(eventComDTO); + } + }); + } return resultList; } @@ -1766,5 +1908,299 @@ public class IssueServiceImpl extends BaseServiceImpl imp return false; } + /** + * Desc: 创建议题【直接创建】 + * @param issueDTO + * @author zxc + * @date 2022/10/8 09:03 + */ + @Override + public void createIssue(IssueDTO issueDTO) { + // 先审核 + if (org.apache.commons.lang3.StringUtils.isNotBlank(issueDTO.getIssueTitle()) || org.apache.commons.lang3.StringUtils.isNotBlank(issueDTO.getSuggestion())) { + TextScanParamDTO textScan = new TextScanParamDTO(); + //标题 + TextTaskDTO taskTitle = new TextTaskDTO(); + taskTitle.setContent(issueDTO.getIssueTitle()); + taskTitle.setDataId(IdWorker.getIdStr()); + textScan.getTasks().add(taskTitle); + //建议 + TextTaskDTO taskSuggestion = new TextTaskDTO(); + taskSuggestion.setDataId(IdWorker.getIdStr()); + taskSuggestion.setContent(issueDTO.getSuggestion()); + textScan.getTasks().add(taskSuggestion); + Result textSyncScanResult = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScan); + if (!textSyncScanResult.success()) { + throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode()); + } else { + if (!textSyncScanResult.getData().isAllPass()) { + logger.error(String.format(TopicConstant.SHIFT_ISSUE, issueDTO.getIssueTitle(), issueDTO.getSuggestion())); + throw new EpmetException(EpmetErrorCode.TEXT_SCAN_FAILED.getCode()); + } + } + } + if (CollectionUtils.isNotEmpty(issueDTO.getAttachmentList())){ + ImgScanParamDTO imgScanParamDTO = new ImgScanParamDTO(); + issueDTO.getAttachmentList().forEach(url -> { + ImgTaskDTO task = new ImgTaskDTO(); + task.setDataId(IdWorker.getIdStr()); + task.setUrl(url.getUrl()); + imgScanParamDTO.getTasks().add(task); + }); + Result imgScanResult = ScanContentUtils.imgSyncScan(scanApiUrl.concat(imgSyncScanMethod), imgScanParamDTO); + if (!imgScanResult.success()){ + throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode()); + } else { + if (!imgScanResult.getData().isAllPass()) { + throw new EpmetException(EpmetErrorCode.IMG_SCAN_FAILED.getCode()); + } + } + } + + // 是否开启 + String openStatus = configurationParameterService.checkIssueAuditSwitchIfOpen(issueDTO.getCustomerId()); + if (ModuleConstants.AUDIT_SWITCH_OPEN.equals(openStatus)){ + // 审核表 历史表 + IssueApplicationEntity iae = ConvertUtils.sourceToTarget(issueDTO, IssueApplicationEntity.class); + iae.setApplyStatus(ModuleConstants.UNDER_AUDITING); + applicationService.insert(iae); + IssueApplicationHistoryEntity iahe = new IssueApplicationHistoryEntity(); + iahe.setCustomerId(issueDTO.getCustomerId()); + iahe.setIssueApplicationId(iae.getId()); + iahe.setActionType(ModuleConstants.UNDER_AUDITING); + historyService.insert(iahe); + insertAtt(issueDTO.getAttachmentList(),iae.getId(),ModuleConstants.ISSUE_APPLICATION,issueDTO.getCustomerId()); + }else { + GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(issueDTO.getGridId()); + if(null == gridInfo){ + throw new EpmetException("查询网格信息失败"+issueDTO.getGridId()); + } + Result> userResult = userOpenFeignClient.queryUserBaseInfo(Arrays.asList(issueDTO.getUserId())); + if (!userResult.success() || CollectionUtils.isEmpty(userResult.getData())){ + throw new EpmetException("查询居民信息失败:"+issueDTO.getUserId()); + } + // 议题 议题进程 + issueDTO.setOrgId(gridInfo.getPid()); + issueDTO.setOrgIdPath(gridInfo.getPids()); + IssueEntity e = ConvertUtils.sourceToTarget(issueDTO, IssueEntity.class); + e.setIssueStatus(ModuleConstants.ISSUE_STATUS_VOTING); + e.setSourceType(ModuleConstants.ISSUE); + e.setDecidedTime(new Date()); + baseDao.insert(e); + IssueProcessEntity issueProcessEntity = new IssueProcessEntity(); + issueProcessEntity.setIssueId(e.getId()); + issueProcessEntity.setIssueStatus(ModuleConstants.ISSUE_STATUS_VOTING); + issueProcessEntity.setOrgType(ModuleConstants.ISSUE_PROCESS_ORG_TYPE_GRID); + issueProcessEntity.setOrgId(issueDTO.getGridId()); + UserBaseInfoResultDTO user = userResult.getData().get(NumConstant.ZERO); + issueProcessEntity.setOperationExplain(user.getShowName() + "发表议题【"+issueDTO.getSuggestion()+"】"); + issueProcessEntity.setOrgName(gridInfo.getGridNamePath()); + issueProcessEntity.setCustomerId(issueDTO.getCustomerId()); + issueProcessService.insert(issueProcessEntity); + insertAtt(issueDTO.getAttachmentList(),e.getId(),ModuleConstants.ISSUE,issueDTO.getCustomerId()); + } + + } + + /** + * Desc: 附件插入 + * @param sourceList 附件集合 + * @param businessId 业务ID + * @param attachTo + * @param customerId + * @author zxc + * @date 2022/10/8 09:01 + */ + private void insertAtt(Collection sourceList,String businessId,String attachTo,String customerId){ + if (CollectionUtils.isNotEmpty(sourceList)){ + List list = ConvertUtils.sourceToTarget(sourceList, IssueAttachmentEntity.class); + Integer sort = NumConstant.ZERO; + for (IssueAttachmentEntity e : list) { + e.setCustomerId(customerId); + e.setBusinessId(businessId); + e.setAttachTo(attachTo); + e.setStatus(ModuleConstants.AUDITION_TYPE_AUTO_PASSED); + e.setSort(sort); + sort++; + } + issueAttachmentService.insertBatch(list); + } + } + + /** + * 根据议题ids查询议题简要信息 + * + * @param issueIds + * @return + */ + @Override + public List getIssueProfile(List issueIds) { + if(CollectionUtils.isEmpty(issueIds)){ + return new ArrayList<>(); + } + return baseDao.selectIssueProfile(issueIds); + } + + /** + * Desc: 查询所有议题 + * @param formDTO + * @author zxc + * @date 2022/10/9 16:58 + */ + @Override + public PageData allIssueList(AllIssueListFormDTO formDTO) { + if (org.apache.commons.lang3.StringUtils.isBlank(formDTO.getOrgId())){ + CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getUserId()); + if (null == staffInfo){ + throw new EpmetException("查询工作人员信息失败:"+formDTO.getUserId()); + } + formDTO.setOrgId(staffInfo.getAgencyId()); + formDTO.setOrgType(ModuleConstants.ISSUE_PROCESS_ORG_TYPE_AGENCY); + } + PageData result = new PageData<>(new ArrayList(),NumConstant.ZERO_L); + if (formDTO.getIsPage()){ + PageInfo pageInfo = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()).doSelectPageInfo(() -> baseDao.allIssueList(formDTO)); + result.setList(pageInfo.getList()); + result.setTotal(Integer.valueOf(String.valueOf(pageInfo.getTotal()))); + }else { + List allIssueListResultDTOS = baseDao.allIssueList(formDTO); + result.setList(allIssueListResultDTOS); + result.setTotal(allIssueListResultDTOS.size()); + } + if (CollectionUtils.isNotEmpty(result.getList())){ + for (AllIssueListResultDTO l : result.getList()) { + if (l.getIssueStatus().equals(ModuleConstants.ISSUE_STATUS_VOTING)){ + String endDate = null == l.getVotingDeadline() ? + DateUtils.format(new Date(),DATE_PATTERN) : + DateUtils.format(l.getVotingDeadline(),DATE_PATTERN); + String today = LocalDate.now().toString(); + if (today.equals(endDate)){ + PolyLineDTO polyLineDTO = issueVoteDetailDao.polyLineData(l.getIssueId(), endDate); + l.setSupportCount(l.getSupportCount() + polyLineDTO.getSupportIncrement()); + l.setOppositionCount(l.getOppositionCount() + polyLineDTO.getOppositionIncrement()); + } + } + GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(l.getGridId()); + if(null == gridInfo){ + logger.warn("查询网格信息失败:"+l.getGridId()); + continue; + } + l.setGridName(gridInfo.getGridNamePath()); + } + } + return result; + } + + @Override + public void allIssueListExport(AllIssueListFormDTO formDTO, HttpServletResponse response) throws IOException { + ExcelWriter excelWriter = null; + formDTO.setPageNo(NumConstant.ONE); + formDTO.setPageSize(NumConstant.TEN_THOUSAND); + try { + String fileName = "议题管理" + DateUtils.format(new Date()) + ".xlsx"; + excelWriter = EasyExcel.write(ExcelUtils.getOutputStreamForExcel(fileName, response), AllIssueListExportExcel.class).build(); + WriteSheet writeSheet = EasyExcel.writerSheet("Sheet1").registerWriteHandler(new FreezeAndFilter()).build(); + List list = null; + do { + PageData data = allIssueList(formDTO); + list = ConvertUtils.sourceToTarget(data.getList(), AllIssueListExportExcel.class); + formDTO.setPageNo(formDTO.getPageNo() + NumConstant.ONE); + excelWriter.write(list, writeSheet); + } while (CollectionUtils.isNotEmpty(list) && list.size() == formDTO.getPageSize()); + } catch (EpmetException e) { + response.reset(); + response.setCharacterEncoding("UTF-8"); + response.setHeader("content-type", "application/json; charset=UTF-8"); + PrintWriter printWriter = response.getWriter(); + Result result = new Result<>().error(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),e.getMsg()); + printWriter.write(JSON.toJSONString(result)); + printWriter.close(); + } catch (Exception e) { + logger.error("export exception", e); + } finally { + if (excelWriter != null) { + excelWriter.finish(); + } + } + } + + /** + * 发布议题 + * 事件转议题 + * + * @param issueFormDTO + * @return + */ + @Transactional(rollbackFor = Exception.class) + @Override + public IssueDTO publishIssue(PublishIssueFormDTO issueFormDTO) { + // 事件转议题,是由工作端无需审核 + IssueEntity issueEntity = ConvertUtils.sourceToTarget(issueFormDTO, IssueEntity.class); + baseDao.insert(issueEntity); + + IssueProcessEntity issueProcessEntity = new IssueProcessEntity(); + issueProcessEntity.setIssueId(issueEntity.getId()); + issueProcessEntity.setIssueStatus(issueEntity.getIssueStatus()); + issueProcessEntity.setOrgType(ModuleConstants.ISSUE_PROCESS_ORG_TYPE_AGENCY); + CustomerStaffInfoCacheResult staffInfo=CustomerStaffRedis.getStaffInfo(issueFormDTO.getCustomerId(),issueFormDTO.getCreatedBy()); + issueProcessEntity.setOrgId(staffInfo.getAgencyId()); + issueProcessEntity.setOperationExplain(String.format("【%s】发表的事件被【%s】转为议题【%s】", issueFormDTO.getEventReportUserName(), staffInfo.getAgencyName(), issueEntity.getIssueTitle())); + issueProcessEntity.setOrgName(staffInfo.getAgencyName()); + issueProcessEntity.setCustomerId(issueFormDTO.getCustomerId()); + issueProcessService.insert(issueProcessEntity); + + //查询网格的所属居民数 + AllResiByGridFormDTO allResiByGridFormDTO=new AllResiByGridFormDTO(); + allResiByGridFormDTO.setGridId(issueEntity.getGridId()); + Result regUserTotalRes=userOpenFeignClient.getAllResiByGrid(allResiByGridFormDTO); + //3.新增议题表决统计表 + IssueVoteStatisticalDTO voteStatistical = new IssueVoteStatisticalDTO(); + voteStatistical.setIssueId(issueEntity.getId()); + //应表决数,该网格下所有的居民 + voteStatistical.setVotableCount(regUserTotalRes.success() ? regUserTotalRes.getData() : NumConstant.ZERO); + issueVoteStatisticalService.save(voteStatistical); + VoteRedisFormDTO voteInitCache = new VoteRedisFormDTO(); + voteInitCache.setIssueId(issueEntity.getId()); + voteInitCache.setShouldVoteCount(regUserTotalRes.success() ? regUserTotalRes.getData() : NumConstant.ZERO); + issueVoteDetailRedis.set(voteInitCache); + + IssueDTO issueDTO = ConvertUtils.sourceToTarget(issueEntity, IssueDTO.class); + issueDTO.setIssueId(issueEntity.getId()); + return issueDTO; + } + /** + * 删除事件时,事件转了议题,调用此方法,删除议题 + * 批量删除议题(议题如果转了项目,此方法不删除项目!) + * 删除issue、issue_category、issue_tags + * @param delIssueFormDTO + * @return 删除的议题中,转为了项目,返回议题id,上层再单独去删除项目 + */ + @Transactional(rollbackFor = Exception.class) + @Override + public List deleteIssueInternal(DelIssueFormDTO delIssueFormDTO) { + List shiftProjectIssueIds = new ArrayList<>(); + Date nowTime = new Date(); + for (String issueId : delIssueFormDTO.getIssueIds()) { + IssueEntity issueEntity = baseDao.selectById(issueId); + if (null == issueEntity) { + continue; + } + // 删除议题主表 + LambdaUpdateWrapper wrapper = new LambdaUpdateWrapper(); + wrapper.eq(IssueEntity::getId, issueId) + .set(IssueEntity::getUpdatedTime, nowTime) + .set(IssueEntity::getUpdatedBy, delIssueFormDTO.getUserId()) + .set(IssueEntity::getDelFlag, NumConstant.ONE_STR); + baseDao.update(null, wrapper); + // 删除议题分类关系表 + issueCategoryService.delByIssueId(issueId, delIssueFormDTO.getUserId(), nowTime); + // 删除议题标签关系表 + issueTagsService.delByIssueId(issueId, delIssueFormDTO.getUserId(), nowTime); + if ("shift_project".equals(issueEntity.getIssueStatus())) { + shiftProjectIssueIds.add(issueEntity.getId()); + } + } + return shiftProjectIssueIds; + } } diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueShareLinkRecordServiceImpl.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueShareLinkRecordServiceImpl.java index 687ce57e47..2c02be5f3c 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueShareLinkRecordServiceImpl.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueShareLinkRecordServiceImpl.java @@ -9,10 +9,11 @@ import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; -import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.utils.SpringContextUtils; import com.epmet.constant.IssueShareConstant; import com.epmet.dao.IssueShareLinkRecordDao; import com.epmet.dao.IssueShareLinkVisitRecordDao; +import com.epmet.dto.IssueDTO; import com.epmet.dto.IssueShareLinkRecordDTO; import com.epmet.dto.form.IssueCreateUrlFormDTO; import com.epmet.dto.form.IssueVisitFormDTO; @@ -20,9 +21,8 @@ import com.epmet.dto.result.IssueCreateUrlResultDTO; import com.epmet.dto.result.IssueVisitResultDTO; import com.epmet.entity.IssueShareLinkRecordEntity; import com.epmet.entity.IssueShareLinkVisitRecordEntity; -import com.epmet.resi.group.dto.topic.form.TopicBelongGroupFormDTO; -import com.epmet.resi.group.dto.topic.result.TopicBelongGroupResultDTO; import com.epmet.resi.group.feign.ResiGroupOpenFeignClient; +import com.epmet.service.IssueService; import com.epmet.service.IssueShareLinkRecordService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -118,19 +118,24 @@ public class IssueShareLinkRecordServiceImpl extends BaseServiceImpl topicInfo = resiGroupOpenFeignClient.selectTopicBelongGroup(topicBelongGroupFormDTO); - if (!topicInfo.success()){ - throw new RenException(IssueShareConstant.TOPIC_BELONG_GROUP_FAILURE); - } + IssueDTO issueEntity= SpringContextUtils.getBean(IssueService.class).get(formDTO.getIssueId()); + //并改成兼容,发现不需要查询话题的网格id, 索性注释了吧 + /*if("resi_topic".equals(issueEntity.getSourceType())){ + TopicBelongGroupFormDTO topicBelongGroupFormDTO = new TopicBelongGroupFormDTO(); + topicBelongGroupFormDTO.setTopicId(issueInfo.getTopicId()); + // 查询议题来源所属小组【话题所属小组】 + Result topicInfo = resiGroupOpenFeignClient.selectTopicBelongGroup(topicBelongGroupFormDTO); + if (!topicInfo.success()){ + throw new RenException(IssueShareConstant.TOPIC_BELONG_GROUP_FAILURE); + } + if (StringUtils.isBlank(topicInfo.getData().getGridId())){ + throw new RenException(IssueShareConstant.TOPIC_BELONG_GROUP_NULL); + } + }*/ IssueShareLinkRecordEntity entity = new IssueShareLinkRecordEntity(); entity.setCustomerId(issueInfo.getCustomerId()); - if (StringUtils.isBlank(topicInfo.getData().getGridId())){ - throw new RenException(IssueShareConstant.TOPIC_BELONG_GROUP_NULL); - } - entity.setGridId(topicInfo.getData().getGridId()); + // entity.setGridId(topicInfo.getData().getGridId());//注释原因同上 + entity.setGridId(issueEntity.getGridId()); entity.setIssueId(formDTO.getIssueId()); entity.setShareUserId(tokenDto.getUserId()); entity.setInviteContent(null); diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueSuggestionServiceImpl.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueSuggestionServiceImpl.java index 20e2d01e6e..1b303c85e9 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueSuggestionServiceImpl.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueSuggestionServiceImpl.java @@ -20,6 +20,7 @@ package com.epmet.service.impl; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.scan.param.TextScanParamDTO; import com.epmet.commons.tools.scan.param.TextTaskDTO; @@ -96,7 +97,7 @@ public class IssueSuggestionServiceImpl extends BaseServiceImpl textSyncScanResult = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO); if (!textSyncScanResult.success()) { - log.warn("居民端用户对议题发表建议,内容审核服务返回失败"); - throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); + throw new EpmetException(EpmetErrorCode.TEXT_SCAN_FAILED.getCode(),EpmetErrorCode.TEXT_SCAN_FAILED.getMsg(),EpmetErrorCode.TEXT_SCAN_FAILED.getMsg()); } else { if (!textSyncScanResult.getData().isAllPass()) { - throw new RenException(EpmetErrorCode.TEXT_SCAN_FAILED.getCode()); + throw new EpmetException(EpmetErrorCode.TEXT_SCAN_FAILED.getCode(),EpmetErrorCode.TEXT_SCAN_FAILED.getMsg(),EpmetErrorCode.TEXT_SCAN_FAILED.getMsg()); } } //赋值网格id IssueDTO issueDTO = issueService.get(dto.getIssueId()); if (null == issueDTO) { - throw new RenException(String.format("根据议题id%s,没有找到议题信息", dto.getIssueId())); + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),String.format("根据议题id%s,没有找到议题信息", dto.getIssueId()),"议题不存在"); } dto.setGridId(issueDTO.getGridId()); dto.setCustomerId(issueDTO.getCustomerId()); diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueTagsServiceImpl.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueTagsServiceImpl.java index 1d24217321..c1b7a5c69e 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueTagsServiceImpl.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueTagsServiceImpl.java @@ -18,6 +18,7 @@ package com.epmet.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.FieldConstant; @@ -49,6 +50,7 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; import java.util.Arrays; +import java.util.Date; import java.util.List; import java.util.Map; @@ -244,4 +246,13 @@ public class IssueTagsServiceImpl extends BaseServiceImpl wrapper = new LambdaUpdateWrapper(); + wrapper.eq(IssueTagsEntity::getIssueId, issueId) + .set(IssueTagsEntity::getUpdatedTime, delTime) + .set(IssueTagsEntity::getUpdatedBy, userId) + .set(IssueTagsEntity::getDelFlag, NumConstant.ONE_STR); + baseDao.update(null, wrapper); + } } \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueVoteDetailServiceImpl.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueVoteDetailServiceImpl.java index 10b4673ce9..eedfd2bb77 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueVoteDetailServiceImpl.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueVoteDetailServiceImpl.java @@ -40,10 +40,12 @@ import com.epmet.dto.form.*; import com.epmet.dto.result.CheckTopicPublisherResultDTO; import com.epmet.dto.result.JoinVoteResultDTO; import com.epmet.entity.IssueVoteDetailEntity; +import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.feign.ResiGroupFeignClient; import com.epmet.redis.IssueVoteDetailRedis; import com.epmet.service.IssueService; import com.epmet.service.IssueVoteDetailService; +import com.epmet.utils.ModuleConstants; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -73,6 +75,8 @@ public class IssueVoteDetailServiceImpl extends BaseServiceImpl page(Map params) { @@ -140,7 +144,7 @@ public class IssueVoteDetailServiceImpl extends BaseServiceImpl integerResult = resiGroupFeignClient.votableCount(dto); - if (!integerResult.success()){ - throw new EpmetException("查询应表决人数失败..."); + /** + * 直接创建议题的,应表决数为网格下的注册居民数 + */ + if (formDTO.getSourceType().equals(ModuleConstants.ISSUE_FROM_TOPIC)){ + Result integerResult = resiGroupFeignClient.votableCount(dto); + if (!integerResult.success()){ + throw new EpmetException("查询应表决人数失败..."); + } + redisData.setShouldVoteCount(integerResult.getData()); + }else { + Result allResi = epmetUserOpenFeignClient.getAllResiByGrid(new AllResiByGridFormDTO(issueDTO.getGridId())); + if (!allResi.success()){ + throw new EpmetException("查询网格下的注册居民失败:"+issueDTO.getGridId()); + } + redisData.setShouldVoteCount(allResi.getData()); } - redisData.setShouldVoteCount(integerResult.getData()); issueVoteDetailRedis.set(redisData); Integer checkoutVoteCount = baseDao.checkoutVote(formDTO); if (checkoutVoteCount==0){ @@ -239,12 +250,21 @@ public class IssueVoteDetailServiceImpl extends BaseServiceImpl votableCount = resiGroupFeignClient.votableCount(gridId); - if(votableCount.success() && null != votableCount.getData()){ - voteCache.setShouldVoteCount(votableCount.getData()); - }else{ - voteCache.setShouldVoteCount(NumConstant.ZERO); + if (StringUtils.isBlank(formDTO.getSourceType())){ + Result votableCount = resiGroupFeignClient.votableCount(gridId); + if(votableCount.success() && null != votableCount.getData()){ + voteCache.setShouldVoteCount(votableCount.getData()); + }else{ + voteCache.setShouldVoteCount(NumConstant.ZERO); + } + }else { + Result allResi = epmetUserOpenFeignClient.getAllResiByGrid(new AllResiByGridFormDTO(formDTO.getGridId())); + if (!allResi.success()){ + throw new EpmetException("查询网格下的注册居民失败:"+formDTO.getGridId()); + } + voteCache.setShouldVoteCount(allResi.getData()); } + return voteCache; } diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueVoteStatisticalServiceImpl.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueVoteStatisticalServiceImpl.java index b28378b26c..1b33806f47 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueVoteStatisticalServiceImpl.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueVoteStatisticalServiceImpl.java @@ -23,6 +23,7 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.StrConstant; +import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; @@ -42,6 +43,7 @@ import com.epmet.dto.result.*; import com.epmet.entity.IssueEntity; import com.epmet.entity.IssueVoteStatisticalEntity; import com.epmet.feign.EpmetUserFeignClient; +import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.feign.GovOrgOpenFeignClient; import com.epmet.feign.ResiGroupFeignClient; import com.epmet.redis.IssueVoteDetailRedis; @@ -98,6 +100,8 @@ public class IssueVoteStatisticalServiceImpl extends BaseServiceImpl page(Map params) { @@ -259,6 +263,50 @@ public class IssueVoteStatisticalServiceImpl extends BaseServiceImpl allResiByGrid = epmetUserOpenFeignClient.getAllResiByGrid(new AllResiByGridFormDTO(issueEntity.getGridId())); + if (!allResiByGrid.success()){ + throw new EpmetException("查询网格下注册居民失败:"+issueEntity.getGridId()); + } + voteRedisFormDTO.setShouldVoteCount(allResiByGrid.getData()); + } + VotingTrendResultDTO votingTrendResultDTO = new VotingTrendResultDTO(); + BeanUtils.copyProperties(voteRedisFormDTO, votingTrendResultDTO); + votingTrendResultDTO.setRealityVoteCount(voteRedisFormDTO.getSupportAmount() + voteRedisFormDTO.getOppositionAmount()); + //DB获取表决 日统计详情 + List polyLineDTOS = issueVoteStatisticalDao.polyLineData(issueId); + String startDate = DateUtils.format(issueEntity.getDecidedTime(),DATE_PATTERN); + String endDate = null == issueEntity.getVotingDeadline() ? + DateUtils.format(new Date(),DATE_PATTERN) : + DateUtils.format(issueEntity.getVotingDeadline(),DATE_PATTERN); + List polyLine = getPolyLine(startDate, endDate); + String today = LocalDate.now().toString(); + if (today.equals(endDate)){ + PolyLineDTO polyLineDTO = issueVoteDetailDao.polyLineData(issueId.getIssueId(), endDate); + polyLine.get(polyLine.size() - NumConstant.ONE).setSupportIncrement(polyLineDTO.getSupportIncrement()); + polyLine.get(polyLine.size() - NumConstant.ONE).setOppositionIncrement(polyLineDTO.getOppositionIncrement()); + } + if (CollectionUtils.isEmpty(polyLineDTOS)){ + votingTrendResultDTO.setPolyLine(polyLine); + return votingTrendResultDTO; + } + polyLineDTOS.forEach(pd -> { + polyLine.forEach(p -> { + if (pd.getVoteDate().equals(p.getVoteDate())){ + p.setOppositionIncrement(pd.getOppositionIncrement()); + p.setSupportIncrement(pd.getSupportIncrement()); + } + }); + }); + votingTrendResultDTO.setPolyLine(polyLine); + return votingTrendResultDTO; + } + public List getPolyLine(String startTime, String endTime){ List result = new ArrayList<>(); Date start = DateUtils.parse(startTime, DATE_PATTERN); @@ -561,36 +609,50 @@ public class IssueVoteStatisticalServiceImpl extends BaseServiceImpl votableCount = - resiGroupFeignClient.votableCount(gridParam); - if(votableCount.success() && null != votableCount.getData()){ + toUpd.setIssueId(issueEntity.getId()); + if ("resi_topic".equals(issueEntity.getSourceType())) { + CommonGridIdFormDTO gridParam = new CommonGridIdFormDTO(); + gridParam.setGridId(issueEntity.getGridId()); + Result votableCount = + resiGroupFeignClient.votableCount(gridParam); + if (votableCount.success() && null != votableCount.getData()) { toUpd.setVotableCount(votableCount.getData()); - } + }else{ + //先默认赋值0吧 + toUpd.setVotableCount(NumConstant.ZERO); + } + } else { + AllResiByGridFormDTO allResiByGridFormDTO=new AllResiByGridFormDTO(); + allResiByGridFormDTO.setGridId(issueEntity.getGridId()); + Result allResiByGrid=epmetUserOpenFeignClient.getAllResiByGrid(allResiByGridFormDTO); + if(allResiByGrid.success()){ + toUpd.setVotableCount(allResiByGrid.getData()); + }else{ + //先默认赋值0吧 + toUpd.setVotableCount(NumConstant.ZERO); + } + } if(StringUtils.isNotBlank(statisticalId)){ toUpd.setId(statisticalId); update(toUpd); }else{ - IssueVoteStatisticalDTO existedStatistical = getByIssueId(issueId); + IssueVoteStatisticalDTO existedStatistical = getByIssueId(issueEntity.getId()); if(null != existedStatistical && StringUtils.isNotBlank(existedStatistical.getId())){ toUpd.setId(existedStatistical.getId()); update(toUpd); diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/utils/ModuleConstants.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/utils/ModuleConstants.java index b6a7f4cd49..f19e282f64 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/utils/ModuleConstants.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/utils/ModuleConstants.java @@ -178,4 +178,10 @@ public interface ModuleConstants { * 是否禁用 disable:禁用 */ String IS_DISABLE = "disable"; + + String UNDER_AUDITING = "under_auditing"; + + String ISSUE_APPLICATION = "issue_application"; + + String ISSUE = "issue"; } diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/resources/db/migration/V0.0.18__alter_issue_type.sql b/epmet-module/gov-issue/gov-issue-server/src/main/resources/db/migration/V0.0.18__alter_issue_type.sql new file mode 100644 index 0000000000..5015a8351b --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/resources/db/migration/V0.0.18__alter_issue_type.sql @@ -0,0 +1,36 @@ +ALTER TABLE issue MODIFY COLUMN SOURCE_ID varchar(32) NULL COMMENT '来源ID eg:2223232(当SOURCE_TYPE为"resi_topic"时,这里指话题的ID),issue时为空' AFTER SOURCE_TYPE; +ALTER TABLE issue MODIFY COLUMN SOURCE_TYPE varchar(32) NULL COMMENT '来源类型 话题:resi_topic;直接立议题:issue;' AFTER ISSUE_STATUS; + +ALTER TABLE issue_application MODIFY COLUMN GROUP_ID varchar(64) NULL COMMENT '小组id' AFTER TOPIC_ID; +ALTER TABLE issue_application MODIFY COLUMN TOPIC_ID varchar(32) NULL COMMENT '话题id' AFTER APPLY_STATUS; + + +alter table issue add column ADDRESS VARCHAR(255) DEFAULT '' COMMENT '地址' AFTER `SUGGESTION`; +alter table issue add COLUMN LONGITUDE VARCHAR(64) DEFAULT'' COMMENT '经度' AFTER ADDRESS; +alter table issue add COLUMN LATITUDE VARCHAR(64) DEFAULT'' COMMENT '纬度' AFTER LONGITUDE; + +alter table issue_application add column ADDRESS VARCHAR(255) DEFAULT '' COMMENT '地址' AFTER `SUGGESTION`; +alter table issue_application add COLUMN LONGITUDE VARCHAR(64) DEFAULT'' COMMENT '经度' AFTER ADDRESS; +alter table issue_application add COLUMN LATITUDE VARCHAR(64) DEFAULT'' COMMENT '纬度' AFTER LONGITUDE; + +CREATE TABLE `issue_attachment` ( + `ID` varchar(64) NOT NULL COMMENT '主键', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID', + `BUSINESS_ID` varchar(64) NOT NULL COMMENT '业务id', + `ATTACH_TO` varchar(32) DEFAULT NULL COMMENT '议题:issue', + `NAME` varchar(64) DEFAULT NULL COMMENT '附件名', + `FORMAT` varchar(64) DEFAULT NULL COMMENT '文件格式(JPG、PNG、PDF、JPEG、BMP、MP4、WMA、M4A、MP3、DOC、DOCX、XLS)', + `TYPE` varchar(64) NOT NULL COMMENT '附件类型((图片 - image、 视频 - video、 语音 - voice、 文档 - doc))', + `URL` varchar(255) NOT NULL COMMENT '附件地址', + `SORT` int(1) NOT NULL COMMENT '排序字段', + `STATUS` varchar(32) NOT NULL DEFAULT 'auto_passed' COMMENT '附件状态(审核中:auditing; \r\nauto_passed: 自动通过;\r\nreview:结果不确定,需要人工审核;\r\nblock: 结果违规;\r\nrejected:人工审核驳回;\r\napproved:人工审核通过)\r\n现在图片是同步审核的,所以图片只有auto_passed一种状态', + `REASON` varchar(255) DEFAULT NULL COMMENT '失败原因', + `DURATION` int(11) DEFAULT NULL COMMENT '语音或视频时长,秒', + `DEL_FLAG` varchar(1) NOT NULL COMMENT '删除标记 0:未删除,1:已删除', + `REVISION` int(11) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT COMMENT='issue库附件表'; \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/resources/db/migration/V0.0.19__alter_issue_application.sql b/epmet-module/gov-issue/gov-issue-server/src/main/resources/db/migration/V0.0.19__alter_issue_application.sql new file mode 100644 index 0000000000..256b0ab6b6 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/resources/db/migration/V0.0.19__alter_issue_application.sql @@ -0,0 +1,2 @@ +alter table issue_application add COLUMN ORG_ID VARCHAR(64) DEFAULT'' COMMENT '组织ID' AFTER GRID_ID; +alter table issue_application add COLUMN ORG_ID_PATH VARCHAR(1024) DEFAULT'' COMMENT '组织ID全路径,包括ORG_ID' AFTER ORG_ID; \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/resources/db/migration/V0.0.20__issue_source.sql b/epmet-module/gov-issue/gov-issue-server/src/main/resources/db/migration/V0.0.20__issue_source.sql new file mode 100644 index 0000000000..ac49a686de --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/resources/db/migration/V0.0.20__issue_source.sql @@ -0,0 +1 @@ +alter table issue MODIFY COLUMN `SOURCE_TYPE` varchar(32) DEFAULT NULL COMMENT '来源类型 话题:resi_topic;直接立议题:issue;事件:ic_event'; diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueApplicationDao.xml b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueApplicationDao.xml index 2820a43019..64541d95c6 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueApplicationDao.xml +++ b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueApplicationDao.xml @@ -2,6 +2,28 @@ + + UPDATE issue_application + + + + when ID = #{i.id} then #{i.orgId} + + + + + when ID = #{i.id} then #{i.orgIdPath} + + + updated_time = now() + where 1=1 + + + ID = #{i.id} + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueAttachmentDao.xml b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueAttachmentDao.xml new file mode 100644 index 0000000000..02e8513b09 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueAttachmentDao.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueCategoryDao.xml b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueCategoryDao.xml index 078661e2a1..4a8deef951 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueCategoryDao.xml +++ b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueCategoryDao.xml @@ -16,7 +16,12 @@ a.sort AS "sort", CONCAT(b.category_name, '-', a.category_name) AS "category_name" FROM issue_project_category_dict a - INNER JOIN issue_project_category_dict b ON a.pid = b.id + INNER JOIN issue_project_category_dict b + ON (a.pid = b.id + and a.CUSTOMER_ID = #{customerId} + and b.CUSTOMER_ID = #{customerId} + and a.CUSTOMER_ID=b.CUSTOMER_ID + ) ) ip ON ic.category_id = ip.idd AND ic.customer_id = ip.customer_id WHERE diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueDao.xml b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueDao.xml index 4dbcbb2e9a..77e9db60da 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueDao.xml +++ b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueDao.xml @@ -28,21 +28,46 @@ + + + + + + + + + + + + + + + - SELECT - source_id AS topicId, - issue_title AS issueTitle, - issue_status AS issueStatus, - suggestion AS issueSuggestion, - grid_id AS gridId, - created_by AS userId, - CREATED_TIME as shiftIssueTime + i.id as issueId, + ( + case when i.SOURCE_TYPE='resi_topic'then i.source_id + else '' + end + )as topicId, + i.source_id, + i.issue_title AS issueTitle, + i.issue_status AS issueStatus, + i.suggestion AS issueSuggestion, + i.grid_id AS gridId, + i.created_by AS userId, + i.CREATED_TIME as shiftIssueTime, + i.SOURCE_TYPE, + ia.URL FROM - issue + issue i + left join issue_attachment ia + on(i.id=ia.BUSINESS_ID and ia.del_flag='0') WHERE - id = #{issueId} - AND del_flag = 0 + i.id = #{issueId} + AND i.del_flag = 0 + - + i.created_time DESC + + + + + + + + + + + + + - SELECT - ID AS issueId, - IFNULL(ISSUE_TITLE,'') AS issueTitle, - IFNULL(CLOSE_REASON,'') AS solution, - UNIX_TIMESTAMP( created_time ) AS issueClosedTime, - SOURCE_ID AS sourceId + i.ID AS issueId, + IFNULL(i.ISSUE_TITLE,'') AS issueTitle, + IFNULL(i.CLOSE_REASON,'') AS solution, + UNIX_TIMESTAMP( i.created_time ) AS issueClosedTime, + i.SOURCE_ID AS sourceId, + i.SOURCE_TYPE, + ia.URL FROM - issue + issue i + left join issue_attachment ia + on(i.id=ia.BUSINESS_ID and ia.del_flag='0') WHERE - DEL_FLAG = '0' - AND GRID_ID = #{gridId} - AND ISSUE_STATUS = 'closed' - AND RESOLVE_TYPE = 'resolved' + i.DEL_FLAG = '0' + AND i.GRID_ID = #{gridId} + AND i.ISSUE_STATUS = 'closed' + AND i.RESOLVE_TYPE = 'resolved' ORDER BY - created_time DESC + i.created_time DESC - SELECT - ID AS issueId, - IFNULL(ISSUE_TITLE,'') AS issueTitle, - IFNULL(CLOSE_REASON,'') AS solution, - UNIX_TIMESTAMP( CLOSED_TIME ) AS closedTime, - SOURCE_ID AS sourceId + i.ID AS issueId, + IFNULL(i.ISSUE_TITLE,'') AS issueTitle, + IFNULL(i.CLOSE_REASON,'') AS solution, + UNIX_TIMESTAMP( i.CLOSED_TIME ) AS closedTime, + i.SOURCE_ID AS sourceId, + i.SOURCE_TYPE as issueSourceType, + i.LONGITUDE, + i.LATITUDE, + i.SOURCE_ID as topicId, + ia.url FROM - issue + issue i + left join issue_attachment ia + on(i.id=ia.BUSINESS_ID and ia.del_flag='0') WHERE - DEL_FLAG = '0' - AND GRID_ID = #{gridId} - AND ISSUE_STATUS = 'closed' - AND RESOLVE_TYPE = 'unresolved' + i.DEL_FLAG = '0' + AND i.GRID_ID = #{gridId} + AND i.ISSUE_STATUS = 'closed' + AND i.RESOLVE_TYPE = 'unresolved' @@ -770,4 +851,79 @@ AND APPLY_STATUS = 'under_auditing' AND GRID_ID = #{gridId} + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueProcessDao.xml b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueProcessDao.xml index 00122cfade..60af2d5d12 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueProcessDao.xml +++ b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueProcessDao.xml @@ -102,13 +102,14 @@ SELECT - '转议题' AS processName, + '发起议题' AS processName, UNIX_TIMESTAMP( created_time ) AS processTime, operation_explain AS progressDesc, org_name AS departmentName, + 'issue' AS type, id AS processId FROM issue_process diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/StaffOrgRelationDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/StaffOrgRelationDTO.java index 47e3105b3d..e1b2602373 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/StaffOrgRelationDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/StaffOrgRelationDTO.java @@ -60,7 +60,7 @@ public class StaffOrgRelationDTO implements Serializable { private String orgId; /** - * 工作人员添加入口类型(组织:agency;部门:dept;网格:gridId) + * 工作人员的添加入口类型(组织:agency;部门:dept;网格:grid) */ private String orgType; diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddStaffV2FromDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddStaffV2FromDTO.java index 705ddfaadb..7bc3b93076 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddStaffV2FromDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddStaffV2FromDTO.java @@ -73,4 +73,9 @@ public class AddStaffV2FromDTO implements Serializable { private String client; private List newRoles; + + /** + * 烟台用:当前登录用户 + */ + private String currentUserId; } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/GetAgencyListFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/GetAgencyListFormDTO.java index 95c371ad83..64dd258641 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/GetAgencyListFormDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/GetAgencyListFormDTO.java @@ -1,7 +1,9 @@ package com.epmet.dto.form; +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; import lombok.Data; +import javax.validation.constraints.NotBlank; import java.io.Serializable; /** @@ -14,6 +16,12 @@ public class GetAgencyListFormDTO implements Serializable { private static final long serialVersionUID = -5846836779036328298L; + /** + * 这个接口在运营端统一认证,新增用户事也调用了 + */ + public interface OperAddUserShowGroup extends CustomerClientShowGroup { + } + @NotBlank(message = "运营端调用此接口必须传客户id",groups =OperAddUserShowGroup.class ) private String customerId; diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/StaffInfoFromDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/StaffInfoFromDTO.java index 133f0df8a4..9bcd6dcb8c 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/StaffInfoFromDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/StaffInfoFromDTO.java @@ -1,5 +1,6 @@ package com.epmet.dto.form; +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; import lombok.Data; import javax.validation.constraints.NotBlank; @@ -14,6 +15,7 @@ import java.io.Serializable; @Data public class StaffInfoFromDTO implements Serializable { private static final long serialVersionUID = 1L; + public interface EditStaffInitGroup extends CustomerClientShowGroup {} /** * 客户ID */ @@ -26,5 +28,6 @@ public class StaffInfoFromDTO implements Serializable { /** * 用户ID */ - String staffId; + @NotBlank(message = "staffId不能为空",groups = EditStaffInitGroup.class) + private String staffId; } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffInitResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffInitResultDTO.java index 36cc283268..87b641b564 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffInitResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffInitResultDTO.java @@ -13,6 +13,7 @@ import java.util.List; @Data public class StaffInitResultDTO implements Serializable { private static final long serialVersionUID = 1L; + private String customerId; /** * 人员ID */ @@ -46,4 +47,12 @@ public class StaffInitResultDTO implements Serializable { */ private List roleList; private List newRoleList; + /** + * customer_staff_agency.agency_id + */ + private String agencyId; + /** + * xxx-xxx + */ + private String agencyName; } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java index c1aba9bb3c..6a8c433250 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java @@ -18,6 +18,7 @@ package com.epmet.controller; import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.constant.AppClientConstant; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; @@ -348,8 +349,12 @@ public class CustomerAgencyController { */ @PostMapping("agencylist") public Result getAgencyList(@LoginUser TokenDto tokenDTO,@RequestBody GetAgencyListFormDTO formDTO) { - if (StringUtils.isBlank(formDTO.getCustomerId())){ - formDTO.setCustomerId(tokenDTO.getCustomerId()); + if(AppClientConstant.APP_OPER.equals(tokenDTO.getApp())){ + ValidatorUtils.validateEntity(formDTO.getCustomerId(),GetAgencyListFormDTO.OperAddUserShowGroup.class); + }else{ + if (StringUtils.isBlank(formDTO.getCustomerId())){ + formDTO.setCustomerId(tokenDTO.getCustomerId()); + } } return new Result().ok(customerAgencyService.getAgencyList(formDTO)); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/StaffController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/StaffController.java index 939f740fc1..bcc8e2f55e 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/StaffController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/StaffController.java @@ -4,13 +4,17 @@ package com.epmet.controller; import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.annotation.RequirePermission; +import com.epmet.commons.tools.constant.AppClientConstant; import com.epmet.commons.tools.enums.RequirePermissionEnum; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.service.StaffService; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -70,6 +74,7 @@ public class StaffController { @PostMapping("editstaffinit") @RequirePermission(requirePermission = RequirePermissionEnum.ORG_STAFF_DETAIL) public Result editStaffInit(@RequestBody StaffInfoFromDTO fromDTO){ + ValidatorUtils.validateEntity(fromDTO,StaffInfoFromDTO.EditStaffInitGroup.class); return staffService.editStaffInit(fromDTO); } @@ -96,9 +101,9 @@ public class StaffController { */ @PostMapping("editstaff") @RequirePermission(requirePermission = RequirePermissionEnum.ORG_STAFF_UPDATE) - public Result editStaff(@LoginUser TokenDto tokenDto, @RequestBody StaffSubmitFromDTO fromDTO){ + public Result editStaff(@RequestBody StaffSubmitFromDTO fromDTO){ ValidatorUtils.validateEntity(fromDTO); - return staffService.editStaff(tokenDto, fromDTO); + return staffService.editStaff(fromDTO); } /** @@ -196,15 +201,27 @@ public class StaffController { /** * 【通讯录】人员添加v2 + * 返回staffId * @author sun */ @PostMapping("addstaffv2") @RequirePermission(requirePermission = RequirePermissionEnum.ORG_STAFF_CREATE) - public Result addStaffV2(@LoginUser TokenDto tokenDto, @RequestBody AddStaffV2FromDTO fromDTO){ + public Result addStaffV2(@LoginUser TokenDto tokenDto, @RequestBody AddStaffV2FromDTO fromDTO){ ValidatorUtils.validateEntity(fromDTO, AddStaffV2FromDTO.AddStaff.class); - fromDTO.setCustomerId(tokenDto.getCustomerId()); - fromDTO.setApp(tokenDto.getApp()); - fromDTO.setClient(tokenDto.getClient()); + if(AppClientConstant.APP_OPER.equals(tokenDto.getApp())){ + if(StringUtils.isBlank(fromDTO.getCustomerId())){ + // 该接口烟台运营端-统一认证也在用,所以客户id,运营端必传。 + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"运营端操作,customerId不能为空","运营端操作,customerId不能为空"); + } + }else{ + //小程序端或者数字社区从token里面取 + fromDTO.setCustomerId(tokenDto.getCustomerId()); + } + //因为添加的是工作人员,这里写死吧! + fromDTO.setApp("gov"); + fromDTO.setClient("wxmp"); + //当前登录用户 + fromDTO.setCurrentUserId(tokenDto.getUserId()); return staffService.addStaffV2(fromDTO); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/StaffOrgRelationEntity.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/StaffOrgRelationEntity.java index 99c242b25d..04ef0c00d2 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/StaffOrgRelationEntity.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/StaffOrgRelationEntity.java @@ -56,7 +56,7 @@ public class StaffOrgRelationEntity extends BaseEpmetEntity { private String orgId; /** - * 工作人员添加入口类型(组织:agency;部门:dept;网格:gridId) + * 工作人员的添加入口类型(组织:agency;部门:dept;网格:grid) */ private String orgType; diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/StaffService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/StaffService.java index fc2f954b02..5a4a989166 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/StaffService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/StaffService.java @@ -62,7 +62,7 @@ public interface StaffService { * @param fromDTO 参数 * @return Result */ - Result editStaff(TokenDto tokenDto,StaffSubmitFromDTO fromDTO); + Result editStaff(StaffSubmitFromDTO fromDTO); /** * 人员编辑 @@ -134,9 +134,10 @@ public interface StaffService { /** * 【通讯录】人员添加v2 + * 返回staffId * @author sun */ - Result addStaffV2(AddStaffV2FromDTO fromDTO); + Result addStaffV2(AddStaffV2FromDTO fromDTO); /** diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffServiceImpl.java index 6950cbcc3c..a81f868ac5 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffServiceImpl.java @@ -17,6 +17,7 @@ import com.epmet.dao.CustomerStaffAgencyDao; import com.epmet.dao.StaffOrgRelationDao; import com.epmet.dto.*; import com.epmet.dto.form.*; +import com.epmet.dto.form.yantai.YtSyncStaffIdFormDTO; import com.epmet.dto.result.*; import com.epmet.entity.*; import com.epmet.feign.*; @@ -46,8 +47,6 @@ public class StaffServiceImpl implements StaffService { @Autowired private EpmetUserFeignClient epmetUserFeignClient; @Autowired - private OperCrmFeignClient operCrmFeignClient; - @Autowired private CustomerAgencyService customerAgencyService; @Autowired private CustomerStaffAgencyService customerStaffAgencyService; @@ -76,11 +75,11 @@ public class StaffServiceImpl implements StaffService { @Autowired private StaffOrgRelationService staffOrgRelationService; @Resource - private CustomerStaffRedis customerStaffRedis; - @Resource private StaffOrgRelationDao staffOrgRelationDao; @Autowired private GovAccessFeignClient govAccessFeignClient; + @Autowired + private EpmetThirdOpenFeignClient epmetThirdOpenFeignClient; @Override public Result getStaffInfoForHome(StaffsInAgencyFromDTO fromDTO) { @@ -127,18 +126,44 @@ public class StaffServiceImpl implements StaffService { return epmetUserFeignClient.getStaffList(fromDTO); } + /** + * 人员添加页面初始化 + * 备注:2022.10.18运营端-统一认证也会调用此接口,入参会给customerId + * @param fromDTO 参数 + * @return + */ @Override public Result> addStaffInit(StaffInfoFromDTO fromDTO) { - CustomerAgencyEntity customerAgencyEntity = customerAgencyService.selectById(fromDTO.getAgencyId()); - fromDTO.setCustomerId(customerAgencyEntity.getCustomerId()); + if(StringUtils.isBlank(fromDTO.getCustomerId())){ + if(StringUtils.isNotBlank(fromDTO.getAgencyId())){ + CustomerAgencyEntity customerAgencyEntity = customerAgencyService.selectById(fromDTO.getAgencyId()); + fromDTO.setCustomerId(customerAgencyEntity.getCustomerId()); + } + } return epmetUserFeignClient.addStaffInit(fromDTO); } @Override public Result editStaffInit(StaffInfoFromDTO fromDTO) { - CustomerAgencyEntity customerAgencyEntity = customerAgencyService.selectById(fromDTO.getAgencyId()); - fromDTO.setCustomerId(customerAgencyEntity.getCustomerId()); - return epmetUserFeignClient.editStaffInit(fromDTO); + //运营端-统一认证调用此接口时,客户id传值了。 + if(StringUtils.isBlank(fromDTO.getCustomerId())){ + CustomerAgencyEntity customerAgencyEntity = customerAgencyService.selectById(fromDTO.getAgencyId()); + fromDTO.setCustomerId(customerAgencyEntity.getCustomerId()); + } + CustomerStaffAgencyDTO customerStaffAgencyDTO=customerStaffAgencyService.getInfoByUserId(fromDTO.getStaffId()); + if (null == customerStaffAgencyDTO) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "customer_staff_agency is null user_id :" + fromDTO.getStaffId(), "查询用户所属组织为空"); + } + //运营端-统一认证那调用的时候, agencyId为空,这里重新赋值下 + if(StringUtils.isBlank(fromDTO.getAgencyId())){ + fromDTO.setAgencyId(customerStaffAgencyDTO.getAgencyId()); + } + Result res=epmetUserFeignClient.editStaffInit(fromDTO); + if (res.success() && null != res.getData()) { + res.getData().setAgencyId(customerStaffAgencyDTO.getAgencyId()); + res.getData().setAgencyName(customerAgencyService.getAgencyName(customerStaffAgencyDTO.getAgencyId())); + } + return new Result().ok(res.getData()); } @Override @@ -179,26 +204,33 @@ public class StaffServiceImpl implements StaffService { return new Result(); } + /** + * + * @param tokenDto TokenDto tokenDto, + * @param fromDTO + * @return + */ @Override - public Result editStaff(TokenDto tokenDto, StaffSubmitFromDTO fromDTO) { - CustomerAgencyEntity customerAgencyEntity = customerAgencyService.selectById(fromDTO.getAgencyId()); - fromDTO.setCustomerId(customerAgencyEntity.getCustomerId()); - - fromDTO.setApp(tokenDto.getApp()); - fromDTO.setClient(tokenDto.getClient()); + public Result editStaff(StaffSubmitFromDTO fromDTO) { + if(StringUtils.isBlank(fromDTO.getCustomerId())){ + CustomerAgencyEntity customerAgencyEntity = customerAgencyService.selectById(fromDTO.getAgencyId()); + fromDTO.setCustomerId(customerAgencyEntity.getCustomerId()); + } + // epmetUserFeignClient.editStaff没有用到这俩参数,就注释了。 + // fromDTO.setApp(tokenDto.getApp()); + // fromDTO.setClient(tokenDto.getClient()); Result result = epmetUserFeignClient.editStaff(fromDTO); if (!result.success()) { - if (result.getCode() != EpmetErrorCode.SERVER_ERROR.getCode()) { - return new Result().error(result.getCode(), result.getMsg()); - } - return new Result().error(EpmetErrorCode.STAFF_EDIT_FAILED.getCode(), EpmetErrorCode.STAFF_EDIT_FAILED.getMsg()); - } - if (tokenDto.getClient().equals("web")){ - Result roleUserAccess = govAccessFeignClient.roleUser(new RoleUserFormDTO(fromDTO.getNewRoles(), fromDTO.getStaffId(),fromDTO.getCustomerId())); - if (!roleUserAccess.success()){ - throw new EpmetException("save data to gov-role-user failure"); + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),result.getInternalMsg(),result.getMsg()); + } + // if (tokenDto.getClient().equals("web")){ + if(CollectionUtils.isNotEmpty(fromDTO.getNewRoles())){ + Result roleUserAccess = govAccessFeignClient.roleUser(new RoleUserFormDTO(fromDTO.getNewRoles(), fromDTO.getStaffId(),fromDTO.getCustomerId())); + if (!roleUserAccess.success()){ + throw new EpmetException("save data to gov-role-user failure"); + } } - } + // } //2021.8.24 sun 人员信息编辑时删除工作人员的缓存信息 CustomerStaffRedis.delStaffInfoFormCache(fromDTO.getCustomerId(), fromDTO.getStaffId()); return result; @@ -537,12 +569,12 @@ public class StaffServiceImpl implements StaffService { */ @Override @Transactional(rollbackFor = Exception.class) - public Result addStaffV2(AddStaffV2FromDTO fromDTO) { + public Result addStaffV2(AddStaffV2FromDTO fromDTO) { //1.根据新增人员类型判断查询机关信息 OrgResultDTO orgDTO = customerAgencyDao.selectAgencyDetail(fromDTO.getOrgId(), fromDTO.getOrgType()); if (null == orgDTO) { - logger.error(String.format("工作人员新增,根据新增人员组织类型未查询到相关组织信息,orgId->%s,orgType->%s", fromDTO.getOrgId(), fromDTO.getOrgType())); - throw new RenException("根据新增人员组织类型未查询到相关组织信息"); + logger.warn(String.format("工作人员新增,根据新增人员组织类型未查询到相关组织信息,orgId->%s,orgType->%s", fromDTO.getOrgId(), fromDTO.getOrgType())); + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"根据新增人员组织类型未查询到相关组织信息","组织不存在"); } //2.调用user服务,新增用户信息 @@ -550,10 +582,7 @@ public class StaffServiceImpl implements StaffService { submitDTO.setAgencyId(orgDTO.getAgencyId()); Result result = epmetUserFeignClient.addStaff(submitDTO); if (!result.success()) { - if (result.getCode() != EpmetErrorCode.SERVER_ERROR.getCode()) { - return new Result().error(result.getCode(), result.getMsg()); - } - return new Result().error(EpmetErrorCode.STAFF_ADD_FAILED.getCode(), EpmetErrorCode.STAFF_ADD_FAILED.getMsg()); + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),result.getInternalMsg(),result.getMsg()); } //3.人员机关表总人数加一、关系表新增关系数据 @@ -612,8 +641,22 @@ public class StaffServiceImpl implements StaffService { throw new EpmetException("save data to gov-role-user failure"); } } - - return new Result(); + //如果是烟台的需要更新 根据手机号+姓名 更新data_sync_user_data置为已创建、记录staffId + // 开发环境默认:45687aa479955f9d06204d415238f7cc + // 测试环境:0c41b272ee9ee95ac6f184ad548a30eb + // 烟台: 1535072605621841922 + if ("1535072605621841922".equals(fromDTO.getCustomerId()) + || "45687aa479955f9d06204d415238f7cc".equals(fromDTO.getCustomerId()) + || "0c41b272ee9ee95ac6f184ad548a30eb".equals(fromDTO.getCustomerId())) { + YtSyncStaffIdFormDTO ytSyncStaffIdFormDTO = ConvertUtils.sourceToTarget(fromDTO,YtSyncStaffIdFormDTO.class); + ytSyncStaffIdFormDTO.setStaffId(result.getData().getUserId()); + ytSyncStaffIdFormDTO.setOperUserId(fromDTO.getCurrentUserId()); + epmetThirdOpenFeignClient.dataSyncUpdateStaff(ytSyncStaffIdFormDTO); + } + //2022.10.18加个返参,借用下StaffDetailResultDTO不再新建dto了 + StaffDetailResultDTO resultDTO=new StaffDetailResultDTO(); + resultDTO.setStaffId(result.getData().getUserId()); + return new Result().ok(resultDTO); } diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/IcEventDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/IcEventDTO.java index 3b14fc3266..3be3954934 100644 --- a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/IcEventDTO.java +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/IcEventDTO.java @@ -103,12 +103,12 @@ public class IcEventDTO implements Serializable { private Date closeCaseTime; /** - * 0:已回复 1:已转项目 1:已转需求 + * 0:已回复 1:已转项目 2:已转需求3:转议题 */ private String operationType; /** - * 项目、需求ID + * 项目、需求ID、议题id */ private String operationId; diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ColseProjectOrDemandFormDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ColseProjectOrDemandFormDTO.java index 19e7d38344..ac1812c5c7 100644 --- a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ColseProjectOrDemandFormDTO.java +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ColseProjectOrDemandFormDTO.java @@ -3,6 +3,7 @@ package com.epmet.dto.form; import lombok.Data; import java.io.Serializable; +import java.util.Date; /** @@ -13,7 +14,7 @@ public class ColseProjectOrDemandFormDTO implements Serializable { private static final long serialVersionUID = -590440160577071133L; //事件管理Id private String icEventId; - //类型 需求:demand 项目:project + //类型 需求:demand 项目:project 议题:issue private String type; //服务方【事件被转需求,需求在办结时的服务方名称】 private String serviceParty; @@ -22,4 +23,11 @@ public class ColseProjectOrDemandFormDTO implements Serializable { private String customerId; private String userId; + + /** + * 项目的结案时间 + * 需求的完成时间 + * 议题的关闭时间 + */ + private Date closeCaseTime; } diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/IcEventAddEditFormDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/IcEventAddEditFormDTO.java index 07d9a8bcf9..31010e536f 100644 --- a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/IcEventAddEditFormDTO.java +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/IcEventAddEditFormDTO.java @@ -5,6 +5,7 @@ import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import org.hibernate.validator.constraints.Length; +import javax.validation.Valid; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; import java.io.Serializable; @@ -83,7 +84,7 @@ public class IcEventAddEditFormDTO implements Serializable { */ private String longitude; /** - * 处理方式[0:已回复 1:已转项目 2:已转需求] + * 0:已回复 1:已转项目 2:已转需求3:转议题 */ private String operationType; /** @@ -117,4 +118,10 @@ public class IcEventAddEditFormDTO implements Serializable { private String app; private String client; + /** + * 新增事件直接转议题 + */ + @Valid + private IcEventToIssueFormDTO issueInfo; + } \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/IcEventToIssueFormDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/IcEventToIssueFormDTO.java new file mode 100644 index 0000000000..e5b99e66d7 --- /dev/null +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/IcEventToIssueFormDTO.java @@ -0,0 +1,64 @@ +package com.epmet.dto.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; +import org.hibernate.validator.constraints.Length; + +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import java.io.Serializable; +import java.util.List; + +/** + * @Description + * @Author yzm + * @Date 2022/10/9 16:46 + */ +@Data +public class IcEventToIssueFormDTO implements Serializable { + private static final long serialVersionUID = -7227815962561508949L; + + public interface AddUserInternalGroup { + } + + public interface AddUserShowGroup extends CustomerClientShowGroup { + } + + public interface AddEventAndShiftIssue extends CustomerClientShowGroup { + } + /** + * 转议题默认传3即可;0:已回复 1:已转项目 2:已转需求3:转议题 + */ + @NotBlank(message = "处理方式不能为空", groups = AddUserInternalGroup.class) + private String operationType; + + @NotBlank(message = "事件id不能为空", groups = AddUserInternalGroup.class) + private String icEventId; + + // /** + // * 二类分类Id + // */ + // private String categoryId; + + /** + * 项目所选分类集合,不可为空 + */ + @Valid + @NotEmpty(message = "事件分类不能为空", groups = AddUserShowGroup.class) + private List categoryList; + + @NotBlank(message = "议题标题不能为空", groups = {AddUserShowGroup.class, AddEventAndShiftIssue.class}) + @Length(message = "议题标题最多输入120字",max = 120,groups = {AddUserShowGroup.class, AddEventAndShiftIssue.class}) + private String issueTitle; + + @Length(message = "处理建议最多输入1000字",max = 1000,groups = {AddUserShowGroup.class, AddEventAndShiftIssue.class}) + @NotBlank(message = "处理建议不能为空", groups = {AddUserShowGroup.class, AddEventAndShiftIssue.class}) + private String suggestion; + + @NotBlank(message = "customerId不能为空", groups = {AddUserInternalGroup.class}) + private String customerId; + @NotBlank(message = "currentUserId不能为空", groups = {AddUserInternalGroup.class}) + private String currentUserId; +} + diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/IcEventListResultDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/IcEventListResultDTO.java index beac1277a0..349db1d45c 100644 --- a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/IcEventListResultDTO.java +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/IcEventListResultDTO.java @@ -117,15 +117,15 @@ public class IcEventListResultDTO implements Serializable { @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Date closeCaseTime; /** - * 0:已回复 1:已转项目 1:已转需求 + * 0:已回复 1:已转项目 2:已转需求3:转议题 */ private String operationType; /** - * 0:已回复 1:已转项目 1:已转需求 + * 0:已回复 1:已转项目 2:已转需求3:转议题 */ private String operationTypeName; /** - * 项目、需求ID + * 项目、需求ID、议题id */ private String operationId; /** diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/IcEventProcessListResultDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/IcEventProcessListResultDTO.java index 7b4b805e7e..4379252a67 100644 --- a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/IcEventProcessListResultDTO.java +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/IcEventProcessListResultDTO.java @@ -14,7 +14,7 @@ import java.util.List; public class IcEventProcessListResultDTO implements Serializable { private static final long serialVersionUID = 5762152044573235897L; - + private String issueId; /** * 项目ID */ diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/MyPubIssuesClosedResultDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/MyPubIssuesClosedResultDTO.java index 46c2c9ff02..71378156e9 100644 --- a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/MyPubIssuesClosedResultDTO.java +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/MyPubIssuesClosedResultDTO.java @@ -17,6 +17,8 @@ public class MyPubIssuesClosedResultDTO implements Serializable { * 议题id */ private String issueId; + private String sourceId; + private String sourceType; /** * 议题标题 @@ -36,11 +38,11 @@ public class MyPubIssuesClosedResultDTO implements Serializable { /** * 话题发表于哪个组 */ - private String topicReleaseGroupName; + private String topicReleaseGroupName = ""; /** * 话题发表于哪个网格 */ - private String topicReleaseGridName; + private String topicReleaseGridName = ""; } diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/MyPubIssuesShiftProjectResultDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/MyPubIssuesShiftProjectResultDTO.java index 8397d64b69..7931067f86 100644 --- a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/MyPubIssuesShiftProjectResultDTO.java +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/MyPubIssuesShiftProjectResultDTO.java @@ -45,4 +45,6 @@ public class MyPubIssuesShiftProjectResultDTO implements Serializable { private String topicReleaseGroupName; private String issueId; + private String sourceId; + private String sourceType; } diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/PendingResultDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/PendingResultDTO.java index ed9f0d8d16..a21e2f47d1 100644 --- a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/PendingResultDTO.java +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/PendingResultDTO.java @@ -1,6 +1,7 @@ package com.epmet.dto.result; -import com.fasterxml.jackson.annotation.JsonIgnore; +import com.epmet.commons.tools.dto.commondto.IcEventComDTO; +import com.epmet.commons.tools.dto.commondto.TopicInfoComDTO; import lombok.Data; import lombok.NoArgsConstructor; @@ -20,14 +21,64 @@ public class PendingResultDTO implements Serializable { private static final long serialVersionUID = 2545519820222637112L; private String issueId; private String issueTitle; + /** + * 议题转成项目时间 + */ private Long issueShiftedTime; + /** + * 话题内容 + */ private String topicContent; + /** + * 当前处理部门名称数组 + */ private List currentHandleDepartMent; + /** + * 话题语音url列表 + */ private List topicVoices; + /** + * 话题内容 + */ private List topicImgs; + /** + * 项目的来源Id(话题或议题Id) + * sourceId=议题id + */ private String sourceId; - @JsonIgnore + // @JsonIgnore private String projectId; private String longitude; private String latitude; + /** + * 项目来源: + * 来源议题 issue + * 项目立项 agency + * 旧版事件上报 resi_event + * 工作人员上报(巡查) work_event + * 新版事件上报 ic_event + */ + private String projectOrigin; + /** + * 话题id + */ + private String topicId; + + /** + * 来源类型 话题:resi_topic;直接立议题:issue; + */ + private String issueSourceType; + /** + * 发布议题的图片 + */ + private List issueImgs; + + /** + * 话题信息-2022.10.10 + */ + private TopicInfoComDTO topicInfo; + /** + * 事件信息-2022.10.10 + */ + private IcEventComDTO icEventInfo; } diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ProjectManageListResultDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ProjectManageListResultDTO.java index 7c9bb481e8..daf846a3a5 100644 --- a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ProjectManageListResultDTO.java +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ProjectManageListResultDTO.java @@ -75,7 +75,15 @@ public class ProjectManageListResultDTO implements Serializable { private Boolean processable; private Boolean returnable; - + /** + * 项目来源: + * 来源议题 issue + * 项目立项 agency + * 旧版事件上报 resi_event + * 工作人员上报(巡查) work_event + * 新版事件上报 ic_event + */ + private String origin; public ProjectManageListResultDTO() { this.gridName = ""; this.title = ""; @@ -86,5 +94,6 @@ public class ProjectManageListResultDTO implements Serializable { this.status = ""; this.departmentNameList = new ArrayList<>(); this.projectId = ""; + this.origin=""; } } diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ResolvedResultDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ResolvedResultDTO.java index 14187406e3..88ad6068c7 100644 --- a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ResolvedResultDTO.java +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ResolvedResultDTO.java @@ -1,5 +1,7 @@ package com.epmet.dto.result; +import com.epmet.commons.tools.dto.commondto.IcEventComDTO; +import com.epmet.commons.tools.dto.commondto.TopicInfoComDTO; import lombok.Data; import java.io.Serializable; @@ -13,6 +15,7 @@ import java.util.List; @Data public class ResolvedResultDTO implements Serializable { private static final long serialVersionUID = -6670213622289052352L; + private String projectId; /** * 议题Id */ @@ -53,4 +56,34 @@ public class ResolvedResultDTO implements Serializable { private String longitude; private String latitude; + /** + * 项目来源: + * 来源议题 issue + * 项目立项 agency + * 旧版事件上报 resi_event + * 工作人员上报(巡查) work_event + * 新版事件上报 ic_event + */ + private String projectOrigin; + /** + * 话题id + */ + private String topicId; + /** + * 来源类型 话题:resi_topic;直接立议题:issue; + */ + private String issueSourceType; + /** + * 发布议题的图片 + */ + private List issueImgs; + + /** + * 话题信息-2022.10.10 + */ + private TopicInfoComDTO topicInfo; + /** + * 事件信息-2022.10.10 + */ + private IcEventComDTO icEventInfo; } diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/UnResolvedResultDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/UnResolvedResultDTO.java index 53f183c389..7d65a6a6b1 100644 --- a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/UnResolvedResultDTO.java +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/UnResolvedResultDTO.java @@ -1,5 +1,7 @@ package com.epmet.dto.result; +import com.epmet.commons.tools.dto.commondto.IcEventComDTO; +import com.epmet.commons.tools.dto.commondto.TopicInfoComDTO; import lombok.Data; import java.io.Serializable; @@ -52,4 +54,36 @@ public class UnResolvedResultDTO implements Serializable { private String topicContent; private String longitude; private String latitude; + + /** + * 项目来源: + * 来源议题 issue + * 项目立项 agency + * 旧版事件上报 resi_event + * 工作人员上报(巡查) work_event + * 新版事件上报 ic_event + */ + private String projectOrigin; + /** + * 话题id + */ + private String topicId; + /** + * 来源类型 话题:resi_topic;直接立议题:issue; + */ + private String issueSourceType; + /** + * 发布议题的图片 + */ + private List issueImgs; + private String projectId; + + /** + * 话题信息-2022.10.10 + */ + private TopicInfoComDTO topicInfo; + /** + * 事件信息-2022.10.10 + */ + private IcEventComDTO icEventInfo; } diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/feign/GovProjectOpenFeignClient.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/feign/GovProjectOpenFeignClient.java index 7907ac7ec5..8220889e9e 100644 --- a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/feign/GovProjectOpenFeignClient.java +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/feign/GovProjectOpenFeignClient.java @@ -2,6 +2,7 @@ package com.epmet.feign; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.IcEventDTO; import com.epmet.dto.ProjectCategoryDTO; import com.epmet.dto.ProjectDTO; import com.epmet.dto.form.*; @@ -170,6 +171,7 @@ public interface GovProjectOpenFeignClient { /** * Desc: 需求完成/项目结案时 修改事件数据 + * 议题关闭时,如果议题来源于事件,也会调用此方法 * @author sun */ @PostMapping("gov/project/icEvent/closeprojectordemand") @@ -178,4 +180,20 @@ public interface GovProjectOpenFeignClient { @PostMapping("gov/project/project/staffpendingproject") Result> staffPendingProject(@RequestBody ProjectListFromDTO formDTO); + /** + * 批量查询事件信息 + * @param icEventIds + * @return + */ + @PostMapping("gov/project/icEvent/batchSelectById") + Result> batchSelectById(@RequestBody List icEventIds); + + /** + * @Description 议题处理进展——已转项目 + * @param formDTO + * @author zxc + */ + @PostMapping("/gov/project/projectprocess/projectprocesslist") + Result> projectProcessList(@RequestBody ProcessProjectIdFormDTO formDTO); + } diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/feign/fallback/GovProjectOpenFeignClientFallback.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/feign/fallback/GovProjectOpenFeignClientFallback.java index 51f7922ba5..bfb6d57f89 100644 --- a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/feign/fallback/GovProjectOpenFeignClientFallback.java +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/feign/fallback/GovProjectOpenFeignClientFallback.java @@ -3,6 +3,7 @@ package com.epmet.feign.fallback; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.ModuleUtils; import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.IcEventDTO; import com.epmet.dto.ProjectCategoryDTO; import com.epmet.dto.ProjectDTO; import com.epmet.dto.form.*; @@ -174,4 +175,22 @@ public class GovProjectOpenFeignClientFallback implements GovProjectOpenFeignCli public Result> staffPendingProject(ProjectListFromDTO formDTO) { return ModuleUtils.feignConError(ServiceConstant.GOV_PROJECT_SERVER, "staffPendingProject",formDTO); } + + /** + * 批量查询事件信息 + * + * @param icEventIds + * @return + */ + @Override + public Result> batchSelectById(List icEventIds) { + return ModuleUtils.feignConError(ServiceConstant.GOV_PROJECT_SERVER, "batchSelectById",icEventIds); + } + + @Override + public Result> projectProcessList(ProcessProjectIdFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.GOV_PROJECT_SERVER, "projectProcessList", formDTO); + } + + } diff --git a/epmet-module/gov-project/gov-project-server/pom.xml b/epmet-module/gov-project/gov-project-server/pom.xml index 375daa8dd2..abb978b7ce 100644 --- a/epmet-module/gov-project/gov-project-server/pom.xml +++ b/epmet-module/gov-project/gov-project-server/pom.xml @@ -219,8 +219,9 @@ callerRunsPolicy false - https://epmet-dev.elinkservice.cn/api/epmetscan/api - + + + https://epmet-open.elinkservice.cn/api/epmetscan/api https://oapi.dingtalk.com/robot/send?access_token=e894e5690f9d6a527722974c71548ff6c0fe29bd956589a09e21b16442a35ed4 diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/IcEventController.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/IcEventController.java index 5105ca27bf..c7bd63814f 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/IcEventController.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/IcEventController.java @@ -59,6 +59,12 @@ public class IcEventController { @Autowired private IcEventReplyService icEventReplyService; + /** + * 事件管理-列表 + * @param tokenDto + * @param formDTO + * @return + */ @RequestMapping("list") public Result> list(@LoginUser TokenDto tokenDto, @RequestBody IcEventListFormDTO formDTO) { formDTO.setCustomerId(tokenDto.getCustomerId()); @@ -83,6 +89,12 @@ public class IcEventController { return new Result().ok(data); } + /** + * 事件管理-新增 + * @param tokenDto + * @param formDTO + * @return + */ @NoRepeatSubmit @PostMapping("add") public Result save(@LoginUser TokenDto tokenDto, @RequestBody IcEventAddEditFormDTO formDTO){ @@ -91,6 +103,9 @@ public class IcEventController { formDTO.setUserId(tokenDto.getUserId()); formDTO.setApp(tokenDto.getApp()); formDTO.setClient(tokenDto.getClient()); + if("3".equals(formDTO.getOperationType())){ + ValidatorUtils.validateEntity(formDTO.getIssueInfo(),IcEventToIssueFormDTO.AddEventAndShiftIssue.class); + } icEventService.save(formDTO); return new Result(); } @@ -242,6 +257,21 @@ public class IcEventController { return new Result(); } + /** + * 事件转议题 + * @param tokenDto + * @param formDTO + * @return + */ + @PostMapping("icEventToIssue") + public Result icEventToIssue(@LoginUser TokenDto tokenDto, @RequestBody IcEventToIssueFormDTO formDTO) { + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setCurrentUserId(tokenDto.getUserId()); + ValidatorUtils.validateEntity(formDTO, IcEventToIssueFormDTO.AddUserShowGroup.class, IcEventToIssueFormDTO.AddUserInternalGroup.class); + icEventService.icEventToIssue(formDTO); + return new Result(); + } + /** * 事件分类分析-一级分类下事件数量 * @@ -334,6 +364,7 @@ public class IcEventController { /** * @Author sun * @Description 需求完成/项目结案时 修改事件数据 + * 议题关闭时,如果议题来源于事件,也会调用此方法 **/ @PostMapping("closeprojectordemand") public Result closeProjectOrDemand(@RequestBody ColseProjectOrDemandFormDTO formDTO) { @@ -382,7 +413,7 @@ public class IcEventController { @PostMapping("myreport-detail") public Result myReportDetail(@LoginUser TokenDto tokenDto, @RequestBody MyReportIcEvFormDTO formDTO) { formDTO.setCustomerId(tokenDto.getCustomerId()); - formDTO.setUserId(tokenDto.getUserId()); + // formDTO.setUserId(tokenDto.getUserId()); ValidatorUtils.validateEntity(formDTO, MyReportIcEvFormDTO.DetailGroup.class); return new Result().ok(icEventService.myReportDetail(formDTO)); } @@ -512,6 +543,18 @@ public class IcEventController { return new Result>().ok(icEventService.icEventPageUserReported(formDTO)); } - + /** + * 批量查询事件信息 + * + * @param icEventIds + * @return + */ + @PostMapping("batchSelectById") + public Result> batchSelectById(@RequestBody List icEventIds) { + if (CollectionUtils.isEmpty(icEventIds)) { + return new Result<>(); + } + return new Result>().ok(icEventService.batchSelectById(icEventIds)); + } } diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectController.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectController.java index 02f813b232..101a735cfe 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectController.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectController.java @@ -279,7 +279,7 @@ public class ProjectController { } /** - * 无需解决项目列表 + * 无需解决项目列表 来源于议题,已结案,无需解决的项目 * @author zhaoqifeng * @date 2021/7/27 14:55 * @param formDTO @@ -451,4 +451,16 @@ public class ProjectController { } } + /** + * 纯属为了测试.... + * 如果项目结案了,事件没有回写可以调用此方法 + * @param tokenDto + * @param projectId + * @return + */ + @PostMapping("test-close/{projectId}") + public Result testClose(@LoginUser TokenDto tokenDto,@PathVariable("projectId")String projectId){ + projectService.modifyIcEvent(null,tokenDto.getUserId(),new Date(),projectId); + return new Result(); + } } \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/IcEventCategoryDao.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/IcEventCategoryDao.java index e8829fda7a..c50f4b5fa7 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/IcEventCategoryDao.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/IcEventCategoryDao.java @@ -15,5 +15,4 @@ import org.apache.ibatis.annotations.Param; public interface IcEventCategoryDao extends BaseDao { IcEventCategoryEntity selectByEventId(@Param("icEventId") String icEventId); - } \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectDao.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectDao.java index 316fbc8de6..07786f5585 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectDao.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectDao.java @@ -189,6 +189,14 @@ public interface ProjectDao extends BaseDao { */ List selectPendingListByGrid(@Param("gridId")String gridId); + /** + * 居民端议事厅-处理中列表 + * 查询的是已经转项目的议题,这里是查询来源于议题的项目 + * @param gridId + * @return + */ + List selectPendingListByGridV2(@Param("gridId")String gridId); + /** * 获取党建声音已结案列表 * @author zhaoqifeng diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/IcEventEntity.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/IcEventEntity.java index ce8d9bdd6a..81c5635aaf 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/IcEventEntity.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/IcEventEntity.java @@ -61,9 +61,9 @@ public class IcEventEntity extends BaseEpmetEntity { */ private String idCard; - /** - * 反映渠道【字典表】 - */ + /** + * 反映渠道【字典表】dictTypeKey:ic_event_source_type;随手拍随时讲0、多媒体反应1、社区电话2、12345:3、网格员手持终端:4 + */ private String sourceType; /** @@ -102,12 +102,12 @@ public class IcEventEntity extends BaseEpmetEntity { private Date closeCaseTime; /** - * 0:已回复 1:已转项目 2:已转需求 + * 0:已回复 1:已转项目 2:已转需求3:转议题 */ private String operationType; /** - * 项目、需求ID + * 项目、需求ID、议题id */ private String operationId; diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/IcEventOperationLogEntity.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/IcEventOperationLogEntity.java index 209d70d4f3..d41ff83514 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/IcEventOperationLogEntity.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/IcEventOperationLogEntity.java @@ -48,6 +48,7 @@ public class IcEventOperationLogEntity extends BaseEpmetEntity { * 4、转需求:shift_demand * 5、办结:close_case; * 6、需求办结:close_demand + * 转议题:shift_to_issue */ private String actionCode; diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectEntity.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectEntity.java index b5199a8392..4d8163c9ae 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectEntity.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectEntity.java @@ -48,7 +48,12 @@ public class ProjectEntity extends BaseEpmetEntity { private String gridId; /** - * 来源:议题issue 项目立项:agency + * 项目来源: + * 来源议题 issue + * 项目立项 agency + * 旧版事件上报 resi_event + * 工作人员上报(巡查) work_event + * 新版事件上报 ic_event */ private String origin; diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/IcEventCategoryService.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/IcEventCategoryService.java index 90c9fd9524..fef4ca591a 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/IcEventCategoryService.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/IcEventCategoryService.java @@ -82,4 +82,12 @@ public interface IcEventCategoryService extends BaseService categoryEntities); } \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/IcEventService.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/IcEventService.java index 40a9f2e55d..d785949909 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/IcEventService.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/IcEventService.java @@ -172,6 +172,7 @@ public interface IcEventService extends BaseService { /** * @Author sun * @Description 需求完成/项目结案时 修改事件数据 + * 议题关闭时,如果议题来源于事件,也会调用此方法 **/ void closeProjectOrDemand(ColseProjectOrDemandFormDTO formDTO); @@ -225,4 +226,16 @@ public interface IcEventService extends BaseService { PageData icEventPageUserReported(PageUserReportEventFormDTO formDTO); + /** + * 事件转议题 + * @param formDTO + */ + void icEventToIssue(IcEventToIssueFormDTO formDTO); + + /** + * 批量查询事件信息 + * @param icEventIds + * @return + */ + List batchSelectById(List icEventIds); } diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectCategoryService.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectCategoryService.java index 9ae8a7fdee..4940a4fbb1 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectCategoryService.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectCategoryService.java @@ -26,6 +26,7 @@ import com.epmet.dto.form.ProjectSaveCategoryFormDTO; import com.epmet.dto.result.ProjectCategoryTagListResultDTO; import com.epmet.entity.ProjectCategoryEntity; +import java.util.Date; import java.util.List; import java.util.Map; import java.util.Set; @@ -136,4 +137,13 @@ public interface ProjectCategoryService extends BaseService> getProjectCategoryMap(List projectIds); + + /** + * 根据项目id,删除项目分类,记录删除人、删除时间 + * @param projectId + * @param userId + * @param delTime + * @return + */ + int delByProjectId(String projectId, String userId, Date delTime); } \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectService.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectService.java index 7dba649107..f588edc374 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectService.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectService.java @@ -11,6 +11,7 @@ import com.epmet.resi.mine.dto.from.MyPartProjectsFormDTO; import javax.servlet.http.HttpServletResponse; import java.io.IOException; +import java.util.Date; import java.util.List; import java.util.Map; @@ -308,7 +309,7 @@ public interface ProjectService extends BaseService { List getResolvedListByGrid(ShiftProjectListFromDTO fromDTO); /** - * 无需解决项目列表 + * 无需解决项目列表 来源于议题,已结案,无需解决的项目 * @author zhaoqifeng * @date 2021/7/27 14:40 * @param fromDTO @@ -399,11 +400,12 @@ public interface ProjectService extends BaseService { PageData orgProjectList(OrgProjectListFormDTO formDTO); /** - * desc:根据来源id和类型 删除项目 (只删了主表) + * desc:根据来源id和类型 删除项目 (只删了主表、项目分类表) * @param originId * @param origin * @return */ Integer deleteByOriginId(String originId, String origin); + void modifyIcEvent(ProjectEntity projectEntity, String userId, Date closeCaseTime, String projectId); } diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/IcEventCategoryServiceImpl.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/IcEventCategoryServiceImpl.java index c1d4d6fac9..52a8b13be1 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/IcEventCategoryServiceImpl.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/IcEventCategoryServiceImpl.java @@ -1,21 +1,26 @@ package com.epmet.service.impl; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.user.LoginUserUtil; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.dao.IcEventCategoryDao; import com.epmet.dto.IcEventCategoryDTO; import com.epmet.entity.IcEventCategoryEntity; import com.epmet.service.IcEventCategoryService; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.Arrays; +import java.util.Date; import java.util.List; import java.util.Map; @@ -27,7 +32,8 @@ import java.util.Map; */ @Service public class IcEventCategoryServiceImpl extends BaseServiceImpl implements IcEventCategoryService { - + @Autowired + private LoginUserUtil loginUserUtil; @Override public PageData page(Map params) { @@ -86,4 +92,18 @@ public class IcEventCategoryServiceImpl extends BaseServiceImpl categoryEntities) { + LambdaUpdateWrapper wrapper = new LambdaUpdateWrapper(); + wrapper.eq(IcEventCategoryEntity::getIcEventId,icEventId) + .set(IcEventCategoryEntity::getUpdatedTime,new Date()) + .set(IcEventCategoryEntity::getUpdatedBy,loginUserUtil.getLoginUserId()) + .set(IcEventCategoryEntity::getDelFlag, NumConstant.ONE_STR); + baseDao.update(null,wrapper); + if(CollectionUtils.isNotEmpty(categoryEntities)){ + this.insertBatch(categoryEntities); + } + } + } \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/IcEventServiceImpl.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/IcEventServiceImpl.java index dda3a90647..b37344a620 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/IcEventServiceImpl.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/IcEventServiceImpl.java @@ -1,5 +1,6 @@ package com.epmet.service.impl; +import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.toolkit.IdWorker; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; @@ -182,6 +183,10 @@ public class IcEventServiceImpl extends BaseServiceImpl issueRes=govIssueOpenFeignClient.publishIssue(issueFormDTO); + if (!issueRes.success() || null == issueRes.getData()) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "事件转议题异常,返参:" + JSON.toJSONString(issueRes), "事件转议题异常"); + } + formDTO.setOperationId(issueRes.getData().getIssueId()); + } //3.新增事件数据、附件数据、分类数据、回复数据、操作记录数据 //3-1.事件数据保存 @@ -282,7 +317,7 @@ public class IcEventServiceImpl extends BaseServiceImpl resultDTOResult = govIssueOpenFeignClient.getCategoryTagList(categoryTag); - if (!resultDTOResult.success()) { - throw new RenException("项目立项,调用issue服务查询分类、标签基础信息失败"); + if (!resultDTOResult.success() || CollectionUtils.isEmpty(resultDTOResult.getData().getCategoryList())) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "调用issue服务查询分类基础信息失败", "分类信息查询异常"); } return resultDTOResult.getData(); } @@ -390,7 +429,7 @@ public class IcEventServiceImpl extends BaseServiceImpl effectRow = epmetHeartOpenFeignClient.deleteUserDemandByOriginId(entity.getId(), ProjectOriginEnum.IC_EVENT.getCode()); - log.info("delete userDemand result:{},eventId:{}", effectRow, id); + // log.info("delete userDemand result:{},eventId:{}", effectRow, id); + } else if(NumConstant.THREE_STR.equals(entity.getOperationType())){ + DelIssueFormDTO delIssueFormDTO = new DelIssueFormDTO(); + delIssueFormDTO.setCustomerId(loginUserUtil.getLoginUserCustomerId()); + delIssueFormDTO.setUserId(loginUserUtil.getLoginUserId()); + delIssueFormDTO.setIssueIds(Arrays.asList(entity.getOperationId())); + // 删除议题, 议题转了项目的,再单独去删除项目 + Result> delIssueRes = govIssueOpenFeignClient.deleteIssueInternal(delIssueFormDTO); + if(delIssueRes.success()&&!CollectionUtils.isEmpty(delIssueRes.getData())){ + // 议题被转了项目,需要删除项目 + SpringContextUtils.getBean(ProjectService.class).deleteByOriginId(delIssueRes.getData().get(0), ProjectOriginEnum.ISSUE.getCode()); + } } LambdaUpdateWrapper wrapper = new LambdaUpdateWrapper(); wrapper.eq(IcEventEntity::getId,id).set(IcEventEntity::getUpdatedTime,new Date()) - .set(IcEventEntity::getCreatedBy,loginUserUtil.getLoginUserId()) + .set(IcEventEntity::getUpdatedBy,loginUserUtil.getLoginUserId()) .set(IcEventEntity::getDelFlag,NumConstant.ONE_STR); baseDao.update(null,wrapper); + //把事件分类ic_event_category也删除了吧,以免后面数据分析用到这个表 + icEventCategoryService.delInsert(id,null); } } @@ -1048,58 +1105,58 @@ public class IcEventServiceImpl extends BaseServiceImpl list = baseDao.icEventList(formDTO); - if (!CollectionUtils.isEmpty(list)) { - resultDTO = list.get(0); - //查询网格名称(组织-网格) - List gridIds = list.stream().map(IcEventListResultDTO::getGridId).collect(Collectors.toList()).stream().distinct().collect(Collectors.toList()); - Result> gridInfoRes = govOrgOpenFeignClient.getGridListByGridIds(gridIds); - List gridInfoList = gridInfoRes.success() && !org.apache.commons.collections4.CollectionUtils.isEmpty(gridInfoRes.getData()) ? gridInfoRes.getData() : new ArrayList<>(); - Map gridInfoMap = gridInfoList.stream().collect(Collectors.toMap(AllGridsByUserIdResultDTO::getGridId, AllGridsByUserIdResultDTO::getGridName, (key1, key2) -> key2)); - - //事件管理字典表数据 - Result> statusRes = adminOpenFeignClient.dictMap(DictTypeEnum.IC_EVENT_SOURCE_TYPE.getCode()); - Map statusMap = statusRes.success() && MapUtils.isNotEmpty(statusRes.getData()) ? statusRes.getData() : new HashMap<>(); - - //封装数据 - if (gridInfoMap.containsKey(resultDTO.getGridId())) { - resultDTO.setGridName(gridInfoMap.get(resultDTO.getGridId())); - } - if (StringUtils.isNotBlank(resultDTO.getSourceType())) { - resultDTO.setSourceTypeName(statusMap.get(resultDTO.getSourceType())); - } - //每个事件对应的图片数据 - if(!CollectionUtils.isEmpty(resultDTO.getAttachmentList())){ - List imageList = new ArrayList<>(); - List voiceList = new ArrayList<>(); - resultDTO.getAttachmentList().forEach(file -> { - if ("image".equals(file.getType())) { - imageList.add(file.getUrl()); - } else if ("voice".equals(file.getType())) { - voiceList.add(file); - } - }); - resultDTO.setImageList(imageList); - resultDTO.setVoiceList(voiceList); - } + if(CollectionUtils.isEmpty(list)){ + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"事件不存在","事件已删除"); + } + resultDTO = list.get(0); + //查询网格名称(组织-网格) + List gridIds = list.stream().map(IcEventListResultDTO::getGridId).collect(Collectors.toList()).stream().distinct().collect(Collectors.toList()); + Result> gridInfoRes = govOrgOpenFeignClient.getGridListByGridIds(gridIds); + List gridInfoList = gridInfoRes.success() && !org.apache.commons.collections4.CollectionUtils.isEmpty(gridInfoRes.getData()) ? gridInfoRes.getData() : new ArrayList<>(); + Map gridInfoMap = gridInfoList.stream().collect(Collectors.toMap(AllGridsByUserIdResultDTO::getGridId, AllGridsByUserIdResultDTO::getGridName, (key1, key2) -> key2)); + + //事件管理字典表数据 + Result> statusRes = adminOpenFeignClient.dictMap(DictTypeEnum.IC_EVENT_SOURCE_TYPE.getCode()); + Map statusMap = statusRes.success() && MapUtils.isNotEmpty(statusRes.getData()) ? statusRes.getData() : new HashMap<>(); + + //封装数据 + if (gridInfoMap.containsKey(resultDTO.getGridId())) { + resultDTO.setGridName(gridInfoMap.get(resultDTO.getGridId())); + } + if (StringUtils.isNotBlank(resultDTO.getSourceType())) { + resultDTO.setSourceTypeName(statusMap.get(resultDTO.getSourceType())); + } + //每个事件对应的图片数据 + if(!CollectionUtils.isEmpty(resultDTO.getAttachmentList())){ + List imageList = new ArrayList<>(); + List voiceList = new ArrayList<>(); + resultDTO.getAttachmentList().forEach(file -> { + if ("image".equals(file.getType())) { + imageList.add(file.getUrl()); + } else if ("voice".equals(file.getType())) { + voiceList.add(file); + } + }); + resultDTO.setImageList(imageList); + resultDTO.setVoiceList(voiceList); + } - //分类信息 - if(StringUtils.isNotBlank(resultDTO.getCategoryId())){ - List categoryList = new ArrayList<>(); - categoryList.add(resultDTO.getCategoryId()); - CategoryTagResultDTO category = queryCategory(formDTO.getCustomerId(), categoryList); - for (IssueProjectCategoryDictDTO ca : category.getCategoryList()){ - if (ca.getId().equals(resultDTO.getCategoryId())) { - resultDTO.setParentCategoryId(ca.getPid()); - resultDTO.setCategoryId(ca.getId()); - resultDTO.setParentCategoryCode(ca.getParentCategoryCode()); - resultDTO.setCategoryCode(ca.getCategoryCode()); - resultDTO.setParentCategoryName(ca.getParentCategoryName()); - resultDTO.setCategoryName(ca.getCategoryName()); - } + //分类信息 + if(StringUtils.isNotBlank(resultDTO.getCategoryId())){ + List categoryList = new ArrayList<>(); + categoryList.add(resultDTO.getCategoryId()); + CategoryTagResultDTO category = queryCategory(formDTO.getCustomerId(), categoryList); + for (IssueProjectCategoryDictDTO ca : category.getCategoryList()){ + if (ca.getId().equals(resultDTO.getCategoryId())) { + resultDTO.setParentCategoryId(ca.getPid()); + resultDTO.setCategoryId(ca.getId()); + resultDTO.setParentCategoryCode(ca.getParentCategoryCode()); + resultDTO.setCategoryCode(ca.getCategoryCode()); + resultDTO.setParentCategoryName(ca.getParentCategoryName()); + resultDTO.setCategoryName(ca.getCategoryName()); } } } - return resultDTO; } @@ -1201,49 +1258,82 @@ public class IcEventServiceImpl extends BaseServiceImpl event = icEventReplyService.getByEventId(formDTO.getIcEventId()); - - //3.判断查询事件项目进展或需求进展信息 - //项目进展 + // operationType 0:已回复 1:已转项目 2:已转需求3:转议题 + //2.判断查询事件项目进展或需求进展信息或者议题进展 if ("1".equals(entity.getOperationType())) { + // 项目进展 ProcessListV2FormDTO processListV2FormDTO = new ProcessListV2FormDTO(); processListV2FormDTO.setProjectId(entity.getOperationId()); List project = projectTraceService.processListV2(processListV2FormDTO); List projectList = ConvertUtils.sourceToTarget(project, IcEventProcessListResultDTO.class); - projectList.forEach(p->p.setType("project")); + projectList.forEach(p -> p.setType("project")); resultList.addAll(projectList); - } - //需求进展 - if ("2".equals(entity.getOperationType())) { + } else if ("2".equals(entity.getOperationType())) { + // 需求进展 LinkedList demand = icEventOperationLogService.getByEventId(formDTO.getIcEventId()); resultList.addAll(demand); + } else if ("3".equals(entity.getOperationType())) { + // 议题处理进展 + IssueIdFormDTO issueIdFormDTO = new IssueIdFormDTO(); + issueIdFormDTO.setIssueId(entity.getOperationId()); + Result issueProcessRes = govIssueOpenFeignClient.queryIssueProcess(issueIdFormDTO); + if(!issueProcessRes.success()||CollectionUtils.isEmpty(issueProcessRes.getData().getProcessList())){ + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "事件已转议题,议题处理进展查询异常", "事件已转议题,议题处理进展查询异常"); + } + IssueAdvanceResDTO issueAdvanceResDTO=issueProcessRes.getData(); + //如果议题已转项目,先放项目的处理进展 + if("shift_project".equals(issueAdvanceResDTO.getIssueStatus())){ + //根据议题id查询项目 + List projectEntityList=SpringContextUtils.getBean(ProjectService.class).getByOriginId(issueAdvanceResDTO.getIssueId()); + if(!CollectionUtils.isEmpty(projectEntityList)){ + // 项目进展 + ProcessListV2FormDTO processListV2FormDTO = new ProcessListV2FormDTO(); + processListV2FormDTO.setProjectId(projectEntityList.get(0).getId()); + List project = projectTraceService.processListV2(processListV2FormDTO); + List projectList = ConvertUtils.sourceToTarget(project, IcEventProcessListResultDTO.class); + projectList.forEach(p -> p.setType("project")); + resultList.addAll(projectList); + } + } + for(ProcessListResultDTOBak issueProcess:issueAdvanceResDTO.getProcessList()){ + IcEventProcessListResultDTO eventProcess=new IcEventProcessListResultDTO(); + eventProcess.setDepartmentName(issueProcess.getDepartmentName()); + eventProcess.setProcessId(issueProcess.getProcessId()); + eventProcess.setProcessName(issueProcess.getProcessName()); + eventProcess.setProcessTime(issueProcess.getProcessTime()); + eventProcess.setPublicReply(issueProcess.getProgressDesc()); + eventProcess.setIssueId(issueAdvanceResDTO.getIssueId()); + eventProcess.setType(issueProcess.getType()); + resultList.add(eventProcess); + } } + //最后拼上回复的!!!!!!!!!!!! + //3.查询事件回复信息 + LinkedList event = icEventReplyService.getByEventId(formDTO.getIcEventId()); resultList.addAll(event); - return resultList; } /** * @Author sun * @Description 需求完成/项目结案时 修改事件数据 + * 议题关闭时,如果议题来源于事件,也会调用此方法 **/ @Override public void closeProjectOrDemand(ColseProjectOrDemandFormDTO formDTO) { //1.查询事件数据 IcEventEntity entity = baseDao.selectById(formDTO.getIcEventId()); if (null == entity || "closed_case".equals(entity.getStatus())) { - logger.error(String.format("事件不存在或已办结不允许修改,事件Id->%s", formDTO.getIcEventId())); + logger.warn(String.format("事件不存在或已办结不允许修改,事件Id->%s", formDTO.getIcEventId())); throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "事件不存在或已办结不允许修改"); } //2.修改事件数据 entity.setStatus("closed_case"); - entity.setCloseCaseTime(new Date()); - entity.setLatestOperatedTime(new Date()); + entity.setCloseCaseTime(formDTO.getCloseCaseTime()); + entity.setLatestOperatedTime(formDTO.getCloseCaseTime()); entity.setDifficultPoint("0"); baseDao.updateById(entity); @@ -1255,7 +1345,31 @@ public class IcEventServiceImpl extends BaseServiceImpl + // AND ie.REPORT_USER_ID = #{userId} + // List list=baseDao.selectMyReport(formDTO); + if(CollectionUtils.isEmpty(list)){ + return null; + } if (!CollectionUtils.isEmpty(list)) { //封装数据 for (MyReportIcEvResDTO dto : list) { @@ -1672,4 +1792,94 @@ public class IcEventServiceImpl extends BaseServiceImpl(pageInfo.getList(), pageInfo.getTotal()); } + /** + * 事件转议题 + * + * @param formDTO + */ + @Transactional(rollbackFor = Exception.class) + @Override + public void icEventToIssue(IcEventToIssueFormDTO formDTO) { + //校验下数据 + IcEventEntity icEventEntity=baseDao.selectById(formDTO.getIcEventId()); + if (null == icEventEntity || !"processing".equals(icEventEntity.getStatus())) { + log.error(String.format("事件不存在icEventId:%s",formDTO.getIcEventId())); + return; + } + //查询分类信息 + List categoryIdList = formDTO.getCategoryList().stream().map(CategoryOrTagFormDTO::getId).collect(Collectors.toList()); + CategoryTagResultDTO category = queryCategory(formDTO.getCustomerId(), categoryIdList); + Date nowTime = new Date(); + //调用issue服务转议题 + PublishIssueFormDTO issueFormDTO=new PublishIssueFormDTO(); + issueFormDTO.setIssueStatus("voting"); + issueFormDTO.setAddress(icEventEntity.getAddress()); + issueFormDTO.setLatitude(icEventEntity.getLatitude()); + issueFormDTO.setLongitude(icEventEntity.getLongitude()); + issueFormDTO.setIssueTitle(formDTO.getIssueTitle()); + issueFormDTO.setSuggestion(formDTO.getSuggestion()); + issueFormDTO.setGridId(icEventEntity.getGridId()); + issueFormDTO.setOrgId(icEventEntity.getAgencyId()); + issueFormDTO.setOrgIdPath(icEventEntity.getGridPids()); + issueFormDTO.setSourceType("ic_event"); + issueFormDTO.setSourceId(icEventEntity.getId()); + issueFormDTO.setCustomerId(formDTO.getCustomerId()); + issueFormDTO.setCreatedBy(formDTO.getCurrentUserId()); + issueFormDTO.setUpdatedBy(formDTO.getCurrentUserId()); + issueFormDTO.setCreatedTime(nowTime); + issueFormDTO.setUpdatedTime(nowTime); + issueFormDTO.setDecidedTime(nowTime); + issueFormDTO.setEventReportUserName(icEventEntity.getName()); + Result issueRes=govIssueOpenFeignClient.publishIssue(issueFormDTO); + if (!issueRes.success() || null == issueRes.getData()) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "事件转议题异常,返参:" + JSON.toJSONString(issueRes), "事件转议题异常"); + } + //校验通过之后..... + //1、修改事件相关信息 + icEventEntity.setOperationType(formDTO.getOperationType()); + icEventEntity.setOperationId(issueRes.getData().getIssueId()); + if("0".equals(icEventEntity.getSourceType())){ + //来源于随手拍的,居民端需要显示红点 + icEventEntity.setRedDot(NumConstant.ONE); + } + icEventEntity.setLatestOperatedTime(nowTime); + icEventEntity.setUpdatedTime(nowTime); + baseDao.updateById(icEventEntity); + //2、插入事件分类表 ic_event_category + //分类全删全增吧 + List categoryEntities=new ArrayList<>(); + for (IssueProjectCategoryDictDTO ca : category.getCategoryList()){ + IcEventCategoryEntity icEventCategoryEntity=new IcEventCategoryEntity(); + icEventCategoryEntity.setCustomerId(formDTO.getCustomerId()); + icEventCategoryEntity.setIcEventId(formDTO.getIcEventId()); + icEventCategoryEntity.setCategoryId(ca.getId()); + icEventCategoryEntity.setCategoryPids(ca.getPids()); + icEventCategoryEntity.setCategoryCode(ca.getCategoryCode()); + categoryEntities.add(icEventCategoryEntity); + } + icEventCategoryService.delInsert(formDTO.getIcEventId(),categoryEntities); + //3、插入操作日志表 ic_event_operation_log + IcEventOperationLogEntity logEntity = new IcEventOperationLogEntity(); + logEntity.setCustomerId(formDTO.getCustomerId()); + logEntity.setIcEventId(formDTO.getIcEventId()); + logEntity.setUserId(formDTO.getCurrentUserId()); + logEntity.setUserIdentity("staff"); + logEntity.setActionCode("shift_to_issue"); + logEntity.setActionDesc("转议题"); + logEntity.setOperateTime(nowTime); + icEventOperationLogService.insert(logEntity); + } + + /** + * 批量查询事件信息 + * + * @param icEventIds + * @return + */ + @Override + public List batchSelectById(List icEventIds) { + Listlist=baseDao.selectBatchIds(icEventIds); + return ConvertUtils.sourceToTarget(list,IcEventDTO.class); + } + } diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectCategoryServiceImpl.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectCategoryServiceImpl.java index 91d609d8e2..4caf803355 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectCategoryServiceImpl.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectCategoryServiceImpl.java @@ -19,6 +19,7 @@ package com.epmet.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.FieldConstant; @@ -244,4 +245,20 @@ public class ProjectCategoryServiceImpl extends BaseServiceImpl wrapper = new LambdaUpdateWrapper(); + wrapper.eq(ProjectCategoryEntity::getProjectId, projectId) + .set(ProjectCategoryEntity::getUpdatedTime,delTime) + .set(ProjectCategoryEntity::getUpdatedBy,userId) + .set(ProjectCategoryEntity::getDelFlag,NumConstant.ONE_STR); + return baseDao.update(null, wrapper); + } } \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectProcessServiceImpl.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectProcessServiceImpl.java index b8b01aa5b9..4ab41b17a6 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectProcessServiceImpl.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectProcessServiceImpl.java @@ -725,7 +725,8 @@ public class ProjectProcessServiceImpl extends BaseServiceImpl issueIds = new ArrayList<>(); + issueIds.add(projectEntity.getOriginId()); + Result> issueRes = govIssueOpenFeignClient.getIssueProfile(issueIds); + if (issueRes.success() && CollectionUtils.isNotEmpty(issueRes.getData())) { + IssueProfileDTO issueProfileDTO = issueRes.getData().get(NumConstant.ZERO); + if ("ic_event".equals(issueProfileDTO.getIssueSourceType())) { + icEventFlag = true; + icEventId = issueProfileDTO.getSourceId(); + } + } + } else if ("ic_event".equals(projectEntity.getOrigin())) { + icEventId = projectEntity.getOriginId(); + } + if ("ic_event".equals(projectEntity.getOrigin()) || icEventFlag) { ColseProjectOrDemandFormDTO dto = new ColseProjectOrDemandFormDTO(); - dto.setCustomerId(fromDTO.getCustomerId()); - dto.setUserId(fromDTO.getUserId()); - dto.setIcEventId(projectEntity.getOriginId()); + dto.setCustomerId(projectEntity.getCustomerId()); + dto.setUserId(userId); + dto.setIcEventId(icEventId); dto.setType("project"); + dto.setCloseCaseTime(closeCaseTime); icEventService.closeProjectOrDemand(dto); } - //2022-5-19 sun end - } @Override @@ -1185,9 +1221,15 @@ public class ProjectServiceImpl extends BaseServiceImpl list = new ArrayList<>(); - ProjectRelatedPersonnelEntity entity1 = new ProjectRelatedPersonnelEntity(); - entity1.setCustomerId(issueDTO.getCustomerId()); - entity1.setProjectId(projectEntity.getId()); - entity1.setApp(AppClientConstant.APP_RESI); - entity1.setGridId(issueDTO.getGridId()); - entity1.setUserId(formDTO.getTopicDTO().getCreatedBy()); - entity1.setSourceType(AppClientConstant.TOPIC); - entity1.setSourceId(formDTO.getTopicDTO().getId()); - ProjectRelatedPersonnelEntity entity2 = ConvertUtils.sourceToTarget(entity1,ProjectRelatedPersonnelEntity.class); - entity2.setUserId(issueDTO.getCreatedBy()); - entity2.setSourceType(AppClientConstant.ISSUE); - entity2.setSourceId(issueDTO.getId()); - list.add(entity1); - list.add(entity2); + if("resi_topic".equals(formDTO.getIssueDTO().getSourceType())){ + //话题 + ProjectRelatedPersonnelEntity topic = new ProjectRelatedPersonnelEntity(); + topic.setCustomerId(issueDTO.getCustomerId()); + topic.setProjectId(projectEntity.getId()); + topic.setApp(AppClientConstant.APP_RESI); + topic.setGridId(issueDTO.getGridId()); + topic.setUserId(formDTO.getTopicDTO().getCreatedBy()); + topic.setSourceType(AppClientConstant.TOPIC); + topic.setSourceId(formDTO.getTopicDTO().getId()); + list.add(topic); + //议题 + ProjectRelatedPersonnelEntity issue = ConvertUtils.sourceToTarget(topic,ProjectRelatedPersonnelEntity.class); + issue.setUserId(issueDTO.getCreatedBy()); + issue.setSourceType(AppClientConstant.ISSUE); + issue.setSourceId(issueDTO.getId()); + list.add(issue); + }else{ + //只插入议题 + ProjectRelatedPersonnelEntity issue = new ProjectRelatedPersonnelEntity(); + issue.setCustomerId(issueDTO.getCustomerId()); + issue.setProjectId(projectEntity.getId()); + issue.setApp(AppClientConstant.APP_RESI); + issue.setGridId(issueDTO.getGridId()); + issue.setUserId(formDTO.getIssueDTO().getCreatedBy()); + issue.setSourceType(AppClientConstant.ISSUE); + issue.setSourceId(formDTO.getIssueDTO().getId()); + list.add(issue); + } projectRelatedPersonnelService.insertBatch(list); //项目分类和标签表初始数据 @@ -2219,7 +2276,7 @@ public class ProjectServiceImpl extends BaseServiceImpl(), null); } catch (Exception e) { String errorMsg = ExceptionUtils.getThrowableErrorStackTrace(e); - log.error("【项目流转】上链失败,错误信息:{}", errorMsg); + log.warn("【项目流转】上链失败,错误信息:{}", errorMsg); } } @@ -2883,8 +2941,10 @@ public class ProjectServiceImpl extends BaseServiceImpl getPendingList(ShiftProjectListFromDTO fromDTO) { + // PageInfo result = + // PageHelper.startPage(fromDTO.getPageNo(), fromDTO.getPageSize(), fromDTO.getIsPage()).doSelectPageInfo(() -> baseDao.selectPendingListByGrid(fromDTO.getGridId())); PageInfo result = - PageHelper.startPage(fromDTO.getPageNo(), fromDTO.getPageSize(), fromDTO.getIsPage()).doSelectPageInfo(() -> baseDao.selectPendingListByGrid(fromDTO.getGridId())); + PageHelper.startPage(fromDTO.getPageNo(), fromDTO.getPageSize(), fromDTO.getIsPage()).doSelectPageInfo(() -> baseDao.selectPendingListByGridV2(fromDTO.getGridId())); if (CollectionUtils.isNotEmpty(result.getList())) { result.getList().forEach(item -> { ProjectDTO dto = new ProjectDTO(); @@ -2919,6 +2979,7 @@ public class ProjectServiceImpl extends BaseServiceImpl getUnResolvedListByGrid(ShiftProjectListFromDTO fromDTO) { + //来源于议题,已结案,无需解决的项目 return baseDao.selectUnResolvedListByGrid(fromDTO.getGridId()); } @@ -3563,16 +3624,31 @@ public class ProjectServiceImpl extends BaseServiceImpl(list, pageInfo.getTotal()); } + /** + * 根据项目来源id, 删除项目主表,项目分类关系表 + * @param originId + * @param origin + * @return + */ + @Transactional(rollbackFor = Exception.class) @Override public Integer deleteByOriginId(String originId, String origin) { - LambdaUpdateWrapper wrapper = new LambdaUpdateWrapper(); - wrapper.eq(ProjectEntity::getOriginId, originId) - .eq(ProjectEntity::getOrigin,origin) - .set(ProjectEntity::getUpdatedTime,new Date()) - .set(ProjectEntity::getCreatedBy,loginUserUtil.getLoginUserId()) - .set(ProjectEntity::getDelFlag,NumConstant.ONE_STR); - return baseDao.update(null, wrapper); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper(); + queryWrapper.eq(ProjectEntity::getOriginId, originId) + .eq(ProjectEntity::getOrigin, origin); + ProjectEntity projectEntity = baseDao.selectOne(queryWrapper); + if (null != projectEntity) { + Date nowTime = new Date(); + LambdaUpdateWrapper wrapper = new LambdaUpdateWrapper(); + wrapper.eq(ProjectEntity::getId, projectEntity.getId()) + .set(ProjectEntity::getUpdatedTime, nowTime) + .set(ProjectEntity::getUpdatedBy, loginUserUtil.getLoginUserId()) + .set(ProjectEntity::getDelFlag, NumConstant.ONE_STR); + baseDao.update(null, wrapper); + projectCategoryService.delByProjectId(projectEntity.getId(), loginUserUtil.getLoginUserId(), nowTime); + return 1; + } + return 0; } - } diff --git a/epmet-module/gov-project/gov-project-server/src/main/resources/db/migration/V0.0.27__icevent_to_issue.sql b/epmet-module/gov-project/gov-project-server/src/main/resources/db/migration/V0.0.27__icevent_to_issue.sql new file mode 100644 index 0000000000..c372ca3cee --- /dev/null +++ b/epmet-module/gov-project/gov-project-server/src/main/resources/db/migration/V0.0.27__icevent_to_issue.sql @@ -0,0 +1,6 @@ +ALTER TABLE ic_event MODIFY COLUMN `OPERATION_TYPE` CHAR ( 1 ) DEFAULT NULL COMMENT '0:已回复 1:已转项目 2:已转需求3:转议题'; +ALTER TABLE ic_event MODIFY COLUMN `OPERATION_ID` VARCHAR ( 32 ) DEFAULT NULL COMMENT '项目、需求ID、议题id'; + +alter TABLE ic_event_operation_log MODIFY COLUMN `ACTION_CODE` varchar(32) NOT NULL COMMENT '1、发布事件:add\r\n2、复:reply;3、立项:shift_project;4、转需求:shift_demand5、办结:close_case;6、需求办结:close_demand;转议题:shift_to_issue;项目结案:project_closed;议题关闭:close_issue'; + +alter TABLE ic_event_operation_log MODIFY COLUMN `ACTION_DESC` varchar(32) NOT NULL COMMENT '1、发布事件:publish;2、撤回事件:recall;n3、复:reply;n4、立项:shift_project;5、转需求: shift_demand;6、办结:close_case;7、需求办结:close_demand;8、选择是否已解决:choose_resolve;9、首次查看阅读事件:read_first:人大代表未读=>已读;工作人员待处理=>处理中;转议题:shift_to_issue;项目结案:project_closed;议题关闭:close_issue'; diff --git a/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/IcEventCategoryDao.xml b/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/IcEventCategoryDao.xml index afb3965750..a5343119cf 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/IcEventCategoryDao.xml +++ b/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/IcEventCategoryDao.xml @@ -17,5 +17,4 @@ del_flag = '0' AND ic_event_id = #{icEventId} - \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/IcEventDao.xml b/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/IcEventDao.xml index b0d42f5b0e..bd7853c4e0 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/IcEventDao.xml +++ b/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/IcEventDao.xml @@ -170,7 +170,14 @@ ie.satisfaction, IF(ie.satisfaction = 'bad','不满意',IF (ie.satisfaction = 'good','基本满意',IF (ie.satisfaction = 'perfect','非常满意',''))) satisfactionName, ie.operation_type, - IF(ie.operation_type = '0','已回复',IF (ie.operation_type = '1','已转项目',IF (ie.operation_type = '2','已转需求',''))) operationTypeName, + ( + case when ie.operation_type = '0' then '已回复' + when ie.operation_type = '1' then '已转项目' + when ie.operation_type = '2' then '已转需求' + when ie.operation_type = '3' then '已转议题' + else '' + end + )as operationTypeName, ie.operation_id, ie.read_flag, ie.red_dot, diff --git a/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectDao.xml b/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectDao.xml index 73c2f11384..b57ebeca72 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectDao.xml +++ b/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectDao.xml @@ -336,18 +336,47 @@ AND a.ORIGIN = 'issue' ORDER BY a.CREATED_TIME DESC + + + + + + + + select * FROM customer_staff + WHERE del_flag = '0' + AND enable_flag = 'enable' + AND customer_id = #{customerId} + diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/DataSyncRecordDisabilityDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/DataSyncRecordDisabilityDao.xml index bca57f359e..1d16260551 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/DataSyncRecordDisabilityDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/DataSyncRecordDisabilityDao.xml @@ -112,7 +112,7 @@ when id = #{item.id} then '处理失败' - when id = #{item.id} then '处理成功' + when id = #{item.id} then '' diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/RegisterRelationDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/RegisterRelationDao.xml index 3ce51f018a..c43cea28cc 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/RegisterRelationDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/RegisterRelationDao.xml @@ -87,5 +87,15 @@ SELECT * FROM register_relation WHERE DEL_FLAG = 0 AND USER_ID = #{userId} + + +