demand: TMS系统 - 成本管理 - 运单利润统计 功能按钮“批量重算”优化

This commit is contained in:
aike 2026-01-28 09:29:43 +08:00
parent ad27118a78
commit 07ea4571f2
2 changed files with 40 additions and 1 deletions

View File

@ -45,6 +45,7 @@ import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.scheduling.annotation.Async;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
@ -53,6 +54,9 @@ import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.time.LocalDateTime;
import java.time.YearMonth;
import java.time.format.DateTimeFormatter;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.*;
@ -1515,6 +1519,39 @@ public class EmisCommonController extends EmisBaseController
}
/**
* 触发按月份计算运单成本
* @return
*/
@GetMapping(value = "/reCalcCostFeeByBillMonth")
@Async
public AjaxResult reCalcCostFeeByBillMonth(String billMonth)
{
if(StringUtils.isEmpty(billMonth)){
return AjaxResult.error("月份不能为空");
}
String lockKey="reCalcCostFeeByBillMonth";
log.info("reCalcCostFeeByBillMonth start");
// 加锁查询
redissonService.lock(lockKey,300);
try{
EmisWaybill emisWaybill = new EmisWaybill();
emisWaybill.getParams().put("billMonth",billMonth.replaceAll("-",""));
emisWaybill.getParams().put("blAllScan","1");
emisTmsCostFeeService.redoCalcCostFeeWaitWaybill(emisWaybill);
}catch(Exception ex){
ex.printStackTrace();
log.error("reCalcCostFeeByBillMonth exception:"+ex.getMessage());
return AjaxResult.error("计算异常:"+ex.getMessage());
}
log.info("reCalcCostFeeByBillMonth end");
redissonService.unlock(lockKey);
return AjaxResult.success("计算成功");
}
/**
* 导出进仓单-对接外部
*

View File

@ -3586,13 +3586,15 @@
a.del_flag = '0'
AND a.order_status != '0'
AND a.order_status != '2'
AND a.bl_calc_cost = '0'
and not EXISTS (
select 1 from emis_waybill_problem_info ewpi where a.bill_code=ewpi.bill_code and ewpi.del_flag='0' and ewpi.`problem_type` in(151)
)
<if test="params.billMonth != null and params.billMonth != ''">
and DATE_FORMAT(a.send_date,'%Y%m')= #{params.billMonth}
</if>
<if test="params.blAllScan != 1">
and a.bl_calc_cost= '0'
</if>
ORDER BY a.send_date DESC
</select>