财务子单mapper

This commit is contained in:
HH 2022-05-25 11:48:07 +08:00
parent 014a9ae814
commit 3a8ab950ac
3 changed files with 64 additions and 63 deletions

View File

@ -152,7 +152,7 @@ public class OrderController extends BaseController {
BigDecimal fdPayMoney = payMoney.multiply(PERCENT7);
// 生成上级分销的子财务单
FinancialDetail financialDetail = new FinancialDetail(financialDetailService.createCode(), deptId,
financialMaster.getId(), fdPayMoney, 2, customerPlaceId);
financialMaster.getId(), financialMaster.getCode(), fdPayMoney, 2, customerPlaceId);
financialDetailService.insertFinancialDetail(financialDetail);
companyRatio = companyRatio.subtract(PERCENT7);
}
@ -164,7 +164,7 @@ public class OrderController extends BaseController {
BigDecimal fdPayMoney = payMoney.multiply(PERCENT2);
// 生成祖级分销的子财务单
FinancialDetail financialDetail = new FinancialDetail(financialDetailService.createCode(), deptId,
financialMaster.getId(), fdPayMoney, 2, parentCustomerPlaceId);
financialMaster.getId(), financialMaster.getCode(), fdPayMoney, 2, parentCustomerPlaceId);
financialDetailService.insertFinancialDetail(financialDetail);
companyRatio = companyRatio.subtract(PERCENT2);
}
@ -173,7 +173,7 @@ public class OrderController extends BaseController {
BigDecimal fdPayMoney = payMoney.multiply(companyRatio);
// 生成平台抽成的子财务单
FinancialDetail financialDetail = new FinancialDetail(financialDetailService.createCode(), deptId,
financialMaster.getId(), fdPayMoney, 2, parentCustomerPlaceId);
financialMaster.getId(), financialMaster.getCode(), fdPayMoney, 2, parentCustomerPlaceId);
financialDetailService.insertFinancialDetail(financialDetail);
}

View File

@ -27,6 +27,9 @@ public class FinancialDetail extends BaseEntity {
@Excel(name = "主财务单ID", cellType = Excel.ColumnType.NUMERIC)
private Long financialMasterId;
@Excel(name = "主财务单编码", cellType = Excel.ColumnType.STRING)
private String financialMasterCode;
@Excel(name = "子订单ID", cellType = Excel.ColumnType.NUMERIC)
private Long orderDetailId;
@ -42,7 +45,7 @@ public class FinancialDetail extends BaseEntity {
@Excel(name = "实付金额", cellType = Excel.ColumnType.STRING)
private BigDecimal payMoney;
@Excel(name = "财务子单类型,师傅转派/多级分销/平台抽成", cellType = Excel.ColumnType.NUMERIC)
@Excel(name = "财务子单类型,1师傅转派/2多级分销/3平台抽成", cellType = Excel.ColumnType.NUMERIC)
private Integer financialDetailType;
/**
@ -66,9 +69,11 @@ public class FinancialDetail extends BaseEntity {
public FinancialDetail() {
}
public FinancialDetail(String code, Long deptId, Long financialMasterId, BigDecimal payMoney, Integer financialDetailType, Long payeeId) {
public FinancialDetail(String code, Long deptId, Long financialMasterId, String financialMasterCode, BigDecimal payMoney, Integer financialDetailType, Long payeeId) {
this.deptId = deptId;
this.code = code;
this.financialMasterId = financialMasterId;
this.financialMasterCode = financialMasterCode;
this.payMoney = payMoney;
this.financialDetailType = financialDetailType;
this.payeeId = payeeId;

View File

@ -9,6 +9,7 @@
<result property="deptId" column="dept_id"/>
<result property="code" column="code"/>
<result property="financialMasterId" column="financial_master_id"/>
<result property="financialMasterCode" column="financial_master_code"/>
<result property="orderDetailId" column="order_detail_id"/>
<result property="orderDetailCode" column="order_detail_code"/>
<result property="totalMoney" column="total_money"/>
@ -27,20 +28,9 @@
</resultMap>
<sql id="selectFinancialDetail">
SELECT id,
code,
order_master_id,
order_master_code,
total_money,
discount_money,
pay_money,
pay_type,
pay_status,
pay_time,
financial_detail_type,
create_by,
create_time,
remark
SELECT id, dept_id, code, financial_master_id, financial_master_code, order_detail_id,
order_detail_code, total_money, discount_money, pay_money, financial_detail_type,
payee_id, pay_type, pay_status, pay_time, create_by, create_time, update_by, update_time, remark
FROM financial_detail
</sql>
@ -48,31 +38,32 @@
resultMap="FinancialDetailResult">
<include refid="selectFinancialDetail"/>
<where>
<if test="orderMasterId != null and orderMasterId != 0">
AND order_master_id = #{orderMasterId}
<if test="financialMasterId != null and financialMasterId != 0">
AND financial_master_id = #{financialMasterId}
</if>
<if test="orderMasterCode != null and orderMasterCode != ''">
AND order_master_code LIKE concat('%', #{orderMasterCode}, '%')
<if test="financialMasterCode != null and financialMasterCode != ''">
AND financial_master_code LIKE concat('%', #{financialMasterCode}, '%')
</if>
<if test="payType != null and payType != 0">
<if test="orderDetailId != null and orderDetailId != 0">
AND order_detail_id = #{orderDetailId}
</if>
<if test="orderDetailCode != null and orderDetailCode != ''">
AND order_detail_code LIKE concat('%', #{orderDetailCode}, '%')
</if>
<if test="payType != null">
AND pay_type = #{payType}
</if>
<if test="payStatus != null and payStatus != 0">
<if test="payStatus != null">
AND pay_status = #{payStatus}
</if>
<if test="financialDetailType != null and financialDetailType != 0">
<if test="financialDetailType != null">
AND financial_detail_type = #{financialDetailType}
</if>
</where>
</select>
<select id="selectById" parameterType="long" resultMap="FinancialDetailResult">
<include refid="selectFinancialDetail"/>
<where>
<if test="financialDetailId != null and financialDetailId != 0">
AND id = #{financialDetailId}
</if>
</where>
<include refid="selectFinancialDetail"/> WHERE id = #{financialDetailId}
</select>
<delete id="deleteFinancialDetailByIds" parameterType="Long">
@ -85,16 +76,13 @@
<update id="updateFinancialDetail" parameterType="com.ghy.payment.domain.FinancialDetail">
UPDATE financial_detail
<set>
<if test="code != null and code != 0">code = #{code},</if>
<if test="orderMasterId != null and orderMasterId != ''">order_master_id = #{orderMasterId},</if>
<if test="orderMasterCode != null and orderMasterCode != ''">order_master_code = #{orderMasterCode},</if>
<if test="totalMoney != null and totalMoney != ''">total_money = #{totalMoney},</if>
<if test="discountMoney != null and discountMoney != ''">discount_money = #{discountMoney},</if>
<if test="payType != null and payType != ''">pay_type = #{payType},</if>
<if test="payStatus != null and payStatus != ''">pay_status = #{payStatus},</if>
<if test="payTime != null and payTime != ''">pay_time = #{payTime},</if>
<if test="payMoney != null and payMoney != ''">pay_money = #{payMoney},</if>
<if test="financialDetailType != null and financialDetailType != 0">financial_detail_type = #{financialDetailType},</if>
<if test="code != null and code != ''">code = #{code},</if>
<if test="totalMoney != null">total_money = #{totalMoney},</if>
<if test="discountMoney != null">discount_money = #{discountMoney},</if>
<if test="payType != null">pay_type = #{payType},</if>
<if test="payStatus != null">pay_status = #{payStatus},</if>
<if test="payTime != null">pay_time = #{payTime},</if>
<if test="payMoney != null">pay_money = #{payMoney},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
update_time = SYSDATE()
</set>
@ -104,29 +92,37 @@
<insert id="insertFinancialDetail" parameterType="com.ghy.payment.domain.FinancialDetail" useGeneratedKeys="true"
keyProperty="id">
INSERT INTO financial_detail(
<if test="code != null and code != 0">code,</if>
<if test="orderMasterId != null and orderMasterId != 0">order_master_id,</if>
<if test="orderMasterCode != null and orderMasterCode != ''">order_master_code,</if>
<if test="totalMoney != null and totalMoney != ''">total_money,</if>
<if test="discountMoney != null and discountMoney != ''">discount_money,</if>
<if test="payType != null and payType != ''">pay_type,</if>
<if test="payStatus != null and payStatus != ''">pay_status,</if>
<if test="payTime != null and payTime != ''">pay_time,</if>
<if test="payMoney != null and payMoney != ''">pay_money,</if>
<if test="financialDetailType != null and financialDetailType != ''">financial_detail_type,</if>
<if test="deptId != null and deptId != 0">dept_id,</if>
<if test="code != null and code != ''">code,</if>
<if test="financialMasterId != null and financialMasterId != 0">financial_master_id,</if>
<if test="financialMasterCode != null and financialMasterCode != ''">financial_master_code,</if>
<if test="orderDetailId != null and orderDetailId != 0">order_detail_id,</if>
<if test="orderDetailCode != null and orderDetailCode != ''">order_detail_code,</if>
<if test="totalMoney != null">total_money,</if>
<if test="discountMoney != null">discount_money,</if>
<if test="payMoney != null">pay_money,</if>
<if test="financialDetailType != null">financial_detail_type,</if>
<if test="payeeId != null and payeeId != 0">payee_id,</if>
<if test="payType != null">pay_type,</if>
<if test="payStatus != null">pay_status,</if>
<if test="payTime != null">pay_time,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
create_time
)VALUES(
<if test="code != null and code != 0">#{code},</if>
<if test="orderMasterId != null and orderMasterId != 0">#{orderMasterId},</if>
<if test="orderMasterCode != null and orderMasterCode != ''">#{orderMasterCode},</if>
<if test="totalMoney != null and totalMoney != ''">#{totalMoney},</if>
<if test="discountMoney != null and discountMoney != ''">#{discountMoney},</if>
<if test="payType != null and payType != ''">#{payType},</if>
<if test="payStatus != null and payStatus != ''">#{payStatus},</if>
<if test="payTime != null and payTime != ''">#{payTime},</if>
<if test="payMoney != null and payMoney != ''">#{payMoney},</if>
<if test="financialDetailType != null and financialDetailType != ''">#{financialDetailType},</if>
<if test="deptId != null and deptId != 0">#{deptId},</if>
<if test="code != null and code != ''">#{code},</if>
<if test="financialMasterId != null and financialMasterId != 0">#{financialMasterId},</if>
<if test="financialMasterCode != null and financialMasterCode != ''">#{financialMasterCode},</if>
<if test="orderDetailId != null and orderDetailId != 0">#{orderDetailId},</if>
<if test="orderDetailCode != null and orderDetailCode != ''">#{orderDetailCode},</if>
<if test="totalMoney != null">#{totalMoney},</if>
<if test="discountMoney != null">#{discountMoney},</if>
<if test="payMoney != null">#{payMoney},</if>
<if test="financialDetailType != null">#{financialDetailType},</if>
<if test="payeeId != null and payeeId != 0">#{payeeId},</if>
<if test="payType != null">#{payType},</if>
<if test="payStatus != null">#{payStatus},</if>
<if test="payTime != null">#{payTime},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
SYSDATE()
)
@ -134,7 +130,7 @@
<select id="checkFinancialDetailCodeUnique" parameterType="String" resultMap="FinancialDetailResult">
<include refid="selectFinancialDetail"/>
WHERE `code` =#{financialDetailCode} LIMIT 1
WHERE `code` = #{financialDetailCode} LIMIT 1
</select>
</mapper>