|
|
@@ -148,6 +148,7 @@ 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("金牛明医")){
|
|
|
@@ -162,6 +163,101 @@ public class FsIntegralOrderController extends BaseController
|
|
|
}
|
|
|
SysRole sysRole = isCheckPermission();
|
|
|
// 处理商品名称:解析item_json并设置goodsName
|
|
|
+ for (FsIntegralOrderListVO vo : fsIntegralOrderListVOS) {
|
|
|
+ if (StringUtils.isNotEmpty(vo.getItemJson())) {
|
|
|
+ try {
|
|
|
+ // 尝试解析JSON格式的商品信息
|
|
|
+ if (vo.getItemJson().startsWith("[")) {
|
|
|
+ // 数组格式,遍历所有商品,用换行符分隔
|
|
|
+ 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++) {
|
|
|
+ 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("个");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 处理商品编码
|
|
|
+ if (goods != null && goods.getString("barCode") != null) {
|
|
|
+ String barCode = goods.getString("barCode");
|
|
|
+ if (barCodeBuilder.length() > 0) {
|
|
|
+ barCodeBuilder.append("\r\n");
|
|
|
+ }
|
|
|
+ barCodeBuilder.append(barCode);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 设置商品名称
|
|
|
+ if (goodsNameBuilder.length() > 0) {
|
|
|
+ vo.setGoodsName(goodsNameBuilder.toString());
|
|
|
+ }
|
|
|
+
|
|
|
+ // 设置商品编码
|
|
|
+ if (barCodeBuilder.length() > 0) {
|
|
|
+ vo.setBarCode(barCodeBuilder.toString());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (vo.getItemJson().startsWith("{")) {
|
|
|
+ // 对象格式
|
|
|
+ com.alibaba.fastjson.JSONObject goods = com.alibaba.fastjson.JSONObject.parseObject(vo.getItemJson());
|
|
|
+
|
|
|
+ // 处理商品名称和数量
|
|
|
+ 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 + "个");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 处理商品编码
|
|
|
+ if (goods != null && goods.getString("barCode") != null) {
|
|
|
+ vo.setBarCode(goods.getString("barCode"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ // 解析失败时保持goodsName为空,避免导出出错
|
|
|
+ log.warn("解析商品信息失败,订单编号:{}, 商品信息:{}", vo.getOrderCode(), vo.getItemJson());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!(sysRole.getIsCheckPhone()==1)){
|
|
|
+ // 加密手机号
|
|
|
+ vo.setUserPhone(decryptAutoPhoneMk(vo.getUserPhone()));
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ ExcelUtil<FsIntegralOrderListVO> util = new ExcelUtil<>(FsIntegralOrderListVO.class);
|
|
|
+ return util.exportExcel(new ArrayList<>(fsIntegralOrderListVOS), "积分商品订单数据");
|
|
|
+ }
|
|
|
+
|
|
|
+ /*public AjaxResult export(FsIntegralOrderParam fsIntegralOrder) {
|
|
|
+ List<FsIntegralOrderListVO> fsIntegralOrderListVOS = new ArrayList<>();
|
|
|
+ if (CloudHostUtils.hasCloudHostName("金牛明医")){
|
|
|
+ *//*目前只有金牛有状态为6的查询,其他项目避免使用6状态码*//*
|
|
|
+ if (fsIntegralOrder.getStatus() != null && fsIntegralOrder.getStatus().equals("6")) {
|
|
|
+ fsIntegralOrder.setStatus("1");
|
|
|
+ fsIntegralOrder.setIsPush(0);
|
|
|
+ }
|
|
|
+ fsIntegralOrderListVOS = fsIntegralOrderService.selectFsIntegralOrderListByJn(fsIntegralOrder);
|
|
|
+ } else {
|
|
|
+ fsIntegralOrderListVOS = fsIntegralOrderService.selectFsIntegralOrderListVO(fsIntegralOrder);
|
|
|
+ }
|
|
|
+ SysRole sysRole = isCheckPermission();
|
|
|
+ // 处理商品名称:解析item_json并设置goodsName
|
|
|
for (FsIntegralOrderListVO vo : fsIntegralOrderListVOS) {
|
|
|
if (StringUtils.isNotEmpty(vo.getItemJson())) {
|
|
|
try {
|
|
|
@@ -201,7 +297,7 @@ public class FsIntegralOrderController extends BaseController
|
|
|
}
|
|
|
ExcelUtil<FsIntegralOrderListVO> util = new ExcelUtil<>(FsIntegralOrderListVO.class);
|
|
|
return util.exportExcel(new ArrayList<>(fsIntegralOrderListVOS), "积分商品订单数据");
|
|
|
- }
|
|
|
+ }*/
|
|
|
/**
|
|
|
* 发货
|
|
|
*/
|