修复Oam相关bug

This commit is contained in:
DB 2023-12-18 21:02:46 +08:00
parent 24578110b0
commit 8f01c3ba9d
14 changed files with 109 additions and 36 deletions

View File

@ -135,7 +135,7 @@
config_name = #{configName},
</if>
<if test="configValue != null and configValue != ''">
config_value = #{config_value},
config_value = #{configValue},
</if>
<if test="configType != null and configType != ''">
config_type = #{configType},

View File

@ -176,8 +176,13 @@ public class CpopWxPayTests {
wxPayService.getProfitSharingService().profitSharingFinish(profitSharingFinishRequest);
}
/**
* 获取微信支付分用户签约计划
* @author DB
* @since 2023/12/15
*/
@Test
public void getPayPointsUserPlan() throws WxPayException {
public void getPayScoreUserSignPlans() throws WxPayException {
wxPayService.getConfig().setServiceId("00003053000000169450961228104460");
String v3 = wxPayService.getV3("https://api.mch.weixin.qq.com/v3/payscore/sign-plan/partner/user-sign-plans/merchant-sign-plan-no/1735294783081091132?sub_mchid=1618925571");
System.out.println(v3);

View File

@ -12,6 +12,10 @@ cpop:
publicKeyFile: /root/jambox-union/jambox-oam/script/secretKey/publicKey
# 公钥文件
privateKeyFile: /root/jambox-union/jambox-oam/script/secretKey/privateKey
# 公钥文件
#publicKeyFile: E:\Cpop\Cpop-Union\Cpop-Core\src\main\resources\static\keyPair\publicKey
# 公钥文件
#privateKeyFile: E:\Cpop\Cpop-Union\Cpop-Core\src\main\resources\static\keyPair\privateKey
# DataSource Config
spring:
@ -99,3 +103,9 @@ wx:
privateKeyPath: /root/cpop-union/cpop-oam/script/secretKey/wxPay_key.pem
# 私钥文件
privateCertPath: /root/cpop-union/cpop-oam/script/secretKey/wxPay_cert.pem
# p12证书的位置可以指定绝对路径也可以指定类路径以classpath:开头)
#keyPath: E:/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
# 私钥文件
#privateCertPath: E:/Cpop/Cpop-Union/Cpop-Core/src/main/resources/static/keyPair/wxPay_cert.pem

View File

@ -35,16 +35,10 @@ public class SysConfigInfoBo implements Serializable {
private String cancelAfterVerificationStaffPhone;
/**
* 需求转任务主体品牌
* 测试员工手机号
*/
@NotBlank(message = "需求转任务主体品牌不能为空")
@ApiModelProperty(value = "需求转任务主体品牌", required = true)
private String oamDemandToTaskBrand;
@NotBlank(message = "测试员工手机号不能为空")
@ApiModelProperty(value = "测试员工手机号", required = true)
private String testStaffPhone;
/**
* 需求转任务主体校区
*/
@NotBlank(message = "需求转任务主体校区不能为空")
@ApiModelProperty(value = "需求转任务主体校区", required = true)
private String oamDemandToTaskStore;
}

View File

@ -28,7 +28,6 @@ import java.util.List;
@Api(tags = "商城管理模块")
@RequestMapping("/oamMall")
public class OamMallController {
@Autowired
private OamMallService oamMallService;

View File

@ -115,6 +115,13 @@ public class BrandManagerServiceImpl extends ServiceImpl<BrandManagerMapper, Bra
@Override
@Transactional(rollbackFor = Exception.class)
public void insertBrandManager(BrandManagerBo bo) {
//查询此管理员是否已存在
if (this.count(QueryWrapper.create().leftJoin(BRAND_MANAGER_STORE).on(BRAND_MANAGER_STORE.BRAND_MANAGER_ID.eq(BRAND_MANAGER.ID))
.where(BRAND_MANAGER.NAME.eq(bo.getName()))
.and(BRAND_MANAGER.PHONE.eq(bo.getPhone()))
.and(BRAND_MANAGER_STORE.BRAND_ID.eq(bo.getBrandId()))) > 0) {
throw new ServiceException("当前管理员已存在");
}
//获取云品牌id
BrandExtend brandExtend = SpringUtils.getBean(BrandExtendService.class).queryChain().where(BrandExtendTableDef.BRAND_EXTEND.BRAND_ID.eq(bo.getBrandId())).one();
//获取用户信息

View File

@ -24,9 +24,14 @@ import com.cpop.oam.business.vo.FinanceReimburseAuditPageVo;
import com.cpop.oam.business.vo.FinanceReimbursePageVo;
import com.cpop.oam.business.vo.ReimbursePersonStatisticVo;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import static com.cpop.core.base.table.table.SysUserTableDef.SYS_USER;
import static com.cpop.oam.business.entity.table.FinanceReimburseStageTableDef.FINANCE_REIMBURSE_STAGE;
@ -107,15 +112,40 @@ public class FinanceReimburseServiceImpl extends ServiceImpl<FinanceReimburseMap
* @Date: 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> allFinishReimburseIds = new ArrayList<>();
if (!list.isEmpty()){
list.forEach(item->{
if (item.getStatus() > 1){
if (item.getStatus() > 2){
throw new ServiceException("状态超标");
}
item.setStatus(item.getStatus() + 1);
if (list.size() > 1) {
//审批转下款,全下
if (item.getStatus() == 1){
allFinishReimburseIds.add(item.getId());
}
}
});
//存在全下的报销
if (!allFinishReimburseIds.isEmpty()) {
Map<String, FinanceReimburse> idToPrice = list.stream().collect(Collectors.toMap(FinanceReimburse::getId, item->item));
List<FinanceReimburseStage> financeReimburseStages = new ArrayList<>();
allFinishReimburseIds.forEach(item -> {
FinanceReimburseStage entity = new FinanceReimburseStage();
BeanUtils.copyBeanProp(entity, bo);
FinanceReimburse financeReimburse = idToPrice.get(item);
entity.setFinanceReimburseId(item)
.setPaymentTime(LocalDateTime.now())
.setStageAmount(financeReimburse.getPrice());
financeReimburseStages.add(entity);
//修改状态
financeReimburse.setStatus(3);
});
SpringUtils.getBean(FinanceReimburseStageService.class).saveBatch(financeReimburseStages);
}
this.updateBatch(list);
}
}

View File

@ -3,6 +3,7 @@ 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;
@ -312,9 +313,26 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
@Override
public Page<PersonTaskPageVo> getPersonTaskPage() {
PageDomain pageDomain = SqlUtils.getInstance().getPageDomain();
JSONObject loginUserInfo = SecurityUtils.getInstance().getLoginUserInfo();
String testStaffPhones = SpringUtils.getBean(RedisService.class).getCacheObject(OamConfigKey.OAM_CONFIG_KEY + OamConfigEnum.TEST_STAFF_PHONE.getKey());
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, 4, 6))
//对比当前员工是否是测试管理员
.and(TASK_STAFF_GROUP.STAFF_ID.eq(loginUserInfo.getString("id")));
}
return this.mapper.paginateAs(pageDomain.getPageNum(),
pageDomain.getPageSize(),
QueryWrapper.create()
queryWrapper
.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))
//个人绩点
@ -327,9 +345,6 @@ 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, 4, 6))
.and(TASK_STAFF_GROUP.STAFF_ID.eq(SecurityUtils.getInstance().getLoginUserInfo().getString("id")))
.orderBy(TASK.EXPECTED_COMPLETION_DATE.asc()),
PersonTaskPageVo.class);
}

View File

@ -513,6 +513,8 @@ public class TaskWorkOrderServiceImpl extends ServiceImpl<TaskWorkOrderMapper, T
.setStoreId(storeId)
.setTaskContent(task.getTaskContent());
SpringUtils.getBean(TaskDemandService.class).insertTaskDemand(taskDemandBo);
//工单办结
workOrderFinish(workOrderId);
}
/**
@ -598,19 +600,15 @@ public class TaskWorkOrderServiceImpl extends ServiceImpl<TaskWorkOrderMapper, T
Set<String> staffIds = new HashSet<>();
staffIds.add(task.getResponsibleStaffId());
staffIds.add(task.getRecordStaffId());
Map<String, StaffInfoVo> staffMap =
staffService
.listAs(
QueryWrapper.create()
.select(STAFF.ID, STAFF.NAME)
.select(SYS_USER.PHONE_NUMBER.as(StaffInfoVo::getPhoneNumber))
.from(STAFF)
.leftJoin(SYS_USER)
.on(SYS_USER.ID.eq(STAFF.ID))
.where(STAFF.ID.in(staffIds)),
StaffInfoVo.class)
.stream()
.collect(Collectors.toMap(StaffInfoVo::getId, item -> item));
Map<String, StaffInfoVo> staffMap = staffService.listAs(QueryWrapper.create()
.select(STAFF.ID, STAFF.NAME)
.select(SYS_USER.PHONE_NUMBER.as(StaffInfoVo::getPhoneNumber))
.from(STAFF)
.leftJoin(SYS_USER)
.on(SYS_USER.ID.eq(STAFF.ID))
.where(STAFF.ID.in(staffIds)),
StaffInfoVo.class)
.stream().collect(Collectors.toMap(StaffInfoVo::getId, item -> item));
List<String> phoneList = new ArrayList<>();
phoneList.add(staffMap.get(task.getResponsibleStaffId()).getPhoneNumber());
// 记录人手机号
@ -618,7 +616,9 @@ public class TaskWorkOrderServiceImpl extends ServiceImpl<TaskWorkOrderMapper, T
// 通知记录
try {
SpringUtils.getBean(WebHookSendHandler.class)
.webHookSendText(WebHookKeyConstant.ORDER_INFO_BOT, phoneList, task.getTaskContent() + "\n工单办结", false);
.webHookSendText(WebHookKeyConstant.ORDER_INFO_BOT, phoneList,
task.getTaskContent() + "\n工单办结", false);
} catch (IOException e) {
throw new ServiceException("发送消息通知失败!");
}

View File

@ -30,4 +30,10 @@ public class ConfigInfoVo implements Serializable {
*/
@ApiModelProperty("核销管理员工手机号")
private String cancelAfterVerificationStaffPhone;
/**
* 测试员工手机号
*/
@ApiModelProperty("测试员工手机号")
private String testStaffPhone;
}

View File

@ -1,5 +1,7 @@
package com.cpop.oam.framework.constant;
import com.cpop.oam.framework.enums.OamConfigEnum;
/**
* @author DB
*/
@ -13,10 +15,10 @@ public interface OamConfigKey {
/**
* 企业微信配置信息
*/
String[] WORK_WX_INFO = {"OamAuditStaffPhone", "OamCancelAfterVerificationStaffPhone"};
String[] WORK_WX_INFO = {OamConfigEnum.AUDIT_STAFF_PHONE.getKey(), OamConfigEnum.CANCEL_AFTER_VERIFICATION_STAFF_PHONE.getKey(), OamConfigEnum.TEST_STAFF_PHONE.getKey()};
/**
* 需求转任务配置信息
*/
String[] DEMAND_TO_TASK = {"DemandToTaskBrand", "DemandToTaskStore"};
String[] DEMAND_TO_TASK = {OamConfigEnum.DEMAND_TO_TASK_BRAND.getKey(), OamConfigEnum.DEMAND_TO_TASK_STORE.getKey()};
}

View File

@ -17,6 +17,10 @@ public enum OamConfigEnum {
*/
CANCEL_AFTER_VERIFICATION_STAFF_PHONE("核销管理员手机号", "OamCancelAfterVerificationStaffPhone",
"cancelAfterVerificationStaffPhone", true),
/**
* 测试员工手机号
*/
TEST_STAFF_PHONE("测试员工手机号", "TestStaffPhone", "testStaffPhone", true),
/**
* 需求转任务主体品牌
*/

View File

@ -27,7 +27,7 @@ import static com.cpop.oam.business.entity.table.TaskTableDef.TASK;
*/
@Slf4j
@Configuration
@Profile("prod")
@Profile(value = "prod")
public class OamScheduledTasks {
@Autowired

View File

@ -48,7 +48,8 @@ public class StoreServiceImpl extends ServiceImpl<StoreMapper, Store> implements
.select("cp_j_store_extend.store_cloud_id as storeCloudId")
.leftJoin(STORE_SIGN).on(STORE_SIGN.STORE_ID.eq(STORE.ID))
.leftJoin(BRAND).on(BRAND.ID.eq(STORE.BRAND_ID))
.leftJoin("cp_j_store_extend").on("`cp_j_store_extend`.`store_id` = `cp_sys_store`.`id`"),
.leftJoin("cp_j_store_extend").on("`cp_j_store_extend`.`store_id` = `cp_sys_store`.`id`")
.and(STORE.STORE_NAME.like(bo.getName())),
StorePageVo.class);
}
}