Merge branch 'dev' of http://git.znkjfw.com/ak/zn-cloud into dev-crm

# Conflicts:
#	yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/job/birthday/BirthdayJob.java
This commit is contained in:
aikai 2024-12-03 20:49:39 +08:00
commit c26f8f723f
33 changed files with 371 additions and 77 deletions

View File

@ -18,7 +18,7 @@ public enum BpmTaskRuleScriptEnum {
LEADER_X1(20L, "流程发起人的一级领导"),
LEADER_X2(21L, "流程发起人的二级领导"),
LEADER_X3(22L, "流程发起人的三级领导"),
LEADER_X4(23L, "审批人的级领导"),
LEADER_X4(23L, "审批人的级领导"),
LEADER_X5(24L, "调岗部门领导"),
LEADER_X6(25L, "分配任务的责任人"),
LEADER_X7(26L, "入职部门领导"),

View File

@ -5,9 +5,12 @@ import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.cash.BpmOACashCreateRe
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.cash.BpmOACashRespVO;
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOACashDO;
import cn.iocoder.yudao.module.bpm.service.oa.BpmOACashService;
import cn.iocoder.yudao.module.system.api.project.ProjectApi;
import cn.iocoder.yudao.module.system.api.project.dto.ProjectDTO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.mapstruct.ap.internal.util.Strings;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@ -32,6 +35,9 @@ public class BpmOACashController {
@Resource
private BpmOACashService cashService;
@Resource
private ProjectApi projectApi;
@PostMapping("/create")
@Operation(summary = "创建请求申请")
public CommonResult<Long> createCash(@Valid @RequestBody BpmOACashCreateReqVO createReqVO) {
@ -45,8 +51,13 @@ public class BpmOACashController {
public CommonResult<BpmOACashRespVO> getCash(@RequestParam("id") Long id) {
BpmOACashDO cashDO = cashService.getCash(id);
BpmOACashRespVO respVO = cashService.convertCash(cashDO);
if (respVO != null && Strings.isNotEmpty(respVO.getProjectNo())) {
ProjectDTO projectDTO = projectApi.getProject(respVO.getProjectNo()).getCheckedData();
respVO.setProjectName(projectDTO.getName());
}
return success(cashService.convertCash(cashDO));
return success(respVO);
}
@GetMapping("/getByProcessInstanceId")
@ -55,7 +66,12 @@ public class BpmOACashController {
public CommonResult<BpmOACashRespVO> getCashByProcessInstanceId(@RequestParam("processInstanceId") String processInstanceId) {
BpmOACashDO cashDO = cashService.getByProcessInstanceId(processInstanceId);
BpmOACashRespVO respVO = cashService.convertCash(cashDO);
if (respVO != null && Strings.isNotEmpty(respVO.getProjectNo())) {
ProjectDTO projectDTO = projectApi.getProject(respVO.getProjectNo()).getCheckedData();
respVO.setProjectName(projectDTO.getName());
}
return success(cashService.convertCash(cashDO));
return success(respVO);
}
}

View File

@ -69,7 +69,7 @@ public class BpmOAImprestController {
return success(respVO);
}
@GetMapping("/getByProcessInstanceId")
@GetMapping("/getProcessInstanceId")
@Operation(summary = "获得备用金表单")
@Parameter(name = "processInstanceId", description = "流程实例编号", required = true, example = "1024")
public CommonResult<BpmOAImprestRespVO> getByProcessInstanceId(@RequestParam("processInstanceId") String processInstanceId) {

View File

@ -5,9 +5,12 @@ import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.reimbursement.BpmOARei
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.reimbursement.BpmOAReimbursementRespVO;
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAReimbursementDO;
import cn.iocoder.yudao.module.bpm.service.oa.BpmOAReimbursementService;
import cn.iocoder.yudao.module.system.api.project.ProjectApi;
import cn.iocoder.yudao.module.system.api.project.dto.ProjectDTO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.mapstruct.ap.internal.util.Strings;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@ -31,6 +34,9 @@ public class BpmOAReimbursementController {
@Resource
private BpmOAReimbursementService service;
@Resource
private ProjectApi projectApi;
@PostMapping("/create")
// @PreAuthorize("@ss.hasPermission('bpm:oa-reimbursement:create')")
@Operation(summary = "创建请求申请")
@ -45,7 +51,13 @@ public class BpmOAReimbursementController {
public CommonResult<BpmOAReimbursementRespVO> getReimbursement(@RequestParam("id") Long id) {
BpmOAReimbursementDO reimbursement = service.getReimbursement(id);
return success(service.convert(reimbursement));
BpmOAReimbursementRespVO respVO = service.convert(reimbursement);
if (respVO != null && Strings.isNotEmpty(respVO.getProjectNo())) {
// 设置项目名称
ProjectDTO projectDTO = projectApi.getProject(respVO.getProjectNo()).getCheckedData();
respVO.setProjectName(projectDTO.getName());
}
return success(respVO);
}
// @GetMapping("/page")
@ -62,6 +74,12 @@ public class BpmOAReimbursementController {
public CommonResult<BpmOAReimbursementRespVO> getByProcessInstanceId(@RequestParam("processInstanceId") String processInstanceId) {
BpmOAReimbursementDO reimbursement = service.getByProcessInstanceId(processInstanceId);
return success(service.convert(reimbursement));
BpmOAReimbursementRespVO respVO = service.convert(reimbursement);
if (respVO != null && Strings.isNotEmpty(respVO.getProjectNo())) {
// 设置项目名称
ProjectDTO projectDTO = projectApi.getProject(respVO.getProjectNo()).getCheckedData();
respVO.setProjectName(projectDTO.getName());
}
return success(respVO);
}
}

View File

@ -31,6 +31,9 @@ public class BpmOACashCreateReqVO {
@NotNull(message = "报销总金额不能为空")
private BigDecimal totalMoney;
@Schema(description = "项目编号")
private String projectNo;
@Schema(description = "备用金申请编号")
private Long imprestId;

View File

@ -37,6 +37,12 @@ public class BpmOACashRespVO extends BpmOABaseRespVO {
@Schema(description = "报销总金额")
private BigDecimal totalMoney;
@Schema(description = "项目编号")
private String projectNo;
@Schema(description = "项目名称")
private String projectName;
@Schema(description = "备用金申请编号")
private Long imprestId;

View File

@ -36,9 +36,12 @@ public class BpmOAReimbursementCreateReqVO {
@NotNull(message = "报销总金额中文大写不能为空")
private String totalMoneyChinese ;
@Schema(description = "报销类型", requiredMode = Schema.RequiredMode.REQUIRED)
@Schema(description = "报销类型 | 1正常报销 2备用金报销", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "报销类型不能为空")
private BigDecimal reimbursementType ;
private BigDecimal reimbursementType;
@Schema(description = "项目编号")
private String projectNo;
@Schema(description = "备用金ID")
private Long imprestId;

View File

@ -43,6 +43,12 @@ public class BpmOAReimbursementRespVO extends BpmOABaseRespVO {
@NotNull(message = "报销类型不能为空")
private BigDecimal reimbursementType ;
@Schema(description = "项目编号")
private String projectNo;
@Schema(description = "项目名称")
private String projectName;
@Schema(description = "备用金金额", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
private BigDecimal amount;

View File

@ -15,6 +15,9 @@ import java.util.Date;
@Data
public class Reimbursement {
@Schema(description = "主键ID")
private Long id;
@Schema(description = "所属部门ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "128")
private Long deptId;

View File

@ -50,6 +50,11 @@ public class BpmOACashDO extends BaseDO {
*/
private BigDecimal totalMoney;
/**
* 项目编号
*/
private String projectNo;
/**
* 备用金申请编号
*/

View File

@ -29,7 +29,7 @@ import java.util.List;
public class BpmOAReimbursementDO extends BaseDO {
/**
* 1: 自费
* 1: 办公报销
*/
public static final Integer EXPENSE_TYPE = 1;
/**
@ -79,6 +79,11 @@ public class BpmOAReimbursementDO extends BaseDO {
*/
private String totalMoneyChinese;
/**
* 项目编号
*/
private String projectNo;
/**
* 报销类型
*/

View File

@ -0,0 +1,71 @@
package cn.iocoder.yudao.module.bpm.dal.dataobject.oa;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
import java.math.BigDecimal;
import java.util.Date;
/**
* OA 报销明细 DO
*
* @author 姚君
*
*/
@TableName(value ="bpm_oa_reimbursement_item", autoResultMap = true)
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class BpmOAReimbursementItemDO extends BaseDO {
/**
* 报销明细表单主键
*/
@TableId
private Long id;
/**
* 报销编号
*/
private Long reimbursementId;
/**
* 费用产生部门编号
*/
private Long deptId;
/**
* 报销金额
*/
private BigDecimal money;
/**
* 费用类型 | 字典值 参考bpm_oa_reimbursement_type
*/
private String type;
/**
* 发生时间
*/
private Date happenTime;
/**
* 发票张数
*/
private Integer quantity ;
/**
* 费用明细
*/
private String detail ;
/**
* 采购申请编号
*/
private Long procureId;
}

View File

@ -0,0 +1,9 @@
package cn.iocoder.yudao.module.bpm.dal.mysql.oa;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAReimbursementItemDO;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface BpmOAReimbursementItemMapper extends BaseMapperX<BpmOAReimbursementItemDO> {
}

View File

@ -13,6 +13,7 @@ import org.springframework.context.annotation.Lazy;
import org.springframework.util.Assert;
import javax.annotation.Resource;
import java.util.Objects;
import java.util.Set;
import static cn.iocoder.yudao.framework.common.util.collection.SetUtils.asSet;
@ -39,32 +40,59 @@ public abstract class BpmTaskAssignLeaderAbstractScript implements BpmTaskAssign
// 获得发起人
ProcessInstance processInstance = bpmProcessInstanceService.getProcessInstance(execution.getProcessInstanceId());
Long startUserId = NumberUtils.parseLong(processInstance.getStartUserId());
// 获得对应 leve 的部门
DeptRespDTO dept = null;
for (int i = 0; i < level; i++) {
// 获得 level 对应的部门
if (dept == null) {
dept = getStartUserDept(startUserId);
if (dept == null) { // 找不到发起人的部门所以无法使用该规则
return emptySet();
}
} else {
DeptRespDTO parentDept = deptApi.getDept(dept.getParentId()).getCheckedData();
if (parentDept == null) { // 找不到父级部门所以只好结束寻找原因是例如说级别比较高的人所在部门层级比较少
break;
}
dept = parentDept;
}
// 获得发起人部门信息
DeptRespDTO startUserDept = getStartUserDept(startUserId);
// 如果发起人部门为空则直接返回空
if (startUserDept == null) {
return emptySet();
}
Long leaderUserId = dept.getLeaderUserId() ;
if( leaderUserId !=null && !startUserId.toString().equals(leaderUserId.toString()) ) {
return asSet(dept.getLeaderUserId()) ;
}else if( leaderUserId !=null && startUserId.toString().equals(leaderUserId.toString()) ) {
// 如果发起人部门层级 小于等于 level则直接返回发起人的部门负责人
if (startUserDept.getLevel() <= level) {
return startUserDept.getLeaderUserId() == null ? emptySet() : asSet(startUserDept.getLeaderUserId());
}
// 获取发起人部门flag
String [] flag = startUserDept.getFlag().split("-");
// 获取指定层级部门信息
DeptRespDTO dept = deptApi.getDept(Long.valueOf(flag[level])).getCheckedData();
Long leaderUserId = dept.getLeaderUserId();
if(leaderUserId == null) {
return emptySet();
}
if (Objects.equals(leaderUserId, startUserId)) {
//如果领导ID和发起人ID一致那么需要再往上级机构寻找
return calculateTaskCandidateUsers(execution, level+1) ;
return calculateTaskCandidateUsers(execution, level+1);
}else {
return emptySet() ;
return asSet(dept.getLeaderUserId());
}
// // 获得对应 leve 的部门
// DeptRespDTO dept = null;
// for (int i = 0; i < level; i++) {
// // 获得 level 对应的部门
// if (dept == null) {
// dept = getStartUserDept(startUserId);
// if (dept == null) { // 找不到发起人的部门所以无法使用该规则
// return emptySet();
// }
// } else {
// DeptRespDTO parentDept = deptApi.getDept(dept.getParentId()).getCheckedData();
// if (parentDept == null) { // 找不到父级部门所以只好结束寻找原因是例如说级别比较高的人所在部门层级比较少
// break;
// }
// dept = parentDept;
// }
// }
// Long leaderUserId = dept.getLeaderUserId() ;
// if( leaderUserId !=null && !startUserId.toString().equals(leaderUserId.toString()) ) {
// return asSet(dept.getLeaderUserId()) ;
// }else if( leaderUserId !=null && startUserId.toString().equals(leaderUserId.toString()) ) {
// //如果领导ID和发起人ID一致那么需要再往上级机构寻找
// return calculateTaskCandidateUsers(execution, level+1) ;
// }else {
// return emptySet() ;
// }
//return dept.getLeaderUserId() != null ? asSet(dept.getLeaderUserId()) : emptySet();
}

View File

@ -83,6 +83,6 @@ public class BpmProcessCcServiceImpl implements BpmProcessCcService {
return processCcMapper.selectList(new LambdaQueryWrapperX<BpmProcessCcDO>()
.likeIfPresent(BpmProcessCcDO::getName, name)
.eqIfPresent(BpmProcessCcDO::getCompanyDeptId, dto.getId()));
.likeIfPresent(BpmProcessCcDO::getCompanyDeptId, String.valueOf(dto.getId())));
}
}

View File

@ -4,8 +4,10 @@ package cn.iocoder.yudao.module.bpm.service.oa;
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.reimbursement.BpmOAReimbursementCreateReqVO;
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.reimbursement.BpmOAReimbursementRespVO;
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAReimbursementDO;
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAReimbursementItemDO;
import javax.validation.Valid;
import java.util.List;
/**
* 报销申请 Service 接口
@ -40,6 +42,14 @@ public interface BpmOAReimbursementService {
*/
BpmOAReimbursementDO getReimbursement(Long id);
/**
* 获得指定得报销明细
*
* @param reimbursementId 报销主表编号
* @return 明细列表
*/
List<BpmOAReimbursementItemDO> getReimbursementItem(Long reimbursementId);
BpmOAReimbursementRespVO convert(BpmOAReimbursementDO bpmOAReimbursementDO);
/**

View File

@ -3,7 +3,6 @@ package cn.iocoder.yudao.module.bpm.service.oa;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.UploadUserFile;
import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.bpm.api.task.BpmProcessInstanceApi;
@ -11,15 +10,16 @@ import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO;
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.procure.BpmOAProcureListEditReqVO;
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.reimbursement.BpmOAReimbursementCreateReqVO;
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.reimbursement.BpmOAReimbursementRespVO;
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.reimbursement.Reimbursement;
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.reimbursement.ReimbursementDTO;
import cn.iocoder.yudao.module.bpm.convert.oa.BpmOAReimbursementConvert;
import cn.iocoder.yudao.module.bpm.dal.dataobject.financialpayment.FinancialPaymentDO;
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAImprestDO;
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAProcureDO;
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAReimbursementDO;
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAReimbursementItemDO;
import cn.iocoder.yudao.module.bpm.dal.dataobject.task.BpmProcessInstanceExtDO;
import cn.iocoder.yudao.module.bpm.dal.mysql.oa.BpmOAImprestMapper;
import cn.iocoder.yudao.module.bpm.dal.mysql.oa.BpmOAReimbursementItemMapper;
import cn.iocoder.yudao.module.bpm.dal.mysql.oa.BpmOAReimbursementMapper;
import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceResultEnum;
import cn.iocoder.yudao.module.bpm.service.financialpayment.FinancialPaymentService;
@ -80,6 +80,9 @@ public class BpmOAReimbursementServiceImpl extends BpmOABaseService implements B
@Resource
private BpmOAImprestMapper bpmOAImprestMapper;
@Resource
private BpmOAReimbursementItemMapper reimbursementItemMapper;
@Resource
private BpmOAProcureService bpmOAProcureService;
@ -102,6 +105,11 @@ public class BpmOAReimbursementServiceImpl extends BpmOABaseService implements B
.setResult(BpmProcessInstanceResultEnum.PROCESS.getResult());
reimbursementMapper.insert(reimbursement);
// 同步插入明细数据
List<BpmOAReimbursementItemDO> createDO = BeanUtils.toBean(createReqVO.getReimbursements(), BpmOAReimbursementItemDO.class);
createDO.forEach(item -> item.setReimbursementId(reimbursement.getId()));
reimbursementItemMapper.insertBatch(createDO);
// 发起 BPM 流程
Map<String, Object> processInstanceVariables = new HashMap<>();
String processInstanceId = processInstanceApi.createProcessInstance(userId,
@ -125,7 +133,7 @@ public class BpmOAReimbursementServiceImpl extends BpmOABaseService implements B
//判断是否有 采购报销
List<Long> procureIds = new ArrayList<>();
for (Reimbursement data : reimbursement.getReimbursements()) {
for (BpmOAReimbursementItemDO data : createDO) {
//报销类别为 采购费时
if ("4".equals(data.getType())) {
@ -158,7 +166,8 @@ public class BpmOAReimbursementServiceImpl extends BpmOABaseService implements B
BpmOAReimbursementDO bpmOAReimbursementDO = validateLeaveExists(id);
reimbursementMapper.updateById(new BpmOAReimbursementDO().setId(id).setResult(result));
// 获取明细数据
List<BpmOAReimbursementItemDO> reimbursements = getReimbursementItem(id);
//审核通过 最后节点
if (BpmProcessInstanceResultEnum.APPROVE.getResult().equals(result)) {
@ -169,13 +178,13 @@ public class BpmOAReimbursementServiceImpl extends BpmOABaseService implements B
//判断是否有采购报销
List<Long> procureIds = new ArrayList<>();
List<Reimbursement> reimbursements = bpmOAReimbursementDO.getReimbursements();
//直接从数据库取出来的List<Reimbursement> 实际上是List<LinkedHashMap>类型 所以不能直接遍历
//将list再次转为json串然后由json串再转为list
String json = JsonUtils.toJsonString(reimbursements);
reimbursements = JsonUtils.parseArray(json, Reimbursement.class);
for (Reimbursement reimbursement : reimbursements) {
// List<Reimbursement> reimbursements = bpmOAReimbursementDO.getReimbursements();
//
// //直接从数据库取出来的List<Reimbursement> 实际上是List<LinkedHashMap>类型 所以不能直接遍历
// //将list再次转为json串然后由json串再转为list
// String json = JsonUtils.toJsonString(reimbursements);
// reimbursements = JsonUtils.parseArray(json, Reimbursement.class);
for (BpmOAReimbursementItemDO reimbursement : reimbursements) {
//报销类别为 采购费时
if ("4".equals(reimbursement.getType())) {
procureIds.add(reimbursement.getProcureId());
@ -219,7 +228,7 @@ public class BpmOAReimbursementServiceImpl extends BpmOABaseService implements B
}
}
String reason = reimbursements.stream().map(Reimbursement::getDetail)
String reason = reimbursements.stream().map(BpmOAReimbursementItemDO::getDetail)
.filter(StrUtil::isNotEmpty)
.collect(Collectors.joining(","));
@ -264,14 +273,14 @@ public class BpmOAReimbursementServiceImpl extends BpmOABaseService implements B
//判断是否有采购报销
List<Long> procureIds = new ArrayList<>();
List<Reimbursement> reimbursements = bpmOAReimbursementDO.getReimbursements();
// List<Reimbursement> reimbursements = bpmOAReimbursementDO.getReimbursements();
//
// //直接从数据库取出来的List<Reimbursement> 实际上是List<LinkedHashMap>类型 所以不能直接遍历
// //将list再次转为json串然后由json串再转为list
// String json = JsonUtils.toJsonString(reimbursements);
// reimbursements = JsonUtils.parseArray(json, Reimbursement.class);
//直接从数据库取出来的List<Reimbursement> 实际上是List<LinkedHashMap>类型 所以不能直接遍历
//将list再次转为json串然后由json串再转为list
String json = JsonUtils.toJsonString(reimbursements);
reimbursements = JsonUtils.parseArray(json, Reimbursement.class);
for (Reimbursement reimbursement : reimbursements) {
for (BpmOAReimbursementItemDO reimbursement : reimbursements) {
//报销类别为 采购费时
if ("4".equals(reimbursement.getType())) {
@ -294,7 +303,7 @@ public class BpmOAReimbursementServiceImpl extends BpmOABaseService implements B
);
}
}
reimbursementMapper.updateById(new BpmOAReimbursementDO().setId(id).setResult(result));
}
private BpmOAReimbursementDO validateLeaveExists(Long id) {
@ -311,19 +320,28 @@ public class BpmOAReimbursementServiceImpl extends BpmOABaseService implements B
return reimbursementMapper.selectById(id);
}
@Override
public List<BpmOAReimbursementItemDO> getReimbursementItem(Long reimbursementId) {
return reimbursementItemMapper.selectList(BpmOAReimbursementItemDO::getReimbursementId, reimbursementId);
}
@Override
public BpmOAReimbursementRespVO convert(BpmOAReimbursementDO reimbursementDO) {
List<Reimbursement> reimbursement = reimbursementDO.getReimbursements();
// 获取明细数据
List<BpmOAReimbursementItemDO> reimbursements = getReimbursementItem(reimbursementDO.getId());
//直接从数据库取出来的List<Reimbursement> 实际上是List<LinkedHashMap>类型 所以不能直接遍历
//将list再次转为json串然后由json串再转为list
String json = JsonUtils.toJsonString(reimbursement);
reimbursement = JsonUtils.parseArray(json, Reimbursement.class);
// List<Reimbursement> reimbursement = reimbursementDO.getReimbursements();
//
// //直接从数据库取出来的List<Reimbursement> 实际上是List<LinkedHashMap>类型 所以不能直接遍历
// //将list再次转为json串然后由json串再转为list
// String json = JsonUtils.toJsonString(reimbursement);
// reimbursement = JsonUtils.parseArray(json, Reimbursement.class);
//针对之前的数据 没有设置明细所属部门的 手动设置发起人的部门编号
AdminUserRespDTO userRespDTO = userApi.getUser(reimbursementDO.getUserId()).getCheckedData();
for (Reimbursement data : reimbursement) {
for (BpmOAReimbursementItemDO data : reimbursements) {
if (data.getDeptId() != null) {
break;
@ -333,9 +351,9 @@ public class BpmOAReimbursementServiceImpl extends BpmOABaseService implements B
}
//获取部门信息map
Map<Long, DeptRespDTO> deptMap = deptApi.getDeptMap(convertSet(reimbursement, Reimbursement::getDeptId));
Map<Long, DeptRespDTO> deptMap = deptApi.getDeptMap(convertSet(reimbursements, BpmOAReimbursementItemDO::getDeptId));
List<ReimbursementDTO> reimbursementDTOS = BeanUtils.toBean(reimbursement, ReimbursementDTO.class);
List<ReimbursementDTO> reimbursementDTOS = BeanUtils.toBean(reimbursements, ReimbursementDTO.class);
BpmOAReimbursementRespVO bpmOAReimbursementRespVO = BeanUtils.toBean(reimbursementDO, BpmOAReimbursementRespVO.class);
bpmOAReimbursementRespVO.setReimbursements(BpmOAReimbursementConvert.INSTANCE.convertList(reimbursementDTOS, deptMap)); //拼接数据

View File

@ -1,7 +1,6 @@
package cn.iocoder.yudao.module.system.api.project;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.system.api.position.dto.PositionDTO;
import cn.iocoder.yudao.module.system.api.project.dto.ProjectDTO;
import cn.iocoder.yudao.module.system.enums.ApiConstants;
import io.swagger.v3.oas.annotations.Operation;
@ -22,4 +21,9 @@ public interface ProjectApi {
@PostMapping(PREFIX + "/create")
@Operation(summary = "创建项目")
CommonResult<Long> create(@RequestBody ProjectDTO createReqVO);
@GetMapping(PREFIX + "/get")
@Operation(summary = "获得项目")
@Parameter(name = "projectNo", description = "项目编号", required = true)
CommonResult<ProjectDTO> getProject(@RequestParam("projectNo") String projectNo);
}

View File

@ -4,6 +4,7 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.system.api.project.dto.ProjectDTO;
import cn.iocoder.yudao.module.system.controller.admin.project.vo.ProjectSaveReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.project.ProjectDO;
import cn.iocoder.yudao.module.system.service.project.ProjectService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;
@ -23,4 +24,10 @@ public class ProjectApiImpl implements ProjectApi {
public CommonResult<Long> create(ProjectDTO createReqVO) {
return success(projectService.createProject(BeanUtils.toBean(createReqVO, ProjectSaveReqVO.class)));
}
@Override
public CommonResult<ProjectDTO> getProject(String projectNo) {
ProjectDO projectDO = projectService.getProject(projectNo);
return success(BeanUtils.toBean(projectDO, ProjectDTO.class));
}
}

View File

@ -29,6 +29,7 @@ import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap;
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
@Tag(name = "管理后台 - 项目管理")
@RestController
@ -180,4 +181,13 @@ public class ProjectController {
return success(respVOs);
}
@GetMapping("/get-my-project")
@Operation(summary = "获得我参与的项目")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('system:project:query')")
public CommonResult<List<ProjectRespVO>> getMyProject() {
List<ProjectDO> projectList = projectService.getMyProject(getLoginUserId());
return success(BeanUtils.toBean(projectList, ProjectRespVO.class));
}
}

View File

@ -32,7 +32,6 @@ public class ProjectSaveReqVO {
private Long responsibleDept;
@Schema(description = "参与部门集合", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "参与部门集合不能为空")
private Set<Long> participationDept;
@Schema(description = "责任人用户编号", requiredMode = Schema.RequiredMode.REQUIRED)

View File

@ -8,6 +8,7 @@ import cn.iocoder.yudao.module.system.dal.dataobject.laborcontract.LaborContract
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.time.LocalDate;
import java.util.List;
/**
@ -35,4 +36,6 @@ public interface LaborContractMapper extends BaseMapperX<LaborContractDO> {
* @return
*/
LaborContractDO getTheEarliestContract(@Param("userId") Long userId);
List<LaborContractDO> selectListByRemindDate(@Param("remindDate")LocalDate remindDate);
}

View File

@ -4,9 +4,12 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.system.controller.admin.project.vo.ProjectPageReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO;
import cn.iocoder.yudao.module.system.dal.dataobject.project.ProjectDO;
import org.apache.ibatis.annotations.Mapper;
import java.util.Objects;
/**
* 项目管理 Mapper
*
@ -21,12 +24,16 @@ public interface ProjectMapper extends BaseMapperX<ProjectDO> {
.eqIfPresent(ProjectDO::getType, reqVO.getType())
.likeIfPresent(ProjectDO::getName, reqVO.getName())
.eqIfPresent(ProjectDO::getResponsibleDept, reqVO.getResponsibleDept())
.likeIfPresent(ProjectDO::getParticipationDept, reqVO.getParticipationDept())
.eqIfPresent(ProjectDO::getDirectorUserId, reqVO.getDirectorUserId())
.betweenIfPresent(ProjectDO::getStartDate, reqVO.getStartDate())
.betweenIfPresent(ProjectDO::getEndDate, reqVO.getEndDate())
.eqIfPresent(ProjectDO::getIsLongTerm, reqVO.getIsLongTerm())
.eqIfPresent(ProjectDO::getStatus, reqVO.getStatus())
.likeLeft(ProjectDO::getParticipationDept, "-" + reqVO.getParticipationDept())
.or()
.likeRight(ProjectDO::getParticipationDept, reqVO.getParticipationDept() + "-")
.or()
.like(ProjectDO::getParticipationDept, "-" + reqVO.getParticipationDept() + "-")
.orderByDesc(ProjectDO::getId));
}
}

View File

@ -68,6 +68,7 @@ public class BirthdayJob {
@XxlJob("birthdayJob")
@TenantJob // --- 这个注解 会将租户列表拉出来 完了后逐个租户执行 定时任务需要注意
public ReturnT<String> execute() {
//获取参数
XxlJobContext xxlJobContext = XxlJobContext.getXxlJobContext();
String jobParam = xxlJobContext.getJobParam();
@ -129,14 +130,10 @@ public class BirthdayJob {
// 获得提醒日期
LocalDate remindDate = LocalDate.now().plusDays(remindDuration == null ? 7 : remindDuration);
// 查询所有试用人员
List<AdminUserDO> userDOS = userService.getUserListByUserStaffing(5);
List<Long> userIds = convertList(userDOS, AdminUserDO::getId);
List<LaborContractDO> laborContractDOS = laborContractService.getListByUserIds(userIds);
List<Long> contractUserIds = laborContractDOS.stream().filter(item -> remindDate.isEqual(item.getSigningDate().plusMonths(item.getProbationPeriodTime())))
.map(LaborContractDO::getUserId)
.collect(Collectors.toList());
// 过滤需要提醒的用户
List<AdminUserDO> positiveUserList = userDOS.stream().filter(item -> contractUserIds.contains(item.getId())).collect(Collectors.toList());
// 查询提醒日期内的试用人员合同
List<LaborContractDO> laborContractDOS = laborContractService.getListByRemindDate(remindDate);
// 获取需要提醒的用户
List<AdminUserDO> positiveUserList = userService.getUserList(convertList(laborContractDOS, LaborContractDO::getUserId));
if (CollUtil.isNotEmpty(positiveUserList)) {
List<Long> noticeUserIds = positiveUserList.stream().map(AdminUserDO::getId).collect(Collectors.toList());
List<AdminOauthUserOtherInfoDO> list = new ArrayList<>();

View File

@ -8,10 +8,11 @@ import cn.iocoder.yudao.module.system.controller.admin.equipment.vo.attendancema
import cn.iocoder.yudao.module.system.dal.dataobject.equipment.AttendanceMachineDO;
import cn.iocoder.yudao.module.system.service.equipment.AttendanceMachineService;
import com.github.yulichang.toolkit.SpringContentUtils;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
@ -31,9 +32,9 @@ public class AttendanceMachineJob {
@Resource
private StringRedisTemplate stringRedisTemplate;
@Scheduled(initialDelay = 5000, fixedRate = 30000)
@XxlJob("updateAttendanceMachineStatusJob")
@TenantJob
public void updateAttendanceMachineStatus() {
public ReturnT<String> execute() {
WebSocketSessionManager webSocketSessionManager = SpringContentUtils.getBean(WebSocketSessionManager.class);
@ -62,5 +63,8 @@ public class AttendanceMachineJob {
attendanceMachineService.updateAttendanceMachineStatus(statusUpdateVOS);
}
// 返回执行成功
return ReturnT.SUCCESS;
}
}

View File

@ -269,11 +269,17 @@ public class DeptServiceImpl implements DeptService {
}
@Override
@DataPermission(enable = false)
@Cacheable(cacheNames = RedisKeyConstants.DEPT_CHILDREN_ID_LIST, key = "#id")
public List<DeptDO> getChildDept(Long id) {
return deptMapper.selectList(new LambdaQueryWrapperX<DeptDO>()
.like(DeptDO::getFlag, id)
.eq(DeptDO::getStatus, CommonStatusEnum.ENABLE.getStatus()));
.eq(DeptDO::getStatus, CommonStatusEnum.ENABLE.getStatus())
.likeLeft(DeptDO::getFlag, "-" + id)
.or()
.likeRight(DeptDO::getFlag, id + "-")
.or()
.like(DeptDO::getFlag, "-" + id + "-"));
}
@Override

View File

@ -102,4 +102,12 @@ public interface LaborContractService {
* @return
*/
LaborContractDO getTheEarliestContract(Long userId);
/**
* 获取指定日期内即将转正的人员
*
* @param remindDate 日期
* @return 合同列表
*/
List<LaborContractDO> getListByRemindDate(LocalDate remindDate);
}

View File

@ -165,4 +165,10 @@ public class LaborContractServiceImpl implements LaborContractService {
public LaborContractDO getTheEarliestContract(Long userId) {
return laborContractMapper.getTheEarliestContract(userId);
}
@Override
public List<LaborContractDO> getListByRemindDate(LocalDate remindDate) {
return laborContractMapper.selectListByRemindDate(remindDate);
}
}

View File

@ -6,6 +6,7 @@ import cn.iocoder.yudao.module.system.controller.admin.project.vo.ProjectSaveReq
import cn.iocoder.yudao.module.system.dal.dataobject.project.ProjectDO;
import javax.validation.Valid;
import java.util.List;
/**
* 项目管理 Service 接口
@ -44,6 +45,14 @@ public interface ProjectService {
*/
ProjectDO getProject(Long id);
/**
* 获得项目管理
*
* @param projectNo 项目编号
* @return 项目
*/
ProjectDO getProject(String projectNo);
/**
* 获得项目管理分页
*
@ -52,4 +61,10 @@ public interface ProjectService {
*/
PageResult<ProjectDO> getProjectPage(ProjectPageReqVO pageReqVO);
/**
* 获得我参与的项目列表
* @param userId 用户编号
* @return 项目列表
*/
List<ProjectDO> getMyProject(Long userId);
}

View File

@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.system.service.project;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.system.controller.admin.project.vo.ProjectPageReqVO;
import cn.iocoder.yudao.module.system.controller.admin.project.vo.ProjectSaveReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.project.ProjectDO;
@ -11,6 +12,7 @@ import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.util.List;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.PROJECT_NOT_EXISTS;
@ -65,9 +67,23 @@ public class ProjectServiceImpl implements ProjectService {
return projectMapper.selectById(id);
}
@Override
public ProjectDO getProject(String projectNo) {
return projectMapper.selectOne(ProjectDO::getProjectNo, projectNo);
}
@Override
public PageResult<ProjectDO> getProjectPage(ProjectPageReqVO pageReqVO) {
return projectMapper.selectPage(pageReqVO);
}
@Override
public List<ProjectDO> getMyProject(Long userId) {
return projectMapper.selectList(new LambdaQueryWrapperX<ProjectDO>()
.eq(ProjectDO::getDirectorUserId, userId)
.or()
.like(ProjectDO::getStaff, userId)
.eq(ProjectDO::getStatus, 1));
}
}

View File

@ -29,4 +29,14 @@
system_labor_contract
where deleted = 0 and user_id = #{userId}
</select>
<select id="selectListByRemindDate" resultType="cn.iocoder.yudao.module.system.dal.dataobject.laborcontract.LaborContractDO">
SELECT
*
FROM
system_labor_contract
WHERE
DATE_ADD(signing_date, INTERVAL probation_period_time MONTH) = #{remindDate}
AND status = 1
AND deleted = 0
</select>
</mapper>

View File

@ -21,6 +21,7 @@
a.dept_id = b.id
and a.status = 0
and a.user_type = 1
and a.deleted = 0
and a.dept_id in
<foreach collection="list" item="deptIds" open="(" close=")" separator=",">
#{deptIds}