发布--发布用户作品--修改--添加了对资源位状态的判断
This commit is contained in:
parent
05be0d579b
commit
2ecd250f73
@ -34,7 +34,7 @@ import com.ruoyi.system.service.*;
|
||||
import com.ruoyi.framework.web.service.TokenService;
|
||||
import com.ruoyi.web.controller.app.baidu.GsonUtils;
|
||||
import com.ruoyi.web.controller.app.baidu.OcrIdCardBAI;
|
||||
import com.ruoyi.web.controller.app.pay.PayService;
|
||||
//import com.ruoyi.web.controller.app.pay.PayService;
|
||||
import javafx.scene.chart.StackedAreaChart;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@ -91,8 +91,8 @@ public class AppSystemController extends BaseController {
|
||||
@Autowired
|
||||
private ISysOrderService sysOrderService;
|
||||
|
||||
@Autowired
|
||||
private PayService payService;
|
||||
// @Autowired
|
||||
// private PayService payService;
|
||||
|
||||
@Autowired
|
||||
private ISysUserFollowService userFollowService;
|
||||
@ -963,7 +963,9 @@ public class AppSystemController extends BaseController {
|
||||
// //----------------------------测试注释内容---------------------------------------
|
||||
|
||||
|
||||
LocalDate startTime = publishUserWorkDto.getStartTime();
|
||||
// LocalDate startTime = publishUserWorkDto.getStartTime();
|
||||
|
||||
LocalDate startTime = tomorrow;
|
||||
|
||||
if(!startTime.isEqual(tomorrow)){
|
||||
return error("非法时间, 以记录ip");
|
||||
@ -973,9 +975,16 @@ public class AppSystemController extends BaseController {
|
||||
LocalDate endTime = startTime;
|
||||
|
||||
// 根据资源位查看价格和时间
|
||||
|
||||
SysSource sysSource = sysSourceService.selectSysSourceBySourceId(sourceId);
|
||||
|
||||
// 获取资源位状态, 若只能从明天开始购买, 通过资源位的状态也能判断是否可以购买, 所以后面的时间判断对现在没有必要,
|
||||
String sourceStatus = sysSource.getSourceStatus();
|
||||
|
||||
// 资源位状态!=0的位置都不可以购买
|
||||
if(!sourceStatus.equals("0")){
|
||||
return error("该资源位不能被购买, 请不要输入非法参数");
|
||||
}
|
||||
|
||||
// 解析价格数据------这里不知道为什么默认是Double类型的??
|
||||
List<Map<String, Double>> list = GsonUtils.fromJson(sysSource.getPrice(), List.class);
|
||||
|
||||
@ -1003,10 +1012,10 @@ public class AppSystemController extends BaseController {
|
||||
// 检查时间是否合法, 从订单中查询当前资源位的订单时间, 每个资源位一年最多有 366条数据
|
||||
// 要不直接查资源位的起止时间??-------并不能这样做-----一个资源位可以购买多个时间段---一个数据根本存不下.
|
||||
// 所以只能通过订单的时间来查询时间是否合法.--这里默认一个订单只有一个时间(即使一个订单对应多个资源位)
|
||||
// 后续可能有必要, 现在必要性不大
|
||||
int back = sysOrderService.isTimeLegal(startTime, endTime, sourceId);
|
||||
|
||||
// 这里也要检查redis缓存中的时间是否合法 --sourceId + startTime + endTime 这三元组就行.
|
||||
|
||||
if(back > 0){
|
||||
return error("购买时间不合法:" + startTime + "至" + endTime);
|
||||
}
|
||||
@ -1318,8 +1327,8 @@ public class AppSystemController extends BaseController {
|
||||
}
|
||||
|
||||
AjaxResult ajaxResult = AjaxResult.success();
|
||||
ajaxResult.put("horizontalCount", horizontalCount);
|
||||
ajaxResult.put("verticalCount", verticalCount);
|
||||
ajaxResult.put("horizontalCount", horizontalCount+1);
|
||||
ajaxResult.put("verticalCount", verticalCount+1);
|
||||
ajaxResult.put("sourceList", showSysSourceList);
|
||||
|
||||
return ajaxResult;
|
||||
|
||||
@ -90,7 +90,7 @@ public class PayBackController {
|
||||
// 购买次数+1
|
||||
sysSource.setbBought(sysSource.getbBought()+1);
|
||||
|
||||
// 已购
|
||||
// 已购未展示
|
||||
sysSource.setSourceStatus("1");
|
||||
|
||||
// 将LocalDate转换为ZonedDateTime,指定时区(例如系统默认时区)----------------看看要不要把时间转换成LocalDate
|
||||
@ -103,7 +103,7 @@ public class PayBackController {
|
||||
// 设置workId
|
||||
sysSource.setWorkId(orderCacheVo.getWorkId());
|
||||
|
||||
// //---------- 更新资源位上的作品-----------------这时应该不更新------------系统的定是任务更新-------
|
||||
// //---------- 更新资源位上的作品-----------------这时应该不更新------------系统的定时任务更新-------
|
||||
// UserWork userWork = userWorkService.selectUserWorkByWorkId(orderCacheVo.getWorkId());
|
||||
// sysSource.setWorkAddress(userWork.getWorkAddress());
|
||||
// //------------更新资源位上的作品 end -------------------------------------------------------------
|
||||
@ -112,15 +112,11 @@ public class PayBackController {
|
||||
sysSourceService.updateSysSource(sysSource);
|
||||
|
||||
|
||||
|
||||
|
||||
//------------------------------------------更新资源位表 sys_source end------------------------------------------
|
||||
|
||||
|
||||
//------------------------------------------更新作品表 user_work 中的 source_id-----------------------------------
|
||||
|
||||
// 没必要一个作品可能对应多个资源位------------user_work只能对应一个source_id
|
||||
|
||||
// 没必要一个作品可能对应多个资源位------------user_work只能对应一个source_id-------------
|
||||
//------------------------------------------更新作品表 user_work 中的 source_id end-------------------------------
|
||||
|
||||
|
||||
@ -141,9 +137,6 @@ public class PayBackController {
|
||||
sysOrderService.insertSysOrder(sysOrder);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
System.out.println(list);
|
||||
|
||||
return "";
|
||||
|
||||
@ -1,139 +1,139 @@
|
||||
package com.ruoyi.web.controller.app.pay;
|
||||
|
||||
|
||||
import com.jeequan.jeepay.JeepayClient;
|
||||
import com.jeequan.jeepay.response.PayOrderCreateResponse;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.redis.RedisCache;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.system.domain.SysSource;
|
||||
import com.ruoyi.system.domain.UserWork;
|
||||
import com.ruoyi.system.domain.dto.PublishUserWorkDto;
|
||||
import com.ruoyi.system.domain.dto.SourcePriceDto;
|
||||
import com.ruoyi.system.domain.vo.PayResponseVo;
|
||||
import com.ruoyi.system.service.ISysSourceService;
|
||||
import com.ruoyi.system.service.IUserWorkService;
|
||||
import com.ruoyi.web.controller.app.baidu.GsonUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import com.ruoyi.common.utils.uuid.UUID;
|
||||
import com.jeequan.jeepay.model.PayOrderCreateReqModel;
|
||||
import com.jeequan.jeepay.request.PayOrderCreateRequest;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class PayService {
|
||||
public static final String APPKEY = "";
|
||||
public static String APPID = "";
|
||||
public static String MCHNO = "";
|
||||
|
||||
@Autowired
|
||||
private IUserWorkService userWorkService;
|
||||
|
||||
@Autowired
|
||||
private ISysSourceService sysSourceService;
|
||||
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
|
||||
|
||||
|
||||
// 生成订单--------将订单数据保存在redis缓存中----缓存时间为10分钟吧
|
||||
public boolean genOrder(double price) {
|
||||
|
||||
|
||||
|
||||
try {
|
||||
|
||||
// 订单号, 自己生成,用来标识这一次支付.
|
||||
String mchOrderNo = "M" + UUID.randomUUID().toString().replaceAll("-", "");
|
||||
|
||||
// 缓存订单和用户关系, 为了回调函数中写入订单数据库
|
||||
System.out.println("mchOrderNo: " + mchOrderNo);
|
||||
// System.out.println(redisCache);
|
||||
|
||||
|
||||
// redisCache.setCacheObject(mchOrderNo, userId.toString() + "_" + result, 1, TimeUnit.DAYS);
|
||||
// System.out.println(redisCache.getCacheObject(mchOrderNo).toString());
|
||||
// log.info("缓存订单和用户关系: mchOrderNo=" + mchOrderNo + ", userId=" + userId);
|
||||
|
||||
|
||||
// //---------------------------------------------------测试环境 先注释掉--------------------------------------------------------
|
||||
// // 支付方式
|
||||
// String wayCode = "QR_CASHIER";
|
||||
//
|
||||
// Byte divisionMode = 0;
|
||||
//
|
||||
// // 前端明确了支付参数的类型 payDataType
|
||||
// String payDataType = "codeImgUrl";
|
||||
// String authCode = "payurl";
|
||||
//
|
||||
// PayOrderCreateRequest request = new PayOrderCreateRequest();
|
||||
// PayOrderCreateReqModel model = new PayOrderCreateReqModel();
|
||||
// request.setBizModel(model);
|
||||
//package com.ruoyi.web.controller.app.pay;
|
||||
//
|
||||
//
|
||||
// model.setMchNo(MCHNO); // 商户号
|
||||
// model.setAppId(APPID);
|
||||
// model.setMchOrderNo(mchOrderNo);
|
||||
// model.setWayCode(wayCode);
|
||||
// model.setAmount(Price);
|
||||
// model.setReturnUrl("http://");
|
||||
// // paypal通道使用USD类型货币
|
||||
// model.setCurrency("CNY");
|
||||
// model.setClientIp("127.0.0.1");
|
||||
// model.setSubject("" + MCHNO + "");
|
||||
// model.setBody("正常订单" + "[" + MCHNO + "]");
|
||||
//import com.jeequan.jeepay.JeepayClient;
|
||||
//import com.jeequan.jeepay.response.PayOrderCreateResponse;
|
||||
//import com.ruoyi.common.core.controller.BaseController;
|
||||
//import com.ruoyi.common.core.domain.AjaxResult;
|
||||
//import com.ruoyi.common.core.redis.RedisCache;
|
||||
//import com.ruoyi.common.utils.SecurityUtils;
|
||||
//import com.ruoyi.common.utils.StringUtils;
|
||||
//import com.ruoyi.system.domain.SysSource;
|
||||
//import com.ruoyi.system.domain.UserWork;
|
||||
//import com.ruoyi.system.domain.dto.PublishUserWorkDto;
|
||||
//import com.ruoyi.system.domain.dto.SourcePriceDto;
|
||||
//import com.ruoyi.system.domain.vo.PayResponseVo;
|
||||
//import com.ruoyi.system.service.ISysSourceService;
|
||||
//import com.ruoyi.system.service.IUserWorkService;
|
||||
//import com.ruoyi.web.controller.app.baidu.GsonUtils;
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
//import com.ruoyi.common.utils.uuid.UUID;
|
||||
//import com.jeequan.jeepay.model.PayOrderCreateReqModel;
|
||||
//import com.jeequan.jeepay.request.PayOrderCreateRequest;
|
||||
//import com.alibaba.fastjson.JSONObject;
|
||||
//import org.springframework.stereotype.Component;
|
||||
//import org.springframework.stereotype.Service;
|
||||
//import org.springframework.web.bind.annotation.*;
|
||||
//
|
||||
// // 支付回调地址
|
||||
// model.setNotifyUrl("http://62.234.19.34:8991/wxPay/result/wxRechargeCallback/"+result); //回调地址
|
||||
// model.setReturnUrl("");
|
||||
// model.setDivisionMode(divisionMode); //分账模式
|
||||
//import java.util.List;
|
||||
//import java.util.concurrent.TimeUnit;
|
||||
//import java.util.stream.Collectors;
|
||||
//
|
||||
// //设置扩展参数
|
||||
// JSONObject extParams = new JSONObject();
|
||||
// if (StringUtils.isNotEmpty(payDataType)) {
|
||||
// extParams.put("payDataType", payDataType.trim());
|
||||
// }
|
||||
// if (StringUtils.isNotEmpty(authCode)) {
|
||||
// extParams.put("authCode", authCode.trim());
|
||||
// }
|
||||
// model.setChannelExtra(extParams.toString());
|
||||
//@Service
|
||||
//public class PayService {
|
||||
// public static final String APPKEY = "";
|
||||
// public static String APPID = "";
|
||||
// public static String MCHNO = "";
|
||||
//
|
||||
// JeepayClient jeepayClient = new JeepayClient("http://payment.pay.oetsoft.com",
|
||||
// APPKEY);
|
||||
// @Autowired
|
||||
// private IUserWorkService userWorkService;
|
||||
//
|
||||
// PayOrderCreateResponse payOrderCreateResponse = jeepayClient.execute(request);
|
||||
// System.out.println(payOrderCreateResponse.toString());
|
||||
// PayResponseVo payResponseVo = JSONObject.parseObject(payOrderCreateResponse.toString(), PayResponseVo.class);
|
||||
// String url = payResponseVo.getData().getPayData();
|
||||
// @Autowired
|
||||
// private ISysSourceService sysSourceService;
|
||||
//
|
||||
// //-------------------------------------------------测试环境先注释掉-----------------------------------------------------------
|
||||
|
||||
// //设置Access-Control-Expose-Headers避免前端调用获取Content-Disposition出现Refused to get unsafe header异常
|
||||
// @Autowired
|
||||
// private RedisCache redisCache;
|
||||
//
|
||||
// response.addHeader("Access-Control-Expose-Headers", "Content-Disposition");
|
||||
// response.addHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("img.jpg", "UTF-8"));
|
||||
|
||||
|
||||
return true;
|
||||
}catch (Exception e){
|
||||
System.out.println(e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// @PostMapping("/WechatPay")
|
||||
// public AjaxResult WechatPay(@RequestBody List<PayDto> payDtoList){
|
||||
// return null;
|
||||
//
|
||||
//
|
||||
// // 生成订单--------将订单数据保存在redis缓存中----缓存时间为10分钟吧
|
||||
// public boolean genOrder(double price) {
|
||||
//
|
||||
//
|
||||
//
|
||||
// try {
|
||||
//
|
||||
// // 订单号, 自己生成,用来标识这一次支付.
|
||||
// String mchOrderNo = "M" + UUID.randomUUID().toString().replaceAll("-", "");
|
||||
//
|
||||
// // 缓存订单和用户关系, 为了回调函数中写入订单数据库
|
||||
// System.out.println("mchOrderNo: " + mchOrderNo);
|
||||
//// System.out.println(redisCache);
|
||||
//
|
||||
//
|
||||
//// redisCache.setCacheObject(mchOrderNo, userId.toString() + "_" + result, 1, TimeUnit.DAYS);
|
||||
//// System.out.println(redisCache.getCacheObject(mchOrderNo).toString());
|
||||
//// log.info("缓存订单和用户关系: mchOrderNo=" + mchOrderNo + ", userId=" + userId);
|
||||
//
|
||||
//
|
||||
//// //---------------------------------------------------测试环境 先注释掉--------------------------------------------------------
|
||||
//// // 支付方式
|
||||
//// String wayCode = "QR_CASHIER";
|
||||
////
|
||||
//// Byte divisionMode = 0;
|
||||
////
|
||||
//// // 前端明确了支付参数的类型 payDataType
|
||||
//// String payDataType = "codeImgUrl";
|
||||
//// String authCode = "payurl";
|
||||
////
|
||||
//// PayOrderCreateRequest request = new PayOrderCreateRequest();
|
||||
//// PayOrderCreateReqModel model = new PayOrderCreateReqModel();
|
||||
//// request.setBizModel(model);
|
||||
////
|
||||
////
|
||||
//// model.setMchNo(MCHNO); // 商户号
|
||||
//// model.setAppId(APPID);
|
||||
//// model.setMchOrderNo(mchOrderNo);
|
||||
//// model.setWayCode(wayCode);
|
||||
//// model.setAmount(Price);
|
||||
//// model.setReturnUrl("http://");
|
||||
//// // paypal通道使用USD类型货币
|
||||
//// model.setCurrency("CNY");
|
||||
//// model.setClientIp("127.0.0.1");
|
||||
//// model.setSubject("" + MCHNO + "");
|
||||
//// model.setBody("正常订单" + "[" + MCHNO + "]");
|
||||
////
|
||||
//// // 支付回调地址
|
||||
//// model.setNotifyUrl("http://62.234.19.34:8991/wxPay/result/wxRechargeCallback/"+result); //回调地址
|
||||
//// model.setReturnUrl("");
|
||||
//// model.setDivisionMode(divisionMode); //分账模式
|
||||
////
|
||||
//// //设置扩展参数
|
||||
//// JSONObject extParams = new JSONObject();
|
||||
//// if (StringUtils.isNotEmpty(payDataType)) {
|
||||
//// extParams.put("payDataType", payDataType.trim());
|
||||
//// }
|
||||
//// if (StringUtils.isNotEmpty(authCode)) {
|
||||
//// extParams.put("authCode", authCode.trim());
|
||||
//// }
|
||||
//// model.setChannelExtra(extParams.toString());
|
||||
////
|
||||
//// JeepayClient jeepayClient = new JeepayClient("http://payment.pay.oetsoft.com",
|
||||
//// APPKEY);
|
||||
////
|
||||
//// PayOrderCreateResponse payOrderCreateResponse = jeepayClient.execute(request);
|
||||
//// System.out.println(payOrderCreateResponse.toString());
|
||||
//// PayResponseVo payResponseVo = JSONObject.parseObject(payOrderCreateResponse.toString(), PayResponseVo.class);
|
||||
//// String url = payResponseVo.getData().getPayData();
|
||||
////
|
||||
//// //-------------------------------------------------测试环境先注释掉-----------------------------------------------------------
|
||||
//
|
||||
//// //设置Access-Control-Expose-Headers避免前端调用获取Content-Disposition出现Refused to get unsafe header异常
|
||||
////
|
||||
//// response.addHeader("Access-Control-Expose-Headers", "Content-Disposition");
|
||||
//// response.addHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("img.jpg", "UTF-8"));
|
||||
//
|
||||
//
|
||||
// return true;
|
||||
// }catch (Exception e){
|
||||
// System.out.println(e);
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
//
|
||||
//// @PostMapping("/WechatPay")
|
||||
//// public AjaxResult WechatPay(@RequestBody List<PayDto> payDtoList){
|
||||
//// return null;
|
||||
////
|
||||
//// }
|
||||
//}
|
||||
|
||||
@ -71,8 +71,8 @@ public class insertSource {
|
||||
for(Seat seat : seats){
|
||||
System.out.println(seat.getX() + " " + seat.getY() + " " + seat.getStatus() + " " + seat.getArea());
|
||||
SysSource sysSource = new SysSource();
|
||||
sysSource.setcX(seat.getX());
|
||||
sysSource.setcY(seat.getY());
|
||||
sysSource.setcX(seat.getY());
|
||||
sysSource.setcY(seat.getX());
|
||||
sysSource.setSourceStatus("0");
|
||||
sysSource.setPart(seat.getArea());
|
||||
|
||||
@ -84,7 +84,7 @@ public class insertSource {
|
||||
sysSource.setCity("济南");
|
||||
sysSource.setScenicId(1L);
|
||||
sysSource.setScenic("泉城广场");
|
||||
sysSource.setCoordinate(seat.getX()+"-"+ seat.getY());
|
||||
sysSource.setCoordinate(seat.getY()+"-"+ seat.getX());
|
||||
sysSource.setWorkAddress("https://img.keaitupian.cn/newupload/11/1668068437206545.jpg");
|
||||
sysSource.setScale("L");
|
||||
sysSourceService.insertSysSource(sysSource);
|
||||
|
||||
@ -96,7 +96,7 @@ token:
|
||||
header: Authorization
|
||||
# 令牌密钥
|
||||
secret: abcdefghijklmnopqrstuvwxyz
|
||||
# 令牌有效期(默认30分钟)1440 = 60*24
|
||||
# 令牌有效期(默认30分钟)1440 = 60*24 单位分钟
|
||||
expireTime: 43200
|
||||
|
||||
# MyBatis配置
|
||||
|
||||
Loading…
Reference in New Issue
Block a user