Merge pull request 'develop' (#174) from develop into master
Reviewed-on: http://git.xdadan.loc/tanex/emis-service/pulls/174
This commit is contained in:
commit
1bc89ca851
@ -1,11 +1,11 @@
|
||||
|
||||
/**
|
||||
/**
|
||||
* @Project: emis
|
||||
* @Title: EmisWaybillController.java
|
||||
* @author linfso
|
||||
* @date 2024-02-29 08:15:14
|
||||
* @Copyright: ShangHai Duta 2022 All rights reserved.
|
||||
* @version v1.0
|
||||
* @version v1.0
|
||||
* @Description: <p> 运单列表 控制器 </p>
|
||||
*/
|
||||
|
||||
@ -33,6 +33,7 @@ import com.xdadan.erp.emis.domain.enumtype.ScanType;
|
||||
import com.xdadan.erp.emis.domain.exception.EmisBizError;
|
||||
import com.xdadan.erp.emis.domain.stat.ScanStatInfoDtl;
|
||||
import com.xdadan.erp.emis.domain.vo.*;
|
||||
import com.xdadan.erp.emis.mapper.EmisWaybillMapper;
|
||||
import com.xdadan.erp.emis.service.*;
|
||||
import com.xdadan.erp.emis.service.print.IXddTplPrint;
|
||||
import com.xdadan.erp.emis.service.print.cpcl.CvtTplToCpcl;
|
||||
@ -59,7 +60,7 @@ import com.xdadan.erp.common.enums.BusinessType;
|
||||
|
||||
/**
|
||||
* 运单列表Controller
|
||||
*
|
||||
*
|
||||
* @author linfso
|
||||
* @date 2024-02-29 08:15:14
|
||||
*/
|
||||
@ -101,6 +102,9 @@ public class EmisWaybillController extends EmisBaseController
|
||||
@Autowired
|
||||
RedissonService redissonService;
|
||||
|
||||
@Autowired
|
||||
private EmisWaybillMapper emisWaybillMapper;
|
||||
|
||||
|
||||
@GetMapping(value = "/checkWaybillIsExists")
|
||||
public AjaxResult checkWaybillIsExists(String billCode){
|
||||
@ -1443,4 +1447,82 @@ public class EmisWaybillController extends EmisBaseController
|
||||
// FileUtil.mkdir(fileUploadDir);
|
||||
}
|
||||
|
||||
@Log(title = "批量更新预估到达时间", businessType = BusinessType.UPDATE)
|
||||
@PostMapping(value = "/batchResubmitProblemWaybills")
|
||||
public AjaxResult batchResubmitProblemWaybills() {
|
||||
try {
|
||||
// 查询2025-08-01 00:00:00-2025-09-03
|
||||
// 23:59:59未签收,且在emis_waybill_problem_info表内的所有运单信息
|
||||
// 重新计算并更新预估到达时间
|
||||
String beginDate = "2025-08-01 00:00:00";
|
||||
String endDate = "2025-09-03 23:59:59";
|
||||
|
||||
// 构建查询条件
|
||||
EmisWaybill queryWaybill = new EmisWaybill();
|
||||
queryWaybill.getParams().put("beginOrderDate", beginDate);
|
||||
queryWaybill.getParams().put("endOrderDate", endDate);
|
||||
// 未签收条件:bl_sign != '1' 或者 waybill_status != '50'(签收扫描)
|
||||
queryWaybill.getParams().put("notSigned", "1");
|
||||
// 在问题表中的条件
|
||||
queryWaybill.getParams().put("inProblemTable", "1");
|
||||
|
||||
List<EmisWaybill> waybillList = emisWaybillService.selectProblemWaybillsForResubmit(queryWaybill);
|
||||
|
||||
if (waybillList == null || waybillList.isEmpty()) {
|
||||
return AjaxResult.success("没有找到符合条件的运单");
|
||||
}
|
||||
|
||||
JSONObject result = new JSONObject();
|
||||
List<JSONObject> successList = new ArrayList<>();
|
||||
List<JSONObject> failList = new ArrayList<>();
|
||||
|
||||
for (EmisWaybill waybill : waybillList) {
|
||||
try {
|
||||
// 重新计算预估到达时间
|
||||
Date newEstimateDate = emisBaseService.getEstimateDate(
|
||||
waybill.getSendDate(),
|
||||
waybill.getProductType(),
|
||||
waybill.getSendCountry(),
|
||||
waybill.getReceiveCountry(),
|
||||
0);
|
||||
|
||||
// 只更新estimateDate字段
|
||||
EmisWaybill updateWaybill = new EmisWaybill();
|
||||
updateWaybill.setId(waybill.getId());
|
||||
updateWaybill.setEstimateDate(newEstimateDate);
|
||||
updateWaybill.preUpdate();
|
||||
|
||||
emisWaybillMapper.updateVirtualWaybill(updateWaybill);
|
||||
|
||||
JSONObject successItem = new JSONObject();
|
||||
successItem.put("billCode", waybill.getBillCode());
|
||||
successItem.put("orderSn", waybill.getOrderSn());
|
||||
successItem.put("message", "预估到达时间更新成功");
|
||||
successList.add(successItem);
|
||||
|
||||
} catch (Exception ex) {
|
||||
JSONObject failItem = new JSONObject();
|
||||
failItem.put("billCode", waybill.getBillCode());
|
||||
failItem.put("orderSn", waybill.getOrderSn());
|
||||
failItem.put("message", ex.getMessage());
|
||||
failList.add(failItem);
|
||||
|
||||
log.error("运单{}预估到达时间更新失败: {}", waybill.getBillCode(), ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
result.put("totalCount", waybillList.size());
|
||||
result.put("successCount", successList.size());
|
||||
result.put("failCount", failList.size());
|
||||
result.put("successList", successList);
|
||||
result.put("failList", failList);
|
||||
|
||||
return AjaxResult.success("批量更新预估到达时间完成", result);
|
||||
|
||||
} catch (Exception ex) {
|
||||
log.error("批量更新预估到达时间失败", ex);
|
||||
return AjaxResult.error("批量更新预估到达时间失败: " + ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -347,4 +347,12 @@ public interface EmisWaybillMapper extends BaseMapper<EmisWaybill>
|
||||
* @return
|
||||
*/
|
||||
List<EmisWaybill> selectHistoryVirtualWaybill(@Param("offset")int offset, @Param("pageSize")int pageSize);
|
||||
|
||||
/**
|
||||
* 查询指定时间范围内未签收且在问题表中的运单信息
|
||||
*
|
||||
* @param emisWaybill 查询条件
|
||||
* @return 运单列表
|
||||
*/
|
||||
List<EmisWaybill> selectProblemWaybillsForResubmit(EmisWaybill emisWaybill);
|
||||
}
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
/**
|
||||
/**
|
||||
* @Project: emis
|
||||
* @Title: EmisWaybillService.java
|
||||
* @author linfso
|
||||
* @date 2024-02-29 08:15:14
|
||||
* @Copyright: ShangHai Duta 2022 All rights reserved.
|
||||
* @version v1.0
|
||||
* @version v1.0
|
||||
* @Description: <p> 运单列表 服务类接口 </p>
|
||||
*/
|
||||
package com.xdadan.erp.emis.service;
|
||||
@ -61,7 +61,7 @@ public interface IEmisWaybillService extends IDataAuditService
|
||||
|
||||
/**
|
||||
* 查询运单列表列表
|
||||
*
|
||||
*
|
||||
* @param emisWaybill 运单列表
|
||||
* @return 运单列表集合
|
||||
*/
|
||||
@ -312,4 +312,12 @@ public interface IEmisWaybillService extends IDataAuditService
|
||||
* @param emisWaybills
|
||||
*/
|
||||
void handleInputVirtualWaybill(List<EmisWaybill> emisWaybills);
|
||||
|
||||
/**
|
||||
* 查询指定时间范围内未签收且在问题表中的运单信息
|
||||
*
|
||||
* @param emisWaybill 查询条件
|
||||
* @return 运单列表
|
||||
*/
|
||||
List<EmisWaybill> selectProblemWaybillsForResubmit(EmisWaybill emisWaybill);
|
||||
}
|
||||
|
||||
@ -6248,6 +6248,15 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询指定时间范围内未签收且在问题表中的运单信息
|
||||
*
|
||||
* @param emisWaybill 查询条件
|
||||
* @return 运单列表
|
||||
*/
|
||||
@Override
|
||||
public List<EmisWaybill> selectProblemWaybillsForResubmit(EmisWaybill emisWaybill) {
|
||||
return emisWaybillMapper.selectProblemWaybillsForResubmit(emisWaybill);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -3929,4 +3929,35 @@
|
||||
</if>
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<!-- 查询指定时间范围内未签收且在问题表中的运单信息 -->
|
||||
<select id="selectProblemWaybillsForResubmit" parameterType="EmisWaybill" resultMap="EmisWaybillResult">
|
||||
<include refid="selectEmisWaybillVo"/>
|
||||
<where>
|
||||
a.del_flag='0'
|
||||
<!-- 时间范围条件 -->
|
||||
<if test="params.beginOrderDate != null and params.beginOrderDate != ''">
|
||||
and a.send_date <![CDATA[ >= ]]> #{params.beginOrderDate}
|
||||
</if>
|
||||
<if test="params.endOrderDate != null and params.endOrderDate != ''">
|
||||
and a.send_date <![CDATA[ <= ]]> #{params.endOrderDate}
|
||||
</if>
|
||||
|
||||
<!-- 未签收条件:bl_sign != '1' 或者 waybill_status != '50'(签收扫描) -->
|
||||
<if test="params.notSigned != null and params.notSigned == '1'">
|
||||
and (a.bl_sign != '1' or a.bl_sign is null)
|
||||
</if>
|
||||
|
||||
<!-- 在问题表中的条件 -->
|
||||
<if test="params.inProblemTable != null and params.inProblemTable == '1'">
|
||||
and exists (
|
||||
select 1 from emis_waybill_problem_info p
|
||||
where a.bill_code = p.bill_code
|
||||
and p.del_flag = '0'
|
||||
)
|
||||
</if>
|
||||
|
||||
</where>
|
||||
order by a.order_date desc
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user