Commit 2b343df4 by jscat

nyx javaapp: 功能优化

1. 解决订单页面(order.wxml) 订单重复提交问题(onPay)
parent c4d386dd
package cn.com.fun.nyxkey.api.common;
package cn.com.fun.nyxkey.api.common;
......@@ -3,7 +3,7 @@ package cn.com.fun.nyxkey.api.common;
public enum ExceptionMsg {
SUCCESS("000000", "操作成功"),
FAILED("999999","操作失败"),
ParamError("000001", "参数错误!"),
ParamError("000001", "参数为空错误!"),
LoginNameOrPassWordError("000100", "用户名或者密码错误!"),
EmailUsed("000101","该邮箱已被注册"),
......@@ -24,7 +24,9 @@ public enum ExceptionMsg {
LimitPictureSize("000401","图片大小必须小于2M"),
LimitPictureType("000402","图片格式必须为'jpg'、'png'、'jpge'、'gif'、'bmp'"),
OSSTokenNameIsBlack("000501", "cardNumber或tokenName不能为空!"),
OSSServerInternalError("000502", "获取阿里oss token失败,服务器内部错误!")
OSSServerInternalError("000502", "获取阿里oss token失败,服务器内部错误!"),
ResubmitError("000601", "重复提交错误!")
;
private ExceptionMsg(String code, String msg) {
......
package cn.com.fun.nyxkey.api.repository;
package cn.com.fun.nyxkey.api.repository;
......@@ -54,6 +54,7 @@ public interface Rockwell_keyMapper {
String genT_order_id();
void addT_order(Rockwell_keyT_order rockwell_keyT_order);
void addT_order_item(Rockwell_keyT_order_item rockwell_keyT_order_item);
List<Rockwell_keyT_order> checkOrderResubmit(Rockwell_keyT_orderQuery rockwell_keyT_orderQuery);
/* collect api */
List<Rockwell_keyV_collect> getV_collect_by_page(Rockwell_keyT_collectQuery rockwell_keyT_collectQuery);
......
package cn.com.fun.nyxkey.api.service;
package cn.com.fun.nyxkey.api.service;
......@@ -73,6 +73,7 @@ public interface Rockwell_keyService {
String Rockwell_keyServiceGenT_order_id();
JSONResult Rockwell_keyServiceAddT_order(String orderId, String activityId, String userId, String productImage, Double totalPrice, int totalCount,
String qrcodeUrl, List<Rockwell_keyT_product> listRockwell_keyT_product);
int Rockwell_keyServiceCheckOrderResubmit(String activityId, String userId, int interval);
/*
collect api 收藏api
......
package cn.com.fun.nyxkey.api.service.impl;
package cn.com.fun.nyxkey.api.service.impl;
......@@ -412,6 +412,22 @@ public class Rockwell_keyServiceImpl implements Rockwell_keyService {
}
public int Rockwell_keyServiceCheckOrderResubmit(String activityId, String userId, int interval)
{
LOGGER.debug("find Rockwell_keyServiceCheckOrderResubmit");
List<Rockwell_keyT_order> listRockwell_keyT_order = new ArrayList<>();
Rockwell_keyT_orderQuery rockwell_keyT_orderQuery = new Rockwell_keyT_orderQuery();
rockwell_keyT_orderQuery.setUserId(userId);
rockwell_keyT_orderQuery.setActivityId(activityId);
Date date = new Date();
date.setTime(date.getTime() - interval*60*1000);
rockwell_keyT_orderQuery.setCreateDatetime(date);
listRockwell_keyT_order = rockwell_keyMapper.checkOrderResubmit(rockwell_keyT_orderQuery);
return listRockwell_keyT_order.size();
}
/* activity api
* 通过 activityId 来获取 view_activity_detail 的详细信息
......
package cn.com.fun.nyxkey.api.web.controller;
package cn.com.fun.nyxkey.api.web.controller;
package cn.com.fun.nyxkey.api.web.controller;
import cn.com.fun.nyxkey.api.common.ExceptionMsg;
import cn.com.fun.nyxkey.api.common.JSONResult;
import cn.com.fun.nyxkey.api.domain.Rockwell_keyT_match;
import cn.com.fun.nyxkey.api.domain.Rockwell_keyT_product;
......@@ -8,10 +9,12 @@ import cn.com.fun.nyxkey.api.service.*;
import cn.com.fun.nyxkey.api.web.common.ResponseHelper;
import cn.com.fun.nyxkey.api.web.common.ResponseWrapper;
import com.alibaba.fastjson.JSON;
import com.sun.org.apache.xpath.internal.operations.Bool;
import io.swagger.annotations.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
......@@ -41,6 +44,10 @@ public class NyxApiController {
@Autowired
private Rockwell_ossService ossService;
//AccessKeyId表示RAM子账号的AccessKeyId;
@Value("${resubmit.interval}")
private int interval;
// 1.1 获取最近10条quiz
// http://localhost:8084/api/financing/hotsearch/report?pageNum=1&pageCount=5
@ApiOperation(value="顺序获取quiz", notes="获取quiz")
......@@ -485,6 +492,12 @@ public class NyxApiController {
int totalCount,
String orderItemString
) {
int resubmit = keyService.Rockwell_keyServiceCheckOrderResubmit(activityId, userId, interval);
if(resubmit!=0)
{
return new JSONResult(ExceptionMsg.ResubmitError);
}
else{
List<Rockwell_keyT_product> listRockwell_keyT_product = JSON.parseArray(orderItemString, Rockwell_keyT_product.class);
//生成orderId
String orderId = keyService.Rockwell_keyServiceGenT_order_id();
......@@ -494,6 +507,8 @@ public class NyxApiController {
qrcodeUrl, listRockwell_keyT_product);
}
}
// 收藏表(tbl_collect)的相关api 获取 view_collect 的数据 by page
// 6.1 collect 查询
// 1. 按照 user_id
......
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
......@@ -501,6 +501,16 @@ limitations under the License.
</foreach>
</insert>
<!-- collect api 5-5 检查是否有重复提交操作 jscat 20200917 -->
<select id="checkOrderResubmit" parameterType="cn.com.fun.nyxkey.api.domain.query.Rockwell_keyT_orderQuery"
resultType="cn.com.fun.nyxkey.api.domain.Rockwell_keyT_order">
select * from tbl_order
where 1=1
AND create_datetime >= #{createDatetime}
AND user_id=#{userId}
AND activity_id=#{activityId}
</select>
<!-- collect api 6-1 获取 v_collect 的值 by page; order by start_datetime asc jscat 20200826 -->
<select id="getV_collect_by_page" parameterType="cn.com.fun.nyxkey.api.domain.query.Rockwell_keyT_collectQuery"
resultType="cn.com.fun.nyxkey.api.domain.Rockwell_keyV_collect">
......
server:
server:
......@@ -84,3 +84,6 @@ aliyun:
dir: user-dir/
dirQrcode: qrcode-dir/
dirLogo: logo-dir/
resubmit:
interval: 3
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论