Commit c5f7e8696843f56567db190ed3fd44d0e9f15054

Authored by 房远帅
2 parents bd99f69f 6227a861

Merge branch 'master_after20' into master_cj_zq

... ... @@ -44,6 +44,7 @@ import com.lframework.xingyun.sc.vo.shipments.plan.QueryShipmentsPlanDetailVo;
44 44 import lombok.extern.slf4j.Slf4j;
45 45 import org.apache.commons.collections4.CollectionUtils;
46 46 import org.apache.commons.collections4.MapUtils;
  47 +import org.apache.commons.lang3.BooleanUtils;
47 48 import org.apache.commons.lang3.StringUtils;
48 49 import org.springframework.transaction.annotation.Transactional;
49 50 import com.lframework.xingyun.sc.mappers.ShipmentsOrderInfoMapper;
... ... @@ -471,7 +472,39 @@ public class ShipmentsOrderInfoServiceImpl extends BaseMpServiceImpl<ShipmentsOr
471 472 return;
472 473 }
473 474 List<String> orderIds = detailList.stream().map(ShipmentsPlanDetail::getOrderId).distinct().collect(Collectors.toList());
474   - purchaseOrderInfoService.updateStatus(orderIds, "DELIVERED");
  475 + // 获取订货单规格数据
  476 + List<PurchaseOrderLine> orderLineList = purchaseOrderLineService.listByOrderIds(orderIds, true);
  477 + if (CollectionUtils.isEmpty(orderLineList)) {
  478 + return;
  479 + }
  480 + // 按照订货单分组
  481 + Map<String, List<PurchaseOrderLine>> orderLineMap = new HashMap<>();
  482 + for (PurchaseOrderLine orderLine : orderLineList) {
  483 + String orderId = orderLine.getPurchaseOrderId();
  484 + List<PurchaseOrderLine> list = orderLineMap.computeIfAbsent(orderId, k -> new ArrayList<>());
  485 + list.add(orderLine);
  486 + }
  487 + List<String> needDeliveryOrderIds = new ArrayList<>();
  488 + for (String orderId : orderIds) {
  489 + List<PurchaseOrderLine> lineList = orderLineMap.get(orderId);
  490 + if (CollectionUtils.isEmpty(lineList)) {
  491 + log.info("========================== 订货单 {} 不存在规格数据!", orderId);
  492 + continue;
  493 + }
  494 + boolean needDelivery = true;
  495 + for (PurchaseOrderLine line : lineList) {
  496 + Boolean shipment = line.getShipment();
  497 + if (!BooleanUtils.isTrue(shipment)) {
  498 + needDelivery = false;
  499 + break;
  500 + }
  501 + }
  502 + if (needDelivery) {
  503 + needDeliveryOrderIds.add(orderId);
  504 + }
  505 + }
  506 +
  507 + purchaseOrderInfoService.updateStatus(needDeliveryOrderIds, "DELIVERED");
475 508 }
476 509
477 510 @Override
... ...
... ... @@ -186,40 +186,49 @@
186 186 AND tb.standard_approved = #{vo.standardApproved}
187 187 </if>
188 188 <if test="vo.workshopIdList != null and vo.workshopIdList.size() > 0">
189   - OR tb.workshop_id IN
  189 + AND tb.workshop_id IN
190 190 <foreach collection="vo.workshopIdList" open="(" separator="," close=")" item="item">
191 191 #{item}
192 192 </foreach>
193 193 </if>
194   - <choose>
195   - <when test="vo.contractIdList != null and vo.contractIdList.size() > 0">
196   - AND (tb.id IN
197   - <foreach collection="vo.contractIdList" open="(" separator="," close=")" item="item">
198   - #{item}
199   - </foreach>
200   - <if test="vo.createById != null and vo.createById != ''">
201   - OR tb.create_by_id = #{vo.createById}
202   - </if>
203   - <if test="vo.createByIdList != null and vo.createByIdList.size() > 0">
204   - OR tb.create_by_id IN
205   - <foreach collection="vo.createByIdList" open="(" separator="," close=")" item="item">
206   - #{item}
207   - </foreach>
208   - </if>
209   - )
210   - </when>
211   - <otherwise>
212   - <if test="vo.createById != null and vo.createById != ''">
213   - AND tb.create_by_id = #{vo.createById}
214   - </if>
215   - <if test="vo.createByIdList != null and vo.createByIdList.size() > 0">
216   - AND tb.create_by_id IN
217   - <foreach collection="vo.createByIdList" open="(" separator="," close=")" item="item">
218   - #{item}
219   - </foreach>
220   - </if>
221   - </otherwise>
222   - </choose>
  194 + <if test="vo.createById != null and vo.createById != ''">
  195 + AND tb.create_by_id = #{vo.createById}
  196 + </if>
  197 + <if test="vo.createByIdList != null and vo.createByIdList.size() > 0">
  198 + AND tb.create_by_id IN
  199 + <foreach collection="vo.createByIdList" open="(" separator="," close=")" item="item">
  200 + #{item}
  201 + </foreach>
  202 + </if>
  203 +<!-- <choose>-->
  204 +<!-- <when test="vo.contractIdList != null and vo.contractIdList.size() > 0">-->
  205 +<!-- AND (tb.id IN-->
  206 +<!-- <foreach collection="vo.contractIdList" open="(" separator="," close=")" item="item">-->
  207 +<!-- #{item}-->
  208 +<!-- </foreach>-->
  209 +<!-- <if test="vo.createById != null and vo.createById != ''">-->
  210 +<!-- OR tb.create_by_id = #{vo.createById}-->
  211 +<!-- </if>-->
  212 +<!-- <if test="vo.createByIdList != null and vo.createByIdList.size() > 0">-->
  213 +<!-- OR tb.create_by_id IN-->
  214 +<!-- <foreach collection="vo.createByIdList" open="(" separator="," close=")" item="item">-->
  215 +<!-- #{item}-->
  216 +<!-- </foreach>-->
  217 +<!-- </if>-->
  218 +<!-- )-->
  219 +<!-- </when>-->
  220 +<!-- <otherwise>-->
  221 +<!-- <if test="vo.createById != null and vo.createById != ''">-->
  222 +<!-- AND tb.create_by_id = #{vo.createById}-->
  223 +<!-- </if>-->
  224 +<!-- <if test="vo.createByIdList != null and vo.createByIdList.size() > 0">-->
  225 +<!-- AND tb.create_by_id IN-->
  226 +<!-- <foreach collection="vo.createByIdList" open="(" separator="," close=")" item="item">-->
  227 +<!-- #{item}-->
  228 +<!-- </foreach>-->
  229 +<!-- </if>-->
  230 +<!-- </otherwise>-->
  231 +<!-- </choose>-->
223 232 </where>
224 233 order by tb.create_time desc
225 234 </select>
... ...