zhenghaoyu
12 months ago
5 changed files with 114 additions and 0 deletions
@ -0,0 +1,40 @@
|
||||
package com.logpm.patch.jobhandle; |
||||
|
||||
import com.logpm.patch.service.IOrderDataService; |
||||
import com.xxl.job.core.biz.model.ReturnT; |
||||
import com.xxl.job.core.handler.annotation.XxlJob; |
||||
import lombok.AllArgsConstructor; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springframework.stereotype.Component; |
||||
|
||||
import java.util.List; |
||||
|
||||
@Slf4j |
||||
@AllArgsConstructor |
||||
@Component |
||||
public class OrderDataRepair { |
||||
|
||||
private final IOrderDataService orderDataService; |
||||
|
||||
@XxlJob("repairOrderSignStatus") |
||||
public ReturnT<String> repairOrderSignStatus(String param) { |
||||
log.info("####################repairOrderSignStatus: 修复订单签收状态 开始"); |
||||
|
||||
//查询所有包件已入库并且已签收的订单状态不为已签收的数据修复状态
|
||||
List<Long> ls = orderDataService.findAllNoSignStatusOrder(); |
||||
for (Long orderId : ls) { |
||||
try{ |
||||
log.info("#############repairOrderSignStatus: 当前处理的订单id为{}",orderId); |
||||
orderDataService.updateOrderStatusByOrderId(orderId,"80"); |
||||
}catch (Exception e){ |
||||
log.error("##############repairOrderSignStatus: 处理订单id为{}的订单失败",orderId); |
||||
continue; |
||||
} |
||||
} |
||||
|
||||
log.info("####################repairOrderSignStatus: 修复订单签收状态 完成"); |
||||
return ReturnT.SUCCESS; |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,16 @@
|
||||
package com.logpm.patch.mapper; |
||||
|
||||
import org.apache.ibatis.annotations.Mapper; |
||||
import org.apache.ibatis.annotations.Param; |
||||
|
||||
import java.util.List; |
||||
|
||||
@Mapper |
||||
public interface OrderDataMapper { |
||||
|
||||
|
||||
List<Long> findAllNoSignStatusOrder(); |
||||
|
||||
void updateOrderStatusByOrderId(@Param("orderId") Long orderId, @Param("orderStatus") String orderStatus); |
||||
|
||||
} |
@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
<mapper namespace="com.logpm.patch.mapper.OrderDataMapper"> |
||||
|
||||
<select id="findAllNoSignStatusOrder" resultType="Long"> |
||||
SELECT id |
||||
FROM |
||||
logpm_distribution_stock_article |
||||
WHERE |
||||
hand_quantity = 0 |
||||
AND order_status != '80' |
||||
AND total_number = ( SELECT COUNT( 1 ) FROM logpm_distribution_parcel_list WHERE stock_article_id = logpm_distribution_stock_article.id AND order_package_status = '70') |
||||
</select> |
||||
|
||||
<update id="updateOrderStatusByOrderId" > |
||||
update logpm_distribution_stock_article |
||||
set order_status = #{orderStatus} |
||||
where id = #{orderId} |
||||
</update> |
||||
|
||||
</mapper> |
@ -0,0 +1,9 @@
|
||||
package com.logpm.patch.service; |
||||
|
||||
import java.util.List; |
||||
|
||||
public interface IOrderDataService { |
||||
List<Long> findAllNoSignStatusOrder(); |
||||
|
||||
void updateOrderStatusByOrderId(Long orderId, String orderStatus); |
||||
} |
@ -0,0 +1,28 @@
|
||||
package com.logpm.patch.service.impl; |
||||
|
||||
import com.alibaba.fastjson.JSONObject; |
||||
import com.logpm.patch.mapper.OrderDataMapper; |
||||
import com.logpm.patch.service.IOrderDataService; |
||||
import lombok.AllArgsConstructor; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import java.util.List; |
||||
|
||||
@Slf4j |
||||
@Service |
||||
@AllArgsConstructor |
||||
public class OrderDataServiceImpl implements IOrderDataService { |
||||
|
||||
private final OrderDataMapper orderDataMapper; |
||||
|
||||
@Override |
||||
public List<Long> findAllNoSignStatusOrder() { |
||||
return orderDataMapper.findAllNoSignStatusOrder(); |
||||
} |
||||
|
||||
@Override |
||||
public void updateOrderStatusByOrderId(Long orderId, String orderStatus) { |
||||
orderDataMapper.updateOrderStatusByOrderId(orderId,orderStatus); |
||||
} |
||||
} |
Loading…
Reference in new issue