Commit ae501680 by jiang'yun

修改问题

parent da067a6b
package com.qianhe.system.controller;
import com.alibaba.fastjson.JSON;
import com.qianhe.common.utils.DateUtils;
import com.qianhe.system.domain.CCBNotifyInfo;
import com.qianhe.system.domain.WaterOrderLog;
import com.qianhe.system.mapper.WaterOrderLogMapper;
......@@ -8,6 +9,7 @@ import com.qianhe.system.mapper.WaterOrderMapper;
import com.qianhe.system.vo.WaterOrderVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
......@@ -41,16 +43,20 @@ public class CCBBackController {
"&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")) {
//验签
// 这里需要调用建行龙支付提供的查询订单接口以保证订单确实支付成功
/* SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssX");
Date date = sdf.parse(successTime);*/
WaterOrderLog orderLog = new WaterOrderLog();
orderLog.setPayNum(notifyInfo.getORDERID());
//orderLog.setPayTime(date);
orderLog.setPayTime(DateUtils.getNowDate());
orderLog.setPayMoney(new BigDecimal(notifyInfo.getPAYMENT()));
orderLog.setBz(JSON.toJSONString(notifyInfo));
int iLog = orderLogMapper.insertWaterOrderLog(orderLog);
WaterOrderVo orderVo = new WaterOrderVo();
orderVo.setOrderNum(notifyInfo.getORDERID());
orderVo.setZfsj(DateUtils.parseDateToStr("yyyy-MM-dd hh:mm:ss",DateUtils.getNowDate()));
int orderI = orderMapper.updateByOrderNum(orderVo);
log.info("验签通过");
return "SUCCESS";
......
......@@ -151,6 +151,7 @@ public class CCBPayController {
map = gson.fromJson(payResult, map.getClass());
String ERRCODE =(String) map.get("ERRCODE");
System.out.println("ERRCODE的值为:"+ERRCODE);
System.out.println(payResult);
if(ERRCODE.equals("000000")){
String appId = (String) map.get("appId");
String timeStamp = (String) map.get("timeStamp");
......
......@@ -23,6 +23,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
......@@ -215,11 +216,13 @@ public class WaterGoodsController extends BaseController
waterGoodsVoList.add(waterGoodsVo);
}
}
if(waterGoodsVoList.size()>0){
map.put("goodsTypeName",waterGoodsType.getTypeName());
map.put("waterGoodsVoList",waterGoodsVoList);
mapList.add(map);
}
}
}
return getDataTable(mapList);
}
......@@ -249,7 +252,7 @@ public class WaterGoodsController extends BaseController
*/
@Log(title = "商品", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody WaterGoodsVo waterGoodsVo)
public AjaxResult add(@RequestBody WaterGoodsVo waterGoodsVo) throws IOException
{
return toAjax(waterGoodsService.insertWaterGoods(waterGoodsVo));
}
......@@ -259,7 +262,7 @@ public class WaterGoodsController extends BaseController
*/
@Log(title = "商品", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody WaterGoodsVo waterGoodsVo)
public AjaxResult edit(@RequestBody WaterGoodsVo waterGoodsVo) throws IOException
{
return toAjax(waterGoodsService.updateWaterGoods(waterGoodsVo));
}
......@@ -291,4 +294,18 @@ public class WaterGoodsController extends BaseController
public AjaxResult getGoodsXq(@RequestBody WaterGoodsVo waterGoodsVo){
return success(waterGoodsService.getGoodsXq(waterGoodsVo));
}
/**
* 保存轮播图
*/
@Log(title = "保存轮播图", businessType = BusinessType.INSERT)
@PostMapping("/savelbt")
public AjaxResult savelbt(@RequestBody WaterGoodsImg waterGoodsImg) throws IOException
{
return toAjax(waterGoodsService.savelbt(waterGoodsImg));
}
}
......@@ -150,6 +150,15 @@ public class SsWxLogin {
map.put("stationName",waterUser.getStationName());
map.put("userType",waterUser.getUserType());
map.put("userGender",waterUser.getUserGender());
AsyncManager.me().execute(AsyncFactory.recordLogininfor(waterUser.getNickName(), Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success")));
//存在
MpLoginUser loginUser = new MpLoginUser();
loginUser.setOpenId(openId);
loginUser.setUserId(waterUser.getId());
loginUser.setNickName(waterUser.getNickName());
loginUser.setIsNewUser("0");
String token = mpTokenService.createToken(loginUser);
map.put(Constants.TOKEN, token);
//查询送水工站点信息
WaterStationUserVo waterStationUser = waterStationUserService.selectWaterStationUserByPhone(waterUser.getPhoneNum());
if (StringUtils.isNull(waterStationUser)){
......
......@@ -116,6 +116,15 @@ public class WxLogin {
map.put("stationName",waterUser.getStationName());
map.put("userType",waterUser.getUserType());
map.put("userGender",waterUser.getUserGender());
AsyncManager.me().execute(AsyncFactory.recordLogininfor(waterUser.getNickName(), Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success")));
//存在
MpLoginUser loginUser = new MpLoginUser();
loginUser.setOpenId(openId);
loginUser.setUserId(waterUser.getId());
loginUser.setNickName(waterUser.getNickName());
loginUser.setIsNewUser("0");
String token = mpTokenService.createToken(loginUser);
map.put(Constants.TOKEN, token);
return AjaxResult.success(map);
}
......
......@@ -3,6 +3,7 @@ package com.qianhe.system.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.qianhe.common.annotation.Excel;
import com.qianhe.common.core.domain.BaseEntity;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
......@@ -15,6 +16,7 @@ import java.util.Date;
* @author qianhe
* @date 2023-11-23
*/
@Data
public class WaterOrderLog extends BaseEntity
{
private static final long serialVersionUID = 1L;
......@@ -48,6 +50,8 @@ public class WaterOrderLog extends BaseEntity
@Excel(name = "订单id")
private Long orderId;
private String bz;
public void setId(Long id)
{
this.id = id;
......
package com.qianhe.system.service;
import com.qianhe.system.domain.WaterGoods;
import com.qianhe.system.domain.WaterGoodsImg;
import com.qianhe.system.vo.WaterGoodsVo;
import java.io.IOException;
import java.util.List;
/**
......@@ -38,7 +40,7 @@ public interface IWaterGoodsService
* @param waterGoodsVo 商品
* @return 结果
*/
public int insertWaterGoods(WaterGoodsVo waterGoodsVo);
public int insertWaterGoods(WaterGoodsVo waterGoodsVo) throws IOException;
/**
* 修改商品
......@@ -46,7 +48,7 @@ public interface IWaterGoodsService
* @param waterGoodsVo 商品
* @return 结果
*/
public int updateWaterGoods(WaterGoodsVo waterGoodsVo);
public int updateWaterGoods(WaterGoodsVo waterGoodsVo) throws IOException ;
/**
* 批量删除商品
......@@ -76,4 +78,7 @@ public interface IWaterGoodsService
* @return
*/
WaterGoodsVo getGoodsXq(WaterGoodsVo waterGoodsVo);
int savelbt(WaterGoodsImg waterGoodsImg);
}
package com.qianhe.system.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.img.Img;
import cn.hutool.core.img.ImgUtil;
import cn.hutool.core.io.FileUtil;
import com.qianhe.common.config.RuoYiConfig;
import com.qianhe.common.utils.DateUtils;
import com.qianhe.common.utils.SecurityUtils;
import com.qianhe.common.utils.StringUtils;
......@@ -10,12 +14,17 @@ import com.qianhe.system.service.IWaterGoodsService;
import com.qianhe.system.utils.ImageThumbnailsUtil;
import com.qianhe.system.vo.WaterGoodsSpeVo;
import com.qianhe.system.vo.WaterGoodsVo;
import net.coobird.thumbnailator.Thumbnails;
import net.coobird.thumbnailator.name.Rename;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
......@@ -29,6 +38,8 @@ import java.util.List;
@Service
public class WaterGoodsServiceImpl implements IWaterGoodsService
{
@Value("${ruoyi.profile}")
private String profile;
@Autowired
private WaterGoodsMapper waterGoodsMapper;
@Autowired
......@@ -176,8 +187,7 @@ public class WaterGoodsServiceImpl implements IWaterGoodsService
*/
@Override
@Transactional
public int insertWaterGoods(WaterGoodsVo waterGoodsVo)
{
public int insertWaterGoods(WaterGoodsVo waterGoodsVo) throws IOException {
waterGoodsVo.setCreateUser(SecurityUtils.getLoginUser().getUsername());
waterGoodsVo.setCreateTime(DateUtils.getNowDate());
int i = waterGoodsMapper.insertWaterGoods(waterGoodsVo);
......@@ -196,8 +206,7 @@ public class WaterGoodsServiceImpl implements IWaterGoodsService
* @return 结果
*/
@Override
public int updateWaterGoods(WaterGoodsVo waterGoodsVo)
{
public int updateWaterGoods(WaterGoodsVo waterGoodsVo) throws IOException {
//删除商品图片
waterGoodsMapper.deleteWaterGoodsImgByGoodsId(waterGoodsVo.getId());
//删除商品关联规格
......@@ -253,29 +262,35 @@ public class WaterGoodsServiceImpl implements IWaterGoodsService
* 新增详情图
* @param waterGoodsVo
*/
private void insertGoodsDetailsImgs(WaterGoodsVo waterGoodsVo) {
private void insertGoodsDetailsImgs(WaterGoodsVo waterGoodsVo) throws IOException {
List<WaterGoodsImg> detailsImgs = waterGoodsVo.getDetailsImgs();
//图片压缩
if (StringUtils.isNotNull(detailsImgs)){
for (WaterGoodsImg detailsImg : detailsImgs) {
String inputImage = detailsImg.getUrl();
String outputImage = detailsImg.getUrl();
//判断图片是否是jpg或jpeg
String hz = detailsImg.getUrl().substring(detailsImg.getUrl().lastIndexOf(".") + 1);
if (hz.equals("jpg") || hz.equals("jpeg")){
try {
imageThumbnailsUtil.compressImage(inputImage,outputImage);
} catch (IOException e) {
e.printStackTrace();
}
}else {
try {
imageThumbnailsUtil.compressImagePNG(inputImage,outputImage);
} catch (IOException e) {
e.printStackTrace();
}
}
// 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);
// //判断图片是否是jpg或jpeg
// String hz = detailsImg.getUrl().substring(detailsImg.getUrl().lastIndexOf(".") + 1);
// if (hz.equals("jpg") || hz.equals("jpeg")){
// try {
// imageThumbnailsUtil.compressImage(inputImage,outputImage);
// } catch (IOException e) {
// e.printStackTrace();
// }
// }else {
// try {
// imageThumbnailsUtil.compressImagePNG(inputImage,outputImage);
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
}
}
List<WaterGoodsImg> detailsImgList = new ArrayList<>();
......@@ -294,33 +309,51 @@ 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"
// };
// List<String> list = ImageUtil.generateThumbnail2Directory(path, files);
// System.out.println(list);
}
/**
* 新增封面图
* @param waterGoodsVo
*/
private void insertGoodsCoverImgs(WaterGoodsVo waterGoodsVo) {
private void insertGoodsCoverImgs(WaterGoodsVo waterGoodsVo) throws IOException {
List<WaterGoodsImg> coverImgs = waterGoodsVo.getCoverImgs();
//图片压缩
if (StringUtils.isNotNull(coverImgs)){
for (WaterGoodsImg coverImg : coverImgs) {
String inputImage = coverImg.getUrl();
String outputImage = coverImg.getUrl();
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);
//旋转图片
// 旋转180度
// ImgUtil.rotate(ImageIO.read(FileUtil.file(outputImageDz)), 180);
//判断图片是否是jpg或jpeg
String hz = coverImg.getUrl().substring(coverImg.getUrl().lastIndexOf(".") + 1);
if (hz.equals("jpg") || hz.equals("jpeg")){
try {
imageThumbnailsUtil.compressImage(inputImage,outputImage);
} catch (IOException e) {
e.printStackTrace();
}
}else {
try {
imageThumbnailsUtil.compressImagePNG(inputImage,outputImage);
} catch (IOException e) {
e.printStackTrace();
}
}
// String hz = coverImg.getUrl().substring(coverImg.getUrl().lastIndexOf(".") + 1);
// if (hz.equals("jpg") || hz.equals("jpeg")){
// try {
// imageThumbnailsUtil.compressImage(inputImage,outputImage);
// } catch (IOException e) {
// e.printStackTrace();
// }
// }else {
// try {
// imageThumbnailsUtil.compressImagePNG(inputImage,outputImage);
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
}
}
......@@ -510,4 +543,11 @@ public class WaterGoodsServiceImpl implements IWaterGoodsService
waterGoodsVo1.setOrderGoodsType(1);
return waterGoodsVo1;
}
@Override
public int savelbt(WaterGoodsImg waterGoodsImg) {
//分类为轮播图
waterGoodsImg.setImgType(3);
return waterGoodsImgMapper.insertWaterGoodsImg(waterGoodsImg);
}
}
......@@ -267,10 +267,13 @@ public class WaterStationServiceImpl implements IWaterStationService
System.out.println(lon+"-------------"+lat);
//查询所有站点信息
List<WaterStation> waterStations = waterStationMapper.selectWaterStationList(new WaterStation());
WaterStation waterStation1 = new WaterStation();
waterStation1.setIsOpen("1");
List<WaterStation> waterStations = waterStationMapper.selectWaterStationList(waterStation1);
List<WaterStationVo> waterStationVoList = new ArrayList<>();
//循环站点,计算符合距离的站点
for (WaterStation waterStation : waterStations) {
//计算距离
double distance = PositionUtil.getDistance1(lon, lat, waterStation.getStationLonTen(), waterStation.getStationLatTen());
System.out.println("dis---------------"+distance);
......
......@@ -63,4 +63,7 @@ public class ImageThumbnailsUtil {
File outfile = new File(outputImagePath); // 目标输出文件,可与源文件一致,一致会覆盖
PngCompressor.compress(file, outfile);
}
}
......@@ -176,4 +176,7 @@ public class WaterOrderVo {
/** 触底请求参数 */
private Integer pageNum;
private String zfsj;
}
......@@ -38,8 +38,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectWaterGoodsList" parameterType="WaterGoods" resultMap="WaterGoodsResult">
<include refid="selectWaterGoodsVo"/>
<where>
a.status = '1'
and
a.del_flag = '0'
and
b.del_flag ='0'
......@@ -59,10 +58,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectWaterGoodsList1" resultMap="WaterGoodsResult">
-- select url cover_img from water_goods_img where img_type = 1 and goods_id = (select id from water_goods where title = '主页轮播图')
select replace(url,'/prod-api','') cover_img from water_goods_img where del_flag = '0'
and goods_id in (SELECT id from water_goods WHERE del_flag = '0'
AND goods_type_id in (select id from water_goods_type where del_flag = '0' and type_name = '主页轮播图'))
select replace(url,'/prod-api','') cover_img from water_goods_img where del_flag = '0'
and img_type=3
</select>
<select id="selectWaterGoodsById" parameterType="Long" resultMap="WaterGoodsResult">
......@@ -83,8 +80,6 @@ select replace(url,'/prod-api','') cover_img from water_goods_img where del_fla
select *
from water_goods
where id = #{id}
and status = '1'
and del_flag = '0'
</select>
......
......@@ -46,6 +46,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="payBackMoney != null">pay_back_money,</if>
<if test="createTime != null">create_time,</if>
<if test="orderId != null">order_id,</if>
<if test="bz != null">bz,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="payTime != null">#{payTime},</if>
......@@ -55,6 +56,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="payBackMoney != null">#{payBackMoney},</if>
<if test="createTime != null">#{createTime},</if>
<if test="orderId != null">#{orderId},</if>
<if test="bz != null">#{bz},</if>
</trim>
</insert>
......
......@@ -103,7 +103,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="startTime != null and startTime != '' and endTime != null and endTime != '' "> and create_time BETWEEN #{startTime} AND #{endTime}</if>
</where>
order by create_time DESC
<if test="pageNum != null"> limit #{pageNum}</if>
</select>
<select id="getWaterOrderListByStationId" parameterType="com.qianhe.system.vo.WaterOrderVo" resultType="com.qianhe.system.vo.WaterOrderVo">
......@@ -267,7 +267,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="updateByOrderNum" parameterType="com.qianhe.system.vo.WaterOrderVo">
update water_order set pay_state = '1' ,order_state = '2' where order_num = #{orderNum}
update water_order set pay_state = '1' ,order_state = '2',zfsj=#{zfsj} where order_num = #{orderNum}
</update>
<update id="deleteWaterOrderById" parameterType="Long">
......
......@@ -116,9 +116,11 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
// .antMatchers("/wx/getWxLoginInfo/**", "/wx/login/**", "/wx/getPhoneNumber/**","/wx/updateUser").permitAll()
.antMatchers("/wx/**").permitAll()
//放行送水小程序登录相关接口
.antMatchers("/ssWx/getWxLoginInfo/**", "/ssWx/login/**", "/ssWx/getPhoneNumber/**","/ssWx/updateUser").permitAll()
.antMatchers("/ssWx/getWxLoginInfo/**", "/ssWx/getUserInfo", "/ssWx/login/**", "/ssWx/getPhoneNumber/**","/ssWx/updateUser").permitAll()
//微信回调
.antMatchers("/callback/payNotify/").permitAll()
//银行回调
.antMatchers("/ccbback/payNotify/").permitAll()
//通用接口放行
.antMatchers("/common/**").permitAll()
//测试放行所有接口
......
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