Compare commits
2 Commits
521a162233
...
d6af73ec88
Author | SHA1 | Date | |
---|---|---|---|
![]() |
d6af73ec88 | ||
![]() |
f7e3d0f3d7 |
@ -0,0 +1,28 @@
|
||||
package cn.iocoder.yudao.module.bpm.api.oa;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.bpm.api.oa.vo.loan.BpmOALoanSumDTO;
|
||||
import cn.iocoder.yudao.module.bpm.enums.ApiConstants;
|
||||
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.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿:fallbackFactory =
|
||||
@Tag(name = "RPC 服务 - 流程实例")
|
||||
public interface BpmOALoanApi {
|
||||
|
||||
String PREFIX = ApiConstants.PREFIX + "/oa/loan";
|
||||
|
||||
@GetMapping(PREFIX + "/getListByStaffId")
|
||||
@Operation(summary = "获取员工当月需抵扣的借支金额")
|
||||
@Parameter(name = "staffId", description = "用户编号", required = true)
|
||||
@Parameter(name = "month", description = "月份", required = true)
|
||||
CommonResult<List<BpmOALoanSumDTO>> getListByStaffId(@RequestParam("staffId") Collection<Long> staffId,
|
||||
@RequestParam("month") String month);
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package cn.iocoder.yudao.module.bpm.api.oa.vo.loan;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.UploadUserFile;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 生产借支 创建 Request VO
|
||||
*
|
||||
* @author 符溶馨
|
||||
*/
|
||||
@Schema(description = "管理后台 - 借支 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode()
|
||||
@ToString(callSuper = true)
|
||||
public class BpmOALoanDTO {
|
||||
|
||||
@Schema(description = "收款人信息")
|
||||
private Long bankId;
|
||||
|
||||
@Schema(description = "借支工厂")
|
||||
private Long factoryId;
|
||||
|
||||
@Schema(description = "借支厂区用户")
|
||||
private Long sfUserId;
|
||||
|
||||
@Schema(description = "借支类型 | 1工资 2费用", example = "1")
|
||||
private Integer loanType;
|
||||
|
||||
@Schema(description = "抵扣工资月份 | yyyy-MM")
|
||||
private String returnDate;
|
||||
|
||||
@Schema(description = "借支金额")
|
||||
private BigDecimal totalMoney;
|
||||
|
||||
@Schema(description = "流程实例编号")
|
||||
private String processInstanceId;
|
||||
|
||||
@Schema(description = "状态-参见 bpm_process_instance_result 枚举")
|
||||
private Integer result;
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package cn.iocoder.yudao.module.bpm.api.oa.vo.loan;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Schema(description = "RPC 服务 - OA 借支 Response VO")
|
||||
@Data
|
||||
public class BpmOALoanSumDTO {
|
||||
|
||||
@Schema(description = "借支员工编号")
|
||||
private Long sfUserId;
|
||||
|
||||
@Schema(description = "借支总金额")
|
||||
private BigDecimal totalAmount;
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package cn.iocoder.yudao.module.bpm.api.oa;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.bpm.api.oa.vo.loan.BpmOALoanSumDTO;
|
||||
import cn.iocoder.yudao.module.bpm.service.oa.BpmOALoanService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
/**
|
||||
* Flowable 流程实例 Api 实现类
|
||||
*/
|
||||
@RestController
|
||||
@Validated
|
||||
public class BpmOALoanApiImpl implements BpmOALoanApi{
|
||||
|
||||
@Resource
|
||||
private BpmOALoanService loanService;
|
||||
|
||||
@Override
|
||||
public CommonResult<List<BpmOALoanSumDTO>> getListByStaffId(Collection<Long> staffId, String month) {
|
||||
|
||||
return success(loanService.getListByStaffId(staffId, month));
|
||||
}
|
||||
}
|
@ -163,5 +163,4 @@ public class BpmOAContractController {
|
||||
|
||||
return success(BeanUtils.toBean(respVOs, BpmOAContractRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,10 +2,7 @@ package cn.iocoder.yudao.module.bpm.controller.admin.oa;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.expenses.BpmOAExpensesCreateReqVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.expenses.BpmOAExpensesPageReqVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.expenses.BpmOAExpensesPageRespVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.expenses.BpmOAExpensesRespVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.expenses.*;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAExpensesDO;
|
||||
import cn.iocoder.yudao.module.bpm.service.oa.BpmOAExpensesService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
@ -70,4 +67,11 @@ public class BpmOAExpensesController {
|
||||
PageResult<BpmOAExpensesPageRespVO> respVO = expensesService.getExpensesPage(pageReqVO);
|
||||
return success(respVO);
|
||||
}
|
||||
|
||||
@GetMapping("/total")
|
||||
@Operation(summary = "获得开支金额统计")
|
||||
public CommonResult<BpmOAExpensesTotal> getExpensesTotal(BpmOAExpensesPageReqVO pageReqVO) {
|
||||
|
||||
return success(expensesService.getExpensesTotal(pageReqVO));
|
||||
}
|
||||
}
|
@ -109,7 +109,7 @@ public class BpmOALoanController {
|
||||
}
|
||||
|
||||
@GetMapping("/getByProcessInstanceId")
|
||||
@Operation(summary = "获得加班申请")
|
||||
@Operation(summary = "获得借支申请")
|
||||
@Parameter(name = "processInstanceId", description = "流程实例编号", required = true, example = "1024")
|
||||
public CommonResult<BpmOALoanRespVO> getByProcessInstanceId(@RequestParam("processInstanceId") String processInstanceId) {
|
||||
BpmOALoanDO loan = loanService.getByProcessInstanceId(processInstanceId);
|
||||
|
@ -27,6 +27,9 @@ public class BpmOAExpensesCreateReqVO {
|
||||
@Schema(description = "开支明细")
|
||||
private List<Expenses> expensesItem;
|
||||
|
||||
@Schema(description = "工厂类型 | 1公司 工厂")
|
||||
private Integer factoryType;
|
||||
|
||||
@Schema(description = "报销总金额", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "报销总金额不能为空")
|
||||
private BigDecimal totalMoney;
|
||||
|
@ -29,5 +29,5 @@ public class BpmOAExpensesPageReqVO extends PageParam {
|
||||
private Integer costSection;
|
||||
|
||||
@Schema(description = "审批通过时间")
|
||||
private LocalDateTime[] endTime;
|
||||
private String[] endTime;
|
||||
}
|
||||
|
@ -58,4 +58,10 @@ public class BpmOAExpensesPageRespVO extends BpmOABaseRespVO {
|
||||
|
||||
@Schema(description = "费用明细")
|
||||
private String detail;
|
||||
|
||||
@Schema(description = "审批时间")
|
||||
private String endTime;
|
||||
|
||||
@Schema(description = "支付状态 | 0未支付 1已支付")
|
||||
private Integer status;
|
||||
}
|
||||
|
@ -34,6 +34,9 @@ public class BpmOAExpensesRespVO extends BpmOABaseRespVO {
|
||||
@Schema(description = "开支明细")
|
||||
private List<Expenses> expensesItem;
|
||||
|
||||
@Schema(description = "工厂类型 | 1公司 工厂")
|
||||
private Integer factoryType;
|
||||
|
||||
@Schema(description = "报销总金额")
|
||||
private BigDecimal totalMoney;
|
||||
|
||||
|
@ -0,0 +1,17 @@
|
||||
package cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.expenses;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Schema(description = "管理后台 - 生产开支金额统计 Response VO")
|
||||
@Data
|
||||
public class BpmOAExpensesTotal {
|
||||
|
||||
@Schema(description = "已付款金额")
|
||||
private BigDecimal amountPaid;
|
||||
|
||||
@Schema(description = "应付款金额")
|
||||
private BigDecimal payableAmount;
|
||||
}
|
@ -32,10 +32,21 @@ public class BpmOALoanCreateReqVO {
|
||||
@NotNull(message = "借支用户不能为空")
|
||||
private Long sfUserId;
|
||||
|
||||
@Schema(description = "借支类型 | 1工资 2费用", example = "1")
|
||||
@NotNull(message = "借支类型不能为空")
|
||||
private Integer loanType;
|
||||
|
||||
@Schema(description = "抵扣工资月份 | yyyy-MM")
|
||||
private String returnDate;
|
||||
|
||||
@Schema(description = "借支金额", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "借支金额不能为空")
|
||||
private BigDecimal totalMoney;
|
||||
|
||||
@Schema(description = "借支事由", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "借支事由不能为空")
|
||||
private String reason;
|
||||
|
||||
@Schema(description = "流程实例编号")
|
||||
private String processInstanceId;
|
||||
|
||||
|
@ -7,6 +7,7 @@ import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
@ -49,9 +50,18 @@ public class BpmOALoanRespVO extends BpmOABaseRespVO {
|
||||
@Schema(description = "借支用户名称")
|
||||
private String sfUserName;
|
||||
|
||||
@Schema(description = "借支类型 | 1工资 2费用", example = "1")
|
||||
private Integer loanType;
|
||||
|
||||
@Schema(description = "抵扣工资月份 | yyyy-MM")
|
||||
private String returnDate;
|
||||
|
||||
@Schema(description = "借支金额")
|
||||
private BigDecimal totalMoney;
|
||||
|
||||
@Schema(description = "借支事由")
|
||||
private String reason;
|
||||
|
||||
@Schema(description = "上传文件", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private List<UploadUserFile> fileItems;
|
||||
|
||||
|
@ -7,6 +7,7 @@ import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.expenses.BpmOAExpenses
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.expenses.Expenses;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAExpensesDO;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAExpensesItemDO;
|
||||
import cn.iocoder.yudao.module.smartfactory.api.factoryInfo.dto.FactoryInfoDTO;
|
||||
import cn.iocoder.yudao.module.system.api.bank.dto.BankRespDTO;
|
||||
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
|
||||
import org.mapstruct.Mapper;
|
||||
@ -30,7 +31,7 @@ public interface BpmOAExpensesConvert {
|
||||
BpmOAExpensesRespVO convert(BpmOAExpensesDO bean);
|
||||
|
||||
default BpmOAExpensesRespVO convert1(BpmOAExpensesDO expensesDO, List<BpmOAExpensesItemDO> expensesItemDOs,
|
||||
Map<Long, DeptRespDTO> deptMap, BankRespDTO bankRespDTO) {
|
||||
Map<Long, FactoryInfoDTO> deptMap, BankRespDTO bankRespDTO) {
|
||||
|
||||
BpmOAExpensesRespVO respVO = BeanUtils.toBean(expensesDO, BpmOAExpensesRespVO.class);
|
||||
|
||||
@ -50,15 +51,15 @@ public interface BpmOAExpensesConvert {
|
||||
return respVO;
|
||||
}
|
||||
|
||||
default List<Expenses> convertList(List<Expenses> list, Map<Long, DeptRespDTO> deptMap) {
|
||||
default List<Expenses> convertList(List<Expenses> list, Map<Long, FactoryInfoDTO> deptMap) {
|
||||
|
||||
return CollectionUtils.convertList(list, expenses -> convert(expenses, deptMap.get(expenses.getDeptId())));
|
||||
}
|
||||
|
||||
default Expenses convert(Expenses expensesItem, DeptRespDTO dept) {
|
||||
default Expenses convert(Expenses expensesItem, FactoryInfoDTO dept) {
|
||||
|
||||
if (dept != null) {
|
||||
expensesItem.setDeptName(dept.getName());
|
||||
expensesItem.setDeptName(dept.getShortName());
|
||||
}
|
||||
|
||||
return expensesItem;
|
||||
|
@ -44,6 +44,11 @@ public class BpmOAExpensesDO extends BaseDO {
|
||||
*/
|
||||
private Long bankId;
|
||||
|
||||
/**
|
||||
* 工厂类型 | 1公司 2工厂
|
||||
*/
|
||||
private Integer factoryType;
|
||||
|
||||
/**
|
||||
* 支出总金额
|
||||
*/
|
||||
|
@ -54,11 +54,26 @@ public class BpmOALoanDO extends BaseDO {
|
||||
*/
|
||||
private Long sfUserId;
|
||||
|
||||
/**
|
||||
* 借支类型 | 1工资 2费用
|
||||
*/
|
||||
private Integer loanType;
|
||||
|
||||
/**
|
||||
* 抵扣工资月份 | yyyy-MM
|
||||
*/
|
||||
private String returnDate;
|
||||
|
||||
/**
|
||||
* 借出金额
|
||||
*/
|
||||
private BigDecimal totalMoney;
|
||||
|
||||
/**
|
||||
* 借支原因
|
||||
*/
|
||||
private String reason;
|
||||
|
||||
/**
|
||||
* 申请结果
|
||||
* 枚举 {@link BpmProcessInstanceResultEnum}
|
||||
|
@ -3,6 +3,7 @@ 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.expenses.BpmOAExpensesPageReqVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.expenses.BpmOAExpensesPageRespVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.expenses.BpmOAExpensesTotal;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAExpensesDO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
@ -13,4 +14,6 @@ public interface BpmOAExpensesMapper extends BaseMapperX<BpmOAExpensesDO> {
|
||||
|
||||
IPage<BpmOAExpensesPageRespVO> selectExpensesPage(@Param("page") IPage<BpmOAExpensesPageReqVO> page,
|
||||
@Param("pageReqVO") BpmOAExpensesPageReqVO pageReqVO);
|
||||
|
||||
BpmOAExpensesTotal selectTotal(@Param("pageReqVO") BpmOAExpensesPageReqVO pageReqVO);
|
||||
}
|
||||
|
@ -1,9 +1,17 @@
|
||||
package cn.iocoder.yudao.module.bpm.dal.mysql.oa;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.bpm.api.oa.vo.loan.BpmOALoanSumDTO;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOALoanDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface BpmOALoanMapper extends BaseMapperX<BpmOALoanDO> {
|
||||
|
||||
List<BpmOALoanSumDTO> selectSumByStaffId(@Param("staffId") Collection<Long> staffId,
|
||||
@Param("month") String month);
|
||||
}
|
||||
|
@ -1,10 +1,7 @@
|
||||
package cn.iocoder.yudao.module.bpm.service.oa;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.expenses.BpmOAExpensesCreateReqVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.expenses.BpmOAExpensesPageReqVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.expenses.BpmOAExpensesPageRespVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.expenses.BpmOAExpensesRespVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.expenses.*;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAExpensesDO;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAExpensesItemDO;
|
||||
|
||||
@ -67,4 +64,10 @@ public interface BpmOAExpensesService {
|
||||
* @return 分页结果
|
||||
*/
|
||||
PageResult<BpmOAExpensesPageRespVO> getExpensesPage(BpmOAExpensesPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 获得开支金额统计
|
||||
* @return 统计信息
|
||||
*/
|
||||
BpmOAExpensesTotal getExpensesTotal(BpmOAExpensesPageReqVO pageReqVO);
|
||||
}
|
||||
|
@ -6,10 +6,7 @@ import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils;
|
||||
import cn.iocoder.yudao.module.bpm.api.task.BpmProcessInstanceApi;
|
||||
import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.expenses.BpmOAExpensesCreateReqVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.expenses.BpmOAExpensesPageReqVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.expenses.BpmOAExpensesPageRespVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.expenses.BpmOAExpensesRespVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.expenses.*;
|
||||
import cn.iocoder.yudao.module.bpm.convert.oa.BpmOAExpensesConvert;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAExpensesDO;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAExpensesItemDO;
|
||||
@ -17,6 +14,8 @@ import cn.iocoder.yudao.module.bpm.dal.mysql.oa.BpmOAExpensesItemMapper;
|
||||
import cn.iocoder.yudao.module.bpm.dal.mysql.oa.BpmOAExpensesMapper;
|
||||
import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceResultEnum;
|
||||
import cn.iocoder.yudao.module.bpm.service.task.BpmHistoryProcessInstanceService;
|
||||
import cn.iocoder.yudao.module.smartfactory.api.factoryInfo.FactoryInfoApi;
|
||||
import cn.iocoder.yudao.module.smartfactory.api.factoryInfo.dto.FactoryInfoDTO;
|
||||
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;
|
||||
@ -63,7 +62,7 @@ public class BpmOAExpensesServiceImpl extends BpmOABaseService implements BpmOAE
|
||||
private BpmProcessInstanceApi processInstanceApi;
|
||||
|
||||
@Resource
|
||||
private DeptApi deptApi;
|
||||
private FactoryInfoApi factoryInfoApi;
|
||||
|
||||
@Resource
|
||||
private BankApi bankApi;
|
||||
@ -90,6 +89,7 @@ public class BpmOAExpensesServiceImpl extends BpmOABaseService implements BpmOAE
|
||||
Map<String, Object> processInstanceVariables = new HashMap<>();
|
||||
String type = bpmOAExpensesItemDOS.stream().map(item -> item.getType().toString()).collect(Collectors.joining(","));
|
||||
processInstanceVariables.put("type", type);
|
||||
processInstanceVariables.put("factoryType", expenses.getFactoryType());
|
||||
String processInstanceId = processInstanceApi.createProcessInstance(userId,
|
||||
new BpmProcessInstanceCreateReqDTO().setProcessDefinitionKey(PROCESS_KEY)
|
||||
.setVariables(processInstanceVariables).setBusinessKey(String.valueOf(expenses.getId()))).getCheckedData();
|
||||
@ -160,8 +160,7 @@ public class BpmOAExpensesServiceImpl extends BpmOABaseService implements BpmOAE
|
||||
List<BpmOAExpensesItemDO> expensesItemDOs = getExpensesItem(expenses.getId());
|
||||
|
||||
//获取部门信息map
|
||||
List<DeptRespDTO> deptList = deptApi.getDeptByFactoryIds(convertSet(expensesItemDOs, BpmOAExpensesItemDO::getDeptId)).getCheckedData();
|
||||
Map<Long, DeptRespDTO> deptMap = convertMap(deptList, DeptRespDTO::getFactoryId);
|
||||
Map<Long, FactoryInfoDTO> factoryInfoDTOS = factoryInfoApi.getFactoryMap(convertSet(expensesItemDOs, BpmOAExpensesItemDO::getDeptId));
|
||||
|
||||
// 获取银行卡信息
|
||||
BankRespDTO bankRespDTO = null;
|
||||
@ -169,7 +168,7 @@ public class BpmOAExpensesServiceImpl extends BpmOABaseService implements BpmOAE
|
||||
bankRespDTO = bankApi.getBank(expenses.getBankId()).getCheckedData();
|
||||
}
|
||||
|
||||
return BpmOAExpensesConvert.INSTANCE.convert1(expenses, expensesItemDOs, deptMap, bankRespDTO);
|
||||
return BpmOAExpensesConvert.INSTANCE.convert1(expenses, expensesItemDOs, factoryInfoDTOS, bankRespDTO);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -177,4 +176,9 @@ public class BpmOAExpensesServiceImpl extends BpmOABaseService implements BpmOAE
|
||||
IPage<BpmOAExpensesPageRespVO> page = expensesMapper.selectExpensesPage(MyBatisUtils.buildPage(pageReqVO) ,pageReqVO);
|
||||
return new PageResult<>(page.getRecords(), page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public BpmOAExpensesTotal getExpensesTotal(BpmOAExpensesPageReqVO pageReqVO) {
|
||||
return expensesMapper.selectTotal(pageReqVO);
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,11 @@
|
||||
package cn.iocoder.yudao.module.bpm.service.oa;
|
||||
|
||||
import cn.iocoder.yudao.module.bpm.api.oa.vo.loan.BpmOALoanSumDTO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.loan.BpmOALoanCreateReqVO;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOALoanDO;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -53,4 +55,11 @@ public interface BpmOALoanService {
|
||||
* @return 借支列表
|
||||
*/
|
||||
List<BpmOALoanDO> getListByStaffId(Long staffId);
|
||||
|
||||
/**
|
||||
* 获取员工当月需抵扣的借支金额
|
||||
* @param staffId 员工编号集合
|
||||
* @return 借支金额统计
|
||||
*/
|
||||
List<BpmOALoanSumDTO> getListByStaffId(Collection<Long> staffId, String month);
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.UploadUserFile;
|
||||
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.oa.vo.loan.BpmOALoanSumDTO;
|
||||
import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.loan.BpmOALoanCreateReqVO;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.financialpayment.FinancialPaymentDO;
|
||||
@ -23,6 +24,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -108,7 +110,7 @@ public class BpmOALoanServiceImpl extends BpmOABaseService implements BpmOALoanS
|
||||
.setUserId(loanDO.getUserId())
|
||||
.setDeptId(user.getData() == null ? null : user.getData().getDeptId())
|
||||
.setProcessInstanceId(loanDO.getProcessInstanceId())
|
||||
.setReason("")
|
||||
.setReason(loanDO.getReason())
|
||||
.setObjectId(id)
|
||||
.setType(7)
|
||||
.setStatus(0)
|
||||
@ -151,4 +153,9 @@ public class BpmOALoanServiceImpl extends BpmOABaseService implements BpmOALoanS
|
||||
.eq(BpmOALoanDO::getSfUserId, staffId)
|
||||
.eq(BpmOALoanDO::getResult, BpmProcessInstanceResultEnum.APPROVE.getResult()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BpmOALoanSumDTO> getListByStaffId(Collection<Long> staffId, String month) {
|
||||
return loanMapper.selectSumByStaffId(staffId, month);
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,8 @@
|
||||
ub.bank_no AS bankNo,
|
||||
ub.bank_name AS bankName,
|
||||
b.total_money AS totalMoney,
|
||||
b.process_instance_id AS processInstanceId
|
||||
b.process_instance_id AS processInstanceId,
|
||||
c.end_time AS endTime
|
||||
FROM bpm_oa_expenses b
|
||||
JOIN bpm_oa_expenses_item a ON a.expenses_id = b.id
|
||||
JOIN bpm_process_instance_ext c ON c.process_instance_id = b.process_instance_id
|
||||
@ -58,4 +59,38 @@
|
||||
</if>
|
||||
ORDER BY c.end_time DESC, a.expenses_id
|
||||
</select>
|
||||
|
||||
<select id="selectTotal" resultType="cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.expenses.BpmOAExpensesTotal">
|
||||
SELECT
|
||||
SUM(a.amount_paid) AS amountPaid,
|
||||
SUM(a.total_money) - SUM(a.amount_paid) AS payableAmount
|
||||
FROM
|
||||
bpm_oa_expenses a
|
||||
JOIN bpm_oa_expenses_item b ON b.expenses_id = b.id
|
||||
JOIN bpm_process_instance_ext c ON c.process_instance_id = a.process_instance_id
|
||||
WHERE
|
||||
a.deleted = 0
|
||||
AND b.deleted = 0
|
||||
AND a.result = 2
|
||||
<if test="pageReqVO.userId != null">
|
||||
AND a.user_id = #{pageReqVO.userId}
|
||||
</if>
|
||||
<if test="pageReqVO.factoryId != null">
|
||||
AND b.dept_id = #{pageReqVO.factoryId}
|
||||
</if>
|
||||
<if test="pageReqVO.type != null">
|
||||
AND b.type = #{pageReqVO.type}
|
||||
</if>
|
||||
<if test="pageReqVO.costSection != null">
|
||||
AND b.cost_section = #{pageReqVO.costSection}
|
||||
</if>
|
||||
<if test="pageReqVO.endTime != null and pageReqVO.endTime.length > 0">
|
||||
<if test="pageReqVO.endTime[0] != null">
|
||||
and c.end_time >= #{pageReqVO.endTime[0]}
|
||||
</if>
|
||||
<if test="pageReqVO.endTime[1] != null">
|
||||
and c.end_time <= #{pageReqVO.endTime[1]}
|
||||
</if>
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
|
@ -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.BpmOALoanMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
<select id="selectSumByStaffId" resultType="cn.iocoder.yudao.module.bpm.api.oa.vo.loan.BpmOALoanSumDTO">
|
||||
SELECT
|
||||
sf_user_id AS sfUserId,
|
||||
SUM(total_money) AS totalAmount
|
||||
FROM
|
||||
bpm_oa_loan
|
||||
WHERE
|
||||
deleted = 0
|
||||
AND result = 2
|
||||
AND return_date = #{month}
|
||||
sf_user_id IN
|
||||
<foreach item="item" index="index" collection="staffId" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
GROUP BY
|
||||
sf_user_id
|
||||
</select>
|
||||
</mapper>
|
@ -10,6 +10,7 @@ import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.datapermission.core.annotation.DataPermission;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||
import cn.iocoder.yudao.module.infra.api.config.ConfigApi;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.user.dto.UserPageDTO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.*;
|
||||
import cn.iocoder.yudao.module.system.convert.user.UserConvert;
|
||||
@ -64,6 +65,9 @@ public class UserController {
|
||||
@Resource
|
||||
private PositionService positionService;
|
||||
|
||||
@Resource
|
||||
private ConfigApi configApi;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "新增用户")
|
||||
@PreAuthorize("@ss.hasPermission('system:user:create')")
|
||||
@ -207,6 +211,25 @@ public class UserController {
|
||||
return success(pageResult);
|
||||
}
|
||||
|
||||
@GetMapping("/getContractSignatory")
|
||||
@Operation(summary = "获得采购合同签约人列表")
|
||||
@DataPermission(enable = false)
|
||||
public CommonResult<List<UserSimpleRespVO>> getContractSignatory() {
|
||||
|
||||
List<UserSimpleRespVO> respVO = new ArrayList<>();
|
||||
|
||||
String userIds = configApi.getConfigKey("system_purchase_contract_user").getCheckedData();
|
||||
if (StrUtil.isNotEmpty(userIds)) {
|
||||
|
||||
Set<Long> userIdsSet = Arrays.stream(userIds.split(","))
|
||||
.map(Long::valueOf)
|
||||
.collect(Collectors.toSet());
|
||||
respVO = BeanUtils.toBean(userService.getUserList(userIdsSet), UserSimpleRespVO.class);
|
||||
}
|
||||
|
||||
return success(respVO);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得用户详情")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
|
@ -149,6 +149,12 @@
|
||||
<artifactId>artemis-http-client</artifactId>
|
||||
<version>1.1.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-module-bpm-api</artifactId>
|
||||
<version>2.0.0-jdk8-snapshot</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
@ -127,10 +127,10 @@ public class CameraDeviceController {
|
||||
for (String key : infoDOMap.keySet()) {
|
||||
|
||||
switch (key) {
|
||||
case "1":
|
||||
case "0":
|
||||
data = BeanUtils.toBean(infoDOMap.get(key).get(0), FactoryTreeRespVO.class);
|
||||
break;
|
||||
case "2":
|
||||
case "1":
|
||||
info.addAll(0, CameraDeviceConvert.INSTANCE.convertList(infoDOMap.get(key), cameraMap));
|
||||
break;
|
||||
case "3":
|
||||
|
@ -5,6 +5,7 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.datapermission.core.annotation.DataPermission;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.factoryinfo.vo.*;
|
||||
@ -104,6 +105,16 @@ public class FactoryInfoController {
|
||||
return success(BeanUtils.toBean(factoryInfo, FactorySimpleRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/simple-list-company")
|
||||
@Operation(summary = "获得公司类型工厂列表 | 用于前端下拉框")
|
||||
@PreAuthorize("@ss.hasPermission('smartfactory:factory-info:query')")
|
||||
@DataPermission()
|
||||
public CommonResult<List<FactorySimpleRespVO>> getCompanyFactoryList() {
|
||||
|
||||
List<FactoryInfoDO> factoryInfo = factoryInfoService.getCompanyFactoryList();
|
||||
return success(BeanUtils.toBean(factoryInfo, FactorySimpleRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/simple-list-authority")
|
||||
@Operation(summary = "获得工厂列表(权限检验) | 用于前端下拉框")
|
||||
@PreAuthorize("@ss.hasPermission('smartfactory:factory-info:query')")
|
||||
|
@ -11,6 +11,7 @@ import cn.iocoder.yudao.module.smartfactory.dal.dataobject.factoryinfo.FactoryIn
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -35,9 +36,9 @@ public interface FactoryInfoMapper extends BaseMapperX<FactoryInfoDO> {
|
||||
default List<FactoryInfoDO> selectListByType(List<Long> factoryId) {
|
||||
|
||||
return selectList(new LambdaQueryWrapperX<FactoryInfoDO>()
|
||||
.eq(FactoryInfoDO::getType, 3)
|
||||
.eq(FactoryInfoDO::getStatus, CommonStatusEnum.ENABLE.getStatus())
|
||||
.inIfPresent(FactoryInfoDO::getId, factoryId));
|
||||
.inIfPresent(FactoryInfoDO::getId, factoryId)
|
||||
.inIfPresent(FactoryInfoDO::getType, Arrays.asList(2,3)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,6 +1,8 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.framework.job.staffSalary;
|
||||
|
||||
import cn.iocoder.yudao.framework.tenant.core.job.TenantJob;
|
||||
import cn.iocoder.yudao.module.bpm.api.oa.BpmOALoanApi;
|
||||
import cn.iocoder.yudao.module.bpm.api.oa.vo.loan.BpmOALoanSumDTO;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.attendance.StaffAttendanceRecordDO;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.staff.StaffDO;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.staffsalary.StaffSalaryDO;
|
||||
@ -43,6 +45,9 @@ public class StaffSalaryJob {
|
||||
@Resource
|
||||
private StaffSalaryMapper staffSalaryMapper;
|
||||
|
||||
@Resource
|
||||
private BpmOALoanApi loanApi;
|
||||
|
||||
@XxlJob("staffSalaryJob")
|
||||
@TenantJob // --- ⚠️ 这个注解 会将租户列表拉出来 完了后逐个租户执行 定时任务需要注意
|
||||
public ReturnT<String> execute() throws Exception {
|
||||
@ -104,7 +109,7 @@ public class StaffSalaryJob {
|
||||
LocalDate[] date;
|
||||
if (type == 1) {
|
||||
date = firstType;
|
||||
}else if (type == 2) {
|
||||
} else if (type == 2) {
|
||||
date = secondType;
|
||||
} else {
|
||||
date = new LocalDate[2];
|
||||
@ -123,6 +128,10 @@ public class StaffSalaryJob {
|
||||
recordMap.putAll(typeOne);
|
||||
}
|
||||
|
||||
// 获取员工借支记录
|
||||
List<BpmOALoanSumDTO> loanDOS = loanApi.getListByStaffId(recordMap.keySet(), month).getCheckedData();
|
||||
Map<Long, BigDecimal> loanMap = loanDOS.stream().collect(Collectors.toMap(BpmOALoanSumDTO::getSfUserId, BpmOALoanSumDTO::getTotalAmount));
|
||||
|
||||
// 计算工资
|
||||
List<StaffSalaryDO> salaryDOS = new ArrayList<>();
|
||||
for (Map.Entry<Long, List<StaffAttendanceRecordDO>> entry : recordMap.entrySet()) {
|
||||
@ -134,7 +143,8 @@ public class StaffSalaryJob {
|
||||
.setStaffId(staffId)
|
||||
.setMonth(month)
|
||||
.setAttendanceDays(items.size())
|
||||
.setFactoryId(staffMap.get(staffId).getFactoryId());
|
||||
.setFactoryId(staffMap.get(staffId).getFactoryId())
|
||||
.setReturnAmount(loanMap.getOrDefault(staffId, BigDecimal.ZERO));
|
||||
|
||||
// 计算当月的工作天数
|
||||
int type = typeMap.get(staffMap.get(staffId).getFactoryId());
|
||||
|
@ -1,5 +1,7 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.framework.rpc.config;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.BpmOALeaveDTO;
|
||||
import cn.iocoder.yudao.module.bpm.api.oa.BpmOALoanApi;
|
||||
import cn.iocoder.yudao.module.infra.api.config.ConfigApi;
|
||||
import cn.iocoder.yudao.module.infra.api.file.FileApi;
|
||||
import cn.iocoder.yudao.module.system.api.assets.AssetsTypeApi;
|
||||
@ -18,7 +20,7 @@ import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@EnableFeignClients(clients = {FileApi.class, RoleApi.class, DeptApi.class, PostApi.class, AdminUserApi.class, SmsSendApi.class, DictDataApi.class, NotifyMessageSendApi.class,
|
||||
SubscribeMessageSendApi.class, ConfigApi.class, PermissionApi.class, AssetsTypeApi.class, LoanApi.class
|
||||
SubscribeMessageSendApi.class, ConfigApi.class, PermissionApi.class, AssetsTypeApi.class, LoanApi.class, BpmOALoanApi.class
|
||||
})
|
||||
public class RpcConfiguration {
|
||||
}
|
||||
|
@ -146,4 +146,10 @@ public interface FactoryInfoService {
|
||||
* @return 利润列表
|
||||
*/
|
||||
List<FactoryProfitVO> getProfit(Long factoryId, String month);
|
||||
|
||||
/**
|
||||
* 获取公司工厂列表
|
||||
* @return 工厂列表
|
||||
*/
|
||||
List<FactoryInfoDO> getCompanyFactoryList();
|
||||
}
|
||||
|
@ -106,20 +106,19 @@ public class FactoryInfoServiceImpl implements FactoryInfoService {
|
||||
|
||||
//校验工厂下是否存在 员工
|
||||
DeptRespDTO deptRespDTO = deptApi.getDeptByFactoryId(id).getCheckedData();
|
||||
if (deptRespDTO != null) {
|
||||
List<AdminUserRespDTO> userRespDTOS = userApi.getUserByDeptIdAll(deptRespDTO.getId()).getCheckedData();
|
||||
|
||||
List<Long> deptId = new ArrayList<>();
|
||||
deptId.add(deptRespDTO.getId());
|
||||
List<AdminUserRespDTO> userRespDTOS = userApi.getUserListByDeptIds(deptId).getCheckedData();
|
||||
if (userRespDTOS != null && !userRespDTOS.isEmpty()) {
|
||||
throw exception(FACTOYRY_EXISTS_STAFF);
|
||||
}
|
||||
|
||||
if (userRespDTOS != null && !userRespDTOS.isEmpty()) {
|
||||
throw exception(FACTOYRY_EXISTS_STAFF);
|
||||
//同步删除部门
|
||||
deptApi.deleteDept(id);
|
||||
}
|
||||
|
||||
// 删除
|
||||
factoryInfoMapper.deleteById(id);
|
||||
|
||||
//同步删除部门
|
||||
deptApi.deleteDept(id);
|
||||
}
|
||||
|
||||
private void validateFactoryInfoExists(Long id) {
|
||||
@ -310,4 +309,12 @@ public class FactoryInfoServiceImpl implements FactoryInfoService {
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FactoryInfoDO> getCompanyFactoryList() {
|
||||
|
||||
return factoryInfoMapper.selectList(new LambdaQueryWrapperX<FactoryInfoDO>()
|
||||
.eq(FactoryInfoDO::getStatus, CommonStatusEnum.ENABLE.getStatus())
|
||||
.in(FactoryInfoDO::getType, Arrays.asList(0,1)));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user