删除多余类
This commit is contained in:
parent
ee29302e6c
commit
eb53ade810
|
|
@ -1,154 +0,0 @@
|
||||||
package com.bonus.canteen.core.config;//package com.bonus.canteen.core.config;
|
|
||||||
//
|
|
||||||
//import cn.hutool.core.map.MapUtil;
|
|
||||||
//import com.bonus.canteen.core.customer.service.AuthorizingService;
|
|
||||||
//import com.bonus.canteen.core.secure.PmsCache;
|
|
||||||
//import com.fasterxml.jackson.core.JsonProcessingException;
|
|
||||||
//import com.fasterxml.jackson.databind.ObjectMapper;
|
|
||||||
//import com.google.common.collect.Maps;
|
|
||||||
//import com.google.common.collect.Sets;
|
|
||||||
//import org.apache.commons.collections4.CollectionUtils;
|
|
||||||
//import org.apache.commons.collections4.ListUtils;
|
|
||||||
//import org.apache.commons.lang3.BooleanUtils;
|
|
||||||
//import org.slf4j.Logger;
|
|
||||||
//import org.slf4j.LoggerFactory;
|
|
||||||
//import org.springframework.data.redis.core.BoundHashOperations;
|
|
||||||
//import org.springframework.data.redis.core.StringRedisTemplate;
|
|
||||||
//import java.time.Instant;
|
|
||||||
//import java.util.*;
|
|
||||||
//import java.util.function.Function;
|
|
||||||
//import java.util.stream.Collectors;
|
|
||||||
//import java.util.stream.Stream;
|
|
||||||
//
|
|
||||||
//public class SecureManager {
|
|
||||||
// private static final Logger log = LoggerFactory.getLogger(SecureManager.class);
|
|
||||||
// private static SecureProperties secureProperties;
|
|
||||||
// private static StringRedisTemplate redisTemplate;
|
|
||||||
// private static AuthorizingService authorizingService;
|
|
||||||
// private static ObjectMapper objectMapper;
|
|
||||||
//
|
|
||||||
// private SecureManager() {
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public static void setSecureProperties(SecureProperties secureProperties) {
|
|
||||||
// if (SecureManager.secureProperties == null) {
|
|
||||||
// SecureManager.secureProperties = secureProperties;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public static void setRedisTemplate(StringRedisTemplate redisTemplate) {
|
|
||||||
// if (SecureManager.redisTemplate == null) {
|
|
||||||
// SecureManager.redisTemplate = redisTemplate;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public static void setAuthorizingService(AuthorizingService authorizingService) {
|
|
||||||
// if (SecureManager.authorizingService == null) {
|
|
||||||
// SecureManager.authorizingService = authorizingService;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public static void setObjectMapper(ObjectMapper objectMapper) {
|
|
||||||
// if (SecureManager.objectMapper == null) {
|
|
||||||
// SecureManager.objectMapper = objectMapper;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// private static String getPmsKey(long subjectId) {
|
|
||||||
// return "permissions:subject_id:" + subjectId;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// private static String getRoleKey(long subjectId) {
|
|
||||||
// return "roles:subject_id:" + subjectId;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public static void clearAllRoleAndPermission() {
|
|
||||||
// redisTemplate.delete(secureProperties.getPermissionKey());
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public static void clearRoleAndPermission(long subjectId) {
|
|
||||||
// redisTemplate.boundHashOps(secureProperties.getPermissionKey()).delete(new Object[]{getRoleKey(subjectId), getPmsKey(subjectId)});
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public static void clearRole(long subjectId) {
|
|
||||||
// redisTemplate.boundHashOps(secureProperties.getPermissionKey()).delete(new Object[]{getRoleKey(subjectId)});
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public static void clearPermission(long subjectId) {
|
|
||||||
// redisTemplate.boundHashOps(secureProperties.getPermissionKey()).delete(new Object[]{getPmsKey(subjectId)});
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public static boolean isLogin() {
|
|
||||||
// return (Boolean)WebContext.get().getAccessToken().map(AccessToken::isAuthenticated).orElse(false);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public static Optional<Long> getSubjectId() {
|
|
||||||
// return WebContext.get().getAccessToken().map(AccessToken::getSubjectId);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public static Optional<String> getSubjectName() {
|
|
||||||
// return WebContext.get().getAccessToken().map(AccessToken::getSubjectName);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public static Map<String, String> getSubjectData() {
|
|
||||||
// return (Map)WebContext.get().getAccessToken().map(AccessToken::getSubjectData).orElse(Maps.newHashMap());
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public static Map<String, String> attachData(Map<String, String> data) {
|
|
||||||
// try {
|
|
||||||
// if (MapUtil.isEmpty(data)) {
|
|
||||||
// return Maps.newHashMapWithExpectedSize(0);
|
|
||||||
// } else {
|
|
||||||
// AccessToken accessToken = (AccessToken)WebContext.get().getAccessToken().orElse(AccessToken.create());
|
|
||||||
// Objects.requireNonNull(accessToken);
|
|
||||||
// data.forEach(accessToken::setData);
|
|
||||||
// accessToken.bind().store();
|
|
||||||
// return accessToken.getSubjectData();
|
|
||||||
// }
|
|
||||||
// } catch (Throwable var2) {
|
|
||||||
// throw var2;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public static Map<String, String> attachData(String key, String value) {
|
|
||||||
// try {
|
|
||||||
// return attachData(Collections.singletonMap(key, value));
|
|
||||||
// } catch (Throwable var3) {
|
|
||||||
// throw var3;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public static void logout() {
|
|
||||||
// WebContext.get().getAccessToken().ifPresent(AccessToken::clear);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public static void revokeAuthenticate() {
|
|
||||||
// WebContext.get().getAccessToken().ifPresent((accessToken) -> {
|
|
||||||
// accessToken.revokeAuthenticate().store();
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public static void revokeAuthenticate(long subjectId, int reservedRecentNum) {
|
|
||||||
// StringRedisTemplate var10000 = redisTemplate;
|
|
||||||
// String var10001 = secureProperties.getServer().getSubjectRefTokenKey();
|
|
||||||
// Set<String> keys = var10000.keys(var10001 + ":" + subjectId + ":*");
|
|
||||||
// if (CollectionUtils.size(keys) > reservedRecentNum) {
|
|
||||||
// assert keys != null;
|
|
||||||
//
|
|
||||||
// Map<Long, List<String>> createTimeAsc_keys = (Map)keys.stream().collect(Collectors.groupingBy((key) -> {
|
|
||||||
// return Long.parseLong(key.split(":")[4]);
|
|
||||||
// }, TreeMap::new, Collectors.toList()));
|
|
||||||
// List<String> keysAsc = createTimeAsc_keys.values().stream().flatMap(Collection::stream).collect(Collectors.toList());
|
|
||||||
// List<String> beDeleteRefKeys = keysAsc.subList(0, keysAsc.size() - reservedRecentNum);
|
|
||||||
// List<String> beDeleteTokenKeys = beDeleteRefKeys.stream().map((dk) -> {
|
|
||||||
// String var100001 = secureProperties.getServer().getStoreKey();
|
|
||||||
// return var100001 + ":" + dk.split(":")[3];
|
|
||||||
// }).collect(Collectors.toList());
|
|
||||||
// redisTemplate.delete(ListUtils.sum(beDeleteRefKeys, beDeleteTokenKeys));
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public String toString() {
|
|
||||||
// return "SecureManager()";
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
@ -1,96 +0,0 @@
|
||||||
package com.bonus.canteen.core.utils;
|
|
||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
|
||||||
import com.bonus.canteen.core.common.utils.RedisUtil;
|
|
||||||
import com.bonus.canteen.core.common.utils.SpringContextHolder;
|
|
||||||
import com.bonus.canteen.core.common.utils.TenantContextHolder;
|
|
||||||
import com.bonus.common.houqin.constant.GlobalConstants;
|
|
||||||
import org.springframework.data.redis.core.RedisTemplate;
|
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
public class CustomIdGenerateUtil {
|
|
||||||
public static String generatePurchaseOrdId() {
|
|
||||||
return generateFixedRuleId("purchaseOrderId:", "CGJH", 3, 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String generateIntoId() {
|
|
||||||
return generateFixedRuleId("intoId:", "RKD", 3, 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String generateOutId() {
|
|
||||||
return generateFixedRuleId("outId:", "CKD", 3, 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String generateCheckId() {
|
|
||||||
return generateFixedRuleId("checkId:", "PDD", 3, 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String generateInquiryId() {
|
|
||||||
return generateFixedRuleId("inquiryId:", "XJD", 3, 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String generateProductionId() {
|
|
||||||
return generateFixedRuleId("productionId:", "SCJH", 3, 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String generateDeliveryGoodsId() {
|
|
||||||
return generateFixedRuleId("deliveryGoodsId:", "SHD", 3, 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String generateOrderGoodsId() {
|
|
||||||
return generateFixedRuleId("orderGoodsId:", "CGDD", 3, 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String generateMaterialInquiryId() {
|
|
||||||
return generateFixedRuleId("materialInquiryId:", "HPXJD", 3, 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String generateInspectGoodsId() {
|
|
||||||
return generateFixedRuleId("inspectGoodsId:", "YHD", 3, 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String generateRefundGoodsId() {
|
|
||||||
return generateFixedRuleId("refundGoodsId:", "THD", 3, 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String generateFetchMaterialId() {
|
|
||||||
return generateFixedRuleId("fetchMaterialId:", "LLD", 3, 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String generateGoodsAllocationId() {
|
|
||||||
return generateFixedRuleId("goodsAllocationId", "HPDB", 3, 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String generateContractId() {
|
|
||||||
return generateFixedRuleId("drpContractId:", "CGHT", 3, 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String generateAdjustmentOrderId() {
|
|
||||||
return generateFixedRuleId("drpAdjustmentOrderId:", "TJD", 3, 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String generateMarketPriceId() {
|
|
||||||
return generateFixedRuleId("drpAdjustmentOrderId:", "SCJ", 3, 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String generateFixedRuleId(String redisKey, String idPrefix, Integer randomLength, Integer length) {
|
|
||||||
Long var10000 = GlobalConstants.TENANT_ID;
|
|
||||||
redisKey = "ystKey:" + var10000 + ":" + redisKey;
|
|
||||||
Long incr = RedisUtil.getIncr(redisTemplate(), redisKey);
|
|
||||||
return idPrefix + DateUtil.format(LocalDateTime.now(), "yyyyMMdd") + getRandomDigit(randomLength) + (length <= 0 ? "" : String.format("%0" + length + "d", incr));
|
|
||||||
}
|
|
||||||
|
|
||||||
private static RedisTemplate<Object, Object> redisTemplate() {
|
|
||||||
return (RedisTemplate) SpringContextHolder.getBean("redisTemplate");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getRandomDigit(int length) {
|
|
||||||
if (length <= 0) {
|
|
||||||
return "";
|
|
||||||
} else {
|
|
||||||
int num = (int)(Math.random() * Math.pow(10.0, (double)length));
|
|
||||||
return String.format("%0" + length + "d", num);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,31 +0,0 @@
|
||||||
package com.bonus.canteen.core.utils.excel;
|
|
||||||
|
|
||||||
import com.alibaba.excel.EasyExcel;
|
|
||||||
import com.alibaba.excel.exception.ExcelDataConvertException;
|
|
||||||
import com.alibaba.excel.metadata.data.CellData;
|
|
||||||
import com.alibaba.excel.read.builder.ExcelReaderSheetBuilder;
|
|
||||||
import com.bonus.common.core.exception.ServiceException;
|
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
|
||||||
import com.bonus.canteen.core.common.config.excel.ExcelListener;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class EasyExcelUtil {
|
|
||||||
public static <T> List<T> readSingleExcel(MultipartFile excel, T t, int headRowNumber) throws Exception {
|
|
||||||
String filename = excel.getOriginalFilename();
|
|
||||||
if (filename != null && (filename.toLowerCase().endsWith(".xls") || filename.toLowerCase().endsWith(".xlsx"))) {
|
|
||||||
try {
|
|
||||||
return ((ExcelReaderSheetBuilder)EasyExcel.read(excel.getInputStream(), t.getClass(), new ExcelListener()).sheet().headRowNumber(headRowNumber)).doReadSync();
|
|
||||||
} catch (ExcelDataConvertException var8) {
|
|
||||||
int rowIndex = var8.getRowIndex();
|
|
||||||
CellData<?> cellData = var8.getCellData();
|
|
||||||
String stringValue = cellData.getStringValue();
|
|
||||||
throw new ServiceException("第" + rowIndex + "行【" + stringValue + "】数据格式错误!");
|
|
||||||
} catch (Exception var9) {
|
|
||||||
throw new ServiceException("文件读取失败,请检查重试!"+ var9.getMessage());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
throw new ServiceException("文件格式错误!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
||||||
package com.bonus.canteen.core.common.config.excel;
|
|
||||||
|
|
||||||
import com.alibaba.excel.context.AnalysisContext;
|
|
||||||
import com.alibaba.excel.event.AnalysisEventListener;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class ExcelListener extends AnalysisEventListener {
|
|
||||||
private List<Object> datas = new ArrayList();
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void invoke(Object object, AnalysisContext context) {
|
|
||||||
this.datas.add(object);
|
|
||||||
this.doSomething();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void doSomething() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void doAfterAllAnalysed(AnalysisContext context) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Object> getDatas() {
|
|
||||||
return this.datas;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDatas(List<Object> datas) {
|
|
||||||
this.datas = datas;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue