Merge branch 'dev' of http://git.znkjfw.com/ak/zn-cloud into crm-业绩目标
# Conflicts: # yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/mysql/oa/BpmOAReceiptMapper.java # yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/rpc/config/RpcConfiguration.java # yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/oa/BpmOAReceiptServiceImpl.java
This commit is contained in:
commit
f3f91f7350
@ -3,13 +3,13 @@ package cn.iocoder.yudao.module.bpm.controller.admin.financialpayment;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.UploadUserFile;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.financialpayment.vo.FinancialPaymentPageReqVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.financialpayment.vo.FinancialPaymentRespVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.financialpayment.vo.FinancialPaymentSaveReqVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.financialpayment.vo.FinancialPaymentSaveVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.financialpaymentitem.vo.FinancialPaymentItemRespVO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.UploadUserFile;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.financialpayment.FinancialPaymentDO;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.financialpaymentitem.FinancialPaymentItemDO;
|
||||
import cn.iocoder.yudao.module.bpm.service.financialpayment.FinancialPaymentService;
|
||||
@ -17,7 +17,6 @@ import cn.iocoder.yudao.module.bpm.service.financialpaymentitem.FinancialPayment
|
||||
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.*;
|
||||
|
||||
@ -106,4 +105,10 @@ public class FinancialPaymentController {
|
||||
return success(BeanUtils.toBean(pageResult, FinancialPaymentRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/total")
|
||||
@Operation(summary = "获得财务支付统计信息")
|
||||
public CommonResult<FinancialPaymentRespVO> getPaymentTotal(@Valid FinancialPaymentPageReqVO pageReqVO) {
|
||||
FinancialPaymentDO paymentDO = financialPaymentService.getPaymentTotal(pageReqVO);
|
||||
return success(BeanUtils.toBean(paymentDO, FinancialPaymentRespVO.class));
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,10 @@
|
||||
package cn.iocoder.yudao.module.bpm.controller.admin.oa;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.expenses.BpmOAExpensesCreateReqVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.expenses.BpmOAExpensesPageReqVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.expenses.BpmOAExpensesPageRespVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.expenses.BpmOAExpensesRespVO;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAExpensesDO;
|
||||
import cn.iocoder.yudao.module.bpm.service.oa.BpmOAExpensesService;
|
||||
@ -59,4 +62,12 @@ public class BpmOAExpensesController {
|
||||
|
||||
return success(respVO);
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得生产开支申请分页")
|
||||
public CommonResult<PageResult<BpmOAExpensesPageRespVO>> getExpensesPage(BpmOAExpensesPageReqVO pageReqVO) {
|
||||
|
||||
PageResult<BpmOAExpensesPageRespVO> respVO = expensesService.getExpensesPage(pageReqVO);
|
||||
return success(respVO);
|
||||
}
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.expenses;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 开支日报分页 Request VO")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class BpmOAExpensesPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "申请人用户编号", example = "1")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "所属工厂编号", example = "1")
|
||||
private Long factoryId;
|
||||
|
||||
@Schema(description = "费用类型 | 字典值参照bpm_oa_expenses_type")
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "费用板块 | 1叉车 2打包 3搬运 4运输")
|
||||
private Integer costSection;
|
||||
|
||||
@Schema(description = "审批通过时间")
|
||||
private LocalDateTime[] endTime;
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.expenses;
|
||||
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.BpmOABaseRespVO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author 符溶馨
|
||||
*/
|
||||
@Schema(description = "管理后台 - 生产开支 请求Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class BpmOAExpensesPageRespVO extends BpmOABaseRespVO {
|
||||
|
||||
@Schema(description = "申请人用户编号")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "申请人用户名称")
|
||||
private String userName;
|
||||
|
||||
@Schema(description = "收款人信息编号")
|
||||
private Long bankId;
|
||||
|
||||
@Schema(description = "收款人名称")
|
||||
private String payeeName;
|
||||
|
||||
@Schema(description = "银行卡号")
|
||||
private String bankNo;
|
||||
|
||||
@Schema(description = "开户行名称")
|
||||
private String bankName;
|
||||
|
||||
@Schema(description = "报销总金额")
|
||||
private BigDecimal totalMoney;
|
||||
|
||||
@Schema(description = "费用申请主键")
|
||||
private Long expensesId;
|
||||
|
||||
@Schema(description = "费用类型 | 字典值参照bpm_oa_expenses_type")
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "费用板块 | 1叉车 2打包 3搬运 4运输")
|
||||
private Integer costSection;
|
||||
|
||||
@Schema(description = "费用产生部门")
|
||||
private Long deptId;
|
||||
|
||||
@Schema(description = "费用产生部门名称")
|
||||
private String deptName;
|
||||
|
||||
@Schema(description = "支出金额")
|
||||
private BigDecimal amount;
|
||||
|
||||
@Schema(description = "费用明细")
|
||||
private String detail;
|
||||
}
|
@ -28,4 +28,7 @@ public class BpmOAReceiptPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "查询模式")
|
||||
private String relation;
|
||||
|
||||
@Schema(description = "合同编号")
|
||||
private Long contractId;
|
||||
}
|
||||
|
@ -41,4 +41,6 @@ public interface FinancialPaymentMapper extends BaseMapperX<FinancialPaymentDO>
|
||||
* @param ids
|
||||
*/
|
||||
void cancel(@Param("ids") List<Long> ids);
|
||||
|
||||
FinancialPaymentDO selectPaymentTotal(@Param("vo") FinancialPaymentPageReqVO pageReqVO);
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ import java.util.Objects;
|
||||
@Mapper
|
||||
public interface BpmOAContractMapper extends BaseMapperX<BpmOAContractDO> {
|
||||
default PageResult<BpmOAContractRespVO> selectPage(BpmOAContractPageReqVO pageReqVO,
|
||||
Long userId) {
|
||||
List<Long> userIds) {
|
||||
|
||||
MPJLambdaWrapperX<BpmOAContractDO> query = new MPJLambdaWrapperX<>();
|
||||
query.selectAll(BpmOAContractDO.class);
|
||||
@ -38,25 +38,10 @@ public interface BpmOAContractMapper extends BaseMapperX<BpmOAContractDO> {
|
||||
query.likeIfPresent(BpmOAContractDO::getCustomerName, pageReqVO.getCustomerName());
|
||||
query.eqIfPresent(BpmOAContractDO::getStatus, pageReqVO.getStatus());
|
||||
query.eqIfPresent(BpmOAContractDO::getResult, pageReqVO.getResult());
|
||||
query.apply(Objects.nonNull(pageReqVO.getSignatoryName()), "u.nickname Like CONCAT('%', {0}, '%')", pageReqVO.getSignatoryName());
|
||||
query.apply(Objects.nonNull(pageReqVO.getCreateName()), "u1.nickname Like CONCAT('%', {0}, '%')", pageReqVO.getCreateName());
|
||||
if ("my".equals(pageReqVO.getRelation())) {
|
||||
query.eq(BpmOAContractDO::getUserId, userId);
|
||||
} else if ("sub".equals(pageReqVO.getRelation())) {
|
||||
query.innerJoin("(" +
|
||||
"\tSELECT DISTINCT\n" +
|
||||
"\t\tu.id \n" +
|
||||
"\tFROM\n" +
|
||||
"\t\tsystem_users u\n" +
|
||||
"\t\tINNER JOIN system_dept d ON d.leader_user_id = " + userId + "\n" +
|
||||
"\t\tINNER JOIN system_dept d1 ON d1.flag LIKE CONCAT( '%', d.id, '-' ) \n" +
|
||||
"\t\tOR d1.flag LIKE CONCAT( '%-', d.id, '-%' ) \n" +
|
||||
"\t\tOR d1.flag LIKE CONCAT( '-', d.id, '%' ) \n" +
|
||||
"\tWHERE\n" +
|
||||
"\t\tu.dept_id = d1.id \n" +
|
||||
"\t\tAND u.STATUS = 0 \n" +
|
||||
"\t) subordinate ON subordinate.id = t.user_id");
|
||||
}
|
||||
query.inIfPresent(BpmOAContractDO::getUserId, userIds);
|
||||
query.apply(Objects.nonNull(pageReqVO.getSignatoryName()),"u.nickname Like CONCAT('%', {0}, '%')", pageReqVO.getSignatoryName());
|
||||
query.apply(Objects.nonNull(pageReqVO.getCreateName()),"u1.nickname Like CONCAT('%', {0}, '%')", pageReqVO.getCreateName());
|
||||
|
||||
query.orderByDesc(BpmOAContractDO::getCreateTime);
|
||||
|
||||
return selectJoinPage(pageReqVO, BpmOAContractRespVO.class, query);
|
||||
|
@ -1,9 +1,16 @@
|
||||
package cn.iocoder.yudao.module.bpm.dal.mysql.oa;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.expenses.BpmOAExpensesPageReqVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.expenses.BpmOAExpensesPageRespVO;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAExpensesDO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@Mapper
|
||||
public interface BpmOAExpensesMapper extends BaseMapperX<BpmOAExpensesDO> {
|
||||
|
||||
IPage<BpmOAExpensesPageRespVO> selectExpensesPage(@Param("page") IPage<BpmOAExpensesPageReqVO> page,
|
||||
@Param("pageReqVO") BpmOAExpensesPageReqVO pageReqVO);
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package cn.iocoder.yudao.module.bpm.dal.mysql.oa;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
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.MPJLambdaWrapperX;
|
||||
@ -19,7 +20,7 @@ import java.util.Objects;
|
||||
|
||||
@Mapper
|
||||
public interface BpmOAReceiptMapper extends BaseMapperX<BpmOAReceiptDO> {
|
||||
default PageResult<BpmOAReceiptRespVO> selectReceiptPage(BpmOAReceiptPageReqVO pageReqVO, Long userId) {
|
||||
default PageResult<BpmOAReceiptRespVO> selectReceiptPage(BpmOAReceiptPageReqVO pageReqVO, List<Long> userIds) {
|
||||
|
||||
MPJLambdaWrapperX<BpmOAReceiptDO> query = new MPJLambdaWrapperX<>();
|
||||
query.selectAll(BpmOAReceiptDO.class);
|
||||
@ -30,26 +31,11 @@ public interface BpmOAReceiptMapper extends BaseMapperX<BpmOAReceiptDO> {
|
||||
query.leftJoin(BpmOAContractDO.class, "c", BpmOAContractDO::getId, BpmOAReceiptDO::getContractId);
|
||||
query.leftJoin("system_users u on u.id = t.creator");
|
||||
query.eqIfPresent(BpmOAReceiptDO::getResult, pageReqVO.getResult());
|
||||
query.in(CollUtil.isNotEmpty(userIds), BpmOAContractDO::getUserId, userIds);
|
||||
query.apply(Objects.nonNull(pageReqVO.getContractId()), "c.id = {0}", pageReqVO.getContractId());
|
||||
query.apply(Objects.nonNull(pageReqVO.getCustomerName()), "c.customer_name LIKE CONCAT('%', {0}, '%')", pageReqVO.getCustomerName());
|
||||
query.apply(Objects.nonNull(pageReqVO.getContractName()), "c.contract_name LIKE CONCAT('%', {0}, '%')", pageReqVO.getContractName());
|
||||
query.apply(Objects.nonNull(pageReqVO.getCreateName()), "u.nickname Like CONCAT('%', {0}, '%')", pageReqVO.getCreateName());
|
||||
if ("my".equals(pageReqVO.getRelation())) {
|
||||
query.eq(BpmOAContractDO::getUserId, userId);
|
||||
} else if ("sub".equals(pageReqVO.getRelation())) {
|
||||
query.innerJoin("(" +
|
||||
"\tSELECT DISTINCT\n" +
|
||||
"\t\tu.id \n" +
|
||||
"\tFROM\n" +
|
||||
"\t\tsystem_users u\n" +
|
||||
"\t\tINNER JOIN system_dept d ON d.leader_user_id = " + userId + "\n" +
|
||||
"\t\tINNER JOIN system_dept d1 ON d1.flag LIKE CONCAT( '%', d.id, '-' ) \n" +
|
||||
"\t\tOR d1.flag LIKE CONCAT( '%-', d.id, '-%' ) \n" +
|
||||
"\t\tOR d1.flag LIKE CONCAT( '-', d.id, '%' ) \n" +
|
||||
"\tWHERE\n" +
|
||||
"\t\tu.dept_id = d1.id \n" +
|
||||
"\t\tAND u.STATUS = 0 \n" +
|
||||
"\t) subordinate ON subordinate.id = t.user_id");
|
||||
}
|
||||
query.apply(Objects.nonNull(pageReqVO.getCreateName()),"u.nickname Like CONCAT('%', {0}, '%')", pageReqVO.getCreateName());
|
||||
query.orderByDesc(BpmOAReceiptDO::getCreateTime);
|
||||
|
||||
return selectJoinPage(pageReqVO, BpmOAReceiptRespVO.class, query);
|
||||
|
@ -1,5 +1,6 @@
|
||||
package cn.iocoder.yudao.module.bpm.dal.mysql.task;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
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;
|
||||
@ -14,12 +15,10 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.mapstruct.ap.internal.util.Strings;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@Mapper
|
||||
public interface BpmTaskExtMapper extends BaseMapperX<BpmTaskExtDO> {
|
||||
@ -97,7 +96,7 @@ public interface BpmTaskExtMapper extends BaseMapperX<BpmTaskExtDO> {
|
||||
|
||||
queryWrapperX.innerJoin(BpmProcessInstanceExtDO.class, on -> on
|
||||
.eq(BpmTaskExtDO::getProcessInstanceId, BpmProcessInstanceExtDO::getProcessInstanceId)
|
||||
.in(Objects.nonNull(userIds), BpmProcessInstanceExtDO::getStartUserId, userIds)
|
||||
.in(CollUtil.isNotEmpty(userIds), BpmProcessInstanceExtDO::getStartUserId, userIds)
|
||||
.eq(StringUtils.isNotEmpty(pageVO.getName()), BpmProcessInstanceExtDO::getName, pageVO.getName()));
|
||||
queryWrapperX.likeRight(BpmProcessInstanceExtDO::getProcessDefinitionId, "oa_");
|
||||
queryWrapperX.eq(BpmTaskExtDO::getAssigneeUserId, userId);
|
||||
|
@ -4,15 +4,15 @@ 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.dal.dataobject.oa.BpmOASalaryDO;
|
||||
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.oa.BpmOASalaryService;
|
||||
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;
|
||||
@ -31,9 +31,6 @@ import static java.util.Collections.emptySet;
|
||||
@Component
|
||||
public class BpmTaskFactoryLeaderScript extends BpmTaskAssignLeaderAbstractScript {
|
||||
|
||||
@Resource
|
||||
private AdminUserApi userApi;
|
||||
|
||||
@Resource
|
||||
private DeptApi deptApi;
|
||||
|
||||
@ -53,6 +50,10 @@ public class BpmTaskFactoryLeaderScript extends BpmTaskAssignLeaderAbstractScrip
|
||||
@Lazy // 解决循环依赖
|
||||
private BpmOALoanService loanService;
|
||||
|
||||
@Resource
|
||||
@Lazy
|
||||
private BpmOASalaryService salaryService;
|
||||
|
||||
@Override
|
||||
public Set<Long> calculateTaskCandidateUsers(DelegateExecution execution) {
|
||||
// 获得发起人
|
||||
@ -87,14 +88,18 @@ public class BpmTaskFactoryLeaderScript extends BpmTaskAssignLeaderAbstractScrip
|
||||
}
|
||||
break;
|
||||
case "oa_salary_2":
|
||||
// 获取发起人的部门信息
|
||||
AdminUserRespDTO userRespDTO = userApi.getUser(Long.valueOf(processInstance.getStartUserId())).getCheckedData();
|
||||
DeptRespDTO deptRespDTO = deptApi.getDept(userRespDTO.getDeptId()).getCheckedData();
|
||||
// 根据流程实例ID 取到薪资付款流程表单
|
||||
BpmOASalaryDO salaryDO = salaryService.getByProcessInstanceId(processInstance.getProcessInstanceId());
|
||||
if (salaryDO != null) {
|
||||
|
||||
// 判断是否是属于工厂部门
|
||||
if (deptRespDTO.getFactoryId() != null) {
|
||||
dept = deptApi.getDept(deptRespDTO.getParentId()).getCheckedData();
|
||||
// 获取申请部门信息
|
||||
DeptRespDTO deptRespDTO = deptApi.getDept(salaryDO.getCompanyDeptId()).getCheckedData();
|
||||
// 判断是否是属于工厂部门
|
||||
if (deptRespDTO != null && deptRespDTO.getFactoryId() != null) {
|
||||
dept = deptApi.getDept(deptRespDTO.getParentId()).getCheckedData();
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.bpm.framework.rpc.config;
|
||||
import cn.iocoder.yudao.module.hrm.api.crmbusiness.BusinessApi;
|
||||
import cn.iocoder.yudao.module.hrm.api.crmcontract.ContractApi;
|
||||
import cn.iocoder.yudao.module.hrm.api.crmcustomer.CrmCustomerApi;
|
||||
import cn.iocoder.yudao.module.hrm.api.userlivetree.UserLiveTreeApi;
|
||||
import cn.iocoder.yudao.module.hrm.api.salesperformancesettlement.SalesPerformanceSettlementApi;
|
||||
import cn.iocoder.yudao.module.infra.api.config.ConfigApi;
|
||||
import cn.iocoder.yudao.module.infra.api.file.FileApi;
|
||||
@ -43,8 +44,8 @@ import org.springframework.context.annotation.Configuration;
|
||||
@EnableFeignClients(clients = {FileApi.class, RoleApi.class, DeptApi.class, PostApi.class, AdminUserApi.class, SmsSendApi.class, DictDataApi.class, NotifyMessageSendApi.class,
|
||||
SubscribeMessageSendApi.class, SocialClientApi.class, UsersExtApi.class, AttendanceApi.class, BankApi.class, ConfigApi.class, PositionApi.class, SupplierApi.class, AssetsApi.class,
|
||||
AssetsTypeApi.class, AssetReceiveApi.class, AttendanceApi.class, AttendanceGroupApi.class, WorkOvertimeApi.class, HolidayApi.class,
|
||||
RentalOrderApi.class, RentalDepositRecordApi.class, ProjectApi.class, RentalItemsRecordApi.class, AdminOauthUserOtherInfoApi.class, StoreProductAttrValueApi.class, StoreProductApi.class,
|
||||
ContractApi.class, BusinessApi.class, CrmCustomerApi.class, StaffApi.class, LoanApi.class, FactoryInfoApi.class, SalesPerformanceSettlementApi.class
|
||||
RentalOrderApi.class, RentalDepositRecordApi.class, ProjectApi.class, RentalItemsRecordApi.class,AdminOauthUserOtherInfoApi.class, StoreProductAttrValueApi.class, StoreProductApi.class,
|
||||
ContractApi.class, BusinessApi.class, CrmCustomerApi.class, StaffApi.class, LoanApi.class, FactoryInfoApi.class, UserLiveTreeApi.class, SalesPerformanceSettlementApi.class
|
||||
})
|
||||
public class RpcConfiguration {
|
||||
}
|
||||
|
@ -88,4 +88,11 @@ public interface FinancialPaymentService {
|
||||
* @return 支付信息列表
|
||||
*/
|
||||
List<FinancialPaymentDO> getFinancialPaymentList(List<String> processInstanceIds);
|
||||
|
||||
/**
|
||||
* 获取支付信息 统计
|
||||
* @param pageReqVO 查询条件
|
||||
* @return 统计信息
|
||||
*/
|
||||
FinancialPaymentDO getPaymentTotal(FinancialPaymentPageReqVO pageReqVO);
|
||||
}
|
||||
|
@ -252,4 +252,10 @@ public class FinancialPaymentServiceImpl implements FinancialPaymentService {
|
||||
return financialPaymentMapper.selectList(FinancialPaymentDO::getProcessInstanceId, processInstanceIds);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public FinancialPaymentDO getPaymentTotal(FinancialPaymentPageReqVO pageReqVO) {
|
||||
pageReqVO.setReceiveUserId(getLoginUserId());
|
||||
return financialPaymentMapper.selectPaymentTotal(pageReqVO);
|
||||
}
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ import cn.iocoder.yudao.module.hrm.api.crmcontract.ContractApi;
|
||||
import cn.iocoder.yudao.module.hrm.api.crmcontract.dto.CrmContractProductDTO;
|
||||
import cn.iocoder.yudao.module.hrm.api.crmcustomer.CrmCustomerApi;
|
||||
import cn.iocoder.yudao.module.hrm.api.crmcustomer.dto.CrmCustomerDTO;
|
||||
import cn.iocoder.yudao.module.hrm.api.userlivetree.UserLiveTreeApi;
|
||||
import cn.iocoder.yudao.module.product.api.storeproduct.StoreProductApi;
|
||||
import cn.iocoder.yudao.module.product.api.storeproductattrvalue.StoreProductAttrValueApi;
|
||||
import cn.iocoder.yudao.module.product.api.storeproductattrvalue.dto.StoreProductAttrValueApiDTO;
|
||||
@ -107,6 +108,9 @@ public class BpmOAContractServiceImpl extends BpmOABaseService implements BpmOAC
|
||||
@Resource
|
||||
private CrmCustomerApi customerApi;
|
||||
|
||||
@Resource
|
||||
private UserLiveTreeApi userLiveTreeApi;
|
||||
|
||||
@Override
|
||||
public Long createContract(Long userId, BpmOAContractCreateReqVO createReqVO) {
|
||||
// 新增合同DO
|
||||
@ -265,7 +269,15 @@ public class BpmOAContractServiceImpl extends BpmOABaseService implements BpmOAC
|
||||
@Override
|
||||
public PageResult<BpmOAContractRespVO> getContractPage(BpmOAContractPageReqVO pageReqVO) {
|
||||
|
||||
return contractMapper.selectPage(pageReqVO, getLoginUserId());
|
||||
List<Long> userIds = new ArrayList<>();
|
||||
if ("my".equals(pageReqVO.getRelation())) {
|
||||
userIds.add(getLoginUserId());
|
||||
}else if ("sub".equals(pageReqVO.getRelation())){
|
||||
// 查询当前用户 所有下级用户编号
|
||||
userIds.addAll(userLiveTreeApi.getItemIdsByUserId(getLoginUserId()).getCheckedData());
|
||||
}
|
||||
|
||||
return contractMapper.selectPage(pageReqVO, userIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,6 +1,9 @@
|
||||
package cn.iocoder.yudao.module.bpm.service.oa;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.expenses.BpmOAExpensesCreateReqVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.expenses.BpmOAExpensesPageReqVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.expenses.BpmOAExpensesPageRespVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.expenses.BpmOAExpensesRespVO;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAExpensesDO;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAExpensesItemDO;
|
||||
@ -57,4 +60,11 @@ public interface BpmOAExpensesService {
|
||||
* @return 开支对象
|
||||
*/
|
||||
BpmOAExpensesRespVO convertExpenses(BpmOAExpensesDO expenses);
|
||||
|
||||
/**
|
||||
* 获得生产开支申请分页
|
||||
* @param pageReqVO 分页信息
|
||||
* @return 分页结果
|
||||
*/
|
||||
PageResult<BpmOAExpensesPageRespVO> getExpensesPage(BpmOAExpensesPageReqVO pageReqVO);
|
||||
}
|
||||
|
@ -1,10 +1,14 @@
|
||||
package cn.iocoder.yudao.module.bpm.service.oa;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.UploadUserFile;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils;
|
||||
import cn.iocoder.yudao.module.bpm.api.task.BpmProcessInstanceApi;
|
||||
import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.expenses.BpmOAExpensesCreateReqVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.expenses.BpmOAExpensesPageReqVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.expenses.BpmOAExpensesPageRespVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.expenses.BpmOAExpensesRespVO;
|
||||
import cn.iocoder.yudao.module.bpm.convert.oa.BpmOAExpensesConvert;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAExpensesDO;
|
||||
@ -18,6 +22,7 @@ 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 com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@ -27,6 +32,7 @@ import javax.annotation.Resource;
|
||||
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;
|
||||
@ -82,6 +88,8 @@ public class BpmOAExpensesServiceImpl extends BpmOABaseService implements BpmOAE
|
||||
|
||||
// 发起 BPM 流程
|
||||
Map<String, Object> processInstanceVariables = new HashMap<>();
|
||||
String type = bpmOAExpensesItemDOS.stream().map(item -> item.getType().toString()).collect(Collectors.joining(","));
|
||||
processInstanceVariables.put("type", type);
|
||||
String processInstanceId = processInstanceApi.createProcessInstance(userId,
|
||||
new BpmProcessInstanceCreateReqDTO().setProcessDefinitionKey(PROCESS_KEY)
|
||||
.setVariables(processInstanceVariables).setBusinessKey(String.valueOf(expenses.getId()))).getCheckedData();
|
||||
@ -163,4 +171,10 @@ public class BpmOAExpensesServiceImpl extends BpmOABaseService implements BpmOAE
|
||||
|
||||
return BpmOAExpensesConvert.INSTANCE.convert1(expenses, expensesItemDOs, deptMap, bankRespDTO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<BpmOAExpensesPageRespVO> getExpensesPage(BpmOAExpensesPageReqVO pageReqVO) {
|
||||
IPage<BpmOAExpensesPageRespVO> page = expensesMapper.selectExpensesPage(MyBatisUtils.buildPage(pageReqVO) ,pageReqVO);
|
||||
return new PageResult<>(page.getRecords(), page.getTotal());
|
||||
}
|
||||
}
|
||||
|
@ -13,11 +13,15 @@ import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.receipt.BpmOAReceiptCr
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.receipt.BpmOAReceiptPageReqVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.receipt.BpmOAReceiptRespVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.receipt.ReceiptStatisticsVO;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAContractDO;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAReceiptDO;
|
||||
import cn.iocoder.yudao.module.bpm.dal.mysql.oa.BpmOAContractMapper;
|
||||
import cn.iocoder.yudao.module.bpm.dal.mysql.oa.BpmOAReceiptMapper;
|
||||
import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceResultEnum;
|
||||
import cn.iocoder.yudao.module.bpm.service.task.BpmHistoryProcessInstanceService;
|
||||
import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService;
|
||||
import cn.iocoder.yudao.module.hrm.api.userlivetree.UserLiveTreeApi;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import org.flowable.engine.runtime.ProcessInstance;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@ -26,6 +30,7 @@ import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@ -62,6 +67,12 @@ public class BpmOAReceiptServiceImpl extends BpmOABaseService implements BpmOARe
|
||||
@Resource
|
||||
private BpmProcessInstanceService bpmProcessInstanceService;
|
||||
|
||||
@Resource
|
||||
private UserLiveTreeApi userLiveTreeApi;
|
||||
|
||||
@Resource
|
||||
private BpmOAContractMapper contractMapper;
|
||||
|
||||
@Override
|
||||
public Long createReceipt(Long userId, BpmOAReceiptCreateReqVO createReqVO) {
|
||||
|
||||
@ -105,7 +116,10 @@ public class BpmOAReceiptServiceImpl extends BpmOABaseService implements BpmOARe
|
||||
ProcessInstance instance = bpmProcessInstanceService.getProcessInstance(processInstanceId);
|
||||
|
||||
if (instance.isEnded()) {
|
||||
|
||||
// 更新合同表的回款金额
|
||||
contractMapper.update(null, new LambdaUpdateWrapper<BpmOAContractDO>()
|
||||
.setSql("return_money = return_money + " + receiptDO.getMoney())
|
||||
.eq(BpmOAContractDO::getId, receiptDO.getContractId()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -135,7 +149,15 @@ public class BpmOAReceiptServiceImpl extends BpmOABaseService implements BpmOARe
|
||||
@Override
|
||||
public PageResult<BpmOAReceiptRespVO> getReceiptPage(BpmOAReceiptPageReqVO pageReqVO) {
|
||||
|
||||
return receiptMapper.selectReceiptPage(pageReqVO, getLoginUserId());
|
||||
List<Long> userIds = new ArrayList<>();
|
||||
if ("my".equals(pageReqVO.getRelation())) {
|
||||
userIds.add(getLoginUserId());
|
||||
}else if ("sub".equals(pageReqVO.getRelation())){
|
||||
// 查询当前用户 所有下级用户编号
|
||||
userIds.addAll(userLiveTreeApi.getItemIdsByUserId(getLoginUserId()).getCheckedData());
|
||||
}
|
||||
|
||||
return receiptMapper.selectReceiptPage(pageReqVO, userIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -102,4 +102,65 @@
|
||||
a.id = #{id}
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectPaymentTotal" resultType="cn.iocoder.yudao.module.bpm.dal.dataobject.financialpayment.FinancialPaymentDO">
|
||||
SELECT
|
||||
SUM(a.amount_payable) AS amountPayable,
|
||||
SUM(a.actual_payment) AS actualPayment
|
||||
FROM
|
||||
bpm_financial_payment a
|
||||
LEFT JOIN system_users b ON a.user_id = b.id
|
||||
LEFT JOIN system_dept as c on b.dept_id = c.id
|
||||
LEFT JOIN system_users as d on a.receive_user_id = d.id
|
||||
WHERE
|
||||
a.deleted = 0
|
||||
<if test="vo.deptIds != null and vo.deptIds.size() > 0">
|
||||
AND c.id IN
|
||||
<foreach collection="vo.deptIds" item="deptId" open="(" separator="," close=")">
|
||||
#{deptId}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="vo.nickname != null and vo.nickname != ''">
|
||||
and b.nickname like concat('%', #{vo.nickname}, '%')
|
||||
</if>
|
||||
<if test="vo.type != null">
|
||||
and a.type = #{vo.type}
|
||||
</if>
|
||||
<if test="vo.status != null">
|
||||
and a.status = #{vo.status}
|
||||
</if>
|
||||
<if test="vo.financeName != null and vo.financeName != ''">
|
||||
and d.nickname like concat('%', #{vo.financeName}, '%')
|
||||
</if>
|
||||
<if test="vo.receiveType != null">
|
||||
<if test="vo.receiveType == 1">
|
||||
and a.receive_user_id is null
|
||||
</if>
|
||||
<if test="vo.receiveType == 2">
|
||||
and a.receive_user_id is not null
|
||||
</if>
|
||||
<if test="vo.receiveType == 3">
|
||||
and a.receive_user_id = #{vo.receiveUserId}
|
||||
</if>
|
||||
<if test="vo.receiveType == 4">
|
||||
and a.receive_user_id != #{vo.receiveUserId}
|
||||
</if>
|
||||
</if>
|
||||
<if test="vo.beginTime != null and vo.beginTime.length > 0">
|
||||
<if test="vo.beginTime[0] != null">
|
||||
and a.begin_time >= #{vo.beginTime[0]}
|
||||
</if>
|
||||
<if test="vo.beginTime[1] != null">
|
||||
and a.begin_time <= #{vo.beginTime[1]}
|
||||
</if>
|
||||
</if>
|
||||
<if test="vo.endTime != null and vo.endTime.length > 0">
|
||||
<if test="vo.endTime[0] != null">
|
||||
and a.end_time >= #{vo.endTime[0]}
|
||||
</if>
|
||||
<if test="vo.endTime[1] != null">
|
||||
and a.end_time <= #{vo.endTime[1]}
|
||||
</if>
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
|
@ -0,0 +1,60 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.iocoder.yudao.module.bpm.dal.mysql.oa.BpmOAExpensesMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
<select id="selectExpensesPage" resultType="cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.expenses.BpmOAExpensesPageRespVO">
|
||||
SELECT
|
||||
a.expenses_id AS expensesId,
|
||||
a.type as type,
|
||||
a.cost_section AS costSection,
|
||||
a.dept_id AS deptId,
|
||||
d.name AS deptName,
|
||||
a.total_money AS amount,
|
||||
a.detail AS detail,
|
||||
b.user_id AS userId,
|
||||
u.nickname AS userName,
|
||||
b.bank_id AS bankId,
|
||||
ub.nickname AS payeeName,
|
||||
ub.bank_no AS bankNo,
|
||||
ub.bank_name AS bankName,
|
||||
b.total_money AS totalMoney,
|
||||
b.process_instance_id AS processInstanceId
|
||||
FROM bpm_oa_expenses b
|
||||
JOIN bpm_oa_expenses_item a ON a.expenses_id = b.id
|
||||
JOIN bpm_process_instance_ext c ON c.process_instance_id = b.process_instance_id
|
||||
LEFT JOIN system_dept d ON d.factory_id = a.dept_id
|
||||
LEFT JOIN system_users u ON u.id = b.user_id
|
||||
LEFT JOIN system_bank ub ON ub.id = b.bank_id
|
||||
WHERE
|
||||
a.deleted = 0
|
||||
AND b.deleted = 0
|
||||
<if test="pageReqVO.userId != null">
|
||||
AND b.user_id = #{pageReqVO.userId}
|
||||
</if>
|
||||
<if test="pageReqVO.factoryId != null">
|
||||
AND a.dept_id = #{pageReqVO.factoryId}
|
||||
</if>
|
||||
<if test="pageReqVO.type != null">
|
||||
AND a.type = #{pageReqVO.type}
|
||||
</if>
|
||||
<if test="pageReqVO.costSection != null">
|
||||
AND a.cost_section = #{pageReqVO.costSection}
|
||||
</if>
|
||||
<if test="pageReqVO.endTime != null and pageReqVO.endTime.length > 0">
|
||||
<if test="pageReqVO.endTime[0] != null">
|
||||
and c.end_time >= #{pageReqVO.endTime[0]}
|
||||
</if>
|
||||
<if test="pageReqVO.endTime[1] != null">
|
||||
and c.end_time <= #{pageReqVO.endTime[1]}
|
||||
</if>
|
||||
</if>
|
||||
ORDER BY c.end_time DESC, a.expenses_id
|
||||
</select>
|
||||
</mapper>
|
@ -0,0 +1,25 @@
|
||||
package cn.iocoder.yudao.module.hrm.api.userlivetree;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.hrm.enums.ApiConstants;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿:fallbackFactory =
|
||||
@Tag(name = "RPC 服务 - CRM用户结构树")
|
||||
public interface UserLiveTreeApi {
|
||||
|
||||
String PREFIX = ApiConstants.PREFIX + "/crm/userLiveTree";
|
||||
|
||||
@GetMapping(PREFIX + "/get-list")
|
||||
@Operation(summary = "通过用户id获取所有子集用户id")
|
||||
@Parameter(name = "id", description = "用户编号", required = true, example = "1024")
|
||||
CommonResult<List<Long>> getItemIdsByUserId(@RequestParam("id") Long id);
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package cn.iocoder.yudao.module.crm.api.userlivetree;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.crm.service.userlivetree.UserLiveTreeService;
|
||||
import cn.iocoder.yudao.module.hrm.api.userlivetree.UserLiveTreeApi;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Flowable CRM Api 实现类
|
||||
*/
|
||||
@RestController
|
||||
@Validated
|
||||
public class UserLiveTreeApiImpl implements UserLiveTreeApi {
|
||||
|
||||
@Resource
|
||||
private UserLiveTreeService userLiveTreeService;
|
||||
|
||||
@Override
|
||||
public CommonResult<List<Long>> getItemIdsByUserId(Long id) {
|
||||
|
||||
return success(userLiveTreeService.getItemIdsByUserId(id));
|
||||
}
|
||||
}
|
@ -14,7 +14,6 @@ public class RentalCustomerSaveReqVO {
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "客户名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六")
|
||||
@NotEmpty(message = "客户名称不能为空")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "手机号")
|
||||
|
@ -95,8 +95,19 @@ public class CustomerSettlementServiceImpl implements CustomerSettlementService
|
||||
|
||||
// 同步更新结算明细
|
||||
if (CollUtil.isNotEmpty(updateReqVO.getSettlementItems())) {
|
||||
// 获取需创建的 结算明细
|
||||
List<SettlementItemDO> createDO = BeanUtils.toBean(updateReqVO.getSettlementItems(), SettlementItemDO.class).stream()
|
||||
.filter(item -> item.getId() == null)
|
||||
.collect(Collectors.toList());
|
||||
// 获取需更新的 结算明细
|
||||
List<SettlementItemDO> updateDO = BeanUtils.toBean(updateReqVO.getSettlementItems(), SettlementItemDO.class).stream()
|
||||
.filter(item -> item.getId() != null)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
//插入
|
||||
settlementItemMapper.insertBatch(createDO);
|
||||
// 更新
|
||||
settlementItemMapper.updateBatch(BeanUtils.toBean(updateReqVO.getSettlementItems(), SettlementItemDO.class));
|
||||
settlementItemMapper.updateBatch(updateDO);
|
||||
}
|
||||
|
||||
customerSettlementMapper.updateById(updateObj);
|
||||
|
@ -281,9 +281,11 @@ public class HolidayUserRecordServiceImpl implements HolidayUserRecordService {
|
||||
String year = String.valueOf(now.getYear());
|
||||
newHolidayUserDOList.forEach(
|
||||
a -> {
|
||||
newHolidayUserEmploymentRecordDOList.add(new HolidayUserEmploymentRecordDO().setUserId(a.getUserId())
|
||||
.setHolidaySettingId(holidaySetting.getId())
|
||||
.setYearNum(year));
|
||||
if (BigDecimal.ZERO.compareTo(a.getHolidayBalance()) > 0) {
|
||||
newHolidayUserEmploymentRecordDOList.add(new HolidayUserEmploymentRecordDO().setUserId(a.getUserId())
|
||||
.setHolidaySettingId(holidaySetting.getId())
|
||||
.setYearNum(year));
|
||||
}
|
||||
}
|
||||
);
|
||||
if (CollUtil.isNotEmpty(newHolidayUserEmploymentRecordDOList)) {
|
||||
@ -300,6 +302,7 @@ public class HolidayUserRecordServiceImpl implements HolidayUserRecordService {
|
||||
List<AdminUserDO> users = this.getUsersByRange(holidaySetting, holidaySettingRangeDOS);
|
||||
// -- 计算获取每个人的假期额度
|
||||
Map<Long, BigDecimal> userQuotaMap = this.getQuotaMap(users, holidayBalanceSettingDO, holidayWorkingAgeDOS);
|
||||
log.info("计算获取每个人的假期额度 userQuotaMap:{}", userQuotaMap);
|
||||
// -- 获取用户的假期表
|
||||
List<Long> userIds = users.stream().map(AdminUserDO::getId).collect(Collectors.toList());
|
||||
Map<Long, AdminUserDO> userMap = users.stream().collect(Collectors.toMap(AdminUserDO::getId, a -> a));
|
||||
|
@ -18,6 +18,7 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode SIZE_NOT_EXISTS = new ErrorCode(1_000_000_004, "规格不存在");
|
||||
|
||||
ErrorCode STAFF_NOT_EXISTS = new ErrorCode(1_000_000_005, "员工不存在");
|
||||
ErrorCode ACCESSORIES_COLLAR_NOT_EXISTS = new ErrorCode(1_000_000_006, "配件费用不存在");
|
||||
|
||||
//打包线模块
|
||||
ErrorCode PACKAGE_NOT_EXISTS = new ErrorCode(1_000_001_001, "打包线信息不存在");
|
||||
|
@ -0,0 +1,93 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.controller.admin.accessoriescollar;
|
||||
|
||||
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.controller.admin.accessoriescollar.vo.AccessoriesCollarPageReqVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.accessoriescollar.vo.AccessoriesCollarRespVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.accessoriescollar.vo.AccessoriesCollarSaveReqVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.accessoriescollar.AccessoriesCollarDO;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.factoryinfo.FactoryInfoDO;
|
||||
import cn.iocoder.yudao.module.smartfactory.service.accessoriescollar.AccessoriesCollarService;
|
||||
import cn.iocoder.yudao.module.smartfactory.service.factoryinfo.FactoryInfoService;
|
||||
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.validation.Valid;
|
||||
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;
|
||||
|
||||
@Tag(name = "管理后台 - 厂区配件领用")
|
||||
@RestController
|
||||
@RequestMapping("/smartfactory/accessories-collar")
|
||||
@Validated
|
||||
public class AccessoriesCollarController {
|
||||
|
||||
@Resource
|
||||
private AccessoriesCollarService accessoriesCollarService;
|
||||
|
||||
@Resource
|
||||
private FactoryInfoService factoryInfoService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建厂区配件领用")
|
||||
@PreAuthorize("@ss.hasPermission('smartfactory:accessories-collar:create')")
|
||||
public CommonResult<Long> createAccessoriesCollar(@Valid @RequestBody AccessoriesCollarSaveReqVO createReqVO) {
|
||||
return success(accessoriesCollarService.createAccessoriesCollar(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新厂区配件领用")
|
||||
@PreAuthorize("@ss.hasPermission('smartfactory:accessories-collar:update')")
|
||||
public CommonResult<Boolean> updateAccessoriesCollar(@Valid @RequestBody AccessoriesCollarSaveReqVO updateReqVO) {
|
||||
accessoriesCollarService.updateAccessoriesCollar(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除厂区配件领用")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('smartfactory:accessories-collar:delete')")
|
||||
public CommonResult<Boolean> deleteAccessoriesCollar(@RequestParam("id") Long id) {
|
||||
accessoriesCollarService.deleteAccessoriesCollar(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得厂区配件领用")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('smartfactory:accessories-collar:query')")
|
||||
public CommonResult<AccessoriesCollarRespVO> getAccessoriesCollar(@RequestParam("id") Long id) {
|
||||
AccessoriesCollarDO accessoriesCollar = accessoriesCollarService.getAccessoriesCollar(id);
|
||||
return success(BeanUtils.toBean(accessoriesCollar, AccessoriesCollarRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得厂区配件领用分页")
|
||||
@PreAuthorize("@ss.hasPermission('smartfactory:accessories-collar:query')")
|
||||
public CommonResult<PageResult<AccessoriesCollarRespVO>> getAccessoriesCollarPage(@Valid AccessoriesCollarPageReqVO pageReqVO) {
|
||||
PageResult<AccessoriesCollarRespVO> pageResult = BeanUtils.toBean(accessoriesCollarService.getAccessoriesCollarPage(pageReqVO), AccessoriesCollarRespVO.class);
|
||||
if (CollUtil.isNotEmpty(pageResult.getList())) {
|
||||
// 获取工厂编号
|
||||
Set<Long> factoryIds = convertSet(pageResult.getList(), AccessoriesCollarRespVO::getFactoryId);
|
||||
// 获取工厂信息
|
||||
Map<Long, FactoryInfoDO> factoryMap = convertMap(factoryInfoService.getFactoryList(factoryIds), FactoryInfoDO::getId);
|
||||
|
||||
pageResult.getList().forEach(data -> {
|
||||
// 设置工厂名称
|
||||
data.setFactoryName(factoryMap.containsKey(data.getFactoryId()) ? factoryMap.get(data.getFactoryId()).getShortName() : null);
|
||||
});
|
||||
}
|
||||
return success(BeanUtils.toBean(pageResult, AccessoriesCollarRespVO.class));
|
||||
}
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.controller.admin.accessoriescollar.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 厂区配件领用分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class AccessoriesCollarPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "工厂编号", example = "10000008")
|
||||
private Long factoryId;
|
||||
|
||||
@Schema(description = "领用月份 | YYYY-MM")
|
||||
private String month;
|
||||
|
||||
@Schema(description = "状态 | 0未确认 1已确认", example = "0")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.controller.admin.accessoriescollar.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 厂区配件领用 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class AccessoriesCollarRespVO {
|
||||
|
||||
@Schema(description = "厂区配件领用表单主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@ExcelProperty("厂区配件领用表单主键")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "工厂编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10000008")
|
||||
@ExcelProperty("工厂编号")
|
||||
private Long factoryId;
|
||||
|
||||
@Schema(description = "工厂名称", example = "工厂名称")
|
||||
private String factoryName;
|
||||
|
||||
@Schema(description = "领用月份 | YYYY-MM")
|
||||
@ExcelProperty("领用月份 | YYYY-MM")
|
||||
private String month;
|
||||
|
||||
@Schema(description = "叉车配件费用")
|
||||
@ExcelProperty("叉车配件费用")
|
||||
private BigDecimal forkliftAccessories;
|
||||
|
||||
@Schema(description = "打包配件费用")
|
||||
@ExcelProperty("打包配件费用")
|
||||
private BigDecimal packageAccessories;
|
||||
|
||||
@Schema(description = "搬运劳保费用")
|
||||
@ExcelProperty("搬运劳保费用")
|
||||
private BigDecimal transportationAmount;
|
||||
|
||||
@Schema(description = "状态 | 0未确认 1已确认", example = "0")
|
||||
@ExcelProperty("状态 | 0未确认 1已确认")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.controller.admin.accessoriescollar.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Schema(description = "管理后台 - 厂区配件领用新增/修改 Request VO")
|
||||
@Data
|
||||
public class AccessoriesCollarSaveReqVO {
|
||||
|
||||
@Schema(description = "厂区配件领用表单主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "工厂编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10000008")
|
||||
@NotNull(message = "工厂编号不能为空")
|
||||
private Long factoryId;
|
||||
|
||||
@Schema(description = "领用月份 | YYYY-MM")
|
||||
private String month;
|
||||
|
||||
@Schema(description = "叉车配件费用")
|
||||
private BigDecimal forkliftAccessories;
|
||||
|
||||
@Schema(description = "打包配件费用")
|
||||
private BigDecimal packageAccessories;
|
||||
|
||||
@Schema(description = "搬运劳保费用")
|
||||
private BigDecimal transportationAmount;
|
||||
|
||||
@Schema(description = "状态 | 0未确认 1已确认", example = "0")
|
||||
private Integer status;
|
||||
|
||||
}
|
@ -153,6 +153,17 @@ public class FactoryInfoController {
|
||||
return success(BeanUtils.toBean(pageResult, FactoryInfoRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/get-profit")
|
||||
@Operation(summary = "获得工厂每月利润")
|
||||
@Parameter(name = "factoryId", description = "工厂编号")
|
||||
@Parameter(name = "month", description = "查询月份")
|
||||
@PreAuthorize("@ss.hasPermission('smartfactory:factory-info:query')")
|
||||
public CommonResult<List<FactoryProfitVO>> getProfit(@RequestParam(name = "factoryId", required = false) Long factoryId,
|
||||
@RequestParam("month") String month) {
|
||||
|
||||
return success(factoryInfoService.getProfit(factoryId, month));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出工厂信息 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('smartfactory:factory-info:export')")
|
||||
|
@ -0,0 +1,107 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.controller.admin.factoryinfo.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Schema(description = "管理后台 - 工厂利润VO")
|
||||
@Data
|
||||
public class FactoryProfitVO {
|
||||
|
||||
@Schema(description = "工厂编号", example = "1024")
|
||||
private Long factoryId;
|
||||
|
||||
@Schema(description = "工厂名称", example = "芋道")
|
||||
private String factoryName;
|
||||
|
||||
@Schema(description = "结算月份", example = "2023-01")
|
||||
private String settlementMonth;
|
||||
|
||||
@Schema(description = "叉车收入", example = "10000")
|
||||
private BigDecimal forkliftRevenue;
|
||||
|
||||
@Schema(description = "打包收入", example = "10000")
|
||||
private BigDecimal packageRevenue;
|
||||
|
||||
@Schema(description = "搬运收入")
|
||||
private BigDecimal porterageRevenue;
|
||||
|
||||
@Schema(description = "叉车租赁收入")
|
||||
private BigDecimal forkliftRentalRevenue;
|
||||
|
||||
@Schema(description = "运输收入")
|
||||
private BigDecimal transportationRevenue;
|
||||
|
||||
@Schema(description = "叉车扣款")
|
||||
private BigDecimal forkliftDeduction;
|
||||
|
||||
@Schema(description = "打包扣款")
|
||||
private BigDecimal packageDeduction;
|
||||
|
||||
@Schema(description = "搬运扣款")
|
||||
private BigDecimal porterageDeduction;
|
||||
|
||||
@Schema(description = "水电扣款")
|
||||
private BigDecimal hydropower;
|
||||
|
||||
@Schema(description = "工伤保险")
|
||||
private BigDecimal employment;
|
||||
|
||||
@Schema(description = "其他(理赔、扣点)")
|
||||
private BigDecimal other;
|
||||
|
||||
@Schema(description = "叉车工资")
|
||||
private BigDecimal forkliftSalary;
|
||||
|
||||
@Schema(description = "打包工资")
|
||||
private BigDecimal packageSalary;
|
||||
|
||||
@Schema(description = "搬运工资")
|
||||
private BigDecimal porterageSalary;
|
||||
|
||||
@Schema(description = "运输工资")
|
||||
private BigDecimal transportSalary;
|
||||
|
||||
@Schema(description = "其他工资")
|
||||
private BigDecimal otherSalary;
|
||||
|
||||
@Schema(description = "叉车配件")
|
||||
private BigDecimal forkliftAccessories;
|
||||
|
||||
@Schema(description = "打包配件")
|
||||
private BigDecimal packageAccessories;
|
||||
|
||||
@Schema(description = "搬运劳保")
|
||||
private BigDecimal transportationAmount;
|
||||
|
||||
@Schema(description = "工伤赔偿")
|
||||
private BigDecimal injuryAmount;
|
||||
|
||||
@Schema(description = "借支")
|
||||
private BigDecimal loanAmount;
|
||||
|
||||
@Schema(description = "差旅费用")
|
||||
private BigDecimal travelExpenses;
|
||||
|
||||
@Schema(description = "其他")
|
||||
private BigDecimal otherAmount;
|
||||
|
||||
@Schema(description = "叉车支出")
|
||||
private BigDecimal forkliftExpenses;
|
||||
|
||||
@Schema(description = "打包支出")
|
||||
private BigDecimal packageExpenses;
|
||||
|
||||
@Schema(description = "搬运支出")
|
||||
private BigDecimal transportationExpenses;
|
||||
|
||||
@Schema(description = "叉车毛利")
|
||||
private BigDecimal forkliftGrossProfit;
|
||||
|
||||
@Schema(description = "打包毛利")
|
||||
private BigDecimal packageGrossProfit;
|
||||
|
||||
@Schema(description = "搬运毛利")
|
||||
private BigDecimal porterageGrossProfit;
|
||||
}
|
@ -110,7 +110,7 @@ public class StaffController {
|
||||
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);
|
||||
data.setFactoryName(factoryInfoMap.containsKey(data.getFactoryId()) ? factoryInfoMap.get(data.getFactoryId()).getShortName() : null);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,56 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.dal.dataobject.accessoriescollar;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 厂区配件领用 DO
|
||||
*
|
||||
* @author 符溶馨
|
||||
*/
|
||||
@TableName("sf_accessories_collar")
|
||||
@KeySequence("sf_accessories_collar_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class AccessoriesCollarDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 厂区配件领用表单主键
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 工厂编号
|
||||
*/
|
||||
private Long factoryId;
|
||||
/**
|
||||
* 领用月份 | YYYY-MM
|
||||
*/
|
||||
private String month;
|
||||
/**
|
||||
* 叉车配件费用
|
||||
*/
|
||||
private BigDecimal forkliftAccessories;
|
||||
/**
|
||||
* 打包配件费用
|
||||
*/
|
||||
private BigDecimal packageAccessories;
|
||||
/**
|
||||
* 搬运劳保费用
|
||||
*/
|
||||
private BigDecimal transportationAmount;
|
||||
/**
|
||||
* 状态 | 0未确认 1已确认
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.dal.mysql.accessoriescollar;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.accessoriescollar.vo.AccessoriesCollarPageReqVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.accessoriescollar.AccessoriesCollarDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 厂区配件领用 Mapper
|
||||
*
|
||||
* @author 符溶馨
|
||||
*/
|
||||
@Mapper
|
||||
public interface AccessoriesCollarMapper extends BaseMapperX<AccessoriesCollarDO> {
|
||||
|
||||
default PageResult<AccessoriesCollarDO> selectPage(AccessoriesCollarPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<AccessoriesCollarDO>()
|
||||
.eqIfPresent(AccessoriesCollarDO::getFactoryId, reqVO.getFactoryId())
|
||||
.eqIfPresent(AccessoriesCollarDO::getMonth, reqVO.getMonth())
|
||||
.eqIfPresent(AccessoriesCollarDO::getStatus, reqVO.getStatus())
|
||||
.betweenIfPresent(AccessoriesCollarDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(AccessoriesCollarDO::getId));
|
||||
}
|
||||
|
||||
}
|
@ -5,6 +5,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.factoryinfo.vo.FactoryInfoPageReqVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.factoryinfo.vo.FactoryProfitVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.screendata.factory.vo.FactoryRollDataRespVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.factoryinfo.FactoryInfoDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
@ -53,4 +54,7 @@ public interface FactoryInfoMapper extends BaseMapperX<FactoryInfoDO> {
|
||||
* @return 返回与给定工厂ID相关联的天气代码,类型为String。
|
||||
*/
|
||||
String getWeatherCodeByFactoryId(@Param("factoryId") Long factoryId, @Param("areaCode") String areaCode);
|
||||
|
||||
List<FactoryProfitVO> selectProfit(@Param("factoryId") Long factoryId,
|
||||
@Param("month") String month);
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.service.accessoriescollar;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.accessoriescollar.vo.AccessoriesCollarPageReqVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.accessoriescollar.vo.AccessoriesCollarSaveReqVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.accessoriescollar.AccessoriesCollarDO;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* 厂区配件领用 Service 接口
|
||||
*
|
||||
* @author 符溶馨
|
||||
*/
|
||||
public interface AccessoriesCollarService {
|
||||
|
||||
/**
|
||||
* 创建厂区配件领用
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createAccessoriesCollar(@Valid AccessoriesCollarSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新厂区配件领用
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateAccessoriesCollar(@Valid AccessoriesCollarSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除厂区配件领用
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteAccessoriesCollar(Long id);
|
||||
|
||||
/**
|
||||
* 获得厂区配件领用
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 厂区配件领用
|
||||
*/
|
||||
AccessoriesCollarDO getAccessoriesCollar(Long id);
|
||||
|
||||
/**
|
||||
* 获得厂区配件领用分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 厂区配件领用分页
|
||||
*/
|
||||
PageResult<AccessoriesCollarDO> getAccessoriesCollarPage(AccessoriesCollarPageReqVO pageReqVO);
|
||||
|
||||
}
|
@ -0,0 +1,71 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.service.accessoriescollar;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.accessoriescollar.vo.AccessoriesCollarPageReqVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.accessoriescollar.vo.AccessoriesCollarSaveReqVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.accessoriescollar.AccessoriesCollarDO;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.mysql.accessoriescollar.AccessoriesCollarMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.smartfactory.enums.ErrorCodeConstants.ACCESSORIES_COLLAR_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
* 厂区配件领用 Service 实现类
|
||||
*
|
||||
* @author 符溶馨
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class AccessoriesCollarServiceImpl implements AccessoriesCollarService {
|
||||
|
||||
@Resource
|
||||
private AccessoriesCollarMapper accessoriesCollarMapper;
|
||||
|
||||
@Override
|
||||
public Long createAccessoriesCollar(AccessoriesCollarSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
AccessoriesCollarDO accessoriesCollar = BeanUtils.toBean(createReqVO, AccessoriesCollarDO.class);
|
||||
accessoriesCollarMapper.insert(accessoriesCollar);
|
||||
// 返回
|
||||
return accessoriesCollar.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateAccessoriesCollar(AccessoriesCollarSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateAccessoriesCollarExists(updateReqVO.getId());
|
||||
// 更新
|
||||
AccessoriesCollarDO updateObj = BeanUtils.toBean(updateReqVO, AccessoriesCollarDO.class);
|
||||
accessoriesCollarMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAccessoriesCollar(Long id) {
|
||||
// 校验存在
|
||||
validateAccessoriesCollarExists(id);
|
||||
// 删除
|
||||
accessoriesCollarMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateAccessoriesCollarExists(Long id) {
|
||||
if (accessoriesCollarMapper.selectById(id) == null) {
|
||||
throw exception(ACCESSORIES_COLLAR_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AccessoriesCollarDO getAccessoriesCollar(Long id) {
|
||||
return accessoriesCollarMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<AccessoriesCollarDO> getAccessoriesCollarPage(AccessoriesCollarPageReqVO pageReqVO) {
|
||||
return accessoriesCollarMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.smartfactory.service.factoryinfo;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.factoryinfo.vo.FactoryInfoPageReqVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.factoryinfo.vo.FactoryInfoSaveReqVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.factoryinfo.vo.FactoryProfitVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.factoryinfo.vo.FactoryUpdateStatusReqVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.screendata.factory.vo.FactoryRollDataRespVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.screendata.factory.vo.ProvincesDataRespVO;
|
||||
@ -136,4 +137,13 @@ public interface FactoryInfoService {
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateFactoryStatus(FactoryUpdateStatusReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 工厂每月利润
|
||||
*
|
||||
* @param factoryId 工厂编号
|
||||
* @param month 月份
|
||||
* @return 利润列表
|
||||
*/
|
||||
List<FactoryProfitVO> getProfit(Long factoryId, String month);
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.service.factoryinfo;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||
import cn.iocoder.yudao.framework.common.enums.DeptTypeEnum;
|
||||
@ -10,6 +11,7 @@ import cn.iocoder.yudao.framework.ip.core.utils.AreaUtils;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.factoryinfo.vo.FactoryInfoPageReqVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.factoryinfo.vo.FactoryInfoSaveReqVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.factoryinfo.vo.FactoryProfitVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.factoryinfo.vo.FactoryUpdateStatusReqVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.screendata.factory.vo.FactoryRollDataRespVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.screendata.factory.vo.ProvincesDataRespVO;
|
||||
@ -280,4 +282,32 @@ public class FactoryInfoServiceImpl implements FactoryInfoService {
|
||||
deptRespDTO.setStatus(updateReqVO.getStatus());
|
||||
deptApi.updateFactoryDept(deptRespDTO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FactoryProfitVO> getProfit(Long factoryId, String month) {
|
||||
|
||||
List<FactoryProfitVO> result = factoryInfoMapper.selectProfit(factoryId, month);
|
||||
if (CollUtil.isNotEmpty(result)) {
|
||||
// 设置叉车毛利、打包毛利、搬运毛利 = 收入 - 扣款 - 人员工资 - 支出
|
||||
result.forEach(vo -> {
|
||||
// 设置叉车毛利
|
||||
vo.setForkliftGrossProfit(vo.getForkliftRevenue()
|
||||
.subtract(vo.getForkliftDeduction())
|
||||
.subtract(vo.getForkliftSalary())
|
||||
.subtract(vo.getForkliftExpenses()));
|
||||
// 设置打包毛利
|
||||
vo.setPackageGrossProfit(vo.getPackageRevenue()
|
||||
.subtract(vo.getPackageDeduction())
|
||||
.subtract(vo.getPackageSalary())
|
||||
.subtract(vo.getPackageExpenses()));
|
||||
// 设置搬运毛利
|
||||
vo.setPorterageGrossProfit(vo.getPorterageRevenue()
|
||||
.subtract(vo.getPorterageDeduction())
|
||||
.subtract(vo.getPorterageSalary())
|
||||
.subtract(vo.getTransportationExpenses()));
|
||||
});
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
@ -110,7 +110,9 @@ public class StaffServiceImpl implements StaffService {
|
||||
|
||||
// 设置工种名称
|
||||
dos.forEach(item -> {
|
||||
item.setPostName(workTypeMap.getOrDefault(item.getWorkTypeId().toString(), ""));
|
||||
if (item.getWorkTypeId() != null) {
|
||||
item.setPostName(workTypeMap.getOrDefault(item.getWorkTypeId().toString(), ""));
|
||||
}
|
||||
});
|
||||
|
||||
vo.setTotal(dos.size());
|
||||
|
@ -31,4 +31,123 @@
|
||||
left join sf_factory_info as b on a.code = #{areaCode}
|
||||
where b.id = #{factoryId}
|
||||
</select>
|
||||
|
||||
<select id="selectProfit" resultType="cn.iocoder.yudao.module.smartfactory.controller.admin.factoryinfo.vo.FactoryProfitVO">
|
||||
WITH json_extracted AS (
|
||||
SELECT
|
||||
scs.id AS settlement_id,-- 提取 JSON 中的值,将 NULL 替换为 0.00
|
||||
COALESCE ( JSON_UNQUOTE( JSON_EXTRACT( scs.other_deductions, '$[0].value' )), '0.00' ) AS hydropower,
|
||||
COALESCE ( JSON_UNQUOTE( JSON_EXTRACT( scs.other_deductions, '$[1].value' )), '0.00' ) AS employment,
|
||||
COALESCE ( JSON_UNQUOTE( JSON_EXTRACT( scs.other_deductions, '$[2].value' )), '0.00' ) AS other,
|
||||
scs.tenant_id
|
||||
FROM
|
||||
system_customer_settlement scs
|
||||
)
|
||||
SELECT
|
||||
sf.id AS factoryId,
|
||||
sf.short_name AS factoryName,
|
||||
#{month} AS settlementMonth,-- 收入明细
|
||||
SUM( CASE WHEN ssi.business_type = 1 THEN COALESCE(ssi.settlement_amount, ssi.pre_settlement_amount) ELSE 0 END ) AS forkliftRevenue,-- 叉车收入
|
||||
SUM( CASE WHEN ssi.business_type = 2 THEN COALESCE(ssi.settlement_amount, ssi.pre_settlement_amount) ELSE 0 END ) AS packageRevenue,-- 打包收入
|
||||
SUM( CASE WHEN ssi.business_type = 3 THEN COALESCE(ssi.settlement_amount, ssi.pre_settlement_amount) ELSE 0 END ) AS porterageRevenue,-- 搬运收入
|
||||
SUM( CASE WHEN ssi.business_type = 4 THEN COALESCE(ssi.settlement_amount, ssi.pre_settlement_amount) ELSE 0 END ) AS forkliftRentalRevenue,-- 叉车租赁收入
|
||||
SUM( CASE WHEN ssi.business_type = 5 THEN COALESCE(ssi.settlement_amount, ssi.pre_settlement_amount) ELSE 0 END ) AS transportationRevenue,-- 运输收入
|
||||
SUM( CASE WHEN ssi.business_type = 1 THEN ssi.deduction_amount ELSE 0 END ) AS forkliftDeduction,-- 叉车扣款
|
||||
SUM( CASE WHEN ssi.business_type = 2 THEN ssi.deduction_amount ELSE 0 END ) AS packageDeduction,-- 打包扣款
|
||||
SUM( CASE WHEN ssi.business_type = 3 THEN ssi.deduction_amount ELSE 0 END ) AS porterageDeduction,-- 搬运扣款
|
||||
je.hydropower AS hydropower,-- 水电扣款
|
||||
je.employment AS employment,-- 工商扣款
|
||||
je.other AS other,-- 其他(理赔、扣点)
|
||||
COALESCE ( sss.forkliftSalary, 0.00 ) AS forkliftSalary,-- 叉车实发工资
|
||||
COALESCE ( sss.packageSalary, 0.00 ) AS packageSalary,-- 打包实发工资
|
||||
COALESCE ( sss.porterageSalary, 0.00 ) AS porterageSalary,-- 搬运实发工资
|
||||
COALESCE ( sss.transportSalary, 0.00 ) AS transportSalary,-- 运输实发工资
|
||||
COALESCE ( sss.otherSalary, 0.00 ) AS otherSalary,-- 其他实发工资
|
||||
COALESCE ( iii.forkliftAccessories, 0.00 ) + COALESCE ( sac.forklift_accessories, 0.00 ) AS forkliftAccessories, -- 叉车配件
|
||||
COALESCE ( iii.packageAccessories, 0.00 ) + COALESCE ( sac.package_accessories, 0.00 ) AS packageAccessories, -- 打包配件
|
||||
COALESCE ( iii.transportationAmount, 0.00 ) + COALESCE ( sac.transportation_amount, 0.00 ) AS transportationAmount, -- 搬运劳保
|
||||
COALESCE ( iii.injuryAmount, 0.00 ) AS injuryAmount, -- 工伤赔偿
|
||||
COALESCE ( loan.loanAmount, 0.00 ) AS loanAmount, -- 工资及借支
|
||||
COALESCE ( iii.travelExpenses, 0.00 ) AS travelExpenses, -- 差旅费用
|
||||
COALESCE ( iii.otherAmount, 0.00 ) AS otherAmount, -- 其他
|
||||
COALESCE ( iii.forkliftExpenses, 0.00 ) + COALESCE ( sac.forklift_accessories, 0.00 ) AS forkliftExpenses, -- 叉车支出
|
||||
COALESCE ( iii.packageExpenses, 0.00 ) + COALESCE ( sac.package_accessories, 0.00 ) AS packageExpenses, -- 打包支出
|
||||
COALESCE ( iii.transportationExpenses, 0.00 ) + COALESCE ( sac.transportation_amount, 0.00 ) AS transportationExpenses -- 搬运支出
|
||||
FROM
|
||||
sf_factory_info sf
|
||||
LEFT JOIN system_customer_settlement scs ON sf.id = scs.customer_id AND scs.settlement_month = #{month}
|
||||
LEFT JOIN system_settlement_item ssi ON scs.id = ssi.settlement_id
|
||||
LEFT JOIN json_extracted je ON scs.id = je.settlement_id
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
s.factory_id,
|
||||
ss.month,
|
||||
SUM( CASE WHEN s.business_type = 2 THEN ss.payable_amount - ss.deduction_amount ELSE 0 END ) AS forkliftSalary,-- 叉车实发工资
|
||||
SUM( CASE WHEN s.business_type = 1 THEN ss.payable_amount - ss.deduction_amount ELSE 0 END ) AS packageSalary,-- 打包实发工资
|
||||
SUM( CASE WHEN s.business_type = 3 THEN ss.payable_amount - ss.deduction_amount ELSE 0 END ) AS porterageSalary,-- 搬运实发工资
|
||||
SUM( CASE WHEN s.business_type = 5 THEN ss.payable_amount - ss.deduction_amount ELSE 0 END ) AS transportSalary,-- 运输实发工资
|
||||
SUM( CASE WHEN ISNULL( s.business_type ) THEN ss.payable_amount - ss.deduction_amount ELSE 0 END ) AS otherSalary -- 其他实发工资
|
||||
FROM
|
||||
sf_staff s
|
||||
JOIN sf_staff_salary ss ON s.id = ss.staff_id
|
||||
WHERE
|
||||
1 = 1
|
||||
GROUP BY
|
||||
s.factory_id,
|
||||
ss.month
|
||||
) sss ON sf.id = sss.factory_id
|
||||
AND sss.month = #{month}
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
boei.dept_id,
|
||||
DATE_FORMAT( bp.end_time, '%Y-%m' ) AS month,
|
||||
SUM( CASE WHEN boei.type = 1 THEN boei.total_money ELSE 0 END ) AS forkliftAccessories,-- 叉车配件
|
||||
SUM( CASE WHEN boei.type = 2 THEN boei.total_money ELSE 0 END ) AS packageAccessories,-- 打包配件
|
||||
SUM( CASE WHEN boei.type = 6 AND boei.cost_section = 3 THEN boei.total_money ELSE 0 END ) AS transportationAmount,-- 搬运劳保
|
||||
SUM( CASE WHEN boei.type = 7 THEN boei.total_money ELSE 0 END ) AS injuryAmount,-- 工伤赔偿
|
||||
SUM( CASE WHEN boei.type = 11 THEN boei.total_money ELSE 0 END ) AS travelExpenses,-- 差旅费用
|
||||
SUM( CASE WHEN boei.type IN (3,4,5,8,9,10,12) AND ( boei.type = 6 AND boei.cost_section <> 3 ) THEN boei.total_money ELSE 0 END ) AS otherAmount, -- 其他
|
||||
SUM( CASE WHEN boei.cost_section = 1 THEN boei.total_money ELSE 0 END ) AS forkliftExpenses, -- 叉车支出
|
||||
SUM( CASE WHEN boei.cost_section = 2 THEN boei.total_money ELSE 0 END ) AS packageExpenses, -- 打包支出
|
||||
SUM( CASE WHEN boei.cost_section = 3 THEN boei.total_money ELSE 0 END ) AS transportationExpenses -- 搬运支出
|
||||
FROM
|
||||
bpm_oa_expenses_item boei
|
||||
JOIN bpm_oa_expenses boe ON boei.expenses_id = boe.id
|
||||
JOIN bpm_process_instance_ext bp ON boe.process_instance_id = bp.process_instance_id
|
||||
WHERE
|
||||
boe.deleted = 0
|
||||
and boe.result = 2
|
||||
GROUP BY
|
||||
boei.dept_id,
|
||||
DATE_FORMAT( bp.end_time, '%Y-%m' )
|
||||
) iii ON sf.id = iii.dept_id
|
||||
AND iii.MONTH = #{month}
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
oaLoan.total_money as loanAmount,
|
||||
oaLoan.factory_id as factoryId,
|
||||
DATE_FORMAT( bp.end_time, '%Y-%m' ) as endTime
|
||||
FROM
|
||||
bpm_oa_loan oaLoan,
|
||||
bpm_process_instance_ext bp
|
||||
WHERE
|
||||
oaLoan.process_instance_id = bp.process_instance_id
|
||||
AND oaLoan.deleted = 0
|
||||
AND oaLoan.result = 2
|
||||
) loan ON sf.id = loan.factoryId
|
||||
AND loan.endTime = #{month}
|
||||
LEFT JOIN sf_accessories_collar sac ON sac.factory_id = sf.id
|
||||
AND sac.month = #{month}
|
||||
AND sac.status = 1
|
||||
AND sac.deleted = 0
|
||||
WHERE
|
||||
sf.type = 3
|
||||
AND sf.deleted = 0
|
||||
AND sf.status = 0
|
||||
<if test="factoryId != null">
|
||||
AND sf.id = #{factoryId}
|
||||
</if>
|
||||
GROUP BY
|
||||
sf.id;
|
||||
</select>
|
||||
</mapper>
|
Loading…
Reference in New Issue
Block a user