diff --git a/epmet-commons/epmet-commons-mybatis/pom.xml b/epmet-commons/epmet-commons-mybatis/pom.xml index 502ef21e81..db396c4042 100644 --- a/epmet-commons/epmet-commons-mybatis/pom.xml +++ b/epmet-commons/epmet-commons-mybatis/pom.xml @@ -13,7 +13,7 @@ jar - 3.2.0 + 3.4.2 1.1.14 4.0 11.2.0.3 diff --git a/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/config/MybatisPlusConfig.java b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/config/MybatisPlusConfig.java index 4eef291b8b..8ef978f3c3 100644 --- a/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/config/MybatisPlusConfig.java +++ b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/config/MybatisPlusConfig.java @@ -8,7 +8,9 @@ package com.epmet.commons.mybatis.config; -import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor; +import com.baomidou.mybatisplus.annotation.DbType; +import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; +import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; import com.epmet.commons.mybatis.interceptor.DataFilterInterceptor; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -37,8 +39,10 @@ public class MybatisPlusConfig { */ @Bean @Order(0) - public PaginationInterceptor paginationInterceptor() { - return new PaginationInterceptor(); + public MybatisPlusInterceptor mybatisPlusInterceptor() { + MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); + interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL)); + return interceptor; } } diff --git a/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/entity/BaseEpmetEntity.java b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/entity/BaseEpmetEntity.java index 9a70d44c39..52071d79e2 100644 --- a/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/entity/BaseEpmetEntity.java +++ b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/entity/BaseEpmetEntity.java @@ -26,7 +26,7 @@ public abstract class BaseEpmetEntity implements Serializable { /** * id */ - @TableId(type = IdType.UUID) + @TableId(type = IdType.ASSIGN_ID) private String id; /** diff --git a/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/service/impl/BaseServiceImpl.java b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/service/impl/BaseServiceImpl.java index 445f5a6e40..8d7327cfa0 100644 --- a/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/service/impl/BaseServiceImpl.java +++ b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/service/impl/BaseServiceImpl.java @@ -57,7 +57,7 @@ public abstract class BaseServiceImpl, T> implements Bas Page page = initPage(params); //默认排序 - if (StringUtils.isNotEmpty(defaultOrderField)) { + if (StringUtils.isNotBlank(defaultOrderField)) { if (isAsc) { page.addOrder(OrderItem.asc(defaultOrderField)); } else { @@ -111,7 +111,7 @@ public abstract class BaseServiceImpl, T> implements Bas String order = (String) params.get(Constant.ORDER); //前端字段排序 - if (StringUtils.isNotEmpty(orderField) && StringUtils.isNotEmpty(order)) { + if (StringUtils.isNotBlank(orderField) && StringUtils.isNotBlank(order)) { if (Constant.ASC.equalsIgnoreCase(order)) { return page.addOrder(OrderItem.asc(orderField)); } else { @@ -135,7 +135,7 @@ public abstract class BaseServiceImpl, T> implements Bas protected Map paramsToLike(Map params, String... likes) { for (String like : likes) { String val = (String) params.get(like); - if (StringUtils.isNotEmpty(val)) { + if (StringUtils.isNotBlank(val)) { params.put(like, "%" + val + "%"); } else { params.put(like, null); @@ -294,12 +294,12 @@ public abstract class BaseServiceImpl, T> implements Bas @Override public boolean deleteById(Serializable id) { - return SqlHelper.delBool(baseDao.deleteById(id)); + return SqlHelper.retBool(baseDao.deleteById(id)); } @Override public boolean deleteBatchIds(Collection idList) { - return SqlHelper.delBool(baseDao.deleteBatchIds(idList)); + return SqlHelper.retBool(baseDao.deleteBatchIds(idList)); } @Transactional(rollbackFor = Exception.class) @@ -311,7 +311,7 @@ public abstract class BaseServiceImpl, T> implements Bas Assert.notNull(tableInfo, "error: can not execute. because can not find cache of TableInfo for entity!"); String keyProperty = tableInfo.getKeyProperty(); Assert.notEmpty(keyProperty, "error: can not execute. because can not find column for id from entity!"); - Object idVal = ReflectionKit.getMethodValue(cls, entity, tableInfo.getKeyProperty()); + Object idVal = ReflectionKit.getFieldValue( entity, tableInfo.getKeyProperty()); return StringUtils.checkValNull(idVal) || Objects.isNull(selectById((Serializable) idVal)) ? insert(entity) : updateById(entity); } return false; @@ -335,7 +335,7 @@ public abstract class BaseServiceImpl, T> implements Bas try (SqlSession batchSqlSession = sqlSessionBatch()) { int i = 0; for (T entity : entityList) { - Object idVal = ReflectionKit.getMethodValue(cls, entity, keyProperty); + Object idVal = ReflectionKit.getFieldValue(entity, keyProperty); if (StringUtils.checkValNull(idVal) || Objects.isNull(selectById((Serializable) idVal))) { batchSqlSession.insert(sqlStatement(SqlMethod.INSERT_ONE), entity); } else { diff --git a/epmet-module/data-aggregator/data-aggregator-client/pom.xml b/epmet-module/data-aggregator/data-aggregator-client/pom.xml index 7f6f4cd2ff..6248b5536f 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/pom.xml +++ b/epmet-module/data-aggregator/data-aggregator-client/pom.xml @@ -20,9 +20,8 @@ com.baomidou mybatis-plus-annotation - 3.2.0 - compile + 3.4.2 - \ No newline at end of file + diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java index dab2edf301..dde180c1ca 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java @@ -23,6 +23,7 @@ import com.epmet.dto.user.result.MidPatrolDetailResult; import com.epmet.dto.user.result.MidPatrolRecordResult; import com.epmet.feign.impl.DataStatisticalOpenFeignClientFallBackFactory; 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.RequestBody; import org.springframework.web.bind.annotation.RequestParam; @@ -353,4 +354,15 @@ public interface DataStatisticalOpenFeignClient { */ @PostMapping("/data/stats/demand/volunteer/daily") Result statsVolunteerDemandServicesDaily(@RequestParam(value = "customer-id", required = false) String customerId); + + /** + * desc: 市北私有化部署需要 支持的任务之一 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @author LiuJanJun + * @date 2022/1/18 4:37 下午 + */ + @PostMapping("/data/stats/shibeiICJob/userPointAndProjectStatus/{bizType}") + Result userPointAndProjectStatus(@PathVariable("bizType") String biztype,@RequestBody ExtractOriginFormDTO formDTO); } diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java index 56fea9c03f..ad48c01c34 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java @@ -339,4 +339,9 @@ public class DataStatisticalOpenFeignClientFallBack implements DataStatisticalOp public Result statsVolunteerDemandServicesDaily(String customerId) { return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "statsVolunteerDemandServicesDaily", customerId); } + + @Override + public Result userPointAndProjectStatus(String biztype,ExtractOriginFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "userPointAndProjectStatus", biztype,formDTO); + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ShiBeiICJobController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ShiBeiICJobController.java new file mode 100644 index 0000000000..5e29d9a6b2 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ShiBeiICJobController.java @@ -0,0 +1,106 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.constant.StrConstant; +import com.epmet.commons.tools.enums.BizTypeEnum; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.redis.RedisKeys; +import com.epmet.commons.tools.redis.RedisUtils; +import com.epmet.commons.tools.utils.DateUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.StatsFormDTO; +import com.epmet.dto.extract.form.ExtractOriginFormDTO; +import com.epmet.dto.screen.form.ScreenCentralZoneDataFormDTO; +import com.epmet.service.StatsProjectService; +import com.epmet.service.evaluationindex.extract.toscreen.ScreenGrassrootsGovernDataAbsorptionService; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Set; + +/** + * desc:市北数字社区 单独部署 job入口 【用户积分排名及项目状态数据】 + */ +@RequestMapping("shibeiICJob") +@RestController +@Slf4j +public class ShiBeiICJobController { + @Autowired + private ScreenGrassrootsGovernDataAbsorptionService screenGrassrootsGovernDataAbsorptionService; + @Autowired + private StatsProjectService statsProjectService; + @Autowired + private RedisUtils redisUtils; + + @PostMapping("userPointAndProjectStatus/{bizType}") + public Result userPointAndProjectStatus(@PathVariable("bizType") String bizType, @RequestBody ExtractOriginFormDTO formDTO) { + if (StringUtils.isBlank(formDTO.getCustomerId())){ + return new Result().error(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"参数错误cid不能为空"); + } + long start = System.currentTimeMillis(); + Set result = new LinkedHashSet<>(); + if (StringUtils.isNotBlank(formDTO.getStartDate()) && StringUtils.isNotBlank(formDTO.getEndDate())) { + List daysBetween = DateUtils.getDaysBetween(formDTO.getStartDate(), formDTO.getEndDate()); + daysBetween.forEach(d -> { + executeMethod(bizType, formDTO.getCustomerId(), d); + result.add(d); + redisUtils.hSet(RedisKeys.getBackDoorbizExcuteResult("userPointAndProjectStatus-"+bizType), formDTO.getCustomerId(), result, 3 * 24 * 60 * 60L); + }); + } else { + if (StringUtils.isBlank(formDTO.getDateId())){ + formDTO.setDateId(DateUtils.getBeforeNDay(NumConstant.ONE)); + } + executeMethod(bizType, formDTO.getCustomerId(), formDTO.getDateId()); + result.add(formDTO.getDateId()); + redisUtils.hSet(RedisKeys.getBackDoorbizExcuteResult("userPointAndProjectStatus-"+bizType), formDTO.getCustomerId(), result, 3 * 24 * 60 * 60L); + } + long end = System.currentTimeMillis(); + long l = (end - start) / 1000; + return new Result().ok("userPointAndProjectStatus耗时-"+bizType + l + "s"); + } + + private void executeMethod(String bizType, String customerId, String d) { + if (bizType.equals(BizTypeEnum.USER.getType())){ + this.extractUserPointData(customerId, d); + } + if (bizType.equals(BizTypeEnum.PROJECT.getType())) { + this.agencyProjectStats(customerId, d); + } + } + + /** + * @Author sun + * @Description 数据-项目-机关日(月)统计 + **/ + private Result agencyProjectStats(String customerId, String dateId) { + try { + if (StringUtils.isNotBlank(dateId)) { + dateId = DateUtils.format(DateUtils.parseDate(dateId, DateUtils.DATE_PATTERN_YYYYMMDD)); + } + StatsFormDTO formDTO = new StatsFormDTO(); + formDTO.setCustomerId(customerId); + formDTO.setDate(dateId); + + statsProjectService.agencyProjectStats(formDTO); + } catch (Exception e) { + log.error("市北-项目状态数据写入失败,参数为:{}" + customerId + StrConstant.HYPHEN + dateId, e); + } + return new Result(); + } + + private void extractUserPointData(String customerId, String dateId) { + try { + //基层治理 - 热心市民 screen_party_user_rank_data + ScreenCentralZoneDataFormDTO param = new ScreenCentralZoneDataFormDTO(); + param.setCustomerId(customerId); + param.setDateId(dateId); + screenGrassrootsGovernDataAbsorptionService.userScoreDataHub(param); + } catch (Exception e) { + log.error("市北-热心市民/党员得分数据写入失败,参数为:{}" + customerId + StrConstant.HYPHEN + dateId, e); + } + } +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/crm/CustomerEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/crm/CustomerEntity.java index c6dc6dba64..af4cb6844e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/crm/CustomerEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/crm/CustomerEntity.java @@ -17,9 +17,10 @@ package com.epmet.entity.crm; +import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; - import com.epmet.commons.mybatis.entity.BaseEpmetEntity; import lombok.Data; import lombok.EqualsAndHashCode; @@ -27,7 +28,7 @@ import lombok.EqualsAndHashCode; import java.util.Date; /** - * 客户表 + * 客户表 * * @author generator generator@elink-cn.com * @since v1.0.0 2020-03-11 @@ -39,6 +40,11 @@ public class CustomerEntity extends BaseEpmetEntity { private static final long serialVersionUID = 1L; + /** + * id + */ + @TableId(type = IdType.ASSIGN_UUID) + private String id; /** * 客户名称 */ diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/ic/IcPrivateDeploySupportProjectTask.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/ic/IcPrivateDeploySupportProjectTask.java new file mode 100644 index 0000000000..bf3a1b3ac3 --- /dev/null +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/ic/IcPrivateDeploySupportProjectTask.java @@ -0,0 +1,33 @@ +package com.epmet.task.ic; + + +import com.alibaba.fastjson.JSON; +import com.epmet.commons.tools.enums.BizTypeEnum; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.extract.form.ExtractOriginFormDTO; +import com.epmet.feign.DataStatisticalOpenFeignClient; +import com.epmet.task.ITask; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * desc:数字社区私有化部署 任务之一还有【autoEvaluateDemandTask,statsDemandTask,dailyStatisticalVoteTask,IcPrivateDeploySupportUserPointTask】 + */ +@Slf4j +@Component("icPrivateDeploySupportProjectTask") +public class IcPrivateDeploySupportProjectTask implements ITask { + @Autowired + private DataStatisticalOpenFeignClient dataStatisticalOpenFeignClient; + + @Override + public void run(String params) { + ExtractOriginFormDTO formDTO = new ExtractOriginFormDTO(); + if (StringUtils.isNotBlank(params)) { + formDTO = JSON.parseObject(params, ExtractOriginFormDTO.class); + } + Result result = dataStatisticalOpenFeignClient.userPointAndProjectStatus(BizTypeEnum.PROJECT.getType(), formDTO); + log.info("icPrivateDeploySupportProjectTask excute end,param:{},result:{}",params,result); + } +} diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/ic/IcPrivateDeploySupportUserPointTask.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/ic/IcPrivateDeploySupportUserPointTask.java new file mode 100644 index 0000000000..3f9b9f2d9d --- /dev/null +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/ic/IcPrivateDeploySupportUserPointTask.java @@ -0,0 +1,33 @@ +package com.epmet.task.ic; + + +import com.alibaba.fastjson.JSON; +import com.epmet.commons.tools.enums.BizTypeEnum; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.extract.form.ExtractOriginFormDTO; +import com.epmet.feign.DataStatisticalOpenFeignClient; +import com.epmet.task.ITask; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * desc:数字社区私有化部署 任务之一还有【autoEvaluateDemandTask,statsDemandTask,dailyStatisticalVoteTask,icPrivateDeploySupportProjectTask】 + */ +@Slf4j +@Component("icPrivateDeploySupportUserPointTask") +public class IcPrivateDeploySupportUserPointTask implements ITask { + @Autowired + private DataStatisticalOpenFeignClient dataStatisticalOpenFeignClient; + + @Override + public void run(String params) { + ExtractOriginFormDTO formDTO = new ExtractOriginFormDTO(); + if (StringUtils.isNotBlank(params)) { + formDTO = JSON.parseObject(params, ExtractOriginFormDTO.class); + } + Result result = dataStatisticalOpenFeignClient.userPointAndProjectStatus(BizTypeEnum.USER.getType(), formDTO); + log.info("icPrivateDeploySupportUserPointTask excute end,param:{},result:{}",params,result); + } +} diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/bootstrap.yml b/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/bootstrap.yml index b158975c86..49db95eb6d 100644 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/bootstrap.yml +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/bootstrap.yml @@ -112,11 +112,6 @@ hystrix: isolation: thread: timeoutInMilliseconds: 60000 #缺省为1000 - threadpool: - default: - coreSize: 10 - maxQueueSize: 500 - queueSizeRejectionThreshold: 500 ribbon: ReadTimeout: 300000 diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/entity/CustomerEntity.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/entity/CustomerEntity.java index 6e56fbee35..fe23757571 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/entity/CustomerEntity.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/entity/CustomerEntity.java @@ -17,8 +17,9 @@ package com.epmet.entity; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; - import com.epmet.commons.mybatis.entity.BaseEpmetEntity; import lombok.Data; import lombok.EqualsAndHashCode; @@ -26,7 +27,7 @@ import lombok.EqualsAndHashCode; import java.util.Date; /** - * 客户表 + * 客户表 * * @author generator generator@elink-cn.com * @since v1.0.0 2020-03-11 @@ -38,6 +39,12 @@ public class CustomerEntity extends BaseEpmetEntity { private static final long serialVersionUID = 1L; + /** + * id + */ + @TableId(type = IdType.ASSIGN_UUID) + private String id; + /** * 客户名称 */ diff --git a/epmet-module/resi-hall/resi-hall-server/src/main/resources/bootstrap.yml b/epmet-module/resi-hall/resi-hall-server/src/main/resources/bootstrap.yml index 4522364f57..33e54c75af 100644 --- a/epmet-module/resi-hall/resi-hall-server/src/main/resources/bootstrap.yml +++ b/epmet-module/resi-hall/resi-hall-server/src/main/resources/bootstrap.yml @@ -69,6 +69,10 @@ hystrix: isolation: thread: timeoutInMilliseconds: 60000 #缺省为1000 + threadpool: + default: + # hystric最大线程个数,默认10,改为20 + maximumSize: 20 ribbon: ReadTimeout: 300000 diff --git a/epmet-module/resi-home/resi-home-server/src/main/resources/bootstrap.yml b/epmet-module/resi-home/resi-home-server/src/main/resources/bootstrap.yml index b0ecb87085..a0fecfc66f 100644 --- a/epmet-module/resi-home/resi-home-server/src/main/resources/bootstrap.yml +++ b/epmet-module/resi-home/resi-home-server/src/main/resources/bootstrap.yml @@ -68,6 +68,10 @@ hystrix: isolation: thread: timeoutInMilliseconds: 60000 #缺省为1000 + threadpool: + default: +# hystric最大线程个数,默认10,改为20 + maximumSize: 20 ribbon: ReadTimeout: 300000