diff --git a/epmet-auth-client/pom.xml b/epmet-auth-client/pom.xml index 1aee53c24e..cdb0519c0d 100644 --- a/epmet-auth-client/pom.xml +++ b/epmet-auth-client/pom.xml @@ -10,5 +10,13 @@ 4.0.0 epmet-auth-client + + + com.epmet + epmet-commons-tools + 2.0.0 + compile + + - \ No newline at end of file + diff --git a/epmet-auth-client/src/main/java/com/epmet/auth/feign/EpmetAuthOpenFeignClient.java b/epmet-auth-client/src/main/java/com/epmet/auth/feign/EpmetAuthOpenFeignClient.java new file mode 100644 index 0000000000..6a510ffcd8 --- /dev/null +++ b/epmet-auth-client/src/main/java/com/epmet/auth/feign/EpmetAuthOpenFeignClient.java @@ -0,0 +1,32 @@ +package com.epmet.auth.feign; + +import com.epmet.auth.feign.fallback.EpmetAuthOpenFeignClientFallbackFactory; +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.utils.Result; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestParam; + +/** + * 本服务对外开放的API,其他服务通过引用此client调用该服务 + * + * @author yinzuomei@elink-cn.com + * @date 2020/6/4 13:25 + */ +@FeignClient(name = ServiceConstant.EPMET_AUTH_SERVER, fallbackFactory = EpmetAuthOpenFeignClientFallbackFactory.class) +//@FeignClient(name = ServiceConstant.EPMET_AUTH_SERVER, fallbackFactory = EpmetAuthOpenFeignClientFallbackFactory.class, url = "http://localhost:8081") +public interface EpmetAuthOpenFeignClient { + + /** + * @Description 根据客户Id查询志愿者用户Id集合 + * @param uuid + * @param userId + * @param customerId + * @return + * @author wangc + * @date 2020.08.13 10:22 + **/ + @PostMapping("/auth/govweb/generateTokenBySSOKey/{uuid}/{userId}") + Result generateTokenBySSOKey(@PathVariable(value = "uuid")String uuid, @PathVariable String userId, @RequestParam String customerId); +} diff --git a/epmet-auth-client/src/main/java/com/epmet/auth/feign/fallback/EpmetAuthOpenFeignClientFallback.java b/epmet-auth-client/src/main/java/com/epmet/auth/feign/fallback/EpmetAuthOpenFeignClientFallback.java new file mode 100644 index 0000000000..8760185fb4 --- /dev/null +++ b/epmet-auth-client/src/main/java/com/epmet/auth/feign/fallback/EpmetAuthOpenFeignClientFallback.java @@ -0,0 +1,20 @@ +package com.epmet.auth.feign.fallback; + +import com.epmet.auth.feign.EpmetAuthOpenFeignClient; +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.utils.ModuleUtils; +import com.epmet.commons.tools.utils.Result; + +/** + * 本服务对外开放的API,其他服务通过引用此client调用该服务 + * + * @author yinzuomei@elink-cn.com + * @date 2020/6/4 13:26 + */ +public class EpmetAuthOpenFeignClientFallback implements EpmetAuthOpenFeignClient { + @Override + public Result generateTokenBySSOKey(String uuid, String userId, String customerId) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_AUTH_SERVER, "generateTokenBySSOKey", uuid, userId,customerId); + } + +} diff --git a/epmet-auth-client/src/main/java/com/epmet/auth/feign/fallback/EpmetAuthOpenFeignClientFallbackFactory.java b/epmet-auth-client/src/main/java/com/epmet/auth/feign/fallback/EpmetAuthOpenFeignClientFallbackFactory.java new file mode 100644 index 0000000000..728ba4072b --- /dev/null +++ b/epmet-auth-client/src/main/java/com/epmet/auth/feign/fallback/EpmetAuthOpenFeignClientFallbackFactory.java @@ -0,0 +1,20 @@ +package com.epmet.auth.feign.fallback; + +import com.epmet.auth.feign.EpmetAuthOpenFeignClient; +import com.epmet.commons.tools.exception.ExceptionUtils; +import feign.hystrix.FallbackFactory; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +@Component +@Slf4j +public class EpmetAuthOpenFeignClientFallbackFactory implements FallbackFactory { + + private EpmetAuthOpenFeignClientFallback fallback = new EpmetAuthOpenFeignClientFallback(); + + @Override + public EpmetAuthOpenFeignClient create(Throwable cause) { + log.error(String.format("FeignClient调用发生异常,异常信息:%s", ExceptionUtils.getThrowableErrorStackTrace(cause))); + return fallback; + } +} diff --git a/epmet-auth/src/main/java/com/epmet/controller/GovWebController.java b/epmet-auth/src/main/java/com/epmet/controller/GovWebController.java index 8a85cb9da4..6ed1a5761f 100644 --- a/epmet-auth/src/main/java/com/epmet/controller/GovWebController.java +++ b/epmet-auth/src/main/java/com/epmet/controller/GovWebController.java @@ -6,18 +6,17 @@ import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.form.GovWebLoginFormDTO; import com.epmet.dto.result.UserTokenResultDTO; import com.epmet.service.GovWebService; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; -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.*; /** * @author sun * @Description PC工作端-登陆服务 */ +@Slf4j @RestController @RequestMapping("govweb") public class GovWebController { @@ -63,5 +62,22 @@ public class GovWebController { return new Result().ok(publicKey); } + /** + * desc: 根据用户id + * + * @return com.epmet.commons.tools.utils.Result + * @author LiuJanJun + * @date 2021/3/8 5:07 下午 + */ + @PostMapping("generateTokenBySSOKey/{uuid}/{userId}") + public Result generateTokenBySSOKey(@PathVariable(value = "uuid")String uuid,@PathVariable String userId,@RequestParam String customerId) { + //判断是否非法登陆 + /*if (!redisUtils.hasKey(RedisKeys.getIcLoginAuthKey(customerId,uuid))){ + log.error("有人使用userid:{} 非法登陆",userId); + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode()); + }*/ + return new Result().ok(govWebService.generateTokenBySSOKey(customerId,userId)); + } + } diff --git a/epmet-auth/src/main/java/com/epmet/service/GovWebService.java b/epmet-auth/src/main/java/com/epmet/service/GovWebService.java index 30f8d8ae4c..79ee6d0adc 100644 --- a/epmet-auth/src/main/java/com/epmet/service/GovWebService.java +++ b/epmet-auth/src/main/java/com/epmet/service/GovWebService.java @@ -16,4 +16,12 @@ public interface GovWebService { * @Description PC工作端-工作人员登录 **/ UserTokenResultDTO login(GovWebLoginFormDTO formDTO); + + /** + * desc:根据用户Id 生成token + * @return + * @param customerId + * @param userId + */ + String generateTokenBySSOKey(String customerId, String userId); } 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 9d455af694..e7eea09292 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 @@ -1,8 +1,11 @@ package com.epmet.service.impl; import com.epmet.common.token.constant.LoginConstant; +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.exception.RenException; +import com.epmet.commons.tools.redis.common.CustomerStaffRedis; import com.epmet.commons.tools.security.dto.GovTokenDto; import com.epmet.commons.tools.security.password.PasswordUtils; import com.epmet.commons.tools.utils.CpUserDetailRedis; @@ -94,6 +97,46 @@ public class GovWebServiceImpl implements GovWebService { } + @Override + public String generateTokenBySSOKey(String customerId, String userId) { + CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(customerId, userId); + if (staffInfo == null){ + log.error("工作人员信息不存在,customerId:{},userId:{}", customerId, userId); + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode()); + } + + + // 生成token + Map map = new HashMap<>(); + map.put("app", "gov"); + map.put("client", "web"); + map.put("userId", userId); + String token = jwtTokenUtils.createToken(map); + int expire = jwtTokenProperties.getExpire(); + + String orgIdPath = thirdLoginService.getOrgIdPath(userId); + String[] orgIdPathParts = orgIdPath.split(":"); + + GovTokenDto tokenDto = new GovTokenDto(); + tokenDto.setCustomerId(customerId); + tokenDto.setApp("gov"); + tokenDto.setClient("web"); + tokenDto.setUserId(userId); + tokenDto.setToken(token); + tokenDto.setUpdateTime(System.currentTimeMillis()); + tokenDto.setExpireTime(jwtTokenUtils.getExpiration(token).getTime()); + tokenDto.setAgencyId(staffInfo.getAgencyId()); + tokenDto.setRootAgencyId(staffInfo.getAgencyId()); + //tokenDto.setDeptIdList(thirdLoginService.getDeptartmentIdList(userId)); + //tokenDto.setGridIdList(thirdLoginService.getGridIdList(userId)); + //tokenDto.setRoleList(thirdLoginService.queryGovStaffRoles(userId, orgIdPathParts[orgIdPathParts.length - 1])); + //tokenDto.setOrgIdPath(orgIdPath); + + cpUserDetailRedis.set(tokenDto, expire); + logger.info("截止时间:" + DateUtils.format(jwtTokenUtils.getExpiration(token), "yyyy-MM-dd HH:mm:ss")); + return token; + } + /** * 生成PC工作端token * @author sun diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java index 47079e14a8..0b6f4d9e72 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java @@ -157,6 +157,7 @@ public enum EpmetErrorCode { COMMUNITY_SELF_ORGANIZATION_LIST_REPART_ERROR(8530, "%s社区自组织名称已存在"), MATTER_NAME_EXISTS_APPOINTMENT_ERROR(8532, "存在重复预约事项"), + ERROR_DATE(8533, "不合理日期"), // 该错误不会提示给前端,只是后端传输错误信息用。 ACCESS_SQL_FILTER_MISSION_ARGS(8701, "缺少生成权限过滤SQL所需参数"), 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 f3c669d7cd..dd764b13fe 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 @@ -636,4 +636,15 @@ public class RedisKeys { public static String getOrgTreeCacheKey(String agencyId) { return rootPrefix.concat("org:temp:orgtree").concat(agencyId); } + + /** + * desc:获取第三方登陆跳转 授权key + * + * @param customerId + * @param uuid + * @return + */ + public static String getIcLoginAuthKey(String customerId, String uuid) { + return rootPrefix.concat("sys:iclogin:authkey:").concat(customerId).concat(StrConstant.COLON).concat(uuid); + } } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java index db6abec6aa..f956423f3a 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java @@ -945,4 +945,127 @@ public class DateUtils { return result; } + /** + * @Description 获取工作日时间【没有排除节假日】 + * @param startDate + * @param num + * @author zxc + * @date 2022/1/7 10:51 上午 + */ + public static Date getWorkDay(Date startDate, int num) { + Date tomorrow = null; + int delay = 1; + while (delay <= num) { + tomorrow = getTomorrow(startDate); + if (!isWeekend(tomorrow)) { + delay++; + } + startDate = tomorrow; + } + return startDate; + } + + /** + * @Description 根据开始时间计算出 当前日期后n个工作日【没有排除节假日】包括今天 + * @param startDate + * @param num + * @author zxc + * @date 2022/1/7 10:20 上午 + */ + public static List getWorkDayList(Date startDate, int num) { + List result = new ArrayList<>(); + Calendar rightNow = Calendar.getInstance(); + rightNow.setTime(startDate); + rightNow.add(Calendar.DATE,-1); + startDate = rightNow.getTime(); + Date tomorrow; + Integer tag = 1; + while (tag <= num){ + tomorrow = getTomorrow(startDate); + // 返回工作日 + if (!isWeekend(tomorrow)) { + result.add(new SimpleDateFormat(DATE_PATTERN).format(tomorrow)); + tag++; + } + startDate = tomorrow; + } + return result; + } + + /** + * @Description 根据开始时间计算出 当前日期后n个周末【没有排除节假日】包括今天 + * @param startDate + * @param num + * @author zxc + * @date 2022/1/7 10:20 上午 + */ + public static List getWeekendDayList(Date startDate, int num) { + List result = new ArrayList<>(); + Calendar rightNow = Calendar.getInstance(); + rightNow.setTime(startDate); + rightNow.add(Calendar.DATE,-1); + startDate = rightNow.getTime(); + Date tomorrow; + Integer tag = 1; + while (tag <= num){ + tomorrow = getTomorrow(startDate); + // 返回周末 + if (isWeekend(tomorrow)) { + result.add(new SimpleDateFormat(DATE_PATTERN).format(tomorrow)); + tag++; + } + startDate = tomorrow; + } + return result; + } + + /** + * @Description 根据开始时间计算出 当前日期后n天【没有排除节假日】包括今天 + * @param startDate + * @param num + * @author zxc + * @date 2022/1/7 10:20 上午 + */ + public static List getEveryDayList(Date startDate, int num) { + List result = new ArrayList<>(); + Calendar rightNow = Calendar.getInstance(); + rightNow.setTime(startDate); + rightNow.add(Calendar.DATE,-1); + startDate = rightNow.getTime(); + Date tomorrow; + Integer tag = 1; + while (tag <= num){ + tomorrow = getTomorrow(startDate); + result.add(new SimpleDateFormat(DATE_PATTERN).format(tomorrow)); + tag++; + startDate = tomorrow; + } + return result; + } + + /** + * @Description 判断日期字符串是否为周末 + * @param date eg:yyyy-MM-dd + * @author zxc + * @date 2022/1/7 10:50 上午 + */ + private static boolean isWeekend(Date date) { + Calendar cal = Calendar.getInstance(); + cal.setTime(date); + return cal.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY || cal.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY; + } + + /** + * @Description 获取tomorrow的日期 + * @param startDate + * @author zxc + * @date 2022/1/7 10:50 上午 + */ + private static Date getTomorrow(Date startDate) { + Calendar cal = Calendar.getInstance(); + cal.setTime(startDate); + cal.add(Calendar.DAY_OF_MONTH, +1); + return cal.getTime(); + } + } diff --git a/epmet-gateway/pom.xml b/epmet-gateway/pom.xml index 175b2145f1..cddbfb3409 100644 --- a/epmet-gateway/pom.xml +++ b/epmet-gateway/pom.xml @@ -77,6 +77,12 @@ epmet-admin-client 2.0.0 + + com.epmet + epmet-auth-client + 2.0.0 + compile + @@ -129,7 +135,7 @@ - + lb://epmet-auth-server lb://epmet-admin-server diff --git a/epmet-gateway/src/main/java/com/epmet/auth/InternalAuthProcessor.java b/epmet-gateway/src/main/java/com/epmet/auth/InternalAuthProcessor.java index 305bf2b3a4..946c5d1907 100644 --- a/epmet-gateway/src/main/java/com/epmet/auth/InternalAuthProcessor.java +++ b/epmet-gateway/src/main/java/com/epmet/auth/InternalAuthProcessor.java @@ -1,11 +1,15 @@ package com.epmet.auth; +import com.alibaba.fastjson.JSON; +import com.epmet.auth.feign.EpmetAuthOpenFeignClient; import com.epmet.commons.tools.constant.AppClientConstant; import com.epmet.commons.tools.constant.Constant; +import com.epmet.commons.tools.constant.CustomerIdConstant; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.security.dto.BaseTokenDto; import com.epmet.commons.tools.utils.CpUserDetailRedis; +import com.epmet.commons.tools.utils.Result; import com.epmet.filter.CpProperty; import com.epmet.jwt.JwtTokenUtils; import io.jsonwebtoken.Claims; @@ -40,6 +44,8 @@ public class InternalAuthProcessor extends AuthProcessor { @Autowired private CpProperty cpProperty; + @Autowired + private EpmetAuthOpenFeignClient epmetAuthOpenFeignClient; @Override public ServerWebExchange auth(ServerWebExchange exchange, GatewayFilterChain chain) { @@ -70,6 +76,22 @@ public class InternalAuthProcessor extends AuthProcessor { userId = (String) claims.get(AppClientConstant.USER_ID); expiration = claims.getExpiration(); baseTokenDto = cpUserDetailRedis.get(app, client, userId, BaseTokenDto.class); + //市北数字社区 如果redis里不存在 则自动登陆 生成token放入redis + if (baseTokenDto == null){ + Result stringResult = epmetAuthOpenFeignClient.generateTokenBySSOKey("123", userId, CustomerIdConstant.SHI_BEI_CUSTOMER_ID); + if (stringResult != null && stringResult.success() && StringUtils.isNotBlank(stringResult.getData())){ + baseTokenDto = new BaseTokenDto(); + baseTokenDto.setApp(app); + baseTokenDto.setClient(client); + baseTokenDto.setUserId(userId); + String tokenNew = stringResult.getData(); + //把传过来的token用新的token 替换 + token = tokenNew; + baseTokenDto.setToken(tokenNew); + baseTokenDto.setCustomerId(CustomerIdConstant.SHI_BEI_CUSTOMER_ID); + } + logger.info("stringResult"+ JSON.toJSONString(stringResult)); + } } } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java index 2101914c08..6011344b15 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java @@ -5,6 +5,7 @@ import com.alibaba.excel.ExcelWriter; import com.alibaba.excel.write.metadata.WriteSheet; import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.annotation.RequirePermission; +import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.enums.RequirePermissionEnum; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetException; @@ -15,7 +16,6 @@ import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.security.user.LoginUserUtil; 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.validator.ValidatorUtils; import com.epmet.dataaggre.beans.GridMemberDataAnalysisExcelExportBean; @@ -30,7 +30,6 @@ import lombok.extern.slf4j.Slf4j; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; import org.springframework.util.CollectionUtils; import org.springframework.web.bind.annotation.*; @@ -41,7 +40,6 @@ import java.net.URLEncoder; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; -import java.text.SimpleDateFormat; import java.util.*; import java.util.concurrent.atomic.AtomicReference; @@ -302,11 +300,11 @@ public class GovOrgController { PageData page; - int pageNo = 0; - int pageSize = 1000; + int pageNo = NumConstant.ONE; + int pageSize = NumConstant.ONE_THOUSAND; do { - page = aggreGridService.getGridMemberDataAnalysis4PcWork(orgId, orgType, pageNo, pageSize, startTime, endTime, false); + page = aggreGridService.getGridMemberDataAnalysis4PcWork(orgId, orgType, pageNo++, pageSize, startTime, endTime, false); List pageList = page.getList(); List exportBeans = ConvertUtils.sourceToTarget(pageList, GridMemberDataAnalysisExcelExportBean.class); diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/impl/DataStatsServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/impl/DataStatsServiceImpl.java index 5055a01925..201f8a39b6 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/impl/DataStatsServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/impl/DataStatsServiceImpl.java @@ -2172,6 +2172,7 @@ public class DataStatsServiceImpl implements DataStatsService, ResultDataResolve // throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "【pcwork查询网格员数据统计列表】传入时间条件有误"); //} + PageHelper.startPage(pageNo, pageSize, needCount); return factGridMemberStatisticsDailyDao.listGridMemberDataStatsIncr(pids, gridId, startDateID, endDateID); } } 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 815b196c51..7f9809a052 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 @@ -342,7 +342,7 @@ public class EpmetUserServiceImpl implements EpmetUserService { re.setTotalTime(totalTime == "" ? "0分钟" : totalTime); //re.setTotalTime(re.getTimeNum() < 1 ? BigDecimal.ZERO + "h" : new BigDecimal(numberFormat.format((float) re.getTimeNum() / (float) 3600)) + "h"); //re.setTotalTime(re.getTimeNum() / 60 + "分钟"); - list.stream().filter(l -> re.getGridId().equals(l.getId())).forEach(s -> re.setGridName(s.getGridName())); + //list.stream().filter(l -> re.getGridId().equals(l.getId())).forEach(s -> re.setGridName(s.getGridName())); }); return resultList; diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenGrassrootsGovernDataAbsorptionServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenGrassrootsGovernDataAbsorptionServiceImpl.java index 34368a57b8..ada550886f 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenGrassrootsGovernDataAbsorptionServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenGrassrootsGovernDataAbsorptionServiceImpl.java @@ -126,7 +126,12 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr if (null != gridInfo) { user.setGridName(gridInfo.getGridName()); user.setOrgId(gridInfo.getAgencyId()); - user.setOrgName(gridInfo.getOrgName()); + if(StringUtils.isNotBlank(gridInfo.getOrgName())){ + user.setOrgName(gridInfo.getOrgName()); + }else{ + GridInfoDTO gridInfoDTO = customerGridService.queryGridInfoDTO(user.getGridId()); + user.setOrgName(gridInfoDTO.getOrgName()); + } //原始数据Pid使用英文:隔开,大屏数据要求按照英文,隔开 user.setAllParentIds(gridInfo.getPids().replaceAll(StrConstant.COLON, StrConstant.COMMA)); }else{ diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml index d1865cf106..053c6004b0 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml @@ -110,8 +110,7 @@ LEFT JOIN customer_agency ca ON (cg.PID = CA.ID) WHERE - CG.CUSTOMER_ID =#{customerId} - and cg.id = #{gridId} + cg.id = #{gridId} + + update customer_grid + SET AREA_CODE = '', + UPDATED_BY=#{operateUserId}, + UPDATED_TIME = NOW() + where customer_id=#{customerId} + AND pids LIKE concat('%',#{agencyId}, '%' ) + + + + update customer_grid + SET AREA_CODE = #{areaCode}, + UPDATED_BY=#{operateUserId}, + UPDATED_TIME = NOW() + where del_flag='0' + and pid=#{agencyId} + diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcPartyServiceCenterDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcPartyServiceCenterDao.xml index 97f5e43cbf..f159698f7f 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcPartyServiceCenterDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcPartyServiceCenterDao.xml @@ -64,7 +64,8 @@ IFNULL(cm.MATTER_IMG,'') AS matterImg, c.ADDRESS, c.WORK_PHONE, - c.CENTER_NAME + c.CENTER_NAME, + cm.APPOINTMENT_TYPE as appointmentType FROM ic_party_service_center c INNER JOIN ic_party_service_center_matter cm ON (cm.PARTY_SERVICE_CENTER_ID = c.ID AND cm.DEL_FLAG = 0) AND c.DEL_FLAG = 0 diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java index 60e935497e..274cb8ed87 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java @@ -218,12 +218,14 @@ public class CustomerStaffController { Result result = customerStaffService.addStaff(fromDTO); //2021-10-18 推送mq,数据同步到中介库 start - OrgOrStaffMQMsg mq = new OrgOrStaffMQMsg(); - mq.setCustomerId(fromDTO.getCustomerId()); - mq.setOrgId(result.getData().getUserId()); - mq.setOrgType("staff"); - mq.setType("staff_create"); - SendMqMsgUtil.build().openFeignClient(epmetMessageOpenFeignClient).sendOrgStaffMqMsg(mq); + if (result.success()) { + OrgOrStaffMQMsg mq = new OrgOrStaffMQMsg(); + mq.setCustomerId(fromDTO.getCustomerId()); + mq.setOrgId(result.getData().getUserId()); + mq.setOrgType("staff"); + mq.setType("staff_create"); + SendMqMsgUtil.build().openFeignClient(epmetMessageOpenFeignClient).sendOrgStaffMqMsg(mq); + } //2021-10-18 end return result; @@ -240,12 +242,14 @@ public class CustomerStaffController { Result result = customerStaffService.editStaff(fromDTO); //2021-10-18 推送mq,数据同步到中介库 start - OrgOrStaffMQMsg mq = new OrgOrStaffMQMsg(); - mq.setCustomerId(fromDTO.getCustomerId()); - mq.setOrgId(fromDTO.getStaffId()); - mq.setOrgType("staff"); - mq.setType("staff_change"); - SendMqMsgUtil.build().openFeignClient(epmetMessageOpenFeignClient).sendOrgStaffMqMsg(mq); + if (result.success()) { + OrgOrStaffMQMsg mq = new OrgOrStaffMQMsg(); + mq.setCustomerId(fromDTO.getCustomerId()); + mq.setOrgId(fromDTO.getStaffId()); + mq.setOrgType("staff"); + mq.setType("staff_change"); + SendMqMsgUtil.build().openFeignClient(epmetMessageOpenFeignClient).sendOrgStaffMqMsg(mq); + } //2021-10-18 end return result; diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffPatrolRecordServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffPatrolRecordServiceImpl.java index 6e0e2d5580..9ddd74e7aa 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffPatrolRecordServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffPatrolRecordServiceImpl.java @@ -491,6 +491,11 @@ public class StaffPatrolRecordServiceImpl extends BaseServiceImpl map = new HashMap<>(); for (PcworkRecordListResultDTO.StaffPatrol r : result.getList()) { + //秒变小时分钟 + Integer minutes = r.getTotalTimeNum() / 60; + String patrolDuration = (minutes / 60 > 0 ? minutes / 60 + "小时" : "") + (minutes % 60 > 0 ? minutes % 60 + "分钟" : "0分钟"); + r.setTotalTime(patrolDuration); + if (map.containsKey(r.getGridId())) { r.setGridName(map.get(r.getGridId()).getGridName()); continue; @@ -512,12 +517,6 @@ public class StaffPatrolRecordServiceImpl extends BaseServiceImpl 0 ? minutes / 60 + "小时" : "") + (minutes % 60 > 0 ? minutes % 60 + "分钟" : "0分钟"); - r.setTotalTime(patrolDuration); - } //3.封装数据并返回 resultDTO.setTotal((int)result.getTotal());