|
|
@@ -3,6 +3,7 @@ package com.fs.his.controller;
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
+import com.fs.common.BeanCopyUtils;
|
|
|
import com.fs.common.annotation.Log;
|
|
|
import com.fs.common.core.controller.BaseController;
|
|
|
import com.fs.common.core.domain.AjaxResult;
|
|
|
@@ -143,12 +144,11 @@ public class FsIntegralOrderController extends BaseController
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 导出积分商品订单列表
|
|
|
+ * 导出积分商品订单列表 卓美个性化导出
|
|
|
*/
|
|
|
@PreAuthorize("@ss.hasPermi('his:integralOrder:export')")
|
|
|
@Log(title = "积分商品订单", businessType = BusinessType.EXPORT)
|
|
|
@GetMapping("/export")
|
|
|
-
|
|
|
public AjaxResult export(FsIntegralOrderParam fsIntegralOrder) {
|
|
|
List<FsIntegralOrderListVO> fsIntegralOrderListVOS = new ArrayList<>();
|
|
|
if (CloudHostUtils.hasCloudHostName("金牛明医")){
|
|
|
@@ -163,7 +163,12 @@ public class FsIntegralOrderController extends BaseController
|
|
|
}
|
|
|
SysRole sysRole = isCheckPermission();
|
|
|
// 处理商品名称:解析item_json并设置goodsName
|
|
|
+ List<FsIntegralOrderListVO> newFsIntegralOrderListVOS=new ArrayList<>();
|
|
|
for (FsIntegralOrderListVO vo : fsIntegralOrderListVOS) {
|
|
|
+ if (!(sysRole.getIsCheckPhone()==1)){
|
|
|
+ // 加密手机号
|
|
|
+ vo.setUserPhone(decryptAutoPhoneMk(vo.getUserPhone()));
|
|
|
+ }
|
|
|
if (StringUtils.isNotEmpty(vo.getItemJson())) {
|
|
|
try {
|
|
|
// 尝试解析JSON格式的商品信息
|
|
|
@@ -171,44 +176,30 @@ public class FsIntegralOrderController extends BaseController
|
|
|
// 数组格式,遍历所有商品,用换行符分隔
|
|
|
com.alibaba.fastjson.JSONArray jsonArray = com.alibaba.fastjson.JSONArray.parseArray(vo.getItemJson());
|
|
|
if (jsonArray != null && !jsonArray.isEmpty()) {
|
|
|
- StringBuilder goodsNameBuilder = new StringBuilder();
|
|
|
- StringBuilder barCodeBuilder = new StringBuilder();
|
|
|
-
|
|
|
for (int i = 0; i < jsonArray.size(); i++) {
|
|
|
+ FsIntegralOrderListVO newVo = BeanCopyUtils.copy(vo,FsIntegralOrderListVO.class);
|
|
|
+ if (newVo==null){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
com.alibaba.fastjson.JSONObject goods = jsonArray.getJSONObject(i);
|
|
|
|
|
|
// 处理商品名称和数量
|
|
|
if (goods != null && goods.getString("goodsName") != null) {
|
|
|
String name = goods.getString("goodsName");
|
|
|
String num = goods.getString("num");
|
|
|
- if (StringUtils.isEmpty(num)) {
|
|
|
- num = "1"; // 默认数量为1
|
|
|
- }
|
|
|
- if (goodsNameBuilder.length() > 0) {
|
|
|
- goodsNameBuilder.append("\r\n");
|
|
|
- }
|
|
|
- goodsNameBuilder.append(name).append(",数量:").append(num).append("个");
|
|
|
+ newVo.setNum(num);
|
|
|
+ newVo.setGoodsName(name);
|
|
|
}
|
|
|
|
|
|
// 处理商品编码
|
|
|
if (goods != null && goods.getString("barCode") != null) {
|
|
|
String barCode = goods.getString("barCode");
|
|
|
- if (barCodeBuilder.length() > 0) {
|
|
|
- barCodeBuilder.append("\r\n");
|
|
|
- }
|
|
|
- barCodeBuilder.append(barCode);
|
|
|
+ newVo.setBarCode(barCode);
|
|
|
}
|
|
|
+ newFsIntegralOrderListVOS.add(newVo);
|
|
|
}
|
|
|
-
|
|
|
- // 设置商品名称
|
|
|
- if (goodsNameBuilder.length() > 0) {
|
|
|
- vo.setGoodsName(goodsNameBuilder.toString());
|
|
|
- }
|
|
|
-
|
|
|
- // 设置商品编码
|
|
|
- if (barCodeBuilder.length() > 0) {
|
|
|
- vo.setBarCode(barCodeBuilder.toString());
|
|
|
- }
|
|
|
+ }else{
|
|
|
+ newFsIntegralOrderListVOS.add(vo);
|
|
|
}
|
|
|
} else if (vo.getItemJson().startsWith("{")) {
|
|
|
// 对象格式
|
|
|
@@ -218,30 +209,27 @@ public class FsIntegralOrderController extends BaseController
|
|
|
if (goods != null && goods.getString("goodsName") != null) {
|
|
|
String name = goods.getString("goodsName");
|
|
|
String num = goods.getString("num");
|
|
|
- if (StringUtils.isEmpty(num)) {
|
|
|
- num = "1"; // 默认数量为1
|
|
|
- }
|
|
|
- vo.setGoodsName(name + ",数量:" + num + "个");
|
|
|
+ vo.setNum(num);
|
|
|
+ vo.setGoodsName(name);
|
|
|
}
|
|
|
|
|
|
// 处理商品编码
|
|
|
if (goods != null && goods.getString("barCode") != null) {
|
|
|
vo.setBarCode(goods.getString("barCode"));
|
|
|
}
|
|
|
+ newFsIntegralOrderListVOS.add(vo);
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
// 解析失败时保持goodsName为空,避免导出出错
|
|
|
log.warn("解析商品信息失败,订单编号:{}, 商品信息:{}", vo.getOrderCode(), vo.getItemJson());
|
|
|
}
|
|
|
- }
|
|
|
- if (!(sysRole.getIsCheckPhone()==1)){
|
|
|
- // 加密手机号
|
|
|
- vo.setUserPhone(decryptAutoPhoneMk(vo.getUserPhone()));
|
|
|
+ }else {
|
|
|
+ newFsIntegralOrderListVOS.add(vo);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
ExcelUtil<FsIntegralOrderListVO> util = new ExcelUtil<>(FsIntegralOrderListVO.class);
|
|
|
- return util.exportExcel(new ArrayList<>(fsIntegralOrderListVOS), "积分商品订单数据");
|
|
|
+ return util.exportExcel(new ArrayList<>(newFsIntegralOrderListVOS), "积分商品订单数据");
|
|
|
}
|
|
|
|
|
|
/*public AjaxResult export(FsIntegralOrderParam fsIntegralOrder) {
|