Browse Source
# Conflicts: # epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java # epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.javafeature/evaluate
488 changed files with 20555 additions and 1343 deletions
@ -1,95 +0,0 @@ |
|||
/** |
|||
* Copyright (c) 2018 人人开源 All rights reserved. |
|||
* |
|||
* https://www.renren.io
|
|||
* |
|||
* 版权所有,侵权必究! |
|||
*/ |
|||
|
|||
package com.epmet.log; |
|||
|
|||
import com.epmet.commons.tools.exception.ExceptionUtils; |
|||
import com.epmet.commons.tools.log.BaseLog; |
|||
import com.epmet.commons.tools.log.enums.LogTypeEnum; |
|||
import com.epmet.commons.tools.redis.RedisKeys; |
|||
import com.epmet.commons.tools.redis.RedisUtils; |
|||
import com.epmet.commons.tools.utils.ConvertUtils; |
|||
import com.epmet.entity.SysLogErrorEntity; |
|||
import com.epmet.entity.SysLogLoginEntity; |
|||
import com.epmet.entity.SysLogOperationEntity; |
|||
import com.epmet.service.SysLogErrorService; |
|||
import com.epmet.service.SysLogLoginService; |
|||
import com.epmet.service.SysLogOperationService; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.apache.commons.lang3.concurrent.BasicThreadFactory; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.boot.CommandLineRunner; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
import java.util.concurrent.ScheduledExecutorService; |
|||
import java.util.concurrent.ScheduledThreadPoolExecutor; |
|||
import java.util.concurrent.TimeUnit; |
|||
|
|||
/** |
|||
* 从Redis队列中获取Log,保存到DB |
|||
* |
|||
* @author Mark sunlightcs@gmail.com |
|||
* @since 1.0.0 |
|||
*/ |
|||
@Slf4j |
|||
@Component |
|||
public class LogConsumer implements CommandLineRunner { |
|||
@Autowired |
|||
private RedisUtils redisUtils; |
|||
@Autowired |
|||
private SysLogErrorService sysLogErrorService; |
|||
@Autowired |
|||
private SysLogLoginService sysLogLoginService; |
|||
@Autowired |
|||
private SysLogOperationService sysLogOperationService; |
|||
private ScheduledExecutorService scheduledService = new ScheduledThreadPoolExecutor(1, |
|||
new BasicThreadFactory.Builder().namingPattern("log-consumer-schedule-pool-%d").daemon(true).build()); |
|||
|
|||
@Override |
|||
public void run(String... args) { |
|||
//上次任务结束后,等待10秒钟,再执行下次任务
|
|||
scheduledService.scheduleWithFixedDelay(() -> { |
|||
try { |
|||
receiveQueue(); |
|||
}catch (Exception e){ |
|||
log.error("LogConsumer Error:"+ ExceptionUtils.getErrorStackTrace(e)); |
|||
} |
|||
}, 1, 10, TimeUnit.SECONDS); |
|||
} |
|||
|
|||
private void receiveQueue() { |
|||
String key = RedisKeys.getSysLogKey(); |
|||
//每次插入100条
|
|||
int count = 100; |
|||
for(int i = 0; i < count; i++){ |
|||
BaseLog log = (BaseLog) redisUtils.rightPop(key); |
|||
if(log == null){ |
|||
return; |
|||
} |
|||
|
|||
//登录日志
|
|||
if(log.getType() == LogTypeEnum.LOGIN.value()){ |
|||
SysLogLoginEntity entity = ConvertUtils.sourceToTarget(log, SysLogLoginEntity.class); |
|||
sysLogLoginService.save(entity); |
|||
} |
|||
|
|||
//操作日志
|
|||
if(log.getType() == LogTypeEnum.OPERATION.value()){ |
|||
SysLogOperationEntity entity = ConvertUtils.sourceToTarget(log, SysLogOperationEntity.class); |
|||
sysLogOperationService.save(entity); |
|||
} |
|||
|
|||
//异常日志
|
|||
if(log.getType() == LogTypeEnum.ERROR.value()){ |
|||
SysLogErrorEntity entity = ConvertUtils.sourceToTarget(log, SysLogErrorEntity.class); |
|||
sysLogErrorService.save(entity); |
|||
} |
|||
} |
|||
} |
|||
|
|||
} |
@ -1,24 +0,0 @@ |
|||
/** |
|||
* Copyright (c) 2018 人人开源 All rights reserved. |
|||
* |
|||
* https://www.renren.io
|
|||
* |
|||
* 版权所有,侵权必究! |
|||
*/ |
|||
|
|||
package com.epmet.commons.tools.annotation; |
|||
|
|||
import java.lang.annotation.*; |
|||
|
|||
/** |
|||
* 操作日志注解 |
|||
* |
|||
* @author Mark sunlightcs@gmail.com |
|||
* @since 1.0.0 |
|||
*/ |
|||
@Target(ElementType.METHOD) |
|||
@Retention(RetentionPolicy.RUNTIME) |
|||
@Documented |
|||
public @interface LogOperation { |
|||
String value() default ""; |
|||
} |
@ -1,121 +0,0 @@ |
|||
/** |
|||
* Copyright (c) 2018 人人开源 All rights reserved. |
|||
* |
|||
* https://www.renren.io
|
|||
* |
|||
* 版权所有,侵权必究! |
|||
*/ |
|||
|
|||
package com.epmet.commons.tools.aspect; |
|||
|
|||
import com.alibaba.fastjson.JSON; |
|||
import com.epmet.commons.tools.annotation.LogOperation; |
|||
import com.epmet.commons.tools.config.ModuleConfig; |
|||
import com.epmet.commons.tools.security.user.SecurityUser; |
|||
import com.epmet.commons.tools.log.SysLogOperation; |
|||
import com.epmet.commons.tools.log.enums.LogTypeEnum; |
|||
import com.epmet.commons.tools.log.enums.OperationStatusEnum; |
|||
import com.epmet.commons.tools.log.producer.LogProducer; |
|||
import com.epmet.commons.tools.security.user.UserDetail; |
|||
import com.epmet.commons.tools.utils.HttpContextUtils; |
|||
import com.epmet.commons.tools.utils.IpUtils; |
|||
import org.aspectj.lang.ProceedingJoinPoint; |
|||
import org.aspectj.lang.annotation.Around; |
|||
import org.aspectj.lang.annotation.Aspect; |
|||
import org.aspectj.lang.annotation.Pointcut; |
|||
import org.aspectj.lang.reflect.MethodSignature; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.http.HttpHeaders; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
import javax.servlet.http.HttpServletRequest; |
|||
import java.lang.reflect.Method; |
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 操作日志,切面处理类 |
|||
* |
|||
* @author Mark sunlightcs@gmail.com |
|||
* @since 1.0.0 |
|||
*/ |
|||
@Aspect |
|||
@Component |
|||
public class LogOperationAspect { |
|||
@Autowired |
|||
private ModuleConfig moduleConfig; |
|||
@Autowired |
|||
private LogProducer logProducer; |
|||
|
|||
@Pointcut("@annotation(com.epmet.commons.tools.annotation.LogOperation)") |
|||
public void logPointCut() { |
|||
|
|||
} |
|||
|
|||
@Around("logPointCut()") |
|||
public Object around(ProceedingJoinPoint point) throws Throwable { |
|||
long beginTime = System.currentTimeMillis(); |
|||
try { |
|||
//执行方法
|
|||
Object result = point.proceed(); |
|||
|
|||
//执行时长(毫秒)
|
|||
long time = System.currentTimeMillis() - beginTime; |
|||
//保存日志
|
|||
saveLog(point, time, OperationStatusEnum.SUCCESS.value()); |
|||
|
|||
return result; |
|||
}catch(Exception e) { |
|||
//执行时长(毫秒)
|
|||
long time = System.currentTimeMillis() - beginTime; |
|||
//保存日志
|
|||
saveLog(point, time, OperationStatusEnum.FAIL.value()); |
|||
|
|||
throw e; |
|||
} |
|||
} |
|||
|
|||
|
|||
private void saveLog(ProceedingJoinPoint joinPoint, long time, Integer status) { |
|||
MethodSignature signature = (MethodSignature) joinPoint.getSignature(); |
|||
Method method = signature.getMethod(); |
|||
|
|||
SysLogOperation log = new SysLogOperation(); |
|||
LogOperation annotation = method.getAnnotation(LogOperation.class); |
|||
if(annotation != null){ |
|||
//注解上的描述
|
|||
log.setOperation(annotation.value()); |
|||
} |
|||
|
|||
//登录用户信息
|
|||
UserDetail user = SecurityUser.getUser(); |
|||
if(user != null){ |
|||
log.setCreator(user.getId()); |
|||
log.setCreatorName(user.getUsername()); |
|||
} |
|||
|
|||
log.setType(LogTypeEnum.OPERATION.value()); |
|||
log.setModule(moduleConfig.getName()); |
|||
log.setStatus(status); |
|||
log.setRequestTime((int)time); |
|||
log.setCreateDate(new Date()); |
|||
|
|||
//请求相关信息
|
|||
HttpServletRequest request = HttpContextUtils.getHttpServletRequest(); |
|||
log.setIp(IpUtils.getIpAddr(request)); |
|||
log.setUserAgent(request.getHeader(HttpHeaders.USER_AGENT)); |
|||
log.setRequestUri(request.getRequestURI()); |
|||
log.setRequestMethod(request.getMethod()); |
|||
|
|||
//请求参数
|
|||
Object[] args = joinPoint.getArgs(); |
|||
try{ |
|||
String params = JSON.toJSONString(args[0]); |
|||
log.setRequestParams(params); |
|||
}catch (Exception e){ |
|||
|
|||
} |
|||
|
|||
//保存到Redis队列里
|
|||
logProducer.saveLog(log); |
|||
} |
|||
} |
@ -1,153 +0,0 @@ |
|||
/** |
|||
* Copyright (c) 2018 人人开源 All rights reserved. |
|||
* |
|||
* https://www.renren.io
|
|||
* |
|||
* 版权所有,侵权必究! |
|||
*/ |
|||
|
|||
package com.epmet.commons.tools.exception; |
|||
|
|||
import cn.hutool.core.map.MapUtil; |
|||
import com.alibaba.fastjson.JSON; |
|||
import com.epmet.commons.tools.config.ModuleConfig; |
|||
import com.epmet.commons.tools.log.SysLogError; |
|||
import com.epmet.commons.tools.log.enums.LogTypeEnum; |
|||
import com.epmet.commons.tools.log.producer.LogProducer; |
|||
import com.epmet.commons.tools.security.user.LoginUserUtil; |
|||
import com.epmet.commons.tools.utils.HttpContextUtils; |
|||
import com.epmet.commons.tools.utils.IpUtils; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import org.slf4j.Logger; |
|||
import org.slf4j.LoggerFactory; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.dao.DuplicateKeyException; |
|||
import org.springframework.http.HttpHeaders; |
|||
import org.springframework.web.bind.annotation.ExceptionHandler; |
|||
|
|||
import javax.servlet.http.HttpServletRequest; |
|||
import java.util.Date; |
|||
import java.util.Map; |
|||
|
|||
|
|||
/** |
|||
* 异常处理器 |
|||
* 暂停使用,改用BaseRequestLogAspect |
|||
* @author Mark sunlightcs@gmail.com |
|||
* @since 1.0.0 |
|||
*/ |
|||
//@RestControllerAdvice
|
|||
public class RenExceptionHandler { |
|||
private static final Logger logger = LoggerFactory.getLogger(RenExceptionHandler.class); |
|||
@Autowired |
|||
private ModuleConfig moduleConfig; |
|||
@Autowired |
|||
private LogProducer logProducer; |
|||
@Autowired |
|||
private LoginUserUtil loginUserUtil; |
|||
|
|||
/** |
|||
* 处理自定义异常 |
|||
* "code": 8000, |
|||
* "msg": "服务器开小差了...", |
|||
*/ |
|||
@ExceptionHandler(RenException.class) |
|||
public Result handleRRException(RenException ex){ |
|||
if (ex.getCode() > 8000) { |
|||
Result result=new Result().error(ex.getCode()); |
|||
result.setData(ex.getInternalMsg()); |
|||
return result; |
|||
} |
|||
logger.error(ExceptionUtils.getErrorStackTrace(ex)); |
|||
Result result=new Result().error(); |
|||
result.setData(ex.getInternalMsg()); |
|||
return result; |
|||
// return new Result().error();
|
|||
} |
|||
|
|||
|
|||
/** |
|||
* 处理自定义异常 |
|||
* "code": 8000, |
|||
* "msg": "服务器开小差了...", |
|||
*/ |
|||
@ExceptionHandler(ValidateException.class) |
|||
public Result handleVException(ValidateException ex){ |
|||
logger.error(ExceptionUtils.getErrorStackTrace(ex)); |
|||
Result result=new Result(); |
|||
result.setCode(ex.getCode()); |
|||
result.setMsg(ex.getMsg()); |
|||
return result; |
|||
// return new Result().error();
|
|||
} |
|||
|
|||
/** |
|||
* 运行时异常拦截 |
|||
* "code": 8000, |
|||
* "msg": "服务器开小差了...", |
|||
*/ |
|||
@ExceptionHandler(RuntimeException.class) |
|||
public Result handleRuntimeException(RuntimeException ex){ |
|||
logger.error(ExceptionUtils.getErrorStackTrace(ex)); |
|||
Result result=new Result().error(); |
|||
result.setData(ex.getMessage()); |
|||
return result; |
|||
// return new Result().error();
|
|||
} |
|||
|
|||
/** |
|||
* 处理自定义异常 |
|||
* "code": 10002, |
|||
* "msg": "数据库中已存在该记录", |
|||
*/ |
|||
@ExceptionHandler(DuplicateKeyException.class) |
|||
public Result handleDuplicateKeyException(DuplicateKeyException ex){ |
|||
logger.error(ExceptionUtils.getErrorStackTrace(ex)); |
|||
return new Result().error(ErrorCode.DB_RECORD_EXISTS); |
|||
} |
|||
|
|||
/** |
|||
* 异常 |
|||
* "code": 8000, |
|||
* "msg": "服务器开小差了...", |
|||
*/ |
|||
@ExceptionHandler(Exception.class) |
|||
public Result handleException(Exception ex){ |
|||
logger.error(ExceptionUtils.getErrorStackTrace(ex)); |
|||
// saveLog(ex);
|
|||
Result result=new Result().error(); |
|||
result.setData(ex.getMessage()); |
|||
return result; |
|||
// return new Result().error();
|
|||
} |
|||
|
|||
/** |
|||
* 保存异常日志 |
|||
*/ |
|||
private void saveLog(Exception ex){ |
|||
SysLogError log = new SysLogError(); |
|||
log.setType(LogTypeEnum.ERROR.value()); |
|||
log.setModule(moduleConfig.getName()); |
|||
|
|||
//请求相关信息
|
|||
HttpServletRequest request = HttpContextUtils.getHttpServletRequest(); |
|||
log.setUserAgent(request.getHeader(HttpHeaders.USER_AGENT)); |
|||
log.setRequestUri(request.getRequestURI()); |
|||
log.setRequestMethod(request.getMethod()); |
|||
log.setIp(IpUtils.getIpAddr(request)); |
|||
Map<String, String> params = HttpContextUtils.getParameterMap(request); |
|||
if(MapUtil.isNotEmpty(params)){ |
|||
log.setRequestParams(JSON.toJSONString(params)); |
|||
} |
|||
|
|||
//登录用户ID
|
|||
|
|||
log.setCreator(loginUserUtil.getLoginUserId()); |
|||
//异常信息
|
|||
log.setErrorInfo(ExceptionUtils.getErrorStackTrace(ex)); |
|||
|
|||
//保存到Redis队列里
|
|||
log.setCreateDate(new Date()); |
|||
logProducer.saveLog(log); |
|||
} |
|||
} |
@ -1,43 +0,0 @@ |
|||
/** |
|||
* Copyright (c) 2018 人人开源 All rights reserved. |
|||
* |
|||
* https://www.renren.io
|
|||
* |
|||
* 版权所有,侵权必究! |
|||
*/ |
|||
|
|||
package com.epmet.commons.tools.log.producer; |
|||
|
|||
import com.google.common.util.concurrent.ThreadFactoryBuilder; |
|||
import com.epmet.commons.tools.log.BaseLog; |
|||
import com.epmet.commons.tools.redis.RedisKeys; |
|||
import com.epmet.commons.tools.redis.RedisUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
import java.util.concurrent.*; |
|||
|
|||
/** |
|||
* 日志通过redis队列,异步保存到数据库 |
|||
* |
|||
* @author Mark sunlightcs@gmail.com |
|||
* @since 1.0.0 |
|||
*/ |
|||
@Component |
|||
public class LogProducer { |
|||
@Autowired |
|||
private RedisUtils redisUtils; |
|||
ThreadFactory namedThreadFactory = new ThreadFactoryBuilder().setNameFormat("log-producer-pool-%d").build(); |
|||
ExecutorService pool = new ThreadPoolExecutor(5, 200, 0L,TimeUnit.MILLISECONDS, |
|||
new LinkedBlockingQueue<>(1024), namedThreadFactory, new ThreadPoolExecutor.AbortPolicy()); |
|||
|
|||
/** |
|||
* 保存Log到Redis消息队列 |
|||
*/ |
|||
public void saveLog(BaseLog log){ |
|||
String key = RedisKeys.getSysLogKey(); |
|||
|
|||
//异步保存到队列
|
|||
pool.execute(() -> redisUtils.leftPush(key, log, RedisUtils.NOT_EXPIRE)); |
|||
} |
|||
} |
@ -0,0 +1,21 @@ |
|||
package com.epmet.dataaggre.dto.epmetuser.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2021/3/30 上午11:04 |
|||
* @DESC |
|||
*/ |
|||
@Data |
|||
public class UserInfosResultDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 7129564173128153335L; |
|||
|
|||
private String userId; |
|||
private String userShowName; |
|||
private String headPhoto; |
|||
|
|||
} |
@ -0,0 +1,35 @@ |
|||
package com.epmet.dataaggre.dto.resigroup.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import javax.validation.constraints.NotNull; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2021/3/30 上午9:34 |
|||
* @DESC |
|||
*/ |
|||
@Data |
|||
public class CandidateListFormDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 6184071611057671961L; |
|||
|
|||
public interface CandidateListForm{} |
|||
|
|||
/** |
|||
* 小组ID |
|||
*/ |
|||
@NotBlank(message = "小组ID不能为空",groups = CandidateListForm.class) |
|||
private String groupId; |
|||
|
|||
@NotNull(message = "pageNo不能为空",groups = CandidateListForm.class) |
|||
private Integer pageNo; |
|||
|
|||
@NotNull(message = "pageSize不能为空",groups = CandidateListForm.class) |
|||
private Integer pageSize; |
|||
|
|||
private String customerId; |
|||
|
|||
} |
@ -0,0 +1,57 @@ |
|||
package com.epmet.dataaggre.dto.resigroup.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2021/3/30 上午9:15 |
|||
* @DESC |
|||
*/ |
|||
@Data |
|||
public class CandidateListResultDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 4720936429310456924L; |
|||
|
|||
/** |
|||
* resi_group_member.id: 成员id |
|||
*/ |
|||
private String memberId; |
|||
|
|||
/** |
|||
* 组员的用户id |
|||
*/ |
|||
private String userId; |
|||
|
|||
/** |
|||
* 成员头像 |
|||
*/ |
|||
private String headPhoto; |
|||
|
|||
/** |
|||
* 成员的显示名称 |
|||
*/ |
|||
private String userShowName; |
|||
|
|||
/** |
|||
* 徽章Url集合 |
|||
*/ |
|||
private String leaderFlag; |
|||
|
|||
/** |
|||
* leader群主,member成员 |
|||
*/ |
|||
private List<String> badgeList; |
|||
|
|||
public CandidateListResultDTO() { |
|||
this.memberId = ""; |
|||
this.userId = ""; |
|||
this.headPhoto = ""; |
|||
this.userShowName = ""; |
|||
this.leaderFlag = ""; |
|||
this.badgeList = new ArrayList<>(); |
|||
} |
|||
} |
@ -0,0 +1,47 @@ |
|||
package com.epmet.dataaggre.redis; |
|||
|
|||
import com.epmet.commons.tools.redis.RedisUtils; |
|||
import com.epmet.dataaggre.constant.GroupConstant; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Component; |
|||
import org.springframework.util.CollectionUtils; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2021/3/30 下午1:39 |
|||
* @DESC |
|||
*/ |
|||
@Component |
|||
@Slf4j |
|||
public class ResiGroupRedis { |
|||
|
|||
@Autowired |
|||
private RedisUtils redisUtils; |
|||
|
|||
/** |
|||
* @Description 获取用户徽章 |
|||
* @Param customerId |
|||
* @Param userId |
|||
* @author zxc |
|||
* @date 2021/3/30 下午3:33 |
|||
*/ |
|||
public List<String> getBadgeInfoByUserId(String customerId,String userId){ |
|||
String key = GroupConstant.BADGE_KEY+customerId+":"+userId; |
|||
List<Object> result = redisUtils.getListLrange(key); |
|||
if (!CollectionUtils.isEmpty(result)){ |
|||
List<String> icons = new ArrayList<>(); |
|||
for (Object o : result) { |
|||
Map<String,String> map = (Map<String, String>) o; |
|||
icons.add(map.get(GroupConstant.BADGE_ICON)); |
|||
} |
|||
return icons; |
|||
} |
|||
return new ArrayList<>(); |
|||
} |
|||
|
|||
} |
@ -1,8 +1,29 @@ |
|||
package com.epmet.dataaggre.service.epmetuser; |
|||
|
|||
import com.epmet.dataaggre.dto.epmetuser.result.UserInfosResultDTO; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2020/12/25 上午9:20 |
|||
*/ |
|||
public interface EpmetUserService { |
|||
|
|||
/** |
|||
* @Description 根据UserIds查询 |
|||
* @Param userIds |
|||
* @author zxc |
|||
* @date 2021/3/30 上午11:07 |
|||
*/ |
|||
List<UserInfosResultDTO> selectUserInfosByUserIds(List<String> userIds); |
|||
|
|||
/** |
|||
* @Description 查询是党员/热心居民的userId |
|||
* @Param userIds |
|||
* @author zxc |
|||
* @date 2021/4/1 上午9:08 |
|||
*/ |
|||
List<String> selectUserIdByCustomerId(List<String> userIds); |
|||
|
|||
} |
|||
|
@ -0,0 +1,43 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.project.dto; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.math.BigDecimal; |
|||
import java.util.Date; |
|||
|
|||
@Data |
|||
public class CustomerCategoryDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 父id |
|||
* pid = 0 查询一级分类 |
|||
* pid != 0 查询二级分类 |
|||
*/ |
|||
private String pid; |
|||
|
|||
/** |
|||
* 客户Id |
|||
*/ |
|||
private String customerId; |
|||
|
|||
} |
@ -0,0 +1,41 @@ |
|||
package com.epmet.project.dto.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @Author zhangyong |
|||
* @Description 002、项目分类字典查询 |
|||
**/ |
|||
@Data |
|||
public class ProjectCategoryDictResultDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 8529179932504931368L; |
|||
|
|||
/** |
|||
* 一级分类编码 |
|||
*/ |
|||
private String categoryCode; |
|||
|
|||
/** |
|||
* 一级分类名称 |
|||
*/ |
|||
private String categoryName; |
|||
|
|||
/** |
|||
* 二级分类列表 |
|||
*/ |
|||
private List<ProjectCategoryDictResultDTO> children; |
|||
|
|||
/** |
|||
* 主键 |
|||
**/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 上级分类ID 顶级此列存储0 |
|||
**/ |
|||
private String pid; |
|||
} |
@ -0,0 +1,27 @@ |
|||
package com.epmet.dto.screen; |
|||
|
|||
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; |
|||
import com.epmet.dto.screen.form.CategoryDictFormDTO; |
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 项目分类字典上报 |
|||
* @Auther: zhangyong |
|||
* @Date: 2021-03-22 |
|||
*/ |
|||
@Data |
|||
public class CategoryDictDataFormDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 当isFirst=true时,直接根据 customerId 删除原有数据,再批量insert。 |
|||
*/ |
|||
private Boolean isFirst; |
|||
|
|||
private List<CategoryDictFormDTO> dataList; |
|||
} |
@ -0,0 +1,61 @@ |
|||
package com.epmet.dto.screen.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* 项目分类字典上报 |
|||
* @Auther: zhangyong |
|||
* @Date: 2021-03-22 |
|||
*/ |
|||
@Data |
|||
public class CategoryDictFormDTO implements Serializable { |
|||
|
|||
|
|||
private static final long serialVersionUID = 1245827825857891963L; |
|||
/** |
|||
* 客户内自己的分类编码 |
|||
*/ |
|||
private String categoryCode; |
|||
|
|||
/** |
|||
* 客户内自己的分类名称 |
|||
*/ |
|||
private String categoryName; |
|||
|
|||
/** |
|||
* 父类分类编码,如果是一级分类,此列赋值为0 |
|||
*/ |
|||
private String parentCategoryCode; |
|||
|
|||
/** |
|||
* 分类等级:1、2....; |
|||
*/ |
|||
private Integer level; |
|||
|
|||
/** |
|||
* 排序 |
|||
*/ |
|||
private Integer sort; |
|||
|
|||
/** |
|||
* 当前分类对应产品内的分类编码,如果对应不上,此列传空 |
|||
*/ |
|||
private String epmetCategoryCode; |
|||
|
|||
/** |
|||
* 原始创建时间yyyy-MM-dd HH:mm:ss |
|||
*/ |
|||
private String originCreatedTime; |
|||
|
|||
/** |
|||
* 原始更新时间yyyy-MM-dd HH:mm:ss |
|||
*/ |
|||
private String orginUpdatedTime; |
|||
|
|||
/** |
|||
* 分类字典表主键 |
|||
*/ |
|||
private String categoryId; |
|||
} |
@ -0,0 +1,56 @@ |
|||
package com.epmet.dto.screen.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2021/3/23 下午2:38 |
|||
* @DESC |
|||
*/ |
|||
@Data |
|||
public class CategoryProjectResultDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = -5774330825880917524L; |
|||
|
|||
private String pid; |
|||
private String pids; |
|||
|
|||
/** |
|||
* 组织ID |
|||
*/ |
|||
private String orgId; |
|||
|
|||
/** |
|||
* 客户ID |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 分类码 |
|||
*/ |
|||
private String categoryCode; |
|||
|
|||
/** |
|||
* 项目总数 |
|||
*/ |
|||
private Integer projectTotal; |
|||
|
|||
/** |
|||
* 分类级别 |
|||
*/ |
|||
private Integer level; |
|||
|
|||
/** |
|||
* 日期ID |
|||
*/ |
|||
private String dateId; |
|||
|
|||
/** |
|||
* 组织级别 |
|||
*/ |
|||
private String orgType; |
|||
|
|||
private Boolean status = false; |
|||
} |
@ -0,0 +1,46 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.dao.evaluationindex.extract; |
|||
|
|||
import com.epmet.commons.mybatis.dao.BaseDao; |
|||
import com.epmet.dto.screen.ScreenProjectCategoryGridDailyDTO; |
|||
import com.epmet.entity.evaluationindex.extract.FactOriginProjectCategoryDailyEntity; |
|||
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 2021-03-19 |
|||
*/ |
|||
@Mapper |
|||
public interface FactOriginProjectCategoryDailyDao extends BaseDao<FactOriginProjectCategoryDailyEntity> { |
|||
|
|||
void deleteOldData(@Param("customerId") String customerId,@Param("dateId") String dateId); |
|||
|
|||
/** |
|||
* @param customerId |
|||
* @author yinzuomei |
|||
* @description 计算当前客户下,各个网格内,各项目分类下项目数量 |
|||
* @Date 2021/3/23 9:58 |
|||
**/ |
|||
List<ScreenProjectCategoryGridDailyDTO> selectListProjectCategoryGridDailyDTO(@Param("customerId") String customerId); |
|||
} |
@ -0,0 +1,41 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.dao.issue; |
|||
|
|||
import com.epmet.entity.issue.IssueProjectCategoryDictEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
import java.util.Date; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 议题项目分类字典 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-12-08 |
|||
*/ |
|||
@Mapper |
|||
public interface IssueProjectCategoryDictDao { |
|||
|
|||
List<IssueProjectCategoryDictEntity> listInsertCategoies(@Param("start") Date start, @Param("end") Date end); |
|||
|
|||
List<IssueProjectCategoryDictEntity> listByUpdatedTime(@Param("start") Date start, @Param("end") Date end); |
|||
|
|||
IssueProjectCategoryDictEntity getById(@Param("customerId")String customerId, @Param("id")String id);; |
|||
} |
@ -0,0 +1,63 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.dao.stats; |
|||
|
|||
import com.epmet.commons.mybatis.dao.BaseDao; |
|||
import com.epmet.dto.screen.form.CategoryDictFormDTO; |
|||
import com.epmet.entity.stats.CustomerProjectCategoryDictEntity; |
|||
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 2021-03-19 |
|||
*/ |
|||
@Mapper |
|||
public interface CustomerProjectCategoryDictDao extends BaseDao<CustomerProjectCategoryDictEntity> { |
|||
|
|||
CustomerProjectCategoryDictEntity getLatestProjectCategory(); |
|||
|
|||
CustomerProjectCategoryDictEntity getLatestUpdatedEntity(); |
|||
|
|||
CustomerProjectCategoryDictEntity selectByCustomerIdAndId(@Param("customerId") String customerId, @Param("categoryId") String categoryId); |
|||
|
|||
/** |
|||
* 当isFirst=true时,直接根据 customerId 删除原有数据,再批量insert。 |
|||
* |
|||
* @param customerId |
|||
* @return java.lang.Integer |
|||
* @Author zhangyong |
|||
* @Date 16:12 2021-03-22 |
|||
**/ |
|||
Integer deleteCustomerProjectCategoryDict(@Param("customerId") String customerId); |
|||
|
|||
/** |
|||
* 批量insert。 |
|||
* |
|||
* @param list |
|||
* @param customerId |
|||
* @return void |
|||
* @Author zhangyong |
|||
* @Date 16:13 2021-03-22 |
|||
**/ |
|||
void batchInsertCustomerProjectCategoryDict(@Param("list") List<CategoryDictFormDTO> list, @Param("customerId")String customerId); |
|||
} |
@ -0,0 +1,63 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.entity.evaluationindex.extract; |
|||
|
|||
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 2021-03-19 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("fact_origin_project_category_daily") |
|||
public class FactOriginProjectCategoryDailyEntity extends BaseEpmetEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 客户id |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 项目id |
|||
*/ |
|||
private String projectId; |
|||
|
|||
/** |
|||
* 分类编码 |
|||
*/ |
|||
private String categoryCode; |
|||
|
|||
/** |
|||
* 所属父类分类编码 |
|||
*/ |
|||
private String parentCategoryCode; |
|||
|
|||
/** |
|||
* 分类等级:1、2....;产品目前只有2级分类 |
|||
*/ |
|||
private Integer level; |
|||
|
|||
} |
@ -0,0 +1,83 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.entity.issue; |
|||
|
|||
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 2020-12-08 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("issue_project_category_dict") |
|||
public class IssueProjectCategoryDictEntity extends BaseEpmetEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 客户id, 产品默认default |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 上级分类ID 顶级此列存储0 |
|||
*/ |
|||
private String pid; |
|||
|
|||
/** |
|||
* 所有上级分类ID,用逗号分开 |
|||
*/ |
|||
private String pids; |
|||
|
|||
/** |
|||
* 上级分类编码 |
|||
*/ |
|||
private String parentCategoryCode; |
|||
|
|||
/** |
|||
* 分类编码,分类编码+customer_id唯一 |
|||
*/ |
|||
private String categoryCode; |
|||
|
|||
/** |
|||
* 分类名称 |
|||
*/ |
|||
private String categoryName; |
|||
|
|||
/** |
|||
* 分类类别1,2,3,4.... |
|||
*/ |
|||
private String categoryType; |
|||
|
|||
/** |
|||
* 排序 |
|||
*/ |
|||
private Integer sort; |
|||
|
|||
/** |
|||
* 是否禁用(enable:启用 disable:禁用) |
|||
*/ |
|||
private String isDisable; |
|||
|
|||
} |
@ -0,0 +1,95 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.entity.stats; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 客户项目分类字典表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-03-19 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("customer_project_category_dict") |
|||
public class CustomerProjectCategoryDictEntity extends BaseEpmetEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 客户id |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 外部客户:external;内部客户:internal |
|||
*/ |
|||
private String customerType; |
|||
|
|||
/** |
|||
* 客户自己的分类编码 |
|||
*/ |
|||
private String categoryCode; |
|||
|
|||
/** |
|||
* 客户自己的分类名称 |
|||
*/ |
|||
private String categoryName; |
|||
|
|||
/** |
|||
* 父类分类编码,如果是一级分类,此列赋值为0 |
|||
*/ |
|||
private String parentCategoryCode; |
|||
|
|||
/** |
|||
* 分类等级:1、2....;产品只有2级分类 |
|||
*/ |
|||
private Integer level; |
|||
|
|||
/** |
|||
* 排序 |
|||
*/ |
|||
private Integer sort; |
|||
|
|||
/** |
|||
* 是否禁用(enable:启用 disable:禁用) |
|||
*/ |
|||
private String isDisable; |
|||
|
|||
/** |
|||
* 对应e世通中的分类编码,没有此列为空 |
|||
*/ |
|||
private String epmetCategoryCode; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private Date originCreatedTime; |
|||
/** |
|||
* 修改时间 |
|||
*/ |
|||
private Date originUpdatedTime; |
|||
|
|||
private String categoryId; |
|||
} |
@ -0,0 +1,39 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.service.Issue; |
|||
|
|||
import com.epmet.entity.issue.IssueProjectCategoryDictEntity; |
|||
|
|||
import java.util.Date; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 议题项目分类字典 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-12-08 |
|||
*/ |
|||
|
|||
public interface IssueProjectCategoryDictService{ |
|||
|
|||
List<IssueProjectCategoryDictEntity> listInsertCategoies(Date start, Date end); |
|||
|
|||
List<IssueProjectCategoryDictEntity> listByUpdatedTime(Date start, Date end); |
|||
|
|||
IssueProjectCategoryDictEntity getById(String customerId,String id); |
|||
} |
@ -0,0 +1,42 @@ |
|||
package com.epmet.service.Issue.impl; |
|||
|
|||
import com.epmet.commons.dynamic.datasource.annotation.DataSource; |
|||
import com.epmet.constant.DataSourceConstant; |
|||
import com.epmet.dao.issue.IssueProjectCategoryDictDao; |
|||
import com.epmet.entity.issue.IssueProjectCategoryDictEntity; |
|||
import com.epmet.service.Issue.IssueProjectCategoryDictService; |
|||
import org.apache.ibatis.annotations.Param; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.Date; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 描述一下 |
|||
* |
|||
* @author yinzuomei@elink-cn.com |
|||
* @date 2021/3/19 15:29 |
|||
*/ |
|||
@Service |
|||
@DataSource(DataSourceConstant.GOV_ISSUE) |
|||
public class IssueProjectCategoryDictServiceImpl implements IssueProjectCategoryDictService { |
|||
@Autowired |
|||
private IssueProjectCategoryDictDao issueProjectCategoryDictDao; |
|||
|
|||
@Override |
|||
public List<IssueProjectCategoryDictEntity> listInsertCategoies(Date start, Date end) { |
|||
return issueProjectCategoryDictDao.listInsertCategoies(start, end); |
|||
} |
|||
|
|||
@Override |
|||
public List<IssueProjectCategoryDictEntity> listByUpdatedTime(Date start, Date end) { |
|||
return issueProjectCategoryDictDao.listByUpdatedTime(start, end); |
|||
} |
|||
|
|||
@Override |
|||
public IssueProjectCategoryDictEntity getById(String customerId, String id) { |
|||
return issueProjectCategoryDictDao.getById(customerId,id); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,50 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.service.evaluationindex.extract.todata; |
|||
|
|||
import com.epmet.commons.mybatis.service.BaseService; |
|||
import com.epmet.dto.extract.form.ExtractOriginFormDTO; |
|||
import com.epmet.dto.screen.ScreenProjectCategoryGridDailyDTO; |
|||
import com.epmet.entity.evaluationindex.extract.FactOriginProjectCategoryDailyEntity; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 项目所属分类表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-03-19 |
|||
*/ |
|||
public interface FactOriginProjectCategoryDailyService extends BaseService<FactOriginProjectCategoryDailyEntity> { |
|||
/** |
|||
* @Description 将epmet_gov_project库中的项目分类信息(project_category)同步到统计库epmet_data_statistical |
|||
* @param paramNew |
|||
* @return void |
|||
* @Author liushaowen |
|||
* @Date 2021/3/22 15:28 |
|||
*/ |
|||
void extractProjectCategory(ExtractOriginFormDTO paramNew); |
|||
|
|||
/** |
|||
* @param customerId |
|||
* @author yinzuomei |
|||
* @description 计算当前客户下,各个网格内,各项目分类下项目数量 |
|||
* @Date 2021/3/23 9:56 |
|||
**/ |
|||
List<ScreenProjectCategoryGridDailyDTO> selectListProjectCategoryGridDailyDTO(String customerId); |
|||
} |
@ -0,0 +1,122 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.service.evaluationindex.extract.todata.impl; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.epmet.commons.dynamic.datasource.annotation.DataSource; |
|||
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|||
import com.epmet.commons.tools.constant.NumConstant; |
|||
import com.epmet.constant.DataSourceConstant; |
|||
import com.epmet.dao.evaluationindex.extract.FactOriginProjectCategoryDailyDao; |
|||
import com.epmet.dto.ProjectCategoryDTO; |
|||
import com.epmet.dto.extract.form.ExtractOriginFormDTO; |
|||
import com.epmet.dto.screen.ScreenProjectCategoryGridDailyDTO; |
|||
import com.epmet.entity.evaluationindex.extract.FactOriginProjectCategoryDailyEntity; |
|||
import com.epmet.entity.issue.IssueProjectCategoryDictEntity; |
|||
import com.epmet.service.Issue.IssueProjectCategoryDictService; |
|||
import com.epmet.service.evaluationindex.extract.todata.FactOriginProjectCategoryDailyService; |
|||
import com.epmet.service.project.ProjectService; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
import org.springframework.util.CollectionUtils; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 项目所属分类表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-03-19 |
|||
*/ |
|||
@Service |
|||
@DataSource(DataSourceConstant.STATS) |
|||
@Slf4j |
|||
public class FactOriginProjectCategoryDailyServiceImpl extends BaseServiceImpl<FactOriginProjectCategoryDailyDao, FactOriginProjectCategoryDailyEntity> implements FactOriginProjectCategoryDailyService { |
|||
@Autowired |
|||
private ProjectService projectService; |
|||
@Autowired |
|||
private IssueProjectCategoryDictService issueProjectCategoryDictService; |
|||
/** |
|||
* @param extractOriginFormDTO |
|||
* @return void |
|||
* @Description 将epmet_gov_project库中的项目分类信息(project_category)同步到统计库epmet_data_statistical |
|||
* @Author liushaowen |
|||
* @Date 2021/3/22 15:28 |
|||
*/ |
|||
@Override |
|||
public void extractProjectCategory(ExtractOriginFormDTO extractOriginFormDTO) { |
|||
String dateString = extractOriginFormDTO.getDateId(); |
|||
String customerId = extractOriginFormDTO.getCustomerId(); |
|||
List<FactOriginProjectCategoryDailyEntity> entities = new ArrayList<>(); |
|||
Integer count = baseDao.selectCount(new QueryWrapper<FactOriginProjectCategoryDailyEntity>().eq("customer_id",customerId)); |
|||
//如果count = 0 初始化该customer所有数据
|
|||
if (NumConstant.ZERO == count){ |
|||
dateString = null; |
|||
} |
|||
List<ProjectCategoryDTO> projectCategoryData = projectService.getProjectCategoryData(customerId, dateString); |
|||
if (!CollectionUtils.isEmpty(projectCategoryData)){ |
|||
projectCategoryData.forEach(data->{ |
|||
FactOriginProjectCategoryDailyEntity insertEntity = new FactOriginProjectCategoryDailyEntity(); |
|||
IssueProjectCategoryDictEntity categoryDictEntity = issueProjectCategoryDictService.getById(customerId, data.getCategoryId()); |
|||
if (categoryDictEntity == null){ |
|||
log.warn("categoryDict not found : customerId:{},categoryId:{}",customerId,data.getCategoryId()); |
|||
} |
|||
insertEntity.setProjectId(data.getProjectId()); |
|||
insertEntity.setCategoryCode(categoryDictEntity.getCategoryCode()); |
|||
insertEntity.setParentCategoryCode(categoryDictEntity.getParentCategoryCode()); |
|||
insertEntity.setCustomerId(customerId); |
|||
insertEntity.setLevel(Integer.valueOf(categoryDictEntity.getCategoryType())); |
|||
insertEntity.setCreatedTime(data.getCreatedTime()); |
|||
entities.add(insertEntity); |
|||
}); |
|||
if (!CollectionUtils.isEmpty(entities)){ |
|||
delAndInsert(customerId,dateString,entities); |
|||
} |
|||
} |
|||
} |
|||
/** |
|||
* @Description category表删除插入 |
|||
* @param customerId |
|||
* @param dateId |
|||
* @param result |
|||
* @return void |
|||
* @Author liushaowen |
|||
* @Date 2021/3/22 17:01 |
|||
*/ |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void delAndInsert(String customerId,String dateId,List<FactOriginProjectCategoryDailyEntity> result){ |
|||
baseDao.deleteOldData(customerId, dateId); |
|||
insertBatch(result); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* @param customerId |
|||
* @author yinzuomei |
|||
* @description 计算当前客户下,各个网格内,各项目分类下项目数量 |
|||
* @Date 2021/3/23 9:56 |
|||
**/ |
|||
@Override |
|||
public List<ScreenProjectCategoryGridDailyDTO> selectListProjectCategoryGridDailyDTO(String customerId) { |
|||
List<ScreenProjectCategoryGridDailyDTO> list=baseDao.selectListProjectCategoryGridDailyDTO(customerId); |
|||
return list; |
|||
} |
|||
} |
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue