Compare commits
4 Commits
d726cc5abb
...
940918d2b8
Author | SHA1 | Date | |
---|---|---|---|
![]() |
940918d2b8 | ||
![]() |
c0d0515fe5 | ||
![]() |
0a8e1c73ec | ||
![]() |
4bba4a5507 |
@ -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;
|
||||
}
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
@ -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>
|
@ -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);
|
||||
|
@ -44,14 +44,14 @@
|
||||
system_customer_settlement scs
|
||||
)
|
||||
SELECT
|
||||
scs.customer_id AS factoryId,
|
||||
factory.short_name AS factoryName,
|
||||
scs.settlement_month,-- 收入明细
|
||||
SUM( CASE WHEN ssi.business_type = 1 THEN ssi.settlement_amount ELSE 0 END ) AS forkliftRevenue,-- 叉车收入
|
||||
SUM( CASE WHEN ssi.business_type = 2 THEN ssi.settlement_amount ELSE 0 END ) AS packageRevenue,-- 打包收入
|
||||
SUM( CASE WHEN ssi.business_type = 3 THEN ssi.settlement_amount ELSE 0 END ) AS porterageRevenue,-- 搬运收入
|
||||
SUM( CASE WHEN ssi.business_type = 4 THEN ssi.settlement_amount ELSE 0 END ) AS forkliftRentalRevenue,-- 叉车租赁收入
|
||||
SUM( CASE WHEN ssi.business_type = 5 THEN ssi.settlement_amount ELSE 0 END ) AS transportationRevenue,-- 运输收入
|
||||
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,-- 搬运扣款
|
||||
@ -63,19 +63,19 @@
|
||||
COALESCE ( sss.porterageSalary, 0.00 ) AS porterageSalary,-- 搬运实发工资
|
||||
COALESCE ( sss.transportSalary, 0.00 ) AS transportSalary,-- 运输实发工资
|
||||
COALESCE ( sss.otherSalary, 0.00 ) AS otherSalary,-- 其他实发工资
|
||||
COALESCE ( iii.forkliftAccessories + sac.forklift_accessories, 0.00 ) AS forkliftAccessories, -- 叉车配件
|
||||
COALESCE ( iii.packageAccessories + sac.package_accessories, 0.00 ) AS packageAccessories, -- 打包配件
|
||||
COALESCE ( iii.transportationAmount + sac.transportation_amount, 0.00 ) AS transportationAmount, -- 搬运劳保
|
||||
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 + sac.forklift_accessories, 0.00 ) AS forkliftExpenses, -- 叉车支出
|
||||
COALESCE ( iii.packageExpenses + sac.package_accessories, 0.00 ) AS packageExpenses, -- 打包支出
|
||||
COALESCE ( iii.transportationExpenses + sac.transportation_amount, 0.00 ) AS transportationExpenses -- 搬运支出
|
||||
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
|
||||
system_customer_settlement scs
|
||||
LEFT JOIN sf_factory_info factory ON scs.customer_id = factory.id
|
||||
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 (
|
||||
@ -95,12 +95,12 @@
|
||||
GROUP BY
|
||||
s.factory_id,
|
||||
ss.month
|
||||
) sss ON scs.customer_id = sss.factory_id
|
||||
AND scs.settlement_month = sss.month
|
||||
) sss ON sf.id = sss.factory_id
|
||||
AND sss.month = #{month}
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
boei.dept_id,
|
||||
DATE_FORMAT( boei.application_date, '%Y-%m' ) AS month,
|
||||
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,-- 搬运劳保
|
||||
@ -113,14 +113,15 @@
|
||||
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( boei.application_date, '%Y-%m' )
|
||||
) iii ON scs.customer_id = iii.dept_id
|
||||
AND scs.settlement_month = iii.MONTH
|
||||
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,
|
||||
@ -133,18 +134,20 @@
|
||||
oaLoan.process_instance_id = bp.process_instance_id
|
||||
AND oaLoan.deleted = 0
|
||||
AND oaLoan.result = 2
|
||||
) loan ON scs.customer_id = loan.factoryId
|
||||
AND scs.settlement_month = loan.endTime
|
||||
LEFT JOIN sf_accessories_collar sac ON sac.factory_id = scs.customer_id
|
||||
AND scs.settlement_month = sac.month
|
||||
) 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
|
||||
scs.settlement_month = #{month}
|
||||
sf.type = 3
|
||||
AND sf.deleted = 0
|
||||
AND sf.status = 0
|
||||
<if test="factoryId != null">
|
||||
AND scs.customer_id = #{factoryId}
|
||||
AND sf.id = #{factoryId}
|
||||
</if>
|
||||
GROUP BY
|
||||
scs.id;
|
||||
sf.id;
|
||||
</select>
|
||||
</mapper>
|
Loading…
Reference in New Issue
Block a user