|
|
@@ -94,6 +94,7 @@ import com.yc.ship.module.system.api.dict.DictDataApi;
|
|
|
import com.yc.ship.module.system.api.dict.dto.DictDataRespDTO;
|
|
|
import com.yc.ship.module.system.api.notify.NotifyMessageSendApi;
|
|
|
import com.yc.ship.module.system.api.notify.dto.NotifySendSingleToUserReqDTO;
|
|
|
+import com.yc.ship.module.system.api.permission.PermissionApi;
|
|
|
import com.yc.ship.module.system.api.user.AdminUserApi;
|
|
|
import com.yc.ship.module.system.api.user.dto.AdminUserRespDTO;
|
|
|
import com.yc.ship.module.trade.api.dto.TradeOrderPayDTO;
|
|
|
@@ -195,6 +196,8 @@ public class OtcTradeOrderServiceImpl implements OtcTradeOrderService {
|
|
|
@Resource
|
|
|
private DictDataApi dictDataApi;
|
|
|
@Resource
|
|
|
+ private PermissionApi permissionApi;
|
|
|
+ @Resource
|
|
|
private AdminUserApi adminUserApi;
|
|
|
@Resource
|
|
|
private ProductApi productApi;
|
|
|
@@ -3960,8 +3963,34 @@ public class OtcTradeOrderServiceImpl implements OtcTradeOrderService {
|
|
|
*/
|
|
|
@Override
|
|
|
public File exportTouristList(TradeOrderPageReqVO reqVO) {
|
|
|
- InputStream template = getClass().getClassLoader().getResourceAsStream("templates/tourist_template_operator.xlsx");
|
|
|
- return getFile(reqVO,template, 0);
|
|
|
+ // 根据当前登录用户角色加载不同模板
|
|
|
+ LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
|
|
+ boolean isDispatch = isDispatchRole(loginUser); // 计调角色判定
|
|
|
+ String templateName;
|
|
|
+ if (isDispatch) {
|
|
|
+ // 计调:使用计调模板
|
|
|
+ templateName = "templates/tourist_template_operator.xlsx";
|
|
|
+ } else {
|
|
|
+ // 销售(或其他角色):使用销售模板
|
|
|
+ templateName = "templates/tourist_template_seller.xlsx";
|
|
|
+ }
|
|
|
+ InputStream template = getClass().getClassLoader().getResourceAsStream(templateName);
|
|
|
+ return getFile(reqVO, template, 0);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 判断当前登录用户是否为计调角色
|
|
|
+ */
|
|
|
+ private boolean isDispatchRole(LoginUser loginUser) {
|
|
|
+ if (loginUser == null) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ // 读取 jd_role 字典的 label(角色码)列表
|
|
|
+ List<String> jdRoleCodes = dictDataApi.getDictDataLabelList("jd_role");
|
|
|
+ if (CollUtil.isEmpty(jdRoleCodes)) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return permissionApi.hasAnyRoles(loginUser.getId(), jdRoleCodes.toArray(new String[0]));
|
|
|
}
|
|
|
|
|
|
/**
|