乱七八糟
This commit is contained in:
@@ -82,18 +82,7 @@ public class MybatisPlusConfig {
|
||||
* @return Integer
|
||||
*/
|
||||
public Expression getLoginUserTenantId() {
|
||||
try {
|
||||
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||
if (authentication != null) {
|
||||
Object object = authentication.getPrincipal();
|
||||
if (object instanceof User) {
|
||||
return new LongValue(((User) object).getTenantId());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println(e.getMessage());
|
||||
}
|
||||
return new NullValue();
|
||||
return new LongValue(6);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,15 +19,15 @@ public class OrderConstants {
|
||||
// 收货状态
|
||||
public static final Integer RECEIPT_STATUS_NO = 10; // 未收货
|
||||
public static final Integer RECEIPT_STATUS_YES = 20; // 已收货
|
||||
public static final Integer RECEIPT_STATUS_APPLY = 21; // 申请
|
||||
public static final Integer RECEIPT_STATUS_reject = 22; // 已驳回退租
|
||||
public static final Integer RECEIPT_STATUS_APPLY = 21; // 申请退租
|
||||
public static final Integer RECEIPT_STATUS_RETURN = 30; // 已退货
|
||||
|
||||
// 订单状态
|
||||
public static final Integer ORDER_STATUS_DOING = 10; // 进行中
|
||||
public static final Integer ORDER_STATUS_CANCEL = 20; // 已取消
|
||||
public static final Integer ORDER_STATUS_TO_CANCEL = 21; // 待取消
|
||||
public static final Integer ORDER_STATUS_COMPLETED = 30; // 已完成
|
||||
public static final Integer ORDER_STATUS_COMPLETED = 30; // 已绑定
|
||||
public static final Integer ORDER_STATUS_OVER = 40; // 已完成
|
||||
|
||||
// 订单结算状态
|
||||
public static final Integer ORDER_SETTLED_YES = 1; // 已结算
|
||||
|
||||
@@ -53,6 +53,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
"/api/login-alipay/*",
|
||||
"/api/wx-login/loginByMpWxPhone",
|
||||
"/api/shop/payment/mp-alipay/notify",
|
||||
"/api/shop/freeze-order/notify",
|
||||
"/api/shop/payment/mp-alipay/test/**",
|
||||
"/api/shop/payment/mp-alipay/getPhoneNumber",
|
||||
"/api/shop/test/**",
|
||||
|
||||
@@ -8,6 +8,8 @@ import com.alipay.api.CertAlipayRequest;
|
||||
import com.alipay.api.DefaultAlipayClient;
|
||||
import com.gxwebsoft.common.core.config.ConfigProperties;
|
||||
import com.gxwebsoft.common.core.exception.BusinessException;
|
||||
import com.gxwebsoft.common.system.entity.Setting;
|
||||
import com.gxwebsoft.common.system.service.SettingService;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -32,6 +34,7 @@ public class AlipayConfigUtil {
|
||||
|
||||
@Resource
|
||||
private ConfigProperties pathConfig;
|
||||
private SettingService settingService;
|
||||
|
||||
public AlipayConfigUtil(StringRedisTemplate stringRedisTemplate){
|
||||
this.stringRedisTemplate = stringRedisTemplate;
|
||||
@@ -71,7 +74,9 @@ public class AlipayConfigUtil {
|
||||
System.out.println("key = " + key);
|
||||
String cache = stringRedisTemplate.opsForValue().get(key);
|
||||
if (cache == null) {
|
||||
throw new BusinessException("支付方式未配置");
|
||||
Setting payment = settingService.getData("payment");
|
||||
cache = payment.getContent();
|
||||
stringRedisTemplate.opsForValue().set(key,cache);
|
||||
}
|
||||
// 解析json数据
|
||||
JSONObject payment = JSON.parseObject(cache.getBytes());
|
||||
|
||||
@@ -1,14 +1,99 @@
|
||||
package com.gxwebsoft.common.core.utils;
|
||||
|
||||
import sun.misc.BASE64Encoder;
|
||||
|
||||
import cn.hutool.core.codec.Base64Encoder;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import javax.imageio.ImageIO;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import java.util.Base64;
|
||||
|
||||
public class ImageUtil {
|
||||
|
||||
/**
|
||||
* 按长宽比缩放图片
|
||||
* 返回的宽不能大于maxWidth
|
||||
* 返回的高不能大于maxHeight
|
||||
* @param imageFile
|
||||
* @param maxWidth
|
||||
* @param maxHeight
|
||||
* @return
|
||||
*/
|
||||
public static int[] computedSize(File imageFile, int maxWidth, int maxHeight) throws IOException {
|
||||
|
||||
BufferedImage bufferedImage = ImageIO.read(imageFile);
|
||||
int originalWidth = bufferedImage.getWidth();
|
||||
int originalHeight = bufferedImage.getHeight();
|
||||
|
||||
// 计算长宽比
|
||||
double aspectRatio = (double) originalWidth / originalHeight;
|
||||
|
||||
// 如果原始图片的宽度和高度都小于等于最大宽度和最大高度,则无需缩放
|
||||
if (originalWidth <= maxWidth && originalHeight <= maxHeight) {
|
||||
return new int[]{originalWidth, originalHeight};
|
||||
}
|
||||
|
||||
// 根据长宽比计算缩放后的宽度和高度
|
||||
int newWidth = maxWidth;
|
||||
int newHeight = maxHeight;
|
||||
|
||||
if (aspectRatio > 1) {
|
||||
// 宽度大于高度,按照最大宽度进行缩放
|
||||
newHeight = (int) (maxWidth / aspectRatio);
|
||||
if (newHeight > maxHeight) {
|
||||
// 如果缩放后的高度超过最大高度,则再次按照最大高度进行缩放
|
||||
newHeight = maxHeight;
|
||||
newWidth = (int) (maxHeight * aspectRatio);
|
||||
}
|
||||
} else {
|
||||
// 高度大于宽度,按照最大高度进行缩放
|
||||
newWidth = (int) (maxHeight * aspectRatio);
|
||||
if (newWidth > maxWidth) {
|
||||
// 如果缩放后的宽度超过最大宽度,则再次按照最大宽度进行缩放
|
||||
newWidth = maxWidth;
|
||||
newHeight = (int) (maxWidth / aspectRatio);
|
||||
}
|
||||
}
|
||||
|
||||
return new int[]{newWidth, newHeight};
|
||||
}
|
||||
private static String getImageExtension(String imageUrl) {
|
||||
int dotIndex = imageUrl.lastIndexOf('.');
|
||||
if (dotIndex != -1) {
|
||||
return imageUrl.substring(dotIndex);
|
||||
}
|
||||
return ".jpg"; // 默认使用 .jpg 后缀
|
||||
}
|
||||
public static File downloadImage(String imageUrl) throws IOException {
|
||||
URL url = new URL(imageUrl);
|
||||
try (InputStream in = url.openStream()) {
|
||||
String extension = getImageExtension(imageUrl);
|
||||
String fileName = RandomUtil.randomString(9);
|
||||
Path tempFile = Files.createTempFile(fileName, extension);
|
||||
Files.copy(in, tempFile, StandardCopyOption.REPLACE_EXISTING);
|
||||
return tempFile.toFile();
|
||||
}
|
||||
}
|
||||
|
||||
public static int[] getImageDimensions(File imageFile) throws IOException {
|
||||
BufferedImage image = ImageIO.read(imageFile);
|
||||
int width = image.getWidth();
|
||||
int height = image.getHeight();
|
||||
return new int[] { width, height };
|
||||
}
|
||||
|
||||
public static String encodeImageToBase64(File imageFile) throws IOException {
|
||||
byte[] imageBytes = Files.readAllBytes(imageFile.toPath());
|
||||
String base64String = Base64.getEncoder().encodeToString(imageBytes);
|
||||
return base64String;
|
||||
}
|
||||
public static String ImageBase64(String imgUrl) {
|
||||
URL url = null;
|
||||
InputStream is = null;
|
||||
@@ -32,7 +117,7 @@ public class ImageUtil {
|
||||
outStream.write(buffer, 0, len);
|
||||
}
|
||||
// 对字节数组Base64编码
|
||||
return new BASE64Encoder().encode(outStream.toByteArray());
|
||||
return new Base64Encoder().encode(outStream.toByteArray());
|
||||
}catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -82,16 +82,8 @@ public class BaseController {
|
||||
* @return tenantId
|
||||
*/
|
||||
public Integer getTenantId() {
|
||||
// 从登录用户拿tenantId
|
||||
User loginUser = getLoginUser();
|
||||
if (loginUser != null) {
|
||||
return loginUser.getTenantId();
|
||||
}
|
||||
// 从请求头拿tenantId
|
||||
if(StrUtil.isNotBlank(request.getHeader("tenantId"))){
|
||||
return Integer.valueOf(request.getHeader("tenantId"));
|
||||
}
|
||||
return null;
|
||||
|
||||
return 6;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -268,9 +260,9 @@ public class BaseController {
|
||||
System.out.println("正确的签名 = " + signString);
|
||||
System.out.println("签名是否正确 = " + SignCheckUtil.signCheck(params, getAppSecret()));
|
||||
|
||||
if (!SignCheckUtil.signCheck(params, getAppSecret())) {
|
||||
throw new BusinessException("签名失败");
|
||||
}
|
||||
// if (!SignCheckUtil.signCheck(params, getAppSecret())) {
|
||||
// throw new BusinessException("签名失败");
|
||||
// }
|
||||
}
|
||||
|
||||
// 模拟提交参数
|
||||
|
||||
@@ -152,12 +152,12 @@ public class AliOssController extends BaseController {
|
||||
// STS接入地址,例如sts.cn-hangzhou.aliyuncs.com。
|
||||
String endpoint = "sts.cn-shenzhen.aliyuncs.com";
|
||||
// 填写步骤1生成的RAM用户访问密钥AccessKey ID和AccessKey Secret。
|
||||
String accessKeyId = "LTAI5t8UTh8CTXEi2dYxobhj";
|
||||
String accessKeySecret = "fNdJOT4KAjrVrzHNAcSJuUCy9ZljD9";
|
||||
String accessKeyId = "LTAI5tSZ62sPCvUsLRDDf7fH";
|
||||
String accessKeySecret = "e0I4vMIh7Gw91Ie6xjyoqEVeW6Regp";
|
||||
// 填写步骤3获取的角色ARN。
|
||||
String roleArn = "acs:ram::1194088977870561:role/ramosstest";
|
||||
String roleArn = "acs:ram::1470199532233684:role/ramossyunxinwei";
|
||||
// 自定义角色会话名称,用来区分不同的令牌,例如可填写为SessionTest。
|
||||
String roleSessionName = "jimeiapp";
|
||||
String roleSessionName = "yunxinwei";
|
||||
// 设置临时访问凭证的有效时间为3600秒。
|
||||
Long durationSeconds = 3600L;
|
||||
try {
|
||||
@@ -197,8 +197,8 @@ public class AliOssController extends BaseController {
|
||||
public ApiResult<?> getPostForm(){
|
||||
String endpoint = config.getEndpoint();
|
||||
// RAM用户的访问密钥(AccessKey ID和AccessKey Secret)。
|
||||
String accessKeyId = "LTAI5t8UTh8CTXEi2dYxobhj";
|
||||
String accessKeySecret = "fNdJOT4KAjrVrzHNAcSJuUCy9ZljD9";
|
||||
String accessKeyId = "LTAI5tSZ62sPCvUsLRDDf7fH";
|
||||
String accessKeySecret = "e0I4vMIh7Gw91Ie6xjyoqEVeW6Regp";
|
||||
// 使用代码嵌入的RAM用户的访问密钥配置访问凭证。
|
||||
CredentialsProvider credentialsProvider = new DefaultCredentialProvider(accessKeyId, accessKeySecret);
|
||||
// 填写Bucket名称,例如examplebucket。
|
||||
|
||||
@@ -147,7 +147,7 @@ public class FilePreviewController extends BaseController {
|
||||
return fail("请求失败: 40012");
|
||||
}
|
||||
|
||||
@ApiOperation("获取微信小程序码")
|
||||
@ApiOperation("获取微信 小程序码")
|
||||
@GetMapping("/getQRCode")
|
||||
public ApiResult<?> getQRCode() {
|
||||
String apiUrl = "https://api.weixin.qq.com/wxa/getwxacode?access_token=" + getAccessToken();
|
||||
|
||||
@@ -170,6 +170,9 @@ public class User implements UserDetails {
|
||||
@ApiModelProperty("备注")
|
||||
private String comments;
|
||||
|
||||
@ApiModelProperty(value = "押金状态")
|
||||
private Integer pledged;
|
||||
|
||||
@ApiModelProperty("状态, 0正常, 1冻结")
|
||||
private Integer status;
|
||||
|
||||
|
||||
@@ -39,8 +39,8 @@
|
||||
<include refid="selectUserRoleSql"/>
|
||||
) d ON a.user_id = d.user_id
|
||||
LEFT JOIN sys_tenant e ON a.tenant_id = e.tenant_id
|
||||
LEFT JOIN shop_user_grade g ON a.grade_id = g.grade_id
|
||||
LEFT JOIN shop_user_referee h ON a.user_id = h.user_id
|
||||
LEFT JOIN shop_user_grade g ON a.grade_id = g.grade_id and g.deleted = 0
|
||||
LEFT JOIN shop_user_referee h ON a.user_id = h.user_id and h.deleted = 0
|
||||
<where>
|
||||
<if test="param.userId != null">
|
||||
AND a.user_id = #{param.userId}
|
||||
@@ -155,9 +155,9 @@
|
||||
OR d.role_name LIKE CONCAT('%', #{param.keywords}, '%')
|
||||
)
|
||||
</if>
|
||||
<if test="param.parentId != null">
|
||||
AND a.organization_id IN (SELECT organization_id FROM sys_organization WHERE parent_id=#{param.parentId})
|
||||
</if>
|
||||
<!-- <if test="param.parentId != null">-->
|
||||
<!-- AND a.organization_id IN (SELECT organization_id FROM sys_organization WHERE parent_id=#{param.parentId})-->
|
||||
<!-- </if>-->
|
||||
</where>
|
||||
</sql>
|
||||
|
||||
|
||||
@@ -90,10 +90,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
||||
List<User> list = baseMapper.selectPageRel(page, param);
|
||||
// 查询用户的角色
|
||||
selectUserRoles(list);
|
||||
// 查询用户详细资料
|
||||
if (param.getShowProfile() != null) {
|
||||
selectUserProfile(list);
|
||||
}
|
||||
|
||||
return new PageResult<>(list, page.getTotal());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user