Merge branch 'dev' of http://git.znkjfw.com/ak/zn-cloud into dev
This commit is contained in:
commit
c0d3d869aa
@ -11,6 +11,7 @@ import java.io.IOException;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Excel 工具类
|
||||
@ -49,14 +50,13 @@ public class ExcelUtils {
|
||||
|
||||
public static <T> void write(HttpServletResponse response, String filename, String sheetName,
|
||||
Class<T> head, List<T> data,
|
||||
int col, List<String> value,
|
||||
int col1,List<String> value1) throws IOException {
|
||||
Map<Integer, List<String>> mapDropDown) throws IOException {
|
||||
|
||||
// 输出excel
|
||||
EasyExcel.write(response.getOutputStream(), head)
|
||||
.autoCloseStream(false) // 不要自动关闭,交给 Servlet 自己处理
|
||||
.registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()) // 基于 column 长度,自动适配。最大 255 宽度
|
||||
.registerWriteHandler(new SpinnerWriteHandler(col, value, col1, value1))
|
||||
.registerWriteHandler(new SpinnerWriteHandler(mapDropDown))
|
||||
.registerConverter(new LongStringConverter()) // 避免 Long 类型丢失精度
|
||||
.excelType(ExcelTypeEnum.XLS)
|
||||
.sheet(sheetName).doWrite(data);
|
||||
|
@ -7,42 +7,30 @@ import org.apache.poi.ss.usermodel.*;
|
||||
import org.apache.poi.ss.util.CellRangeAddressList;
|
||||
import org.apache.poi.xssf.usermodel.XSSFDataValidation;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class SpinnerWriteHandler implements SheetWriteHandler {
|
||||
|
||||
private int col;
|
||||
|
||||
private int col1;
|
||||
|
||||
private List<String> deptName;
|
||||
|
||||
private List<String> postName;
|
||||
private Map<Integer, List<String>> mapDropDown;
|
||||
|
||||
public SpinnerWriteHandler() {
|
||||
}
|
||||
|
||||
public SpinnerWriteHandler(int col, List<String> deptName,
|
||||
int col1, List<String> postName) {
|
||||
public SpinnerWriteHandler(Map<Integer, List<String>> mapDropDown) {
|
||||
|
||||
this.col = col;
|
||||
this.col1 = col1;
|
||||
this.deptName = deptName;
|
||||
this.postName = postName;
|
||||
this.mapDropDown = mapDropDown;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void afterSheetCreate(WriteWorkbookHolder writeWorkbookHolder, WriteSheetHolder writeSheetHolder) {
|
||||
|
||||
Map<Integer, String[]> mapDropDown = new HashMap<>();
|
||||
// 这里的key值 对应导出列的顺序 从0开始
|
||||
if (deptName != null) {
|
||||
mapDropDown.put(col, deptName.toArray(new String[0]));
|
||||
}
|
||||
mapDropDown.put(col1, postName.toArray(new String[0]));
|
||||
// Map<Integer, List<String>> mapDropDown = new HashMap<>();
|
||||
// // 这里的key值 对应导出列的顺序 从0开始
|
||||
// if (deptName != null) {
|
||||
// mapDropDown.put(col, deptName);
|
||||
// }
|
||||
// mapDropDown.put(col1, postName);
|
||||
Sheet sheet = writeSheetHolder.getSheet();
|
||||
/// 开始设置下拉框
|
||||
DataValidationHelper helper = sheet.getDataValidationHelper();// 设置下拉框
|
||||
@ -56,7 +44,7 @@ public class SpinnerWriteHandler implements SheetWriteHandler {
|
||||
Name category1Name = workbook.createName();
|
||||
category1Name.setNameName(hiddenName);
|
||||
|
||||
for (Map.Entry<Integer, String[]> entry : mapDropDown.entrySet()) {
|
||||
for (Map.Entry<Integer, List<String>> entry : mapDropDown.entrySet()) {
|
||||
|
||||
/*** 起始行、终止行、起始列、终止列 **/
|
||||
CellRangeAddressList addressList = new CellRangeAddressList(1, 1000, entry.getKey(), entry.getKey());
|
||||
@ -65,18 +53,18 @@ public class SpinnerWriteHandler implements SheetWriteHandler {
|
||||
String excelLine = getExcelLine(entry.getKey());
|
||||
|
||||
// 循环赋值
|
||||
String[] values = entry.getValue();
|
||||
for (int i = 0, length = values.length; i < length; i++) {
|
||||
List<String> values = entry.getValue();
|
||||
for (int i = 0; i < values.size(); i++) {
|
||||
// 3:表示你开始的行数 3表示 你开始的列数
|
||||
Row row = hidden.getRow(i);
|
||||
if (row == null) {
|
||||
row = hidden.createRow(i);
|
||||
}
|
||||
row.createCell(entry.getKey()).setCellValue(values[i]);
|
||||
row.createCell(entry.getKey()).setCellValue(values.get(i));
|
||||
}
|
||||
// hidden!$H:$1:$H$50 sheet为hidden的 H1列开始H50行数据获取下拉数组
|
||||
String refers = hiddenName + "!$"+excelLine+
|
||||
"$1:$"+excelLine +"$"+ (values.length);
|
||||
"$1:$"+excelLine +"$"+ (values.size());
|
||||
|
||||
/*** 设置下拉框数据 **/
|
||||
DataValidationConstraint constraint = helper.createFormulaListConstraint(refers);
|
||||
|
@ -18,12 +18,14 @@ 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, "入职部门领导"),
|
||||
LEADER_X8(27L, "调薪部门领导"),
|
||||
LEADER_X9(28L, "调薪人上级领导");
|
||||
LEADER_X9(28L, "调薪人上级领导"),
|
||||
LEADER_X10(29L, "所选工厂的领导"),
|
||||
LEADER_X11(30L, "审批人的上级领导");
|
||||
|
||||
/**
|
||||
* 脚本编号
|
||||
|
@ -2,7 +2,9 @@ package cn.iocoder.yudao.module.bpm.controller.admin.definition;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.process.*;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmProcessDefinitionExtDO;
|
||||
import cn.iocoder.yudao.module.bpm.service.definition.BpmProcessDefinitionService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
@ -12,6 +14,7 @@ import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -61,4 +64,21 @@ public class BpmProcessDefinitionController {
|
||||
String bpmnXML = bpmDefinitionService.getProcessDefinitionBpmnXML(id);
|
||||
return success(bpmnXML);
|
||||
}
|
||||
|
||||
@PutMapping ("/update-scope")
|
||||
@Operation(summary = "修改流程定义的 Scope")
|
||||
public CommonResult<Boolean> updateProcessDefinitionScope(@Valid @RequestBody DefinitionScopeVO scopeVO) {
|
||||
bpmDefinitionService.updateProcessDefinitionScope(scopeVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping ("/get")
|
||||
@Operation(summary = "获得流程定义")
|
||||
@Parameter(name = "processDefinitionId", description = "流程定义编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('bpm:process-definition:query')")
|
||||
public CommonResult<DefinitionScopeVO> getProcessDefinition(@RequestParam("processDefinitionId") String processDefinitionId) {
|
||||
|
||||
BpmProcessDefinitionExtDO definitionExtDO = bpmDefinitionService.getProcessDefinitionExt(processDefinitionId);
|
||||
return success(BeanUtils.toBean(definitionExtDO, DefinitionScopeVO.class));
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,9 @@ public class BpmProcessDefinitionRespVO {
|
||||
@Schema(description = "版本", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Integer version;
|
||||
|
||||
@Schema(description = "流程Key")
|
||||
private String key;
|
||||
|
||||
@Schema(description = "流程名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道")
|
||||
@NotEmpty(message = "流程名称不能为空")
|
||||
private String name;
|
||||
|
@ -0,0 +1,25 @@
|
||||
package cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.process;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
@Schema(description = "管理后台 - 流程定义的 ScopeVO")
|
||||
@Data
|
||||
public class DefinitionScopeVO {
|
||||
|
||||
@Schema(description = "流程定义的编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
@NotNull(message = "流程定义的编号不能为空")
|
||||
private String processDefinitionId;
|
||||
|
||||
@Schema(description = "使用权限范围 | 1全员 2指定部门 3指定用户", example = "1")
|
||||
private Integer dataScope;
|
||||
|
||||
@Schema(description = "使用权限范围 | 指定部门编号数组", example = "1,2,3")
|
||||
private List<Long> dataScopeDeptIds;
|
||||
|
||||
@Schema(description = "使用权限范围 | 指定用户编号数组", example = "1,2,3")
|
||||
private List<Long> dataScopeUserIds;
|
||||
}
|
@ -8,6 +8,8 @@ import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAImprestDO;
|
||||
import cn.iocoder.yudao.module.bpm.service.oa.BpmOAImprestService;
|
||||
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 io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
@ -38,6 +40,9 @@ public class BpmOAImprestController {
|
||||
@Resource
|
||||
private BankApi bankApi;
|
||||
|
||||
@Resource
|
||||
private DeptApi deptApi;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建请求申请")
|
||||
public CommonResult<Long> createImprest(@Valid @RequestBody BpmOAImprestCreateReqVO createReqVO) {
|
||||
@ -52,14 +57,18 @@ public class BpmOAImprestController {
|
||||
|
||||
BpmOAImprestDO imprest = imprestService.getImprest(id);
|
||||
BpmOAImprestRespVO respVO = BpmOAImprestConvert.INSTANCE.convert(imprest);
|
||||
if (respVO != null && imprest.getBankId() != null) {
|
||||
if (respVO != null) {
|
||||
// 获取收款账号信息
|
||||
BankRespDTO bankRespDTO = bankApi.getBank(imprest.getBankId()).getCheckedData();
|
||||
BankRespDTO bankRespDTO = bankApi.getBank(respVO.getBankId()).getCheckedData();
|
||||
if (bankRespDTO != null) {
|
||||
respVO.setBankName(bankRespDTO.getBankName());
|
||||
respVO.setNickname(bankRespDTO.getNickname());
|
||||
respVO.setBankNo(bankRespDTO.getBankNo());
|
||||
}
|
||||
|
||||
// 获取公司信息
|
||||
DeptRespDTO company = deptApi.getDept(respVO.getCompanyId()).getCheckedData();
|
||||
respVO.setCompanyName(company.getName());
|
||||
}
|
||||
|
||||
return success(respVO);
|
||||
@ -99,6 +108,10 @@ public class BpmOAImprestController {
|
||||
respVO.setNickname(bankRespDTO.getNickname());
|
||||
respVO.setBankNo(bankRespDTO.getBankNo());
|
||||
}
|
||||
|
||||
// 获取公司信息
|
||||
DeptRespDTO company = deptApi.getDept(respVO.getCompanyId()).getCheckedData();
|
||||
respVO.setCompanyName(company.getName());
|
||||
}
|
||||
|
||||
return success(respVO);
|
||||
|
@ -5,7 +5,9 @@ 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.loan.BpmOALoanCreateReqVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.loan.BpmOALoanRespVO;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.financialpayment.FinancialPaymentDO;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOALoanDO;
|
||||
import cn.iocoder.yudao.module.bpm.service.financialpayment.FinancialPaymentService;
|
||||
import cn.iocoder.yudao.module.bpm.service.oa.BpmOALoanService;
|
||||
import cn.iocoder.yudao.module.smartfactory.api.factoryInfo.FactoryInfoApi;
|
||||
import cn.iocoder.yudao.module.smartfactory.api.factoryInfo.dto.FactoryInfoDTO;
|
||||
@ -31,8 +33,7 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap;
|
||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
|
||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*;
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
|
||||
/**
|
||||
@ -64,6 +65,9 @@ public class BpmOALoanController {
|
||||
@Resource
|
||||
private FactoryInfoApi factoryInfoApi;
|
||||
|
||||
@Resource
|
||||
private FinancialPaymentService financialPaymentService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建借支申请")
|
||||
public CommonResult<Long> createLoan(@Valid @RequestBody BpmOALoanCreateReqVO createReqVO) {
|
||||
@ -146,6 +150,10 @@ public class BpmOALoanController {
|
||||
List<BpmOALoanRespVO> respVOS = BeanUtils.toBean(loanList, BpmOALoanRespVO.class);
|
||||
if (CollUtil.isNotEmpty(respVOS)) {
|
||||
|
||||
// 获取支付信息
|
||||
List<String> processInstanceIds = convertList(loanList, BpmOALoanDO::getProcessInstanceId);
|
||||
Map<String, FinancialPaymentDO> financialPayments = convertMap(financialPaymentService.getFinancialPaymentList(processInstanceIds), FinancialPaymentDO::getProcessInstanceId);
|
||||
|
||||
// 获取申请人信息
|
||||
Set<Long> userIds = convertSet(loanList, BpmOALoanDO::getUserId);
|
||||
Map<Long, AdminUserRespDTO> userMap = userApi.getUserMap(userIds);
|
||||
@ -165,6 +173,8 @@ public class BpmOALoanController {
|
||||
item.setSfUserName(loanUserMap.get(item.getSfUserId()).getNickName());
|
||||
// 设置借支用户部门名称
|
||||
item.setFactoryName(factoryMap.get(item.getFactoryId()).getName());
|
||||
// 设置支付状态
|
||||
item.setStatus(financialPayments.containsKey(item.getProcessInstanceId()) ? financialPayments.get(item.getProcessInstanceId()).getStatus() : 2);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -84,6 +84,8 @@ public class BpmOAPaymentController {
|
||||
@Parameter(name = "type", description = "付款类型", required = true, example = "1")
|
||||
public CommonResult<List<BpmOAPaymentRespVO>> getPayment(@RequestParam("type") Integer type) {
|
||||
|
||||
List<BpmOAPaymentRespVO> list = paymentService.getPaymentList(type);
|
||||
|
||||
return success(paymentService.getPaymentList(type));
|
||||
}
|
||||
|
||||
|
@ -36,6 +36,10 @@ public class BpmOAImprestCreateReqVO {
|
||||
@NotNull(message = "费用事由不能为空")
|
||||
private String reason;
|
||||
|
||||
@Schema(description = "付款公司编号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "付款公司编号不能为空")
|
||||
private Long companyId;
|
||||
|
||||
@Schema(description = "费用金额", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "费用金额不能为空")
|
||||
private BigDecimal amount;
|
||||
|
@ -44,6 +44,12 @@ public class BpmOAImprestRespVO extends BpmOABaseRespVO {
|
||||
@NotNull(message = "费用事由不能为空")
|
||||
private String reason;
|
||||
|
||||
@Schema(description = "付款公司编号")
|
||||
private Long companyId;
|
||||
|
||||
@Schema(description = "付款公司名称")
|
||||
private String companyName;
|
||||
|
||||
@Schema(description = "费用金额", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "费用金额不能为空")
|
||||
private BigDecimal amount;
|
||||
|
@ -54,4 +54,7 @@ public class BpmOALoanRespVO extends BpmOABaseRespVO {
|
||||
|
||||
@Schema(description = "上传文件", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private List<UploadUserFile> fileItems;
|
||||
|
||||
@Schema(description = "支付状态 | 0待支付 1分批支付中 2已支付 3拒绝")
|
||||
private Integer status;
|
||||
}
|
||||
|
@ -30,11 +30,39 @@ public class BpmOAPrintDataRespVO extends BpmOABaseRespVO {
|
||||
@Schema(description = "流程审批节点信息【包含人员签名地址】")
|
||||
List<BpmTaskRespVO> processTasks ;
|
||||
|
||||
/**
|
||||
* 发起流程的用户
|
||||
*/
|
||||
private User startUser;
|
||||
|
||||
/**
|
||||
* 抄送用户信息
|
||||
*/
|
||||
private List<CCUser> ccUsers;
|
||||
|
||||
@Schema(description = "用户信息")
|
||||
@Data
|
||||
public static class User {
|
||||
|
||||
@Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "用户昵称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿")
|
||||
private String nickname;
|
||||
|
||||
@Schema(description = "部门编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Long deptId;
|
||||
|
||||
@Schema(description = "部门名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "研发部")
|
||||
private String deptName;
|
||||
|
||||
@Schema(description = "公司编号")
|
||||
private Long companyId;
|
||||
|
||||
@Schema(description = "公司名称")
|
||||
private String companyName;
|
||||
}
|
||||
|
||||
@Schema(description = "抄送用户信息")
|
||||
@Data
|
||||
public static class CCUser {
|
||||
|
@ -54,14 +54,21 @@ public class BpmProcessInstanceRespVO {
|
||||
|
||||
@Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "用户昵称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿")
|
||||
private String nickname;
|
||||
|
||||
@Schema(description = "部门编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Long deptId;
|
||||
|
||||
@Schema(description = "部门名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "研发部")
|
||||
private String deptName;
|
||||
|
||||
@Schema(description = "公司编号")
|
||||
private Long companyId;
|
||||
|
||||
@Schema(description = "公司名称")
|
||||
private String companyName;
|
||||
}
|
||||
|
||||
@Schema(description = "流程定义信息")
|
||||
|
@ -97,7 +97,7 @@ public interface BpmProcessInstanceConvert {
|
||||
|
||||
default BpmProcessInstanceRespVO convert2(HistoricProcessInstance processInstance, BpmProcessInstanceExtDO processInstanceExt,
|
||||
ProcessDefinition processDefinition, BpmProcessDefinitionExtDO processDefinitionExt,
|
||||
String bpmnXml, AdminUserRespDTO startUser, DeptRespDTO dept) {
|
||||
String bpmnXml, AdminUserRespDTO startUser, DeptRespDTO dept, DeptRespDTO companyDept) {
|
||||
BpmProcessInstanceRespVO respVO = convert2(processInstance);
|
||||
copyTo(processInstanceExt, respVO);
|
||||
respVO.setBusinessKey(processInstance.getBusinessKey()) ;
|
||||
@ -111,6 +111,12 @@ public interface BpmProcessInstanceConvert {
|
||||
if (dept != null) {
|
||||
respVO.getStartUser().setDeptName(dept.getName());
|
||||
}
|
||||
if (companyDept != null) {
|
||||
// 设置用户所属公司编号
|
||||
respVO.getStartUser().setCompanyId(companyDept.getId());
|
||||
// 设置用户所属公司名称
|
||||
respVO.getStartUser().setCompanyName(companyDept.getName());
|
||||
}
|
||||
}
|
||||
return respVO;
|
||||
}
|
||||
|
@ -90,4 +90,21 @@ public class BpmProcessDefinitionExtDO extends BaseDO {
|
||||
* 流程图标路径地址
|
||||
*/
|
||||
private String processImg ;
|
||||
|
||||
/**
|
||||
* 使用权限范围 | 1全员 2指定部门 3指定用户
|
||||
*/
|
||||
private Integer dataScope;
|
||||
|
||||
/**
|
||||
* 使用权限 指定部门数组
|
||||
*/
|
||||
@TableField(typeHandler = JacksonTypeHandler.class)
|
||||
private List<Long> dataScopeDeptIds;
|
||||
|
||||
/**
|
||||
* 使用权限 指定用户数组
|
||||
*/
|
||||
@TableField(typeHandler = JacksonTypeHandler.class)
|
||||
private List<Long> dataScopeUserIds;
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ public class FinancialPaymentDO extends BaseDO {
|
||||
*/
|
||||
private String reason;
|
||||
/**
|
||||
* 流程类型 1现金支出 2备用金 3采购付款 4报销 5供应商采购付款 6开支日报
|
||||
* 流程类型 1现金支出 2备用金 3采购付款 4报销 5付款申请 6薪资付款 7借支申请 8供应商采购付款
|
||||
*/
|
||||
private Integer type;
|
||||
/**
|
||||
|
@ -65,6 +65,11 @@ public class BpmOAImprestDO extends BaseDO {
|
||||
*/
|
||||
private String reason;
|
||||
|
||||
/**
|
||||
* 付款公司编号
|
||||
*/
|
||||
private Long companyId;
|
||||
|
||||
/**
|
||||
* 申请金额
|
||||
*/
|
||||
|
@ -15,7 +15,9 @@ import java.util.List;
|
||||
@Mapper
|
||||
public interface BpmOAPaymentMapper extends BaseMapperX<BpmOAPaymentDO> {
|
||||
|
||||
List<BpmOAPaymentRespVO> selectPaymentList(@Param("type") Integer type);
|
||||
List<BpmOAPaymentRespVO> selectPaymentList(@Param("type") Integer type,
|
||||
@Param("deptId") Long deptId,
|
||||
@Param("method") Integer method);
|
||||
|
||||
default PageResult<BpmOAPaymentDO> selectTicketsPage(BpmOAPaymentPageReqVO pageReqVO, Long userId) {
|
||||
|
||||
|
@ -0,0 +1,82 @@
|
||||
package cn.iocoder.yudao.module.bpm.framework.flowable.core.behavior.script.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task.BpmTaskRespVO;
|
||||
import cn.iocoder.yudao.module.bpm.enums.definition.BpmTaskRuleScriptEnum;
|
||||
import cn.iocoder.yudao.module.bpm.framework.flowable.core.behavior.script.BpmTaskAssignScript;
|
||||
import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService;
|
||||
import cn.iocoder.yudao.module.bpm.service.task.BpmTaskService;
|
||||
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.user.AdminUserApi;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
||||
import org.flowable.engine.delegate.DelegateExecution;
|
||||
import org.flowable.engine.runtime.ProcessInstance;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.collection.SetUtils.asSet;
|
||||
import static java.util.Collections.emptySet;
|
||||
|
||||
/**
|
||||
* 分配给审批人的上级领导 审批的 Script 实现类
|
||||
*/
|
||||
@Component
|
||||
public class BpmTaskAssignLeaderScript implements BpmTaskAssignScript {
|
||||
|
||||
@Resource
|
||||
@Lazy // 解决循环依赖
|
||||
private DeptApi deptApi;
|
||||
@Resource
|
||||
@Lazy // 解决循环依赖
|
||||
private AdminUserApi userApi;
|
||||
|
||||
@Resource
|
||||
@Lazy // 解决循环依赖
|
||||
private BpmProcessInstanceService bpmProcessInstanceService;
|
||||
|
||||
@Resource
|
||||
@Lazy // 解决循环依赖
|
||||
private BpmTaskService bpmTaskService ;
|
||||
|
||||
@Override
|
||||
public Set<Long> calculateTaskCandidateUsers(DelegateExecution execution) {
|
||||
|
||||
ProcessInstance processInstance = bpmProcessInstanceService.getProcessInstance(execution.getProcessInstanceId());
|
||||
List<BpmTaskRespVO> bpmTaskRespVOs = bpmTaskService.getTaskListByProcessInstanceId(processInstance.getProcessInstanceId());
|
||||
if (CollUtil.isEmpty(bpmTaskRespVOs)) {
|
||||
return emptySet();
|
||||
}
|
||||
|
||||
// 获取最后一个Task任务相关数据
|
||||
BpmTaskRespVO bpmTaskRespVO = bpmTaskRespVOs.get(0) ;
|
||||
Long assigneeUserId = bpmTaskRespVO.getAssigneeUser().getId();
|
||||
|
||||
// 获取审批人部门信息
|
||||
DeptRespDTO dept = getUserDept(assigneeUserId);
|
||||
if (dept == null || dept.getParentId() == null) {
|
||||
return emptySet();
|
||||
}
|
||||
// 获取审批人的上级部门信息
|
||||
DeptRespDTO assignDept = deptApi.getDept(dept.getParentId()).getCheckedData();
|
||||
|
||||
return assignDept != null && assignDept.getLeaderUserId() != null ? asSet(assignDept.getLeaderUserId()) : emptySet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BpmTaskRuleScriptEnum getEnum() {
|
||||
return BpmTaskRuleScriptEnum.LEADER_X11;
|
||||
}
|
||||
|
||||
private DeptRespDTO getUserDept(Long userId) {
|
||||
AdminUserRespDTO user = userApi.getUser(userId).getCheckedData();
|
||||
if (user.getDeptId() == null) { // 找不到部门,所以无法使用该规则
|
||||
return null;
|
||||
}
|
||||
return deptApi.getDept(user.getDeptId()).getCheckedData();
|
||||
}
|
||||
}
|
@ -13,6 +13,7 @@ import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
||||
import org.flowable.engine.delegate.DelegateExecution;
|
||||
import org.flowable.engine.runtime.ProcessInstance;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@ -23,18 +24,18 @@ import static cn.iocoder.yudao.framework.common.util.collection.SetUtils.asSet;
|
||||
import static java.util.Collections.emptySet;
|
||||
|
||||
/**
|
||||
* 分配给审批人的上级领导 审批的 Script 实现类
|
||||
* 分配给发起人的上级领导 审批的 Script 实现类
|
||||
*
|
||||
|
||||
*/
|
||||
@Component
|
||||
public class BpmTaskCurrentAssignLeaderScript extends BpmTaskAssignLeaderAbstractScript {
|
||||
|
||||
@Resource
|
||||
private AdminUserApi userApi;
|
||||
|
||||
@Resource
|
||||
private AdminUserApi adminUserApi;
|
||||
@Resource
|
||||
private DeptApi deptApi;
|
||||
|
||||
@Resource
|
||||
@Lazy // 解决循环依赖
|
||||
private BpmProcessInstanceService bpmProcessInstanceService;
|
||||
@ -43,6 +44,10 @@ public class BpmTaskCurrentAssignLeaderScript extends BpmTaskAssignLeaderAbstrac
|
||||
@Lazy // 解决循环依赖
|
||||
private BpmTaskService bpmTaskService ;
|
||||
|
||||
@Resource
|
||||
@Lazy // 解决循环依赖
|
||||
private StringRedisTemplate stringRedisTemplate;
|
||||
|
||||
@Override
|
||||
public Set<Long> calculateTaskCandidateUsers(DelegateExecution execution) {
|
||||
// 获得发起人
|
||||
@ -51,65 +56,77 @@ public class BpmTaskCurrentAssignLeaderScript extends BpmTaskAssignLeaderAbstrac
|
||||
if (CollUtil.isEmpty(bpmTaskRespVOs)) {
|
||||
return emptySet();
|
||||
}
|
||||
Long startUserId = NumberUtils.parseLong(processInstance.getStartUserId());
|
||||
|
||||
//获取最后一个Task任务相关数据
|
||||
// 获取最后一个Task任务相关数据
|
||||
BpmTaskRespVO bpmTaskRespVO = bpmTaskRespVOs.get(0) ;
|
||||
Long assigneeUserId = bpmTaskRespVO.getAssigneeUser().getId() ;
|
||||
Long assigneeUserId = bpmTaskRespVO.getAssigneeUser().getId();
|
||||
|
||||
// 获得对应 发起人 的部门
|
||||
DeptRespDTO dept = getUserDept(startUserId);
|
||||
if (dept == null) { // 找不到发起人的部门,所以无法使用该规则
|
||||
return emptySet();
|
||||
}
|
||||
// 获取审批节点当前的 审批部门信息
|
||||
String key = "assignee_dept_" + processInstance.getId();
|
||||
String deptId = stringRedisTemplate.opsForValue().get(key);
|
||||
if (deptId == null) {
|
||||
|
||||
int count = 0;
|
||||
Long parentId = dept.getParentId();
|
||||
for (int i = 0; i < dept.getLevel(); i++) {
|
||||
Long startUserId = NumberUtils.parseLong(processInstance.getStartUserId());
|
||||
// 获得对应 发起人 的部门
|
||||
DeptRespDTO dept = getUserDept(startUserId);
|
||||
if (dept == null) { // 找不到发起人的部门,所以无法使用该规则
|
||||
return emptySet();
|
||||
}
|
||||
|
||||
if (i == 0) { //第一次查找 判断审批人是否为发起人部门负责人
|
||||
if (assigneeUserId.toString().equals(processInstance.getStartUserId())
|
||||
&& !dept.getLeaderUserId().toString().equals(processInstance.getStartUserId())){ //如果发起人不是所在部门负责人时
|
||||
int count = 0;
|
||||
Long parentId = dept.getParentId();
|
||||
for (int i = 0; i < dept.getLevel(); i++) {
|
||||
|
||||
if (i == 0) { //第一次查找 判断审批人是否为发起人部门负责人
|
||||
if (assigneeUserId.toString().equals(processInstance.getStartUserId())
|
||||
&& !dept.getLeaderUserId().toString().equals(processInstance.getStartUserId())){ //如果发起人不是所在部门负责人时
|
||||
|
||||
count = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//获得发起人的上级部门
|
||||
DeptRespDTO parentDept = deptApi.getDept(parentId).getCheckedData();
|
||||
if (parentDept == null) { // 找不到父级部门,所以只好结束寻找。原因是:例如说,级别比较高的人,所在部门层级比较少
|
||||
return emptySet();
|
||||
}
|
||||
|
||||
if (!parentDept.getLeaderUserId().toString().equals(assigneeUserId.toString())){ //如果发起人上级部门负责人不为当前审批人时
|
||||
|
||||
dept = parentDept;
|
||||
count = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
parentId = parentDept.getParentId();
|
||||
}
|
||||
|
||||
//获得发起人的上级部门
|
||||
DeptRespDTO parentDept = deptApi.getDept(parentId).getCheckedData();
|
||||
if (parentDept == null) { // 找不到父级部门,所以只好结束寻找。原因是:例如说,级别比较高的人,所在部门层级比较少
|
||||
if (count == 0){// 找不到父级部门。原因是:人的所属部门配在了最高节点了
|
||||
return emptySet();
|
||||
}
|
||||
if (!parentDept.getLeaderUserId().toString().equals(assigneeUserId.toString())){ //如果发起人上级部门负责人不为当前审批人时
|
||||
|
||||
dept = parentDept;
|
||||
count = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
parentId = parentDept.getParentId();
|
||||
return dept.getLeaderUserId() != null ? asSet(dept.getLeaderUserId()) : emptySet();
|
||||
}
|
||||
|
||||
if (count == 0){// 找不到父级部门。原因是:人的所属部门配在了最高节点了
|
||||
DeptRespDTO assigneeDept = deptApi.getDept(Long.valueOf(deptId)).getCheckedData();
|
||||
if (assigneeDept == null) {
|
||||
return emptySet();
|
||||
}
|
||||
|
||||
return dept.getLeaderUserId() != null ? asSet(dept.getLeaderUserId()) : emptySet();
|
||||
// 判断当前审批人是不是 当前审批部门的负责人
|
||||
if (!assigneeUserId.equals(assigneeDept.getLeaderUserId())) {
|
||||
return asSet(assigneeDept.getLeaderUserId());
|
||||
}else {
|
||||
|
||||
// //获取最后一个Task任务相关数据
|
||||
// BpmTaskRespVO bpmTaskRespVO = bpmTaskRespVOs.get(0) ;
|
||||
// Long assigneeUserId = bpmTaskRespVO.getAssigneeUser().getId() ;
|
||||
// // 获取当前审批用户的部门信息
|
||||
// DeptRespDTO dept = getUserDept(assigneeUserId);
|
||||
// if (dept == null) { // 找不到发起人的部门,所以无法使用该规则
|
||||
// return emptySet();
|
||||
// }
|
||||
// DeptRespDTO parentDept = deptApi.getDept(dept.getParentId()).getCheckedData();
|
||||
// if (parentDept == null) { // 找不到父级部门。原因是:人的所属部门配在了最高节点了
|
||||
// return emptySet();
|
||||
// }
|
||||
// return parentDept.getLeaderUserId() != null ? asSet(parentDept.getLeaderUserId()) : emptySet();
|
||||
// 获得上级部门信息
|
||||
DeptRespDTO parentDept = deptApi.getDept(assigneeDept.getParentId()).getCheckedData();
|
||||
if (parentDept != null) {
|
||||
// 更新审批部门缓存
|
||||
stringRedisTemplate.opsForValue().set(key, parentDept.getId().toString());
|
||||
}
|
||||
return parentDept != null && parentDept.getLeaderUserId() != null ? asSet(parentDept.getLeaderUserId()) : emptySet();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -118,7 +135,7 @@ public class BpmTaskCurrentAssignLeaderScript extends BpmTaskAssignLeaderAbstrac
|
||||
}
|
||||
|
||||
private DeptRespDTO getUserDept(Long userId) {
|
||||
AdminUserRespDTO user = adminUserApi.getUser(userId).getCheckedData();
|
||||
AdminUserRespDTO user = userApi.getUser(userId).getCheckedData();
|
||||
if (user.getDeptId() == null) { // 找不到部门,所以无法使用该规则
|
||||
return null;
|
||||
}
|
||||
|
@ -50,20 +50,15 @@ public class BpmTaskEntryLeaderScript implements BpmTaskAssignScript {
|
||||
return emptySet();
|
||||
}
|
||||
|
||||
//根据流程实例ID 取到调岗流程表单
|
||||
//根据流程实例ID 取到入职流程表单
|
||||
BpmOAEntryDO entryDO = entryService.getEntry(Long.valueOf(processInstance.getBusinessKey()));
|
||||
//获取调岗部门ID
|
||||
//获取入职部门ID
|
||||
Long deptId = entryDO.getEntryDeptId();
|
||||
|
||||
//根据部门ID 获取部门信息
|
||||
DeptRespDTO dept = deptApi.getDept(deptId).getCheckedData();
|
||||
if (dept.getLevel() > 3) { //判断部门层级
|
||||
|
||||
String[] flag = dept.getFlag().split("-");
|
||||
dept = deptApi.getDept(Long.valueOf(flag[3])).getCheckedData();
|
||||
}
|
||||
|
||||
return dept.getLeaderUserId() != null ? asSet(dept.getLeaderUserId()) : emptySet();
|
||||
return dept != null && dept.getLeaderUserId() != null ? asSet(dept.getLeaderUserId()) : emptySet();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -0,0 +1,108 @@
|
||||
package cn.iocoder.yudao.module.bpm.framework.flowable.core.behavior.script.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task.BpmTaskRespVO;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAExpensesItemDO;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOALoanDO;
|
||||
import cn.iocoder.yudao.module.bpm.enums.definition.BpmTaskRuleScriptEnum;
|
||||
import cn.iocoder.yudao.module.bpm.service.oa.BpmOAExpensesService;
|
||||
import cn.iocoder.yudao.module.bpm.service.oa.BpmOALoanService;
|
||||
import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService;
|
||||
import cn.iocoder.yudao.module.bpm.service.task.BpmTaskService;
|
||||
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.user.AdminUserApi;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
||||
import org.flowable.engine.delegate.DelegateExecution;
|
||||
import org.flowable.engine.runtime.ProcessInstance;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.collection.SetUtils.asSet;
|
||||
import static java.util.Collections.emptySet;
|
||||
|
||||
/**
|
||||
* 分配给所选工厂的领导 审批的 Script 实现类
|
||||
*/
|
||||
@Component
|
||||
public class BpmTaskFactoryLeaderScript extends BpmTaskAssignLeaderAbstractScript {
|
||||
|
||||
@Resource
|
||||
private AdminUserApi userApi;
|
||||
|
||||
@Resource
|
||||
private DeptApi deptApi;
|
||||
|
||||
@Resource
|
||||
@Lazy // 解决循环依赖
|
||||
private BpmProcessInstanceService bpmProcessInstanceService;
|
||||
|
||||
@Resource
|
||||
@Lazy // 解决循环依赖
|
||||
private BpmTaskService bpmTaskService;
|
||||
|
||||
@Resource
|
||||
@Lazy // 解决循环依赖
|
||||
private BpmOAExpensesService expensesService;
|
||||
|
||||
@Resource
|
||||
@Lazy // 解决循环依赖
|
||||
private BpmOALoanService loanService;
|
||||
|
||||
@Override
|
||||
public Set<Long> calculateTaskCandidateUsers(DelegateExecution execution) {
|
||||
// 获得发起人
|
||||
ProcessInstance processInstance = bpmProcessInstanceService.getProcessInstance(execution.getProcessInstanceId());
|
||||
List<BpmTaskRespVO> bpmTaskRespVOs = bpmTaskService.getTaskListByProcessInstanceId(processInstance.getProcessInstanceId());
|
||||
if (CollUtil.isEmpty(bpmTaskRespVOs)) {
|
||||
return emptySet();
|
||||
}
|
||||
|
||||
DeptRespDTO dept = null;
|
||||
switch (processInstance.getProcessDefinitionKey()) {
|
||||
case "oa_expenses_2":
|
||||
// 根据流程实例ID 取到开支日报流程表单
|
||||
List<BpmOAExpensesItemDO> expensesItems = expensesService.getExpensesItem(Long.valueOf(processInstance.getBusinessKey()));
|
||||
// 获取开支所属工厂信息
|
||||
if (CollUtil.isNotEmpty(expensesItems)) {
|
||||
|
||||
DeptRespDTO factory = deptApi.getDeptByFactoryId(expensesItems.get(0).getDeptId()).getCheckedData();
|
||||
// 获取工厂上级部门信息
|
||||
dept = deptApi.getDept(factory.getParentId()).getCheckedData();
|
||||
}
|
||||
break;
|
||||
case "oa_loan_2":
|
||||
// 根据流程实例ID 取到借支流程表单
|
||||
BpmOALoanDO loanDO = loanService.getLoan(Long.valueOf(processInstance.getBusinessKey()));
|
||||
|
||||
if (loanDO != null) {
|
||||
// 获取借支工厂信息
|
||||
DeptRespDTO factory = deptApi.getDeptByFactoryId(loanDO.getFactoryId()).getCheckedData();
|
||||
// 获取工厂上级部门信息
|
||||
dept = deptApi.getDept(factory.getParentId()).getCheckedData();
|
||||
}
|
||||
break;
|
||||
case "oa_salary_2":
|
||||
// 获取发起人的部门信息
|
||||
AdminUserRespDTO userRespDTO = userApi.getUser(Long.valueOf(processInstance.getStartUserId())).getCheckedData();
|
||||
DeptRespDTO deptRespDTO = deptApi.getDept(userRespDTO.getDeptId()).getCheckedData();
|
||||
|
||||
// 判断是否是属于工厂部门
|
||||
if (deptRespDTO.getFactoryId() != null) {
|
||||
dept = deptApi.getDept(deptRespDTO.getParentId()).getCheckedData();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return dept != null && dept.getLeaderUserId() != null ? asSet(dept.getLeaderUserId()) : emptySet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BpmTaskRuleScriptEnum getEnum() {
|
||||
return BpmTaskRuleScriptEnum.LEADER_X10;
|
||||
}
|
||||
}
|
@ -160,4 +160,10 @@ public interface BpmProcessDefinitionService {
|
||||
* @return 流程定义列表
|
||||
*/
|
||||
List<BpmProcessDefinitionSimpleVO> getProcessDefinitionSimpleList(BpmProcessDefinitionListReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 更新流程定义的权限范围
|
||||
* @param scopeVO 更新信息
|
||||
*/
|
||||
void updateProcessDefinitionScope(DefinitionScopeVO scopeVO);
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import cn.hutool.core.util.StrUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.PageUtils;
|
||||
import cn.iocoder.yudao.framework.flowable.core.util.BpmnModelUtils;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.process.*;
|
||||
import cn.iocoder.yudao.module.bpm.convert.definition.BpmProcessDefinitionConvert;
|
||||
@ -14,6 +15,8 @@ import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmProcessDefinitio
|
||||
import cn.iocoder.yudao.module.bpm.dal.mysql.definition.BpmProcessDefinitionExtMapper;
|
||||
import cn.iocoder.yudao.module.bpm.service.definition.dto.BpmProcessDefinitionCreateReqDTO;
|
||||
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
||||
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.flowable.bpmn.converter.BpmnXMLConverter;
|
||||
import org.flowable.bpmn.model.BpmnModel;
|
||||
@ -33,10 +36,8 @@ 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.*;
|
||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap;
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.PROCESS_DEFINITION_KEY_NOT_MATCH;
|
||||
import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.PROCESS_DEFINITION_NAME_NOT_MATCH;
|
||||
import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.*;
|
||||
import static java.util.Collections.emptyList;
|
||||
|
||||
/**
|
||||
@ -66,6 +67,9 @@ public class BpmProcessDefinitionServiceImpl implements BpmProcessDefinitionServ
|
||||
@Resource
|
||||
private DeptApi deptApi;
|
||||
|
||||
@Resource
|
||||
private AdminUserApi userApi;
|
||||
|
||||
@Override
|
||||
public ProcessDefinition getProcessDefinition(String id) {
|
||||
return repositoryService.getProcessDefinition(id);
|
||||
@ -160,6 +164,24 @@ public class BpmProcessDefinitionServiceImpl implements BpmProcessDefinitionServ
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateProcessDefinitionScope(DefinitionScopeVO scopeVO) {
|
||||
// 校验流程定义是否存在
|
||||
BpmProcessDefinitionExtDO definitionExtDO = processDefinitionMapper.selectByProcessDefinitionId(scopeVO.getProcessDefinitionId());
|
||||
if (definitionExtDO == null) {
|
||||
throw exception(PROCESS_DEFINITION_NOT_EXISTS);
|
||||
}
|
||||
|
||||
BpmProcessDefinitionExtDO updateDO = new BpmProcessDefinitionExtDO();
|
||||
updateDO.setId(definitionExtDO.getId());
|
||||
updateDO.setDataScope(scopeVO.getDataScope());
|
||||
updateDO.setDataScopeDeptIds(scopeVO.getDataScopeDeptIds());
|
||||
updateDO.setDataScopeUserIds(scopeVO.getDataScopeUserIds());
|
||||
|
||||
// 更新
|
||||
processDefinitionMapper.updateById(updateDO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String createProcessDefinition(@Valid BpmProcessDefinitionCreateReqDTO createReqDTO) {
|
||||
// 创建 Deployment 部署
|
||||
@ -288,11 +310,24 @@ public class BpmProcessDefinitionServiceImpl implements BpmProcessDefinitionServ
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
// 获取当前登录用户信息
|
||||
AdminUserRespDTO userRespDTO = userApi.getUser(getLoginUserId()).getCheckedData();
|
||||
|
||||
// 获得 BpmProcessDefinitionDO Map
|
||||
List<BpmProcessDefinitionExtDO> processDefinitionDOs = processDefinitionMapper.selectListByProcessDefinitionIds(
|
||||
convertList(processDefinitions, ProcessDefinition::getId));
|
||||
List<BpmProcessDefinitionExtDO> processDefinitionDOs = processDefinitionMapper.selectList(new LambdaQueryWrapperX<BpmProcessDefinitionExtDO>()
|
||||
.inIfPresent(BpmProcessDefinitionExtDO::getProcessDefinitionId, convertList(processDefinitions, ProcessDefinition::getId))
|
||||
.eq(BpmProcessDefinitionExtDO::getDataScope, 1)
|
||||
.or()
|
||||
.like(BpmProcessDefinitionExtDO::getDataScopeDeptIds, userRespDTO.getDeptId())
|
||||
.or()
|
||||
.like(BpmProcessDefinitionExtDO::getDataScopeUserIds, userRespDTO.getId())
|
||||
);
|
||||
Map<String, BpmProcessDefinitionExtDO> processDefinitionDOMap = convertMap(processDefinitionDOs,
|
||||
BpmProcessDefinitionExtDO::getProcessDefinitionId);
|
||||
|
||||
// 移除 无权限的流程定义
|
||||
processDefinitions.removeIf(item -> !processDefinitionDOMap.containsKey(item.getId()));
|
||||
|
||||
// 执行查询,并返回
|
||||
return BpmProcessDefinitionConvert.INSTANCE.convertList3(processDefinitions, processDefinitionDOMap);
|
||||
}
|
||||
@ -331,5 +366,4 @@ public class BpmProcessDefinitionServiceImpl implements BpmProcessDefinitionServ
|
||||
return new PageResult<>(BpmProcessDefinitionConvert.INSTANCE.convertList(processDefinitions, deploymentMap,
|
||||
processDefinitionDOMap, formMap), definitionCount);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -28,8 +28,9 @@ import cn.iocoder.yudao.module.system.api.auth.AdminOauthUserOtherInfoApi;
|
||||
import cn.iocoder.yudao.module.system.api.auth.dto.AdminOauthUserOtherInfoApiDTO;
|
||||
import cn.iocoder.yudao.module.system.api.auth.vo.AdminOauthUserOtherInfoApiVO;
|
||||
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
||||
import cn.iocoder.yudao.module.system.api.loan.LoanApi;
|
||||
import cn.iocoder.yudao.module.system.api.loan.dto.LoanDTO;
|
||||
import cn.iocoder.yudao.module.system.api.subscribe.SubscribeMessageSendApi;
|
||||
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -37,6 +38,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@ -70,7 +72,7 @@ public class FinancialPaymentServiceImpl implements FinancialPaymentService {
|
||||
@Resource
|
||||
private SubscribeMessageSendApi subscribeMessageSendApi;
|
||||
@Resource
|
||||
private AdminUserApi userApi;
|
||||
private LoanApi loanApi;
|
||||
@Resource
|
||||
private BpmProcessInstanceExtMapper processInstanceExtMapper;
|
||||
@Resource
|
||||
@ -78,6 +80,15 @@ public class FinancialPaymentServiceImpl implements FinancialPaymentService {
|
||||
@Resource
|
||||
private AdminOauthUserOtherInfoApi adminOauthUserOtherInfoApi;
|
||||
|
||||
@Resource
|
||||
private BpmOALoanMapper loanMapper;
|
||||
|
||||
@Resource
|
||||
private BpmOAPaymentMapper paymentMapper;
|
||||
|
||||
@Resource
|
||||
private BpmOASalaryMapper salaryMapper;
|
||||
|
||||
@Override
|
||||
public Long createFinancialPayment(FinancialPaymentSaveVO vo) {
|
||||
FinancialPaymentItemSaveReqVO createReqVO = vo.getFinancialPaymentItemSaveReqVO();
|
||||
@ -103,16 +114,31 @@ public class FinancialPaymentServiceImpl implements FinancialPaymentService {
|
||||
// TODO: 2024/8/18 - 驳回该流程通过流程实例id 发消息通知发起人 - 更改状态
|
||||
financialPayment.setStatus(3);
|
||||
// -- 修改流程状态
|
||||
if (financialPayment.getType() == 1) {
|
||||
cashMapper.updateById(new BpmOACashDO().setId(financialPayment.getObjectId()).setResult(BpmProcessInstanceResultEnum.BACK.getResult()));
|
||||
} else if (financialPayment.getType() == 2) {
|
||||
imprestMapper.updateById(new BpmOAImprestDO().setId(financialPayment.getObjectId()).setResult(BpmProcessInstanceResultEnum.BACK.getResult()));
|
||||
} else if (financialPayment.getType() == 3) {
|
||||
oAProcurePayMapper.updateById(new BpmOAProcurePayDO().setId(financialPayment.getObjectId()).setResult(BpmProcessInstanceResultEnum.BACK.getResult()));
|
||||
} else if (financialPayment.getType() == 4) {
|
||||
reimbursementMapper.updateById(new BpmOAReimbursementDO().setId(financialPayment.getObjectId()).setResult(BpmProcessInstanceResultEnum.BACK.getResult()));
|
||||
} else if (financialPayment.getType() == 5) {
|
||||
supplierPurchasePaymentMapper.updateById(new BpmOASupplierPurchasePaymentDO().setId(financialPayment.getObjectId()).setResult(BpmProcessInstanceResultEnum.BACK.getResult()));
|
||||
switch (financialPayment.getType()) {
|
||||
case 1:
|
||||
cashMapper.updateById(new BpmOACashDO().setId(financialPayment.getObjectId()).setResult(BpmProcessInstanceResultEnum.BACK.getResult()));
|
||||
break;
|
||||
case 2:
|
||||
imprestMapper.updateById(new BpmOAImprestDO().setId(financialPayment.getObjectId()).setResult(BpmProcessInstanceResultEnum.BACK.getResult()));
|
||||
break;
|
||||
case 3:
|
||||
oAProcurePayMapper.updateById(new BpmOAProcurePayDO().setId(financialPayment.getObjectId()).setResult(BpmProcessInstanceResultEnum.BACK.getResult()));
|
||||
break;
|
||||
case 4:
|
||||
reimbursementMapper.updateById(new BpmOAReimbursementDO().setId(financialPayment.getObjectId()).setResult(BpmProcessInstanceResultEnum.BACK.getResult()));
|
||||
break;
|
||||
case 5:
|
||||
paymentMapper.updateById(new BpmOAPaymentDO().setId(financialPayment.getObjectId()).setResult(BpmProcessInstanceResultEnum.BACK.getResult()));
|
||||
break;
|
||||
case 6:
|
||||
salaryMapper.updateById(new BpmOASalaryDO().setId(financialPayment.getObjectId()).setResult(BpmProcessInstanceResultEnum.BACK.getResult()));
|
||||
break;
|
||||
case 7:
|
||||
loanMapper.updateById(new BpmOALoanDO().setId(financialPayment.getObjectId()).setResult(BpmProcessInstanceResultEnum.BACK.getResult()));
|
||||
break;
|
||||
case 8:
|
||||
supplierPurchasePaymentMapper.updateById(new BpmOASupplierPurchasePaymentDO().setId(financialPayment.getObjectId()).setResult(BpmProcessInstanceResultEnum.BACK.getResult()));
|
||||
break;
|
||||
}
|
||||
BpmProcessInstanceExtDO instanceExtDO = new BpmProcessInstanceExtDO().setProcessInstanceId(financialPayment.getProcessInstanceId())
|
||||
.setStatus(BpmProcessInstanceStatusEnum.FINISH.getStatus())
|
||||
@ -120,6 +146,22 @@ public class FinancialPaymentServiceImpl implements FinancialPaymentService {
|
||||
processInstanceExtMapper.updateByProcessInstanceId(instanceExtDO);
|
||||
}
|
||||
this.updateById(financialPayment);
|
||||
|
||||
// 判断是借支申请时
|
||||
if (financialPayment.getType() == 7 && financialPayment.getStatus() == 2) {
|
||||
|
||||
// 获取借支信息
|
||||
BpmOALoanDO loanDO = loanMapper.selectById(financialPayment.getObjectId());
|
||||
|
||||
// 同步插入借支表中
|
||||
LoanDTO createDO = new LoanDTO()
|
||||
.setUserId(loanDO.getSfUserId())
|
||||
.setDeptId(loanDO.getFactoryId())
|
||||
.setAmount(loanDO.getTotalMoney())
|
||||
.setReturnAmount(BigDecimal.ZERO);
|
||||
loanApi.createLoan(createDO);
|
||||
}
|
||||
|
||||
// -- 获取发起人的openId
|
||||
AdminOauthUserOtherInfoApiVO item = adminOauthUserOtherInfoApi.getByCondition(
|
||||
new AdminOauthUserOtherInfoApiDTO().setUserIds(Collections.singletonList(financialPayment.getUserId()))
|
||||
|
@ -1,7 +1,5 @@
|
||||
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.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.bpm.api.task.BpmProcessInstanceApi;
|
||||
@ -9,37 +7,29 @@ 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.BpmOAExpensesRespVO;
|
||||
import cn.iocoder.yudao.module.bpm.convert.oa.BpmOAExpensesConvert;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.financialpayment.FinancialPaymentDO;
|
||||
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.bpm.dal.dataobject.task.BpmProcessInstanceExtDO;
|
||||
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.financialpayment.FinancialPaymentService;
|
||||
import cn.iocoder.yudao.module.bpm.service.task.BpmHistoryProcessInstanceService;
|
||||
import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService;
|
||||
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.user.AdminUserApi;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import org.flowable.engine.runtime.ProcessInstance;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
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;
|
||||
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.convertMap;
|
||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
|
||||
import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.OA_EXPENSES_NOT_EXISTS;
|
||||
|
||||
@ -66,22 +56,12 @@ public class BpmOAExpensesServiceImpl extends BpmOABaseService implements BpmOAE
|
||||
@Resource
|
||||
private BpmProcessInstanceApi processInstanceApi;
|
||||
|
||||
@Resource
|
||||
@Lazy // 解决循环依赖
|
||||
private BpmProcessInstanceService bpmProcessInstanceService;
|
||||
|
||||
@Resource
|
||||
private FinancialPaymentService financialPaymentService;
|
||||
|
||||
@Resource
|
||||
private DeptApi deptApi;
|
||||
|
||||
@Resource
|
||||
private BankApi bankApi;
|
||||
|
||||
@Resource
|
||||
private AdminUserApi userApi;
|
||||
|
||||
@Resource
|
||||
@Lazy // 解决循环依赖
|
||||
private BpmHistoryProcessInstanceService historyProcessInstanceService;
|
||||
@ -131,41 +111,6 @@ public class BpmOAExpensesServiceImpl extends BpmOABaseService implements BpmOAE
|
||||
BpmOAExpensesDO expenses = validateLeaveExists(id);
|
||||
|
||||
expensesMapper.updateById(new BpmOAExpensesDO().setId(id).setResult(result));
|
||||
|
||||
// 获取现金支出明细
|
||||
List<BpmOAExpensesItemDO> expensesItemDOs = getExpensesItem(id);
|
||||
|
||||
List<Long> procureIds = new ArrayList<>();
|
||||
//审核通过 (最后节点)
|
||||
if (BpmProcessInstanceResultEnum.APPROVE.getResult().equals(result)) {
|
||||
|
||||
ProcessInstance instance = bpmProcessInstanceService.getProcessInstance(processInstanceId);
|
||||
|
||||
if (instance.isEnded()) {
|
||||
|
||||
String reason = expensesItemDOs.stream()
|
||||
.map(BpmOAExpensesItemDO::getDetail)
|
||||
.filter(StrUtil::isNotEmpty)
|
||||
.collect(Collectors.joining(","));
|
||||
|
||||
BpmProcessInstanceExtDO processInstance = bpmProcessInstanceService.getProcessInstanceDO(processInstanceId);
|
||||
CommonResult<AdminUserRespDTO> user = userApi.getUser(expenses.getUserId());
|
||||
// -- 插入到财务支付表中
|
||||
financialPaymentService.save(new FinancialPaymentDO()
|
||||
.setUserId(expenses.getUserId())
|
||||
.setDeptId(user.getData() == null ? null : user.getData().getDeptId())
|
||||
.setProcessInstanceId(expenses.getProcessInstanceId())
|
||||
.setProcessInstanceName(processInstance.getName())
|
||||
.setReason(reason)
|
||||
.setObjectId(id)
|
||||
.setType(6)
|
||||
.setStatus(0)
|
||||
.setAmountPayable(expenses.getTotalMoney())
|
||||
.setBeginTime(processInstance.getCreateTime())
|
||||
.setEndTime(processInstance.getEndTime())
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private BpmOAExpensesDO validateLeaveExists(Long id) {
|
||||
@ -207,7 +152,8 @@ public class BpmOAExpensesServiceImpl extends BpmOABaseService implements BpmOAE
|
||||
List<BpmOAExpensesItemDO> expensesItemDOs = getExpensesItem(expenses.getId());
|
||||
|
||||
//获取部门信息map
|
||||
Map<Long, DeptRespDTO> deptMap = deptApi.getDeptMap(convertSet(expensesItemDOs, BpmOAExpensesItemDO::getDeptId));
|
||||
List<DeptRespDTO> deptList = deptApi.getDeptByFactoryIds(convertSet(expensesItemDOs, BpmOAExpensesItemDO::getDeptId)).getCheckedData();
|
||||
Map<Long, DeptRespDTO> deptMap = convertMap(deptList, DeptRespDTO::getFactoryId);
|
||||
|
||||
// 获取银行卡信息
|
||||
BankRespDTO bankRespDTO = null;
|
||||
|
@ -1,11 +1,11 @@
|
||||
package cn.iocoder.yudao.module.bpm.service.oa;
|
||||
|
||||
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.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.imprest.BpmOAImprestCreateReqVO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.UploadUserFile;
|
||||
import cn.iocoder.yudao.module.bpm.convert.oa.BpmOAImprestConvert;
|
||||
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.task.BpmProcessInstanceExtDO;
|
||||
@ -23,7 +23,6 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -65,7 +64,8 @@ public class BpmOAImprestServiceImpl extends BpmOABaseService implements BpmOAIm
|
||||
public Long createImprest(Long userId, BpmOAImprestCreateReqVO createReqVO) {
|
||||
|
||||
//插入OA 备用金申请
|
||||
BpmOAImprestDO imprest = BpmOAImprestConvert.INSTANCE.convert(createReqVO).setUserId(userId)
|
||||
BpmOAImprestDO imprest = BeanUtils.toBean(createReqVO, BpmOAImprestDO.class)
|
||||
.setUserId(userId)
|
||||
.setStatus(BpmOAImprestDO.FLAG_FALSE)
|
||||
.setResult(BpmProcessInstanceResultEnum.PROCESS.getResult());
|
||||
imprestMapper.insert(imprest);
|
||||
|
@ -1,25 +1,28 @@
|
||||
package cn.iocoder.yudao.module.bpm.service.oa;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
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.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;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOALoanDO;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.task.BpmProcessInstanceExtDO;
|
||||
import cn.iocoder.yudao.module.bpm.dal.mysql.oa.BpmOALoanMapper;
|
||||
import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceResultEnum;
|
||||
import cn.iocoder.yudao.module.bpm.service.financialpayment.FinancialPaymentService;
|
||||
import cn.iocoder.yudao.module.bpm.service.task.BpmHistoryProcessInstanceService;
|
||||
import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService;
|
||||
import cn.iocoder.yudao.module.system.api.loan.LoanApi;
|
||||
import cn.iocoder.yudao.module.system.api.loan.dto.LoanDTO;
|
||||
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
||||
import org.flowable.engine.runtime.ProcessInstance;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -51,7 +54,10 @@ public class BpmOALoanServiceImpl extends BpmOABaseService implements BpmOALoanS
|
||||
private BpmHistoryProcessInstanceService historyProcessInstanceService;
|
||||
|
||||
@Resource
|
||||
private LoanApi loanApi;
|
||||
private AdminUserApi userApi;
|
||||
|
||||
@Resource
|
||||
private FinancialPaymentService financialPaymentService;
|
||||
|
||||
|
||||
@Override
|
||||
@ -93,14 +99,24 @@ public class BpmOALoanServiceImpl extends BpmOABaseService implements BpmOALoanS
|
||||
if (BpmProcessInstanceResultEnum.APPROVE.getResult().equals(result)) {
|
||||
|
||||
ProcessInstance instance = processInstanceService.getProcessInstance(processInstanceId);
|
||||
|
||||
if (instance.isEnded()) {
|
||||
|
||||
// 同步插入借支表中
|
||||
LoanDTO createDO = new LoanDTO()
|
||||
.setAmount(loanDO.getTotalMoney())
|
||||
.setReturnAmount(BigDecimal.ZERO);
|
||||
loanApi.createLoan(createDO);
|
||||
BpmProcessInstanceExtDO processInstance = processInstanceService.getProcessInstanceDO(processInstanceId);
|
||||
// -- 插入到财务支付表中
|
||||
CommonResult<AdminUserRespDTO> user = userApi.getUser(loanDO.getUserId());
|
||||
financialPaymentService.save(new FinancialPaymentDO()
|
||||
.setUserId(loanDO.getUserId())
|
||||
.setDeptId(user.getData() == null ? null : user.getData().getDeptId())
|
||||
.setProcessInstanceId(loanDO.getProcessInstanceId())
|
||||
.setReason("")
|
||||
.setObjectId(id)
|
||||
.setType(7)
|
||||
.setStatus(0)
|
||||
.setAmountPayable(loanDO.getTotalMoney())
|
||||
.setProcessInstanceName(processInstance.getName())
|
||||
.setBeginTime(processInstance.getCreateTime())
|
||||
.setEndTime(processInstance.getEndTime())
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.bpm.service.oa;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.iocoder.yudao.framework.common.enums.DeptTypeEnum;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.UploadUserFile;
|
||||
@ -34,6 +35,7 @@ import java.util.*;
|
||||
|
||||
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.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.OA_PAYMENT_FILES_NOT_NULL;
|
||||
import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.OA_PAYMENT_NOT_EXISTS;
|
||||
|
||||
@ -157,7 +159,17 @@ public class BpmOAPaymentServiceImpl extends BpmOABaseService implements BpmOAPa
|
||||
@Override
|
||||
public List<BpmOAPaymentRespVO> getPaymentList(Integer type) {
|
||||
|
||||
return paymentMapper.selectPaymentList(type);
|
||||
int method = 0;
|
||||
// 获取发起人的部门信息
|
||||
AdminUserRespDTO userDTO = userApi.getUser(getLoginUserId()).getCheckedData();
|
||||
DeptRespDTO deptDTO = deptApi.getDept(userDTO.getDeptId()).getCheckedData();
|
||||
|
||||
// 判断财务部门时,查询全部分批记录
|
||||
if (deptDTO != null && deptDTO.getType().equals(DeptTypeEnum.FINANCE_DEPT.getValue())) {
|
||||
method = 1;
|
||||
}
|
||||
|
||||
return paymentMapper.selectPaymentList(type, userDTO.getDeptId(), method);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -161,7 +161,7 @@ public class BpmOASupplierPurchasePaymentServiceImpl extends BpmOABaseService im
|
||||
.setProcessInstanceId(supplierPurchasePaymentDO.getProcessInstanceId())
|
||||
.setReason(supplierPurchasePaymentDO.getRemark())
|
||||
.setObjectId(id)
|
||||
.setType(5)
|
||||
.setType(8)
|
||||
.setStatus(0)
|
||||
.setAmountPayable(supplierPurchasePaymentDO.getTotalMoney())
|
||||
.setProcessInstanceName(processInstance.getName())
|
||||
|
File diff suppressed because one or more lines are too long
@ -13,10 +13,21 @@
|
||||
<select id="selectPaymentList" resultType="cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.payment.BpmOAPaymentRespVO">
|
||||
SELECT
|
||||
a.*,
|
||||
d.name as deptName,
|
||||
bank.nickname as nickname,
|
||||
bank.bank_no as bankNo,
|
||||
bank.bank_name as bankName,
|
||||
COALESCE(SUM( b.payment_ratio ), 0) + COALESCE(a.payment_ratio,0) AS ratio
|
||||
FROM
|
||||
bpm_oa_payment a
|
||||
<if test="method != 1">
|
||||
INNER JOIN system_users u
|
||||
ON u.id = a.user_id
|
||||
AND u.dept_id = #{deptId}
|
||||
</if>
|
||||
LEFT JOIN bpm_oa_payment b ON b.parent_id = a.id AND b.result = 2
|
||||
LEFT JOIN system_dept d ON d.id = a.dept_id
|
||||
LEFT JOIN system_bank bank ON bank.id = a.bank_id
|
||||
WHERE
|
||||
ISNULL( a.parent_id )
|
||||
AND a.result = 2
|
||||
|
@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.hrm.api.crmbusiness;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.hrm.api.crmbusiness.dto.CrmBusinessDTO;
|
||||
import cn.iocoder.yudao.module.hrm.api.crmbusiness.dto.CrmBusinessProductDTO;
|
||||
import cn.iocoder.yudao.module.hrm.enums.ApiConstants;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
@ -10,6 +11,8 @@ import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿:fallbackFactory =
|
||||
@Tag(name = "RPC 服务 - 流程实例")
|
||||
public interface BusinessApi {
|
||||
@ -20,4 +23,9 @@ public interface BusinessApi {
|
||||
@Operation(summary = "获得商机信息")
|
||||
@Parameter(name = "id", description = "ID", required = true)
|
||||
CommonResult<CrmBusinessDTO> getBusiness(@RequestParam("id") Long id);
|
||||
|
||||
@GetMapping(PREFIX + "/getByBusinessId")
|
||||
@Operation(summary = "获得商机所绑定产品信息")
|
||||
@Parameter(name = "businessId", description = "商机编号", required = true)
|
||||
CommonResult<List<CrmBusinessProductDTO>> getBusinessProduct(@RequestParam("businessId") Long businessId);
|
||||
}
|
||||
|
@ -0,0 +1,38 @@
|
||||
package cn.iocoder.yudao.module.hrm.api.crmbusiness.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Schema(description = "RPC 服务 - 商机产品关联 Response DTO")
|
||||
@Data
|
||||
public class CrmBusinessProductDTO {
|
||||
|
||||
@Schema(description = "编号")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "商机id")
|
||||
private Long businessId;
|
||||
|
||||
@Schema(description = "产品id")
|
||||
private Long productId;
|
||||
|
||||
@Schema(description = "商品名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "商品属性")
|
||||
private String productAttrUnique;
|
||||
|
||||
@Schema(description = "单价")
|
||||
private BigDecimal price;
|
||||
|
||||
@Schema(description = "数量")
|
||||
private Integer nums;
|
||||
|
||||
@Schema(description = "小计")
|
||||
private BigDecimal subtotal;
|
||||
|
||||
@Schema(description = "备注")
|
||||
private String remarks;
|
||||
}
|
@ -3,14 +3,18 @@ package cn.iocoder.yudao.module.crm.api.crmbusiness;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.crmbusiness.vo.CrmBusinessRespVO;
|
||||
import cn.iocoder.yudao.module.crm.dal.dataobject.crmbusiness.CrmBusinessProductDO;
|
||||
import cn.iocoder.yudao.module.crm.service.crmbusiness.CrmBusinessService;
|
||||
import cn.iocoder.yudao.module.hrm.api.crmbusiness.BusinessApi;
|
||||
import cn.iocoder.yudao.module.hrm.api.crmbusiness.dto.CrmBusinessDTO;
|
||||
import cn.iocoder.yudao.module.hrm.api.crmbusiness.dto.CrmBusinessProductDTO;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
/**
|
||||
@ -28,4 +32,10 @@ public class BusinessApiImpl implements BusinessApi {
|
||||
CrmBusinessRespVO businessDO = businessService.getBusiness(id);
|
||||
return success(BeanUtils.toBean(businessDO, CrmBusinessDTO.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<List<CrmBusinessProductDTO>> getBusinessProduct(Long businessId) {
|
||||
List<CrmBusinessProductDO> businessProductList = businessService.getBusinessProductListByBusinessId(businessId);
|
||||
return success(BeanUtils.toBean(businessProductList, CrmBusinessProductDTO.class));
|
||||
}
|
||||
}
|
||||
|
@ -55,8 +55,4 @@ public class AchievementController {
|
||||
public CommonResult<List<SalesVO>> getSales(@RequestParam(name = "relation",defaultValue = "my",required=false) String relation) {
|
||||
return success(achievementService.getSales(relation));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -10,7 +10,6 @@ import cn.iocoder.yudao.module.crm.service.crmbusiness.CrmBusinessService;
|
||||
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.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
@ -1,33 +1,33 @@
|
||||
package cn.iocoder.yudao.module.crm.controller.admin.userlivetree;
|
||||
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
import javax.validation.*;
|
||||
import javax.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
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.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.userlivetree.vo.*;
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.userlivetree.vo.UserLiveTreeListVO;
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.userlivetree.vo.UserLiveTreePageReqVO;
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.userlivetree.vo.UserLiveTreeRespVO;
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.userlivetree.vo.UserLiveTreeSaveReqVO;
|
||||
import cn.iocoder.yudao.module.crm.dal.dataobject.userlivetree.UserLiveTreeDO;
|
||||
import cn.iocoder.yudao.module.crm.service.userlivetree.UserLiveTreeService;
|
||||
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
||||
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.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||
|
||||
@Tag(name = "管理后台 - crm用户结构树")
|
||||
@RestController
|
||||
@ -38,6 +38,9 @@ public class UserLiveTreeController {
|
||||
@Resource
|
||||
private UserLiveTreeService userLiveTreeService;
|
||||
|
||||
@Resource
|
||||
private AdminUserApi userApi;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建crm用户结构树")
|
||||
@PreAuthorize("@ss.hasPermission('crm:user-live-tree:create')")
|
||||
@ -46,10 +49,10 @@ public class UserLiveTreeController {
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/list")
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "crm用户结构树列表")
|
||||
public CommonResult<List<UserLiveTreeListVO>> userLiveTreeList(@Valid @RequestBody UserLiveTreePageReqVO pageReqVO) {
|
||||
return success(userLiveTreeService.userLiveTreeList(pageReqVO));
|
||||
public CommonResult<List<UserLiveTreeListVO>> userLiveTreeList() {
|
||||
return success(userLiveTreeService.userLiveTreeList());
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@ -81,9 +84,9 @@ public class UserLiveTreeController {
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得crm用户结构树分页")
|
||||
@PreAuthorize("@ss.hasPermission('crm:user-live-tree:query')")
|
||||
public CommonResult<PageResult<UserLiveTreeRespVO>> getUserLiveTreePage(@Valid UserLiveTreePageReqVO pageReqVO) {
|
||||
PageResult<UserLiveTreeDO> pageResult = userLiveTreeService.getUserLiveTreePage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, UserLiveTreeRespVO.class));
|
||||
public CommonResult<PageResult<UserLiveTreeListVO>> getUserLiveTreePage(@Valid UserLiveTreePageReqVO pageReqVO) {
|
||||
|
||||
return success(userLiveTreeService.getUserLiveTreePage(pageReqVO));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@ -93,7 +96,7 @@ public class UserLiveTreeController {
|
||||
public void exportUserLiveTreeExcel(@Valid UserLiveTreePageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<UserLiveTreeDO> list = userLiveTreeService.getUserLiveTreePage(pageReqVO).getList();
|
||||
List<UserLiveTreeListVO> list = userLiveTreeService.getUserLiveTreePage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "crm用户结构树.xls", "数据", UserLiveTreeRespVO.class,
|
||||
BeanUtils.toBean(list, UserLiveTreeRespVO.class));
|
||||
|
@ -41,6 +41,4 @@ public interface AchievementService {
|
||||
* @return
|
||||
*/
|
||||
List<SalesVO> getSales(String relation);
|
||||
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,8 @@ import cn.iocoder.yudao.module.bpm.api.oa.vo.contract.ContractStatisticsDTO;
|
||||
import cn.iocoder.yudao.module.bpm.api.oa.vo.receipt.ReceiptStatisticsDTO;
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.crmanalysis.vo.*;
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.crmclues.vo.CrmCluesStatisticsRespVO;
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.userlivetree.vo.UserLiveTreeListVO;
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.userlivetree.vo.UserLiveTreePageReqVO;
|
||||
import cn.iocoder.yudao.module.crm.dal.dataobject.crmachievement.CrmAchievementDO;
|
||||
import cn.iocoder.yudao.module.crm.dal.dataobject.crmbusiness.CrmBusinessDO;
|
||||
import cn.iocoder.yudao.module.crm.dal.dataobject.crmclues.CrmCluesDO;
|
||||
@ -36,8 +38,6 @@ import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
||||
import cn.iocoder.yudao.module.system.api.dept.dto.DeptApiDTO;
|
||||
import cn.iocoder.yudao.module.system.api.dept.dto.DeptApiVO;
|
||||
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserApiVO;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserPageApiDTO;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -91,15 +91,15 @@ public class AchievementServiceImpl implements AchievementService {
|
||||
|
||||
@Override
|
||||
public PageResult<UserAchieveVO> getAchievementPage(AchievementPageReqVO pageReqVO) {
|
||||
AdminUserPageApiDTO dto = new AdminUserPageApiDTO();
|
||||
dto.setNickname(pageReqVO.getName());
|
||||
dto.setPageNo(pageReqVO.getPageNo());
|
||||
dto.setPageSize(pageReqVO.getPageSize());
|
||||
dto.setRoleCodes("sale"); // 设置查询用户的角色类型
|
||||
|
||||
// 获取销售角色 分页列表
|
||||
PageResult<AdminUserApiVO> pageResult = adminUserApi.getUserPageByRole(dto).getCheckedData();
|
||||
PageResult<UserAchieveVO> pageResult1 = BeanUtils.toBean(pageResult, UserAchieveVO.class);
|
||||
PageResult<UserLiveTreeListVO> pageResult = userLiveTreeService.getUserLiveTreePage(new UserLiveTreePageReqVO());
|
||||
List<UserAchieveVO> achieveVOS = pageResult.getList().stream()
|
||||
.map(v -> new UserAchieveVO()
|
||||
.setId(v.getUserId())
|
||||
.setNickname(v.getNickname()))
|
||||
.collect(Collectors.toList());
|
||||
PageResult<UserAchieveVO> pageResult1 = new PageResult<>(achieveVOS, pageResult.getTotal());
|
||||
|
||||
if (CollUtil.isNotEmpty(pageResult1.getList())) {
|
||||
|
||||
|
@ -4,21 +4,20 @@ import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.iocoder.yudao.framework.common.enums.ShopCommonEnum;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.crmanalysis.vo.AchievementPageReqVO;
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.crmanalysis.vo.CustomerLevelVO;
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.crmanalysis.vo.UserRecordVO;
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.crmanalysis.vo.UserVolumeVO;
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.crmcustomer.vo.CustomerStatisticRespVO;
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.crmrecord.vo.RecordStatisticsRespVO;
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.userlivetree.vo.UserLiveTreeListVO;
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.userlivetree.vo.UserLiveTreePageReqVO;
|
||||
import cn.iocoder.yudao.module.crm.dal.dataobject.crmcustomer.CrmCustomerDO;
|
||||
import cn.iocoder.yudao.module.crm.dal.mysql.crmcustomer.CrmCustomerMapper;
|
||||
import cn.iocoder.yudao.module.crm.service.crmrecord.CrmRecordService;
|
||||
import cn.iocoder.yudao.module.crm.service.userlivetree.UserLiveTreeService;
|
||||
import cn.iocoder.yudao.module.system.api.dict.DictDataApi;
|
||||
import cn.iocoder.yudao.module.system.api.dict.dto.DictDataRespDTO;
|
||||
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserApiVO;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserPageApiDTO;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@ -46,15 +45,15 @@ public class CustomerServiceImpl implements CustomerService {
|
||||
@Resource
|
||||
private DictDataApi dictDataApi;
|
||||
|
||||
@Resource
|
||||
private AdminUserApi adminUserApi;
|
||||
|
||||
@Resource
|
||||
private CrmCustomerMapper customerMapper;
|
||||
|
||||
@Resource
|
||||
private CrmRecordService recordService;
|
||||
|
||||
@Resource
|
||||
private UserLiveTreeService userLiveTreeService;
|
||||
|
||||
@Override
|
||||
public CustomerLevelVO getCustomerLevel() {
|
||||
List<DictDataRespDTO> list = dictDataApi.getDictDataList("customer_level").getCheckedData();
|
||||
@ -120,14 +119,15 @@ public class CustomerServiceImpl implements CustomerService {
|
||||
@Override
|
||||
public PageResult<UserVolumeVO> getCustomerVolume(AchievementPageReqVO pageReqVO) {
|
||||
|
||||
AdminUserPageApiDTO dto = new AdminUserPageApiDTO();
|
||||
dto.setNickname(pageReqVO.getName());
|
||||
dto.setPageNo(pageReqVO.getPageNo());
|
||||
dto.setPageSize(pageReqVO.getPageSize());
|
||||
dto.setRoleCodes("sale"); // 设置查询用户的角色类型
|
||||
// 获取销售角色 分页列表
|
||||
PageResult<UserLiveTreeListVO> pageResult = userLiveTreeService.getUserLiveTreePage(new UserLiveTreePageReqVO());
|
||||
List<UserVolumeVO> volumeVOS = pageResult.getList().stream()
|
||||
.map(v -> new UserVolumeVO()
|
||||
.setId(v.getUserId())
|
||||
.setNickname(v.getNickname()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
PageResult<AdminUserApiVO> pageResult = adminUserApi.getUserPageByRole(dto).getCheckedData();
|
||||
PageResult<UserVolumeVO> pageResult1 = BeanUtils.toBean(pageResult, UserVolumeVO.class);
|
||||
PageResult<UserVolumeVO> pageResult1 = new PageResult<>(volumeVOS, pageResult.getTotal());
|
||||
if (CollectionUtil.isNotEmpty(pageResult1.getList())) {
|
||||
|
||||
List<Long> userIds = convertList(pageResult1.getList(), UserVolumeVO::getId);
|
||||
@ -160,14 +160,16 @@ public class CustomerServiceImpl implements CustomerService {
|
||||
|
||||
@Override
|
||||
public PageResult<UserRecordVO> getRecord(AchievementPageReqVO pageReqVO) {
|
||||
AdminUserPageApiDTO dto = new AdminUserPageApiDTO();
|
||||
dto.setNickname(pageReqVO.getName());
|
||||
dto.setPageNo(pageReqVO.getPageNo());
|
||||
dto.setPageSize(pageReqVO.getPageSize());
|
||||
dto.setRoleCodes("sale"); // 设置查询用户的角色类型
|
||||
|
||||
PageResult<AdminUserApiVO> pageResult = adminUserApi.getUserPageByRole(dto).getCheckedData();
|
||||
PageResult<UserRecordVO> pageResult1 = BeanUtils.toBean(pageResult, UserRecordVO.class);
|
||||
// 获取销售角色 分页列表
|
||||
PageResult<UserLiveTreeListVO> pageResult = userLiveTreeService.getUserLiveTreePage(new UserLiveTreePageReqVO());
|
||||
List<UserRecordVO> recordVOS = pageResult.getList().stream()
|
||||
.map(v -> new UserRecordVO()
|
||||
.setId(v.getUserId())
|
||||
.setNickname(v.getNickname()))
|
||||
.collect(Collectors.toList());
|
||||
PageResult<UserRecordVO> pageResult1 = new PageResult<>(recordVOS, pageResult.getTotal());
|
||||
|
||||
if (CollectionUtil.isNotEmpty(pageResult1.getList())) {
|
||||
// 获取所有用户跟进统计列表
|
||||
List<Long> userIds = convertList(pageResult1.getList(), UserRecordVO::getId);
|
||||
|
@ -52,15 +52,14 @@ public interface UserLiveTreeService {
|
||||
* @param pageReqVO 分页查询
|
||||
* @return crm用户结构树分页
|
||||
*/
|
||||
PageResult<UserLiveTreeDO> getUserLiveTreePage(UserLiveTreePageReqVO pageReqVO);
|
||||
PageResult<UserLiveTreeListVO> getUserLiveTreePage(UserLiveTreePageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 获取列表
|
||||
*
|
||||
* @param pageReqVO
|
||||
* @return
|
||||
* @return 用户列表
|
||||
*/
|
||||
List<UserLiveTreeListVO> userLiveTreeList(@Valid UserLiveTreePageReqVO pageReqVO);
|
||||
List<UserLiveTreeListVO> userLiveTreeList();
|
||||
|
||||
/**
|
||||
* 通过用户id获取所有子集用户id
|
||||
@ -69,4 +68,10 @@ public interface UserLiveTreeService {
|
||||
* @return
|
||||
*/
|
||||
List<Long> getItemIdsByUserId(Long id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有用户列表
|
||||
* @return 用户列表
|
||||
*/
|
||||
List<UserLiveTreeListVO> getUserLiveList();
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
package cn.iocoder.yudao.module.crm.service.userlivetree;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
@ -8,16 +9,17 @@ import cn.iocoder.yudao.module.crm.controller.admin.userlivetree.vo.UserLiveTree
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.userlivetree.vo.UserLiveTreeSaveReqVO;
|
||||
import cn.iocoder.yudao.module.crm.dal.dataobject.userlivetree.UserLiveTreeDO;
|
||||
import cn.iocoder.yudao.module.crm.dal.mysql.userlivetree.UserLiveTreeMapper;
|
||||
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
|
||||
|
||||
/**
|
||||
* crm用户结构树 Service 实现类
|
||||
*
|
||||
@ -30,6 +32,9 @@ public class UserLiveTreeServiceImpl implements UserLiveTreeService {
|
||||
@Resource
|
||||
private UserLiveTreeMapper userLiveTreeMapper;
|
||||
|
||||
@Resource
|
||||
private AdminUserApi userApi;
|
||||
|
||||
|
||||
@Override
|
||||
public Long createUserLiveTree(UserLiveTreeSaveReqVO createReqVO) {
|
||||
@ -59,13 +64,25 @@ public class UserLiveTreeServiceImpl implements UserLiveTreeService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<UserLiveTreeDO> getUserLiveTreePage(UserLiveTreePageReqVO pageReqVO) {
|
||||
return userLiveTreeMapper.selectPage(pageReqVO);
|
||||
public PageResult<UserLiveTreeListVO> getUserLiveTreePage(UserLiveTreePageReqVO pageReqVO) {
|
||||
|
||||
PageResult<UserLiveTreeListVO> pageResult = BeanUtils.toBean(userLiveTreeMapper.selectPage(pageReqVO), UserLiveTreeListVO.class);
|
||||
if (CollUtil.isNotEmpty(pageResult.getList())) {
|
||||
// 获取用户编号
|
||||
Set<Long> userIds = convertSet(pageResult.getList(), UserLiveTreeListVO::getUserId);
|
||||
// 获取用户信息
|
||||
Map<Long, AdminUserRespDTO> userMap = userApi.getUserMap(userIds);
|
||||
|
||||
pageResult.getList().forEach(item -> {
|
||||
item.setNickname(userMap.get(item.getUserId()) != null ? userMap.get(item.getUserId()).getNickname() : null);
|
||||
});
|
||||
}
|
||||
return pageResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserLiveTreeListVO> userLiveTreeList(UserLiveTreePageReqVO pageReqVO) {
|
||||
List<UserLiveTreeListVO> userLiveTreeDOS = this.userLiveTreeList();
|
||||
public List<UserLiveTreeListVO> userLiveTreeList() {
|
||||
List<UserLiveTreeListVO> userLiveTreeDOS = this.getUserLiveTreeList();
|
||||
return userLiveTreeDOS.stream()
|
||||
.filter(vo -> vo.getPid() == 0)
|
||||
.collect(Collectors.toList());
|
||||
@ -73,7 +90,7 @@ public class UserLiveTreeServiceImpl implements UserLiveTreeService {
|
||||
|
||||
@Override
|
||||
public List<Long> getItemIdsByUserId(Long userId) {
|
||||
List<UserLiveTreeListVO> userLiveTreeListVOS = this.userLiveTreeList();
|
||||
List<UserLiveTreeListVO> userLiveTreeListVOS = this.getUserLiveTreeList();
|
||||
Map<Long, List<UserLiveTreeListVO>> map = userLiveTreeListVOS.stream().collect(Collectors.groupingBy(UserLiveTreeListVO::getUserId));
|
||||
List<UserLiveTreeListVO> list = map.get(userId);
|
||||
List<Long> ids = new ArrayList<>();
|
||||
@ -96,7 +113,13 @@ public class UserLiveTreeServiceImpl implements UserLiveTreeService {
|
||||
recursionGetId(nextList, ids);
|
||||
}
|
||||
|
||||
public List<UserLiveTreeListVO> userLiveTreeList(){
|
||||
@Override
|
||||
public List<UserLiveTreeListVO> getUserLiveList() {
|
||||
// -- 这里将所有的数据拉出来 -
|
||||
return userLiveTreeMapper.userLiveTreeList();
|
||||
}
|
||||
|
||||
public List<UserLiveTreeListVO> getUserLiveTreeList(){
|
||||
// -- 这里将所有的数据拉出来 -
|
||||
List<UserLiveTreeListVO> userLiveTreeDOS = userLiveTreeMapper.userLiveTreeList();
|
||||
// 1. 按父ID分组,获取每个父节点下的子节点列表
|
||||
|
@ -110,6 +110,12 @@
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-monitor</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-module-crm-api</artifactId>
|
||||
<version>2.0.0-jdk8-snapshot</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
@ -1,8 +1,11 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.storeproduct;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.yudao.module.hrm.api.crmbusiness.BusinessApi;
|
||||
import cn.iocoder.yudao.module.hrm.api.crmbusiness.dto.CrmBusinessProductDTO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.storeproduct.vo.*;
|
||||
import cn.iocoder.yudao.module.product.convert.storeproduct.StoreProductConvert;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.storeproduct.StoreProductDO;
|
||||
@ -25,8 +28,10 @@ import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
|
||||
|
||||
@Tag(name = "管理后台 - 商品")
|
||||
@RestController
|
||||
@ -39,6 +44,8 @@ public class StoreProductController {
|
||||
@Resource
|
||||
private StoreProductAttrValueService storeProductAttrValueService;
|
||||
|
||||
@Resource
|
||||
private BusinessApi businessApi;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建商品")
|
||||
@ -83,6 +90,25 @@ public class StoreProductController {
|
||||
return success(StoreProductConvert.INSTANCE.convertList(list));
|
||||
}
|
||||
|
||||
@GetMapping("/listByBusinessId")
|
||||
@Operation(summary = "获得指定商机的商品列表")
|
||||
@Parameter(name = "businessId", description = "商机ID", required = true, example = "1024,2048")
|
||||
@PreAuthorize("@ss.hasPermission('shop:store-product:query')")
|
||||
public CommonResult<List<StoreProductRespVO>> getStoreProductList(@RequestParam("businessId") Long businessId) {
|
||||
|
||||
// 获取商机绑定产品的信息
|
||||
List<CrmBusinessProductDTO> businessProductList = businessApi.getBusinessProduct(businessId).getCheckedData();
|
||||
// 获取产品编号
|
||||
Set<Long> ids = convertSet(businessProductList, CrmBusinessProductDTO::getProductId);
|
||||
|
||||
if (CollUtil.isNotEmpty(ids)) {
|
||||
List<StoreProductDO> list = storeProductService.getStoreProductList(ids);
|
||||
return success(StoreProductConvert.INSTANCE.convertList(list));
|
||||
}else {
|
||||
return success(CollUtil.newArrayList());
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得商品分页")
|
||||
@PreAuthorize("@ss.hasPermission('shop:store-product:query')")
|
||||
|
@ -28,8 +28,8 @@ public class StoreProductPageReqVO extends PageParam {
|
||||
@Schema(description = "库存售罄", example = "0")
|
||||
private String stock;
|
||||
|
||||
@Schema(description = "库存售罄", example = "0")
|
||||
private String cateId;
|
||||
@Schema(description = "商品分类id", example = "0")
|
||||
private String goodsCateId;
|
||||
|
||||
private List<Long> catIds;
|
||||
|
||||
|
@ -27,7 +27,7 @@ public interface StoreProductMapper extends BaseMapperX<StoreProductDO> {
|
||||
wrapper.likeIfPresent(StoreProductDO::getStoreName, reqVO.getStoreName())
|
||||
.likeIfPresent(StoreProductDO::getShopName, reqVO.getShopName())
|
||||
.eqIfPresent(StoreProductDO::getIsPostage, reqVO.getIsPostage())
|
||||
.eqIfPresent(StoreProductDO::getCateId, reqVO.getCateId())
|
||||
.eqIfPresent(StoreProductDO::getCateId, reqVO.getGoodsCateId())
|
||||
.orderByDesc(StoreProductDO::getId);
|
||||
|
||||
wrapper.eq(StoreProductDO::getIsShow, Convert.toInt(reqVO.getIsShow()));
|
||||
|
@ -1,11 +1,12 @@
|
||||
package cn.iocoder.yudao.module.product.framework.rpc.config;
|
||||
|
||||
import cn.iocoder.yudao.module.hrm.api.crmbusiness.BusinessApi;
|
||||
import cn.iocoder.yudao.module.member.api.level.MemberLevelApi;
|
||||
import cn.iocoder.yudao.module.member.api.user.MemberUserApi;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@EnableFeignClients(clients = {MemberUserApi.class, MemberLevelApi.class})
|
||||
@EnableFeignClients(clients = {MemberUserApi.class, MemberLevelApi.class, BusinessApi.class})
|
||||
public class RpcConfiguration {
|
||||
}
|
||||
|
@ -68,11 +68,16 @@ public interface DeptApi {
|
||||
@Parameter(name = "factoryId", description = "工厂编号", example = "100001", required = true)
|
||||
void deleteDept(@RequestParam("factoryId") Long factoryId);
|
||||
|
||||
@PostMapping(PREFIX + "/getByFactoryId")
|
||||
@GetMapping(PREFIX + "/getByFactoryId")
|
||||
@Operation(summary = "根据工厂ID获得部门信息")
|
||||
@Parameter(name = "factoryId", description = "工厂编号", example = "100001", required = true)
|
||||
CommonResult<DeptRespDTO> getDeptByFactoryId(@RequestParam("factoryId") Long factoryId);
|
||||
|
||||
@GetMapping(PREFIX + "/getByFactoryIds")
|
||||
@Operation(summary = "根据工厂ID获得部门信息")
|
||||
@Parameter(name = "factoryIds", description = "工厂编号", example = "100001", required = true)
|
||||
CommonResult<List<DeptRespDTO>> getDeptByFactoryIds(@RequestParam("factoryIds") Collection<Long> factoryIds);
|
||||
|
||||
|
||||
/**
|
||||
* 获得指定编号的部门 Map
|
||||
|
@ -108,6 +108,14 @@ public class DeptApiImpl implements DeptApi {
|
||||
return success(BeanUtils.toBean(deptDO, DeptRespDTO.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
@DataPermission(enable = false)
|
||||
public CommonResult<List<DeptRespDTO>> getDeptByFactoryIds(Collection<Long> factoryIds) {
|
||||
|
||||
List<DeptDO> deptDOS = deptService.getDeptListByFactoryIds(factoryIds);
|
||||
return success(BeanUtils.toBean(deptDOS, DeptRespDTO.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
@DataPermission(enable = false)
|
||||
public CommonResult<List<Long>> getChildDeptList(Long deptId) {
|
||||
|
@ -9,7 +9,7 @@ import lombok.NoArgsConstructor;
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class DeptSimpleRespVO {
|
||||
public class DeptSimpleRespVO {
|
||||
|
||||
@Schema(description = "部门编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
private Long id;
|
||||
@ -28,4 +28,7 @@ public class DeptSimpleRespVO {
|
||||
|
||||
@Schema(description = "工厂编号")
|
||||
private Long factoryId;
|
||||
|
||||
@Schema(description = "机构类型 | 字典值参考 system_dept_type", example = "0")
|
||||
private String type;
|
||||
}
|
||||
|
@ -4,13 +4,13 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.smartfactory.api.factoryInfo.FactoryInfoApi;
|
||||
import cn.iocoder.yudao.module.smartfactory.api.factoryInfo.dto.FactoryInfoDTO;
|
||||
import cn.iocoder.yudao.module.smartfactory.api.staff.StaffApi;
|
||||
import cn.iocoder.yudao.module.smartfactory.api.staff.dto.StaffDTO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.loan.vo.LoanPageReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.loan.vo.LoanRespVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.loan.LoanDO;
|
||||
import cn.iocoder.yudao.module.system.service.dept.DeptService;
|
||||
import cn.iocoder.yudao.module.system.service.loan.LoanService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
@ -44,7 +44,7 @@ public class LoanController {
|
||||
private StaffApi staffApi;
|
||||
|
||||
@Resource
|
||||
private DeptService deptService;
|
||||
private FactoryInfoApi factoryInfoApi;
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得借支管理")
|
||||
@ -55,6 +55,15 @@ public class LoanController {
|
||||
return success(BeanUtils.toBean(loan, LoanRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/getByStaffId")
|
||||
@Operation(summary = "获得指定员工的借支管理")
|
||||
@Parameter(name = "staffId", description = "员工编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('system:loan:query')")
|
||||
public CommonResult<LoanRespVO> getByStaffId(@RequestParam("id") Long id) {
|
||||
LoanDO loan = loanService.getByUserId(id);
|
||||
return success(BeanUtils.toBean(loan, LoanRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得借支管理分页")
|
||||
@PreAuthorize("@ss.hasPermission('system:loan:query')")
|
||||
@ -70,7 +79,7 @@ public class LoanController {
|
||||
|
||||
// 获取部门信息
|
||||
Set<Long> deptIds = convertSet(result.getList(), LoanRespVO::getDeptId);
|
||||
Map<Long, DeptDO> deptMap = convertMap(deptService.getDeptList(deptIds), DeptDO::getId);
|
||||
Map<Long, FactoryInfoDTO> deptMap = factoryInfoApi.getFactoryMap(deptIds);
|
||||
|
||||
result.getList().forEach(item -> {
|
||||
// 设置借支用户名称
|
||||
|
@ -374,11 +374,14 @@ public class UserController {
|
||||
List<PostDO> postDO = postService.getPostList(null, Collections.singleton(CommonStatusEnum.ENABLE.getStatus()));
|
||||
postDO.sort(Comparator.comparing(PostDO::getSort));
|
||||
|
||||
Map<Integer, List<String>> mapDropDown = new HashMap<>();
|
||||
mapDropDown.put(1, getDeptNameFun(deptDO));
|
||||
mapDropDown.put(2, getPostNameFun(postDO));
|
||||
|
||||
// 输出 Excel
|
||||
ExcelUtils.write(response, "用户数据.xls", "数据", UserRespVO.class,
|
||||
UserConvert.INSTANCE.convertList(list, deptMap, postMap, positionMap),
|
||||
1, getDeptNameFun(deptDO),
|
||||
2, getPostNameFun(postDO));
|
||||
mapDropDown);
|
||||
}
|
||||
|
||||
@GetMapping("/get-import-template")
|
||||
@ -399,11 +402,14 @@ public class UserController {
|
||||
List<PostDO> postDO = postService.getPostList(null, Collections.singleton(CommonStatusEnum.ENABLE.getStatus()));
|
||||
postDO.sort(Comparator.comparing(PostDO::getSort));
|
||||
|
||||
Map<Integer, List<String>> mapDropDown = new HashMap<>();
|
||||
mapDropDown.put(1, getDeptNameFun(deptDO));
|
||||
mapDropDown.put(2, getPostNameFun(postDO));
|
||||
|
||||
// 输出
|
||||
ExcelUtils.write(response, "用户导入模板.xlsx", "用户列表",
|
||||
UserImportExcelVO.class, null,
|
||||
1, getDeptNameFun(deptDO),
|
||||
2, getPostNameFun(postDO));
|
||||
mapDropDown);
|
||||
}
|
||||
|
||||
@PostMapping("/import")
|
||||
|
@ -71,8 +71,10 @@ public class LogFormController {
|
||||
//获取规则信息
|
||||
LogRuleDO logRuleDO = logRuleService.getLogRule(form.getId());
|
||||
|
||||
//设置日志类型
|
||||
logFormRespVO.setType(logRuleDO.getType());
|
||||
if (logRuleDO != null) {
|
||||
//设置日志类型
|
||||
logFormRespVO.setType(logRuleDO.getType());
|
||||
}
|
||||
}
|
||||
|
||||
return success(logFormRespVO);
|
||||
|
@ -45,4 +45,6 @@ public interface LogUseMapper extends BaseMapperX<LogUseDO> {
|
||||
* @return
|
||||
*/
|
||||
List<Long> getFormIdsByDataPermission(Long userId);
|
||||
|
||||
List<Long> selectUseDeptList();
|
||||
}
|
@ -1084,6 +1084,7 @@ public class AttendanceServiceImpl implements AttendanceService {
|
||||
// -- 如果有报错的话 - 那么进行回滚操作 - 并且redis 中的补卡次数也要+1 (redis并不会回滚)
|
||||
String key = "ReplacementCardNum" + "_" + userId + "_" + LocalDateTime.now().format(Constants.YEAR_MONTH_FORMAT);
|
||||
stringRedisTemplate.opsForValue().increment(key, 1);
|
||||
log.error("补卡失败", e);
|
||||
throw exception(ABNORMAL_CARD_REPLENISHMENT);
|
||||
}
|
||||
}
|
||||
@ -1115,6 +1116,7 @@ public class AttendanceServiceImpl implements AttendanceService {
|
||||
// -- 如果有报错的话 - 那么进行回滚操作 - 并且redis 中的补卡次数也要+1 (redis并不会回滚)
|
||||
String key = "ReplacementCardNum" + "_" + userId + "_" + LocalDateTime.now().format(Constants.YEAR_MONTH_FORMAT);
|
||||
stringRedisTemplate.opsForValue().increment(key, punchRecordIds.size());
|
||||
log.error("补卡失败", e);
|
||||
throw exception(ABNORMAL_CARD_REPLENISHMENT);
|
||||
}
|
||||
}
|
||||
|
@ -160,7 +160,7 @@ public interface DeptService {
|
||||
* @param factoryIds
|
||||
* @return
|
||||
*/
|
||||
List<DeptDO> getDeptListByFactoryIds(List<Long> factoryIds);
|
||||
List<DeptDO> getDeptListByFactoryIds(Collection<Long> factoryIds);
|
||||
|
||||
/**
|
||||
* 获取部门列表
|
||||
|
@ -356,7 +356,7 @@ public class DeptServiceImpl implements DeptService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeptDO> getDeptListByFactoryIds(List<Long> factoryIds) {
|
||||
public List<DeptDO> getDeptListByFactoryIds(Collection<Long> factoryIds) {
|
||||
return deptMapper.selectList(new LambdaQueryWrapper<DeptDO>()
|
||||
.in(DeptDO::getFactoryId, factoryIds));
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.worklog.LogUseDO;
|
||||
import cn.iocoder.yudao.module.system.dal.mysql.worklog.LogUseMapper;
|
||||
import cn.iocoder.yudao.module.system.service.worklog.dto.LogUseSaveReqDTO;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
@ -98,11 +97,7 @@ public class LogUseServiceImpl implements LogUseService {
|
||||
@Override
|
||||
public List<Long> getUseDeptList() {
|
||||
|
||||
QueryWrapper<LogUseDO> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.select("DISTINCT use_user_dept");
|
||||
|
||||
List<LogUseDO> logUseDOS = logUseMapper.selectList(queryWrapper);
|
||||
return convertList(logUseDOS, LogUseDO::getUseUserDept);
|
||||
return logUseMapper.selectUseDeptList();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -66,7 +66,7 @@
|
||||
</springProfile>
|
||||
<!-- 其它环境 -->
|
||||
<springProfile name="dev,test,stage,prod,default">
|
||||
<root level="INFO">
|
||||
<root level="DEBUG">
|
||||
<appender-ref ref="STDOUT"/>
|
||||
<appender-ref ref="ASYNC"/>
|
||||
<appender-ref ref="GRPC"/>
|
||||
|
@ -207,7 +207,7 @@
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="filterCrmUserFlag != null and filterCrmUserFlag == 1">
|
||||
not exists (SELECT id from crm_user_live_tree where a.id = id)
|
||||
and not exists (SELECT user_id from crm_user_live_tree where a.id = user_id)
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
@ -30,4 +30,17 @@
|
||||
deleted = 0
|
||||
and form_id = #{formId}
|
||||
</select>
|
||||
|
||||
<select id="selectUseDeptList" resultType="java.lang.Long">
|
||||
SELECT DISTINCT
|
||||
u.dept_id as deptId
|
||||
FROM
|
||||
work_log_use log,
|
||||
system_users u
|
||||
WHERE
|
||||
u.id = log.use_user_id
|
||||
and u.status = 0
|
||||
and log.deleted = 0
|
||||
and u.deleted = 0
|
||||
</select>
|
||||
</mapper>
|
@ -17,6 +17,8 @@ public interface ErrorCodeConstants {
|
||||
|
||||
ErrorCode SIZE_NOT_EXISTS = new ErrorCode(1_000_000_004, "规格不存在");
|
||||
|
||||
ErrorCode STAFF_NOT_EXISTS = new ErrorCode(1_000_000_005, "员工不存在");
|
||||
|
||||
//打包线模块
|
||||
ErrorCode PACKAGE_NOT_EXISTS = new ErrorCode(1_000_001_001, "打包线信息不存在");
|
||||
ErrorCode PACKAGE_DATA_EXISTS = new ErrorCode(1_000_001_001, "当前日期的数据已存在");
|
||||
@ -32,4 +34,5 @@ public interface ErrorCodeConstants {
|
||||
// ========== 工资模块 1_000_004_000 ==========
|
||||
ErrorCode STAFF_SALARY_NOT_EXISTS = new ErrorCode(1_000_004_001, "工资记录不存在!");
|
||||
ErrorCode INDUSTRIAL_INJURY_NOT_EXISTS = new ErrorCode(1_000_004_002, "工伤记录不存在!");
|
||||
ErrorCode STAFF_SALARY_EXISTS = new ErrorCode(1_000_004_003, "工资记录已存在");
|
||||
}
|
||||
|
@ -33,9 +33,7 @@ import java.text.DecimalFormat;
|
||||
import java.time.DayOfWeek;
|
||||
import java.time.LocalDate;
|
||||
import java.time.temporal.TemporalAdjusters;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
@ -213,11 +211,14 @@ public class FactoryDataController {
|
||||
List<SizeDO> sizeDOS = sizeService.getListSize();
|
||||
List<String> size = sizeDOS.stream().map(info -> info.getId() + ":" + info.getName()).collect(Collectors.toList());
|
||||
|
||||
Map<Integer, List<String>> mapDropDown = new HashMap<>();
|
||||
mapDropDown.put(0, factory);
|
||||
mapDropDown.put(2, size);
|
||||
|
||||
// 输出
|
||||
ExcelUtils.write(response, "出入库数据导入模板.xls", "详情",
|
||||
FactoryDataImportVO.class, null,
|
||||
0, factory,
|
||||
2, size);
|
||||
mapDropDown);
|
||||
}
|
||||
|
||||
@PostMapping("/import")
|
||||
|
@ -1,5 +1,6 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.controller.admin.staff;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
@ -26,10 +27,15 @@ import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
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.convertMap;
|
||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
|
||||
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||
|
||||
@Tag(name = "管理后台 - 员工")
|
||||
@ -75,9 +81,9 @@ public class StaffController {
|
||||
@Operation(summary = "获得员工")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('factory:staff:query')")
|
||||
public CommonResult<StaffRespVO> getStaff(@RequestParam("id") Long id) {
|
||||
public CommonResult<StaffDO> getStaff(@RequestParam("id") Long id) {
|
||||
StaffDO staff = staffService.getStaff(id);
|
||||
return success(BeanUtils.toBean(staff, StaffRespVO.class));
|
||||
return success(staff);
|
||||
}
|
||||
|
||||
@GetMapping("/getListByFactory")
|
||||
@ -96,7 +102,19 @@ public class StaffController {
|
||||
@PreAuthorize("@ss.hasPermission('factory:staff:query')")
|
||||
public CommonResult<PageResult<StaffRespVO>> getStaffPage(@Valid StaffPageReqVO pageReqVO) {
|
||||
PageResult<StaffDO> pageResult = staffService.getStaffPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, StaffRespVO.class));
|
||||
PageResult<StaffRespVO> result = BeanUtils.toBean(pageResult, StaffRespVO.class);
|
||||
if (CollUtil.isNotEmpty(result.getList())) {
|
||||
|
||||
// 获取工厂详情
|
||||
Set<Long> factoryIds = convertSet(result.getList(), StaffRespVO::getFactoryId);
|
||||
Map<Long, FactoryInfoDO> factoryInfoMap = convertMap(factoryInfoService.getFactoryList(factoryIds), FactoryInfoDO::getId);
|
||||
result.getList().forEach(data -> {
|
||||
// 设置工厂名称
|
||||
data.setFactoryName(factoryInfoMap.containsKey(data.getFactoryId()) ? factoryInfoMap.get(data.getFactoryId()).getName() : null);
|
||||
});
|
||||
}
|
||||
|
||||
return success(result);
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@ -128,11 +146,21 @@ public class StaffController {
|
||||
.map(item -> item.getValue() + ":" + item.getLabel())
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 获取业务类型名称
|
||||
List<DictDataRespDTO> businessTypeVOs = dictDataApi.getDictDataList("system_settlement_type").getCheckedData();
|
||||
List<String> businessTypeName = businessTypeVOs.stream()
|
||||
.map(item -> item.getValue() + ":" + item.getLabel())
|
||||
.collect(Collectors.toList());
|
||||
|
||||
Map<Integer, List<String>> mapDropDown = new HashMap<>();
|
||||
mapDropDown.put(1, factoryName);
|
||||
mapDropDown.put(2, workTypeName);
|
||||
mapDropDown.put(3, businessTypeName);
|
||||
|
||||
// 输出
|
||||
ExcelUtils.write(response, "工人导入模板.xlsx", "工人列表",
|
||||
StaffImportExcelVO.class, null,
|
||||
1, factoryName,
|
||||
2, workTypeName);
|
||||
mapDropDown);
|
||||
}
|
||||
|
||||
@PostMapping("/import")
|
||||
|
@ -30,6 +30,9 @@ public class StaffImportExcelVO {
|
||||
@ExcelProperty("工种名称")
|
||||
private String workTypeName;
|
||||
|
||||
@ExcelProperty("业务类型名称")
|
||||
private String businessTypeName;
|
||||
|
||||
@ExcelProperty("手机号码")
|
||||
@Mobile
|
||||
private String mobile;
|
||||
|
@ -15,15 +15,12 @@ public class StaffPageReqVO extends PageParam {
|
||||
@Schema(description = "员工昵称")
|
||||
private String nickName;
|
||||
|
||||
@Schema(description = "年龄")
|
||||
private Integer age;
|
||||
|
||||
@Schema(description = "用户性别(0男 1女 2未知)")
|
||||
private Integer sex;
|
||||
|
||||
@Schema(description = "工种id", example = "6971")
|
||||
private Integer workTypeId;
|
||||
|
||||
@Schema(description = "所属业务类型")
|
||||
private Integer businessType;
|
||||
|
||||
@Schema(description = "工厂id", example = "6971")
|
||||
private Long factoryId;
|
||||
|
||||
|
@ -31,6 +31,9 @@ public class StaffRespVO {
|
||||
@Schema(description = "工种id", example = "6971")
|
||||
private Integer workTypeId;
|
||||
|
||||
@Schema(description = "所属业务类型")
|
||||
private Integer businessType;
|
||||
|
||||
@Schema(description = "工厂id", example = "6971")
|
||||
private Long factoryId;
|
||||
|
||||
|
@ -27,6 +27,9 @@ public class StaffSaveReqVO {
|
||||
@Schema(description = "工种id", example = "6971")
|
||||
private Integer workTypeId;
|
||||
|
||||
@Schema(description = "所属业务类型")
|
||||
private Integer businessType;
|
||||
|
||||
@Schema(description = "工厂id", example = "6971")
|
||||
private Long factoryId;
|
||||
|
||||
|
@ -15,8 +15,6 @@ import cn.iocoder.yudao.module.smartfactory.dal.dataobject.staffsalary.StaffSala
|
||||
import cn.iocoder.yudao.module.smartfactory.service.factoryinfo.FactoryInfoService;
|
||||
import cn.iocoder.yudao.module.smartfactory.service.staff.StaffService;
|
||||
import cn.iocoder.yudao.module.smartfactory.service.staffsalary.StaffSalaryService;
|
||||
import cn.iocoder.yudao.module.system.api.loan.LoanApi;
|
||||
import cn.iocoder.yudao.module.system.api.loan.dto.LoanDTO;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
@ -49,8 +47,12 @@ public class StaffSalaryController {
|
||||
@Resource
|
||||
private FactoryInfoService factoryInfoService;
|
||||
|
||||
@Resource
|
||||
private LoanApi loanApi;
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建员工工资")
|
||||
@PreAuthorize("@ss.hasPermission('smartfactory:staff-salary:create')")
|
||||
public CommonResult<Long> createStaff(@Valid @RequestBody StaffSalarySaveReqVO createReqVO) {
|
||||
return success(staffSalaryService.createStaffSalary(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新厂区员工工资")
|
||||
@ -83,15 +85,8 @@ public class StaffSalaryController {
|
||||
@PreAuthorize("@ss.hasPermission('smartfactory:staff-salary:query')")
|
||||
public CommonResult<StaffSalaryRespVO> getStaffSalary(@RequestParam("id") Long id) {
|
||||
StaffSalaryDO staffSalary = staffSalaryService.getStaffSalary(id);
|
||||
StaffSalaryRespVO respVO = BeanUtils.toBean(staffSalary, StaffSalaryRespVO.class);
|
||||
if (respVO != null) {
|
||||
|
||||
// 获取员工借支信息
|
||||
LoanDTO loanDTO = loanApi.getByUserId(staffSalary.getStaffId()).getCheckedData();
|
||||
// 设置员工借支余额
|
||||
respVO.setLoanAmount(loanDTO.getRemainingAmount());
|
||||
}
|
||||
return success(respVO);
|
||||
return success(BeanUtils.toBean(staffSalary, StaffSalaryRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/get-list")
|
||||
|
@ -48,6 +48,11 @@ public class StaffDO extends BaseDO {
|
||||
*/
|
||||
private Integer workTypeId;
|
||||
|
||||
/**
|
||||
* 所属业务类型
|
||||
*/
|
||||
private Integer businessType;
|
||||
|
||||
/**
|
||||
* 工厂id
|
||||
*/
|
||||
|
@ -3,12 +3,18 @@ package cn.iocoder.yudao.module.smartfactory.dal.mysql.staff;
|
||||
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.smartfactory.controller.admin.staff.vo.StaffPageReqVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.staffsalary.vo.StaffSalaryPageReqVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.staffsalary.vo.StaffSalaryRespVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.factoryinfo.FactoryInfoDO;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.staff.StaffDO;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.staffsalary.StaffSalaryDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 员工 Mapper
|
||||
@ -20,8 +26,9 @@ public interface StaffMapper extends BaseMapperX<StaffDO> {
|
||||
|
||||
default PageResult<StaffDO> selectPage(StaffPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<StaffDO>()
|
||||
.eqIfPresent(StaffDO::getAge, reqVO.getAge())
|
||||
.eqIfPresent(StaffDO::getWorkTypeId, reqVO.getWorkTypeId())
|
||||
.eqIfPresent(StaffDO::getFactoryId, reqVO.getFactoryId())
|
||||
.likeIfPresent(StaffDO::getNickName, reqVO.getNickName())
|
||||
.eqIfPresent(StaffDO::getStatus, reqVO.getStatus())
|
||||
.orderByDesc(StaffDO::getId));
|
||||
}
|
||||
@ -40,4 +47,35 @@ public interface StaffMapper extends BaseMapperX<StaffDO> {
|
||||
* @return 员工信息列表
|
||||
*/
|
||||
List<StaffDO> getStaffDataV2(@Param("factoryId") Long factoryId);
|
||||
|
||||
default PageResult<StaffSalaryRespVO> selectSalaryPage(StaffSalaryPageReqVO pageReqVO) {
|
||||
|
||||
MPJLambdaWrapperX<StaffDO> query = new MPJLambdaWrapperX<StaffDO>()
|
||||
.selectAs(StaffDO::getId, StaffSalaryRespVO::getStaffId)
|
||||
.selectAs(StaffDO::getNickName, StaffSalaryRespVO::getStaffName)
|
||||
.selectAs(StaffDO::getFactoryId, StaffSalaryRespVO::getFactoryId)
|
||||
.selectAs(FactoryInfoDO::getName, StaffSalaryRespVO::getFactoryName)
|
||||
.selectAs(StaffDO::getWorkTypeId, StaffSalaryRespVO::getWorkTypeId)
|
||||
.selectAs(StaffSalaryDO::getMonth, StaffSalaryRespVO::getMonth)
|
||||
.selectAs(StaffDO::getSalary, StaffSalaryRespVO::getSalary)
|
||||
.selectAs(StaffSalaryDO::getId, StaffSalaryRespVO::getId)
|
||||
.selectAs(StaffSalaryDO::getAttendanceDays, StaffSalaryRespVO::getAttendanceDays)
|
||||
.selectAs(StaffSalaryDO::getPayableAmount, StaffSalaryRespVO::getPayableAmount)
|
||||
.selectAs(StaffSalaryDO::getReturnAmount, StaffSalaryRespVO::getReturnAmount)
|
||||
.selectAs(StaffSalaryDO::getDeductionAmount, StaffSalaryRespVO::getDeductionAmount)
|
||||
.selectAs(StaffSalaryDO::getRealAmount, StaffSalaryRespVO::getRealAmount)
|
||||
.selectAs(StaffSalaryDO::getDeductionItems, StaffSalaryRespVO::getDeductionItems)
|
||||
.selectAs(StaffSalaryDO::getStatus, StaffSalaryRespVO::getStatus)
|
||||
.selectAs(StaffSalaryDO::getCreateTime, StaffSalaryRespVO::getCreateTime);
|
||||
query.leftJoin(StaffSalaryDO.class, on -> on
|
||||
.eq(StaffDO::getId, StaffSalaryDO::getStaffId)
|
||||
.eq(Objects.nonNull(pageReqVO.getMonth()), StaffSalaryDO::getMonth, pageReqVO.getMonth())
|
||||
.eq(Objects.nonNull(pageReqVO.getStatus()), StaffSalaryDO::getStatus, pageReqVO.getStatus()));
|
||||
query.leftJoin(FactoryInfoDO.class, FactoryInfoDO::getId, StaffDO::getFactoryId);
|
||||
query.eqIfPresent(StaffDO::getFactoryId, pageReqVO.getFactoryId());
|
||||
query.eqIfPresent(StaffDO::getWorkTypeId, pageReqVO.getWorkTypeId());
|
||||
query.eqIfPresent(StaffDO::getId, pageReqVO.getStaffId());
|
||||
|
||||
return selectJoinPage(pageReqVO, StaffSalaryRespVO.class, query);
|
||||
}
|
||||
}
|
||||
|
@ -16,17 +16,18 @@ import cn.iocoder.yudao.module.smartfactory.controller.admin.staff.vo.StaffPageR
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.staff.vo.StaffSaveReqVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.staff.StaffDO;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.mysql.staff.StaffMapper;
|
||||
import cn.iocoder.yudao.module.system.api.dict.DictDataApi;
|
||||
import cn.iocoder.yudao.module.system.api.dict.dto.DictDataRespDTO;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.smartfactory.enums.ErrorCodeConstants.STAFF_NOT_EXISTS;
|
||||
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.USER_IMPORT_LIST_IS_EMPTY;
|
||||
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.USER_USERNAME_EXISTS;
|
||||
|
||||
@ -43,6 +44,9 @@ public class StaffServiceImpl implements StaffService {
|
||||
@Resource
|
||||
private StaffMapper staffMapper;
|
||||
|
||||
@Resource
|
||||
private DictDataApi dictDataApi;
|
||||
|
||||
@Override
|
||||
public Long createStaff(StaffSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
@ -54,7 +58,9 @@ public class StaffServiceImpl implements StaffService {
|
||||
|
||||
@Override
|
||||
public void updateStaff(StaffSaveReqVO updateReqVO) {
|
||||
validateUserForCreateOrUpdate(updateReqVO.getId(), null, null, null);
|
||||
if (staffMapper.selectById(updateReqVO.getId()) == null) {
|
||||
throw exception(STAFF_NOT_EXISTS);
|
||||
}
|
||||
// 更新
|
||||
StaffDO updateObj = BeanUtils.toBean(updateReqVO, StaffDO.class);
|
||||
staffMapper.updateById(updateObj);
|
||||
@ -66,7 +72,7 @@ public class StaffServiceImpl implements StaffService {
|
||||
staffMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateUserForCreateOrUpdate(Long id, String username, String mobile, String idCard) {
|
||||
private void validateUserForCreate(Long id, String username, String mobile, String idCard) {
|
||||
// 关闭数据权限,避免因为没有数据权限,查询不到数据,进而导致唯一校验不正确
|
||||
DataPermissionUtils.executeIgnore(() -> {
|
||||
|
||||
@ -95,7 +101,18 @@ public class StaffServiceImpl implements StaffService {
|
||||
@Override
|
||||
public StaffDataRespVO getStaffData(Long factoryId) {
|
||||
StaffDataRespVO vo = new StaffDataRespVO();
|
||||
List<StaffDO> dos = staffMapper.getStaffData(factoryId);
|
||||
List<StaffDO> dos = staffMapper.selectList(new LambdaQueryWrapperX<StaffDO>()
|
||||
.ne(StaffDO::getStatus, 0));
|
||||
|
||||
// 获取工种信息
|
||||
List<DictDataRespDTO> workTypeVOs = dictDataApi.getDictDataList("user_work_type").getCheckedData();
|
||||
Map<String, String> workTypeMap = workTypeVOs.stream().collect(Collectors.toMap(DictDataRespDTO::getValue, DictDataRespDTO::getLabel));
|
||||
|
||||
// 设置工种名称
|
||||
dos.forEach(item -> {
|
||||
item.setPostName(workTypeMap.getOrDefault(item.getWorkTypeId().toString(), ""));
|
||||
});
|
||||
|
||||
vo.setTotal(dos.size());
|
||||
vo.setMaleTotal((int) dos.stream().filter(a -> a.getSex() == 0).count());
|
||||
vo.setFemaleTotal((int) dos.stream().filter(a -> a.getSex() == 1).count());
|
||||
@ -112,6 +129,14 @@ public class StaffServiceImpl implements StaffService {
|
||||
public StaffDataRespVO getStaffDataV2(Long factoryId) {
|
||||
StaffDataRespVO vo = new StaffDataRespVO();
|
||||
List<StaffDO> dos = staffMapper.getStaffDataV2(factoryId);
|
||||
// 获取工种信息
|
||||
List<DictDataRespDTO> workTypeVOs = dictDataApi.getDictDataList("user_work_type").getCheckedData();
|
||||
Map<String, String> workTypeMap = workTypeVOs.stream().collect(Collectors.toMap(DictDataRespDTO::getValue, DictDataRespDTO::getLabel));
|
||||
|
||||
// 设置工种名称
|
||||
dos.forEach(item -> {
|
||||
item.setPostName(workTypeMap.getOrDefault(item.getWorkTypeId().toString(), ""));
|
||||
});
|
||||
vo.setTotal(dos.size());
|
||||
vo.setMaleTotal((int) dos.stream().filter(a -> a.getSex() == 0).count());
|
||||
vo.setFemaleTotal((int) dos.stream().filter(a -> a.getSex() == 1).count());
|
||||
@ -137,7 +162,7 @@ public class StaffServiceImpl implements StaffService {
|
||||
//校验,判断是否有不符合的原因
|
||||
try {
|
||||
if (!updateSupport) {
|
||||
validateUserForCreateOrUpdate(null, importUser.getNickName(), null, importUser.getIdCard());
|
||||
validateUserForCreate(null, importUser.getNickName(), null, importUser.getIdCard());
|
||||
}
|
||||
} catch (ServiceException ex) {
|
||||
respVO.getFailureUsernames().put(importUser.getNickName(), ex.getMessage());
|
||||
@ -167,11 +192,17 @@ public class StaffServiceImpl implements StaffService {
|
||||
updateUser.setWorkTypeId(Integer.valueOf(importUser.getWorkTypeName().split(":")[0]));
|
||||
}
|
||||
|
||||
// 设置业务类型
|
||||
if (StrUtil.isNotEmpty(importUser.getBusinessTypeName())) {
|
||||
|
||||
updateUser.setBusinessType(Integer.valueOf(importUser.getBusinessTypeName().split(":")[0]));
|
||||
}
|
||||
|
||||
// 判断如果不存在,在进行插入
|
||||
if (updateSupport) {
|
||||
StaffDO staffDO = staffMapper.selectOne(new LambdaQueryWrapperX<StaffDO>()
|
||||
.eq(StaffDO::getIdCard, importUser.getIdCard())
|
||||
.eq(StaffDO::getNickName, importUser.getNickName()));
|
||||
.eqIfPresent(StaffDO::getIdCard, importUser.getIdCard())
|
||||
.eqIfPresent(StaffDO::getNickName, importUser.getNickName()));
|
||||
|
||||
updateUser.setId(staffDO.getId());
|
||||
staffMapper.updateById(updateUser);
|
||||
|
@ -16,6 +16,13 @@ import java.util.List;
|
||||
*/
|
||||
public interface StaffSalaryService {
|
||||
|
||||
/**
|
||||
* 创建厂区员工工资
|
||||
* @param createReqVO 创建信息
|
||||
* @return 工资编号
|
||||
*/
|
||||
Long createStaffSalary(StaffSalarySaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新厂区员工工资
|
||||
*
|
||||
|
@ -7,6 +7,7 @@ import cn.iocoder.yudao.module.smartfactory.controller.admin.staffsalary.vo.Staf
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.staffsalary.vo.StaffSalaryRespVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.staffsalary.vo.StaffSalarySaveReqVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.staffsalary.StaffSalaryDO;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.mysql.staff.StaffMapper;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.mysql.staffsalary.StaffSalaryMapper;
|
||||
import cn.iocoder.yudao.module.system.api.loan.LoanApi;
|
||||
import cn.iocoder.yudao.module.system.api.loan.dto.LoanDTO;
|
||||
@ -19,6 +20,7 @@ import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.smartfactory.enums.ErrorCodeConstants.STAFF_SALARY_EXISTS;
|
||||
import static cn.iocoder.yudao.module.smartfactory.enums.ErrorCodeConstants.STAFF_SALARY_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
@ -33,9 +35,30 @@ public class StaffSalaryServiceImpl implements StaffSalaryService {
|
||||
@Resource
|
||||
private StaffSalaryMapper staffSalaryMapper;
|
||||
|
||||
@Resource
|
||||
private StaffMapper staffMapper;
|
||||
|
||||
@Resource
|
||||
private LoanApi loanApi;
|
||||
|
||||
@Override
|
||||
public Long createStaffSalary(StaffSalarySaveReqVO createReqVO) {
|
||||
|
||||
// 校验当前月份工资是否存在
|
||||
Long count = staffSalaryMapper.selectCount(new LambdaQueryWrapperX<StaffSalaryDO>()
|
||||
.eq(StaffSalaryDO::getStaffId, createReqVO.getStaffId())
|
||||
.eq(StaffSalaryDO::getMonth, createReqVO.getMonth()));
|
||||
if (count > 0L) {
|
||||
throw exception(STAFF_SALARY_EXISTS);
|
||||
}
|
||||
|
||||
// 插入
|
||||
StaffSalaryDO staffSalaryDO = BeanUtils.toBean(createReqVO, StaffSalaryDO.class);
|
||||
staffSalaryMapper.insert(staffSalaryDO);
|
||||
|
||||
return staffSalaryDO.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateStaffSalary(StaffSalarySaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
@ -68,7 +91,12 @@ public class StaffSalaryServiceImpl implements StaffSalaryService {
|
||||
|
||||
@Override
|
||||
public PageResult<StaffSalaryRespVO> getStaffSalaryPage(StaffSalaryPageReqVO pageReqVO) {
|
||||
return staffSalaryMapper.selectSalaryPage(pageReqVO);
|
||||
|
||||
if (pageReqVO.getMonth() != null) {
|
||||
return staffMapper.selectSalaryPage(pageReqVO);
|
||||
}else {
|
||||
return staffSalaryMapper.selectSalaryPage(pageReqVO);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -37,18 +37,15 @@
|
||||
ext.work_type as workType,
|
||||
b.factory_id as factoryId,
|
||||
a.idcard as idCard,
|
||||
a.status as status,
|
||||
d.label as postName
|
||||
a.status as status
|
||||
FROM
|
||||
system_users AS a
|
||||
LEFT JOIN system_users_ext AS ext ON a.id = ext.user_id
|
||||
LEFT JOIN system_dept AS b ON a.dept_id = b.id
|
||||
LEFT JOIN sf_factory_info AS c ON b.factory_id = c.id
|
||||
left join system_dict_data as d on ext.work_type = d.value
|
||||
<where>
|
||||
a.user_type = 2
|
||||
and a.deleted = 0
|
||||
and d.dict_type = 'user_work_type'
|
||||
<if test="factoryId != null">
|
||||
and b.factory_id = #{factoryId}
|
||||
</if>
|
||||
|
Loading…
Reference in New Issue
Block a user