Compare commits
5 Commits
8097eb2ea9
...
99b5ff9efc
Author | SHA1 | Date | |
---|---|---|---|
![]() |
99b5ff9efc | ||
![]() |
0703f3d8ef | ||
![]() |
d9fbd61195 | ||
![]() |
16e541462c | ||
![]() |
6029bb270d |
@ -60,6 +60,7 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode OA_REFUND_NOT_EXISTS = new ErrorCode(1_009_001_123, "退款申请不存在");
|
||||
ErrorCode OA_PROJECT_NOT_EXISTS = new ErrorCode(1_009_001_124, "项目申请不存在");
|
||||
ErrorCode OA_CONTRACT_INVOICE_AMOUNT_LACK = new ErrorCode(1_009_001_125, "该合同的开票余额不足!");
|
||||
ErrorCode OA_PAYMENT_NOT_EXISTS = new ErrorCode(1_009_001_126, "付款申请不存在");
|
||||
|
||||
// ========== 流程模型 1-009-002-000 ==========
|
||||
ErrorCode MODEL_KEY_EXISTS = new ErrorCode(1_009_002_000, "已经存在流程标识为【{}】的流程");
|
||||
|
@ -0,0 +1,143 @@
|
||||
package cn.iocoder.yudao.module.bpm.controller.admin.oa;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.payment.BpmOAPaymentCreateReqVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.payment.BpmOAPaymentRespVO;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAPaymentDO;
|
||||
import cn.iocoder.yudao.module.bpm.service.oa.BpmOAPaymentService;
|
||||
import cn.iocoder.yudao.module.system.api.bank.BankApi;
|
||||
import cn.iocoder.yudao.module.system.api.bank.dto.BankRespDTO;
|
||||
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
||||
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
|
||||
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.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
|
||||
/**
|
||||
* OA 付款申请 Controller
|
||||
*
|
||||
* @author 符溶馨
|
||||
|
||||
*/
|
||||
@Tag(name = "管理后台 - OA 付款申请")
|
||||
@RestController
|
||||
@RequestMapping("/bpm/oa/payment")
|
||||
@Validated
|
||||
public class BpmOAPaymentController {
|
||||
|
||||
@Resource
|
||||
private BpmOAPaymentService paymentService;
|
||||
|
||||
@Resource
|
||||
private ProjectApi projectApi;
|
||||
|
||||
@Resource
|
||||
private DeptApi deptApi;
|
||||
|
||||
@Resource
|
||||
private BankApi bankApi;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建付款申请")
|
||||
public CommonResult<Long> createPayment(@Valid @RequestBody BpmOAPaymentCreateReqVO createReqVO) {
|
||||
|
||||
return success(paymentService.createPayment(getLoginUserId(), createReqVO));
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得付款申请")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
public CommonResult<BpmOAPaymentRespVO> getPayment(@RequestParam("id") Long id) {
|
||||
|
||||
BpmOAPaymentDO payment = paymentService.getPayment(id);
|
||||
BpmOAPaymentRespVO respVO = BeanUtils.toBean(payment, BpmOAPaymentRespVO.class);
|
||||
if (respVO != null) {
|
||||
// 获取部门信息Map
|
||||
List<Long> deptIds = Arrays.asList(payment.getDeptId(), payment.getPaymentCompany());
|
||||
Map<Long, DeptRespDTO> dtoMap = deptApi.getDeptMap(new HashSet<>(deptIds));
|
||||
|
||||
// 设置部门名称
|
||||
respVO.setDeptName(dtoMap.get(payment.getDeptId()).getName());
|
||||
// 设置付款公司名称
|
||||
respVO.setPaymentCompanyName(dtoMap.get(payment.getPaymentCompany()).getName());
|
||||
|
||||
if (payment.getProjectNo() != null) {
|
||||
// 获取项目信息
|
||||
ProjectDTO project = projectApi.getProject(payment.getProjectNo()).getCheckedData();
|
||||
// 设置项目名称
|
||||
respVO.setProjectName(project.getName());
|
||||
}
|
||||
|
||||
if (payment.getBankId() != null) {
|
||||
// 获取银行卡信息
|
||||
BankRespDTO bankResp = bankApi.getBank(payment.getBankId()).getCheckedData();
|
||||
// 设置银行卡信息
|
||||
respVO.setBankName(bankResp.getBankName());
|
||||
respVO.setBankNo(bankResp.getBankNo());
|
||||
respVO.setNickname(bankResp.getNickname());
|
||||
}
|
||||
}
|
||||
|
||||
return success(respVO);
|
||||
}
|
||||
|
||||
@GetMapping("/getByProcessInstanceId")
|
||||
@Operation(summary = "获得付款申请")
|
||||
@Parameter(name = "BpmOAPaymentRespVO", description = "流程实例编号", required = true, example = "1024")
|
||||
public CommonResult<BpmOAPaymentRespVO> getByProcessInstanceId(@RequestParam("processInstanceId") String processInstanceId) {
|
||||
|
||||
BpmOAPaymentDO payment = paymentService.getByProcessInstanceId(processInstanceId);
|
||||
BpmOAPaymentRespVO respVO = BeanUtils.toBean(payment, BpmOAPaymentRespVO.class);
|
||||
if (respVO != null) {
|
||||
// 获取部门信息Map
|
||||
List<Long> deptIds = Arrays.asList(payment.getDeptId(), payment.getPaymentCompany());
|
||||
Map<Long, DeptRespDTO> dtoMap = deptApi.getDeptMap(new HashSet<>(deptIds));
|
||||
|
||||
// 设置部门名称
|
||||
respVO.setDeptName(dtoMap.get(payment.getDeptId()).getName());
|
||||
// 设置付款公司名称
|
||||
respVO.setPaymentCompanyName(dtoMap.get(payment.getPaymentCompany()).getName());
|
||||
|
||||
if (payment.getProjectNo() != null) {
|
||||
// 获取项目信息
|
||||
ProjectDTO project = projectApi.getProject(payment.getProjectNo()).getCheckedData();
|
||||
// 设置项目名称
|
||||
respVO.setProjectName(project.getName());
|
||||
}
|
||||
|
||||
if (payment.getBankId() != null) {
|
||||
// 获取银行卡信息
|
||||
BankRespDTO bankResp = bankApi.getBank(payment.getBankId()).getCheckedData();
|
||||
// 设置银行卡信息
|
||||
respVO.setBankName(bankResp.getBankName());
|
||||
respVO.setBankNo(bankResp.getBankNo());
|
||||
respVO.setNickname(bankResp.getNickname());
|
||||
}
|
||||
}
|
||||
|
||||
return success(respVO);
|
||||
}
|
||||
|
||||
@GetMapping("/get-list")
|
||||
@Operation(summary = "获得指定条件的付款申请")
|
||||
@Parameter(name = "type", description = "付款类型", required = true, example = "1")
|
||||
public CommonResult<List<BpmOAPaymentRespVO>> getPayment(@RequestParam("type") Integer type) {
|
||||
|
||||
return success(paymentService.getPaymentList(type));
|
||||
}
|
||||
}
|
@ -78,8 +78,8 @@ public class BpmOAProcurePayController {
|
||||
|
||||
@GetMapping("/getAvailablePurchaseOrders")
|
||||
@Operation(summary = "获取可用采购单列表")
|
||||
public CommonResult<List<BpmOAProcureRespVO>> getAvailablePurchaseOrders() {
|
||||
List<BpmOAProcureDO> list = oAProcurePayService.getAvailablePurchaseOrders();
|
||||
public CommonResult<List<BpmOAProcureRespVO>> getAvailablePurchaseOrders(@RequestParam(name = "type", required = false) Integer type) {
|
||||
List<BpmOAProcureDO> list = oAProcurePayService.getAvailablePurchaseOrders(type);
|
||||
return success(BeanUtils.toBean(list, BpmOAProcureRespVO.class));
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,68 @@
|
||||
package cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.payment;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.UploadUserFile;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 付款申请 创建 Request VO
|
||||
*
|
||||
* @author 符溶馨
|
||||
*/
|
||||
@Schema(description = "管理后台 - 付款申请创建 Request VO")
|
||||
@Data
|
||||
public class BpmOAPaymentCreateReqVO {
|
||||
|
||||
@Schema(description = "申请事由", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "申请事由不能为空")
|
||||
private String reason;
|
||||
|
||||
@Schema(description = "付款类型 | 字典值参考 bpm_oa_payment_type", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "付款类型不能为空")
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "费用产生部门编号", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
private Long deptId;
|
||||
|
||||
@Schema(description = "项目编号", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
private String projectNo;
|
||||
|
||||
@Schema(description = "采购单编号", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
private Long procureId;
|
||||
|
||||
@Schema(description = "银行编号", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
private Long bankId;
|
||||
|
||||
@Schema(description = "付款方式 | 1预付款 2分期付款 3全额付款", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
private Integer paymentMethod;
|
||||
|
||||
@Schema(description = "付款总额 | 针对预付款、分期付款情况", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
private BigDecimal totalAmount;
|
||||
|
||||
@Schema(description = "付款比例 | 针对分期付款情况", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
private Integer paymentRatio;
|
||||
|
||||
@Schema(description = "付款金额", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "付款金额不能为空")
|
||||
private BigDecimal amount;
|
||||
|
||||
@Schema(description = "付款公司编号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "付款公司编号不能为空")
|
||||
private Long paymentCompany;
|
||||
|
||||
@Schema(description = "父级审批编号", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
private Long parentId;
|
||||
|
||||
@Schema(description = "流程实例编号")
|
||||
private String processInstanceId;
|
||||
|
||||
@Schema(description = "状态-参见 bpm_process_instance_result 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Integer result;
|
||||
|
||||
@Schema(description = "上传文件", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private List<UploadUserFile> fileItems;
|
||||
}
|
@ -0,0 +1,81 @@
|
||||
package cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.payment;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.UploadUserFile;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.BpmOABaseRespVO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 符溶馨
|
||||
*/
|
||||
@Schema(description = "管理后台 - 付款申请 请求Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class BpmOAPaymentRespVO extends BpmOABaseRespVO {
|
||||
|
||||
@Schema(description = "申请事由")
|
||||
private String reason;
|
||||
|
||||
@Schema(description = "付款类型 | 字典值参考 bpm_oa_payment_type")
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "费用产生部门编号")
|
||||
private Long deptId;
|
||||
|
||||
@Schema(description = "费用产生部门名称")
|
||||
private String deptName;
|
||||
|
||||
@Schema(description = "项目编号")
|
||||
private String projectNo;
|
||||
|
||||
@Schema(description = "采购单编号", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
private Long procureId;
|
||||
|
||||
@Schema(description = "项目名称")
|
||||
private String projectName;
|
||||
|
||||
@Schema(description = "银行编号")
|
||||
private Long bankId;
|
||||
|
||||
@Schema(description = "付款人昵称")
|
||||
private String nickname;
|
||||
|
||||
@Schema(description = "银行名称")
|
||||
private String bankName;
|
||||
|
||||
@Schema(description = "银行账号")
|
||||
private String bankNo;
|
||||
|
||||
@Schema(description = "付款方式 | 1预付款 2分期付款 3全额付款")
|
||||
private Integer paymentMethod;
|
||||
|
||||
@Schema(description = "付款总额 | 针对预付款、分期付款情况")
|
||||
private BigDecimal totalAmount;
|
||||
|
||||
@Schema(description = "付款比例 | 针对分期付款情况")
|
||||
private Integer paymentRatio;
|
||||
|
||||
@Schema(description = "付款金额")
|
||||
private BigDecimal amount;
|
||||
|
||||
@Schema(description = "付款公司编号")
|
||||
private Long paymentCompany;
|
||||
|
||||
@Schema(description = "付款公司名称")
|
||||
private String paymentCompanyName;
|
||||
|
||||
@Schema(description = "父级审批编号")
|
||||
private Long parentId;
|
||||
|
||||
@Schema(description = "累计付款比列")
|
||||
private Integer ratio;
|
||||
|
||||
@Schema(description = "上传文件")
|
||||
private List<UploadUserFile> fileItems;
|
||||
}
|
@ -0,0 +1,121 @@
|
||||
package cn.iocoder.yudao.module.bpm.dal.dataobject.oa;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.UploadUserFile;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceResultEnum;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
|
||||
import lombok.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 付款申请 DO
|
||||
*
|
||||
* @author 艾楷
|
||||
*/
|
||||
@TableName("bpm_oa_payment")
|
||||
@KeySequence("bpm_oa_payment") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class BpmOAPaymentDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 付款申请表单主键
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 申请人的用户编号
|
||||
* 关联 AdminUserDO 的 id 属性
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 申请事由
|
||||
*/
|
||||
private String reason;
|
||||
|
||||
/**
|
||||
* 付款类型 | 字典值参考 bpm_oa_payment_type
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 费用产生部门编号
|
||||
*/
|
||||
private Long deptId;
|
||||
|
||||
/**
|
||||
* 项目编号
|
||||
*/
|
||||
private String projectNo;
|
||||
|
||||
/**
|
||||
* 采购计划编号
|
||||
*/
|
||||
private Long procureId;
|
||||
|
||||
/**
|
||||
* 银行编号
|
||||
*/
|
||||
private Long bankId;
|
||||
|
||||
/**
|
||||
* 付款方式 | 1预付款 2分期付款 3全额付款
|
||||
*/
|
||||
private Integer paymentMethod;
|
||||
|
||||
/**
|
||||
* 付款总额 | 针对预付款、分期付款情况
|
||||
*/
|
||||
private BigDecimal totalAmount;
|
||||
|
||||
/**
|
||||
* 付款比例 | 百分比数字
|
||||
*/
|
||||
private Integer paymentRatio;
|
||||
|
||||
/**
|
||||
* 付款金额
|
||||
*/
|
||||
private BigDecimal amount;
|
||||
|
||||
/**
|
||||
* 付款公司
|
||||
*/
|
||||
private Long paymentCompany;
|
||||
|
||||
/**
|
||||
* 父级审批
|
||||
*/
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 出差的结果
|
||||
* 枚举 {@link BpmProcessInstanceResultEnum}
|
||||
* 考虑到简单,所以直接复用了 BpmProcessInstanceResultEnum 枚举,也可以自己定义一个枚举哈
|
||||
*/
|
||||
private Integer result;
|
||||
|
||||
/**
|
||||
* 对应的流程编号
|
||||
* 关联 ProcessInstance 的 id 属性
|
||||
*/
|
||||
private String processInstanceId;
|
||||
|
||||
/**
|
||||
* 附件基本信息
|
||||
*/
|
||||
@TableField(typeHandler = JacksonTypeHandler.class)
|
||||
private List<UploadUserFile> fileItems ;
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package cn.iocoder.yudao.module.bpm.dal.mysql.oa;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.payment.BpmOAPaymentRespVO;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAPaymentDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface BpmOAPaymentMapper extends BaseMapperX<BpmOAPaymentDO> {
|
||||
|
||||
List<BpmOAPaymentRespVO> selectPaymentList(@Param("type") Integer type);
|
||||
}
|
@ -3,7 +3,6 @@ package cn.iocoder.yudao.module.bpm.dal.mysql.oa;
|
||||
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.framework.mybatis.core.query.MPJLambdaWrapperX;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.procure.BpmOAProcurePageReqVO;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAProcureDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
@ -34,5 +33,6 @@ public interface BpmOAProcureMapper extends BaseMapperX<BpmOAProcureDO> {
|
||||
.orderByDesc(BpmOAProcureDO::getId));
|
||||
}
|
||||
|
||||
List<BpmOAProcureDO> selectListByDeptId(@Param("companyDeptId") Long companyDeptId);
|
||||
List<BpmOAProcureDO> selectListByDeptId(@Param("companyDeptId") Long companyDeptId,
|
||||
@Param("type") Integer type);
|
||||
}
|
||||
|
@ -17,9 +17,7 @@ import org.springframework.validation.annotation.Validated;
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
@ -91,7 +89,9 @@ public class BpmOAEvectionServiceImpl extends BpmOABaseService implements BpmOAE
|
||||
// 发起出差申请后,判断是否是当天的出差
|
||||
if (evection.getStartTime().toLocalDate().isEqual(LocalDate.now())) {
|
||||
// 设置外勤打卡权限
|
||||
userApi.updateFieldworkType(getLoginUserId(), 1);
|
||||
Set<Long> userIds = evection.getTogetherUserIds();
|
||||
userIds.add(userId);
|
||||
userApi.updateFieldworkType(userIds, 1);
|
||||
}
|
||||
|
||||
return evection.getId();
|
||||
@ -100,7 +100,7 @@ public class BpmOAEvectionServiceImpl extends BpmOABaseService implements BpmOAE
|
||||
@Override
|
||||
public void updateEvectionResult(Long id, Integer result) {
|
||||
|
||||
validateLeaveExists(id);
|
||||
BpmOAEvectionDO evectionDO = validateLeaveExists(id);
|
||||
evectionMapper.updateById(new BpmOAEvectionDO().setId(id).setResult(result));
|
||||
|
||||
// -- 自己取消
|
||||
@ -109,15 +109,19 @@ public class BpmOAEvectionServiceImpl extends BpmOABaseService implements BpmOAE
|
||||
|| BpmProcessInstanceResultEnum.CANCEL.getResult().equals(result)
|
||||
|| BpmProcessInstanceResultEnum.BACK.getResult().equals(result)) {
|
||||
|
||||
// 发起外出申请后,设置关闭外勤打卡权限
|
||||
userApi.updateFieldworkType(getLoginUserId(), 0);
|
||||
// 设置关闭外勤打卡权限
|
||||
Set<Long> userIds = evectionDO.getTogetherUserIds();
|
||||
userIds.add(evectionDO.getUserId());
|
||||
userApi.updateFieldworkType(userIds, 0);
|
||||
}
|
||||
}
|
||||
|
||||
private void validateLeaveExists(Long id) {
|
||||
if (evectionMapper.selectById(id) == null) {
|
||||
private BpmOAEvectionDO validateLeaveExists(Long id) {
|
||||
BpmOAEvectionDO evectionDO = evectionMapper.selectById(id);
|
||||
if (evectionDO == null) {
|
||||
throw exception(OA_EVECTION_NOT_EXISTS);
|
||||
}
|
||||
return evectionDO;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -17,9 +17,7 @@ import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDate;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
@ -84,7 +82,7 @@ public class BpmOAGoOutServiceImpl extends BpmOABaseService implements BpmOAGoOu
|
||||
// 发起外出申请后,判断是否是当天的外出
|
||||
if (goOut.getStartTime().toLocalDate().isEqual(LocalDate.now())) {
|
||||
// 设置外勤打卡权限
|
||||
userApi.updateFieldworkType(getLoginUserId(), 1);
|
||||
userApi.updateFieldworkType(Collections.singletonList(userId), 1);
|
||||
}
|
||||
|
||||
return goOut.getId();
|
||||
@ -102,7 +100,7 @@ public class BpmOAGoOutServiceImpl extends BpmOABaseService implements BpmOAGoOu
|
||||
|| BpmProcessInstanceResultEnum.BACK.getResult().equals(result)) {
|
||||
|
||||
// 发起外出申请后,设置关闭外勤打卡权限
|
||||
userApi.updateFieldworkType(getLoginUserId(), 0);
|
||||
userApi.updateFieldworkType(Collections.singletonList(getLoginUserId()), 0);
|
||||
}
|
||||
|
||||
goOutMapper.updateById(new BpmOAGoOutDO().setId(id).setResult(result));
|
||||
|
@ -0,0 +1,49 @@
|
||||
package cn.iocoder.yudao.module.bpm.service.oa;
|
||||
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.payment.BpmOAPaymentCreateReqVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.payment.BpmOAPaymentRespVO;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAPaymentDO;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
public interface BpmOAPaymentService {
|
||||
|
||||
/**
|
||||
* 创建付款申请
|
||||
*
|
||||
* @param userId 用户编号
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createPayment(Long userId, @Valid BpmOAPaymentCreateReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新付款申请的状态
|
||||
*
|
||||
* @param id 编号
|
||||
* @param result 结果
|
||||
*/
|
||||
void updatePaymentResult(String processInstanceId, Long id, Integer result);
|
||||
|
||||
/**
|
||||
* 获得付款申请
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 退款申请
|
||||
*/
|
||||
BpmOAPaymentDO getPayment(Long id);
|
||||
|
||||
/**
|
||||
* 获得指定的付款申请
|
||||
* @param processInstanceId 流程实例编号
|
||||
* @return 退款申请
|
||||
*/
|
||||
BpmOAPaymentDO getByProcessInstanceId(String processInstanceId);
|
||||
|
||||
/**
|
||||
* 获得付款申请列表
|
||||
* @return 付款申请列表
|
||||
*/
|
||||
List<BpmOAPaymentRespVO> getPaymentList(Integer type);
|
||||
}
|
@ -0,0 +1,108 @@
|
||||
package cn.iocoder.yudao.module.bpm.service.oa;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.UploadUserFile;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.payment.BpmOAPaymentCreateReqVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.payment.BpmOAPaymentRespVO;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAPaymentDO;
|
||||
import cn.iocoder.yudao.module.bpm.dal.mysql.oa.BpmOAPaymentMapper;
|
||||
import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceResultEnum;
|
||||
import cn.iocoder.yudao.module.bpm.service.task.BpmHistoryProcessInstanceService;
|
||||
import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.OA_PAYMENT_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
* OA 付款申请 Service 实现类
|
||||
*
|
||||
* @author 符溶馨
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class BpmOAPaymentServiceImpl extends BpmOABaseService implements BpmOAPaymentService{
|
||||
|
||||
/**
|
||||
* OA 付款对应的流程定义 KEY
|
||||
*/
|
||||
public static final String PROCESS_KEY = "oa_payment_2";
|
||||
|
||||
@Resource
|
||||
private BpmOAPaymentMapper paymentMapper;
|
||||
|
||||
@Resource
|
||||
private BpmProcessInstanceService processInstanceService;
|
||||
|
||||
@Resource
|
||||
private BpmHistoryProcessInstanceService historyProcessInstanceService;
|
||||
|
||||
@Override
|
||||
public Long createPayment(Long userId, BpmOAPaymentCreateReqVO createReqVO) {
|
||||
|
||||
//插入OA 付款申请
|
||||
BpmOAPaymentDO paymentDO = BeanUtils.toBean(createReqVO, BpmOAPaymentDO.class).setUserId(userId)
|
||||
.setResult(BpmProcessInstanceResultEnum.PROCESS.getResult());
|
||||
paymentMapper.insert(paymentDO);
|
||||
|
||||
// 发起 BPM 流程
|
||||
Map<String, Object> processInstanceVariables = new HashMap<>();
|
||||
String processInstanceId = processInstanceService.createProcessInstance(userId,
|
||||
new BpmProcessInstanceCreateReqDTO().setProcessDefinitionKey(PROCESS_KEY)
|
||||
.setVariables(processInstanceVariables).setBusinessKey(String.valueOf(paymentDO.getId())));
|
||||
|
||||
// 将工作流的编号,更新到 OA 付款申请单中
|
||||
paymentMapper.updateById(new BpmOAPaymentDO().setId(paymentDO.getId()).setProcessInstanceId(processInstanceId));
|
||||
|
||||
// 判断是否为重新发起的流程
|
||||
if (createReqVO.getProcessInstanceId() != null && createReqVO.getResult() == 3) {
|
||||
|
||||
historyProcessInstanceService.createHistoryProcessInstance(processInstanceId, createReqVO.getProcessInstanceId());
|
||||
}
|
||||
|
||||
List<UploadUserFile> fileItems = createReqVO.getFileItems() ;
|
||||
//这里的逻辑,如果fileItems不为空,且有数据,那么说明是上传了附件的,则需要更工作流文件表对应的实例Id
|
||||
if (fileItems != null && !fileItems.isEmpty()) {
|
||||
uploadBpmFileProcessInstanceId(processInstanceId,fileItems) ;
|
||||
}
|
||||
return paymentDO.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updatePaymentResult(String processInstanceId, Long id, Integer result) {
|
||||
|
||||
validateLeaveExists(id);
|
||||
paymentMapper.updateById(new BpmOAPaymentDO().setId(id).setResult(result));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BpmOAPaymentDO getPayment(Long id) {
|
||||
|
||||
return paymentMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BpmOAPaymentDO getByProcessInstanceId(String processInstanceId) {
|
||||
|
||||
return paymentMapper.selectOne(BpmOAPaymentDO::getProcessInstanceId, processInstanceId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BpmOAPaymentRespVO> getPaymentList(Integer type) {
|
||||
|
||||
return paymentMapper.selectPaymentList(type);
|
||||
}
|
||||
|
||||
private void validateLeaveExists(Long id) {
|
||||
if (paymentMapper.selectById(id) == null) {
|
||||
throw exception(OA_PAYMENT_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
}
|
@ -59,7 +59,7 @@ public interface BpmOAProcurePayService {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<BpmOAProcureDO> getAvailablePurchaseOrders();
|
||||
List<BpmOAProcureDO> getAvailablePurchaseOrders(Integer type);
|
||||
|
||||
void updateEvectionResult(String processInstanceExtId, Long id, Integer result);
|
||||
|
||||
|
@ -41,7 +41,6 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -158,7 +157,7 @@ public class BpmOAProcurePayServiceImpl extends BpmOABaseService implements BpmO
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BpmOAProcureDO> getAvailablePurchaseOrders() {
|
||||
public List<BpmOAProcureDO> getAvailablePurchaseOrders(Integer type) {
|
||||
//获取当前登录用户id
|
||||
Long userId = WebFrameworkUtils.getLoginUserId();
|
||||
// 获取当前登录用的部门信息
|
||||
@ -171,7 +170,7 @@ public class BpmOAProcurePayServiceImpl extends BpmOABaseService implements BpmO
|
||||
DeptRespDTO company = deptApi.getUserCompanyDept(userId).getCheckedData();
|
||||
|
||||
// 查询当前用户所在公司下,所有部门可用的采购单
|
||||
return oaProcureMapper.selectListByDeptId(company.getId());
|
||||
return oaProcureMapper.selectListByDeptId(company.getId(), type);
|
||||
|
||||
}else {
|
||||
|
||||
@ -184,6 +183,7 @@ public class BpmOAProcurePayServiceImpl extends BpmOABaseService implements BpmO
|
||||
.in(BpmOAProcureDO::getUserId, userIds)
|
||||
.eq(BpmOAProcureDO::getResult, BpmProcessInstanceResultEnum.APPROVE.getResult())
|
||||
.eq(BpmOAProcureDO::getPayFlag, BpmOAProcureDO.FLAG_FALSE)
|
||||
.eqIfPresent(BpmOAProcureDO::getProcureType, type)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,31 @@
|
||||
package cn.iocoder.yudao.module.bpm.service.oa.listener;
|
||||
|
||||
import cn.iocoder.yudao.module.bpm.framework.bpm.core.event.BpmProcessInstanceResultEvent;
|
||||
import cn.iocoder.yudao.module.bpm.framework.bpm.core.event.BpmProcessInstanceResultEventListener;
|
||||
import cn.iocoder.yudao.module.bpm.service.oa.BpmOAPaymentService;
|
||||
import cn.iocoder.yudao.module.bpm.service.oa.BpmOAPaymentServiceImpl;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* OA 签呈的结果的监听器实现类
|
||||
*
|
||||
* @author 符溶馨
|
||||
*/
|
||||
@Component
|
||||
public class BpmOAPaymentResultListener extends BpmProcessInstanceResultEventListener {
|
||||
|
||||
@Resource
|
||||
private BpmOAPaymentService paymentService;
|
||||
|
||||
@Override
|
||||
protected String getProcessDefinitionKey() {
|
||||
return BpmOAPaymentServiceImpl.PROCESS_KEY;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onEvent(BpmProcessInstanceResultEvent event) {
|
||||
paymentService.updatePaymentResult(event.getId() ,Long.parseLong(event.getBusinessKey()), event.getResult());
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.iocoder.yudao.module.bpm.dal.mysql.oa.BpmOAPaymentMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
|
||||
<select id="selectPaymentList" resultType="cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.payment.BpmOAPaymentRespVO">
|
||||
SELECT
|
||||
a.*,
|
||||
COALESCE(SUM( b.payment_ratio ), 0) + COALESCE(a.payment_ratio,0) AS ratio
|
||||
FROM
|
||||
bpm_oa_payment a
|
||||
LEFT JOIN bpm_oa_payment b ON b.parent_id = a.id AND b.result = 2
|
||||
WHERE
|
||||
ISNULL( a.parent_id )
|
||||
AND a.result = 2
|
||||
AND a.payment_method = #{type}
|
||||
GROUP BY
|
||||
a.id
|
||||
HAVING
|
||||
ratio < 100
|
||||
</select>
|
||||
</mapper>
|
@ -29,5 +29,8 @@
|
||||
a.result = 2
|
||||
AND a.pay_flag = 0
|
||||
AND a.deleted = 0
|
||||
<if test="type != null">
|
||||
AND a.procure_type = #{type}
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
|
@ -0,0 +1,23 @@
|
||||
--- #################### 注册中心相关配置 ####################
|
||||
|
||||
spring:
|
||||
cloud:
|
||||
nacos:
|
||||
server-addr: 127.0.0.1:8848
|
||||
discovery:
|
||||
namespace: dev # 命名空间。这里使用 dev 开发环境
|
||||
metadata:
|
||||
version: 1.0.0 # 服务实例的版本号,可用于灰度发布
|
||||
|
||||
--- #################### 配置中心相关配置 ####################
|
||||
|
||||
spring:
|
||||
cloud:
|
||||
nacos:
|
||||
# Nacos Config 配置项,对应 NacosConfigProperties 配置属性类
|
||||
config:
|
||||
server-addr: 127.0.0.1:8848 # Nacos 服务器地址
|
||||
namespace: dev # 命名空间 dev 的ID,不能直接使用 dev 名称。创建命名空间的时候需要指定ID为 dev,这里使用 dev 开发环境
|
||||
group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP
|
||||
name: ${spring.application.name} # 使用的 Nacos 配置集的 dataId,默认为 spring.application.name
|
||||
file-extension: yaml # 使用的 Nacos 配置集的 dataId 的文件拓展名,同时也是 Nacos 配置集的配置格式,默认为 properties
|
@ -0,0 +1,23 @@
|
||||
--- #################### 注册中心相关配置 ####################
|
||||
|
||||
spring:
|
||||
cloud:
|
||||
nacos:
|
||||
server-addr: 127.0.0.1:8848
|
||||
discovery:
|
||||
namespace: prod # 命名空间。这里使用 dev 开发环境
|
||||
metadata:
|
||||
version: 1.0.0 # 服务实例的版本号,可用于灰度发布
|
||||
|
||||
--- #################### 配置中心相关配置 ####################
|
||||
|
||||
spring:
|
||||
cloud:
|
||||
nacos:
|
||||
# Nacos Config 配置项,对应 NacosConfigProperties 配置属性类
|
||||
config:
|
||||
server-addr: 127.0.0.1:8848 # Nacos 服务器地址
|
||||
namespace: prod # 命名空间 dev 的ID,不能直接使用 dev 名称。创建命名空间的时候需要指定ID为 dev,这里使用 dev 开发环境
|
||||
group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP
|
||||
name: ${spring.application.name} # 使用的 Nacos 配置集的 dataId,默认为 spring.application.name
|
||||
file-extension: yaml # 使用的 Nacos 配置集的 dataId 的文件拓展名,同时也是 Nacos 配置集的配置格式,默认为 properties
|
@ -73,10 +73,6 @@ public interface DeptApi {
|
||||
@Parameter(name = "factoryId", description = "工厂编号", example = "100001", required = true)
|
||||
CommonResult<DeptRespDTO> getDeptByFactoryId(@RequestParam("factoryId") Long factoryId);
|
||||
|
||||
@GetMapping(PREFIX + "/getListByLeader")
|
||||
@Operation(summary = "获取所有部门信息")
|
||||
@Parameter(name = "userId", description = "用户编号", example = "146", required = true)
|
||||
CommonResult<List<DeptRespDTO>> getDeptListByLeader(@RequestParam("userId") Long userId);
|
||||
|
||||
/**
|
||||
* 获得指定编号的部门 Map
|
||||
|
@ -85,7 +85,7 @@ public interface AdminUserApi {
|
||||
@Operation(summary = "修改用户外勤打卡权限")
|
||||
@Parameter(name = "userId", description = "用户id", example = "1024", required = true)
|
||||
@Parameter(name = "fieldworkFlag", description = "是否可外勤打卡 | 0否 1是", example = "1", required = true)
|
||||
void updateFieldworkType(@RequestParam("userId") Long userId,
|
||||
void updateFieldworkType(@RequestParam("userId") Collection<Long> userId,
|
||||
@RequestParam("fieldworkFlag") Integer fieldworkFlag);
|
||||
|
||||
@PostMapping(PREFIX + "/updateUserStaffing")
|
||||
|
@ -108,13 +108,6 @@ public class DeptApiImpl implements DeptApi {
|
||||
return success(BeanUtils.toBean(deptDO, DeptRespDTO.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<List<DeptRespDTO>> getDeptListByLeader(Long userId) {
|
||||
|
||||
List<DeptDO> deptDOS = deptService.getDeptByLeaderId(userId);
|
||||
return success(BeanUtils.toBean(deptDOS, DeptRespDTO.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
@DataPermission(enable = false)
|
||||
public CommonResult<List<Long>> getChildDeptList(Long deptId) {
|
||||
|
@ -100,7 +100,7 @@ public class AdminUserApiImpl implements AdminUserApi {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateFieldworkType(Long userId, Integer fieldworkFlag) {
|
||||
public void updateFieldworkType(Collection<Long> userId, Integer fieldworkFlag) {
|
||||
|
||||
userService.updateFieldworkType(userId, fieldworkFlag);
|
||||
}
|
||||
|
@ -164,6 +164,15 @@ public class DeptController {
|
||||
return success(BeanUtils.toBean(list, DeptSimpleRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping(value = { "/get-factory-dept"})
|
||||
@Operation(summary = "获取工厂部门精简信息列表", description = "只包含被开启的部门,主要用于前端的下拉选项")
|
||||
@DataPermission(enable = false)
|
||||
public CommonResult<List<DeptSimpleRespVO>> getFactoryDept() {
|
||||
List<DeptDO> list = deptService.getFactoryDept();
|
||||
|
||||
return success(BeanUtils.toBean(list, DeptSimpleRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping(value = {"/getListByType"})
|
||||
@Operation(summary = "获取指定类型的部门精简信息列表", description = "只包含被开启的部门,主要用于前端的下拉选项")
|
||||
@Parameter(name = "type", description = "类型", required = true, example = "1")
|
||||
|
@ -25,4 +25,7 @@ public class DeptSimpleRespVO {
|
||||
|
||||
@Schema(description = "是否为虚机构 | 0否 1是")
|
||||
private Integer virtuallyStatus;
|
||||
|
||||
@Schema(description = "工厂编号")
|
||||
private Long factoryId;
|
||||
}
|
||||
|
@ -117,8 +117,10 @@ public class RentalOrderController {
|
||||
if (CollectionUtil.isNotEmpty(refundMap)) {
|
||||
// 设置对应的订单号中的 申请退款和扣款金额
|
||||
pageResult.getList().forEach(item -> {
|
||||
item.setApplyRefundAmount(refundMap.get(item.getOrderNo()).getRefundAmount());
|
||||
item.setApplyChargebacksAmount(refundMap.get(item.getOrderNo()).getChargebacksAmount());
|
||||
if (refundMap.get(item.getOrderNo()) != null) {
|
||||
item.setApplyRefundAmount(refundMap.get(item.getOrderNo()).getRefundAmount());
|
||||
item.setApplyChargebacksAmount(refundMap.get(item.getOrderNo()).getChargebacksAmount());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,7 @@ import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.file.vo.FileRespVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.laborcontract.vo.LaborContractRespVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.laborcontract.LaborContractDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
@ -38,4 +39,6 @@ public interface LaborContractMapper extends BaseMapperX<LaborContractDO> {
|
||||
LaborContractDO getTheEarliestContract(@Param("userId") Long userId);
|
||||
|
||||
List<LaborContractDO> selectListByRemindDate(@Param("remindDate")LocalDate remindDate);
|
||||
|
||||
List<LaborContractRespVO> selectContractCount(@Param("userIds") List<Long> userIds);
|
||||
}
|
||||
|
@ -120,8 +120,7 @@ public interface AdminUserMapper extends BaseMapperX<AdminUserDO> {
|
||||
.selectAs("a.contractDuration", LaborContractRespVO::getContractDuration)
|
||||
.selectAs("a.probationPeriodTime", LaborContractRespVO::getProbationPeriodTime)
|
||||
.selectAs("a.status", LaborContractRespVO::getStatus)
|
||||
.selectAs("a.createTime", LaborContractRespVO::getCreateTime)
|
||||
.selectCount("a.id", LaborContractRespVO::getSigningCount);
|
||||
.selectAs("a.createTime", LaborContractRespVO::getCreateTime);
|
||||
queryWrapper.innerJoin(DeptDO.class, DeptDO::getId, AdminUserDO::getDeptId)
|
||||
.leftJoin("(SELECT\n" +
|
||||
" id,\n" +
|
||||
@ -156,7 +155,6 @@ public interface AdminUserMapper extends BaseMapperX<AdminUserDO> {
|
||||
queryWrapper.between("a.expiration_date", pageReqVO.getExpirationDate()[0], pageReqVO.getExpirationDate()[1]);
|
||||
}
|
||||
queryWrapper.eq(Objects.nonNull(pageReqVO.getStatus()), "a.status", pageReqVO.getStatus());
|
||||
queryWrapper.groupBy(AdminUserDO::getId);
|
||||
queryWrapper.orderByAsc("a.status");
|
||||
queryWrapper.orderByAsc(AdminUserDO::getId);
|
||||
|
||||
|
@ -191,4 +191,10 @@ public interface DeptService {
|
||||
* @return 部门列表
|
||||
*/
|
||||
List<DeptDO> getDeptListByType(String type);
|
||||
|
||||
/**
|
||||
* 获取工厂部门
|
||||
* @return 部门列表
|
||||
*/
|
||||
List<DeptDO> getFactoryDept();
|
||||
}
|
||||
|
@ -392,6 +392,14 @@ public class DeptServiceImpl implements DeptService {
|
||||
.eq(DeptDO::getStatus, CommonStatusEnum.ENABLE.getStatus()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeptDO> getFactoryDept() {
|
||||
|
||||
return deptMapper.selectList(new LambdaQueryWrapperX<DeptDO>()
|
||||
.eq(DeptDO::getStatus, CommonStatusEnum.ENABLE.getStatus())
|
||||
.isNotNull(DeptDO::getFactoryId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeptDO> getDeptList(DeptApiDTO dto) {
|
||||
List<DeptDO> list = deptMapper.selectList(new LambdaQueryWrapperX<DeptDO>()
|
||||
|
@ -22,10 +22,12 @@ import org.springframework.validation.annotation.Validated;
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
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.module.system.enums.ErrorCodeConstants.LABOR_CONTRACT_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
@ -126,6 +128,21 @@ public class LaborContractServiceImpl implements LaborContractService {
|
||||
|
||||
Page<LaborContractRespVO> page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize());
|
||||
IPage<LaborContractRespVO> pageList = userMapper.selectContractPage(page, pageReqVO);
|
||||
if (CollectionUtil.isNotEmpty(pageList.getRecords())) {
|
||||
|
||||
List<Long> userIds = convertList(pageList.getRecords(), LaborContractRespVO::getUserId);
|
||||
List<LaborContractRespVO> countRespVOs = laborContractMapper.selectContractCount(userIds);
|
||||
Map<Long, LaborContractRespVO> countMap = convertMap(countRespVOs, LaborContractRespVO::getUserId);
|
||||
|
||||
pageList.getRecords().forEach(item -> {
|
||||
LaborContractRespVO respVO = countMap.get(item.getUserId());
|
||||
if (respVO != null) {
|
||||
item.setSigningCount(respVO.getSigningCount());
|
||||
}else {
|
||||
item.setSigningCount(0);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return new PageResult<>(pageList.getRecords(), pageList.getTotal());
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ public interface AdminUserService {
|
||||
* @param id 用户编号
|
||||
* @param fieldworkFlag 状态
|
||||
*/
|
||||
void updateFieldworkType(Long id, Integer fieldworkFlag);
|
||||
void updateFieldworkType(Collection<Long> id, Integer fieldworkFlag);
|
||||
|
||||
/**
|
||||
* 删除用户
|
||||
|
@ -289,14 +289,13 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateFieldworkType(Long id, Integer fieldworkFlag) {
|
||||
public void updateFieldworkType(Collection<Long> id, Integer fieldworkFlag) {
|
||||
// 更新状态
|
||||
AdminUserDO updateObj = new AdminUserDO();
|
||||
updateObj.setId(id);
|
||||
updateObj.setFieldworkFlag(fieldworkFlag);
|
||||
updateObj.setFieldworkType(fieldworkFlag == 1 ? 2 : 0); //设置为 临时外勤类型
|
||||
userMapper.update(updateObj, new LambdaQueryWrapper<AdminUserDO>()
|
||||
.eq(AdminUserDO::getId, id)
|
||||
userMapper.update(updateObj, new LambdaQueryWrapperX<AdminUserDO>()
|
||||
.in(AdminUserDO::getId, id)
|
||||
.ne(AdminUserDO::getFieldworkType, 1));
|
||||
}
|
||||
|
||||
|
@ -39,4 +39,20 @@
|
||||
AND status = 1
|
||||
AND deleted = 0
|
||||
</select>
|
||||
|
||||
<select id="selectContractCount" resultType="cn.iocoder.yudao.module.system.controller.admin.laborcontract.vo.LaborContractRespVO">
|
||||
SELECT
|
||||
user_id AS userId,
|
||||
COUNT(1) AS signingCount
|
||||
FROM
|
||||
system_labor_contract
|
||||
WHERE
|
||||
deleted = 0
|
||||
AND user_id in
|
||||
<foreach collection="userIds" item="userId" separator="," open="(" close=")">
|
||||
#{userId}
|
||||
</foreach>
|
||||
GROUP BY
|
||||
user_id
|
||||
</select>
|
||||
</mapper>
|
||||
|
@ -238,7 +238,7 @@ public class FactoryInfoServiceImpl implements FactoryInfoService {
|
||||
// 如果当前登录用户数据权限 不是查看全部数据
|
||||
if (!deptDataPermission.getAll()) {
|
||||
|
||||
List<DeptRespDTO> deptRespDTO = deptApi.getDeptListByLeader(getLoginUserId()).getCheckedData();
|
||||
List<DeptRespDTO> deptRespDTO = deptApi.getDeptByLeaderId(getLoginUserId()).getCheckedData();
|
||||
|
||||
if (deptRespDTO != null) {
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user