|
|
@@ -584,47 +584,43 @@ public class OrderItemsServiceImpl extends ServiceImpl<OrderItemsMapper, OrderIt
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public R<Map<String,Object>> importPolicy(List<PolicyExcel> data, Boolean isCovered,Long policyName,String salesType) {
|
|
|
- Map<String,Object> map = new HashMap<>();
|
|
|
- //查找政策
|
|
|
+ public R<Map<String, Object>> importPolicy(List<PolicyExcel> data, Boolean isCovered, Long policyName, String salesType) {
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ // 查找政策
|
|
|
SalesPolicy policy = salesPolicyClient.getPolicy(policyName);
|
|
|
- if (policy == null){
|
|
|
+ if (policy == null) {
|
|
|
throw new SecurityException("未找到政策信息");
|
|
|
}
|
|
|
- StringBuffer stringBuffer = new StringBuffer();//导入失败的商品
|
|
|
+ // 导入失败的商品
|
|
|
+ StringBuilder stringBuffer = new StringBuilder();
|
|
|
List<SalesPolicyItem> list = new ArrayList<>();
|
|
|
- //根据商品编码和主政策id查政策明细
|
|
|
- for(int i=0;i<data.size();i++)
|
|
|
- {
|
|
|
- PolicyExcel policyExcel = data.get(i);
|
|
|
- if (StringUtils.isBlank(policyExcel.getCode())){
|
|
|
- stringBuffer.append(policyExcel.getCode()+",");
|
|
|
+ // 根据商品编码和主政策id查政策明细
|
|
|
+ for (PolicyExcel policyExcel : data) {
|
|
|
+ if (StringUtils.isBlank(policyExcel.getCode())) {
|
|
|
+ stringBuffer.append(policyExcel.getCode()).append(",");
|
|
|
continue;
|
|
|
}
|
|
|
- if (policyExcel.getOrderQuantity() == null){
|
|
|
+ if (policyExcel.getOrderQuantity() == null) {
|
|
|
policyExcel.setOrderQuantity(BigDecimal.ZERO);
|
|
|
}
|
|
|
- SalesPolicyItem policyItem = salesPolicyClient.getPolicyItem(policyExcel.getCode(), policy.getId(),salesType);
|
|
|
- if (policyItem == null){
|
|
|
- stringBuffer.append(policyExcel.getCode()+",");
|
|
|
+ SalesPolicyItem policyItem = salesPolicyClient.getPolicyItem(policyExcel.getCode(), policy.getId(), salesType);
|
|
|
+ if (policyItem == null) {
|
|
|
+ stringBuffer.append(policyExcel.getCode()).append(",");
|
|
|
continue;
|
|
|
}
|
|
|
+ policyItem.setIsSpecial("特价".equals(policy.getType()) ? 1 : 0);
|
|
|
policyItem.setOrderQuantity(policyExcel.getOrderQuantity());
|
|
|
list.add(policyItem);
|
|
|
}
|
|
|
- map.put("list",list);
|
|
|
- map.put("message",stringBuffer.toString());
|
|
|
+ map.put("list", list);
|
|
|
+ map.put("message", stringBuffer.toString());
|
|
|
return R.data(map);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public boolean submitPay(Long id) {
|
|
|
Integer integer = baseMapper.submitPay(id);
|
|
|
- if (integer != null && integer >0){
|
|
|
- return true;
|
|
|
- }else {
|
|
|
- return false;
|
|
|
- }
|
|
|
+ return integer != null && integer > 0;
|
|
|
}
|
|
|
|
|
|
}
|