提交 21f100d7 authored 作者: huyufan's avatar huyufan

优化相关代码

上级 93996aaf
......@@ -186,7 +186,7 @@ public class OrderGoodsStatusLazyComponent implements InitializingBean {
List<Integer> ids = new LinkedList<>();
for (OrderChild orderChild : orderChildrenList) {
childSum.add(orderChild.getWeight());
childSum = childSum.add(orderChild.getWeight());
ids.add(orderChild.getId());
}
orderChildDao.batchUpdateOrderChildStatus(OrderChildEnum.Status.PLATFORM_CANCEL.getCode(), ids);
......@@ -212,7 +212,7 @@ public class OrderGoodsStatusLazyComponent implements InitializingBean {
param.setPlatformResidueCarryWeight(BigDecimal.ZERO);
}
}
//只更新货单未拉运吨数,已拉运吨数
//只更新货单已拉运吨数
orderGoodsDao.updateOrderGoodsSetAlreadyWeight(childSum, orderGoods.getId());
orderFeign.rollbackOrderWeight(param);
} else {
......
......@@ -74,4 +74,8 @@ public interface OrderGoodsDao extends BaseDao<OrderGoodsMapper, OrderGoods, Int
List<OrderGoods> selectListByOrderGoodsList(List<String> orderNos);
Integer updateOrderGoods(OrderGoodsEditParams orderGoodsEditParams);
boolean batchUpdateOrderGoodsStatus(Integer status, List<Integer> ids);
boolean batchUpdateOrderGoodsWeight(BigDecimal residueWeight, List<Integer> ids);
}
......@@ -194,5 +194,19 @@ public class OrderGoodsDaoImpl extends BaseDaoImpl<OrderGoodsMapper, OrderGoods,
return baseMapper.updateOrderGoods(orderGoodsEditParams);
}
@Override
public boolean batchUpdateOrderGoodsStatus(Integer status, List<Integer> ids) {
return update(lUdWrapper().in(OrderGoods :: getId,ids)
.set(OrderGoods :: getOrderGoodsStatus, status))
;
}
@Override
public boolean batchUpdateOrderGoodsWeight(BigDecimal residueWeight, List<Integer> ids) {
return update(lUdWrapper().in(OrderGoods :: getId,ids)
.set(OrderGoods::getResidueTransportWeight, residueWeight)
);
}
}
......@@ -177,7 +177,7 @@ public class OrderGoodsSqlProvider {
public String updateOrderGoodsSetAlreadyWeight(@Param(value = "alreadyWeight") BigDecimal alreadyWeight,@Param(value ="id") Integer id){
String sql = new SQL() {{
UPDATE("order_goods")
.SET("already_transport_weight = already_transport_weight + #{residueWeight}")
.SET("already_transport_weight = already_transport_weight - #{residueWeight}")
.WHERE("id = #{id}");
}}.toString();
......@@ -188,7 +188,7 @@ public class OrderGoodsSqlProvider {
String sql = new SQL() {{
UPDATE("order_goods")
.SET("residue_transport_weight = residue_transport_weight + #{residueWeight}")
.SET("already_transport_weight = already_transport_weight + #{alreadyWeight}")
.SET("already_transport_weight = already_transport_weight - #{alreadyWeight}")
.WHERE("id = #{id}");
}}.toString();
......@@ -248,7 +248,7 @@ public class OrderGoodsSqlProvider {
String sql = new SQL() {{
UPDATE("order_goods")
.SET("residue_transport_weight = residue_transport_weight + #{residueWeight}")
.SET("already_transport_weight = already_transport_weight + #{alreadyWeight}")
.SET("already_transport_weight = already_transport_weight - #{alreadyWeight}")
.SET("status = #{status}")
.WHERE("id = #{id}");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论