Commit efb5f72e by XiaHou

查询展览纪念馆

parent 40858f9b
package com.atlgroupasia.servicecenter.controller; package com.atlgroupasia.servicecenter.controller;
import com.atlgroupasia.servicecenter.common.CommonPage;
import com.atlgroupasia.servicecenter.common.Page;
import com.atlgroupasia.servicecenter.dto.DonorDto; import com.atlgroupasia.servicecenter.dto.DonorDto;
import com.atlgroupasia.servicecenter.entity.DonateOrder; import com.atlgroupasia.servicecenter.dto.OshServicesOrderDTO;
import com.atlgroupasia.servicecenter.entity.User; import com.atlgroupasia.servicecenter.queryparam.QueryOrderRelationTimeParam;
import com.atlgroupasia.servicecenter.service.*; import com.atlgroupasia.servicecenter.service.*;
import com.atlgroupasia.servicecenter.utils.JsonResult; import com.atlgroupasia.servicecenter.utils.JsonResult;
import com.atlgroupasia.servicecenter.utils.StringUtilSS;
import com.atlgroupasia.servicecenter.vo.DonorVo; import com.atlgroupasia.servicecenter.vo.DonorVo;
import com.atlgroupasia.servicecenter.vo.OshServicesOrderItemVo; import com.atlgroupasia.servicecenter.vo.OshServicesOrderItemVo;
import com.atlgroupasia.servicecenter.vo.OshServicesOrderVo; import com.atlgroupasia.servicecenter.vo.OshServicesOrderVo;
import com.atlgroupasia.servicecenter.vo.OshServicesVo;
import com.github.wxpay.sdk.WXPayUtil;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import io.swagger.annotations.*; import io.swagger.annotations.*;
...@@ -19,16 +18,10 @@ import org.apache.commons.lang3.StringUtils; ...@@ -19,16 +18,10 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -254,13 +247,13 @@ public class ApiOshServicesOrderController { ...@@ -254,13 +247,13 @@ public class ApiOshServicesOrderController {
if (selfList.size() > 0) { if (selfList.size() > 0) {
for (Map<String, Object> item : selfList) { for (Map<String, Object> item : selfList) {
String itemId = item.get("id").toString(); String itemId = item.get("id").toString();
if(itemId.equals(id)){ if (itemId.equals(id)) {
isMySelf = "1"; isMySelf = "1";
break; break;
} }
} }
} }
map.put("isMySelf",isMySelf); map.put("isMySelf", isMySelf);
} }
return JsonResult.success("获取福位列表成功!", list); return JsonResult.success("获取福位列表成功!", list);
} }
...@@ -298,7 +291,7 @@ public class ApiOshServicesOrderController { ...@@ -298,7 +291,7 @@ public class ApiOshServicesOrderController {
Map<String, Object> result = Maps.newHashMap(); Map<String, Object> result = Maps.newHashMap();
result.put("orderId", returnVo.getId()); result.put("orderId", returnVo.getId());
result.put("code", returnVo.getCode()); result.put("code", returnVo.getCode());
result.put("createDate",System.currentTimeMillis()); result.put("createDate", System.currentTimeMillis());
result.put("payPrice", returnVo.getTotalPrice()); result.put("payPrice", returnVo.getTotalPrice());
return JsonResult.success("新增请求成功", result); return JsonResult.success("新增请求成功", result);
} }
...@@ -461,4 +454,22 @@ public class ApiOshServicesOrderController { ...@@ -461,4 +454,22 @@ public class ApiOshServicesOrderController {
return JsonResult.success("获取评价列表成功", oshServicesOrderSerice.findEvaluateList(vo)); return JsonResult.success("获取评价列表成功", oshServicesOrderSerice.findEvaluateList(vo));
} }
@ApiOperation("根据时光纪查询 订单List ,不传分页参数不分页")
@RequestMapping(value = "/selectTimesNumberByTimeId", method = RequestMethod.GET)
public JsonResult<CommonPage<OshServicesOrderDTO>> selectTimesNumberByTimeId(@ModelAttribute QueryOrderRelationTimeParam queryOrderRelationTimeParam, @ModelAttribute Page page) {
return JsonResult.success("查询成功", this.oshServicesOrderSerice.selectTimesNumberByTimeId(queryOrderRelationTimeParam, page));
}
@ApiOperation("获取时光纪相关纪念次数 以及 订单总金额")
@RequestMapping(value = "/getOrderTimesNumber", method = RequestMethod.GET)
public JsonResult<Map> getOrderTimesNumber(@ModelAttribute QueryOrderRelationTimeParam queryOrderRelationTimeParam) {
return JsonResult.success("查询成功", this.oshServicesOrderSerice.getOrderTimesNumber(queryOrderRelationTimeParam));
}
@ApiOperation("查询纪念排行人数数据 ,不传分页参数不分页")
@RequestMapping(value = "/selectOrderListGroupByUserId", method = RequestMethod.GET)
public JsonResult<CommonPage<OshServicesOrderDTO>> selectOrderListGroupByUserId(@ModelAttribute QueryOrderRelationTimeParam queryOrderRelationTimeParam, @ModelAttribute Page page) {
return JsonResult.success("查询成功", this.oshServicesOrderSerice.selectOrderListGroupByUserId(queryOrderRelationTimeParam, page));
}
} }
package com.atlgroupasia.servicecenter.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @Author xh
* @Date 2021/7/14
* description:时光纪相关 订单统计参数类
*/
@Data
public class AtlTimeOrderDTO implements Serializable {
@ApiModelProperty(value = "纪念次数")
private Long commemorateTimes;
@ApiModelProperty(value = "活跃值")
private Long activeValue;
}
package com.atlgroupasia.servicecenter.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
* @Author xh
* @Date 2021/7/14
* description:
*/
@Data
public class OshServicesOrderDTO implements Serializable {
@ApiModelProperty(value = "订单id")
private Long id;
@ApiModelProperty(value = "下单人昵称")
private String nickName;
@ApiModelProperty(value = "订单创建时间")
private Date createTime;
@ApiModelProperty(value = "订单状态 1:易付款 2: 已支付 3服务中 4:已完成")
private String status;
@ApiModelProperty(value = "用户表备注")
private String remark;
@ApiModelProperty(value = "总价")
private BigDecimal totalPrice;
@ApiModelProperty(value = "支付方式 0:微信 1:支付宝")
private String payWay;
@ApiModelProperty(value = "下单人头像")
private String pic;
@ApiModelProperty(value = "订单item详情List")
private List<OshServicesOrderItemDTO> oshServicesOrderItemDTOList;
@ApiModelProperty(value = "纪念次数")
private Long times;
@ApiModelProperty(value = "活跃值)
private BigDecimal sumTotalPrice;
}
package com.atlgroupasia.servicecenter.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* @Author xh
* @Date 2021/7/14
* description:
*/
@Data
public class OshServicesOrderItemDTO implements Serializable {
@ApiModelProperty(value = "订单明细id")
private Long id;
@ApiModelProperty(value = "商品规格名称")
private String name;
@ApiModelProperty(value = "数量")
private Integer num;
@ApiModelProperty(value = "订单价格")
private BigDecimal price;
}
package com.atlgroupasia.servicecenter.mapper; package com.atlgroupasia.servicecenter.mapper;
import com.atlgroupasia.servicecenter.dto.OshServicesOrderDTO;
import com.atlgroupasia.servicecenter.dto.OshServicesOrderItemDTO;
import com.atlgroupasia.servicecenter.queryparam.QueryOrderRelationTimeParam;
import com.atlgroupasia.servicecenter.vo.OshServicesOrderVo; import com.atlgroupasia.servicecenter.vo.OshServicesOrderVo;
import com.atlgroupasia.servicecenter.vo.OshServicesVo;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -12,24 +15,74 @@ public interface OshServicesOrderMapper { ...@@ -12,24 +15,74 @@ public interface OshServicesOrderMapper {
/*订单列表*/ /*订单列表*/
List<Map<String, Object>> findList(OshServicesOrderVo vo); List<Map<String, Object>> findList(OshServicesOrderVo vo);
/*订单评价详情*/ /*订单评价详情*/
Map<String, Object> evaluateView(OshServicesOrderVo vo); Map<String, Object> evaluateView(OshServicesOrderVo vo);
/*订单评价*/ /*订单评价*/
void evaluate(OshServicesOrderVo vo); void evaluate(OshServicesOrderVo vo);
/*查询已评价订单列表*/ /*查询已评价订单列表*/
List<Map<String, Object>> findEvaluateList(OshServicesOrderVo vo); List<Map<String, Object>> findEvaluateList(OshServicesOrderVo vo);
/*查询好评评价订单条数*/ /*查询好评评价订单条数*/
List<Map<String, Object>> findRateListByOrderId(OshServicesOrderVo vo); List<Map<String, Object>> findRateListByOrderId(OshServicesOrderVo vo);
/*新增订单*/ /*新增订单*/
void insert(OshServicesOrderVo vo); void insert(OshServicesOrderVo vo);
/*订单详情*/ /*订单详情*/
Map<String, Object> view(OshServicesOrderVo vo); Map<String, Object> view(OshServicesOrderVo vo);
/*订单支付*/ /*订单支付*/
void payOrder(OshServicesOrderVo vo); void payOrder(OshServicesOrderVo vo);
/*通过订单编码查询订单*/ /*通过订单编码查询订单*/
OshServicesOrderVo getViewByCode(OshServicesOrderVo vo); OshServicesOrderVo getViewByCode(OshServicesOrderVo vo);
/*查看订单提交视频和图片列表*/ /*查看订单提交视频和图片列表*/
List<Map<String, Object>> videoAndImageList(@Param("orderId") Long orderId); List<Map<String, Object>> videoAndImageList(@Param("orderId") Long orderId);
/*查看未观看视频列表*/ /*查看未观看视频列表*/
List<Map<String, Object>> findVideoListUnWatch(Long orderId); List<Map<String, Object>> findVideoListUnWatch(Long orderId);
/**
* 查询时光纪相关联的订单
*
* @param queryOrderRelationTimeParam
* @return
*/
List<OshServicesOrderDTO> selectOrderListByTimeId(QueryOrderRelationTimeParam queryOrderRelationTimeParam);
/**
* 根据订单id 查询相关订单item详情数据
*
* @param orderId
* @return
*/
List<OshServicesOrderItemDTO> selectOrderItemListByOrderId(Long orderId);
/**
* 查询支付订单次数
*
* @param queryOrderRelationTimeParam
* @return
*/
Long selectPayOrderTimes(QueryOrderRelationTimeParam queryOrderRelationTimeParam);
/**
* 查询支付订单总金额
*
* @param queryOrderRelationTimeParam
* @return
*/
BigDecimal selectPayOrderTotalPrice(QueryOrderRelationTimeParam queryOrderRelationTimeParam);
/**
* 查询纪念排行人数数据
*
* @param queryOrderRelationTimeParam
* @return
*/
List<OshServicesOrderDTO> selectOrderListGroupByUserId(QueryOrderRelationTimeParam queryOrderRelationTimeParam);
} }
package com.atlgroupasia.servicecenter.queryparam;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* @Author xh
* @Date 2021/7/14
* description:查询时光纪相关的订单数据
*/
@Data
public class QueryOrderRelationTimeParam implements Serializable {
@ApiModelProperty(value = "关联app时光纪id")
private Long relationTimeId;
@ApiModelProperty(value = "关联app纪念的用户id(谁下的单就是谁的id)")
private Long relationUserId;
}
...@@ -2,12 +2,19 @@ package com.atlgroupasia.servicecenter.service; ...@@ -2,12 +2,19 @@ package com.atlgroupasia.servicecenter.service;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.atlgroupasia.servicecenter.mapper.*; import com.atlgroupasia.servicecenter.common.CommonPage;
import com.atlgroupasia.servicecenter.common.Page;
import com.atlgroupasia.servicecenter.dto.OshServicesOrderDTO;
import com.atlgroupasia.servicecenter.mapper.OshServicesOrderItemMapper;
import com.atlgroupasia.servicecenter.mapper.OshServicesOrderMapper;
import com.atlgroupasia.servicecenter.mapper.OshServicesOrderRecordMapper;
import com.atlgroupasia.servicecenter.queryparam.QueryOrderRelationTimeParam;
import com.atlgroupasia.servicecenter.utils.*; import com.atlgroupasia.servicecenter.utils.*;
import com.atlgroupasia.servicecenter.vo.OshServicesOrderItemVo; import com.atlgroupasia.servicecenter.vo.OshServicesOrderItemVo;
import com.atlgroupasia.servicecenter.vo.OshServicesOrderRecordVo; import com.atlgroupasia.servicecenter.vo.OshServicesOrderRecordVo;
import com.atlgroupasia.servicecenter.vo.OshServicesOrderVo; import com.atlgroupasia.servicecenter.vo.OshServicesOrderVo;
import com.atlgroupasia.servicecenter.vo.OshServicesVo; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.github.wxpay.sdk.WXPay; import com.github.wxpay.sdk.WXPay;
import com.github.wxpay.sdk.WXPayConstants; import com.github.wxpay.sdk.WXPayConstants;
import com.github.wxpay.sdk.WXPayUtil; import com.github.wxpay.sdk.WXPayUtil;
...@@ -20,9 +27,9 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -20,9 +27,9 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.io.Console;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
@Service @Service
@Slf4j @Slf4j
...@@ -36,7 +43,6 @@ public class OshServicesOrderSerice { ...@@ -36,7 +43,6 @@ public class OshServicesOrderSerice {
public static final String PAY_URL = "https://api.mch.weixin.qq.com/pay/unifiedorder"; public static final String PAY_URL = "https://api.mch.weixin.qq.com/pay/unifiedorder";
@Resource @Resource
private OshServicesOrderMapper oshServicesOrderMapper; private OshServicesOrderMapper oshServicesOrderMapper;
@Resource @Resource
...@@ -68,7 +74,7 @@ public class OshServicesOrderSerice { ...@@ -68,7 +74,7 @@ public class OshServicesOrderSerice {
imageList.add(str); imageList.add(str);
} }
} }
item.put("imageUrls",imageList); item.put("imageUrls", imageList);
} }
map.put("videoList", videoList); map.put("videoList", videoList);
return map; return map;
...@@ -142,7 +148,7 @@ public class OshServicesOrderSerice { ...@@ -142,7 +148,7 @@ public class OshServicesOrderSerice {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public String payBack(HttpServletRequest request) { public String payBack(HttpServletRequest request) {
String resXml = HttpUtils.parse(request); String resXml = HttpUtils.parse(request);
log.error("------------支付回调进入:"+resXml); log.error("------------支付回调进入:" + resXml);
WXConfigUtil config = null; WXConfigUtil config = null;
try { try {
config = new WXConfigUtil(); config = new WXConfigUtil();
...@@ -208,10 +214,10 @@ public class OshServicesOrderSerice { ...@@ -208,10 +214,10 @@ public class OshServicesOrderSerice {
String body = "服务订单支付"; String body = "服务订单支付";
data.put("body", body); data.put("body", body);
data.put("out_trade_no", code); data.put("out_trade_no", code);
double price = Double.parseDouble(payPrice)*100; double price = Double.parseDouble(payPrice) * 100;
data.put("total_fee", new Double(price).intValue()+""); data.put("total_fee", new Double(price).intValue() + "");
//自己的服务器IP地址 //自己的服务器IP地址
data.put("spbill_create_ip",SPBILL_CREATE_IP); data.put("spbill_create_ip", SPBILL_CREATE_IP);
//异步通知地址(请注意必须是外网) //异步通知地址(请注意必须是外网)
//http://userapi.atlxm.com/api/services/order/wxPayBack //http://userapi.atlxm.com/api/services/order/wxPayBack
data.put("notify_url", NOTIFY_URL); data.put("notify_url", NOTIFY_URL);
...@@ -228,7 +234,7 @@ public class OshServicesOrderSerice { ...@@ -228,7 +234,7 @@ public class OshServicesOrderSerice {
param.put("appid", config.getAppID()); param.put("appid", config.getAppID());
param.put("partnerid", response.get("mch_id")); param.put("partnerid", response.get("mch_id"));
param.put("prepayid", response.get("prepay_id")); param.put("prepayid", response.get("prepay_id"));
param.put("package", "prepayid="+ response.get("prepay_id")); param.put("package", "prepayid=" + response.get("prepay_id"));
param.put("noncestr", response.get("nonce_str")); param.put("noncestr", response.get("nonce_str"));
param.put("timestamp", System.currentTimeMillis() / 1000 + ""); param.put("timestamp", System.currentTimeMillis() / 1000 + "");
param.put("sign", WXPayUtil.generateSignature(param, config.getKey(), param.put("sign", WXPayUtil.generateSignature(param, config.getKey(),
...@@ -254,10 +260,10 @@ public class OshServicesOrderSerice { ...@@ -254,10 +260,10 @@ public class OshServicesOrderSerice {
String body = "服务订单支付"; String body = "服务订单支付";
data.put("body", body); data.put("body", body);
data.put("out_trade_no", code); data.put("out_trade_no", code);
double price = Double.parseDouble(payPrice)*100; double price = Double.parseDouble(payPrice) * 100;
data.put("total_fee", new Double(price).intValue()+""); data.put("total_fee", new Double(price).intValue() + "");
//自己的服务器IP地址 //自己的服务器IP地址
data.put("spbill_create_ip",SPBILL_CREATE_IP); data.put("spbill_create_ip", SPBILL_CREATE_IP);
//异步通知地址(请注意必须是外网) //异步通知地址(请注意必须是外网)
//http://userapi.atlxm.com/api/services/order/wxPayBack //http://userapi.atlxm.com/api/services/order/wxPayBack
data.put("notify_url", NOTIFY_URL); data.put("notify_url", NOTIFY_URL);
...@@ -265,20 +271,20 @@ public class OshServicesOrderSerice { ...@@ -265,20 +271,20 @@ public class OshServicesOrderSerice {
data.put("trade_type", TRADE_TYPE_H5); data.put("trade_type", TRADE_TYPE_H5);
Map<String, Object> result = Maps.newHashMap(); Map<String, Object> result = Maps.newHashMap();
Map<String, Object> h5Info = Maps.newHashMap(); Map<String, Object> h5Info = Maps.newHashMap();
if("0".equals(payType)){ if ("0".equals(payType)) {
h5Info.put("type","Android"); h5Info.put("type", "Android");
h5Info.put("app_name","安泰乐"); h5Info.put("app_name", "安泰乐");
h5Info.put("package_name","com.atlcare.app"); h5Info.put("package_name", "com.atlcare.app");
}else if("1".equals(payType)){ } else if ("1".equals(payType)) {
h5Info.put("type","IOS"); h5Info.put("type", "IOS");
h5Info.put("app_name","安泰乐"); h5Info.put("app_name", "安泰乐");
h5Info.put("bundle_id","com.atl-life.app"); h5Info.put("bundle_id", "com.atl-life.app");
}else { } else {
h5Info.put("type","Wap"); h5Info.put("type", "Wap");
h5Info.put("wap_url","安泰乐"); //需要提供参数 h5Info.put("wap_url", "安泰乐"); //需要提供参数
h5Info.put("wap_name","待祭祀支付"); h5Info.put("wap_name", "待祭祀支付");
} }
result.put("h5_info",h5Info); result.put("h5_info", h5Info);
data.put("scene_info", result.toString()); data.put("scene_info", result.toString());
//附加数据,在查询API和支付通知中原样返回,该字段主要用于商户携带订单的自定义数据 //附加数据,在查询API和支付通知中原样返回,该字段主要用于商户携带订单的自定义数据
/* data.put("sign", WXPayUtil.generateSignature(data, config.getKey(), /* data.put("sign", WXPayUtil.generateSignature(data, config.getKey(),
...@@ -289,14 +295,14 @@ public class OshServicesOrderSerice { ...@@ -289,14 +295,14 @@ public class OshServicesOrderSerice {
if ("SUCCESS".equals(response.get("return_code"))) {//主要返回以下5个参数 if ("SUCCESS".equals(response.get("return_code"))) {//主要返回以下5个参数
Map<String, String> param = new HashMap<>(); Map<String, String> param = new HashMap<>();
param.put("appId", config.getAppID()); param.put("appId", config.getAppID());
param.put("package", "prepay_id="+response.get("prepay_id")); param.put("package", "prepay_id=" + response.get("prepay_id"));
param.put("nonceStr", response.get("nonce_str")); param.put("nonceStr", response.get("nonce_str"));
param.put("timeStamp", System.currentTimeMillis() / 1000 + ""); param.put("timeStamp", System.currentTimeMillis() / 1000 + "");
param.put("signType", "MD5"); param.put("signType", "MD5");
String sign = WXPayUtil.generateSignature(param, config.getKey(), String sign = WXPayUtil.generateSignature(param, config.getKey(),
WXPayConstants.SignType.MD5); WXPayConstants.SignType.MD5);
param.put("sign", sign); param.put("sign", sign);
log.info("返回app接口:"+param.toString()); log.info("返回app接口:" + param.toString());
return param; return param;
} }
} catch (Exception e) { } catch (Exception e) {
...@@ -318,29 +324,30 @@ public class OshServicesOrderSerice { ...@@ -318,29 +324,30 @@ public class OshServicesOrderSerice {
String body = "服务订单支付"; String body = "服务订单支付";
data.put("body", body); data.put("body", body);
data.put("out_trade_no", code); data.put("out_trade_no", code);
double price = Double.parseDouble(payPrice)*100; double price = Double.parseDouble(payPrice) * 100;
data.put("total_fee", new Double(price).intValue()+""); data.put("total_fee", new Double(price).intValue() + "");
//自己的服务器IP地址 //自己的服务器IP地址
data.put("spbill_create_ip",SPBILL_CREATE_IP); data.put("spbill_create_ip", SPBILL_CREATE_IP);
//异步通知地址(请注意必须是外网) //异步通知地址(请注意必须是外网)
//http://userapi.atlxm.com/api/services/order/wxPayBack //http://userapi.atlxm.com/api/services/order/wxPayBack
data.put("notify_url", NOTIFY_URL); data.put("notify_url", NOTIFY_URL);
//交易类型 //交易类型
data.put("trade_type", TRADE_TYPE_JSAPI); data.put("trade_type", TRADE_TYPE_JSAPI);
data.put("openid", openId); data.put("openid", openId);
log.info("JSAPI支付请求参数未---->" + data.toString());
Map<String, String> response = wxpay.unifiedOrder(data); Map<String, String> response = wxpay.unifiedOrder(data);
log.info(response.toString()); log.info("JSAPI参数返回结果 为---->" + response.toString());
if ("SUCCESS".equals(response.get("return_code"))) {//主要返回以下5个参数 if ("SUCCESS".equals(response.get("return_code"))) {//主要返回以下5个参数
Map<String, String> param = new HashMap<>(); Map<String, String> param = new HashMap<>();
param.put("appId", config.getAppID()); param.put("appId", config.getAppID());
param.put("package", "prepay_id="+response.get("prepay_id")); param.put("package", "prepay_id=" + response.get("prepay_id"));
param.put("nonceStr", response.get("nonce_str")); param.put("nonceStr", response.get("nonce_str"));
param.put("timeStamp", System.currentTimeMillis() / 1000 + ""); param.put("timeStamp", System.currentTimeMillis() / 1000 + "");
param.put("signType", "MD5"); param.put("signType", "MD5");
String sign = WXPayUtil.generateSignature(param, config.getKey(), String sign = WXPayUtil.generateSignature(param, config.getKey(),
WXPayConstants.SignType.MD5); WXPayConstants.SignType.MD5);
param.put("sign", sign); param.put("sign", sign);
log.info("返回app接口:"+param.toString()); log.info("返回app接口:" + param.toString());
return param; return param;
} }
} catch (Exception e) { } catch (Exception e) {
...@@ -362,10 +369,10 @@ public class OshServicesOrderSerice { ...@@ -362,10 +369,10 @@ public class OshServicesOrderSerice {
String body = "服务订单支付"; String body = "服务订单支付";
data.put("body", body); data.put("body", body);
data.put("out_trade_no", code); data.put("out_trade_no", code);
double price = Double.parseDouble(payPrice)*100; double price = Double.parseDouble(payPrice) * 100;
data.put("total_fee", new Double(price).intValue()+""); data.put("total_fee", new Double(price).intValue() + "");
//自己的服务器IP地址 //自己的服务器IP地址
data.put("spbill_create_ip",SPBILL_CREATE_IP); data.put("spbill_create_ip", SPBILL_CREATE_IP);
//异步通知地址(请注意必须是外网) //异步通知地址(请注意必须是外网)
//http://userapi.atlxm.com/api/services/order/wxPayBack //http://userapi.atlxm.com/api/services/order/wxPayBack
data.put("notify_url", NOTIFY_URL); data.put("notify_url", NOTIFY_URL);
...@@ -377,14 +384,14 @@ public class OshServicesOrderSerice { ...@@ -377,14 +384,14 @@ public class OshServicesOrderSerice {
if ("SUCCESS".equals(response.get("return_code"))) {//主要返回以下5个参数 if ("SUCCESS".equals(response.get("return_code"))) {//主要返回以下5个参数
Map<String, String> param = new HashMap<>(); Map<String, String> param = new HashMap<>();
param.put("appId", config.getAppID()); param.put("appId", config.getAppID());
param.put("package", "prepay_id="+response.get("prepay_id")); param.put("package", "prepay_id=" + response.get("prepay_id"));
param.put("nonceStr", response.get("nonce_str")); param.put("nonceStr", response.get("nonce_str"));
param.put("timeStamp", System.currentTimeMillis() / 1000 + ""); param.put("timeStamp", System.currentTimeMillis() / 1000 + "");
param.put("signType", "MD5"); param.put("signType", "MD5");
String sign = WXPayUtil.generateSignature(param, config.getKey(), String sign = WXPayUtil.generateSignature(param, config.getKey(),
WXPayConstants.SignType.MD5); WXPayConstants.SignType.MD5);
param.put("sign", sign); param.put("sign", sign);
log.info("返回app接口:"+param.toString()); log.info("返回app接口:" + param.toString());
return param; return param;
} }
} catch (Exception e) { } catch (Exception e) {
...@@ -395,9 +402,78 @@ public class OshServicesOrderSerice { ...@@ -395,9 +402,78 @@ public class OshServicesOrderSerice {
} }
public List<Map<String, Object>> videoAndImageList(Long orderId){ public List<Map<String, Object>> videoAndImageList(Long orderId) {
return oshServicesOrderMapper.videoAndImageList(orderId); return oshServicesOrderMapper.videoAndImageList(orderId);
} }
/**
* 根据时光纪查询 订单List
*
* @param queryOrderRelationTimeParam
* @return
*/
public CommonPage<OshServicesOrderDTO> selectTimesNumberByTimeId(QueryOrderRelationTimeParam queryOrderRelationTimeParam, Page page) {
if (page != null && page.getPageNum() != null && page.getPageSize() != null) {
PageHelper.startPage(page.getPageNum(), page.getPageSize());
}
List<OshServicesOrderDTO> oshServicesOrderDTOList = this.oshServicesOrderMapper.selectOrderListByTimeId(queryOrderRelationTimeParam);
//记录下 pagehelper第一次分页查询的 返回得总条数 等信息
PageInfo<OshServicesOrderDTO> pageInfo = new PageInfo<>(oshServicesOrderDTOList);
oshServicesOrderDTOList = oshServicesOrderDTOList.stream().map(item -> {
item.setOshServicesOrderItemDTOList(this.oshServicesOrderMapper.selectOrderItemListByOrderId(item.getId()));
return item;
}).collect(Collectors.toList());
//因为进行了第二次查询 所以pageHelp得分页总数得到了变化 导致不准确 因此我们需要手动校准一下
CommonPage<OshServicesOrderDTO> result = new CommonPage<OshServicesOrderDTO>();
result.setTotalPage(pageInfo.getPages());
result.setPageNum(pageInfo.getPageNum());
result.setPageSize(pageInfo.getPageSize());
result.setTotal(pageInfo.getTotal());
result.setList(oshServicesOrderDTOList);
return result;
}
/**
* 获取时光纪相关纪念次数 以及 订单总金额
*
* @param queryOrderRelationTimeParam
* @return
*/
public JsonResult getOrderTimesNumber(QueryOrderRelationTimeParam queryOrderRelationTimeParam) {
if (queryOrderRelationTimeParam.getRelationTimeId() == null) {
return JsonResult.failed("传入时光纪id为空");
}
//返回查询的数据
Map<String, Object> dataMap = new HashMap<>();
//查询支付订单次数
dataMap.put("纪念人次", this.oshServicesOrderMapper.selectPayOrderTimes(queryOrderRelationTimeParam));
dataMap.put("活跃值", this.oshServicesOrderMapper.selectPayOrderTotalPrice(queryOrderRelationTimeParam));
return JsonResult.success("获取成功", dataMap);
}
/**
* 查询纪念排行人数数据
*
* @param queryOrderRelationTimeParam
* @return
*/
public CommonPage<OshServicesOrderDTO> selectOrderListGroupByUserId(QueryOrderRelationTimeParam queryOrderRelationTimeParam, Page page) {
if (page != null && page.getPageNum() != null && page.getPageSize() != null) {
PageHelper.startPage(page.getPageNum(), page.getPageSize());
}
List<OshServicesOrderDTO> oshServicesOrderDTOList = this.oshServicesOrderMapper.selectOrderListGroupByUserId(queryOrderRelationTimeParam);
//记录下 pagehelper第一次分页查询的 返回得总条数 等信息
PageInfo<OshServicesOrderDTO> pageInfo = new PageInfo<>(oshServicesOrderDTOList);
//因为进行了第二次查询 所以pageHelp得分页总数得到了变化 导致不准确 因此我们需要手动校准一下
CommonPage<OshServicesOrderDTO> result = new CommonPage<OshServicesOrderDTO>();
result.setTotalPage(pageInfo.getPages());
result.setPageNum(pageInfo.getPageNum());
result.setPageSize(pageInfo.getPageSize());
result.setTotal(pageInfo.getTotal());
result.setList(oshServicesOrderDTOList);
return result;
}
} }
...@@ -5,6 +5,8 @@ import io.swagger.annotations.ApiModel; ...@@ -5,6 +5,8 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.io.Serializable;
/** /**
* JsonResult * JsonResult
* *
...@@ -12,8 +14,7 @@ import lombok.Data; ...@@ -12,8 +14,7 @@ import lombok.Data;
* @date 2018/7/29 22:19 * @date 2018/7/29 22:19
*/ */
@Data @Data
@ApiModel public class JsonResult<T> implements Serializable {
public class JsonResult<T> {
@ApiModelProperty(name = "success", value = "是否正常通讯") @ApiModelProperty(name = "success", value = "是否正常通讯")
private Boolean success = Boolean.TRUE; private Boolean success = Boolean.TRUE;
@ApiModelProperty(name = "status", value = "状态码,200:OK,401:未登录,500:错误") @ApiModelProperty(name = "status", value = "状态码,200:OK,401:未登录,500:错误")
...@@ -22,6 +23,8 @@ public class JsonResult<T> { ...@@ -22,6 +23,8 @@ public class JsonResult<T> {
private String message; private String message;
@ApiModelProperty(name = "data", value = "返回数据") @ApiModelProperty(name = "data", value = "返回数据")
private Object data; private Object data;
@ApiModelProperty(value = "返回结果")
private T result;
public static JsonResult success() { public static JsonResult success() {
JsonResult res = new JsonResult(); JsonResult res = new JsonResult();
......
...@@ -24,7 +24,7 @@ public class WXOfficeConfigUtil implements WXPayConfig { ...@@ -24,7 +24,7 @@ public class WXOfficeConfigUtil implements WXPayConfig {
public static final String APP_SECRET = "4bbb492abc6c12756e4bcbb775ae5069"; public static final String APP_SECRET = "4bbb492abc6c12756e4bcbb775ae5069";
public WXOfficeConfigUtil() throws Exception { public WXOfficeConfigUtil() throws Exception {
String certPath = "/www/wwwroot/userapi.atlxm.com/apiclient_cert.p12"; String certPath = "D:/myWindos/document/项目文档/安泰乐二开项目对接/apiclient_cert.p12";
File file = new File(certPath); File file = new File(certPath);
InputStream certStream = new FileInputStream(file); InputStream certStream = new FileInputStream(file);
this.certData = new byte[(int) file.length()]; this.certData = new byte[(int) file.length()];
......
...@@ -71,6 +71,6 @@ public class OshServicesOrderVo { ...@@ -71,6 +71,6 @@ public class OshServicesOrderVo {
private String payChooseType; private String payChooseType;
@ApiModelProperty(value = "关联app时光纪id",required = false) @ApiModelProperty(value = "关联app时光纪id",required = false)
private Long relationTimeId; private Long relationTimeId;
@ApiModelProperty(value = "关联app的用户id",required = false) @ApiModelProperty(value = "关联app纪念的用户id(谁下的单就是谁的id)",required = false)
private Long relationUserId; private Long relationUserId;
} }
...@@ -189,8 +189,49 @@ ...@@ -189,8 +189,49 @@
<where> <where>
is_del = 0 and order_id = #{orderId} is_del = 0 and order_id = #{orderId}
</where> </where>
</select>
<select id="selectOrderListByTimeId" parameterType="com.atlgroupasia.servicecenter.queryparam.QueryOrderRelationTimeParam" resultType="com.atlgroupasia.servicecenter.dto.OshServicesOrderDTO">
select
a.id,a.create_time createTime,a.status,a.remark,a.total_price totalPrice,a.pay_way payWay,a.pic
from osh_services_order a
where a.relation_time_id =#{relationTimeId}
</select>
<select id="selectOrderItemListByOrderId" parameterType="java.lang.Long" resultType="com.atlgroupasia.servicecenter.dto.OshServicesOrderItemDTO">
select
a.id.a.name,a.num,aprice
from osh_services_order_item a
where a.order_id = #{orderId}
</select>
<select id="selectPayOrderTimes" parameterType="com.atlgroupasia.servicecenter.queryparam.QueryOrderRelationTimeParam" resultType="java.lang.Long">
select IFNULL(count(*),0) from osh_services_order
where pay_price is not null
<if test="relationTimeId != null">
and relation_time_id =#{relationTimeId}
</if>
</select> </select>
<select id="selectPayOrderTotalPrice" parameterType="com.atlgroupasia.servicecenter.queryparam.QueryOrderRelationTimeParam" resultType="java.math.BigDecimal">
select
IFNULL(sum(total_price),0)
from osh_services_order a
where pay_price is not null
<if test="relationTimeId != null">
and relation_time_id =#{relationTimeId}
</if>
</select>
<select id="selectOrderListGroupByUserId" parameterType="com.atlgroupasia.servicecenter.queryparam.QueryOrderRelationTimeParam" resultType="com.atlgroupasia.servicecenter.dto.OshServicesOrderDTO">
select
a.id,a.create_time createTime,a.status,a.remark,a.total_price totalPrice,a.pay_way payWay,a.pic,
IFNULL(count(*),0) times,IFNULL(sum(total_price),0) sumTotalPrice
from osh_services_order a
where a.relation_time_id =#{relationTimeId}
and a.pay_price is not null
group by a.relation_user_id
order by sumTotalPrice desc,a.create_time desc
</select>
</mapper> </mapper>
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