|
|
@@ -28,11 +28,7 @@ import com.fs.common.event.TemplateEvent;
|
|
|
import com.fs.common.event.TemplateListenEnum;
|
|
|
import com.fs.common.exception.CustomException;
|
|
|
import com.fs.common.exception.ServiceException;
|
|
|
-import com.fs.common.utils.CloudHostUtils;
|
|
|
-import com.fs.common.utils.DateUtils;
|
|
|
-import com.fs.common.utils.IpUtil;
|
|
|
-import com.fs.common.utils.ServletUtils;
|
|
|
-import com.fs.common.utils.StringUtils;
|
|
|
+import com.fs.common.utils.*;
|
|
|
import com.fs.common.utils.poi.ExcelUtil;
|
|
|
import com.fs.common.utils.ip.IpUtils;
|
|
|
import com.fs.common.utils.spring.SpringUtils;
|
|
|
@@ -5442,6 +5438,73 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
return expressInfoDTO;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public String importOrderStatusData(List<FsStoreOrderStateVo> list) {
|
|
|
+ if (StringUtils.isNull(list) || list.isEmpty()) {
|
|
|
+ throw new ServiceException("导入数据不能为空!");
|
|
|
+ }
|
|
|
+ int successNum = 0;
|
|
|
+ int failureNum = 0;
|
|
|
+ StringBuilder successMsg = new StringBuilder();
|
|
|
+ StringBuilder failureMsg = new StringBuilder();
|
|
|
+ for (FsStoreOrderStateVo vo : list) {
|
|
|
+ try {
|
|
|
+ //1.必填参数
|
|
|
+ ExcelUtils.validateRequiredFields(vo, list.indexOf(vo) + 1); // 传入行号
|
|
|
+ FsStoreOrderScrm o = fsStoreOrderMapper.selectFsStoreOrderByOrderCode(vo.getOrderCode());
|
|
|
+ if (o ==null){
|
|
|
+ failureNum++;
|
|
|
+ String msg = "<br/>" + failureNum + "、订单编号 " + vo.getOrderCode() + " 导入失败:";
|
|
|
+ failureMsg.append(msg).append("订单不存在");
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ FsStoreOrderScrm param = new FsStoreOrderScrm();
|
|
|
+ param.setOrderCode(vo.getOrderCode());
|
|
|
+ String inputStatus = vo.getStatus();
|
|
|
+ if (StringUtils.isEmpty(inputStatus)) {
|
|
|
+ failureNum++;
|
|
|
+ String msg = "<br/>" + failureNum + "、订单编号 " + vo.getOrderCode() + " 导入失败:";
|
|
|
+ failureMsg.append(msg).append("该订单状态为空");
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ if ("-1".equals(inputStatus)) {
|
|
|
+ failureNum++;
|
|
|
+ String msg = "<br/>" + failureNum + "、订单编号 " + vo.getOrderCode() + " 导入失败:";
|
|
|
+ failureMsg.append(msg).append("该状态不支持修改为退款中,需要手动申请退款");
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ if ("-2".equals(inputStatus)) {
|
|
|
+ failureNum++;
|
|
|
+ String msg = "<br/>" + failureNum + "、订单编号 " + vo.getOrderCode() + " 导入失败:";
|
|
|
+ failureMsg.append(msg).append("该状态不支持修改为已退款,需要审核完成退款");
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ param.setStatus(Integer.valueOf(inputStatus));
|
|
|
+ fsStoreOrderMapper.updateFsStoreOrderByOrderCode(param);
|
|
|
+
|
|
|
+ successNum++;
|
|
|
+ successMsg.append("<br/>").append(successNum).append("、订单编号 ").append(vo.getOrderCode()).append(" 修改成功");
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+
|
|
|
+ failureNum++;
|
|
|
+ String msg = "<br/>" + failureNum + "、订单编号 " + vo.getOrderCode() + " 修改失败:";
|
|
|
+ failureMsg.append(msg).append(e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (failureNum > 0) {
|
|
|
+ failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
|
|
|
+ throw new ServiceException(failureMsg.toString());
|
|
|
+ } else {
|
|
|
+ successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
|
|
|
+ }
|
|
|
+ return successMsg.toString();
|
|
|
+ }
|
|
|
+
|
|
|
private static final DateTimeFormatter CST_FORMATTER = DateTimeFormatter
|
|
|
.ofPattern("EEE MMM dd HH:mm:ss zzz yyyy", Locale.US)
|
|
|
.withZone(ZoneId.of("Asia/Shanghai"));
|