This commit is contained in:
linfso 2024-07-04 04:15:49 +08:00
parent 0e3ae79352
commit 0bbf68624e
6 changed files with 152 additions and 4 deletions

View File

@ -470,6 +470,30 @@ public class EmisCommonController extends EmisBaseController
}
/**
* 自动出账触发
* @return
*/
@GetMapping("/autoDoBillTrigger")
public AjaxResult autoDoBillTrigger(){
String lockKey="autoDoBillTrigger";
log.error("autoDoBillTrigger start");
// 加锁查询
redissonService.lock(lockKey,300);
try{
emisBaseService.autoDoBill();
}catch(Exception ex){
ex.printStackTrace();
log.error("autoDoBillTrigger exception:"+ex.getMessage());
}
log.error("autoDoBillTrigger end");
redissonService.unlock(lockKey);
return AjaxResult.success("发送成功");
}
/**
* 物流轨迹采集触发
* @return

View File

@ -36,6 +36,10 @@ public interface EmisWaybillFeeitemMapper extends BaseMapper<EmisWaybillFeeitem>
*/
public List<EmisWaybillFeeitem> selectEmisWaybillFeeitemList(EmisWaybillFeeitem emisWaybillFeeitem);
public List<EmisWaybillFeeitem> selectFeeitemListByWaybillId(Long waybillId);
/**
* 新增
*

View File

@ -53,6 +53,9 @@ public interface EmisWaybillMapper extends BaseMapper<EmisWaybill>
*/
public List<EmisWaybill> selectEmisWaybillList(EmisWaybill emisWaybill);
public List<EmisWaybill> selectWaitDoBillList(EmisWaybill emisWaybill);
/**
* 新增
*
@ -120,6 +123,12 @@ public interface EmisWaybillMapper extends BaseMapper<EmisWaybill>
// 删除签收状态
public int updateUnSignStatus(EmisWaybill emisWaybill);
// 打出账标识
public int updateHasDoBill(EmisWaybill emisWaybill);
// 取消出账标识
public int cancelHasDoBill(EmisWaybill emisWaybill);
// 更新问题件状态
public int updateProblemStatus(EmisWaybill emisWaybill);
@ -140,4 +149,7 @@ public interface EmisWaybillMapper extends BaseMapper<EmisWaybill>
}

View File

@ -78,13 +78,13 @@ public class EmisBaseService {
protected EmisWaybillMapper emisWaybillMapper;
@Autowired
protected IEmisWaybillFeeitemService emisWaybillFeeitemMapper;
protected EmisWaybillFeeitemMapper emisWaybillFeeitemMapper;
@Autowired
protected IEmisWaybillCargoService emisWaybillCargoMapper;
protected EmisWaybillCargoMapper emisWaybillCargoMapper;
@Autowired
protected IEmisWaybillAttachmentService emisWaybillAttachmentMapper;
protected EmisWaybillAttachmentMapper emisWaybillAttachmentMapper;
@Autowired
protected EmisTransLineMapper emisTransLineMapper;
@ -161,6 +161,12 @@ public class EmisBaseService {
private EmisSpecialCalcWeightMapper emisSpecialCalcWeightMapper;
@Autowired
private EmisSettleSubBillMapper emisSettleSubBillMapper;
@Autowired
private EmisSettleSubBillFeeitemMapper emisSettleSubBillFeeitemMapper;
@Autowired
@ -875,6 +881,85 @@ public class EmisBaseService {
}
/**
* 自动出账
*/
public void autoDoBill() {
// 获取需要出账的运单列表
EmisWaybill qEmisWaybill = new EmisWaybill();
List<EmisWaybill> list = emisWaybillMapper.selectWaitDoBillList(qEmisWaybill);
if(!CollectionUtil.isEmpty(list)){
for(EmisWaybill dt:list){
log.error("===>Start 自动出账:"+dt.getBillCode());
try {
// 生成分账单明细
EmisSettleSubBill emisSettleSubBill=new EmisSettleSubBill();
emisSettleSubBill.setBillCode(dt.getBillCode());
emisSettleSubBill.setBillNo(dt.getBillCode());
emisSettleSubBill.setBillDate(new Date());
// 账单类型 1-现金 2-月结
if( StringUtils.endsWithAny(dt.getPaymentType(),"2","4","5")) {
emisSettleSubBill.setSettleType("2");
}else{
emisSettleSubBill.setSettleType("1");
}
emisSettleSubBill.setCurrency(dt.getCurrency());
emisSettleSubBill.setBillMonth(DateUtils.parseDateToStr("yyyyMM",dt.getSendDate()));
emisSettleSubBill.setBillFee(dt.getFreight());
emisSettleSubBill.setCustNo(dt.getCustNo());
emisSettleSubBill.setCustomerCode(dt.getCustomerCode());
emisSettleSubBill.setCustomerName(dt.getCustomerName());
emisSettleSubBillMapper.insertEmisSettleSubBill(emisSettleSubBill);
// 如果是一口价,自动生成一条运费明细,其他则根据实际来计算
// 生成费用明细
if(dt.getCalcFeeType().equals("3")) {
EmisSettleSubBillFeeitem emisSettleSubBillFeeitem =new EmisSettleSubBillFeeitem();
emisSettleSubBillFeeitem.setBillCode(dt.getBillCode());
emisSettleSubBillFeeitem.setBillFee(dt.getFreight());
emisSettleSubBillFeeitem.setCurrency(dt.getCurrency());
emisSettleSubBillFeeitem.setFeeCode("1001");
emisSettleSubBillFeeitem.setFeeName("运输费");
emisSettleSubBillFeeitem.setOrigFee(dt.getRealFee());
emisSettleSubBillFeeitem.setRemark("一口价运输费");
emisSettleSubBillFeeitemMapper.insertEmisSettleSubBillFeeitem(emisSettleSubBillFeeitem);
}else{
List<EmisWaybillFeeitem> feeitemList = emisWaybillFeeitemMapper.selectFeeitemListByWaybillId(dt.getId());
for(EmisWaybillFeeitem feeitem:feeitemList){
EmisSettleSubBillFeeitem emisSettleSubBillFeeitem =new EmisSettleSubBillFeeitem();
emisSettleSubBillFeeitem.setBillCode(dt.getBillCode());
emisSettleSubBillFeeitem.setBillFee(feeitem.getRealFee());
emisSettleSubBillFeeitem.setCurrency(feeitem.getCurrency());
emisSettleSubBillFeeitem.setFeeCode(feeitem.getFeeCode());
emisSettleSubBillFeeitem.setFeeName(feeitem.getFeeName());
emisSettleSubBillFeeitem.setOrigFee(feeitem.getRealFee());
emisSettleSubBillFeeitem.setRemark("运单费用明细");
emisSettleSubBillFeeitemMapper.insertEmisSettleSubBillFeeitem(emisSettleSubBillFeeitem);
}
}
// 出账标识
emisWaybillMapper.updateHasDoBill(dt);
}catch (Exception ex){
ex.printStackTrace();
}
log.error("===>End 自动出账");
}
}
}
/**
* 短信发送

View File

@ -59,6 +59,12 @@
where a.id = #{id}
</select>
<select id="selectFeeitemListByWaybillId" parameterType="Long" resultMap="EmisWaybillFeeitemResult">
select id, waybill_id, fee_code, fee_name, fee, real_fee, currency, quote_id, expr_id, calc_exp, initial_weight_fee, add_weight_price, bl_auto_gen, order_num, del_flag, create_by, create_time, update_by, update_time, remark
from emis_waybill_feeitem a
where a.waybill_id = #{waybillId}
</select>
<insert id="insertEmisWaybillFeeitem" parameterType="EmisWaybillFeeitem">
insert into emis_waybill_feeitem
<trim prefix="(" suffix=")" suffixOverrides=",">

View File

@ -897,6 +897,12 @@
<!-- 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, 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
from emis_waybill a
where a.del_flag='0' and a.bl_bill = '0' limit 300
</select>
<select id="selectEmisWaybillById" 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
from emis_waybill a
@ -1486,8 +1492,19 @@
where order_sn=#{orderSn}
</update>
<!-- 打出账标识 -->
<update id="updateHasDoBill" parameterType="String">
update emis_waybill set
bl_bill = '1',produce_bill_date=now(),produce_bill_site_code='88888',produce_bill_man_code='0'
where del_flag='0' and bill_code=#{billCode}
</update>
<!-- 取消出账标识 -->
<update id="cancelHasDoBill" parameterType="String">
update emis_waybill set
bl_bill = '0',produce_bill_date=null,produce_bill_site_code=null,produce_bill_man_code=null
where del_flag='0' and bill_code=#{billCode}
</update>
<update id="updateUnSignStatus" parameterType="EmisWaybill">