|
@@ -1,5 +1,6 @@
|
|
|
package com.fs.his.service.impl;
|
|
|
|
|
|
+import java.util.Collections;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.Set;
|
|
@@ -16,10 +17,12 @@ import com.fs.his.mapper.FsStorePaymentMapper;
|
|
|
import com.fs.his.param.FsStoreOrderParam;
|
|
|
import com.fs.his.param.FsStorePaymentParam;
|
|
|
import com.fs.his.service.IFsStoreOrderService;
|
|
|
+import com.fs.his.utils.PhoneUtil;
|
|
|
import com.fs.his.vo.FsStoreOrderExcelVO;
|
|
|
import com.fs.his.vo.FsStoreOrderExportVO;
|
|
|
import com.fs.his.vo.FsStorePaymentExcelVO;
|
|
|
import com.fs.system.service.ISysMenuService;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.scheduling.annotation.Async;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -34,6 +37,7 @@ import com.fs.his.service.IFsExportTaskService;
|
|
|
* @date 2024-11-19
|
|
|
*/
|
|
|
@Service
|
|
|
+@Slf4j
|
|
|
public class FsExportTaskServiceImpl implements IFsExportTaskService
|
|
|
{
|
|
|
@Autowired
|
|
@@ -126,46 +130,42 @@ public class FsExportTaskServiceImpl implements IFsExportTaskService
|
|
|
return fsExportTaskMapper.isExportType1(userId);
|
|
|
}
|
|
|
|
|
|
- @Async
|
|
|
+ @Async(value = "threadPoolTaskExecutor")
|
|
|
@Override
|
|
|
public void exportStore1Data(FsStoreOrderParam fsStoreOrder) {
|
|
|
List<FsStoreOrderExportVO> list = fsStoreOrderMapper.selectFsStoreOrderListVOByExport(fsStoreOrder);
|
|
|
//对手机号脱敏
|
|
|
if (list != null) {
|
|
|
-
|
|
|
-
|
|
|
+ LoginUser loginUser = SecurityUtils.getLoginUser();
|
|
|
+ boolean isAdmin = loginUser.getUser().isAdmin();
|
|
|
+ // 获取用户权限
|
|
|
+ boolean hasPhonePermission = isAdmin;
|
|
|
+ boolean hasAddressPermission = isAdmin;
|
|
|
+
|
|
|
+ if (!isAdmin) {
|
|
|
+ Set<String> perms = menuService.selectMenuPermsByUserId(loginUser.getUserId());
|
|
|
+ log.info("当前用户登录权限: {}", perms);
|
|
|
+ hasPhonePermission = perms.contains("his:storeOrder:queryPhone");
|
|
|
+ hasAddressPermission = perms.contains("his:storeOrder:queryAddress");
|
|
|
+ }
|
|
|
for (FsStoreOrderExportVO vo : list) {
|
|
|
vo.setFollowFrequency(6);
|
|
|
if (vo.getCycle()!=null){
|
|
|
vo.setFollowCount(vo.getCycle()/ vo.getFollowFrequency());
|
|
|
}
|
|
|
- boolean isPhoneEncodeFlag = true;
|
|
|
- boolean isAddressEncodeFlag = true;
|
|
|
- LoginUser loginUser = SecurityUtils.getLoginUser();
|
|
|
- List<SysRole> admin = loginUser.getUser().getRoles().stream().filter(item -> item.getRoleKey().equals("admin")).collect(Collectors.toList());
|
|
|
- if (!admin.isEmpty()) {
|
|
|
- //超级管理员
|
|
|
- isAddressEncodeFlag = false;
|
|
|
- isPhoneEncodeFlag = false;
|
|
|
- } else {
|
|
|
- //非超级管理员
|
|
|
- Set<String> perms = menuService.selectMenuPermsByUserId(loginUser.getUserId());
|
|
|
- boolean phoneContains = perms.contains("his:storeOrder:queryPhone");
|
|
|
- boolean addressContains = perms.contains("his:storeOrder:queryAddress");
|
|
|
- if (addressContains) {
|
|
|
- isAddressEncodeFlag = false;
|
|
|
- }
|
|
|
- if (phoneContains) {
|
|
|
- isPhoneEncodeFlag = false;
|
|
|
- }
|
|
|
- }
|
|
|
- if (isPhoneEncodeFlag) {
|
|
|
- if (vo.getUserPhone() != null) {
|
|
|
- vo.setUserPhone(vo.getUserPhone().replaceAll("(\\d{3})\\d*(\\d{4})", "$1****$2"));
|
|
|
+
|
|
|
+ // 处理手机号
|
|
|
+ if (vo.getUserPhone() != null) {
|
|
|
+ String decryptedPhone = PhoneUtil.decryptPhone(vo.getUserPhone());
|
|
|
+ if (hasPhonePermission) {
|
|
|
+ vo.setUserPhone(decryptedPhone);
|
|
|
+ } else {
|
|
|
+ vo.setUserPhone(decryptedPhone.replaceAll("(\\d{3})\\d*(\\d{4})", "$1****$2"));
|
|
|
}
|
|
|
}
|
|
|
- if (isAddressEncodeFlag) {
|
|
|
- if (vo.getUserAddress() != null) {
|
|
|
+ // 处理地址
|
|
|
+ if (vo.getUserAddress() != null) {
|
|
|
+ if (!hasAddressPermission) {
|
|
|
vo.setUserAddress(ParseUtils.parseAddress(vo.getUserAddress()));
|
|
|
}
|
|
|
}
|