|
@@ -7,6 +7,8 @@ import com.fs.common.annotation.Log;
|
|
|
import com.fs.common.core.controller.BaseController;
|
|
import com.fs.common.core.controller.BaseController;
|
|
|
import com.fs.common.core.domain.AjaxResult;
|
|
import com.fs.common.core.domain.AjaxResult;
|
|
|
import com.fs.common.core.domain.R;
|
|
import com.fs.common.core.domain.R;
|
|
|
|
|
+import com.fs.common.core.domain.entity.SysRole;
|
|
|
|
|
+import com.fs.common.core.domain.entity.SysUser;
|
|
|
import com.fs.common.core.page.TableDataInfo;
|
|
import com.fs.common.core.page.TableDataInfo;
|
|
|
import com.fs.common.enums.BusinessType;
|
|
import com.fs.common.enums.BusinessType;
|
|
|
import com.fs.common.utils.CloudHostUtils;
|
|
import com.fs.common.utils.CloudHostUtils;
|
|
@@ -22,6 +24,7 @@ import com.fs.his.param.BatchSetErpOrderParam;
|
|
|
import com.fs.his.vo.*;
|
|
import com.fs.his.vo.*;
|
|
|
import com.fs.his.param.FsIntegralOrderParam;
|
|
import com.fs.his.param.FsIntegralOrderParam;
|
|
|
import com.fs.his.service.*;
|
|
import com.fs.his.service.*;
|
|
|
|
|
+import com.fs.system.service.ISysRoleService;
|
|
|
import com.fs.utils.OrderContextHolder;
|
|
import com.fs.utils.OrderContextHolder;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -81,6 +84,7 @@ public class FsIntegralOrderController extends BaseController
|
|
|
public TableDataInfo list(FsIntegralOrderParam fsIntegralOrder)
|
|
public TableDataInfo list(FsIntegralOrderParam fsIntegralOrder)
|
|
|
{
|
|
{
|
|
|
startPage();
|
|
startPage();
|
|
|
|
|
+ List<FsIntegralOrderListVO> list = new ArrayList<>();
|
|
|
if (CloudHostUtils.hasCloudHostName("金牛明医")){
|
|
if (CloudHostUtils.hasCloudHostName("金牛明医")){
|
|
|
/*目前只有金牛有状态为6的查询,其他项目避免使用6状态码*/
|
|
/*目前只有金牛有状态为6的查询,其他项目避免使用6状态码*/
|
|
|
if (fsIntegralOrder.getStatus() != null && fsIntegralOrder.getStatus().equals("6")) {
|
|
if (fsIntegralOrder.getStatus() != null && fsIntegralOrder.getStatus().equals("6")) {
|
|
@@ -89,82 +93,109 @@ public class FsIntegralOrderController extends BaseController
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 金牛明医项目:支持多个订单ID查询
|
|
// 金牛明医项目:支持多个订单ID查询
|
|
|
- if (fsIntegralOrder.getOrderCodes() != null && !fsIntegralOrder.getOrderCodes().isEmpty()) {
|
|
|
|
|
- // 如果传了orderIds参数,使用新的查询逻辑
|
|
|
|
|
- List<FsIntegralOrder> orders = fsIntegralOrderService.selectFsIntegralOrderByOrderIdsv2(fsIntegralOrder.getOrderCodes());
|
|
|
|
|
- List<FsIntegralOrderListVO> list = orders.stream()
|
|
|
|
|
- .map(this::convertOrderToListVO)
|
|
|
|
|
- .collect(Collectors.toList());
|
|
|
|
|
- for (FsIntegralOrderListVO vo : list) {
|
|
|
|
|
- vo.setUserPhone(decryptAutoPhoneMk(vo.getUserPhone()));
|
|
|
|
|
- }
|
|
|
|
|
- return getDataTable(list);
|
|
|
|
|
- } else {
|
|
|
|
|
- // 原有逻辑:单个orderId或其他条件查询
|
|
|
|
|
- List<FsIntegralOrderListVO> list = fsIntegralOrderService.selectFsIntegralOrderListByJn(fsIntegralOrder);
|
|
|
|
|
- for (FsIntegralOrderListVO vo : list) {
|
|
|
|
|
- vo.setUserPhone(decryptAutoPhoneMk(vo.getUserPhone()));
|
|
|
|
|
- }
|
|
|
|
|
- return getDataTable(list);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+// if (fsIntegralOrder.getOrderCodes() != null && !fsIntegralOrder.getOrderCodes().isEmpty()) {
|
|
|
|
|
+// // 如果传了orderIds参数,使用新的查询逻辑
|
|
|
|
|
+// List<FsIntegralOrder> orders = fsIntegralOrderService.selectFsIntegralOrderByOrderIdsv2(fsIntegralOrder.getOrderCodes());
|
|
|
|
|
+// List<FsIntegralOrderListVO> list = orders.stream()
|
|
|
|
|
+// .map(this::convertOrderToListVO)
|
|
|
|
|
+// .collect(Collectors.toList());
|
|
|
|
|
+// for (FsIntegralOrderListVO vo : list) {
|
|
|
|
|
+// vo.setUserPhone(decryptAutoPhoneMk(vo.getUserPhone()));
|
|
|
|
|
+// }
|
|
|
|
|
+// return getDataTable(list);
|
|
|
|
|
+// } else {
|
|
|
|
|
+// // 原有逻辑:单个orderId或其他条件查询
|
|
|
|
|
+// List<FsIntegralOrderListVO> list = fsIntegralOrderService.selectFsIntegralOrderListByJn(fsIntegralOrder);
|
|
|
|
|
+// for (FsIntegralOrderListVO vo : list) {
|
|
|
|
|
+// vo.setUserPhone(decryptAutoPhoneMk(vo.getUserPhone()));
|
|
|
|
|
+// }
|
|
|
|
|
+// return getDataTable(list);
|
|
|
|
|
+// }
|
|
|
|
|
+ list = fsIntegralOrderService.selectFsIntegralOrderListByJn(fsIntegralOrder);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ list = fsIntegralOrderService.selectFsIntegralOrderListVO(fsIntegralOrder);
|
|
|
}
|
|
}
|
|
|
- List<FsIntegralOrderListVO> list = fsIntegralOrderService.selectFsIntegralOrderListVO(fsIntegralOrder);
|
|
|
|
|
- for (FsIntegralOrderListVO vo : list) {
|
|
|
|
|
- vo.setUserPhone(decryptAutoPhoneMk(vo.getUserPhone()));
|
|
|
|
|
|
|
+ SysRole sysRole = isCheckPermission();
|
|
|
|
|
+ if (sysRole != null && !(sysRole.getIsCheckPhone()==1)) {
|
|
|
|
|
+ for (FsIntegralOrderListVO vo : list) {
|
|
|
|
|
+ vo.setUserPhone(decryptAutoPhoneMk(vo.getUserPhone()));
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
return getDataTable(list);
|
|
return getDataTable(list);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private ISysRoleService sysRoleService;
|
|
|
|
|
+ private SysRole isCheckPermission() {
|
|
|
|
|
+ SysRole sysRole = new SysRole();
|
|
|
|
|
+ SysUser user = getLoginUser().getUser();
|
|
|
|
|
+ boolean flag = user.isAdmin();
|
|
|
|
|
+ if (flag) {
|
|
|
|
|
+ sysRole.setIsCheckPhone(1);
|
|
|
|
|
+ sysRole.setIsCheckAddress(1);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ List<SysRole> roles = user.getRoles();
|
|
|
|
|
+ if (roles != null && !roles.isEmpty()) {
|
|
|
|
|
+ Long[] roleIds = roles.stream().map(SysRole::getRoleId).toArray(Long[]::new);
|
|
|
|
|
+ return sysRoleService.getIsCheckPermission(roleIds);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return sysRole;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 导出积分商品订单列表
|
|
* 导出积分商品订单列表
|
|
|
*/
|
|
*/
|
|
|
@PreAuthorize("@ss.hasPermi('his:integralOrder:export')")
|
|
@PreAuthorize("@ss.hasPermi('his:integralOrder:export')")
|
|
|
@Log(title = "积分商品订单", businessType = BusinessType.EXPORT)
|
|
@Log(title = "积分商品订单", businessType = BusinessType.EXPORT)
|
|
|
@GetMapping("/export")
|
|
@GetMapping("/export")
|
|
|
- public AjaxResult export(FsIntegralOrder fsIntegralOrder)
|
|
|
|
|
- {
|
|
|
|
|
- if (CloudHostUtils.hasCloudHostName("金牛明医")&&fsIntegralOrder.getStatus() != null && fsIntegralOrder.getStatus().equals(6)) {
|
|
|
|
|
|
|
+ public AjaxResult export(FsIntegralOrderParam fsIntegralOrder) {
|
|
|
|
|
+ List<FsIntegralOrderListVO> fsIntegralOrderListVOS = new ArrayList<>();
|
|
|
|
|
+ if (CloudHostUtils.hasCloudHostName("金牛明医")){
|
|
|
/*目前只有金牛有状态为6的查询,其他项目避免使用6状态码*/
|
|
/*目前只有金牛有状态为6的查询,其他项目避免使用6状态码*/
|
|
|
- FsIntegralOrderParam param = new FsIntegralOrderParam();
|
|
|
|
|
- BeanUtil.copyProperties(fsIntegralOrder, param);
|
|
|
|
|
- param.setStatus("1");
|
|
|
|
|
- param.setIsPush(0);
|
|
|
|
|
- List<FsIntegralOrderListVO> fsIntegralOrderListVOS = fsIntegralOrderService.selectFsIntegralOrderListByJn(param);
|
|
|
|
|
-
|
|
|
|
|
- // 处理商品名称:解析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()) {
|
|
|
|
|
- com.alibaba.fastjson.JSONObject goods = jsonArray.getJSONObject(0);
|
|
|
|
|
- if (goods != null && goods.getString("goodsName") != null) {
|
|
|
|
|
- vo.setGoodsName(goods.getString("goodsName"));
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- } else if (vo.getItemJson().startsWith("{")) {
|
|
|
|
|
- // 对象格式
|
|
|
|
|
- com.alibaba.fastjson.JSONObject goods = com.alibaba.fastjson.JSONObject.parseObject(vo.getItemJson());
|
|
|
|
|
|
|
+ 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 {
|
|
|
|
|
+ // 尝试解析JSON格式的商品信息
|
|
|
|
|
+ if (vo.getItemJson().startsWith("[")) {
|
|
|
|
|
+ // 数组格式,取第一个商品
|
|
|
|
|
+ com.alibaba.fastjson.JSONArray jsonArray = com.alibaba.fastjson.JSONArray.parseArray(vo.getItemJson());
|
|
|
|
|
+ if (jsonArray != null && !jsonArray.isEmpty()) {
|
|
|
|
|
+ com.alibaba.fastjson.JSONObject goods = jsonArray.getJSONObject(0);
|
|
|
if (goods != null && goods.getString("goodsName") != null) {
|
|
if (goods != null && goods.getString("goodsName") != null) {
|
|
|
vo.setGoodsName(goods.getString("goodsName"));
|
|
vo.setGoodsName(goods.getString("goodsName"));
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- } catch (Exception e) {
|
|
|
|
|
- // 解析失败时保持goodsName为空,避免导出出错
|
|
|
|
|
- log.warn("解析商品信息失败,订单编号:{}, 商品信息:{}", vo.getOrderCode(), vo.getItemJson());
|
|
|
|
|
|
|
+ } else if (vo.getItemJson().startsWith("{")) {
|
|
|
|
|
+ // 对象格式
|
|
|
|
|
+ com.alibaba.fastjson.JSONObject goods = com.alibaba.fastjson.JSONObject.parseObject(vo.getItemJson());
|
|
|
|
|
+ if (goods != null && goods.getString("goodsName") != null) {
|
|
|
|
|
+ vo.setGoodsName(goods.getString("goodsName"));
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ // 解析失败时保持goodsName为空,避免导出出错
|
|
|
|
|
+ log.warn("解析商品信息失败,订单编号:{}, 商品信息:{}", vo.getOrderCode(), vo.getItemJson());
|
|
|
}
|
|
}
|
|
|
- // 解密手机号
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!(sysRole.getIsCheckPhone()==1)){
|
|
|
|
|
+ // 加密手机号
|
|
|
vo.setUserPhone(decryptAutoPhoneMk(vo.getUserPhone()));
|
|
vo.setUserPhone(decryptAutoPhoneMk(vo.getUserPhone()));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- ExcelUtil<FsIntegralOrderListVO> util = new ExcelUtil<>(FsIntegralOrderListVO.class);
|
|
|
|
|
- return util.exportExcel(new ArrayList<>(fsIntegralOrderListVOS), "积分商品订单数据");
|
|
|
|
|
}
|
|
}
|
|
|
- return fsIntegralOrderService.export(fsIntegralOrder);
|
|
|
|
|
|
|
+ ExcelUtil<FsIntegralOrderListVO> util = new ExcelUtil<>(FsIntegralOrderListVO.class);
|
|
|
|
|
+ return util.exportExcel(new ArrayList<>(fsIntegralOrderListVOS), "积分商品订单数据");
|
|
|
}
|
|
}
|
|
|
/**
|
|
/**
|
|
|
* 发货
|
|
* 发货
|
|
@@ -460,32 +491,4 @@ public class FsIntegralOrderController extends BaseController
|
|
|
return df;
|
|
return df;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * 将 FsIntegralOrder 转换为 FsIntegralOrderListVO
|
|
|
|
|
- * @param order 积分订单实体
|
|
|
|
|
- * @return 转换后的VO对象
|
|
|
|
|
- */
|
|
|
|
|
- private FsIntegralOrderListVO convertOrderToListVO(FsIntegralOrder order) {
|
|
|
|
|
- FsIntegralOrderListVO vo = new FsIntegralOrderListVO();
|
|
|
|
|
- vo.setOrderId(order.getOrderId());
|
|
|
|
|
- vo.setOrderCode(order.getOrderCode());
|
|
|
|
|
- vo.setUserId(order.getUserId());
|
|
|
|
|
- vo.setUserName(order.getUserName());
|
|
|
|
|
- vo.setUserPhone(order.getUserPhone());
|
|
|
|
|
- vo.setUserAddress(order.getUserAddress());
|
|
|
|
|
- vo.setItemJson(order.getItemJson());
|
|
|
|
|
- vo.setIntegral(order.getIntegral());
|
|
|
|
|
- vo.setStatus(order.getStatus() != null ? order.getStatus().toString() : null);
|
|
|
|
|
- vo.setDeliveryCode(order.getDeliveryCode());
|
|
|
|
|
- vo.setDeliveryName(order.getDeliveryName());
|
|
|
|
|
- vo.setDeliverySn(order.getDeliverySn());
|
|
|
|
|
- vo.setDeliveryTime(order.getDeliveryTime());
|
|
|
|
|
- vo.setCreateTime(order.getCreateTime());
|
|
|
|
|
- vo.setQwUserId(order.getQwUserId());
|
|
|
|
|
- vo.setCompanyUserId(order.getCompanyUserId());
|
|
|
|
|
- vo.setCompanyId(order.getCompanyId());
|
|
|
|
|
- vo.setPayMoney(order.getPayMoney());
|
|
|
|
|
- vo.setLoginAccount(order.getLoginAccount());
|
|
|
|
|
- return vo;
|
|
|
|
|
- }
|
|
|
|
|
}
|
|
}
|