Commit ca56564e by jiang'yun

修改问题

parent ae501680
......@@ -143,6 +143,11 @@
<version>0.4.7</version>
</dependency>
<dependency>
<groupId>netpay</groupId>
<artifactId>netpay</artifactId>
<version>1.1</version>
</dependency>
<!-- <dependency>
<groupId>com.github.wechatpay-apiv3</groupId>
......
package com.qianhe.system.controller;
import CCBSign.RSASig;
import com.alibaba.fastjson.JSON;
import com.qianhe.common.utils.DateUtils;
import com.qianhe.common.utils.StringUtils;
import com.qianhe.system.domain.CCBNotifyInfo;
import com.qianhe.system.domain.WaterOrderLog;
import com.qianhe.system.mapper.WaterOrderLogMapper;
import com.qianhe.system.mapper.WaterOrderMapper;
import com.qianhe.system.utils.RSASigUtils;
import com.qianhe.system.vo.WaterOrderVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -15,6 +18,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
......@@ -37,14 +41,14 @@ public class CCBBackController {
private WaterOrderMapper orderMapper;
@PostMapping("/payNotify/")
public String pay(CCBNotifyInfo notifyInfo) {
log.info("建行回调通知参数[{}]", JSON.toJSONString(notifyInfo));
String src = "POSID=" + notifyInfo.getPOSID() + "&BRANCHID=" + notifyInfo.getBRANCHID() + "&ORDERID=" + notifyInfo.getORDERID() +
"&PAYMENT=" + notifyInfo.getPAYMENT() + "&CURCODE=" + notifyInfo.getCURCODE() + "&REMARK1=" + notifyInfo.getREMARK1() + "&REMARK2=" + notifyInfo.getREMARK2() + "&ACC_TYPE=" + notifyInfo.getACC_TYPE() +
"&SUCCESS=" + notifyInfo.getSUCCESS() + "&TYPE=" + notifyInfo.getTYPE() + "&REFERER=" + notifyInfo.getREFERER() + "&CLIENTIP=" + notifyInfo.getCLIENTIP();
if (notifyInfo.getSUCCESS().equals("Y")) {
//验签
public String pay(CCBNotifyInfo notifyInfo, HttpServletRequest request ) {
String queryString = request.getQueryString();
log.info("建行回调通知参数[{}]", queryString);
//验签
boolean b = RSASigUtils.verifySigature(queryString);
if(b){
if (notifyInfo.getSUCCESS().equals("Y")) {
// 这里需要调用建行龙支付提供的查询订单接口以保证订单确实支付成功
/* SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssX");
Date date = sdf.parse(successTime);*/
......@@ -52,7 +56,7 @@ public class CCBBackController {
orderLog.setPayNum(notifyInfo.getORDERID());
orderLog.setPayTime(DateUtils.getNowDate());
orderLog.setPayMoney(new BigDecimal(notifyInfo.getPAYMENT()));
orderLog.setBz(JSON.toJSONString(notifyInfo));
orderLog.setBz(queryString);
int iLog = orderLogMapper.insertWaterOrderLog(orderLog);
WaterOrderVo orderVo = new WaterOrderVo();
orderVo.setOrderNum(notifyInfo.getORDERID());
......@@ -61,6 +65,12 @@ public class CCBBackController {
log.info("验签通过");
return "SUCCESS";
} else {
// 验签失败
log.info("验签失败");
return "FAIL";
}
}else {
// 验签失败
log.info("验签失败");
return "FAIL";
......
......@@ -70,4 +70,13 @@ public class WaterGoods
private String totalPrice;
private String orderNo;
/** 删除状态 */
private String delFlag;
/** 商品简介 */
@Excel(name = "商品简介")
private String spjj;
//规格
private String spe;
}
......@@ -270,12 +270,13 @@ public class WaterGoodsServiceImpl implements IWaterGoodsService
for (WaterGoodsImg detailsImg : detailsImgs) {
// String inputImage = detailsImg.getUrl();
// String outputImage = detailsImg.getUrl();
String inputImage =profile + detailsImg.getUrl().replace("/profile","");
String outputImageDz = inputImage.substring(0,inputImage.lastIndexOf("/"));
Thumbnails.of(inputImage)
// 图片缩放率,不能和size()一起使用
.scale(0.7d)// 缩略图保存目录,该目录需存在,否则报错
.toFiles(new File(outputImageDz), Rename.NO_CHANGE);
// String inputImage =profile + detailsImg.getUrl().replace("/profile","");
// inputImage= inputImage.replace("/prod-api","");
// String outputImageDz = inputImage.substring(0,inputImage.lastIndexOf("/"));
// Thumbnails.of(inputImage)
// // 图片缩放率,不能和size()一起使用
// .scale(0.7d)// 缩略图保存目录,该目录需存在,否则报错
// .toFiles(new File(outputImageDz), Rename.NO_CHANGE);
// //判断图片是否是jpg或jpeg
// String hz = detailsImg.getUrl().substring(detailsImg.getUrl().lastIndexOf(".") + 1);
// if (hz.equals("jpg") || hz.equals("jpeg")){
......@@ -310,16 +311,19 @@ public class WaterGoodsServiceImpl implements IWaterGoodsService
}
public static void main(String[] args) throws IOException {
// String path = "D:\\workspace\\idea\\individual\\springboot-learn\\springboot-thumbnail\\image";
// String[] files = new String[]{
// "image/1.jpg",
// "image/2.jpg"
// };
// String path = "/prod-api/profile/upload/2024/04/10/1677026988375_20240410161337A007.jpg";
// String inputImage ="D:/ruoyi/uploadPath" + path.replace("/profile","");
// inputImage= inputImage.replace("/prod-api","");
// String outputImageDz = inputImage.substring(0,inputImage.lastIndexOf("/"));
// System.out.println(inputImage);
// System.out.println(outputImageDz);
String path = "D:\\workspace\\idea\\individual\\springboot-learn\\springboot-thumbnail\\image";
ImageThumbnailsUtil.generateDirectoryThumbnail(path);
// List<String> list = ImageUtil.generateThumbnail2Directory(path, files);
// System.out.println(list);
}
/**
* 新增封面图
* @param waterGoodsVo
......@@ -330,12 +334,13 @@ public class WaterGoodsServiceImpl implements IWaterGoodsService
//图片压缩
if (StringUtils.isNotNull(coverImgs)){
for (WaterGoodsImg coverImg : coverImgs) {
String inputImage =profile + coverImg.getUrl().replace("/profile","");
String outputImageDz = inputImage.substring(0,inputImage.lastIndexOf("/"));
Thumbnails.of(inputImage)
// 图片缩放率,不能和size()一起使用
.scale(0.7d)// 缩略图保存目录,该目录需存在,否则报错
.toFiles(new File(outputImageDz), Rename.NO_CHANGE);
// String inputImage =profile + coverImg.getUrl().replace("/profile","");
// inputImage= inputImage.replace("/prod-api","");
// String outputImageDz = inputImage.substring(0,inputImage.lastIndexOf("/"));
// Thumbnails.of(inputImage)
// // 图片缩放率,不能和size()一起使用
// .scale(0.7d)// 缩略图保存目录,该目录需存在,否则报错
// .toFiles(new File(outputImageDz), Rename.NO_CHANGE);
//旋转图片
// 旋转180度
// ImgUtil.rotate(ImageIO.read(FileUtil.file(outputImageDz)), 180);
......
......@@ -358,7 +358,8 @@ public class WaterOrderServiceImpl implements IWaterOrderService
WaterOrderVo waterOrderVo = new WaterOrderVo();
waterOrderVo.setStationId(stationId);
waterOrderVo.setCreateTime(DateUtils.getNowDate());
return waterOrderMapper.getOrderNumByStation1(waterOrderVo);
Map<String, Integer> orderNumByStation1 = waterOrderMapper.getOrderNumByStation1(waterOrderVo);
return orderNumByStation1;
}
/**
......
package com.qianhe.system.utils;
import com.idrsolutions.image.png.PngCompressor;
import net.coobird.thumbnailator.Thumbnails;
import net.coobird.thumbnailator.name.Rename;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.io.*;
import java.util.ArrayList;
import java.util.List;
/**
* 图片压缩工具
......@@ -66,4 +70,122 @@ public class ImageThumbnailsUtil {
// 图片默认缩放比率
private static final double DEFAULT_SCALE = 0.8d;
// 缩略图后缀
private static final String SUFFIX = "-thumbnail";
/**
* 生成缩略图到指定的目录
*
* @param path 目录
* @param files 要生成缩略图的文件列表
* @throws IOException
*/
public static List<String> generateThumbnail2Directory(String path, String... files) throws IOException {
return generateThumbnail2Directory(DEFAULT_SCALE, path, files);
}
/**
* 生成缩略图到指定的目录
*
* @param scale 图片缩放率
* @param pathname 缩略图保存目录
* @param files 要生成缩略图的文件列表
* @throws IOException
*/
public static List<String> generateThumbnail2Directory(double scale, String pathname, String... files) throws IOException {
Thumbnails.of(files)
// 图片缩放率,不能和size()一起使用
.scale(scale)
// 缩略图保存目录,该目录需存在,否则报错
.toFiles(new File(pathname), Rename.NO_CHANGE);
List<String> list = new ArrayList<>(files.length);
for (String file : files) {
list.add(appendSuffix(file, SUFFIX));
}
return list;
}
/**
* 将指定目录下所有图片生成缩略图
*
* @param pathname 文件目录
*/
public static void generateDirectoryThumbnail(String pathname) throws IOException {
generateDirectoryThumbnail(pathname, DEFAULT_SCALE);
}
/**
* 将指定目录下所有图片生成缩略图
*
* @param pathname 文件目录
*/
public static void generateDirectoryThumbnail(String pathname, double scale) throws IOException {
File[] files = new File(pathname).listFiles();
compressRecurse(files, pathname);
}
/**
* 文件追加后缀
*
* @param fileName 原文件名
* @param suffix 文件后缀
* @return
*/
public static String appendSuffix(String fileName, String suffix) {
String newFileName = "";
int indexOfDot = fileName.lastIndexOf('.');
if (indexOfDot != -1) {
newFileName = fileName.substring(0, indexOfDot);
newFileName += suffix;
newFileName += fileName.substring(indexOfDot);
} else {
newFileName = fileName + suffix;
}
return newFileName;
}
private static void compressRecurse(File[] files, String pathname) throws IOException {
for (File file : files) {
// 目录
if (file.isDirectory()) {
File[] subFiles = file.listFiles();
compressRecurse(subFiles, pathname + File.separator + file.getName());
} else {
// 文件包含压缩文件后缀或非图片格式,则不再压缩
String extension = getFileExtention(file.getName());
if (!file.getName().contains(SUFFIX) && isImage(extension)) {
generateThumbnail2Directory(pathname, file.getAbsolutePath());
}
}
}
}
/**
* 根据文件扩展名判断文件是否图片格式
*
* @param extension 文件扩展名
* @return
*/
public static boolean isImage(String extension) {
String[] imageExtension = new String[]{"jpeg", "jpg", "gif", "bmp", "png"};
for (String e : imageExtension) if (extension.toLowerCase().equals(e)) return true;
return false;
}
public static String getFileExtention(String fileName) {
String extension = fileName.substring(fileName.lastIndexOf(".") + 1);
return extension;
}
}
package com.qianhe.system.utils;
import CCBSign.RSASig;
/**
* 建行验签
*/
public class RSASigUtils {
/**
*
* @param queryString 建行返回的完整参数路径
* @return
*/
public static boolean verifySigature(String queryString){
//POSID=081113098&BRANCHID=370000000&ORDERID=202404090007XDCM&PAYMENT=0.01&CURCODE=01&REMARK1=&REMARK2=&ACC_TYPE=WX&SUCCESS=Y&ACCDATE=20240409&SIGN=48e8498a505b605c9e661b4fc85a90cd86410b52d01d730709d59a1645f8c4c6d0b2ae4c2c44ebcfc95f7510ad7ce1507fb685401a1724b66031de55398a797c4d871be305334ed52cffac985ab335597d1b2bfbdd3852b479cba41f75f2fd7ddd6339fc8e02aeea5c8a216eb3e47177b517bc017f1a268bb785348b4cb5caf9
String src =queryString.substring(0,queryString.lastIndexOf("&SIGN"));
String SIGN=queryString.substring(queryString.lastIndexOf("&SIGN=")+6);
//验签
//商户公钥
String gy="30819c300d06092a864886f70d010101050003818a0030818602818064e273bd425d22649fff218f6e8a767dd33c5606268201e171edcf51fcca9ea97666c0abd37cb366b87014729328644b831574ea74a622133c38896e5c75c9b836cdeb6bf0ce6b6f5de4e5a36053d6da33018e08c296fc121bfa916272ef305c5ad075cf01053bbb39328ef990834b7882e026f8c2660ff6f7c5d64570352f21020111";
RSASig rsaSig=new RSASig();
rsaSig.setPublicKey(gy);
// 参数:SIGN 建行返回的签名
// src 签名前的源串,例如:POSID=000000&BRANCHID=110000000&ORDERID=
// 00320995&PAYMENT=0.01&CURCODE=01&REMARK1=test1&REMARK2=test2&SUCCESS=Y
return rsaSig.verifySigature(SIGN, src);
}
}
......@@ -73,6 +73,9 @@ public class WaterGoodsVo {
@Excel(name = "状态", readConverterExp = "1=上架0下架")
private Integer status;
private String spjj;
private String spe;
/** 封面图集合 */
private List<WaterGoodsImg> coverImgs;
......
......@@ -48,4 +48,6 @@ public class WaterStationUserVo {
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
private String isOpen;
}
......@@ -16,10 +16,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="createUser" column="create_user" />
<result property="createTime" column="create_time" />
<result property="status" column="status" />
<result property="delFlag" column="del_flag" />
<result property="spjj" column="spjj" />
<result property="spe" column="spe" />
</resultMap>
<sql id="selectWaterGoodsVo">
select distinct a.id id, title, goods_type_id, belong_station_id, cover_img, details_img, c.price, volume, a.create_user, a.create_time, status
select distinct a.id id, title, goods_type_id, belong_station_id, cover_img, details_img, c.price, volume, a.create_user, a.create_time, status,a.spjj, c.spe
from
water_goods a
left join
......@@ -52,6 +55,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="price != null and price != ''"> and price = #{price}</if>
<if test="volume != null and volume != ''"> and volume = #{volume}</if>
<if test="status != null "> and status = #{status}</if>
<if test="spjj != null and spjj != ''"> and a.spjj = #{spjj}</if>
</where>
order by create_time DESC
</select>
......@@ -107,6 +111,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createUser != null">create_user,</if>
<if test="createTime != null">create_time,</if>
<if test="status != null">status,</if>
<if test="spjj != null">spjj,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="title != null">#{title},</if>
......@@ -119,6 +124,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createUser != null">#{createUser},</if>
<if test="createTime != null">#{createTime},</if>
<if test="status != null">#{status},</if>
<if test="spjj != null">#{spjj},</if>
</trim>
</insert>
......@@ -135,6 +141,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createUser != null">create_user = #{createUser},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="status != null">status = #{status},</if>
<if test="spjj != null">spjj = #{spjj},</if>
</trim>
where id = #{id}
</update>
......
......@@ -63,7 +63,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="orderNum != null and orderNum != ''"> and order_num like concat('%', #{orderNum}, '%')</if>
<if test="userId != null "> and user_id = #{userId}</if>
<if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
<if test="userPhone != null "> and user_phone = #{userPhone}</if>
<if test="userPhone != null "> and user_phone like concat('%', #{userPhone}, '%') </if>
<if test="userProvince != null and userProvince != ''"> and user_province = #{userProvince}</if>
<if test="userCity != null and userCity != ''"> and user_city = #{userCity}</if>
<if test="userArea != null and userArea != ''"> and user_area = #{userArea}</if>
......
......@@ -30,7 +30,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<where>
del_flag = '0'
<if test="stationName != null and stationName != ''"> and station_name like concat('%', #{stationName}, '%')</if>
<if test="phoneNum != null "> and phone_num = #{phoneNum}</if>
<if test="phoneNum != null "> and phone_num like concat('%', #{phoneNum}, '%')</if>
<if test="stationAddress != null and stationAddress != ''"> and station_address = #{stationAddress}</if>
<!-- <if test="stationLon != null "> and station_lon = #{stationLon}</if>
<if test="stationLat != null "> and station_lat = #{stationLat}</if>-->
......
......@@ -15,10 +15,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="stationName" column="station_name" />
<result property="createTime" column="create_time" />
<result property="createUser" column="create_user" />
<result property="isOpen" column="is_open" />
</resultMap>
<sql id="selectWaterStationUserVo">
select id, name, age, gender, phone, id_num, station_id, create_time, create_user from water_station_user
select a.id, name, age, gender, phone, id_num, station_id, a.create_time, a.create_user,b.is_open from water_station_user a left join water_station b on a.station_id=b.id
</sql>
<select id="selectWaterStationUserList" parameterType="WaterStationUser" resultMap="WaterStationUserResult">
......@@ -29,7 +30,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="name != null and name != ''"> and su.name like concat('%', #{name}, '%')</if>
<if test="age != null "> and su.age = #{age}</if>
<if test="gender != null "> and su.gender = #{gender}</if>
<if test="phone != null "> and su.phone = #{phone}</if>
<if test="phone != null "> and su.phone like concat('%', #{phone}, '%') </if>
<if test="idNum != null and idNum != ''"> and su.id_num = #{idNum}</if>
<if test="stationId != null "> and su.station_id = #{stationId}</if>
<if test="createUser != null and createUser != ''"> and su.create_user = #{createUser}</if>
......@@ -45,8 +46,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectWaterStationUserByPhone" parameterType="Long" resultMap="WaterStationUserResult">
<include refid="selectWaterStationUserVo"/>
where phone = #{phone}
and del_flag = '0'
where a.phone = #{phone}
and a.del_flag = '0'
</select>
<insert id="insertWaterStationUser" parameterType="WaterStationUser" useGeneratedKeys="true" keyProperty="id">
......
......@@ -19,7 +19,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectWaterTextVo"/>
<where>
del_flag = '0'
<if test="title != null and title != ''"> and title = #{title}</if>
<if test="title != null and title != ''"> and title like concat('%', #{title}, '%') </if>
<if test="content != null and content != ''"> and content = #{content}</if>
</where>
order by create_time DESC
......
......@@ -25,7 +25,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<where>
status != 1
<if test="nickName != null and nickName != ''"> and nick_name like concat('%', #{nickName}, '%')</if>
<if test="phoneNum != null "> and phone_num = #{phoneNum}</if>
<if test="phoneNum != null "> and phone_num like concat('%', #{phoneNum}, '%') </if>
<if test="stationName != null and stationName != ''"> and station_name like concat('%', #{stationName}, '%')</if>
<if test="userType != null and userType != ''"> and user_type = #{userType}</if>
<if test="userGender != null "> and user_gender = #{userGender}</if>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment