|
|
@ -489,23 +489,28 @@ public class AppletOrderTeamServiceImpl implements AppletOrderTeamService { |
|
|
|
public Result<?> submitQualityInfo2(String token, String id, String listJson) { |
|
|
|
|
|
|
|
if (StringUtils.isBlank(token)){ |
|
|
|
Result.error("token不能为空"); |
|
|
|
return Result.error("token不能为空"); |
|
|
|
} |
|
|
|
|
|
|
|
HanHaiMember member = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token); |
|
|
|
if (member == null) { |
|
|
|
return Result.error("用户token无效"); |
|
|
|
} |
|
|
|
|
|
|
|
if (StringUtils.isBlank(listJson)){ |
|
|
|
Result.error("list不能为空"); |
|
|
|
return Result.error("list不能为空"); |
|
|
|
} |
|
|
|
|
|
|
|
CommonOrder order = commonOrderService.getById(id); |
|
|
|
|
|
|
|
if (order == null){ |
|
|
|
Result.error("订单无效"); |
|
|
|
return Result.error("订单无效"); |
|
|
|
} |
|
|
|
|
|
|
|
List<CommonOrder> list = JSON.parseArray(listJson, CommonOrder.class); |
|
|
|
|
|
|
|
if (list == null || list.isEmpty()) { |
|
|
|
return Result.error("订单列表为空"); |
|
|
|
} |
|
|
|
|
|
|
|
BigDecimal priceSum = new BigDecimal(0);//总价格 |
|
|
|
Integer qualifiedNumSum = 0;//合格数量 |
|
|
@ -513,11 +518,23 @@ public class AppletOrderTeamServiceImpl implements AppletOrderTeamService { |
|
|
|
Integer unrecyclableSum = 0;//不可回收数量 |
|
|
|
|
|
|
|
for (CommonOrder orderReq : list) { |
|
|
|
if (orderReq == null) { |
|
|
|
continue; // 跳过null的订单项 |
|
|
|
} |
|
|
|
|
|
|
|
priceSum = priceSum.add(orderReq.getPrice()); |
|
|
|
qualifiedNumSum += orderReq.getQualifiedNum(); |
|
|
|
noQualifiedNumSum += orderReq.getNoQualifiedNum(); |
|
|
|
unrecyclableSum += orderReq.getUnrecyclable(); |
|
|
|
// 安全地处理可能为null的数值 |
|
|
|
if (orderReq.getPrice() != null) { |
|
|
|
priceSum = priceSum.add(orderReq.getPrice()); |
|
|
|
} |
|
|
|
if (orderReq.getQualifiedNum() != null) { |
|
|
|
qualifiedNumSum += orderReq.getQualifiedNum(); |
|
|
|
} |
|
|
|
if (orderReq.getNoQualifiedNum() != null) { |
|
|
|
noQualifiedNumSum += orderReq.getNoQualifiedNum(); |
|
|
|
} |
|
|
|
if (orderReq.getUnrecyclable() != null) { |
|
|
|
unrecyclableSum += orderReq.getUnrecyclable(); |
|
|
|
} |
|
|
|
|
|
|
|
//设置用户 |
|
|
|
orderReq.setUserId(member.getId()); |
|
|
@ -525,16 +542,24 @@ public class AppletOrderTeamServiceImpl implements AppletOrderTeamService { |
|
|
|
orderReq.setHasChild("1"); |
|
|
|
orderReq.setType(1); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//设置商品 |
|
|
|
if (StringUtils.isNotBlank(orderReq.getShopId())){ |
|
|
|
CommonShop shop = commonShopService.getById(orderReq.getShopId()); |
|
|
|
orderReq.setUnit(shop.getUnit()); |
|
|
|
orderReq.setImage(shop.getImage()); |
|
|
|
orderReq.setTitle(shop.getName()); |
|
|
|
orderReq.setDetails(shop.getService()); |
|
|
|
orderReq.setShopClass(shop.getShopClass()); |
|
|
|
orderReq.setCreateTime(new Date()); |
|
|
|
}else if (orderReq.getTestingStatus() == 1){ |
|
|
|
if (shop != null) { |
|
|
|
orderReq.setUnit(shop.getUnit()); |
|
|
|
orderReq.setImage(shop.getImage()); |
|
|
|
orderReq.setTitle(shop.getName()); |
|
|
|
orderReq.setDetails(shop.getService()); |
|
|
|
orderReq.setShopClass(shop.getShopClass()); |
|
|
|
orderReq.setCreateTime(new Date()); |
|
|
|
} else { |
|
|
|
// 商品不存在时的处理 |
|
|
|
orderReq.setTitle("商品不存在"); |
|
|
|
orderReq.setCreateTime(new Date()); |
|
|
|
} |
|
|
|
}else if (orderReq.getTestingStatus() != null && orderReq.getTestingStatus() == 1){ |
|
|
|
//质量问题 |
|
|
|
orderReq.setTitle("质量问题"); |
|
|
|
}else { |
|
|
|