This commit is contained in:
linfso 2024-11-14 06:49:39 +08:00
parent b3bb3a8c3d
commit a074ec96e7
5 changed files with 90 additions and 39 deletions

View File

@ -621,6 +621,31 @@ public class EmisCommonController extends EmisBaseController
}
/**
* 自动出账触发
* @return
*/
@GetMapping("/autoDoProfitTrigger")
public AjaxResult autoDoProfitTrigger(){
String lockKey="autoDoProfitTrigger";
log.error("autoDoProfitTrigger start");
// 加锁查询
redissonService.lock(lockKey,300);
try{
emisCommissionProfitService.autoDoProfit();
}catch(Exception ex){
ex.printStackTrace();
log.error("autoDoProfitTrigger exception:"+ex.getMessage());
}
log.error("autoDoProfitTrigger end");
redissonService.unlock(lockKey);
return AjaxResult.success("发送成功");
}
/**
* 计算运单提成
* @return
@ -632,7 +657,7 @@ public class EmisCommonController extends EmisBaseController
// 加锁查询
redissonService.lock(lockKey,300);
try{
emisCommissionProfitService.reCalcEmpProfitByBillCode(billCode);
emisCommissionProfitService.reCalcProfitByBillCode(billCode);
}
catch (Exception ex){
redissonService.unlock(lockKey);

View File

@ -71,6 +71,9 @@ public interface EmisWaybillMapper extends BaseMapper<EmisWaybill>
public List<EmisWaybill> selectWaitDoBillList(EmisWaybill emisWaybill);
public List<EmisWaybill> selectWaitDoProfitList(EmisWaybill emisWaybill);
/**
* 新增
*

View File

@ -28,12 +28,17 @@ public interface IEmisCommissionProfitService
public EmisCommissionProfit selectEmisCommissionProfitById(Long id);
/**
* 重新计算提成根据billCode
* @param billCode
* @return
*/
public int reCalcEmpProfitByBillCode(String billCode);
/**
* 自动计算提成
*/
public void autoDoProfit();
/**
* 重新计算提成根据billCode
* @param billCode
* @return
*/
public int reCalcProfitByBillCode(String billCode);
/**
* 查询员工提成表列表

View File

@ -14,6 +14,7 @@ import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.googlecode.aviator.AviatorEvaluator;
@ -55,12 +56,31 @@ public class EmisCommissionProfitServiceImpl extends EmisBaseService implements
@Autowired
protected EmisWaybillMapper emisWaybillMapper;
/**
* 自动计算提成
*/
public void autoDoProfit() {
// 获取需要出账的运单列表
EmisWaybill qEmisWaybill = new EmisWaybill();
List<EmisWaybill> list = emisWaybillMapper.selectWaitDoProfitList(qEmisWaybill);
if(!CollectionUtil.isEmpty(list)){
for(EmisWaybill dt:list){
try {
reCalcProfitByBillCode(dt.getBillCode());
}catch (Exception ex){
ex.printStackTrace();
}
}
}
}
/**
* 根据单号重新计算提成
*/
@Override
@Transactional
public int reCalcEmpProfitByBillCode(String billCode)
public int reCalcProfitByBillCode(String billCode)
{
// 获取运单信息
EmisWaybill waybill = getWaybillByBillCode(billCode);

View File

@ -1956,10 +1956,7 @@
</select>
<!-- or a.salesmen=#{params.privEmpName}-->
<!-- or a.payee=#{params.privEmpName}-->
<!-- 通用权限判断 参数 isPrivQuery -->
<select id="selectWaitDoBillList" parameterType="EmisWaybill" resultMap="EmisWaybillResult">
select
id, order_sn, cust_order_id, bill_code, order_status, waybill_status, order_type,
@ -1993,38 +1990,39 @@
</select>
<select id="selectEmisWaybillById_old" parameterType="Long" resultMap="EmisWaybillResult">
select id, order_sn, cust_order_id, bill_code, bill_code_sub, order_status, waybill_status, order_type, order_date,
user_id, customer_code, customer_name, open_id, receive_name, receive_company, receive_mobile, receive_tel,
receive_country, receive_province, receive_city, receive_county, receive_town, receive_address, receive_postcode,
receive_pcd, send_name, send_company, send_mobile, send_tel, send_country, send_province, send_city, send_county, send_town,
send_address, send_postcode, send_pcd, payment_type, calc_fee_type, cust_no, cust_name, trans_line_type, product_type,
time_type, meter_type, carry_type, customs_clear, customs_eclaration, estimate_date, pack_type, dispatch_method,
pickup_method, pick_start_date, pick_finish_date, pick_fail_reason, into_warehouse_code, into_warehouse_name,
into_warehouse_address, into_warehouse_contact, into_warehouse_phone, into_warehouse_bill_code, warehouse_in_no,
customer_delivery_begin_time, customer_delivery_end_time, goods_type, goods_info, goods_pics, bl_prepare_in_freight,
prepare_in_est_fee, prepare_in_real_fee, prepare_in_express, prepare_in_bill_code, prepare_in_remark, prepare_in_supplier,
total_weight, total_volume, parcel_qty, bill_weight, volume_weight, currency, settlement_weight, scan_weight, fee_weight, freight,
real_payment_type, real_fee, bl_special_quote, bl_over_long, bl_bill, bl_bill_text, bl_over_weight, over_weight_number,
fee_remark, third_code, real_value, bl_insure, insure_value, insure_value_currency, insure_fee_currency, insure_fee,
insure_remark, insure_site_code, insure_date, bl_print, print_man_code, print_site, print_date, print_count, bl_disp_fd,
transfer_code, transfer_billcode, disp_fd_date, disp_fd_reason, current_site_code, next_site_code, last_site_code,
register_site_code, register_date, register_man_code, take_piece_employee_code, send_site_code, send_center_code,
send_date, dispatch_man_code, dispatch_date, dispatch_site_code, produce_bill_date, produce_bill_site_code,
produce_bill_man_code, destination_code, destination_province, destination_city, destination_county,
dispatch_underling_site_code, destination_center_code, market_man_code, payee, salesmen, operate_employee_code,
bl_is_question, problem_type, problem_cause, problem_delay_days, bl_message, bl_accept_message, bl_gen_subbill,
bl_sign, sign_man, sign_man_code, sign_site_code, sign_date, bill_pic_send_rmk, bill_pic_dispatch_rmk, timezone_offset,
payment_status, payment_date, payment_remark, order_remark, data_from, bl_special_goods, remark, del_flag, create_by,
create_time, update_by, update_time, create_site, update_site,ext_info
<select id="selectWaitDoProfitList" parameterType="EmisWaybill" resultMap="EmisWaybillResult">
select
id, order_sn, cust_order_id, bill_code, order_status, waybill_status, order_type,
order_date, user_id, customer_code, customer_name, open_id, receive_name, receive_company, receive_mobile,
receive_tel, receive_country, receive_province, receive_city, receive_county, receive_town,
receive_address, receive_postcode, receive_pcd, send_name, send_company, send_mobile, send_tel,
send_country, send_province, send_city, send_county, send_town, send_address, send_postcode,
send_pcd, payment_type, calc_fee_type, cust_no, cust_name, trans_line_type, product_type, time_type,
meter_type, carry_type, customs_clear, customs_eclaration, estimate_date, pack_type, dispatch_method,
pickup_method, pick_start_date, pick_finish_date, pick_fail_reason, into_warehouse_code, into_warehouse_name,
into_warehouse_address, into_warehouse_contact, into_warehouse_phone, into_warehouse_bill_code, warehouse_in_no,
customer_delivery_begin_time, customer_delivery_end_time, goods_type, goods_info, goods_pics, bl_prepare_in_freight,
prepare_in_est_fee, prepare_in_real_fee, prepare_in_express, prepare_in_bill_code, prepare_in_remark,
prepare_in_supplier, total_weight, total_volume, parcel_qty, bill_weight, volume_weight, currency,
settlement_weight, scan_weight, fee_weight, freight, real_payment_type, real_fee, bl_special_quote, bl_over_long,
bl_bill, bl_bill_text, bl_over_weight, over_weight_number, fee_remark, third_code, real_value, bl_insure,
insure_value, insure_value_currency, insure_fee_currency, insure_fee, insure_remark, insure_site_code,
insure_date, bl_print, print_man_code, print_site, print_date, print_count, bl_disp_fd, transfer_code,
transfer_billcode, disp_fd_date, disp_fd_reason, current_site_code, next_site_code, last_site_code,
register_site_code, register_date, register_man_code, take_piece_employee_code, send_site_code,
send_center_code, send_date, dispatch_man_code, dispatch_date, dispatch_site_code, produce_bill_date,
produce_bill_site_code, produce_bill_man_code, destination_code, destination_province, destination_city,
destination_county, dispatch_underling_site_code, destination_center_code, market_man_code, payee,
salesmen, operate_employee_code, bl_is_question, problem_type, problem_cause, problem_delay_days,
bl_message, bl_accept_message, bl_gen_subbill, bl_sign, sign_man, sign_man_code, sign_site_code,
sign_date, bill_pic_send_rmk, bill_pic_dispatch_rmk, timezone_offset, payment_status, payment_date,
payment_remark, order_remark, data_from, bl_special_goods, remark, del_flag, create_by, create_time,
update_by, update_time, create_site, update_site,ext_info
from emis_waybill a
where a.id = #{id}
where a.del_flag='0' and a.bl_profit = '0' and a.order_status !='0' and a.order_status!='2' limit 300
</select>
<insert id="insertEmisWaybill" parameterType="EmisWaybill" useGeneratedKeys="true" keyProperty="id">
insert into emis_waybill
<trim prefix="(" suffix=")" suffixOverrides=",">