mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-05-03 01:20:15 +08:00
update 默认分隔符
This commit is contained in:
@@ -787,7 +787,7 @@ public class OrderService {
|
||||
// 排除掉已经申请过的订单
|
||||
List<String> orderCodeList = orderInvoiceRecords.stream() // 转化为 Stream
|
||||
.map(OrderInvoiceRecord::getOrderCodes) // 获取 OrderInvoiceRecord 中的 orderCodes 字符串
|
||||
.flatMap(str -> Arrays.stream(str.split(","))) // 分隔逗号并转化为 Stream
|
||||
.flatMap(str -> Arrays.stream(str.split(Constants.DEFAULT_DELIMITER))) // 分隔逗号并转化为 Stream
|
||||
.collect(Collectors.toList()); // 收集为 List<String>
|
||||
|
||||
orderList = orderList.stream()
|
||||
@@ -813,7 +813,7 @@ public class OrderService {
|
||||
List<OrderInvoiceRecord> orderInvoiceRecords = orderInvoiceRecordService.selectInvoiceRecordList(dto.getMemberId(), dateTime, LocalDateTime.now());
|
||||
List<String> orderCodeList = orderInvoiceRecords.stream() // 转化为 Stream
|
||||
.map(OrderInvoiceRecord::getOrderCodes) // 获取 OrderInvoiceRecord 中的 orderCodes 字符串
|
||||
.flatMap(str -> Arrays.stream(str.split(","))) // 分隔逗号并转化为 Stream
|
||||
.flatMap(str -> Arrays.stream(str.split(Constants.DEFAULT_DELIMITER))) // 分隔逗号并转化为 Stream
|
||||
.collect(Collectors.toList()); // 收集为 List<String>
|
||||
|
||||
// 取交集 校验订单是否已经开票
|
||||
@@ -823,19 +823,9 @@ public class OrderService {
|
||||
return;
|
||||
}
|
||||
|
||||
// 整理数据
|
||||
List<OrderVO> orderVOList = orderBasicInfoService.getListByOrderCodes(dto.getOrderCodes());
|
||||
BigDecimal totalAmount = BigDecimal.ZERO;
|
||||
BigDecimal totalElecAmount = BigDecimal.ZERO;
|
||||
BigDecimal totalServiceAmount = BigDecimal.ZERO;
|
||||
for (OrderVO orderVO : orderVOList) {
|
||||
totalAmount = totalAmount.add(orderVO.getOrderAmount());
|
||||
totalElecAmount = totalElecAmount.add(orderVO.getTotalElectricityAmount());
|
||||
totalServiceAmount = totalServiceAmount.add(orderVO.getTotalServiceAmount());
|
||||
}
|
||||
|
||||
// 查抬头信息
|
||||
MemberInvoiceTitle invoiceTitle = memberInvoiceTitleService.selectMemberInvoiceTitleById(Long.parseLong(dto.getTitleId()));
|
||||
|
||||
if (StringUtils.isNotEmpty(dto.getReception())) {
|
||||
boolean b = false;
|
||||
if (StringUtils.isEmail(dto.getReception()) && !StringUtils.equals(dto.getReception(), invoiceTitle.getEmail())) {
|
||||
@@ -851,16 +841,38 @@ public class OrderService {
|
||||
}
|
||||
}
|
||||
|
||||
// 入库
|
||||
OrderInvoiceRecord orderInvoiceRecord = new OrderInvoiceRecord();
|
||||
orderInvoiceRecord.setStatus("0");
|
||||
orderInvoiceRecord.setMemberId(dto.getMemberId());
|
||||
orderInvoiceRecord.setTitleId(dto.getTitleId());
|
||||
orderInvoiceRecord.setOrderCodes(String.join(",", dto.getOrderCodes()));
|
||||
orderInvoiceRecord.setTotalAmount(totalAmount);
|
||||
orderInvoiceRecord.setTotalElecAmount(totalElecAmount);
|
||||
orderInvoiceRecord.setTotalServiceAmount(totalServiceAmount);
|
||||
orderInvoiceRecordService.insertOrderInvoiceRecord(orderInvoiceRecord);
|
||||
// 整理数据
|
||||
List<OrderVO> orderVOList = orderBasicInfoService.getListByOrderCodes(dto.getOrderCodes());
|
||||
|
||||
// 根据运营商分组
|
||||
Map<String, List<OrderVO>> map = orderVOList.stream().collect(Collectors.groupingBy(OrderVO::getMerchantId));
|
||||
|
||||
BigDecimal totalAmount = null;
|
||||
BigDecimal totalElecAmount = null;
|
||||
BigDecimal totalServiceAmount = null;
|
||||
// 根据运营商创建多笔开票记录
|
||||
for (Map.Entry<String, List<OrderVO>> entry : map.entrySet()) {
|
||||
totalAmount = BigDecimal.ZERO;
|
||||
totalElecAmount = BigDecimal.ZERO;
|
||||
totalServiceAmount = BigDecimal.ZERO;
|
||||
List<OrderVO> orders = entry.getValue();
|
||||
for (OrderVO orderVO : orders) {
|
||||
totalAmount = totalAmount.add(orderVO.getOrderAmount());
|
||||
totalElecAmount = totalElecAmount.add(orderVO.getTotalElectricityAmount());
|
||||
totalServiceAmount = totalServiceAmount.add(orderVO.getTotalServiceAmount());
|
||||
}
|
||||
|
||||
// 入库
|
||||
OrderInvoiceRecord orderInvoiceRecord = new OrderInvoiceRecord();
|
||||
orderInvoiceRecord.setStatus(Constants.ZERO);
|
||||
orderInvoiceRecord.setMemberId(dto.getMemberId());
|
||||
orderInvoiceRecord.setTitleId(dto.getTitleId());
|
||||
orderInvoiceRecord.setOrderCodes(String.join(Constants.DEFAULT_DELIMITER, dto.getOrderCodes()));
|
||||
orderInvoiceRecord.setTotalAmount(totalAmount);
|
||||
orderInvoiceRecord.setTotalElecAmount(totalElecAmount);
|
||||
orderInvoiceRecord.setTotalServiceAmount(totalServiceAmount);
|
||||
orderInvoiceRecordService.insertOrderInvoiceRecord(orderInvoiceRecord);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.jsowell.web.controller.system;
|
||||
|
||||
import com.jsowell.common.annotation.Log;
|
||||
import com.jsowell.common.constant.Constants;
|
||||
import com.jsowell.common.constant.UserConstants;
|
||||
import com.jsowell.common.core.controller.BaseController;
|
||||
import com.jsowell.common.core.domain.AjaxResult;
|
||||
@@ -49,7 +50,7 @@ public class SysDeptController extends BaseController {
|
||||
while (it.hasNext()) {
|
||||
SysDept d = (SysDept) it.next();
|
||||
if (d.getDeptId().intValue() == deptId
|
||||
|| ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + "")) {
|
||||
|| ArrayUtils.contains(StringUtils.split(d.getAncestors(), Constants.DEFAULT_DELIMITER), deptId + "")) {
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,10 @@ import io.jsonwebtoken.Claims;
|
||||
* @author jsowell
|
||||
*/
|
||||
public class Constants {
|
||||
|
||||
// 默认分隔符
|
||||
public static final String DEFAULT_DELIMITER = ",";
|
||||
|
||||
// 非法交易流水号 由充电桩启动的订单会传全是0的交易流水号
|
||||
public static final String ILLEGAL_TRANSACTION_CODE = "00000000000000000000000000000000";
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.jsowell.common.core.text;
|
||||
|
||||
import com.jsowell.common.constant.Constants;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
|
||||
@@ -252,7 +253,7 @@ public class Convert {
|
||||
* @return 结果
|
||||
*/
|
||||
public static Integer[] toIntArray(String str) {
|
||||
return toIntArray(",", str);
|
||||
return toIntArray(Constants.DEFAULT_DELIMITER, str);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -262,7 +263,7 @@ public class Convert {
|
||||
* @return 结果
|
||||
*/
|
||||
public static Long[] toLongArray(String str) {
|
||||
return toLongArray(",", str);
|
||||
return toLongArray(Constants.DEFAULT_DELIMITER, str);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -312,7 +313,7 @@ public class Convert {
|
||||
* @return 结果
|
||||
*/
|
||||
public static String[] toStrArray(String str) {
|
||||
return toStrArray(",", str);
|
||||
return toStrArray(Constants.DEFAULT_DELIMITER, str);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.jsowell.common.filter;
|
||||
|
||||
import com.jsowell.common.constant.Constants;
|
||||
import com.jsowell.common.enums.HttpMethod;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
|
||||
@@ -25,7 +26,7 @@ public class XssFilter implements Filter {
|
||||
public void init(FilterConfig filterConfig) throws ServletException {
|
||||
String tempExcludes = filterConfig.getInitParameter("excludes");
|
||||
if (StringUtils.isNotEmpty(tempExcludes)) {
|
||||
String[] url = tempExcludes.split(",");
|
||||
String[] url = tempExcludes.split(Constants.DEFAULT_DELIMITER);
|
||||
for (int i = 0; url != null && i < url.length; i++) {
|
||||
excludes.add(url[i]);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.jsowell.common.util;
|
||||
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.jsowell.common.constant.CacheConstants;
|
||||
import com.jsowell.common.constant.Constants;
|
||||
import com.jsowell.common.core.domain.entity.SysDictData;
|
||||
import com.jsowell.common.core.redis.RedisCache;
|
||||
import com.jsowell.common.util.spring.SpringUtils;
|
||||
@@ -18,7 +19,7 @@ public class DictUtils {
|
||||
/**
|
||||
* 分隔符
|
||||
*/
|
||||
public static final String SEPARATOR = ",";
|
||||
public static final String SEPARATOR = Constants.DEFAULT_DELIMITER;
|
||||
|
||||
/**
|
||||
* 设置字典缓存
|
||||
|
||||
@@ -69,7 +69,7 @@ public class AddressUtils {
|
||||
if (StringUtils.isBlank(areaCode) || StringUtils.isBlank(address)) {
|
||||
return null;
|
||||
}
|
||||
String[] split = StringUtils.split(areaCode, ",");
|
||||
String[] split = StringUtils.split(areaCode, Constants.DEFAULT_DELIMITER);
|
||||
String param = "key=" + AMAP_GET_LOCATION_KEY + "&city=" + split[2] + "&address=" + address;
|
||||
String resultStr = HttpUtils.sendGet(AMAP_GET_LOCATION_URL, param, Constants.UTF8);
|
||||
if (StringUtils.isNotBlank(resultStr)) {
|
||||
@@ -81,7 +81,7 @@ public class AddressUtils {
|
||||
Map<String, String> map = Maps.newHashMap();
|
||||
JSONObject jsonObject = geocodes.getJSONObject(0);
|
||||
String location = jsonObject.getString("location");
|
||||
String[] strArr = StringUtils.split(location, ",");
|
||||
String[] strArr = StringUtils.split(location, Constants.DEFAULT_DELIMITER);
|
||||
map.put("lng", strArr[0]);
|
||||
map.put("lat", strArr[1]);
|
||||
return map;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.jsowell.common.util.ip;
|
||||
|
||||
import com.jsowell.common.constant.Constants;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@@ -200,8 +201,8 @@ public class IpUtils {
|
||||
*/
|
||||
public static String getMultistageReverseProxyIp(String ip) {
|
||||
// 多级反向代理检测
|
||||
if (ip != null && ip.indexOf(",") > 0) {
|
||||
final String[] ips = ip.trim().split(",");
|
||||
if (ip != null && ip.indexOf(Constants.DEFAULT_DELIMITER) > 0) {
|
||||
final String[] ips = ip.trim().split(Constants.DEFAULT_DELIMITER);
|
||||
for (String subIp : ips) {
|
||||
if (false == isUnknown(subIp)) {
|
||||
ip = subIp;
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.jsowell.common.annotation.Excel.ColumnType;
|
||||
import com.jsowell.common.annotation.Excel.Type;
|
||||
import com.jsowell.common.annotation.Excels;
|
||||
import com.jsowell.common.config.JsowellConfig;
|
||||
import com.jsowell.common.constant.Constants;
|
||||
import com.jsowell.common.core.domain.AjaxResult;
|
||||
import com.jsowell.common.core.text.Convert;
|
||||
import com.jsowell.common.exception.UtilException;
|
||||
@@ -889,7 +890,7 @@ public class ExcelUtil<T> {
|
||||
*/
|
||||
public static String convertByExp(String propertyValue, String converterExp, String separator) {
|
||||
StringBuilder propertyString = new StringBuilder();
|
||||
String[] convertSource = converterExp.split(",");
|
||||
String[] convertSource = converterExp.split(Constants.DEFAULT_DELIMITER);
|
||||
for (String item : convertSource) {
|
||||
String[] itemArray = item.split("=");
|
||||
if (StringUtils.containsAny(propertyValue, separator)) {
|
||||
@@ -918,7 +919,7 @@ public class ExcelUtil<T> {
|
||||
*/
|
||||
public static String reverseByExp(String propertyValue, String converterExp, String separator) {
|
||||
StringBuilder propertyString = new StringBuilder();
|
||||
String[] convertSource = converterExp.split(",");
|
||||
String[] convertSource = converterExp.split(Constants.DEFAULT_DELIMITER);
|
||||
for (String item : convertSource) {
|
||||
String[] itemArray = item.split("=");
|
||||
if (StringUtils.containsAny(propertyValue, separator)) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.jsowell.framework.config;
|
||||
|
||||
import com.jsowell.common.constant.Constants;
|
||||
import com.jsowell.common.filter.RepeatableFilter;
|
||||
import com.jsowell.common.filter.XssFilter;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
@@ -33,7 +34,7 @@ public class FilterConfig {
|
||||
FilterRegistrationBean registration = new FilterRegistrationBean();
|
||||
registration.setDispatcherTypes(DispatcherType.REQUEST);
|
||||
registration.setFilter(new XssFilter());
|
||||
registration.addUrlPatterns(StringUtils.split(urlPatterns, ","));
|
||||
registration.addUrlPatterns(StringUtils.split(urlPatterns, Constants.DEFAULT_DELIMITER));
|
||||
registration.setName("xssFilter");
|
||||
registration.setOrder(FilterRegistrationBean.HIGHEST_PRECEDENCE);
|
||||
Map<String, String> initParameters = new HashMap<String, String>();
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.jsowell.framework.config;
|
||||
|
||||
import com.google.code.kaptcha.text.impl.DefaultTextCreator;
|
||||
import com.jsowell.common.constant.Constants;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
@@ -10,7 +11,7 @@ import java.util.Random;
|
||||
* @author jsowell
|
||||
*/
|
||||
public class KaptchaTextCreator extends DefaultTextCreator {
|
||||
private static final String[] CNUMBERS = "0,1,2,3,4,5,6,7,8,9,10".split(",");
|
||||
private static final String[] CNUMBERS = "0,1,2,3,4,5,6,7,8,9,10".split(Constants.DEFAULT_DELIMITER);
|
||||
|
||||
@Override
|
||||
public String getText() {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.jsowell.framework.config;
|
||||
|
||||
import com.jsowell.common.constant.Constants;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import org.apache.ibatis.io.VFS;
|
||||
import org.apache.ibatis.session.SqlSessionFactory;
|
||||
@@ -42,7 +43,7 @@ public class MyBatisConfig {
|
||||
MetadataReaderFactory metadataReaderFactory = new CachingMetadataReaderFactory(resolver);
|
||||
List<String> allResult = new ArrayList<String>();
|
||||
try {
|
||||
for (String aliasesPackage : typeAliasesPackage.split(",")) {
|
||||
for (String aliasesPackage : typeAliasesPackage.split(Constants.DEFAULT_DELIMITER)) {
|
||||
List<String> result = new ArrayList<String>();
|
||||
aliasesPackage = ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX
|
||||
+ ClassUtils.convertClassNameToResourcePath(aliasesPackage.trim()) + "/" + DEFAULT_RESOURCE_PATTERN;
|
||||
@@ -66,7 +67,7 @@ public class MyBatisConfig {
|
||||
}
|
||||
}
|
||||
if (allResult.size() > 0) {
|
||||
typeAliasesPackage = String.join(",", (String[]) allResult.toArray(new String[0]));
|
||||
typeAliasesPackage = String.join(Constants.DEFAULT_DELIMITER, (String[]) allResult.toArray(new String[0]));
|
||||
} else {
|
||||
throw new RuntimeException("mybatis typeAliasesPackage 路径扫描错误,参数typeAliasesPackage:" + typeAliasesPackage + "未找到任何包");
|
||||
}
|
||||
@@ -103,7 +104,7 @@ public class MyBatisConfig {
|
||||
final SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean();
|
||||
sessionFactory.setDataSource(dataSource);
|
||||
sessionFactory.setTypeAliasesPackage(typeAliasesPackage);
|
||||
sessionFactory.setMapperLocations(resolveMapperLocations(StringUtils.split(mapperLocations, ",")));
|
||||
sessionFactory.setMapperLocations(resolveMapperLocations(StringUtils.split(mapperLocations, Constants.DEFAULT_DELIMITER)));
|
||||
sessionFactory.setConfigLocation(new DefaultResourceLoader().getResource(configLocation));
|
||||
return sessionFactory.getObject();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.jsowell.generator.util;
|
||||
|
||||
import com.jsowell.common.constant.Constants;
|
||||
import com.jsowell.common.constant.GenConstants;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.generator.config.GenConfig;
|
||||
@@ -156,7 +157,7 @@ public class GenUtils {
|
||||
boolean autoRemovePre = GenConfig.getAutoRemovePre();
|
||||
String tablePrefix = GenConfig.getTablePrefix();
|
||||
if (autoRemovePre && StringUtils.isNotEmpty(tablePrefix)) {
|
||||
String[] searchList = StringUtils.split(tablePrefix, ",");
|
||||
String[] searchList = StringUtils.split(tablePrefix, Constants.DEFAULT_DELIMITER);
|
||||
tableName = replaceFirst(tableName, searchList);
|
||||
}
|
||||
return StringUtils.convertToCamelCase(tableName);
|
||||
|
||||
Reference in New Issue
Block a user