添加一次性支付分账;添加工单暂停回复定时器;修订报销批量转交;添加菜单允许缓存;添加店铺子商户
This commit is contained in:
parent
d3ca17d681
commit
a4788fc73e
@ -42,6 +42,7 @@ import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import com.zaxxer.hikari.HikariDataSource;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -67,6 +68,11 @@ public class EasyLearnOrderServiceImpl extends ServiceImpl<EasyLearnOrderMapper,
|
||||
@Autowired
|
||||
private WxPayAsyncTask wxPayAsyncTask;
|
||||
|
||||
/**
|
||||
* 一次性支付回调地址
|
||||
*/
|
||||
private final String ONCE_PAY_NOTIFY_URL = "https://api.jamboxsys.com/Cpop-Mall/easyLearn/callback/notify/order";
|
||||
|
||||
/**
|
||||
* 获取放心学分页
|
||||
*
|
||||
@ -356,12 +362,18 @@ public class EasyLearnOrderServiceImpl extends ServiceImpl<EasyLearnOrderMapper,
|
||||
throw new ServiceException(notifyResult.getReturnMsg());
|
||||
}
|
||||
String orderId = notifyResult.getOutTradeNo();
|
||||
//更新订单
|
||||
this.updateChain().set(EASY_LEARN_ORDER.OUT_ORDER_NO, notifyResult.getTransactionId()).where(EASY_LEARN_ORDER.ID.eq(orderId)).update();
|
||||
//需要分账
|
||||
if (notifyResult.getTotalFee() >= Math.ceil(1 / OrderSource.MALL.getRate())) {
|
||||
//获取订单信息
|
||||
EasyLearnOrder easyLearnOrder = this.getById(orderId);
|
||||
//设置子商户
|
||||
wxPayService.getConfig().setSubMchId(wxPayHandler.getSubMchId(easyLearnOrder.getBrandId(), easyLearnOrder.getStoreId()));
|
||||
wxPayAsyncTask.asyncWxPayProfitSharing(orderId, notifyResult, wxPayService, OrderSource.EASY_LEARN);
|
||||
}
|
||||
//更新订单
|
||||
this.updateChain().set(EASY_LEARN_ORDER.OUT_ORDER_NO, notifyResult.getTransactionId()).where(EASY_LEARN_ORDER.ID.eq(orderId)).update();
|
||||
//TODO: 通知波哥办卡
|
||||
SpringUtils.getBean(RestTemplate.class);
|
||||
} catch (WxPayException e) {
|
||||
throw new ServiceException(e.getMessage());
|
||||
}
|
||||
@ -416,7 +428,7 @@ public class EasyLearnOrderServiceImpl extends ServiceImpl<EasyLearnOrderMapper,
|
||||
easyLearnOrder.setOrderType(2).setBrandId(brandExtend.getBrandId()).setStoreId(storeExtend.getStoreId());
|
||||
this.save(easyLearnOrder);
|
||||
//获取商户信息
|
||||
WxPayService wxPayService = wxPayHandler.getWxPayService(null, null, null);
|
||||
WxPayService wxPayService = wxPayHandler.getWxPayService(null, wxPayHandler.getSubMchId(brandExtend.getBrandId(), storeExtend.getStoreId()), ONCE_PAY_NOTIFY_URL);
|
||||
WxPayUnifiedOrderRequest orderRequest = new WxPayUnifiedOrderRequest();
|
||||
//需要分账
|
||||
if (bo.getTotalAmount().scaleByPowerOfTen(2).intValue() >= Math.ceil(1 / OrderSource.EASY_LEARN.getRate())) {
|
||||
|
||||
@ -1 +1,6 @@
|
||||
|
||||
wx:
|
||||
pay:
|
||||
#支付通知地址
|
||||
notify-url: https://api.jamboxsys.com/Cpop-Mall/easyLearn/callback/notify/order
|
||||
#分账回调
|
||||
notify-sharing: https://api.jamboxsys.com/Cpop-Mall/easyLearn/callback/notify/profitSharing
|
||||
|
||||
@ -59,4 +59,10 @@ public class ReimburseApplicationBo implements Serializable {
|
||||
@ApiModelProperty(value = "附件")
|
||||
private String attachmentUrl;
|
||||
|
||||
/**
|
||||
* 报销申请id
|
||||
*/
|
||||
@ApiModelProperty(value = "报销申请id")
|
||||
private String id;
|
||||
|
||||
}
|
||||
|
||||
@ -1,17 +1,15 @@
|
||||
package com.cpop.oam.business.controller.backstage;
|
||||
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import com.cpop.common.utils.bean.BeanUtils;
|
||||
import com.cpop.core.annontation.OperationLog;
|
||||
import com.cpop.core.base.R;
|
||||
import com.cpop.core.base.enums.OperationLogEnum;
|
||||
import com.cpop.oam.business.bo.*;
|
||||
import com.cpop.oam.business.entity.FinanceReimburseType;
|
||||
import com.cpop.oam.business.service.FinanceReimburseService;
|
||||
import com.cpop.oam.business.service.FinanceReimburseStageService;
|
||||
import com.cpop.oam.business.service.FinanceReimburseTypeService;
|
||||
import com.cpop.oam.business.vo.*;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -87,11 +85,25 @@ public class FinanceReimburseController {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description: 财务报销模块-报销审核分页列表
|
||||
* 修改报销申请
|
||||
* @author DB
|
||||
* @since 2023/12/21
|
||||
* @param bo 请求
|
||||
* @return R<Void>
|
||||
*/
|
||||
@ApiOperation("修改报销申请")
|
||||
@PutMapping("/updateReimburseApplication")
|
||||
public R<Void> updateReimburseApplication(@RequestBody @Validated ReimburseApplicationBo bo) {
|
||||
financeReimburseService.updateReimburseApplication(bo);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 财务报销模块-报销审核分页列表
|
||||
* @param bo 请求参数
|
||||
* @return: R<Page<FinanceReimbursePageVo>>
|
||||
* @Author: DB
|
||||
* @Date: 2023/5/30 15:44
|
||||
* @return R<Page<FinanceReimbursePageVo>>
|
||||
* @author DB
|
||||
* @since : 2023/5/30 15:44
|
||||
**/
|
||||
@PreAuthorize("@aps.hasPermission('financial:audit:list')")
|
||||
@ApiOperation("财务报销模块-报销审核分页列表")
|
||||
|
||||
@ -37,7 +37,7 @@ public class FinanceReimburse extends BaseEntity implements Serializable {
|
||||
private String staffId;
|
||||
|
||||
/**
|
||||
* 状态:0:已提交;1:审批中;2:下款中;3:已下发;4:驳回
|
||||
* 状态:0:审批中;1:下款中;2:已下发-1:驳回
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
|
||||
@ -45,7 +45,7 @@ public class Task extends BaseEntity implements Serializable {
|
||||
private String responsibleStaffId;
|
||||
|
||||
/**
|
||||
* 任务状态(-1:失败;0:待审核;1:待接受;2:进行中;3:待测试;4:逾期;5:暂停;6:逾期完成;7:接收超时;8:待部署;9:已归档;10:审核不通过)
|
||||
* 任务状态(-1:失败;0:待审核;1:待接受;2:进行中;3:待测试;5:暂停;7:接收超时;8:待部署;9:已归档;10:审核不通过)
|
||||
*/
|
||||
private Integer taskStatus;
|
||||
|
||||
|
||||
@ -51,6 +51,14 @@ public interface FinanceReimburseService extends IService<FinanceReimburse> {
|
||||
*/
|
||||
void insertReimburseApplication(ReimburseApplicationBo bo);
|
||||
|
||||
/**
|
||||
* 修改报销申请
|
||||
* @author DB
|
||||
* @since 2023/12/21
|
||||
* @param bo 请求
|
||||
*/
|
||||
void updateReimburseApplication(ReimburseApplicationBo bo);
|
||||
|
||||
/**
|
||||
* @Description: 财务报销模块-个人报销统计
|
||||
* @return: R<Page<FinanceReimbursePageVo>>
|
||||
@ -67,4 +75,5 @@ public interface FinanceReimburseService extends IService<FinanceReimburse> {
|
||||
* @return: com.jambox.core.base.R<java.lang.Void>
|
||||
*/
|
||||
void reimbursePay(ReimbursePayBo bo);
|
||||
|
||||
}
|
||||
|
||||
@ -57,8 +57,18 @@ public class FinanceReimburseServiceImpl extends ServiceImpl<FinanceReimburseMap
|
||||
//获取当前登陆用户信息
|
||||
LoginUser loginUser = SecurityUtils.getInstance().getLoginUser();
|
||||
PageDomain pageDomain = SqlUtils.getInstance().getPageDomain();
|
||||
QueryWrapper queryWrapper = QueryWrapper.create();
|
||||
if (bo.getStatus()!=null){
|
||||
if (bo.getStatus() == 0) {
|
||||
//状态
|
||||
queryWrapper.and(FINANCE_REIMBURSE.STATUS.in(0, -1));
|
||||
} else {
|
||||
//状态
|
||||
queryWrapper.and(FINANCE_REIMBURSE.STATUS.eq(bo.getStatus()));
|
||||
}
|
||||
}
|
||||
return this.mapper.paginateAs(pageDomain.getPageNum(), pageDomain.getPageSize(),
|
||||
QueryWrapper.create().select(FINANCE_REIMBURSE.ALL_COLUMNS)
|
||||
queryWrapper.select(FINANCE_REIMBURSE.ALL_COLUMNS)
|
||||
.select(STAFF.NAME.as(FinanceReimbursePageVo::getStaffName))
|
||||
.select(FINANCE_REIMBURSE_TYPE.TYPE_NAME.as(FinanceReimbursePageVo::getTypeName))
|
||||
.from(FINANCE_REIMBURSE)
|
||||
@ -68,9 +78,7 @@ public class FinanceReimburseServiceImpl extends ServiceImpl<FinanceReimburseMap
|
||||
//用户id
|
||||
.where(SYS_USER.ID.eq(loginUser.getUserId()))
|
||||
//类型
|
||||
.and(FINANCE_REIMBURSE.TYPE_ID.eq(bo.getTypeId()))
|
||||
//状态
|
||||
.and(FINANCE_REIMBURSE.STATUS.eq(bo.getStatus())),
|
||||
.and(FINANCE_REIMBURSE.TYPE_ID.eq(bo.getTypeId())),
|
||||
FinanceReimbursePageVo.class);
|
||||
}
|
||||
|
||||
@ -84,8 +92,18 @@ public class FinanceReimburseServiceImpl extends ServiceImpl<FinanceReimburseMap
|
||||
@Override
|
||||
public Page<FinanceReimburseAuditPageVo> getReimburseAuditPage(FinanceReimburseAuditPageBo bo) {
|
||||
PageDomain pageDomain = SqlUtils.getInstance().getPageDomain();
|
||||
QueryWrapper queryWrapper = QueryWrapper.create();
|
||||
if (bo.getStatus()!=null){
|
||||
if (bo.getStatus() == 0) {
|
||||
//状态
|
||||
queryWrapper.and(FINANCE_REIMBURSE.STATUS.in(0, -1));
|
||||
} else {
|
||||
//状态
|
||||
queryWrapper.and(FINANCE_REIMBURSE.STATUS.eq(bo.getStatus()));
|
||||
}
|
||||
}
|
||||
return this.mapper.paginateAs(pageDomain.getPageNum(), pageDomain.getPageSize(),
|
||||
QueryWrapper.create().select(FINANCE_REIMBURSE.ALL_COLUMNS)
|
||||
queryWrapper.select(FINANCE_REIMBURSE.ALL_COLUMNS)
|
||||
.select(STAFF.NAME.as(FinanceReimbursePageVo::getStaffName))
|
||||
.select(FINANCE_REIMBURSE_TYPE.TYPE_NAME.as(FinanceReimbursePageVo::getTypeName))
|
||||
.from(FINANCE_REIMBURSE)
|
||||
@ -96,82 +114,57 @@ public class FinanceReimburseServiceImpl extends ServiceImpl<FinanceReimburseMap
|
||||
.and(FINANCE_REIMBURSE.TYPE_ID.eq(bo.getTypeId()))
|
||||
//理由
|
||||
.and(FINANCE_REIMBURSE.REMARKS.like(bo.getQuery()).or(STAFF.NAME.like(bo.getQuery())))
|
||||
//状态
|
||||
.and(FINANCE_REIMBURSE.STATUS.eq(bo.getStatus()))
|
||||
.orderBy(FINANCE_REIMBURSE.CREATE_TIME.asc()),
|
||||
FinanceReimburseAuditPageVo.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description: 修改报销状态
|
||||
* 修改报销状态
|
||||
* @param bo 请求参数
|
||||
* @Author: DB
|
||||
* @Date: 2023/5/10 16:01
|
||||
* @author DB
|
||||
* @since : 2023/5/10 16:01
|
||||
**/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateReimburseStatus(ReimburseStatusBo bo) {
|
||||
List<FinanceReimburse> list = this.list(QueryWrapper.create().where(FINANCE_REIMBURSE.ID.in(bo.getIds())));
|
||||
List<String> finishReimburseIds = list.stream().map(FinanceReimburse::getId).collect(Collectors.toList());
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
List<FinanceReimburseStage> financeReimburseStages = new ArrayList<>();
|
||||
//审批批量转下款
|
||||
if (list.get(0).getStatus() == 1) {
|
||||
|
||||
}
|
||||
|
||||
List<String> allFinishReimburseIds = new ArrayList<>();
|
||||
if (!list.isEmpty()){
|
||||
list.forEach(item->{
|
||||
if (item.getStatus() > 2){
|
||||
throw new ServiceException("状态超标");
|
||||
}
|
||||
if (list.size() > 1) {
|
||||
//审批转下款,全下
|
||||
if (item.getStatus() == 1 || item.getStatus() == 2){
|
||||
allFinishReimburseIds.add(item.getId());
|
||||
}
|
||||
} else {
|
||||
//审批转下款,全下
|
||||
if (item.getStatus() == 2){
|
||||
allFinishReimburseIds.add(item.getId());
|
||||
}
|
||||
}
|
||||
item.setStatus(item.getStatus() + 1);
|
||||
});
|
||||
//存在全下的报销
|
||||
if (!allFinishReimburseIds.isEmpty()) {
|
||||
Map<String, FinanceReimburse> idToPrice = list.stream().collect(Collectors.toMap(FinanceReimburse::getId, item->item));
|
||||
//获取已有的报销阶段
|
||||
Map<String, List<FinanceReimburseStage>> stageMap = SpringUtils.getBean(FinanceReimburseStageService.class).queryChain()
|
||||
.where(FINANCE_REIMBURSE_STAGE.FINANCE_REIMBURSE_ID.in(allFinishReimburseIds)).list()
|
||||
.stream().collect(Collectors.groupingBy(FinanceReimburseStage::getFinanceReimburseId));
|
||||
List<FinanceReimburseStage> financeReimburseStages = new ArrayList<>();
|
||||
allFinishReimburseIds.forEach(item -> {
|
||||
list.forEach(item -> {
|
||||
FinanceReimburseStage entity = new FinanceReimburseStage();
|
||||
BeanUtils.copyBeanProp(entity, bo);
|
||||
FinanceReimburse financeReimburse = idToPrice.get(item);
|
||||
entity.setFinanceReimburseId(item)
|
||||
.setPaymentTime(LocalDateTime.now());
|
||||
if (stageMap.get(item) != null) {
|
||||
//减去已下发的
|
||||
entity.setStageAmount(financeReimburse.getPrice().subtract(stageMap.get(item).stream().map(FinanceReimburseStage::getStageAmount).reduce(BigDecimal.ZERO, BigDecimal::add)));
|
||||
} else {
|
||||
entity.setStageAmount(financeReimburse.getPrice());
|
||||
}
|
||||
entity.setFinanceReimburseId(item.getId()).setPaymentTime(now).setStageAmount(item.getPrice());
|
||||
financeReimburseStages.add(entity);
|
||||
//修改状态
|
||||
financeReimburse.setStatus(3);
|
||||
item.setStatus(2);
|
||||
});
|
||||
} else {
|
||||
//获取已有的报销阶段
|
||||
Map<String, List<FinanceReimburseStage>> stageMap = SpringUtils.getBean(FinanceReimburseStageService.class).queryChain()
|
||||
.where(FINANCE_REIMBURSE_STAGE.FINANCE_REIMBURSE_ID.in(finishReimburseIds)).list()
|
||||
.stream().collect(Collectors.groupingBy(FinanceReimburseStage::getFinanceReimburseId));
|
||||
list.forEach(item->{
|
||||
if (stageMap.get(item.getId()) != null) {
|
||||
//减去已下发的
|
||||
FinanceReimburseStage entity = new FinanceReimburseStage();
|
||||
entity.setStageAmount(item.getPrice().subtract(stageMap.get(item.getId()).stream().map(FinanceReimburseStage::getStageAmount).reduce(BigDecimal.ZERO, BigDecimal::add)));
|
||||
item.setStatus(2);
|
||||
}
|
||||
});
|
||||
}
|
||||
//批量修改
|
||||
SpringUtils.getBean(FinanceReimburseStageService.class).saveBatch(financeReimburseStages);
|
||||
}
|
||||
this.updateBatch(list);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @descriptions 新增报销申请
|
||||
* 新增报销申请
|
||||
* @author DB
|
||||
* @date 2023/09/21 15:55
|
||||
* @since 2023/09/21 15:55
|
||||
* @param bo 请求参数
|
||||
* @return: com.cpop.core.base.R<java.lang.Void>
|
||||
*/
|
||||
@Override
|
||||
public void insertReimburseApplication(ReimburseApplicationBo bo) {
|
||||
@ -183,6 +176,20 @@ public class FinanceReimburseServiceImpl extends ServiceImpl<FinanceReimburseMap
|
||||
this.save(financeReimburse);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改报销申请
|
||||
* @author DB
|
||||
* @since 2023/12/21
|
||||
* @param bo 请求
|
||||
*/
|
||||
@Override
|
||||
public void updateReimburseApplication(ReimburseApplicationBo bo) {
|
||||
//获取申请员工信息
|
||||
FinanceReimburse financeReimburse = BeanUtils.mapToClass(bo, FinanceReimburse.class);
|
||||
financeReimburse.setStatus(0);
|
||||
this.updateById(financeReimburse);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description: 财务报销模块-个人报销统计
|
||||
* @return: R<Page<FinanceReimbursePageVo>>
|
||||
|
||||
@ -4,8 +4,6 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import com.cpop.common.constant.Constants;
|
||||
import com.cpop.common.utils.StringUtils;
|
||||
import com.cpop.common.utils.bean.BeanUtils;
|
||||
import com.cpop.common.utils.http.HttpUtils;
|
||||
import com.cpop.core.base.R;
|
||||
import com.cpop.core.base.entity.LoginUser;
|
||||
import com.cpop.core.base.entity.PageDomain;
|
||||
import com.cpop.core.base.entity.loginInfo.OamStaffLoginInfo;
|
||||
@ -28,6 +26,8 @@ import com.cpop.oam.business.vo.StaffInfoVo;
|
||||
import com.cpop.oam.business.vo.StaffPageVo;
|
||||
import com.cpop.oam.business.vo.StaffVo;
|
||||
import com.cpop.oam.business.vo.SysOperationLogVo;
|
||||
import com.cpop.oam.framework.constant.OamConfigKey;
|
||||
import com.cpop.oam.framework.enums.OamConfigEnum;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import com.mybatisflex.core.row.Db;
|
||||
@ -35,18 +35,16 @@ import com.mybatisflex.core.row.DbChain;
|
||||
import com.mybatisflex.core.row.Row;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import me.chanjar.weixin.cp.api.WxCpService;
|
||||
import me.chanjar.weixin.cp.bean.message.WxCpXmlMessage;
|
||||
import okhttp3.*;
|
||||
import org.springframework.security.crypto.bcrypt.BCrypt;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import static com.cpop.core.base.table.table.SysOperationLogTableDef.SYS_OPERATION_LOG;
|
||||
import static com.cpop.core.base.table.table.SysUserTableDef.SYS_USER;
|
||||
@ -374,13 +372,16 @@ public class StaffServiceImpl extends ServiceImpl<StaffMapper, Staff> implements
|
||||
*/
|
||||
@Override
|
||||
public List<StaffVo> getTechnologyStaffList() {
|
||||
//不查询测试员工
|
||||
String testStaffPhone = SpringUtils.getBean(RedisService.class).getCacheObject(OamConfigKey.OAM_CONFIG_KEY + OamConfigEnum.TEST_STAFF_PHONE.getKey());
|
||||
return this.listAs(QueryWrapper.create()
|
||||
.select(STAFF.ID, STAFF.NAME, STAFF.USER_ID, STAFF.STAFF_TYPE)
|
||||
.from(STAFF)
|
||||
.leftJoin(SYS_USER).on(SYS_USER.ID.eq(STAFF.USER_ID))
|
||||
.where(STAFF.STAFF_TYPE.eq(0))
|
||||
//不查询停用的员工
|
||||
.and(SYS_USER.STATUS.eq(true)),
|
||||
.and(SYS_USER.STATUS.eq(true))
|
||||
.and(SYS_USER.PHONE_NUMBER.notIn(Arrays.asList(testStaffPhone.split(",")))),
|
||||
StaffVo.class);
|
||||
}
|
||||
|
||||
|
||||
@ -1,12 +1,6 @@
|
||||
package com.cpop.oam.business.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cpop.oam.business.service.*;
|
||||
import com.cpop.oam.business.vo.*;
|
||||
import com.cpop.oam.framework.constant.OamConfigKey;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import com.cpop.api.tencent.wxWork.handler.WebHookSendHandler;
|
||||
import com.cpop.common.constant.Constants;
|
||||
import com.cpop.common.utils.DateUtils;
|
||||
@ -25,9 +19,19 @@ import com.cpop.oam.business.entity.Staff;
|
||||
import com.cpop.oam.business.entity.Task;
|
||||
import com.cpop.oam.business.entity.TaskStaffGroup;
|
||||
import com.cpop.oam.business.mapper.TaskMapper;
|
||||
import com.cpop.oam.business.service.StaffService;
|
||||
import com.cpop.oam.business.service.TaskService;
|
||||
import com.cpop.oam.business.service.TaskStaffGroupService;
|
||||
import com.cpop.oam.business.service.TaskWorkOrderService;
|
||||
import com.cpop.oam.business.vo.*;
|
||||
import com.cpop.oam.framework.constant.OamConfigKey;
|
||||
import com.cpop.oam.framework.constant.WebHookKeyConstant;
|
||||
import com.cpop.oam.framework.enums.OamConfigEnum;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.time.LocalDate;
|
||||
@ -41,17 +45,11 @@ import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.cpop.core.base.table.table.SysUserTableDef.SYS_USER;
|
||||
import static com.cpop.oam.business.entity.table.DutyTableDef.DUTY;
|
||||
import static com.cpop.oam.business.entity.table.StaffTableDef.STAFF;
|
||||
import static com.cpop.oam.business.entity.table.TaskDemandTableDef.TASK_DEMAND;
|
||||
import static com.cpop.oam.business.entity.table.TaskStaffGroupTableDef.TASK_STAFF_GROUP;
|
||||
import static com.cpop.oam.business.entity.table.TaskTableDef.TASK;
|
||||
import static com.mybatisflex.core.query.QueryMethods.*;
|
||||
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
* OAM-任务表 服务层实现。
|
||||
*
|
||||
@ -339,21 +337,9 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
|
||||
if (StringUtils.isBlank(testStaffPhones)) {
|
||||
throw new ServiceException("测试员工手机号未配置,请联系相关人员配置");
|
||||
}
|
||||
boolean thisStaffIsTest = Arrays.asList(testStaffPhones.split(",")).contains(loginUserInfo.getString("phoneNumber"));
|
||||
QueryWrapper queryWrapper = QueryWrapper.create();
|
||||
//是否是测试员工
|
||||
if (thisStaffIsTest) {
|
||||
//进行中与已完成的任务
|
||||
queryWrapper.and(TASK.TASK_STATUS.in(3, 6));
|
||||
} else {
|
||||
//进行中与已完成的任务
|
||||
queryWrapper.and(TASK.TASK_STATUS.in(2, 3))
|
||||
//对比当前员工是否是测试管理员
|
||||
.and(TASK_STAFF_GROUP.STAFF_ID.eq(loginUserInfo.getString("id")));
|
||||
}
|
||||
return this.mapper.paginateAs(pageDomain.getPageNum(),
|
||||
pageDomain.getPageSize(),
|
||||
queryWrapper
|
||||
QueryWrapper.create()
|
||||
.select(TASK.ID, TASK.TASK_STATUS, TASK.TASK_CONTENT, TASK.TASK_ITEM, TASK.TASK_RATING, TASK.TASK_RECEIPT_TIME, TASK.EXPECTED_COMPLETION_DATE, TASK.TASK_PROGRESS, TASK.SUBJECT)
|
||||
.select(STAFF.NAME.as(PersonTaskPageVo::getResponsibleStaffName))
|
||||
//个人绩点
|
||||
@ -366,6 +352,9 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
|
||||
.leftJoin(STAFF)
|
||||
.on(STAFF.ID.eq(TASK_STAFF_GROUP.STAFF_ID))
|
||||
.where(TASK.TASK_TYPE.in(0, 1))
|
||||
//对比当前员工是否是测试管理员
|
||||
.and(TASK.TASK_STATUS.in(2, 3))
|
||||
.and(TASK_STAFF_GROUP.STAFF_ID.eq(loginUserInfo.getString("id")))
|
||||
.orderBy(TASK.EXPECTED_COMPLETION_DATE.asc()),
|
||||
PersonTaskPageVo.class);
|
||||
}
|
||||
|
||||
@ -1,37 +1,35 @@
|
||||
package com.cpop.oam.business.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cpop.common.utils.StringUtils;
|
||||
import com.cpop.core.base.entity.PageDomain;
|
||||
import com.cpop.oam.business.bo.TaskDemandBo;
|
||||
import com.cpop.oam.business.dto.TaskWorkOrderReceiveDealPauseDto;
|
||||
import com.cpop.oam.business.vo.TaskWorkOrderPersonVo;
|
||||
import com.cpop.oam.business.vo.TaskWorkOrderReceiveDealPauseVo;
|
||||
import com.cpop.oam.business.vo.WorkOrderDutyVo;
|
||||
import com.cpop.oam.framework.enums.OamConfigEnum;
|
||||
import com.cpop.oam.framework.tasks.WorkOrderAcceptOverTimeTask;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import com.cpop.api.tencent.wxWork.handler.WebHookSendHandler;
|
||||
import com.cpop.common.utils.DateUtils;
|
||||
import com.cpop.common.utils.StringUtils;
|
||||
import com.cpop.common.utils.bean.BeanUtils;
|
||||
import com.cpop.core.base.entity.PageDomain;
|
||||
import com.cpop.core.base.exception.ServiceException;
|
||||
import com.cpop.core.service.RedisService;
|
||||
import com.cpop.core.utils.QuartzUtils;
|
||||
import com.cpop.core.utils.SecurityUtils;
|
||||
import com.cpop.core.utils.SpringUtils;
|
||||
import com.cpop.core.utils.sql.SqlUtils;
|
||||
import com.cpop.oam.business.bo.PauseWorkOrderBo;
|
||||
import com.cpop.oam.business.bo.TaskDemandBo;
|
||||
import com.cpop.oam.business.bo.TaskWorkOrderBo;
|
||||
import com.cpop.oam.business.bo.TaskWorkOrderRecordBo;
|
||||
import com.cpop.oam.business.dto.TaskWorkOrderReceiveDealPauseDto;
|
||||
import com.cpop.oam.business.entity.*;
|
||||
import com.cpop.oam.business.mapper.TaskWorkOrderMapper;
|
||||
import com.cpop.oam.business.service.*;
|
||||
import com.cpop.oam.business.vo.StaffInfoVo;
|
||||
import com.cpop.oam.business.vo.TaskWorkOrderPageVo;
|
||||
import com.cpop.oam.business.vo.TaskWorkOrderRecordListVo;
|
||||
import com.cpop.oam.business.vo.*;
|
||||
import com.cpop.oam.framework.constant.WebHookKeyConstant;
|
||||
import com.cpop.oam.framework.enums.OamConfigEnum;
|
||||
import com.cpop.oam.framework.enums.QuartzEnums;
|
||||
import com.cpop.oam.framework.tasks.WorkOrderAcceptOverTimeTask;
|
||||
import com.cpop.oam.framework.tasks.WorkOrderOvertimeTask;
|
||||
import com.cpop.oam.framework.tasks.WorkOrderPauseRecoverTask;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.quartz.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -57,9 +55,6 @@ import static com.cpop.oam.business.entity.table.TaskWorkOrderTableDef.TASK_WORK
|
||||
import static com.cpop.system.business.entity.table.BrandTableDef.BRAND;
|
||||
import static com.cpop.system.business.entity.table.StoreTableDef.STORE;
|
||||
|
||||
import com.cpop.core.utils.sql.SqlUtils;
|
||||
import com.cpop.core.service.RedisService;
|
||||
|
||||
/**
|
||||
* 任务-工单表 服务层实现。
|
||||
*
|
||||
@ -538,6 +533,7 @@ public class TaskWorkOrderServiceImpl extends ServiceImpl<TaskWorkOrderMapper, T
|
||||
if (task.getTaskStatus() == 2) {
|
||||
startOrUpdateWorkOrderOvertimeTask(bo.getWorkOrderId(), true, bo.getPauseExpireTime());
|
||||
}
|
||||
startOrRemoveWorkOrderPauseRecover(bo.getWorkOrderId(), true, bo.getPauseExpireTime());
|
||||
// 设定任务状态暂停
|
||||
task.setTaskStatus(5);
|
||||
taskService.updateById(task);
|
||||
@ -570,6 +566,45 @@ public class TaskWorkOrderServiceImpl extends ServiceImpl<TaskWorkOrderMapper, T
|
||||
.update();
|
||||
}
|
||||
|
||||
/**
|
||||
* 开始与删除工单暂停恢复任务
|
||||
* @author DB
|
||||
* @since 2023/12/21
|
||||
* @param workOrderId 工单di
|
||||
* @param isStart 是否开始
|
||||
* @param pauseExpireTime 暂停到期时间
|
||||
*/
|
||||
private void startOrRemoveWorkOrderPauseRecover(String workOrderId, Boolean isStart, LocalDateTime pauseExpireTime) {
|
||||
// 基于表达式构建触发器
|
||||
QuartzUtils quartzUtils = SpringUtils.getBean(QuartzUtils.class);
|
||||
try {
|
||||
if (isStart) {
|
||||
ZoneId zoneId = ZoneId.systemDefault();
|
||||
String cron = quartzUtils.convertToCron(Date.from(pauseExpireTime.atZone(zoneId).toInstant()));
|
||||
// 通过JobBuilder构建JobDetail实例,JobDetail规定其job只能是实现Job接口的实例
|
||||
JobDetail jobDetail = JobBuilder.newJob(WorkOrderPauseRecoverTask.class)
|
||||
.withIdentity(QuartzEnums.WORK_ORDER_PAUSE_RECOVER_TASK.getName() + workOrderId,
|
||||
QuartzEnums.WORK_ORDER_PAUSE_RECOVER_TASK.getGroup())
|
||||
.usingJobData("WorkOrderId", workOrderId)
|
||||
.build();
|
||||
CronScheduleBuilder cronScheduleBuilder = CronScheduleBuilder.cronSchedule(cron);
|
||||
// CronTrigger表达式触发器 继承于Trigger。TriggerBuilder 用于构建触发器实例
|
||||
CronTrigger cronTrigger = TriggerBuilder.newTrigger()
|
||||
.withIdentity(QuartzEnums.WORK_ORDER_PAUSE_RECOVER_TASK.getName() + workOrderId,
|
||||
QuartzEnums.WORK_ORDER_PAUSE_RECOVER_TASK.getGroup())
|
||||
.withSchedule(cronScheduleBuilder)
|
||||
.build();
|
||||
scheduler.scheduleJob(jobDetail, cronTrigger);
|
||||
} else {
|
||||
quartzUtils.deleteJob(QuartzEnums.WORK_ORDER_PAUSE_RECOVER_TASK.getName() + workOrderId,
|
||||
QuartzEnums.WORK_ORDER_PAUSE_RECOVER_TASK.getGroup());
|
||||
}
|
||||
} catch (SchedulerException | ParseException e) {
|
||||
log.error(e.getMessage());
|
||||
throw new ServiceException("生成工单超时任务失败!");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 工单模块-工单提交-工单办结
|
||||
*
|
||||
@ -615,10 +650,7 @@ public class TaskWorkOrderServiceImpl extends ServiceImpl<TaskWorkOrderMapper, T
|
||||
phoneList.add(staffMap.get(task.getRecordStaffId()).getPhoneNumber());
|
||||
// 通知记录
|
||||
try {
|
||||
SpringUtils.getBean(WebHookSendHandler.class)
|
||||
.webHookSendText(WebHookKeyConstant.ORDER_INFO_BOT, phoneList,
|
||||
|
||||
task.getTaskContent() + "\n工单办结", false);
|
||||
SpringUtils.getBean(WebHookSendHandler.class).webHookSendText(WebHookKeyConstant.ORDER_INFO_BOT, phoneList, task.getTaskContent() + "\n工单办结", false);
|
||||
} catch (IOException e) {
|
||||
throw new ServiceException("发送消息通知失败!");
|
||||
}
|
||||
@ -627,6 +659,7 @@ public class TaskWorkOrderServiceImpl extends ServiceImpl<TaskWorkOrderMapper, T
|
||||
SpringUtils.getBean(QuartzUtils.class)
|
||||
.deleteJob(QuartzEnums.WORK_ORDER_OVERTIME_TASK.getName() + workOrderId,
|
||||
QuartzEnums.WORK_ORDER_OVERTIME_TASK.getGroup());
|
||||
startOrRemoveWorkOrderPauseRecover(workOrderId, false, null);
|
||||
} catch (SchedulerException e) {
|
||||
throw new ServiceException("删除工单完结超时任务失败");
|
||||
}
|
||||
|
||||
@ -14,7 +14,11 @@ public enum QuartzEnums {
|
||||
/**
|
||||
* 工单接收超时定时任务
|
||||
*/
|
||||
WORK_ORDER_ACCEPT_OVERTIME_TASK("WorkOrderAcceptOvertimeTask:", "WorkOrder");
|
||||
WORK_ORDER_ACCEPT_OVERTIME_TASK("WorkOrderAcceptOvertimeTask:", "WorkOrder"),
|
||||
/**
|
||||
* 工单暂停回复任务
|
||||
*/
|
||||
WORK_ORDER_PAUSE_RECOVER_TASK("WorkOrderPauseRecoverTask:", "WorkOrder");;
|
||||
|
||||
QuartzEnums(String name, String group) {
|
||||
this.name = name;
|
||||
|
||||
@ -0,0 +1,37 @@
|
||||
package com.cpop.oam.framework.tasks;
|
||||
|
||||
import com.cpop.core.utils.SpringUtils;
|
||||
import com.cpop.oam.business.entity.Task;
|
||||
import com.cpop.oam.business.entity.TaskWorkOrder;
|
||||
import com.cpop.oam.business.service.TaskService;
|
||||
import com.cpop.oam.business.service.TaskWorkOrderService;
|
||||
import org.quartz.Job;
|
||||
import org.quartz.JobDataMap;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
|
||||
import static com.cpop.oam.business.entity.table.TaskTableDef.TASK;
|
||||
|
||||
/**
|
||||
* 工单暂停回复任务
|
||||
* @author DB
|
||||
* @version 1.0.0
|
||||
* @since 2023-12-21 21:38
|
||||
*/
|
||||
public class WorkOrderPauseRecoverTask implements Job {
|
||||
|
||||
@Override
|
||||
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||
// 获取工单id
|
||||
JobDataMap jobDataMap = jobExecutionContext.getJobDetail().getJobDataMap();
|
||||
String workOrderId = jobDataMap.getString("WorkOrderId");
|
||||
TaskWorkOrderService taskWorkOrderService = SpringUtils.getBean(TaskWorkOrderService.class);
|
||||
TaskWorkOrder taskWorkOrder = taskWorkOrderService.getById(workOrderId);
|
||||
// 修改任务逾期
|
||||
TaskService taskService = SpringUtils.getBean(TaskService.class);
|
||||
Task task = taskService.getById(taskWorkOrder.getTaskId());
|
||||
if (task.getTaskStatus() == 5) {
|
||||
taskService.updateChain().set(TASK.TASK_STATUS, 2).where(TASK.ID.eq(taskWorkOrder.getTaskId())).update();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -26,4 +26,15 @@
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
||||
@ -82,7 +82,7 @@ public class WxPayHandler {
|
||||
* @param notifyUrl 通知地址
|
||||
* @return com.github.binarywang.wxpay.service.WxPayService
|
||||
*/
|
||||
public WxPayService getWxPayService(String subAppId, String subMchId,String notifyUrl) {
|
||||
public WxPayService getWxPayService(String subAppId, String subMchId, String notifyUrl) {
|
||||
WxPayConfig payConfig = wxPayService.getConfig();
|
||||
//子商户信息
|
||||
payConfig.setSubAppId(StringUtils.trimToNull(subAppId));
|
||||
@ -93,4 +93,28 @@ public class WxPayHandler {
|
||||
wxPayService.setConfig(payConfig);
|
||||
return wxPayService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取子商户
|
||||
* @author DB
|
||||
* @since 2023/12/21
|
||||
* @param brandId 品牌id
|
||||
* @param storeId 校区id
|
||||
* @return String
|
||||
*/
|
||||
public String getSubMchId(String brandId, String storeId) {
|
||||
//先查校区
|
||||
Row store = Db.selectOneByQuery("cp_sys_store", QueryWrapper.create().where("id = ?", storeId));
|
||||
String wxMchId = store.getString("wxMchId");
|
||||
if (StringUtils.isBlank(wxMchId)){
|
||||
//查询品牌
|
||||
Row brand = Db.selectOneByQuery("cp_sys_brand", QueryWrapper.create().where("id = ?", brandId));
|
||||
wxMchId = brand.getString("wxMchId");
|
||||
if (StringUtils.isBlank(wxMchId)){
|
||||
//果酱默认商户
|
||||
wxMchId = "1618925571";
|
||||
}
|
||||
}
|
||||
return wxMchId;
|
||||
}
|
||||
}
|
||||
|
||||
@ -49,7 +49,7 @@ public class WxPayAsyncTask {
|
||||
ProfitSharingRequest profitSharingRequest = buildProfitSharingRequest(orderId, notifyResult, orderSource);
|
||||
try {
|
||||
Thread.sleep(5000);
|
||||
wxPayProfitSharing(profitSharingRequest, wxPayService, 0,orderSource);
|
||||
wxPayProfitSharing(profitSharingRequest, wxPayService, 0, orderSource);
|
||||
} catch (InterruptedException e) {
|
||||
throw new ServiceException(e.getMessage());
|
||||
}
|
||||
|
||||
@ -3,16 +3,13 @@ package com.cpop.system.business.entity;
|
||||
import com.cpop.core.base.entity.BaseEntity;
|
||||
import com.cpop.core.base.entity.BaseInsertListener;
|
||||
import com.cpop.core.base.entity.BaseUpdateListener;
|
||||
import com.cpop.core.base.enums.UserType;
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.Table;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.*;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 系统菜单表 实体类。
|
||||
*
|
||||
@ -94,6 +91,11 @@ public class Menu extends BaseEntity implements Serializable {
|
||||
*/
|
||||
private Boolean hideMenu;
|
||||
|
||||
/**
|
||||
* 是否忽略KeepAlive缓存
|
||||
*/
|
||||
private Boolean ignoreKeepAlive;
|
||||
|
||||
/**
|
||||
* 菜单模块
|
||||
*/
|
||||
|
||||
@ -3,17 +3,14 @@ package com.cpop.system.business.entity;
|
||||
import com.cpop.core.base.entity.BaseEntity;
|
||||
import com.cpop.core.base.entity.BaseInsertListener;
|
||||
import com.cpop.core.base.entity.BaseUpdateListener;
|
||||
import com.cpop.core.base.enums.SourceType;
|
||||
import com.mybatisflex.annotation.Column;
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.Table;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.*;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 系统-店铺/校区表 实体类。
|
||||
*
|
||||
@ -80,6 +77,11 @@ public class Store extends BaseEntity implements Serializable {
|
||||
*/
|
||||
private Boolean isTest;
|
||||
|
||||
/**
|
||||
* 微信商户id
|
||||
*/
|
||||
private String wxMchId;
|
||||
|
||||
/**
|
||||
* 逻辑删除(0否1是)
|
||||
*/
|
||||
|
||||
@ -243,6 +243,7 @@ public class MenuServiceImpl extends ServiceImpl<MenuMapper, Menu> implements Me
|
||||
meta.setOrderNo(item.getOrderNo());
|
||||
meta.setTitle(item.getTitle());
|
||||
meta.setHideMenu(item.getHideMenu());
|
||||
meta.setIgnoreKeepAlive(item.getIgnoreKeepAlive());
|
||||
item.setMeta(meta);
|
||||
});
|
||||
//构建根节点
|
||||
|
||||
@ -107,6 +107,12 @@ public class MenuRouteVo implements Serializable {
|
||||
@ApiModelProperty("隐藏菜单")
|
||||
private Boolean hideMenu;
|
||||
|
||||
/**
|
||||
* 是否忽略KeepAlive缓存
|
||||
*/
|
||||
@ApiModelProperty("是否忽略KeepAlive缓存")
|
||||
private Boolean ignoreKeepAlive;
|
||||
|
||||
/**
|
||||
* 内部定义类
|
||||
*/
|
||||
@ -141,5 +147,10 @@ public class MenuRouteVo implements Serializable {
|
||||
* 隐藏子类菜单
|
||||
*/
|
||||
private Boolean hideChildrenInMenu;
|
||||
|
||||
/**
|
||||
* 是否忽略KeepAlive缓存
|
||||
*/
|
||||
private Boolean ignoreKeepAlive;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user