Compare commits

...

3 Commits

Author SHA1 Message Date
furongxin
92b22c5c5e refactor(smartfactory): 优化员工考勤记录创建逻辑
- 在创建员工考勤记录时,先初始化一个空的 ArrayList,然后再使用 BeanUtils 进行转换- 这样做的目的是确保在转换前有一个干净的列表,避免潜在的数据污染问题
- 同时,这种写法也更加清晰易读,有助于代码维护
2025-04-10 01:20:30 +08:00
furongxin
72254590dc feat(system): 客户结算信息增加统计功能并优化相关数据结构
- 新增客户结算信息统计接口和相关数据结构
-为 CustomerSettlementDO 和 SettlementItemDO 添加新的财务相关字段
- 优化 CustomerSettlementPageReqVO 结构,支持日期范围查询- 为 LoanMapper 添加新的查询条件,提高贷款查询的灵活性
2025-04-10 01:20:20 +08:00
furongxin
f1b88b349a fix(bpm): 修复报销和借款相关问题
- 修改报销查询条件,使用月份格式比较时间- 更新报销和借款关联方式,使用 LEFT JOIN
- 在报销流程中添加工厂 ID 变量- 优化借款查询 SQL,移除不必要的条件
2025-04-10 01:20:06 +08:00
19 changed files with 139 additions and 33 deletions

View File

@ -112,6 +112,7 @@ public class BpmOAExpensesServiceImpl extends BpmOABaseService implements BpmOAE
String type = bpmOAExpensesItemDOS.stream().map(item -> item.getType().toString()).collect(Collectors.joining(","));
processInstanceVariables.put("type", type);
processInstanceVariables.put("factoryType", expenses.getFactoryType());
processInstanceVariables.put("factory_id", bpmOAExpensesItemDOS.get(0).getDeptId());
String processInstanceId = processInstanceService.createProcessInstance(userId,
new BpmProcessInstanceCreateReqDTO().setProcessDefinitionKey(PROCESS_KEY)
.setVariables(processInstanceVariables).setBusinessKey(String.valueOf(expenses.getId())));

View File

@ -52,10 +52,10 @@
</if>
<if test="pageReqVO.endTime != null and pageReqVO.endTime.length > 0">
<if test="pageReqVO.endTime[0] != null">
and c.end_time &gt;= #{pageReqVO.endTime[0]}
and DATE_FORMAT(c.end_time, '%Y-%m') &gt;= #{pageReqVO.endTime[0]}
</if>
<if test="pageReqVO.endTime[1] != null">
and c.end_time &lt;= #{pageReqVO.endTime[1]}
and DATE_FORMAT(c.end_time, '%Y-%m') &lt;= #{pageReqVO.endTime[1]}
</if>
</if>
ORDER BY c.end_time DESC, a.expenses_id
@ -68,8 +68,8 @@
SUM(a.total_money) - SUM(a.amount_paid) AS remainingPayable
FROM
bpm_oa_expenses a
JOIN bpm_oa_expenses_item b ON b.expenses_id = b.id
JOIN bpm_process_instance_ext c ON c.process_instance_id = a.process_instance_id
LEFT JOIN bpm_oa_expenses_item b ON b.expenses_id = a.id
LEFT JOIN bpm_process_instance_ext c ON c.process_instance_id = a.process_instance_id
WHERE
a.deleted = 0
AND b.deleted = 0
@ -88,10 +88,10 @@
</if>
<if test="pageReqVO.endTime != null and pageReqVO.endTime.length > 0">
<if test="pageReqVO.endTime[0] != null">
and c.end_time &gt;= #{pageReqVO.endTime[0]}
and DATE_FORMAT(c.end_time, '%Y-%m') &gt;= #{pageReqVO.endTime[0]}
</if>
<if test="pageReqVO.endTime[1] != null">
and c.end_time &lt;= #{pageReqVO.endTime[1]}
and DATE_FORMAT(c.end_time, '%Y-%m') &lt;= #{pageReqVO.endTime[1]}
</if>
</if>
</select>

View File

@ -59,7 +59,6 @@
1 AS type
FROM
bpm_oa_expenses e
JOIN bpm_oa_loan l ON e.user_id = l.user_id AND l.sf_user_id = #{pageReqVO.staffId}
LEFT JOIN system_users u ON e.user_id = u.id
LEFT JOIN system_dept d ON u.dept_id = d.id
LEFT JOIN bpm_process_instance_ext p ON e.process_instance_id = p.process_instance_id
@ -67,7 +66,6 @@
e.deleted = 0
AND e.result = 2
AND e.status = 2
AND l.deleted = 0
AND u.deleted = 0
AND d.deleted = 0
AND p.deleted = 0

View File

@ -9,10 +9,7 @@ import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import cn.iocoder.yudao.module.smartfactory.api.factoryInfo.FactoryInfoApi;
import cn.iocoder.yudao.module.smartfactory.api.factoryInfo.dto.FactoryInfoDTO;
import cn.iocoder.yudao.module.system.controller.admin.customersettlement.vo.CustomerSettlementPageReqVO;
import cn.iocoder.yudao.module.system.controller.admin.customersettlement.vo.CustomerSettlementRespVO;
import cn.iocoder.yudao.module.system.controller.admin.customersettlement.vo.CustomerSettlementSaveReqVO;
import cn.iocoder.yudao.module.system.controller.admin.customersettlement.vo.SettlementItemVO;
import cn.iocoder.yudao.module.system.controller.admin.customersettlement.vo.*;
import cn.iocoder.yudao.module.system.dal.dataobject.customersettlement.CustomerSettlementDO;
import cn.iocoder.yudao.module.system.dal.dataobject.customersettlement.SettlementItemDO;
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
@ -136,7 +133,7 @@ public class CustomerSettlementController {
item.setSettlementItems(BeanUtils.toBean(itemMap.get(item.getId()), SettlementItemVO.class));
}
// 设置工厂名称
item.setCustomerName(factoryMap.get(item.getCustomerId()).getName());
item.setCustomerName(factoryMap.get(item.getCustomerId()).getShortName());
// 设置创建人名称
item.setCreatorName(userMap.get(item.getCreator()) == null ? "" : userMap.get(item.getCreator()).getNickname());
});
@ -145,6 +142,14 @@ public class CustomerSettlementController {
return success(respVO);
}
@GetMapping("/total")
@Operation(summary = "获得结算统计信息")
@PreAuthorize("@ss.hasPermission('system:customer-settlement:query')")
public CommonResult<StatisticsVO> getCustomerSettlementTotal(@Valid CustomerSettlementPageReqVO pageReqVO) {
return success(customerSettlementService.getCustomerSettlementTotal(pageReqVO));
}
@GetMapping("/export-excel")
@Operation(summary = "导出客户结算信息 Excel")
@PreAuthorize("@ss.hasPermission('system:customer-settlement:export')")

View File

@ -19,7 +19,7 @@ public class CustomerSettlementPageReqVO extends PageParam {
private Integer businessType;
@Schema(description = "结算月份")
private String settlementMonth;
private String[] settlementMonth;
@Schema(description = "结算公司id", example = "3044")
private Long companyId;

View File

@ -6,6 +6,7 @@ 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;
import java.util.List;
@ -35,6 +36,9 @@ public class CustomerSettlementRespVO {
@Schema(description = "收款明细")
private List<PaymentItem> paymentItem;
@Schema(description = "收款金额")
private BigDecimal paymentAmount;
@Schema(description = "备注")
private String notes;

View File

@ -6,6 +6,7 @@ import lombok.Data;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.List;
@Schema(description = "管理后台 - 客户结算信息新增/修改 Request VO")
@ -29,6 +30,9 @@ public class CustomerSettlementSaveReqVO {
@Schema(description = "收款明细")
private List<PaymentItem> paymentItem;
@Schema(description = "收款金额")
private BigDecimal paymentAmount;
@Schema(description = "备注")
private String notes;

View File

@ -27,6 +27,12 @@ public class SettlementItemVO {
@Schema(description = "扣款明细")
private List<OtherDeductionsVO> deductionItems;
@Schema(description = "扣款金额")
private BigDecimal deductionAmount;
@Schema(description = "结算金额")
private BigDecimal settlementAmount;
@Schema(description = "已收款金额")
private BigDecimal receivedTotal;
}

View File

@ -0,0 +1,26 @@
package cn.iocoder.yudao.module.system.controller.admin.customersettlement.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.math.BigDecimal;
@Schema(description = "管理后台 - 客户结算信息统计 Response VO")
@Data
public class StatisticsVO {
@Schema(description = "预结算金额")
private BigDecimal preSettlementTotal;
@Schema(description = "应结算金额")
private BigDecimal shouldSettlementTotal;
@Schema(description = "扣款金额")
private BigDecimal deductionTotal;
@Schema(description = "结算金额")
private BigDecimal settlementTotal;
@Schema(description = "已收款金额")
private BigDecimal receivedTotal;
}

View File

@ -23,8 +23,10 @@ public class LoanPageReqVO extends PageParam {
@Schema(description = "借支用户部门编号", example = "128")
private Long deptId;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
@Schema(description = "借支类型")
private Integer loanType;
@Schema(description = "查询方式 | 是否查询全部借支 0否 1是 为0时查询 剩余金额不为0的借支")
private Integer model = 0;
}

View File

@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import lombok.*;
import java.math.BigDecimal;
import java.util.List;
/**
@ -48,6 +49,11 @@ public class CustomerSettlementDO extends BaseDO {
@TableField(typeHandler = JacksonTypeHandler.class)
private List<PaymentItem> paymentItem;
/**
* 收款金额
*/
private BigDecimal paymentAmount;
/**
* 备注
*/

View File

@ -57,6 +57,11 @@ public class SettlementItemDO extends BaseDO {
@TableField(typeHandler = JacksonTypeHandler.class)
private List<OtherDeductionsVO> deductionItems;
/**
* 扣款金额
*/
private BigDecimal deductionAmount;
/**
* 结算金额
*/

View File

@ -4,8 +4,10 @@ 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.system.controller.admin.customersettlement.vo.CustomerSettlementPageReqVO;
import cn.iocoder.yudao.module.system.controller.admin.customersettlement.vo.StatisticsVO;
import cn.iocoder.yudao.module.system.dal.dataobject.customersettlement.CustomerSettlementDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* 客户结算信息 Mapper
@ -18,8 +20,9 @@ public interface CustomerSettlementMapper extends BaseMapperX<CustomerSettlement
default PageResult<CustomerSettlementDO> selectPage(CustomerSettlementPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<CustomerSettlementDO>()
.eqIfPresent(CustomerSettlementDO::getCustomerId, reqVO.getCustomerId())
.eqIfPresent(CustomerSettlementDO::getSettlementMonth, reqVO.getSettlementMonth())
.betweenIfPresent(CustomerSettlementDO::getSettlementMonth, reqVO.getSettlementMonth())
.orderByDesc(CustomerSettlementDO::getId));
}
StatisticsVO selectTotal(@Param("reqVO") CustomerSettlementPageReqVO pageReqVO);
}

View File

@ -23,7 +23,9 @@ public interface LoanMapper extends BaseMapperX<LoanDO> {
return selectPage(reqVO, new LambdaQueryWrapperX<LoanDO>()
.eqIfPresent(LoanDO::getUserId, reqVO.getUserId())
.eqIfPresent(LoanDO::getDeptId, reqVO.getDeptId())
.betweenIfPresent(LoanDO::getCreateTime, reqVO.getCreateTime())
.eqIfPresent(LoanDO::getLoanType, reqVO.getLoanType())
.ne(reqVO.getModel() == 0, LoanDO::getRemainingAmount, 0)
.orderByDesc(LoanDO::getRemainingAmount)
.orderByDesc(LoanDO::getUserId));
}

View File

@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.system.service.customersettlement;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.system.controller.admin.customersettlement.vo.CustomerSettlementPageReqVO;
import cn.iocoder.yudao.module.system.controller.admin.customersettlement.vo.CustomerSettlementSaveReqVO;
import cn.iocoder.yudao.module.system.controller.admin.customersettlement.vo.StatisticsVO;
import cn.iocoder.yudao.module.system.dal.dataobject.customersettlement.CustomerSettlementDO;
import cn.iocoder.yudao.module.system.dal.dataobject.customersettlement.SettlementItemDO;
@ -67,7 +68,14 @@ public interface CustomerSettlementService {
* 更新结算信息确认状态
*
* @param id 编号
* @param status
* @param status 状态
*/
void updateConfirm(Long id, Integer status);
/**
* 获得结算统计信息
* @param pageReqVO 查询信息
* @return 统计信息
*/
StatisticsVO getCustomerSettlementTotal(CustomerSettlementPageReqVO pageReqVO);
}

View File

@ -7,6 +7,7 @@ import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.infra.api.file.FileApi;
import cn.iocoder.yudao.module.system.controller.admin.customersettlement.vo.CustomerSettlementPageReqVO;
import cn.iocoder.yudao.module.system.controller.admin.customersettlement.vo.CustomerSettlementSaveReqVO;
import cn.iocoder.yudao.module.system.controller.admin.customersettlement.vo.StatisticsVO;
import cn.iocoder.yudao.module.system.controller.admin.worklog.vo.upload.UploadUserFile;
import cn.iocoder.yudao.module.system.dal.dataobject.customersettlement.CustomerSettlementDO;
import cn.iocoder.yudao.module.system.dal.dataobject.customersettlement.SettlementItemDO;
@ -162,4 +163,10 @@ public class CustomerSettlementServiceImpl implements CustomerSettlementService
.setId(id)
.setStatus(status));
}
@Override
public StatisticsVO getCustomerSettlementTotal(CustomerSettlementPageReqVO pageReqVO) {
return customerSettlementMapper.selectTotal(pageReqVO);
}
}

View File

@ -0,0 +1,40 @@
<?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.system.dal.mysql.customersettlement.CustomerSettlementMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
<select id="selectTotal" resultType="cn.iocoder.yudao.module.system.controller.admin.customersettlement.vo.StatisticsVO">
SELECT
SUM(b.pre_settlement_amount) AS preSettlementTotal,
SUM(b.should_settlement_amount) AS shouldSettlementTotal,
SUM(b.deduction_amount) AS deductionTotal,
SUM(b.settlement_amount) AS settlementTotal,
SUM(a.payment_amount) AS receivedTotal
FROM
system_customer_settlement a
LEFT JOIN system_settlement_item b ON b.settlement_id = a.id
WHERE
a.deleted = 0
AND b.deleted = 0
<if test="reqVO.customerId != null">
AND a.customer_id = #{reqVO.customerId}
</if>
<if test="reqVO.businessType != null">
AND b.business_type = #{reqVO.businessType}
</if>
<if test="reqVO.settlementMonth != null and reqVO.settlementMonth.length > 0">
<if test="reqVO.settlementMonth[0] != null">
and a.settlement_month &gt;= #{reqVO.settlementMonth[0]}
</if>
<if test="reqVO.settlementMonth[1] != null">
and a.settlement_month &lt;= #{reqVO.settlementMonth[1]}
</if>
</if>
</select>
</mapper>

View File

@ -1,12 +0,0 @@
<?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.system.dal.mysql.linefixedassetstemporarytable.LineFixedAssetsTemporaryTableMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>

View File

@ -56,7 +56,8 @@ public class StaffAttendanceRecordServiceImpl implements StaffAttendanceRecordSe
List<StaffAttendanceRecordDO> createDo = new ArrayList<>();
for (StaffAttendanceRecordSaveReqVO vo : createReqVO) {
List<StaffAttendanceRecordDO> staffAttendanceRecord = BeanUtils.toBean(vo.getRecords(), StaffAttendanceRecordDO.class);
List<StaffAttendanceRecordDO> staffAttendanceRecord = new ArrayList<>();
staffAttendanceRecord = BeanUtils.toBean(vo.getRecords(), StaffAttendanceRecordDO.class);
// 移除status为空得数据
staffAttendanceRecord.removeIf(item -> item.getStatus() == null);