添加webSocket;添加ecpp配置

This commit is contained in:
DB 2023-11-24 22:31:42 +08:00
parent 9ad0bc0ed5
commit 32dbd17038
12 changed files with 229 additions and 140 deletions

2
.gitignore vendored
View File

@ -20,6 +20,8 @@ target/
*.iml
*.ipr
*.log
.jlsp
.arts
### NetBeans ###
/nbproject/private/
/nbbuild/

View File

@ -0,0 +1,20 @@
package com.cpop.api.tencent.wxWork.core.config;
import com.cpop.api.tencent.wxWork.core.config.ecpp.EcppProperties;
import lombok.Getter;
import org.springframework.context.annotation.Configuration;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
/**
* Description 数字人民币API配置类
* @authors DB
* @date 2023-11-24 17:27:07
* @version 1.0.0
*/
@Getter
@Configuration
@EnableConfigurationProperties(EcppProperties.class)
public class EcppApiConfig {
}

View File

@ -0,0 +1,33 @@
package com.cpop.api.tencent.wxWork.core.config.ecpp;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
/**
* Description 数字人民币配置
* @authors DB
* @date 2023-11-24 17:34:59
* @version 1.0.0
*/
@Data
@ConfigurationProperties(prefix = "ecpp.pay")
public class EcppProperties {
/**基础路径 */
private String baseUrl;
/**应用/平台标识 */
private String appId;
/**公钥 */
private String appType;
/**签名身份类型1、平台2、商户; 3、用户 */
private String signatureIdType;
/**签名身份标识 */
private String signatureId;
/**公钥 */
private String publicKey;
}

View File

@ -11,7 +11,7 @@ import org.springframework.context.annotation.Configuration;
*/
@Data
@Configuration
@ConfigurationProperties(prefix = "pupu.api.tencent.wx-work")
@ConfigurationProperties(prefix = "cpop.api.tencent.wx-work")
public class WxWorkApiConfig {
/**

View File

@ -1 +1,13 @@
#数币
ecpp:
pay:
appId: 1000
signatureIdType: 1
signatureId: 90035603022098432
publicKey: MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA32A6vFBgXZgVgzaboSHjMMfJxrxXITDkdgzMR/WpTdxJvqZyyZtPOtdL4wg6St4lki4W/SMH6zTWJX07HYeWl8KiSOAXr2kcqHWPhO+rmtq8rMaR831f9ot7GK/6hkKUFRQZ8Uev8pGnOO4w5n+AaLOkohd+K0WXoaNokD+vxvZO7+yTYY/WAT30ItaMY0Ld5o3rRRo63lHuNlBjQ6mP8U6pPXek0J+oONraxJwZPsCEGTw3tfsXi0uMViRRXfp33H2xBZ11wrRrY/l5Pp8YPpJCxrCyzGcwlNqsT4VuEW4NglMyyU0g0J9mR+eIZS2kmuhpwjshyGC2Soc7DYdNUwIDAQAB
paycallback: /callback/ecnypaypass/pay
#腾讯
tencent:
#企业微信
wx-work:

View File

@ -1,16 +1,16 @@
# 项目相关配置
cpop:
# 文件路径 示例( Windows配置W:/WorkSpace/java/uploadPathLinux配置 /home/baseFramework/uploadPath
profile: E:/Cpop/uploadPath
profile: D:/Cpop/uploadPath
jwt:
#白名单
whiteList: /login,/getCaptcha,/profile/**,/doc.html,/webjars/**,/favicon.ico,/v2/api-docs/**,/swagger-resources,/wxCp/*,/wxCp/portal/*/registerCode
whiteList: /websocket/*,/login,/getCaptcha,/profile/**,/doc.html,/webjars/**,/favicon.ico,/v2/api-docs/**,/swagger-resources,/wxCp/*,/wxCp/portal/*/registerCode
gateway:
rsa-keypair:
# 公钥文件
publicKeyFile: E:\Cpop\Cpop-Union\Cpop-Core\src\main\resources\static\keyPair\publicKey
publicKeyFile: D:\Cpop\Cpop-Union\Cpop-Core\src\main\resources\static\keyPair\publicKey
# 公钥文件
privateKeyFile: E:\Cpop\Cpop-Union\Cpop-Core\src\main\resources\static\keyPair\privateKey
privateKeyFile: D:\Cpop\Cpop-Union\Cpop-Core\src\main\resources\static\keyPair\privateKey
# DataSource Config
spring:
@ -88,8 +88,8 @@ knife4j:
wx:
pay:
# p12证书的位置可以指定绝对路径也可以指定类路径以classpath:开头)
keyPath: E:/Cpop/Cpop-Union/Cpop-Core/src/main/resources/static/keyPair/wxPay_cert.p12
keyPath: D:/Cpop/Cpop-Union/Cpop-Core/src/main/resources/static/keyPair/wxPay_cert.p12
# 私钥证书
privateKeyPath: E:/Cpop/Cpop-Union/Cpop-Core/src/main/resources/static/keyPair/wxPay_key.pem
privateKeyPath: D:/Cpop/Cpop-Union/Cpop-Core/src/main/resources/static/keyPair/wxPay_key.pem
# 私钥文件
privateCertPath: E:/Cpop/Cpop-Union/Cpop-Core/src/main/resources/static/keyPair/wxPay_cert.pem
privateCertPath: D:/Cpop/Cpop-Union/Cpop-Core/src/main/resources/static/keyPair/wxPay_cert.pem

View File

@ -4,7 +4,7 @@ cpop:
profile: /root/cpop-union/cpop-oam/upload
jwt:
#白名单
whiteList: /login,/getCaptcha,/profile/**,/wxOpen/receiveTicket,/wxOpen/*/callback,/wxOpen/bindOpenAccount/*,/wxCp/portal/*,/wxCp/*,/wxCp/portal/*/registerCode
whiteList: /websocket/*,/login,/getCaptcha,/profile/**,/wxOpen/receiveTicket,/wxOpen/*/callback,/wxOpen/bindOpenAccount/*,/wxCp/portal/*,/wxCp/*,/wxCp/portal/*/registerCode
#拦截
gateway:
rsa-keypair:

View File

@ -4,7 +4,7 @@ cpop:
profile: /root/cpop-union/cpop-mall/upload
jwt:
#白名单
whiteList: /login,/getCaptcha,/profile/**,/doc.html,/webjars/**,/favicon.ico,/v2/api-docs/**,/swagger-resources,/wxOpen/receiveTicket,/wxOpen/*/callback,/wxOpen/bindOpenAccount/*,/wxCp/portal/*,/wxCp/portal/*/registerCode,/wxCp/*
whiteList: /websocket/*,/login,/getCaptcha,/profile/**,/doc.html,/webjars/**,/favicon.ico,/v2/api-docs/**,/swagger-resources,/wxOpen/receiveTicket,/wxOpen/*/callback,/wxOpen/bindOpenAccount/*,/wxCp/portal/*,/wxCp/portal/*/registerCode,/wxCp/*
#拦截
gateway:
rsa-keypair:

View File

@ -92,7 +92,6 @@ public class CommonServiceImpl implements CommonService {
*/
@Override
public ConfigInfoVo getSysConfigInfo() {
ConfigInfoVo sysConfigInfoVo = new ConfigInfoVo();
RedisService redisService = SpringUtils.getBean(RedisService.class);
CoreService coreService = SpringUtils.getBean(CoreService.class);
//获取企业微信信息
@ -105,14 +104,15 @@ public class CommonServiceImpl implements CommonService {
configMap.put(sysConfigEnum.getField(), cacheInfo);
} else {
//查询系统
String value = coreService.selectConfigByKey(item).getConfigValue();
if (StringUtils.isNotBlank(value)) {
SysConfig sysConfig = coreService.selectConfigByKey(item);
if (null !=sysConfig) {
//获取枚举
OamConfigEnum sysConfigEnum = OamConfigEnum.matchKey(item);
configMap.put(sysConfigEnum.getField(), value);
configMap.put(sysConfigEnum.getField(), sysConfig.getConfigValue());
}
}
});
ConfigInfoVo sysConfigInfoVo = new ConfigInfoVo();
BeanUtils.mapToObj(configMap, sysConfigInfoVo);
return sysConfigInfoVo;
}

View File

@ -1,6 +1,7 @@
package com.cpop.oam.business.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.cpop.system.framework.ws.server.WebSocketServer;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.spring.service.impl.ServiceImpl;
@ -72,8 +73,10 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
@Override
public Page<TaskPageVo> getTaskPage(TaskPageBo bo) {
PageDomain pageDomain = SqlUtils.getInstance().getPageDomain();
return this.mapper.paginateAs(pageDomain.getPageNum(),pageDomain.getPageSize(),
QueryWrapper.create().where(TASK.TASK_STATUS.eq(1))
return this.mapper.paginateAs(pageDomain.getPageNum(),
pageDomain.getPageSize(),
QueryWrapper.create()
.where(TASK.TASK_STATUS.eq(1))
.and(TASK.TASK_TYPE.eq(bo.getTaskType()))
.and(TASK.TASK_RATING.eq(bo.getTaskRating()))
.orderBy(TASK.EXPECTED_COMPLETION_DATE.asc()),
@ -110,7 +113,11 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
List<String> phoneList = new ArrayList<String>();
phoneList.add(auditStaffPhone);
try {
SpringUtils.getBean(WebHookSendHandler.class).webHookSendText(WebHookKeyConstant.PRODUCT_BOT, phoneList, "==========您有一条新的迭代任务需要审核==========", false);
SpringUtils.getBean(WebHookSendHandler.class)
.webHookSendText(WebHookKeyConstant.PRODUCT_BOT,
phoneList,
"==========您有一条新的迭代任务需要审核==========",
false);
} catch (IOException e) {
throw new ServiceException("发送通知失败!");
}
@ -125,10 +132,9 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
@Override
public Page<TaskAuditPageVo> getTaskAuditPage() {
PageDomain pageDomain = SqlUtils.getInstance().getPageDomain();
return this.mapper.paginateAs(pageDomain.getPageNum(),pageDomain.getPageSize(),
QueryWrapper.create()
.where(TASK.TASK_STATUS.eq(0))
.orderBy(TASK.CREATE_TIME.desc()),
return this.mapper.paginateAs(pageDomain.getPageNum(),
pageDomain.getPageSize(),
QueryWrapper.create().where(TASK.TASK_STATUS.eq(0)).orderBy(TASK.CREATE_TIME.desc()),
TaskAuditPageVo.class);
}
@ -143,6 +149,12 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
public void setTaskAuditComments(TaskAuditCommentsBo bo) {
Task entity = BeanUtils.mapToClass(bo, Task.class);
this.updateById(entity);
// 如果通过,可以通过websocket进行通信
if (bo.getTaskStatus() == 1) {
// 获取任务信息
Task task = this.getById(bo.getId());
SpringUtils.getBean(WebSocketServer.class).sendInfo("您的任务" + task.getTaskName() + "已通过,请注意接收:", task.getResponsibleStaffId());
}
}
/**
@ -155,10 +167,9 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
public Page<TaskAuditPageVo> getTaskRejectPage() {
// 获取当前用户信息
PageDomain pageDomain = SqlUtils.getInstance().getPageDomain();
return this.mapper.paginateAs(pageDomain.getPageNum(),pageDomain.getPageSize(),
QueryWrapper.create()
.where(TASK.TASK_STATUS.eq(-1))
.orderBy(TASK.CREATE_TIME.desc()),
return this.mapper.paginateAs(pageDomain.getPageNum(),
pageDomain.getPageSize(),
QueryWrapper.create().where(TASK.TASK_STATUS.eq(-1)).orderBy(TASK.CREATE_TIME.desc()),
TaskAuditPageVo.class);
}
@ -247,9 +258,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
default:
taskRatingPoint = 10;
}
taskStaffGroup.setStaffId(task.getResponsibleStaffId())
.setTaskId(id)
.setGradePoint(taskRatingPoint);
taskStaffGroup.setStaffId(task.getResponsibleStaffId()).setTaskId(id).setGradePoint(taskRatingPoint);
SpringUtils.getBean(TaskStaffGroupService.class).save(taskStaffGroup);
}
@ -267,8 +276,8 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
if (Constants.SUPER_ADMIN.equals(loginUser.getUsername())) {
// TODO超级管理员暂时获取所有任务
} else {
Staff staff = SpringUtils.getBean(StaffService.class).getOne(QueryWrapper.create()
.where(STAFF.USER_ID.eq(loginUser.getUserId())));
Staff staff = SpringUtils.getBean(StaffService.class)
.getOne(QueryWrapper.create().where(STAFF.USER_ID.eq(loginUser.getUserId())));
staffId = staff.getId();
}
// 任务状态
@ -280,14 +289,17 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
queryWrapper.and(TASK.TASK_STATUS.in(2, 4));
}
PageDomain pageDomain = SqlUtils.getInstance().getPageDomain();
return this.mapper.paginateAs(pageDomain.getPageNum(),pageDomain.getPageSize(),
return this.mapper.paginateAs(pageDomain.getPageNum(),
pageDomain.getPageSize(),
queryWrapper.select(TASK.ALL_COLUMNS)
.select(STAFF.NAME.as(PersonTaskPageVo::getResponsibleStaffName))
.from(TASK)
// 员工表
.leftJoin(STAFF).on(STAFF.ID.eq(TASK.RESPONSIBLE_STAFF_ID))
.leftJoin(STAFF)
.on(STAFF.ID.eq(TASK.RESPONSIBLE_STAFF_ID))
// 任务员工组
.leftJoin(TASK_STAFF_GROUP).on(TASK_STAFF_GROUP.TASK_ID.eq(TASK.ID))
.leftJoin(TASK_STAFF_GROUP)
.on(TASK_STAFF_GROUP.TASK_ID.eq(TASK.ID))
.where(TASK.TASK_TYPE.in(0, 1))
.and(TASK_STAFF_GROUP.STAFF_ID.eq(staffId))
.orderBy(TASK.EXPECTED_COMPLETION_DATE.asc()),
@ -304,9 +316,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
@Override
public void updateTaskItem(TaskItemBo bo) {
isTaskResponsibleStaff(bo.getId());
this.updateChain().set(TASK.TASK_ITEM, bo.getTaskItem())
.where(TASK.ID.eq(bo.getId()))
.update();
this.updateChain().set(TASK.TASK_ITEM, bo.getTaskItem()).where(TASK.ID.eq(bo.getId())).update();
}
/**
@ -422,9 +432,11 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
} else {
// 查询个人涉及到的任务
TaskStaffGroupService taskStaffGroupService = SpringUtils.getBean(TaskStaffGroupService.class);
taskStaffGroups = taskStaffGroupService.list(QueryWrapper.create().where(TASK_STAFF_GROUP.STAFF_ID.eq(loginUserInfo.getString("id"))));
taskStaffGroups = taskStaffGroupService
.list(QueryWrapper.create().where(TASK_STAFF_GROUP.STAFF_ID.eq(loginUserInfo.getString("id"))));
if (!taskStaffGroups.isEmpty()) {
queryWrapper.and(TASK.ID.in(taskStaffGroups.stream().map(TaskStaffGroup::getTaskId).collect(Collectors.toSet())));
queryWrapper.and(
TASK.ID.in(taskStaffGroups.stream().map(TaskStaffGroup::getTaskId).collect(Collectors.toSet())));
}
if (taskStaffGroups.isEmpty()) {
return new TaskMonthStatisticsVo();
@ -442,8 +454,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
LocalDate now = LocalDate.now();
firstDay = now.with(TemporalAdjusters.firstDayOfMonth());
}
List<Task> taskList = this.list(queryWrapper
.select(TASK.ALL_COLUMNS)
List<Task> taskList = this.list(queryWrapper.select(TASK.ALL_COLUMNS)
.and(TASK.EXPECTED_COMPLETION_DATE.ge(firstDay))
.orderBy(TASK.EXPECTED_COMPLETION_DATE.asc()));
if (taskList.isEmpty()) {
@ -459,7 +470,8 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
* @Author: DB
* @Date: 2023/5/15 17:54
**/
private TaskMonthStatisticsVo buildMonthTaskStatistics(List<Task> taskList, TaskMonthStatisticsBo bo ,List<TaskStaffGroup> taskStaffGroups) {
private TaskMonthStatisticsVo buildMonthTaskStatistics(List<Task> taskList, TaskMonthStatisticsBo bo,
List<TaskStaffGroup> taskStaffGroups) {
TaskMonthStatisticsVo statisticsVo = new TaskMonthStatisticsVo();
List<TaskMonthStatisticsVo.DataStatisticsVo> vos = new ArrayList<>();
statisticsVo.setVos(vos);
@ -467,7 +479,8 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
// 进行中运营人员
statisticsVo.setInProgress(taskList.stream().filter(s -> 2 == s.getTaskStatus()).count());
// 已完成
Set<String> finishTaskSet = taskList.stream().filter(s -> 3 == s.getTaskStatus()).map(Task::getId).collect(Collectors.toSet());
Set<String> finishTaskSet =
taskList.stream().filter(s -> 3 == s.getTaskStatus()).map(Task::getId).collect(Collectors.toSet());
statisticsVo.setHaveCompleted(Long.parseLong(String.valueOf(finishTaskSet.size())));
// 已逾期
statisticsVo.setOverdue(taskList.stream().filter(s -> 4 == s.getTaskStatus()).count());
@ -476,11 +489,16 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
// 逾期完成
statisticsVo.setOverdueCompletion(taskList.stream().filter(s -> 6 == s.getTaskStatus()).count());
// 逾期完成
Set<String> overdueCompletionSet = taskList.stream().filter(s -> 6 == s.getTaskStatus()).map(Task::getId).collect(Collectors.toSet());
Set<String> overdueCompletionSet =
taskList.stream().filter(s -> 6 == s.getTaskStatus()).map(Task::getId).collect(Collectors.toSet());
if (null != taskStaffGroups) {
// 统计绩点(计算已完成的和逾期完成)
Long finishGpa = statisticalGPA(taskStaffGroups.stream().filter(s -> finishTaskSet.contains(s.getTaskId())).collect(Collectors.toList()));
Long overdueCompletionGpa = statisticalGPA(taskStaffGroups.stream().filter(s -> overdueCompletionSet.contains(s.getTaskId())).collect(Collectors.toList()));
Long finishGpa = statisticalGPA(taskStaffGroups.stream()
.filter(s -> finishTaskSet.contains(s.getTaskId()))
.collect(Collectors.toList()));
Long overdueCompletionGpa = statisticalGPA(taskStaffGroups.stream()
.filter(s -> overdueCompletionSet.contains(s.getTaskId()))
.collect(Collectors.toList()));
statisticsVo.setGpaOfTheMonth(finishGpa + overdueCompletionGpa);
}
List<Date> allTheDateOfMonth;
@ -499,7 +517,8 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
taskList.forEach(task -> {
// 接受时间
LocalDate date = task.getTaskReceiptTime().toLocalDate();
if (localDate.compareTo(date) >= 0 && localDate.compareTo(task.getExpectedCompletionDate().toLocalDate()) <= 0){
if (localDate.compareTo(date) >= 0
&& localDate.compareTo(task.getExpectedCompletionDate().toLocalDate()) <= 0) {
taskNames.add(task.getTaskName());
}
});

View File

@ -13,6 +13,8 @@ import org.springframework.stereotype.Service;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import com.cpop.core.utils.SpringUtils;
import com.cpop.system.framework.ws.server.WebSocketServer;
/**
* @author DB

View File

@ -2,13 +2,14 @@ package com.cpop.system.framework.ws.server;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import javax.websocket.*;
import javax.websocket.server.PathParam;
import javax.websocket.server.ServerEndpoint;
import java.io.IOException;
import java.util.concurrent.CopyOnWriteArraySet;
import java.util.concurrent.atomic.AtomicInteger;
import com.cpop.core.base.exception.ServiceException;
/**
* @author DB
@ -24,7 +25,7 @@ public class WebSocketServer {
/**
* 静态变量用来记录当前在线连接数应该把它设计成线程安全的
*/
private static int onlineCount = 0;
private static AtomicInteger onlineCount = new AtomicInteger(0);
/**
* concurrent包的线程安全Set用来存放每个客户端对应的MyWebSocket对象
*/
@ -112,7 +113,7 @@ public class WebSocketServer {
/**
* 群发自定义消息
*/
public static void sendInfo(String message, @PathParam("sid") String sid) throws IOException {
public static void sendInfo(String message, @PathParam("sid") String sid) {
log.info("推送消息到窗口" + sid + ",推送内容:" + message);
for (WebSocketServer item : webSocketSet) {
try {
@ -123,21 +124,21 @@ public class WebSocketServer {
item.sendMessage(message);
}
} catch (IOException e) {
continue;
throw new ServiceException("发送webSocket消息失败!");
}
}
}
public static synchronized int getOnlineCount() {
public static synchronized AtomicInteger getOnlineCount() {
return onlineCount;
}
public static synchronized void addOnlineCount() {
WebSocketServer.onlineCount++;
WebSocketServer.onlineCount.incrementAndGet();
}
public static synchronized void subOnlineCount() {
WebSocketServer.onlineCount--;
WebSocketServer.onlineCount.decrementAndGet();
}
public static CopyOnWriteArraySet<WebSocketServer> getWebSocketSet() {