This commit is contained in:
linfso 2024-11-04 16:28:10 +08:00
parent 5f91a22794
commit 4bde47c509
7 changed files with 115 additions and 16 deletions

View File

@ -86,6 +86,9 @@ public class EmisCommonController extends EmisBaseController
@Autowired
private IEmisSettleInvoiceChRecordService emisSettleInvoiceChRecordService;
@Autowired
private IEmisCommissionProfitService emisCommissionProfitService;
@Autowired
private IEmisSettleInvoiceRecordService emisSettleInvoiceRecordService;
@ -619,16 +622,17 @@ public class EmisCommonController extends EmisBaseController
}
/**
* 单独出账
* 计算运单提成
* @return
*/
@GetMapping("/redoBillByBillCode")
public AjaxResult redoBillByBillCode(String billCode){
String lockKey="redoBillByBillCode_"+billCode;
@GetMapping("/reCalcEmpProfitByBillCode")
public AjaxResult reCalcEmpProfitByBillCode(String billCode){
log.error("reCalcEmpProfitByBillCode start");
String lockKey="reCalcEmpProfitByBillCode"+billCode;
// 加锁查询
redissonService.lock(lockKey,300);
try{
emisBaseService.redoGenerateBill(billCode);
emisCommissionProfitService.reCalcEmpProfitByBillCode(billCode);
}
catch (Exception ex){
redissonService.unlock(lockKey);
@ -642,6 +646,7 @@ public class EmisCommonController extends EmisBaseController
return AjaxResult.error("确认异常,联系客服");
}
redissonService.unlock(lockKey);
log.error("reCalcEmpProfitByBillCode end");
return AjaxResult.success("发送成功");
}
@ -670,6 +675,37 @@ public class EmisCommonController extends EmisBaseController
}
/**
* 单独出账
* @return
*/
@GetMapping("/redoBillByBillCode")
public AjaxResult redoBillByBillCode(String billCode){
String lockKey="redoBillByBillCode_"+billCode;
// 加锁查询
redissonService.lock(lockKey,300);
try{
emisBaseService.redoGenerateBill(billCode);
}
catch (Exception ex){
redissonService.unlock(lockKey);
ex.printStackTrace();
// 返回子定义异常
if(ex instanceof EmisBizError){
return AjaxResult.error(ex.getMessage(),((EmisBizError)ex).getErrorCode());
}
return AjaxResult.error("确认异常,联系客服");
}
redissonService.unlock(lockKey);
return AjaxResult.success("发送成功");
}
/**
* 自动出账触发
* @return
@ -989,5 +1025,4 @@ public class EmisCommonController extends EmisBaseController
}
}

View File

@ -19,6 +19,8 @@ import com.xdadan.erp.common.core.domain.TreeEntity;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import lombok.Data;
@ -70,5 +72,7 @@ public class EmisCommissionQuote extends BaseEntity
private String fromCountryName;
private String countryName;
private List<EmisCommissionExpression> exprList;
}

View File

@ -33,7 +33,7 @@ public interface IEmisCommissionProfitService
* @param billCode
* @return
*/
public int reCalcCommissionProfitByBillCode(String billCode);
public int reCalcEmpProfitByBillCode(String billCode);
/**
* 查询员工提成表列表

View File

@ -12,7 +12,10 @@ package com.xdadan.erp.emis.service.impl;
import java.util.List;
import com.xdadan.erp.emis.domain.EmisCommissionExpression;
import com.xdadan.erp.emis.domain.EmisCommissionQuote;
import com.xdadan.erp.emis.domain.EmisWaybill;
import com.xdadan.erp.emis.mapper.EmisCommissionQuoteMapper;
import com.xdadan.erp.emis.service.EmisBaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -20,6 +23,7 @@ import com.xdadan.erp.emis.domain.EmisCommissionProfit;
import com.xdadan.erp.emis.mapper.EmisCommissionProfitMapper;
import com.xdadan.erp.emis.service.IEmisCommissionProfitService;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
/**
* 员工提成表Service业务层处理
@ -33,7 +37,8 @@ public class EmisCommissionProfitServiceImpl extends EmisBaseService implements
@Autowired
private EmisCommissionProfitMapper emisCommissionProfitMapper;
@Autowired
private EmisCommissionQuoteMapper emisCommissionQuoteMapper;
/**
@ -41,9 +46,8 @@ public class EmisCommissionProfitServiceImpl extends EmisBaseService implements
*/
@Override
@Transactional
public int reCalcCommissionProfitByBillCode(String billCode)
public int reCalcEmpProfitByBillCode(String billCode)
{
// 获取运单信息
EmisWaybill waybill = getWaybillByBillCode(billCode);
@ -51,7 +55,45 @@ public class EmisCommissionProfitServiceImpl extends EmisBaseService implements
String pickUpMethod=waybill.getPickupMethod();
String takePieceEmployeeCode=waybill.getTakePieceEmployeeCode();
String operateEmployeeCode=waybill.getOperateEmployeeCode();
String country=waybill.getReceiveCountry();
String fromCountry=waybill.getSendCountry();
// 计算每个岗位的提成方案
/*
网点客服 1
快件单证 2
取件员 3
网点操作员 4
派件员 5
销售联系人 6
中转操作员 7
单证员 8
*/
// 根据不同岗位计算
for(int i=1;i<=8;i++) {
// 网点客服 1
if(i==1) {
EmisCommissionQuote emisCommissionQuote = new EmisCommissionQuote();
emisCommissionQuote.setPostType("1");
emisCommissionQuote.setCountry(country);
emisCommissionQuote.setFromCountry(fromCountry);
// 获取提成方案
List<EmisCommissionQuote> listQuote = emisCommissionQuoteMapper.selectEmisCommissionQuoteList(emisCommissionQuote);
if(!CollectionUtils.isEmpty(listQuote)){
for (EmisCommissionQuote quoteItem:listQuote) {
List<EmisCommissionExpression> exprList=quoteItem.getExprList();
// 按票计算方式
if("1".equals(quoteItem.getCalcType())){
}
}
}
}
}
return 1;

View File

@ -23,6 +23,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select id, quote_id, quote_sequence, use_site_code, use_site, start_weight, end_weight, initial_weight, additional_weight, condition_expression, calculate_expression, status, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site from emis_commission_expression
</sql>
<select id="selectExprListByQuoteId" parameterType="Long" resultMap="EmisCommissionExpressionResult">
select id, quote_id, quote_sequence, use_site_code, use_site, start_weight, end_weight, initial_weight, additional_weight, condition_expression, calculate_expression, status, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
from emis_commission_expression a
where a.quote_id = #{quoteId} and a.del_flag!='1'
</select>
<select id="selectEmisCommissionExpressionList" parameterType="EmisCommissionExpression" resultMap="EmisCommissionExpressionResult">
<include refid="selectEmisCommissionExpressionVo"/>
<where>

View File

@ -23,6 +23,7 @@
<association property="fromCountryName" column="from_country" select="com.xdadan.erp.emis.mapper.EmisBaseMapper.selectCountryNameByCode"/>
<association property="countryName" column="country" select="com.xdadan.erp.emis.mapper.EmisBaseMapper.selectCountryNameByCode"/>
<association property="exprList" column="quote_id" select="com.xdadan.erp.emis.mapper.EmisCommissionExpressionMapper.selectExprListByQuoteId"/>
</resultMap>

View File

@ -51,7 +51,6 @@
<result property="openChStatusDesc" column="open_ch_status_desc" />
<result property="openComCode" column="open_com_code" />
<association property="applyManName" column="apply_man_code" select="com.xdadan.erp.emis.mapper.EmisBaseMapper.selectEmpNameByCode"/>
<association property="applySiteName" column="apply_site_code" select="com.xdadan.erp.emis.mapper.EmisBaseMapper.selectSiteNameByCode"/>
@ -65,7 +64,7 @@
</resultMap>
<sql id="selectEmisSettleInvoiceRecordVo">
select id, apply_seq_no, apply_date, apply_man_code, apply_site_code, customer_code, customer_name, settle_bill_no, settle_bill_name, apply_money, invoice_type, company_name, company_tax_no, company_tel, company_address, bank_name, bank_acc_no, contact, phone, real_tax_type, open_money_max, open_money, invoice_no, invoice_status, invoice_status_desc, recieve_address, email, file_path, remark, bl_audit, audit_date, audit_man_code, audit_site_code, audit_note, op_man_code, op_date, op_site_code, open_ch_id, open_ch_status, open_ch_status_desc, open_com_code, del_flag, create_by, create_time, update_by, update_time, create_site, update_site from emis_settle_invoice_record
select id, apply_seq_no, apply_date, apply_man_code, apply_site_code, customer_code, customer_name, settle_bill_no, settle_bill_name, apply_money, invoice_type, openbill_scope, company_name, company_tax_no, company_tel, company_address, invioce_remark, bank_name, bank_acc_no, contact, phone, real_tax_type, orig_open_money, add_tax_rate, add_open_money, open_money_max, open_money, invoice_no, invoice_status, invoice_status_desc, recieve_address, email, file_path, remark, bl_audit, audit_date, audit_man_code, audit_site_code, audit_note, op_man_code, op_date, op_site_code, open_ch_id, open_ch_status, open_ch_status_desc, open_com_code, del_flag, create_by, create_time, update_by, update_time, create_site, update_site from emis_settle_invoice_record
</sql>
<select id="selectEmisSettleInvoiceRecordList" parameterType="EmisSettleInvoiceRecord" resultMap="EmisSettleInvoiceRecordResult">
@ -263,7 +262,7 @@
</select>
<select id="selectEmisSettleInvoiceRecordById" parameterType="Long" resultMap="EmisSettleInvoiceRecordResult">
select id, apply_seq_no, apply_date, apply_man_code, apply_site_code, customer_code, customer_name, settle_bill_no, settle_bill_name, apply_money, invoice_type, company_name, company_tax_no, company_tel, company_address, bank_name, bank_acc_no, contact, phone, real_tax_type, open_money_max, open_money, invoice_no, invoice_status, invoice_status_desc, recieve_address, email, file_path, remark, bl_audit, audit_date, audit_man_code, audit_site_code, audit_note, op_man_code, op_date, op_site_code, open_ch_id, open_ch_status, open_ch_status_desc, open_com_code, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
select id, apply_seq_no, apply_date, apply_man_code, apply_site_code, customer_code, customer_name, settle_bill_no, settle_bill_name, apply_money, invoice_type, openbill_scope, company_name, company_tax_no, company_tel, company_address, invioce_remark, bank_name, bank_acc_no, contact, phone, real_tax_type, orig_open_money, add_tax_rate, add_open_money, open_money_max, open_money, invoice_no, invoice_status, invoice_status_desc, recieve_address, email, file_path, remark, bl_audit, audit_date, audit_man_code, audit_site_code, audit_note, op_man_code, op_date, op_site_code, open_ch_id, open_ch_status, open_ch_status_desc, open_com_code, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
from emis_settle_invoice_record a
where a.id = #{id}
</select>
@ -271,7 +270,6 @@
<insert id="insertEmisSettleInvoiceRecord" parameterType="EmisSettleInvoiceRecord" useGeneratedKeys="true" keyProperty="id">
insert into emis_settle_invoice_record
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="applySeqNo != null and applySeqNo != ''">apply_seq_no,</if>
<if test="applyDate != null">apply_date,</if>
<if test="applyManCode != null and applyManCode != ''">apply_man_code,</if>
@ -282,15 +280,20 @@
<if test="settleBillName != null and settleBillName != ''">settle_bill_name,</if>
<if test="applyMoney != null">apply_money,</if>
<if test="invoiceType != null and invoiceType != ''">invoice_type,</if>
<if test="openbillScope != null and openbillScope != ''">openbill_scope,</if>
<if test="companyName != null and companyName != ''">company_name,</if>
<if test="companyTaxNo != null and companyTaxNo != ''">company_tax_no,</if>
<if test="companyTel != null and companyTel != ''">company_tel,</if>
<if test="companyAddress != null and companyAddress != ''">company_address,</if>
<if test="invioceRemark != null and invioceRemark != ''">invioce_remark,</if>
<if test="bankName != null and bankName != ''">bank_name,</if>
<if test="bankAccNo != null and bankAccNo != ''">bank_acc_no,</if>
<if test="contact != null and contact != ''">contact,</if>
<if test="phone != null and phone != ''">phone,</if>
<if test="realTaxType != null and realTaxType != ''">real_tax_type,</if>
<if test="origOpenMoney != null">orig_open_money,</if>
<if test="addTaxRate != null">add_tax_rate,</if>
<if test="addOpenMoney != null">add_open_money,</if>
<if test="openMoneyMax != null">open_money_max,</if>
<if test="openMoney != null">open_money,</if>
<if test="invoiceNo != null and invoiceNo != ''">invoice_no,</if>
@ -321,7 +324,6 @@
<if test="updateSite != null and updateSite != ''">update_site,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="applySeqNo != null and applySeqNo != ''">#{applySeqNo},</if>
<if test="applyDate != null">#{applyDate},</if>
<if test="applyManCode != null and applyManCode != ''">#{applyManCode},</if>
@ -332,15 +334,20 @@
<if test="settleBillName != null and settleBillName != ''">#{settleBillName},</if>
<if test="applyMoney != null">#{applyMoney},</if>
<if test="invoiceType != null and invoiceType != ''">#{invoiceType},</if>
<if test="openbillScope != null and openbillScope != ''">#{openbillScope},</if>
<if test="companyName != null and companyName != ''">#{companyName},</if>
<if test="companyTaxNo != null and companyTaxNo != ''">#{companyTaxNo},</if>
<if test="companyTel != null and companyTel != ''">#{companyTel},</if>
<if test="companyAddress != null and companyAddress != ''">#{companyAddress},</if>
<if test="invioceRemark != null and invioceRemark != ''">#{invioceRemark},</if>
<if test="bankName != null and bankName != ''">#{bankName},</if>
<if test="bankAccNo != null and bankAccNo != ''">#{bankAccNo},</if>
<if test="contact != null and contact != ''">#{contact},</if>
<if test="phone != null and phone != ''">#{phone},</if>
<if test="realTaxType != null and realTaxType != ''">#{realTaxType},</if>
<if test="origOpenMoney != null">#{origOpenMoney},</if>
<if test="addTaxRate != null">#{addTaxRate},</if>
<if test="addOpenMoney != null">#{addOpenMoney},</if>
<if test="openMoneyMax != null">#{openMoneyMax},</if>
<if test="openMoney != null">#{openMoney},</if>
<if test="invoiceNo != null and invoiceNo != ''">#{invoiceNo},</if>
@ -375,7 +382,6 @@
<update id="updateEmisSettleInvoiceRecord" parameterType="EmisSettleInvoiceRecord">
update emis_settle_invoice_record
<trim prefix="SET" suffixOverrides=",">
<if test="applySeqNo != null and applySeqNo != ''">apply_seq_no = #{applySeqNo},</if>
<if test="applyDate != null">apply_date = #{applyDate},</if>
<if test="applyManCode != null and applyManCode != ''">apply_man_code = #{applyManCode},</if>
<if test="applySiteCode != null and applySiteCode != ''">apply_site_code = #{applySiteCode},</if>
@ -385,15 +391,20 @@
<if test="settleBillName != null and settleBillName != ''">settle_bill_name = #{settleBillName},</if>
<if test="applyMoney != null">apply_money = #{applyMoney},</if>
<if test="invoiceType != null and invoiceType != ''">invoice_type = #{invoiceType},</if>
<if test="openbillScope != null and openbillScope != ''">openbill_scope = #{openbillScope},</if>
<if test="companyName != null and companyName != ''">company_name = #{companyName},</if>
<if test="companyTaxNo != null and companyTaxNo != ''">company_tax_no = #{companyTaxNo},</if>
<if test="companyTel != null and companyTel != ''">company_tel = #{companyTel},</if>
<if test="companyAddress != null and companyAddress != ''">company_address = #{companyAddress},</if>
<if test="invioceRemark != null and invioceRemark != ''">invioce_remark = #{invioceRemark},</if>
<if test="bankName != null and bankName != ''">bank_name = #{bankName},</if>
<if test="bankAccNo != null and bankAccNo != ''">bank_acc_no = #{bankAccNo},</if>
<if test="contact != null and contact != ''">contact = #{contact},</if>
<if test="phone != null and phone != ''">phone = #{phone},</if>
<if test="realTaxType != null and realTaxType != ''">real_tax_type = #{realTaxType},</if>
<if test="origOpenMoney != null">orig_open_money = #{origOpenMoney},</if>
<if test="addTaxRate != null">add_tax_rate = #{addTaxRate},</if>
<if test="addOpenMoney != null">add_open_money = #{addOpenMoney},</if>
<if test="openMoneyMax != null">open_money_max = #{openMoneyMax},</if>
<if test="openMoney != null">open_money = #{openMoney},</if>
<if test="invoiceNo != null and invoiceNo != ''">invoice_no = #{invoiceNo},</if>