记得上下班打卡 | git大法好,push需谨慎

Commit eeb7a803 authored by zhanggb's avatar zhanggb

Merge remote-tracking branch 'origin/master' into dev_erp

parents 073e1c8a a28fe678
......@@ -17,6 +17,7 @@ public class DragonConstant {
public static final String REFUND_TYPE_APP_UNION="APPUNIONPAY";//,"微信内网页、微信公众号"),
public static final String REFUND_TYPE_APPLET_DOUYIN="APPLETDOUYINPAY";//,"applet 抖音支付"),
public static final String REFUND_TYPE_APPLET_WEPAY="APPLETWEPAY";//,"微信小程序");
public static final String REFUND_TYPE_APPLETB_WEPAY="APPLETBWEPAY";//,"微信小程序B");
public static final String REFUND_TYPE_MICROPAY_WEPAY="MICROPAYWEPAY";//,"扫码枪微信支付");
public static final String REFUND_TYPE_MICROPAY_ALIPAY="MICROPAYALIPAY";//,"扫码枪微信支付");
......@@ -47,7 +48,7 @@ public class DragonConstant {
public enum DeviceFromEnum{
WEB("web",""),WAP("wap",""),WAPPAGE("wappage","")
,APP("app",""),JS("js",""),APPLET("applet",""),MICROPAY("micropay","");
,APP("app",""),JS("js",""),APPLET("applet",""),APPLETB("appletb",""),MICROPAY("micropay","");
private String code;
private String message;
DeviceFromEnum(String code, String message) {
......@@ -186,6 +187,7 @@ public class DragonConstant {
PAYMENT_TYPE_WEB_WEPAY("WEBWEPAY","wepay","web","电脑网页内微信二维码支付,用户打开微信扫码支付"),
PAYMENT_TYPE_JS_WEPAY("JSWEPAY","wepay","js","微信内网页、微信公众号"),
PAYMENT_TYPE_APPLET_WEPAY("APPLETWEPAY","wepay","applet","微信小程序"),
PAYMENT_TYPE_APPLETB_WEPAY("APPLETBWEPAY","wepay","applet","微信小程序"),
PAYMENT_TYPE_MICROPAY_WEPAY("MICROPAYWEPAY","wepay","micropay","微信扫码枪支付"),
PAYMENT_TYPE_APPLET_DOUYINPAY("APPLETDOUYINPAY","douyinpay","applet","抖音小程序"),
PAYMENT_TYPE_WAP_UNIONPAY("WAPUNIONPAY","unionpay","wap","银联wap支付"),
......
......@@ -41,6 +41,8 @@ public class DragonPayBaseReqDto implements Serializable, Cloneable{
//苹果的stransactionId
private String transactionId;
private String appIdType="";
@Override
public String toString(){
return JsonUtils.toJson(this);
......
......@@ -22,11 +22,6 @@
<artifactId>liquidnet-service-goblin-do</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel</artifactId>
<version>3.0.5</version>
</dependency>
<dependency>
<groupId>com.liquidnet</groupId>
<artifactId>liquidnet-service-dragon-api</artifactId>
......
package com.liquidnet.service.goblin.dto.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
/**
* <p>
* 商城订单表
* </p>
*
* @author liquidnet
* @since 2021-12-27
*/
@Data
@EqualsAndHashCode(callSuper = false)
public class GoblinNowOrderDetailsVo implements Serializable, Cloneable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = " 订单id")
private String orderId;
@ApiModelProperty(value = " 订单号")
private String orderCode;
@ApiModelProperty(value = "支付单号")
private String paymentId;
@ApiModelProperty(value = " 商户单号")
private String payCode;
@ApiModelProperty(value = " 支付方式")
private String payType;
@ApiModelProperty(value = " 订单金额")
private String priceActual;
@ApiModelProperty(value = " 支付时间")
private String payTime;
private static final GoblinNowOrderDetailsVo obj = new GoblinNowOrderDetailsVo();
public static GoblinNowOrderDetailsVo getNew() {
try {
return (GoblinNowOrderDetailsVo) obj.clone();
} catch (CloneNotSupportedException e) {
return new GoblinNowOrderDetailsVo();
}
}
}
package com.liquidnet.service.goblin.dto.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
/**
* <p>
* 商城订单表
* </p>
*
* @author liquidnet
* @since 2021-12-27
*/
@Data
@EqualsAndHashCode(callSuper = false)
public class GoblinNowOrderListVo implements Serializable, Cloneable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "订单id")
private String orderId;
@ApiModelProperty(value = "订单号")
private String orderCode;
@ApiModelProperty(value = "订单金额")
private String priceActual;
@ApiModelProperty(value = "支付时间")
private String payTime;
@ApiModelProperty(value = "用户id")
private String userId;
private static final GoblinNowOrderListVo obj = new GoblinNowOrderListVo();
public static GoblinNowOrderListVo getNew() {
try {
return (GoblinNowOrderListVo) obj.clone();
} catch (CloneNotSupportedException e) {
return new GoblinNowOrderListVo();
}
}
}
package com.liquidnet.service.goblin.param;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ApiModel(value = "GoblinNowOrderListParam")
@Data
public class GoblinNowOrderListParam implements Cloneable {
@ApiModelProperty(required = false, value = "页数")
private int page;
@ApiModelProperty(required = true, value = "店铺id")
private String storeId;
@ApiModelProperty(required = true, value = "活动id")
private String marketId;
@ApiModelProperty(required = true, value = "订单号")
private String orderCode;
private static final GoblinNowOrderListParam obj = new GoblinNowOrderListParam();
public static GoblinNowOrderListParam getNew() {
try {
return (GoblinNowOrderListParam) obj.clone();
} catch (CloneNotSupportedException e) {
return new GoblinNowOrderListParam();
}
}
}
package com.liquidnet.service.goblin.service;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.goblin.dto.vo.GoblinSelfMarketingVo;
import com.liquidnet.service.goblin.dto.vo.GoblinShowStoreInfoVo;
import com.liquidnet.service.goblin.dto.vo.GoblinZhengzaiGoodVo;
import com.liquidnet.service.goblin.dto.vo.GoblinZhengzaiPushVo;
import com.liquidnet.service.goblin.dto.vo.*;
import java.util.List;
......@@ -49,6 +46,8 @@ public interface IGoblinAppZhengzaiService {
*/
ResponseDto<List<GoblinZhengzaiPushVo>> orderPushDetails(String offCode,String marketId);
ResponseDto<GoblinAppOrderDetailsVo> orderPushDetailsPos(String offCode, String marketId);
/**
* 订单绑定
* @param uid
......
package com.liquidnet.service.goblin.service;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.goblin.dto.GoblinZhengzaiMarketOrderExcelDto;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
public interface IGoblinExportService {
List<GoblinZhengzaiMarketOrderExcelDto> exportZhengzaiMarketOrder(Map<String, Object> paramMap);
//导出商城订单信息
ResponseDto<String> exportMallOrder(HttpServletResponse response, String beginTime, String endTime, String state, Integer mailType,String storeId);
}
package com.liquidnet.service.goblin.service;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.goblin.dto.vo.GoblinAppOrderListVo;
import com.liquidnet.service.goblin.dto.vo.GoblinSelfMarketingVo;
import com.liquidnet.service.goblin.dto.vo.GoblinZhengzaiGoodPageVo;
import com.liquidnet.service.goblin.dto.vo.GoblinZhengzaiGoodVo;
import com.liquidnet.service.goblin.dto.vo.*;
import com.liquidnet.service.goblin.param.GoblinNowOrderListParam;
import java.util.List;
......@@ -30,4 +28,8 @@ public interface IGoblinStoreZhengzaiService {
ResponseDto<List<GoblinAppOrderListVo>> orderList(int page);
ResponseDto<Boolean> orderPush(String orderMasterCode);
ResponseDto<List<GoblinNowOrderListVo>> nowOrderList(GoblinNowOrderListParam param);
ResponseDto<GoblinAppOrderDetailsVo> nowOrderDetails(GoblinNowOrderListParam param);
}
......@@ -489,7 +489,9 @@
// busiName = selectThreeName;
}
if (typeOne == 2) {
useScope = 80;
if (goodsId) {
useScope = 80;
}
busiId = goodsId;
busiName = $("#searchIpt2").val() || '全部商品';
}
......
......@@ -532,7 +532,9 @@
// busiName = selectThreeName;
}
if (typeOne == 2) {
useScope = 80;
if (goodsId) {
useScope = 80;
}
busiId = goodsId;
busiName = $("#searchIpt2").val() || '全部商品';
}
......
......@@ -53,24 +53,22 @@
<body class="gray-bg">
<div class="container-div">
<div class="row">
<!-- <div class="col-sm-12 search-collapse">-->
<!-- <form id="formId">-->
<!-- <div class="select-list">-->
<!-- <ul>-->
<!-- <li>-->
<!-- <label>手机号:</label>-->
<!-- <input type="text" name="activityTitle"/>-->
<!-- </li>-->
<!-- <li>-->
<!-- <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i-->
<!-- class="fa fa-search"></i>&nbsp;搜索</a>-->
<!--&lt;!&ndash; <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i&ndash;&gt;-->
<!--&lt;!&ndash; class="fa fa-refresh"></i>&nbsp;重置</a>&ndash;&gt;-->
<!-- </li>-->
<!-- </ul>-->
<!-- </div>-->
<!-- </form>-->
<!-- </div>-->
<div class="col-sm-12 search-collapse">
<form id="formId">
<div class="select-list">
<ul>
<li>
<label>名称:</label>
<input type="text" name="name"/>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
class="fa fa-search"></i>&nbsp;搜索</a>
</li>
</ul>
</div>
</form>
</div>
<div class="col-sm-12 select-table table-bordered">
<table id="bootstrap-table"></table>
</div>
......
......@@ -35,6 +35,7 @@ import com.liquidnet.service.smile.entity.SmilePrice;
import com.liquidnet.service.smile.entity.SmileSchool;
import com.liquidnet.service.smile.entity.SmileUser;
import com.liquidnet.service.smile.entity.dto.ShowBaseVoDto;
import com.liquidnet.service.smile.entity.dto.SmilePriceIdPhoneDao;
import com.liquidnet.service.smile.mapper.SmileAgentMapper;
import com.liquidnet.service.smile.mapper.SmilePriceMapper;
import com.liquidnet.service.smile.mapper.SmileSchoolMapper;
......@@ -101,7 +102,7 @@ public class SmileShowServiceImpl extends ServiceImpl<SmileSchoolMapper, SmileSc
PageHelper.startPage(smileShowParam.getPageNum(), smileShowParam.getPageSize());
TableDataInfo rspData = new TableDataInfo();
//查询所有代理的演出id
List<KylinPerformancesDto> kylinPerformancesList = kylinPerformancesMapper.selectPerIdByAgent();
List<KylinPerformancesDto> kylinPerformancesList = kylinPerformancesMapper.selectPerIdByAgent(smileShowParam.getName());
List<ShowVo> showVoList = kylinPerformancesList.stream().map(kylinPerformancesDto -> {
ShowVo vo = ShowVo.getNew().copy(kylinPerformancesDto);
Integer ordNum = kylinOrderTicketRelationsMapper.concatByAgentDed(kylinPerformancesDto.getPerformancesId());
......@@ -351,16 +352,15 @@ public class SmileShowServiceImpl extends ServiceImpl<SmileSchoolMapper, SmileSc
//创建list长度定位分组数量
List<UserData> userDataList = new ArrayList<>();
//已打款跳出循环,去打款表中获取打款记录
LambdaQueryWrapper<SmilePrice> lambdaQueryWrapper = Wrappers.lambdaQuery(SmilePrice.class);
lambdaQueryWrapper.eq(SmilePrice::getPerformancesId, performancesId);
lambdaQueryWrapper.isNotNull(SmilePrice::getUid);
lambdaQueryWrapper.eq(SmilePrice::getDelTag, 0);
List<SmilePrice> smilePrices = smilePriceMapper.selectList(lambdaQueryWrapper);
for (SmilePrice smilePrice : smilePrices) {
List<SmilePriceIdPhoneDao> smilePrices = smileUserMapper.selectPriceIdPhone(performancesId);
for (SmilePriceIdPhoneDao smilePrice : smilePrices) {
if (smilePrice.getRecord() != null && !"".equals(smilePrice.getRecord())) {
UserData userData = JSON.parseObject(smilePrice.getRecord(), UserData.class);
//保存打款标识
userData.setPriceStatus(smileRedisUtils.getShowPriceUid(performancesId, userData.getUid()));
userData.setPhone(smilePrice.getPhone());
userData.setIdCard(smilePrice.getIdCard());
userData.setAgentName(smilePrice.getName());
userDataList.add(userData);
ids.add(userData.getUid());
}
......@@ -436,8 +436,8 @@ public class SmileShowServiceImpl extends ServiceImpl<SmileSchoolMapper, SmileSc
userData.setUsername(showBaseVoDtoList.get(0).getName());
userData.setCityName(showBaseVoDtoList.get(0).getCity());
userData.setType(showBaseVoDtoList.get(0).getType());
userData.setPhone(showBaseVoList.get(0).getPhone());
userData.setIdCard(showBaseVoList.get(0).getIdCard());
userData.setPhone(showBaseVoDtoList.get(0).getPhone());
userData.setIdCard(showBaseVoDtoList.get(0).getIdCard());
userData.setState(showBaseVoDtoList.get(0).getState());
if (userData.getType() != 2) {
userData.setAgentName(showBaseVoDtoList.get(0).getName());
......
......@@ -76,6 +76,13 @@ public abstract class DateUtil {
return LocalDateTime.parse(str, formatter);
}
public LocalDate parse2LocalDate(String str) {
if (null == str || str.trim().length() <= 0) {
return null;
}
return LocalDate.parse(str, formatter);
}
}
/**
......
......@@ -22,6 +22,7 @@ public class IDGenerator {
return nextMilliId().concat(s.substring(s.length() - 7));
}
public static String nextTimeId2() {
String s = String.valueOf(System.nanoTime());
return nextMilliId2().concat(s.substring(s.length() - 7));
......@@ -112,6 +113,10 @@ public class IDGenerator {
public static String payCode() {
return "PAY" + nextTimeId();
}
public static String payCodeByType() {
return "PAYB" + nextTimeId();
}
public static String getZxlNftImageCosCode() {
return "ZXLNFTIMAGE" + nextTimeId();
......
......@@ -212,6 +212,9 @@ liquidnet:
smile:
appid: wx4956704fe769112c
secret: 645919ab4a4c48eb8e73aea38752adfa
modern:
appid: wxe3a093ce7278d5b1
secret: 14d531f87dffd3cbbd668ae9f475f1ff
umeng:
ios:
appkey: 54fe819bfd98c546b50004f0
......
......@@ -212,6 +212,9 @@ liquidnet:
smile:
appid: wx4956704fe769112c
secret: 645919ab4a4c48eb8e73aea38752adfa
modern:
appid: wxe3a093ce7278d5b1
secret: 14d531f87dffd3cbbd668ae9f475f1ff
umeng:
ios:
appkey: 54fe819bfd98c546b50004f0
......
......@@ -212,6 +212,9 @@ liquidnet:
smile:
appid: wx4956704fe769112c
secret: 645919ab4a4c48eb8e73aea38752adfa
modern:
appid: wxe3a093ce7278d5b1
secret: 14d531f87dffd3cbbd668ae9f475f1ff
umeng:
ios:
appkey: 54fe819bfd98c546b50004f0
......
......@@ -212,6 +212,9 @@ liquidnet:
smile:
appid: wx4956704fe769112c
secret: 645919ab4a4c48eb8e73aea38752adfa
modern:
appid: wxe3a093ce7278d5b1
secret: 14d531f87dffd3cbbd668ae9f475f1ff
umeng:
ios:
appkey: 54fe819bfd98c546b50004f0
......
......@@ -16,4 +16,12 @@
<maven.compiler.target>8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel</artifactId>
<version>${easyexcel.version}</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
package com.liquidnet.service.goblin.dto;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
* select gso.order_id '订单ID',
* gso.user_mobile as '用户手机号',
* gos.spu_name '商品名称',
* gsm.name '活动名称',
* gsi.store_name '店铺名称',
* gso.order_code '订单编号',
* gso.pay_code '商户单号',
* gso.status '状态',
* if(gso.device_from = 'micropay', 'pos机订单', '线上订单') as 支付来源,
* gos.push_time as '核销时间',
* if(gso.status in (2, 3, 4), '已付款', '已退款') as '订单状态',
* (case gso.pay_type
* when 'wepay' then '微信支付'
* when 'alipay' then '支付宝支付'
* when 'huifu' then '汇付'
* when 'unionpay' then '云闪付'
* when 'pos_crash' then '现金支付'
* else '0元付' end)
* '支付类型',
* gos.num '数量',
* gos.sku_price '商品单价',
* gos.sku_price_actual '实际支付价格',
* gos.price_voucher '优惠金额',
* gso.created_at '订单创建时间'
* from goblin_store_order gso
* inner join goblin_order_sku gos on gos.order_id = gso.order_id
* inner join goblin_store_info gsi on gsi.store_id = gso.store_id
* inner join goblin_self_marketing gsm on gsm.self_market_id = SUBSTRING_INDEX(gso.market_id, 'ZZ', -1)
* where gso.status not in (0, 5)
* and gso.market_id = 'ZZ223161701266386447667'
* # and gsi.store_name = '摩登天空官方周边售卖'
* order by gso.created_at desc;
*/
@Getter
@Setter
public class GoblinZhengzaiMarketOrderExcelDto implements Serializable, Cloneable {
private static final long serialVersionUID = -2804101458736599181L;
@ExcelProperty("商品名称")
private String spuName;
@ExcelProperty("活动名称")
private String marketName;
@ExcelProperty("店铺名称")
private String storeName;
@ExcelProperty("订单编号")
private String orderCode;
@ExcelProperty("商户单号")
private String payCode;
@ExcelProperty("订单状态")
private String orderStatus;
@ExcelProperty("订单创建时间")
private LocalDateTime createdAt;
@ExcelProperty("核销时间")
private LocalDateTime pushTime;
@ExcelProperty("支付来源")
private String deviceFrom;
@ExcelProperty("支付类型")
private String payType;
@ExcelProperty("购买数量")
private Integer nums;
@ExcelProperty("商品单价")
private BigDecimal skuPrice;
@ExcelProperty("实际支付价格")
private BigDecimal priceActual;
@ExcelProperty("优惠金额")
private BigDecimal priceVoucher;
}
package com.liquidnet.service.goblin.mapper;
import com.liquidnet.service.goblin.dto.GoblinZhengzaiMarketOrderExcelDto;
import com.liquidnet.service.goblin.dto.MallOrdertDao;
import com.liquidnet.service.goblin.entity.GoblinStoreOrder;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
......@@ -7,6 +8,7 @@ import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* <p>
......@@ -21,4 +23,5 @@ public interface GoblinStoreOrderMapper extends BaseMapper<GoblinStoreOrder> {
List<MallOrdertDao> exportMallOrder(@Param("beginTime") Date beginTime, @Param("endTime") Date endTime, @Param("states") List<String>
states, @Param("mailType") Integer mailType, @Param("storeId") String storeId);
List<GoblinZhengzaiMarketOrderExcelDto> exportZhengzaiMarketOrder(Map<String, Object> paramMap);
}
......@@ -82,5 +82,41 @@
</where>
group by gos.order_sku_id
</select>
<select id="exportZhengzaiMarketOrder" resultType="com.liquidnet.service.goblin.dto.GoblinZhengzaiMarketOrderExcelDto">
select gos.spu_name spuName,
gsm.name marketName,
gsi.store_name storeName,
gso.order_code orderCode,
gso.pay_code payCode,
if(gso.status in (2, 3, 4), '已付款', '已退款') orderStatus,
gso.created_at createdAt,
gos.push_time pushTime,
if(gso.device_from = 'micropay', 'pos机订单', '线上订单') deviceFrom,
(case gso.pay_type
when 'wepay' then '微信支付'
when 'alipay' then '支付宝支付'
when 'huifu' then '汇付'
when 'unionpay' then '云闪付'
when 'pos_crash' then '现金支付'
else '0元付' end) payType,
gos.num nums,
gos.sku_price skuPrice,
gos.sku_price_actual priceActual,
gos.price_voucher priceVoucher
from goblin_store_order gso
inner join goblin_order_sku gos on gos.order_id = gso.order_id
inner join goblin_store_info gsi on gsi.store_id = gso.store_id
inner join goblin_self_marketing gsm on gsm.self_market_id = SUBSTRING_INDEX(gso.market_id, 'ZZ', -1)
<where>
gso.status not in (0, 5) and gso.store_id = #{storeId,jdbcType=VARCHAR} and gso.market_id = #{marketId,jdbcType=VARCHAR}
<if test="beginTime != null">
and gso.created_at <![CDATA[>=]]> #{beginTime,jdbcType=TIMESTAMP}
</if>
<if test="endTime != null">
and gso.created_at <![CDATA[<=]]> #{endTime,jdbcType=TIMESTAMP}
</if>
</where>
order by gso.created_at desc
</select>
</mapper>
......@@ -68,7 +68,7 @@ public interface KylinPerformancesMapper extends BaseMapper<KylinPerformances> {
List<KylinPerformances> selectByComment();
List<KylinPerformancesDto> selectPerIdByAgent();
List<KylinPerformancesDto> selectPerIdByAgent(@Param("title") String title );
List<KylinPerformancesDao> selectTicketIdByPerId(@Param("performancesId") String performancesId);
......
......@@ -762,13 +762,17 @@ GROUP BY user_mobile,tickets_id;
GROUP BY
kk.performance_id
) AS map ON map.performance_id = kp.performances_id
WHERE
kp.performances_id IN ( SELECT sa.performance_id FROM smile_agent AS sa WHERE sa.del_tag = 0 GROUP BY sa.performance_id )
<where>
kp.performances_id IN ( SELECT sa.performance_id FROM smile_agent AS sa WHERE sa.del_tag = 0 GROUP BY sa.performance_id )
<if test="title!=''">
AND kp.title LIKE concat('%', #{title}, '%')
</if>
</where>
GROUP BY
sa.performance_id
ORDER BY
kp.COMMENT DESC,
kp.time_start DESC
kp.title DESC
</select>
<select id="getListAll" resultType="com.liquidnet.service.kylin.dao.report.KylinPerformancesDto">
......
package com.liquidnet.service.smile.entity.dto;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
* <p>
*
* </p>
*
* @author liquidnet
* @since 2022-03-22
*/
@Data
@EqualsAndHashCode(callSuper = false)
public class SmilePriceIdPhoneDao implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 演出id
*/
private String performancesId;
/**
* 用户id
*/
private String uid;
/**
* 打款金额
*/
private BigDecimal price;
/**
* 打款记录保留
*/
private String record;
/**
* 打款标识0:未打款,1:已打款
*/
private Integer status;
/**
* 0:未删除,1:已删除
*/
private Integer delTag;
/**
* 证件号
*/
private String idCard;
/**
* 手机
*/
private String phone;
/**
* 总代名称
*/
private String name;
/**
* 创建时间
*/
private LocalDateTime createdDate;
/**
* 修改时间
*/
private LocalDateTime updatedDate;
private static final SmilePriceIdPhoneDao obj = new SmilePriceIdPhoneDao();
public static SmilePriceIdPhoneDao getNew() {
try {
return (SmilePriceIdPhoneDao) obj.clone();
} catch (CloneNotSupportedException e) {
return new SmilePriceIdPhoneDao();
}
}
}
package com.liquidnet.service.smile.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.liquidnet.service.smile.entity.SmileSchool;
import com.liquidnet.service.smile.entity.SmileUser;
import com.liquidnet.service.smile.entity.dao.SmileUserCheckDao;
import com.liquidnet.service.smile.entity.dto.SmilePriceIdPhoneDao;
import org.apache.ibatis.annotations.Param;
import java.util.List;
......@@ -45,4 +47,6 @@ public interface SmileUserMapper extends BaseMapper<SmileUser> {
List<SmileUser> selectUidByPerId(@Param("performancesId") String performancesId);
List<SmileUser> selectUidByPerIdNotType(@Param("performancesId") String performancesId);
List<SmilePriceIdPhoneDao> selectPriceIdPhone(String performanceId);
}
......@@ -202,4 +202,17 @@
</select>
<select id="selectPriceIdPhone" resultType="com.liquidnet.service.smile.entity.dto.SmilePriceIdPhoneDao">
SELECT
a.*,b.id_card,b.phone,c.name
FROM
smile_price as a
inner join smile_user as b on a.uid = b.uid
inner join smile_user as c on b.agent_id = c.uid
WHERE
performances_id = #{performanceId}
AND a.uid IS NOT NULL
AND a.del_tag = 0
</select>
</mapper>
......@@ -50,7 +50,11 @@ public class DragonServiceCommonBiz {
orders.setClientIp(dragonPayBaseReqDto.getClientIp());
orders.setNotifyUrl(dragonPayBaseReqDto.getNotifyUrl());
orders.setNotifyStatus(Integer.valueOf(DragonConstant.PayNotifyStatusEnum.NOTIFY_INIT.getCode()));
orders.setPaymentType((dragonPayBaseReqDto.getDeviceFrom()+dragonPayBaseReqDto.getPayType()).toUpperCase());
if(dragonPayBaseReqDto.getAppIdType().equals("b")){
orders.setPaymentType((dragonPayBaseReqDto.getDeviceFrom()+dragonPayBaseReqDto.getAppIdType()+dragonPayBaseReqDto.getPayType()).toUpperCase());
}else{
orders.setPaymentType((dragonPayBaseReqDto.getDeviceFrom()+dragonPayBaseReqDto.getPayType()).toUpperCase());
}
// orders.setPaymentId();
orders.setPaymentAt(LocalDateTime.now());
// orders.setFinishedAt();
......
......@@ -41,7 +41,11 @@ public class WepayBiz{
Map<String, Object> respMap = new HashMap<>();
SortedMap<String, Object> paramMap = new TreeMap<>();
paramMap.put("appid", appid);
paramMap.put("mch_id", merchantId);
if (outTradeNo.contains("b")) {
paramMap.put("mch_id", PayWepayUtils.getInstance().getMerchantBId());
}else{
paramMap.put("mch_id", merchantId);
}
String nonce_str = PayWepayUtils.getInstance().getNonceStr();
paramMap.put("nonce_str", nonce_str);
paramMap.put("out_trade_no", outTradeNo);
......
......@@ -171,7 +171,11 @@ public abstract class AbstractWepayStrategy implements IWepayStrategy {
protected SortedMap<String, Object> buildRequestParamMap(DragonPayBaseReqDto dragonPayBaseReqDto){
String nonceStr = PayWepayUtils.getInstance().getNonceStr();
SortedMap<String, Object> parameters = new TreeMap<>();
parameters.put("mch_id", PayWepayUtils.getInstance().getMerchantId());
if(dragonPayBaseReqDto.getAppIdType().equals("b")){
parameters.put("mch_id", PayWepayUtils.getInstance().getMerchantBId());
}else{
parameters.put("mch_id", PayWepayUtils.getInstance().getMerchantId());
}
parameters.put("nonce_str", nonceStr);
parameters.put("spbill_create_ip", dragonPayBaseReqDto.getClientIp());
parameters.put("total_fee", dragonPayBaseReqDto.getPrice().multiply(BigDecimal.valueOf(100L)).intValue()+"");
......@@ -210,7 +214,12 @@ public abstract class AbstractWepayStrategy implements IWepayStrategy {
@Override
public DragonPayOrderQueryRespDto checkOrderStatus(String code) {
DragonOrdersDto ordersDto = dataUtils.getPayOrderByCode(code);
Map<String, Object> resultMap = wepayBiz.tradeQuery(code,this.getAppid());
Map<String, Object> resultMap=null;
if(code.contains("b")){
resultMap = wepayBiz.tradeQuery(code, PayWepayUtils.getInstance().getAPPLETB_APPID());
}else{
resultMap = wepayBiz.tradeQuery(code,this.getAppid());
}
DragonPayOrderQueryRespDto respDto = dragonPayBiz.buildPayOrderQueryRespDto(ordersDto);
Object returnCode = resultMap.get("return_code");
......
......@@ -32,7 +32,11 @@ public class WepayStrategyAppletImpl extends AbstractWepayStrategy{
@Override
SortedMap<String, Object> appendRequestParam(SortedMap<String, Object> requestMap, DragonPayBaseReqDto dragonPayBaseReqDto) {
requestMap.put("trade_type", "JSAPI");
requestMap.put("appid", PayWepayUtils.getInstance().getAPPLET_APP_ID());
if(dragonPayBaseReqDto.getAppIdType().equals("b")){
requestMap.put("appid", PayWepayUtils.getInstance().getAPPLETB_APPID());
}else{
requestMap.put("appid", PayWepayUtils.getInstance().getAPPLET_APP_ID());
}
requestMap.put("openid", dragonPayBaseReqDto.getOpenId()); //只有trade_type="JSAPI"时必须传
return requestMap;
}
......
......@@ -82,7 +82,7 @@ public class PayController {
long startTime = System.currentTimeMillis();
//为什么在js和applet中才需要判断open_id?
if (payType.equalsIgnoreCase(DragonConstant.PayChannelEnum.WEPAY.getCode())) {
if (deviceFrom.equalsIgnoreCase(DragonConstant.DeviceFromEnum.JS.getCode()) || deviceFrom.equalsIgnoreCase(DragonConstant.DeviceFromEnum.APPLET.getCode())) {
if (deviceFrom.equalsIgnoreCase(DragonConstant.DeviceFromEnum.JS.getCode())||deviceFrom.equalsIgnoreCase(DragonConstant.DeviceFromEnum.APPLETB.getCode()) || deviceFrom.equalsIgnoreCase(DragonConstant.DeviceFromEnum.APPLET.getCode())) {
if (StringUtil.isEmpty(openId)) {
return ResponseDto.failure("微信支付openId不能为空!");
}
......@@ -91,6 +91,10 @@ public class PayController {
DragonPayBaseReqDto dragonPayBaseReqDto = DragonPayBaseReqDto.getNew();
dragonPayBaseReqDto.setPayType(payType);
dragonPayBaseReqDto.setDeviceFrom(deviceFrom);
if(deviceFrom.equals("appletb")){
dragonPayBaseReqDto.setDeviceFrom("applet");
dragonPayBaseReqDto.setAppIdType("b");
}
dragonPayBaseReqDto.setOpenId(openId);
dragonPayBaseReqDto.setType(type);
dragonPayBaseReqDto.setPrice(price);
......
......@@ -122,6 +122,9 @@ public class DragonOrderRefundsServiceImpl implements IDragonOrderRefundsService
case DragonConstant.REFUND_TYPE_APPLET_WEPAY:
dto = weyPayRefund(code, orderRefundCode, code, reason, price, priceTotal, paymentId, paymentType, localWePayCallBackUrl, nowTime);
break;
case DragonConstant.REFUND_TYPE_APPLETB_WEPAY:
dto = weyPayRefund(code, orderRefundCode, code, reason, price, priceTotal, paymentId, paymentType, localWePayCallBackUrl, nowTime);
break;
case DragonConstant.REFUND_TYPE_APPLET_DOUYIN:
dataUtils.setOrderCode(orderRefundCode, orderCode);
dto = douYinRefund(code, orderRefundCode, code, reason, price, priceTotal, paymentId, paymentType, localDouYinCallBackUrl, nowTime);
......@@ -414,6 +417,9 @@ public class DragonOrderRefundsServiceImpl implements IDragonOrderRefundsService
parameters.put("appid", PayWepayUtils.getInstance().getAPP_ID());
} else if (paymentType.equalsIgnoreCase(DragonConstant.PayTypeEnum.PAYMENT_TYPE_APPLET_WEPAY.getCode())) {
parameters.put("appid", PayWepayUtils.getInstance().getAPPLET_APP_ID());
}else if(paymentType.equalsIgnoreCase(DragonConstant.PayTypeEnum.PAYMENT_TYPE_APPLETB_WEPAY.getCode())){
parameters.put("appid", PayWepayUtils.getInstance().getAPPLETB_APPID());
parameters.put("mch_id", PayWepayUtils.getInstance().getMerchantBId());
} else if (paymentType.equalsIgnoreCase(DragonConstant.PayTypeEnum.PAYMENT_TYPE_WAP_WEPAY.getCode())) {
parameters.put("appid", PayWepayUtils.getInstance().getWAP_APP_ID());
}else if(paymentType.equalsIgnoreCase(DragonConstant.PayTypeEnum.PAYMENT_TYPE_MICROPAY_WEPAY.getCode())){
......@@ -434,7 +440,12 @@ public class DragonOrderRefundsServiceImpl implements IDragonOrderRefundsService
try {
HttpPost httpost = new HttpPost("https://api.mch.weixin.qq.com/secapi/pay/refund");
httpost.setEntity(new StringEntity(data, "UTF-8"));
CloseableHttpResponse response = PayWepayUtils.getInstance().getHttpClient().execute(httpost);
CloseableHttpResponse response=null;
if(code.contains("B")){
response = PayWepayUtils.getInstance().getHttpClientB().execute(httpost);
}else{
response = PayWepayUtils.getInstance().getHttpClient().execute(httpost);
}
try {
HttpEntity entity = response.getEntity();
entity.getContent();
......
......@@ -56,7 +56,11 @@ public class DragonOrdersServiceImpl implements IDragonOrdersService {
@Override
public ResponseDto<DragonPayBaseRespDto> dragonPay(DragonPayBaseReqDto dragonPayBaseReqDto) {
//设置支付编号
dragonPayBaseReqDto.setCode(IDGenerator.payCode());
if(dragonPayBaseReqDto.getAppIdType().equals("b")){
dragonPayBaseReqDto.setCode(IDGenerator.payCodeByType());
}else{
dragonPayBaseReqDto.setCode(IDGenerator.payCode());
}
log.info("dragon:dragonPay:req:dragonPayBaseReqDto : {}",dragonPayBaseReqDto.toString());
return payChannelStrategyContext.getStrategy(dragonPayBaseReqDto.getPayType()).dragonPay(dragonPayBaseReqDto);
}
......
......@@ -44,6 +44,9 @@ public class PayWepayUtils {
private final String WAP_APP_ID="wx3498304dda39c5a1";
private final String APPLET_APP_ID="wx4732efeaa2b08086";
private final String APPLETB_APPID="wxe3a093ce7278d5b1";
private final String merchantBId="1614003616";
public PayWepayUtils() {
}
......@@ -60,6 +63,14 @@ public class PayWepayUtils {
return APPLET_APP_ID;
}
public String getAPPLETB_APPID() {
return APPLETB_APPID;
}
public String getMerchantBId() {
return merchantBId;
}
public String getJS_APP_ID() {
return JS_APP_ID;
}
......@@ -146,6 +157,45 @@ public class PayWepayUtils {
}
return httpClient;
}
public CloseableHttpClient getHttpClientB() {
try {
if (httpClient == null) {
InputStream certStream = PayWepayUtils.class.getClassLoader().getResourceAsStream("payCert/wepayb/apiclient_cert.p12");
byte[] certData = IOUtils.toByteArray(certStream);
certStream.read(certData);
certStream.close();
KeyStore keyStore = KeyStore.getInstance("PKCS12");
ByteArrayInputStream inputStream = new ByteArrayInputStream(certData);
try {
keyStore.load(inputStream, merchantBId.toCharArray());
} finally {
inputStream.close();
}
SSLContext sslcontext = SSLContexts.custom()
.loadKeyMaterial(keyStore, merchantBId.toCharArray())
.build();
SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(
sslcontext,
SSLConnectionSocketFactory.getDefaultHostnameVerifier());
// 配置同时支持 HTTP 和 HTPPS
Registry<ConnectionSocketFactory> socketFactoryRegistry = RegistryBuilder.<ConnectionSocketFactory>create().register("http", PlainConnectionSocketFactory.getSocketFactory()).register("https", sslsf).build();
// 初始化连接管理器
poolConnManager =new PoolingHttpClientConnectionManager(socketFactoryRegistry);
poolConnManager.setMaxTotal(4000);// 同时最多连接数
// 设置最大路由
poolConnManager.setDefaultMaxPerRoute(2000);
// 初始化httpClient
httpClient = getConnection();
}
} catch (Exception e) {
e.printStackTrace();
}
return httpClient;
}
public static CloseableHttpClient getConnection() {
RequestConfig config = RequestConfig.custom().setConnectTimeout(5000).setConnectionRequestTimeout(5000).setSocketTimeout(5000).build();
......
-----BEGIN CERTIFICATE-----
MIID9jCCAt6gAwIBAgIUNKCBh8ymih18cn2V0/0dlbOVBKMwDQYJKoZIhvcNAQEL
BQAwXjELMAkGA1UEBhMCQ04xEzARBgNVBAoTClRlbnBheS5jb20xHTAbBgNVBAsT
FFRlbnBheS5jb20gQ0EgQ2VudGVyMRswGQYDVQQDExJUZW5wYXkuY29tIFJvb3Qg
Q0EwHhcNMjIwNTE5MDU1NTAzWhcNMjcwNTE4MDU1NTAzWjCBhzETMBEGA1UEAwwK
MTYxNDAwMzYxNjEbMBkGA1UECgwS5b6u5L+h5ZWG5oi357O757ufMTMwMQYDVQQL
DCrkuIrmtbfmkannmbvlpKnnqbrmlofljJbkvKDmkq3mnInpmZDlhazlj7gxCzAJ
BgNVBAYMAkNOMREwDwYDVQQHDAhTaGVuWmhlbjCCASIwDQYJKoZIhvcNAQEBBQAD
ggEPADCCAQoCggEBAMSxROciPdRnfUUIcXox1XLvREeP04ky5J9zp0+k1QPjUEf0
GlvWNjgpUrDWINFVUGA4lbVk0qUU1BKbcev4sfCRsXc0IwdEPjPJxfnXUzNVdseq
4+qgwbWqAo5XtUp4DAZtGdd6W8Waj+VINtB96mk7qQQjSlcriJk8uw4Byz02Al1q
+LyyLLW2xvYvCdTQElIjM8Qft40nzP2W5PMA5oG0+vWy2cQkJUjCCwVyc5ryOmaq
ovdHRMTbtnrkjTK9scXUQ0/aeyXEQzGMlwRjKikChhobLzRhowkeAQRZigPtha0F
R4bNIPAvylwJLunPbXekyAiEONRgz6xc2G/Z6lkCAwEAAaOBgTB/MAkGA1UdEwQC
MAAwCwYDVR0PBAQDAgTwMGUGA1UdHwReMFwwWqBYoFaGVGh0dHA6Ly9ldmNhLml0
cnVzLmNvbS5jbi9wdWJsaWMvaXRydXNjcmw/Q0E9MUJENDIyMEU1MERCQzA0QjA2
QUQzOTc1NDk4NDZDMDFDM0U4RUJEMjANBgkqhkiG9w0BAQsFAAOCAQEAAHbohRmA
Zu2EFyo46evwyYaRcYjEbu31O/1pJx3/7jAQ/FNrxhO6CmfUyugh1lBPka3r9HI2
4yw2vuBhBe/uGk2FSt+IwJXQ8XWCFYDlBAyH/1fM1JkNgxL/feDDbLK3mgHyxYcP
xHABD+Mw1+Mqt9OAuts9710bW6ZPKH+0r9VfakRKI6J6CPUxAP9BuEgQnwCMZv1I
6H4BC+cjQwCSSz0uI1LZgG+kbSX3HSfTudTNPp7G6fk8+4PSSAIdiVOA1BXJqIGk
v8sqj2Omk/svtIrBb5taPUfengFnASM0ebGrsrT13zH0J0D8h7k7eyxi5+arlY53
AuPiPt7HGiAovg==
-----END CERTIFICATE-----
-----BEGIN PRIVATE KEY-----
MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDEsUTnIj3UZ31F
CHF6MdVy70RHj9OJMuSfc6dPpNUD41BH9Bpb1jY4KVKw1iDRVVBgOJW1ZNKlFNQS
m3Hr+LHwkbF3NCMHRD4zycX511MzVXbHquPqoMG1qgKOV7VKeAwGbRnXelvFmo/l
SDbQfeppO6kEI0pXK4iZPLsOAcs9NgJdavi8siy1tsb2LwnU0BJSIzPEH7eNJ8z9
luTzAOaBtPr1stnEJCVIwgsFcnOa8jpmqqL3R0TE27Z65I0yvbHF1ENP2nslxEMx
jJcEYyopAoYaGy80YaMJHgEEWYoD7YWtBUeGzSDwL8pcCS7pz213pMgIhDjUYM+s
XNhv2epZAgMBAAECggEBAL7/AFCNMIsL/1nEjCTDNWkJLD1tTVVh5R1s+d/dyLeg
yTlFsT7ScQ3yGoj7NRzxAj6dU8qz39RLuG9lIKeqdGeNok2FhCovO1OgsC0eyX0E
lXXn3K/ecJvOPfMo+jMZBVxMHxbdizYEE4zqpcepLbIIK+SHvE2PSXK7xUwhs9B3
6EQsJwiiLuzklRS8mU3ycL+3J/OFw/eBYdreulEoZTHYBBskj16XBg+zFzD2uT2g
1RWBetkxlyR2/wfd3maK57CMSTZzx+mIyb8sJoCclXxyDvrv44W5XVrUrsVDh8xI
aDJqOll1N1paxTHXG4p3jNDuPubXmYwozyf1JsarNbECgYEA7J7IFOnxvUdvxW1r
/0l+38v3bg/jJzMvzOsBR3y1LNCxE0LstJf02X+My0D1OBF7ODRpo23kUdyRxKt7
kZ5AGHpEuyzauroCKRCfeaM4mWcGJEDs4rL4Q3wtN9hx9Q7SY0Tgxm8PgxrbBq25
K9yX+yyk7GN3nflF7Et52ITTeY0CgYEA1M1SSlzMKL9t2F1e0uBC5uWbDaWq42H4
9dNm1qc0b8P5LUABA+Vzw32DLl17AdeV0cxGw+rtTMYo53sAm+L54gcRAMc7wruS
2Kzyzd0uc3PMdUxPj4VlABEyzL5uDl78hRFqa2llH0PewKU1Pk/Egk4sUDvn+gu3
woGHlMIicv0CgYEAqPtAIodsJ2Oj89eQH/GJ1SOh4Y0hCPaqNWrDMB1kecvUGdBa
oSJALy/DCcirF06Ms/fiVV9+hePCijR4++aLGa//87g1wNJkBpWjfkfNfOgxX6Sq
R7/OQsuks1Q1FfBu2YvwBmZ8KoH8V0mriyJvu2YHpfXnD/9cK0M/khxRtmUCgYB9
rVkpQ87rTcsg2lvzLLE2TmoZUDsxmR4AiL6WjR9h1pqlx8QRugR5cvnzew/3kYwQ
4JT2hhtpmSp1M2azqgQsIkI/dGrt4fui7dlkDXmug7g/mjbuqzhwJrgaxWiYIi7+
o792+kLXiSzYF3nveAq1blerdwXU3fDD9d3N1C2mPQKBgQChukYrSDo/Kvl7X+o8
/b6Y69O9fpZs823Xo1fz4Y5/ODS2bchthoiNR4VtNvojX/S+ib7fV/Vio1d75DXX
RYLPB7zjyOkeNYt3xbjNjw4fsPORTZTUAGt6kwRHw4DNTA1hb6855WyntdMngwXQ
G6GcrqeUnwrZJwtZe5WOBSz3Jg==
-----END PRIVATE KEY-----
......@@ -22,7 +22,7 @@ public class GoblinAppZhengzaiController {
@Autowired
IGoblinAppZhengzaiService goblinAppZhengzaiService;
// @Autowired
// @Autowired
// IGoblinOrderService goblinOrderService;
@Autowired
IGoblinOrderAppService goblinOrderAppService;
......@@ -81,7 +81,7 @@ public class GoblinAppZhengzaiController {
})
public ResponseDto<Boolean> orderPush(@RequestParam("offCode") @Valid String offCode,
@RequestParam("marketId") @Valid String marketId) {
return goblinAppZhengzaiService.orderPush(offCode, "ZZ" +marketId);
return goblinAppZhengzaiService.orderPush(offCode, "ZZ" + marketId);
}
@PostMapping("orderPushDetails")
......@@ -96,6 +96,18 @@ public class GoblinAppZhengzaiController {
return goblinAppZhengzaiService.orderPushDetails(offCode, "ZZ" + marketId);
}
@PostMapping("orderPushDetailsPos")
@ApiOperation("正在下单-出货详情-Pos")
@ApiResponse(code = 200, message = "接口返回对象参数")
@ApiImplicitParams({
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "offCode", value = "取货码", example = "1"),
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "marketId", value = "活动id", example = "1"),
})
public ResponseDto<GoblinAppOrderDetailsVo> orderPushDetailsPos(@RequestParam("offCode") @Valid String offCode,
@RequestParam("marketId") @Valid String marketId) {
return goblinAppZhengzaiService.orderPushDetailsPos(offCode, "ZZ" + marketId);
}
@PostMapping("orderBind")
@ApiOperation("正在下单-绑定订单号")
@ApiResponse(code = 200, message = "接口返回对象参数")
......
......@@ -3,6 +3,7 @@ package com.liquidnet.service.goblin.controller;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.goblin.dto.manage.GoblinOrderParam;
import com.liquidnet.service.goblin.dto.vo.*;
import com.liquidnet.service.goblin.param.GoblinNowOrderListParam;
import com.liquidnet.service.goblin.service.IGoblinOrderAppService;
import com.liquidnet.service.goblin.service.IGoblinStoreZhengzaiService;
import io.swagger.annotations.*;
......@@ -23,7 +24,7 @@ public class GoblinStoreZhengzaiController {
@Autowired
IGoblinStoreZhengzaiService goblinStoreZhengzaiService;
// @Autowired
// @Autowired
// IGoblinOrderService goblinOrderService;
@Autowired
IGoblinOrderAppService goblinOrderAppService;
......@@ -53,9 +54,9 @@ public class GoblinStoreZhengzaiController {
@ApiImplicitParam(type = "form", required = false, dataType = "String", name = "kw", value = "搜索关键字【1~64位】支持搜索`SPU名称`", example = ""),
})
public ResponseDto<GoblinZhengzaiGoodPageVo> getStoreList2(@RequestParam("marketId") @Valid String marketId,
@RequestParam("page") @Valid Integer page,
@RequestParam(value = "kw", required = false) @Size(min = 1, max = 64, message = "搜索内容长度超出范围1~64位") String keyword) {
return goblinStoreZhengzaiService.getSpuList2(marketId,keyword,page);
@RequestParam("page") @Valid Integer page,
@RequestParam(value = "kw", required = false) @Size(min = 1, max = 64, message = "搜索内容长度超出范围1~64位") String keyword) {
return goblinStoreZhengzaiService.getSpuList2(marketId, keyword, page);
}
@PostMapping("list")
......@@ -95,6 +96,18 @@ public class GoblinStoreZhengzaiController {
return goblinOrderAppService.orderDetails(orderId, null);
}
@PostMapping("now/list")
@ApiOperation("pos根据订单号查询")
public ResponseDto<List<GoblinNowOrderListVo>> nowOrderList(@RequestBody GoblinNowOrderListParam param) {
return goblinStoreZhengzaiService.nowOrderList(param);
}
@PostMapping("now/details")
@ApiOperation("pos根据订单号查询详情")
public ResponseDto<GoblinAppOrderDetailsVo> nowOrderDetails(@RequestBody GoblinNowOrderListParam param) {
return goblinStoreZhengzaiService.nowOrderDetails(param);
}
// @PostMapping("paySuccess")
// @ApiOperation("汇付支付成功回调")
// @ResponseBody
......
......@@ -8,6 +8,7 @@ import com.liquidnet.service.base.constant.MQConst;
import com.liquidnet.service.goblin.constant.GoblinStatusConst;
import com.liquidnet.service.goblin.dto.vo.*;
import com.liquidnet.service.goblin.service.IGoblinAppZhengzaiService;
import com.liquidnet.service.goblin.service.IGoblinOrderAppService;
import com.liquidnet.service.goblin.util.*;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -35,6 +36,8 @@ public class GoblinAppZhengzaiServiceImpl implements IGoblinAppZhengzaiService {
QueueUtils queueUtils;
@Autowired
GoblinOrderUtils orderUtils;
@Autowired
IGoblinOrderAppService goblinOrderAppService;
@Override
......@@ -186,6 +189,38 @@ public class GoblinAppZhengzaiServiceImpl implements IGoblinAppZhengzaiService {
return ResponseDto.success(listVo);
}
@Override
public ResponseDto<GoblinAppOrderDetailsVo> orderPushDetailsPos(String offCode, String marketId) {
String[] orderIds = redisUtils.getOffCode(offCode);
String uid = CurrentUtil.getCurrentUid();
GoblinStoreInfoVo storeInfoVo = redisUtils.getStoreInfoVoByUid(uid);
if (storeInfoVo == null) {
return ResponseDto.failure("参数错误");
}
if (orderIds == null) {
return ResponseDto.failure("订单不存在");
} else {
for (String orderId : orderIds) {
GoblinStoreOrderVo storeOrderVo = redisUtils.getGoblinOrder(orderId);
if (!storeInfoVo.getStoreId().equals(storeOrderVo.getStoreId()) || !(storeOrderVo.getWriteOffCode().equals(offCode))) {
continue;
}
if (storeOrderVo.getStatus().equals(GoblinStatusConst.Status.ORDER_STATUS_0.getValue())) {
return ResponseDto.failure("订单未支付");
}
// if (storeOrderVo.getStatus().equals(GoblinStatusConst.Status.ORDER_STATUS_4.getValue())) {
// return ResponseDto.failure("出货失败,订单已核销");
// }
if (!storeOrderVo.getMarketId().equals(marketId)) {
return ResponseDto.failure("活动不符");
}
ResponseDto<GoblinAppOrderDetailsVo> responseVo = goblinOrderAppService.orderDetails(storeOrderVo.getOrderId(), storeOrderVo.getUserId());
return ResponseDto.success(responseVo.getData());
}
}
return ResponseDto.failure("暂无数据");
}
@Override
public ResponseDto<Boolean> orderBind(String uid, String masterCode) {
String[] orderIds = redisUtils.getMasterCode(masterCode);
......
......@@ -788,7 +788,7 @@ public class GoblinFrontServiceImpl implements GoblinFrontService {
if (StringUtil.isNotBlank(spuids)) {
query.addCriteria(Criteria.where("spuId").nin(spuids.split(",")));
}
query.addCriteria(Criteria.where("delFlg").is("0").and("shelvesStatus").is("3").and("spuAppear").is("0").and("marketId").is(null));
query.addCriteria(Criteria.where("delFlg").is("0").and("shelvesStatus").is("3").and("spuAppear").is("0").and("marketId").is(null).and("cateFid").nin("22196120924543", "22196122839313"));
//redis里面获取排序规则 1、上架时间2、销量3、价格高到低4、价格低到高
......
......@@ -8,6 +8,8 @@ import com.liquidnet.service.base.SqlMapping;
import com.liquidnet.service.base.constant.MQConst;
import com.liquidnet.service.goblin.constant.GoblinStatusConst;
import com.liquidnet.service.goblin.dto.vo.*;
import com.liquidnet.service.goblin.param.GoblinNowOrderListParam;
import com.liquidnet.service.goblin.service.IGoblinOrderAppService;
import com.liquidnet.service.goblin.service.IGoblinStoreZhengzaiService;
import com.liquidnet.service.goblin.util.GoblinMongoUtils;
import com.liquidnet.service.goblin.util.GoblinRedisUtils;
......@@ -38,6 +40,8 @@ public class GoblinStoreZhengzaiServiceImpl implements IGoblinStoreZhengzaiServi
GoblinMongoUtils mongoUtils;
@Autowired
QueueUtils queueUtils;
@Autowired
IGoblinOrderAppService goblinOrderAppService;
@Override
......@@ -75,7 +79,7 @@ public class GoblinStoreZhengzaiServiceImpl implements IGoblinStoreZhengzaiServi
return ResponseDto.failure("店铺不存在");
}
GoblinSelfMarketingVo marketingVo = redisUtils.getSelfMarket(marketId);
if (marketingVo.getStatus()!=null && marketingVo.getStatus() == 7) {
if (marketingVo.getStatus() != null && marketingVo.getStatus() == 7) {
return ResponseDto.failure("活动已停用");
}
//todo
......@@ -115,7 +119,7 @@ public class GoblinStoreZhengzaiServiceImpl implements IGoblinStoreZhengzaiServi
return ResponseDto.failure("店铺不存在");
}
GoblinSelfMarketingVo marketingVo = redisUtils.getSelfMarket(marketId);
if (marketingVo.getStatus()!=null && marketingVo.getStatus() == 7) {
if (marketingVo.getStatus() != null && marketingVo.getStatus() == 7) {
return ResponseDto.failure("活动已停用");
}
//todo
......@@ -126,13 +130,13 @@ public class GoblinStoreZhengzaiServiceImpl implements IGoblinStoreZhengzaiServi
}
// 支持搜索SPU
HashMap map = mongoUtils.getMarketSpuData(marketId,page, keyword,storeId);
HashMap map = mongoUtils.getMarketSpuData(marketId, page, keyword, storeId);
long total = (long) map.get("total");
List<String> hitSpuIdList = (List<String>) map.get("data");
List<GoblinZhengzaiGoodVo> voList = ObjectUtil.getGoblinZhengzaiGoodVoArrayList();
for (String spuId : hitSpuIdList) {
GoblinGoodsInfoVo vo = hitSpuIdList.contains(spuId) ? redisUtils.getGoodsInfoVo(spuId) : null;
GoblinGoodsInfoVo vo = hitSpuIdList.contains(spuId) ? redisUtils.getGoodsInfoVo(spuId) : null;
if (null != vo && vo.getShelvesStatus().equals("3")) {
GoblinZhengzaiGoodVo returnVo = GoblinZhengzaiGoodVo.getNew();
BeanUtils.copyProperties(vo, returnVo);
......@@ -193,6 +197,29 @@ public class GoblinStoreZhengzaiServiceImpl implements IGoblinStoreZhengzaiServi
return ResponseDto.success();
}
@Override
public ResponseDto<List<GoblinNowOrderListVo>> nowOrderList(GoblinNowOrderListParam param) {
String storeId = param.getStoreId();
String marketId = param.getMarketId();
int page = param.getPage();
String orderCode = param.getOrderCode();
List<GoblinNowOrderListVo> data = mongoUtils.getGoblinNowOrderListVo(orderCode, storeId, marketId, page);
return ResponseDto.success(data);
}
@Override
public ResponseDto<GoblinAppOrderDetailsVo> nowOrderDetails(GoblinNowOrderListParam param) {
String storeId = param.getStoreId();
String marketId = param.getMarketId();
String orderCode = param.getOrderCode();
GoblinNowOrderListVo data = mongoUtils.getGoblinNowOrderDetailsVo(orderCode, storeId, marketId);
if(data==null){
return ResponseDto.failure("订单不存在");
}
ResponseDto<GoblinAppOrderDetailsVo> responseVo = goblinOrderAppService.orderDetails(data.getOrderId(), data.getUserId());
return ResponseDto.success(responseVo.getData());
}
//获取 订单剩余可支付时间[S]
private long getRestTime(GoblinStoreOrderVo orderVo) {
long restTime = 0L;
......
......@@ -331,7 +331,7 @@ public class GoblinZhengzaiServiceImpl implements IGoblinZhengzaiService {
redisUtils.setGoodsSkuInfoVo(skuVo);
//mysql
sqlsData.add(new Object[]{bean.getPriceMarketing(),
bean.getStockMarketing(), bean.getBuyFactor(), bean.getBuyRoster(), bean.getBuyLimit(), bean.getUpdatedAt(), params.getSelfMarketId(), params.getStoreId()});
bean.getStockMarketing(), bean.getBuyFactor(), bean.getBuyRoster(), bean.getBuyLimit(), bean.getUpdatedAt(), params.getSelfMarketId(), params.getStoreId(),item.getSkuId()});
marketSkuList.add(skuVo.getSkuId());
priceList.add(bean.getPriceMarketing());
if (bean.getBuyFactor() == 2) {
......
......@@ -654,10 +654,11 @@ public class GoblinMongoUtils {
Query query = Query.query(criteria);
query.with(PageRequest.of(page - 1, pageSize));
query.fields().include("spuId");
query.with(Sort.by(Sort.Order.desc("shelvesAt")));
long total = mongoTemplate.count(query, GoblinStoreMgtGoodsListVo.class, GoblinGoodsInfoVo.class.getSimpleName());
List<GoblinStoreMgtGoodsListVo> goodsListVos = mongoTemplate.find(query, GoblinStoreMgtGoodsListVo.class, GoblinGoodsInfoVo.class.getSimpleName());
map.put("total",total);
map.put("data",CollectionUtils.isEmpty(goodsListVos) ? CollectionUtil.arrayListString() : goodsListVos.stream().map(GoblinStoreMgtGoodsListVo::getSpuId).distinct().collect(Collectors.toList()));
map.put("total", total);
map.put("data", CollectionUtils.isEmpty(goodsListVos) ? CollectionUtil.arrayListString() : goodsListVos.stream().map(GoblinStoreMgtGoodsListVo::getSpuId).distinct().collect(Collectors.toList()));
return map;
}
......@@ -1895,6 +1896,24 @@ public class GoblinMongoUtils {
map.put("total", total);
return map;
}
public List<GoblinNowOrderListVo> getGoblinNowOrderListVo(String orderCode, String storeId, String marketId, Integer pageNum) {
int pageSize = 20;
Criteria criteria = Criteria.where("storeId").is(storeId).and("marketId").is("ZZ".concat(marketId))
.orOperator(Criteria.where("paymentId").is(orderCode), Criteria.where("orderCode").regex("^.*" + orderCode + "$"));
Query query = Query.query(criteria);
query.with(PageRequest.of(pageNum - 1, pageSize)).with(Sort.by(Sort.Order.desc("createdAt")));
List<GoblinNowOrderListVo> list = mongoTemplate.find(query, GoblinNowOrderListVo.class, GoblinStoreOrderVo.class.getSimpleName());
return list;
}
public GoblinNowOrderListVo getGoblinNowOrderDetailsVo(String orderCode, String storeId, String marketId) {
Criteria criteria = Criteria.where("storeId").is(storeId).and("marketId").is("ZZ".concat(marketId)).and("orderCode").is(orderCode);
Query query = Query.query(criteria);
GoblinNowOrderListVo data = mongoTemplate.findOne(query, GoblinNowOrderListVo.class, GoblinStoreOrderVo.class.getSimpleName());
return data;
}
/* ---------------------------------------- ---------------------------------------- */
/* ---------------------------------------- ---------------------------------------- */
}
......@@ -86,7 +86,7 @@ goblin.store.market.updateRelation=UPDATE goblin_store_market_purchasing SET pri
goblin.store.market.delSpuRelation=UPDATE goblin_store_market_purchasing SET del_flag = ?,updated_at = ? WHERE store_market_id =? and store_id =? and spu_id=?
#---- \u5E73\u53F0\u6D3B\u52A8
goblin.self.market.insertRelation=INSERT INTO goblin_marketing_zhengzai (`zhengzai_id`,`self_market_id`,`spu_id`,`sku_id`,`store_id`,`price_marketing`,`stock_marketing`,`buy_factor`,`buy_roster`,`buy_limit`,`del_flag`,`created_at`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?)
goblin.self.market.updateRelation=UPDATE goblin_marketing_zhengzai SET price_marketing=? ,stock_marketing=? , buy_factor=?,buy_roster=?,buy_limit=?,updated_at=? WHERE self_market_id =? and store_id =?
goblin.self.market.updateRelation=UPDATE goblin_marketing_zhengzai SET price_marketing=? ,stock_marketing=? , buy_factor=?,buy_roster=?,buy_limit=?,updated_at=? WHERE self_market_id =? and store_id =? and sku_id = ?
goblin.self.market.delSpuRelation=UPDATE goblin_marketing_zhengzai SET del_flag = ?,updated_at = ? WHERE self_market_id =? and store_id =? and spu_id=?
#---- \u8BA2\u5355\u7ED1\u5B9A[\u6B63\u5728\u4E0B\u5355] \u51FA\u8D27
goblin_order.zhengzai.bind=UPDATE goblin_store_order SET user_id = ? ,updated_at = ? WHERE order_id = ? and (updated_at <= ? or created_at = ? or updated_at is null)
......
......@@ -50,7 +50,11 @@ public class DragonServiceCommonBiz {
orders.setClientIp(dragonPayBaseReqDto.getClientIp());
orders.setNotifyUrl(dragonPayBaseReqDto.getNotifyUrl());
orders.setNotifyStatus(Integer.valueOf(DragonConstant.PayNotifyStatusEnum.NOTIFY_INIT.getCode()));
orders.setPaymentType((dragonPayBaseReqDto.getDeviceFrom()+dragonPayBaseReqDto.getPayType()).toUpperCase());
if(dragonPayBaseReqDto.getAppIdType().equals("b")){
orders.setPaymentType((dragonPayBaseReqDto.getDeviceFrom()+dragonPayBaseReqDto.getAppIdType()+dragonPayBaseReqDto.getPayType()).toUpperCase());
}else{
orders.setPaymentType((dragonPayBaseReqDto.getDeviceFrom()+dragonPayBaseReqDto.getPayType()).toUpperCase());
}
// orders.setPaymentId();
orders.setPaymentAt(LocalDateTime.now());
// orders.setFinishedAt();
......
......@@ -41,7 +41,11 @@ public class WepayBiz{
Map<String, Object> respMap = new HashMap<>();
SortedMap<String, Object> paramMap = new TreeMap<>();
paramMap.put("appid", appid);
paramMap.put("mch_id", merchantId);
if (outTradeNo.contains("b")) {
paramMap.put("mch_id", PayWepayUtils.getInstance().getMerchantBId());
}else{
paramMap.put("mch_id", merchantId);
}
String nonce_str = PayWepayUtils.getInstance().getNonceStr();
paramMap.put("nonce_str", nonce_str);
paramMap.put("out_trade_no", outTradeNo);
......
......@@ -156,7 +156,11 @@ public abstract class AbstractWepayStrategy implements IWepayStrategy {
protected SortedMap<String, Object> buildRequestParamMap(DragonPayBaseReqDto dragonPayBaseReqDto){
String nonceStr = PayWepayUtils.getInstance().getNonceStr();
SortedMap<String, Object> parameters = new TreeMap<>();
parameters.put("mch_id", PayWepayUtils.getInstance().getMerchantId());
if(dragonPayBaseReqDto.getAppIdType().equals("b")){
parameters.put("mch_id", PayWepayUtils.getInstance().getMerchantBId());
}else{
parameters.put("mch_id", PayWepayUtils.getInstance().getMerchantId());
}
parameters.put("nonce_str", nonceStr);
parameters.put("spbill_create_ip", dragonPayBaseReqDto.getClientIp());
parameters.put("total_fee", dragonPayBaseReqDto.getPrice().multiply(BigDecimal.valueOf(100L)).intValue()+"");
......@@ -195,7 +199,12 @@ public abstract class AbstractWepayStrategy implements IWepayStrategy {
@Override
public DragonPayOrderQueryRespDto checkOrderStatus(String code) {
DragonOrdersDto ordersDto = dataUtils.getPayOrderByCode(code);
Map<String, Object> resultMap = wepayBiz.tradeQuery(code,this.getAppid());
Map<String, Object> resultMap=null;
if(code.contains("b")){
resultMap = wepayBiz.tradeQuery(code, PayWepayUtils.getInstance().getAPPLETB_APPID());
}else{
resultMap = wepayBiz.tradeQuery(code,this.getAppid());
}
DragonPayOrderQueryRespDto respDto = dragonPayBiz.buildPayOrderQueryRespDto(ordersDto);
Object returnCode = resultMap.get("return_code");
......
......@@ -32,7 +32,11 @@ public class WepayStrategyAppletImpl extends AbstractWepayStrategy{
@Override
SortedMap<String, Object> appendRequestParam(SortedMap<String, Object> requestMap, DragonPayBaseReqDto dragonPayBaseReqDto) {
requestMap.put("trade_type", "JSAPI");
requestMap.put("appid", PayWepayUtils.getInstance().getAPPLET_APP_ID());
if(dragonPayBaseReqDto.getAppIdType().equals("b")){
requestMap.put("appid", PayWepayUtils.getInstance().getAPPLETB_APPID());
}else{
requestMap.put("appid", PayWepayUtils.getInstance().getAPPLET_APP_ID());
}
requestMap.put("openid", dragonPayBaseReqDto.getOpenId()); //只有trade_type="JSAPI"时必须传
return requestMap;
}
......
/*
package com.liquidnet.service.dragon.controller;
import com.liquidnet.commons.lang.util.StringUtil;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.dragon.constant.DragonConstant;
import com.liquidnet.service.dragon.dto.DragonPayBaseReqDto;
import com.liquidnet.service.dragon.dto.DragonPayBaseRespDto;
import com.liquidnet.service.dragon.dto.DragonPayOrderQueryRespDto;
import com.liquidnet.service.dragon.service.IDragonOrdersService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;
*/
/**
* @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0
......@@ -8,19 +30,22 @@ package com.liquidnet.service.dragon.controller;
* @Package com.liquidnet.service.dragon.controller
* @Copyright: LightNet @ Copyright (c) 2021
* @date 2021/7/9 12:29
*/
/*@Slf4j
*//*
@Slf4j
@RestController
@RequestMapping("pay")
public class PayController {
@Autowired
private IDragonOrdersService dragonOrdersService;
*//**
*/
/**
* 电脑网页支付宝支付
*
* @return
*//*
@PostMapping("/dragonPay")
@ApiOperation("Dragon支付")
@ApiResponse(code = 200, message = "接口返回对象参数")
......@@ -62,7 +87,7 @@ public class PayController {
long startTime = System.currentTimeMillis();
//为什么在js和applet中才需要判断open_id?
if (payType.equalsIgnoreCase(DragonConstant.PayChannelEnum.WEPAY.getCode())) {
if (deviceFrom.equalsIgnoreCase(DragonConstant.DeviceFromEnum.JS.getCode()) || deviceFrom.equalsIgnoreCase(DragonConstant.DeviceFromEnum.APPLET.getCode())) {
if (deviceFrom.equalsIgnoreCase(DragonConstant.DeviceFromEnum.JS.getCode())||deviceFrom.equalsIgnoreCase(DragonConstant.DeviceFromEnum.APPLETB.getCode()) || deviceFrom.equalsIgnoreCase(DragonConstant.DeviceFromEnum.APPLET.getCode())) {
if (StringUtil.isEmpty(openId)) {
return ResponseDto.failure("微信支付openId不能为空!");
}
......@@ -71,6 +96,10 @@ public class PayController {
DragonPayBaseReqDto dragonPayBaseReqDto = DragonPayBaseReqDto.getNew();
dragonPayBaseReqDto.setPayType(payType);
dragonPayBaseReqDto.setDeviceFrom(deviceFrom);
if(deviceFrom.equals("appletb")){
dragonPayBaseReqDto.setDeviceFrom("applet");
dragonPayBaseReqDto.setAppIdType("b");
}
dragonPayBaseReqDto.setOpenId(openId);
dragonPayBaseReqDto.setType(type);
dragonPayBaseReqDto.setPrice(price);
......@@ -138,4 +167,5 @@ public class PayController {
rs.put("result", "" + respDto);
return ResponseDto.success(rs);
}
}*/
}
*/
......@@ -122,6 +122,9 @@ public class DragonOrderRefundsServiceImpl implements IDragonOrderRefundsService
case DragonConstant.REFUND_TYPE_APPLET_WEPAY:
dto = weyPayRefund(code, orderRefundCode, code, reason, price, priceTotal, paymentId, paymentType, localWePayCallBackUrl, nowTime);
break;
case DragonConstant.REFUND_TYPE_APPLETB_WEPAY:
dto = weyPayRefund(code, orderRefundCode, code, reason, price, priceTotal, paymentId, paymentType, localWePayCallBackUrl, nowTime);
break;
case DragonConstant.REFUND_TYPE_APPLET_DOUYIN:
dataUtils.setOrderCode(orderRefundCode, orderCode);
dto = douYinRefund(code, orderRefundCode, code, reason, price, priceTotal, paymentId, paymentType, localDouYinCallBackUrl, nowTime);
......@@ -414,6 +417,9 @@ public class DragonOrderRefundsServiceImpl implements IDragonOrderRefundsService
parameters.put("appid", PayWepayUtils.getInstance().getAPP_ID());
} else if (paymentType.equalsIgnoreCase(DragonConstant.PayTypeEnum.PAYMENT_TYPE_APPLET_WEPAY.getCode())) {
parameters.put("appid", PayWepayUtils.getInstance().getAPPLET_APP_ID());
}else if(paymentType.equalsIgnoreCase(DragonConstant.PayTypeEnum.PAYMENT_TYPE_APPLETB_WEPAY.getCode())){
parameters.put("appid", PayWepayUtils.getInstance().getAPPLETB_APPID());
parameters.put("mch_id", PayWepayUtils.getInstance().getMerchantBId());
} else if (paymentType.equalsIgnoreCase(DragonConstant.PayTypeEnum.PAYMENT_TYPE_WAP_WEPAY.getCode())) {
parameters.put("appid", PayWepayUtils.getInstance().getWAP_APP_ID());
}else if(paymentType.equalsIgnoreCase(DragonConstant.PayTypeEnum.PAYMENT_TYPE_MICROPAY_WEPAY.getCode())){
......@@ -434,7 +440,12 @@ public class DragonOrderRefundsServiceImpl implements IDragonOrderRefundsService
try {
HttpPost httpost = new HttpPost("https://api.mch.weixin.qq.com/secapi/pay/refund");
httpost.setEntity(new StringEntity(data, "UTF-8"));
CloseableHttpResponse response = PayWepayUtils.getInstance().getHttpClient().execute(httpost);
CloseableHttpResponse response=null;
if(code.contains("B")){
response = PayWepayUtils.getInstance().getHttpClientB().execute(httpost);
}else{
response = PayWepayUtils.getInstance().getHttpClient().execute(httpost);
}
try {
HttpEntity entity = response.getEntity();
entity.getContent();
......
......@@ -59,7 +59,11 @@ public class DragonOrdersServiceImpl implements IDragonOrdersService {
@Override
public ResponseDto<DragonPayBaseRespDto> dragonPay(DragonPayBaseReqDto dragonPayBaseReqDto) {
//设置支付编号
dragonPayBaseReqDto.setCode(IDGenerator.payCode());
if(dragonPayBaseReqDto.getAppIdType().equals("b")){
dragonPayBaseReqDto.setCode(IDGenerator.payCodeByType());
}else{
dragonPayBaseReqDto.setCode(IDGenerator.payCode());
}
log.info("dragon:dragonPay:req:dragonPayBaseReqDto : {}",dragonPayBaseReqDto.toString());
return payChannelStrategyContext.getStrategy(dragonPayBaseReqDto.getPayType()).dragonPay(dragonPayBaseReqDto);
}
......@@ -103,49 +107,44 @@ public class DragonOrdersServiceImpl implements IDragonOrdersService {
public DragonPayBaseRespDto dragonNotifyApple(DragonPayBaseReqDto dragonPayBaseReqDto) {
//1 调用苹果查询结果
String verifyResult = buyAppVerify(dragonPayBaseReqDto.getReceiptData());
//第二部
//持久化通知记录
dragonServiceCommonBiz.createDragonOrderLogs(dragonPayBaseReqDto.getCode(),dragonPayBiz.getPaymentType(dragonPayBaseReqDto.getPayType(),dragonPayBaseReqDto.getDeviceFrom()),verifyResult);
if (verifyResult == null) {
// 苹果服务器没有返回验证结果
log.info("苹果支付,app调用,查不到订单信息");
return null;
} else {
JSONObject job = JSONObject.parseObject(verifyResult);
String states = job.getString("status");
if (states.equals("0")){ // 前端所提供的收据是有效的 验证成功
String r_receipt = job.getString("receipt");
Integer states = job.getInteger("status");
if (states==0){ // 前端所提供的收据是有效的 验证成功
/* String r_receipt = job.getString("receipt");
JSONObject returnJson = JSONObject.parseObject(r_receipt);
String in_app = returnJson.getString("in_app");
JSONObject in_appJson = JSONObject.parseObject(in_app.substring(1, in_app.length() - 1));
/* ApplePayRefundDto applePayRefundDto=ApplePayRefundDto.getNew();*/
String product_id = in_appJson.getString("product_id");
/*applePayRefundDto.setProductId(product_id);*/
String transaction_id = in_appJson.getString("transaction_id"); // 订单号
String transaction_id = in_appJson.getString("transaction_id"); // 订单号*/
//如果单号一致 则开始处理逻辑
if(dragonPayBaseReqDto.getTransactionId().equals(transaction_id)){
//判断是已经查过了。
DragonPayBaseRespDto dragonPayBaseRespDto=dataUtils.getDragonPayBaseRespDto(dragonPayBaseReqDto.getOrderCode());
if(null!=dragonPayBaseRespDto){
return dragonPayBaseRespDto;
}
/*String[] moneys = product_id.split("\\.");//实际支付金额*/
//此处开始业务逻辑
//2 插入支付该支付的东西(预支付的东西)//dragon_orders
dragonServiceCommonBiz.buildPayOrders(dragonPayBaseReqDto,null);
//第二部
//持久化通知记录
dragonServiceCommonBiz.createDragonOrderLogs(dragonPayBaseReqDto.getCode(),dragonPayBiz.getPaymentType(dragonPayBaseReqDto.getPayType(),dragonPayBaseReqDto.getDeviceFrom()),verifyResult);
//修改状态
applepay.completeSuccessOrder(dataUtils.getPayOrderByCode(dragonPayBaseReqDto.getCode()),transaction_id,verifyResult);
//
DragonPayBaseRespDto respDto = buildCommonRespDto(dragonPayBaseReqDto);
respDto.setProductId(product_id);
dataUtils.createAPPLePayOrder(dragonPayBaseReqDto.getOrderCode(),respDto);
return respDto;
//判断是已经查过了。
DragonPayBaseRespDto dragonPayBaseRespDto=dataUtils.getDragonPayBaseRespDto(dragonPayBaseReqDto.getOrderCode());
if(null!=dragonPayBaseRespDto){
return dragonPayBaseRespDto;
}
/*String[] moneys = product_id.split("\\.");//实际支付金额*/
//此处开始业务逻辑
//2 插入支付该支付的东西(预支付的东西)//dragon_orders
dragonServiceCommonBiz.buildPayOrders(dragonPayBaseReqDto,null);
//修改状态
applepay.completeSuccessOrder(dataUtils.getPayOrderByCode(dragonPayBaseReqDto.getCode()),dragonPayBaseReqDto.getTransactionId(),verifyResult);
//
DragonPayBaseRespDto respDto = buildCommonRespDto(dragonPayBaseReqDto);
respDto.setStatus(0);
dataUtils.createAPPLePayOrder(dragonPayBaseReqDto.getOrderCode(),respDto);
return respDto;
} else {
return null;
}
}
return null;
}
public String buyAppVerify(String receipt) {
try{
......
......@@ -44,6 +44,9 @@ public class PayWepayUtils {
private final String WAP_APP_ID="wx3498304dda39c5a1";
private final String APPLET_APP_ID="wx4732efeaa2b08086";
private final String APPLETB_APPID="wxe3a093ce7278d5b1";
private final String merchantBId="1614003616";
public PayWepayUtils() {
}
......@@ -60,6 +63,14 @@ public class PayWepayUtils {
return APPLET_APP_ID;
}
public String getAPPLETB_APPID() {
return APPLETB_APPID;
}
public String getMerchantBId() {
return merchantBId;
}
public String getJS_APP_ID() {
return JS_APP_ID;
}
......@@ -146,6 +157,45 @@ public class PayWepayUtils {
}
return httpClient;
}
public CloseableHttpClient getHttpClientB() {
try {
if (httpClient == null) {
InputStream certStream = PayWepayUtils.class.getClassLoader().getResourceAsStream("payCert/wepayb/apiclient_cert.p12");
byte[] certData = IOUtils.toByteArray(certStream);
certStream.read(certData);
certStream.close();
KeyStore keyStore = KeyStore.getInstance("PKCS12");
ByteArrayInputStream inputStream = new ByteArrayInputStream(certData);
try {
keyStore.load(inputStream, merchantBId.toCharArray());
} finally {
inputStream.close();
}
SSLContext sslcontext = SSLContexts.custom()
.loadKeyMaterial(keyStore, merchantBId.toCharArray())
.build();
SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(
sslcontext,
SSLConnectionSocketFactory.getDefaultHostnameVerifier());
// 配置同时支持 HTTP 和 HTPPS
Registry<ConnectionSocketFactory> socketFactoryRegistry = RegistryBuilder.<ConnectionSocketFactory>create().register("http", PlainConnectionSocketFactory.getSocketFactory()).register("https", sslsf).build();
// 初始化连接管理器
poolConnManager =new PoolingHttpClientConnectionManager(socketFactoryRegistry);
poolConnManager.setMaxTotal(4000);// 同时最多连接数
// 设置最大路由
poolConnManager.setDefaultMaxPerRoute(2000);
// 初始化httpClient
httpClient = getConnection();
}
} catch (Exception e) {
e.printStackTrace();
}
return httpClient;
}
public static CloseableHttpClient getConnection() {
RequestConfig config = RequestConfig.custom().setConnectTimeout(5000).setConnectionRequestTimeout(5000).setSocketTimeout(5000).build();
......
-----BEGIN CERTIFICATE-----
MIID9jCCAt6gAwIBAgIUNKCBh8ymih18cn2V0/0dlbOVBKMwDQYJKoZIhvcNAQEL
BQAwXjELMAkGA1UEBhMCQ04xEzARBgNVBAoTClRlbnBheS5jb20xHTAbBgNVBAsT
FFRlbnBheS5jb20gQ0EgQ2VudGVyMRswGQYDVQQDExJUZW5wYXkuY29tIFJvb3Qg
Q0EwHhcNMjIwNTE5MDU1NTAzWhcNMjcwNTE4MDU1NTAzWjCBhzETMBEGA1UEAwwK
MTYxNDAwMzYxNjEbMBkGA1UECgwS5b6u5L+h5ZWG5oi357O757ufMTMwMQYDVQQL
DCrkuIrmtbfmkannmbvlpKnnqbrmlofljJbkvKDmkq3mnInpmZDlhazlj7gxCzAJ
BgNVBAYMAkNOMREwDwYDVQQHDAhTaGVuWmhlbjCCASIwDQYJKoZIhvcNAQEBBQAD
ggEPADCCAQoCggEBAMSxROciPdRnfUUIcXox1XLvREeP04ky5J9zp0+k1QPjUEf0
GlvWNjgpUrDWINFVUGA4lbVk0qUU1BKbcev4sfCRsXc0IwdEPjPJxfnXUzNVdseq
4+qgwbWqAo5XtUp4DAZtGdd6W8Waj+VINtB96mk7qQQjSlcriJk8uw4Byz02Al1q
+LyyLLW2xvYvCdTQElIjM8Qft40nzP2W5PMA5oG0+vWy2cQkJUjCCwVyc5ryOmaq
ovdHRMTbtnrkjTK9scXUQ0/aeyXEQzGMlwRjKikChhobLzRhowkeAQRZigPtha0F
R4bNIPAvylwJLunPbXekyAiEONRgz6xc2G/Z6lkCAwEAAaOBgTB/MAkGA1UdEwQC
MAAwCwYDVR0PBAQDAgTwMGUGA1UdHwReMFwwWqBYoFaGVGh0dHA6Ly9ldmNhLml0
cnVzLmNvbS5jbi9wdWJsaWMvaXRydXNjcmw/Q0E9MUJENDIyMEU1MERCQzA0QjA2
QUQzOTc1NDk4NDZDMDFDM0U4RUJEMjANBgkqhkiG9w0BAQsFAAOCAQEAAHbohRmA
Zu2EFyo46evwyYaRcYjEbu31O/1pJx3/7jAQ/FNrxhO6CmfUyugh1lBPka3r9HI2
4yw2vuBhBe/uGk2FSt+IwJXQ8XWCFYDlBAyH/1fM1JkNgxL/feDDbLK3mgHyxYcP
xHABD+Mw1+Mqt9OAuts9710bW6ZPKH+0r9VfakRKI6J6CPUxAP9BuEgQnwCMZv1I
6H4BC+cjQwCSSz0uI1LZgG+kbSX3HSfTudTNPp7G6fk8+4PSSAIdiVOA1BXJqIGk
v8sqj2Omk/svtIrBb5taPUfengFnASM0ebGrsrT13zH0J0D8h7k7eyxi5+arlY53
AuPiPt7HGiAovg==
-----END CERTIFICATE-----
-----BEGIN PRIVATE KEY-----
MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDEsUTnIj3UZ31F
CHF6MdVy70RHj9OJMuSfc6dPpNUD41BH9Bpb1jY4KVKw1iDRVVBgOJW1ZNKlFNQS
m3Hr+LHwkbF3NCMHRD4zycX511MzVXbHquPqoMG1qgKOV7VKeAwGbRnXelvFmo/l
SDbQfeppO6kEI0pXK4iZPLsOAcs9NgJdavi8siy1tsb2LwnU0BJSIzPEH7eNJ8z9
luTzAOaBtPr1stnEJCVIwgsFcnOa8jpmqqL3R0TE27Z65I0yvbHF1ENP2nslxEMx
jJcEYyopAoYaGy80YaMJHgEEWYoD7YWtBUeGzSDwL8pcCS7pz213pMgIhDjUYM+s
XNhv2epZAgMBAAECggEBAL7/AFCNMIsL/1nEjCTDNWkJLD1tTVVh5R1s+d/dyLeg
yTlFsT7ScQ3yGoj7NRzxAj6dU8qz39RLuG9lIKeqdGeNok2FhCovO1OgsC0eyX0E
lXXn3K/ecJvOPfMo+jMZBVxMHxbdizYEE4zqpcepLbIIK+SHvE2PSXK7xUwhs9B3
6EQsJwiiLuzklRS8mU3ycL+3J/OFw/eBYdreulEoZTHYBBskj16XBg+zFzD2uT2g
1RWBetkxlyR2/wfd3maK57CMSTZzx+mIyb8sJoCclXxyDvrv44W5XVrUrsVDh8xI
aDJqOll1N1paxTHXG4p3jNDuPubXmYwozyf1JsarNbECgYEA7J7IFOnxvUdvxW1r
/0l+38v3bg/jJzMvzOsBR3y1LNCxE0LstJf02X+My0D1OBF7ODRpo23kUdyRxKt7
kZ5AGHpEuyzauroCKRCfeaM4mWcGJEDs4rL4Q3wtN9hx9Q7SY0Tgxm8PgxrbBq25
K9yX+yyk7GN3nflF7Et52ITTeY0CgYEA1M1SSlzMKL9t2F1e0uBC5uWbDaWq42H4
9dNm1qc0b8P5LUABA+Vzw32DLl17AdeV0cxGw+rtTMYo53sAm+L54gcRAMc7wruS
2Kzyzd0uc3PMdUxPj4VlABEyzL5uDl78hRFqa2llH0PewKU1Pk/Egk4sUDvn+gu3
woGHlMIicv0CgYEAqPtAIodsJ2Oj89eQH/GJ1SOh4Y0hCPaqNWrDMB1kecvUGdBa
oSJALy/DCcirF06Ms/fiVV9+hePCijR4++aLGa//87g1wNJkBpWjfkfNfOgxX6Sq
R7/OQsuks1Q1FfBu2YvwBmZ8KoH8V0mriyJvu2YHpfXnD/9cK0M/khxRtmUCgYB9
rVkpQ87rTcsg2lvzLLE2TmoZUDsxmR4AiL6WjR9h1pqlx8QRugR5cvnzew/3kYwQ
4JT2hhtpmSp1M2azqgQsIkI/dGrt4fui7dlkDXmug7g/mjbuqzhwJrgaxWiYIi7+
o792+kLXiSzYF3nveAq1blerdwXU3fDD9d3N1C2mPQKBgQChukYrSDo/Kvl7X+o8
/b6Y69O9fpZs823Xo1fz4Y5/ODS2bchthoiNR4VtNvojX/S+ib7fV/Vio1d75DXX
RYLPB7zjyOkeNYt3xbjNjw4fsPORTZTUAGt6kwRHw4DNTA1hb6855WyntdMngwXQ
G6GcrqeUnwrZJwtZe5WOBSz3Jg==
-----END PRIVATE KEY-----
......@@ -156,7 +156,12 @@ public abstract class AbstractWepayStrategy implements IWepayStrategy {
protected SortedMap<String, Object> buildRequestParamMap(DragonPayBaseReqDto dragonPayBaseReqDto){
String nonceStr = PayWepayUtils.getInstance().getNonceStr();
SortedMap<String, Object> parameters = new TreeMap<>();
parameters.put("mch_id", PayWepayUtils.getInstance().getMerchantId());
// parameters.put("mch_id", PayWepayUtils.getInstance().getMerchantId());
if(dragonPayBaseReqDto.getAppIdType().equals("b")){
parameters.put("mch_id", PayWepayUtils.getInstance().getMerchantBId());
}else{
parameters.put("mch_id", PayWepayUtils.getInstance().getMerchantId());
}
parameters.put("nonce_str", nonceStr);
parameters.put("spbill_create_ip", dragonPayBaseReqDto.getClientIp());
parameters.put("total_fee", dragonPayBaseReqDto.getPrice().multiply(BigDecimal.valueOf(100L)).intValue()+"");
......@@ -195,9 +200,16 @@ public abstract class AbstractWepayStrategy implements IWepayStrategy {
@Override
public DragonPayOrderQueryRespDto checkOrderStatus(String code) {
DragonOrdersDto ordersDto = dataUtilsDragon.getPayOrderByCode(code);
Map<String, Object> resultMap = wepayBiz.tradeQuery(code,this.getAppid());
Map<String, Object> resultMap = null;
if(code.contains("b")){
resultMap = wepayBiz.tradeQuery(code, PayWepayUtils.getInstance().getAPPLETB_APPID());
}else{
resultMap = wepayBiz.tradeQuery(code,this.getAppid());
}
DragonPayOrderQueryRespDto respDto = dragonPayBiz.buildPayOrderQueryRespDto(ordersDto);
Object returnCode = resultMap.get("return_code");
// 查询失败
if (null == returnCode || "FAIL".equals(returnCode)) {
......
......@@ -32,7 +32,11 @@ public class WepayStrategyAppletImpl extends AbstractWepayStrategy{
@Override
SortedMap<String, Object> appendRequestParam(SortedMap<String, Object> requestMap, DragonPayBaseReqDto dragonPayBaseReqDto) {
requestMap.put("trade_type", "JSAPI");
requestMap.put("appid", PayWepayUtils.getInstance().getAPPLET_APP_ID());
if(dragonPayBaseReqDto.getAppIdType().equals("b")){
requestMap.put("appid", PayWepayUtils.getInstance().getAPPLETB_APPID());
}else{
requestMap.put("appid", PayWepayUtils.getInstance().getAPPLET_APP_ID());
}
requestMap.put("openid", dragonPayBaseReqDto.getOpenId()); //只有trade_type="JSAPI"时必须传
return requestMap;
}
......
......@@ -89,6 +89,10 @@ public class PayController {
DragonPayBaseReqDto dragonPayBaseReqDto = DragonPayBaseReqDto.getNew();
dragonPayBaseReqDto.setPayType(payType);
dragonPayBaseReqDto.setDeviceFrom(deviceFrom);
if(deviceFrom.equals("appletb")){
dragonPayBaseReqDto.setDeviceFrom("applet");
dragonPayBaseReqDto.setAppIdType("b");
}
dragonPayBaseReqDto.setOpenId(openId);
dragonPayBaseReqDto.setType(type);
dragonPayBaseReqDto.setPrice(price);
......
......@@ -122,6 +122,9 @@ public class DragonOrderRefundsServiceImpl implements IDragonOrderRefundsService
case DragonConstant.REFUND_TYPE_APPLET_WEPAY:
dto = weyPayRefund(code, orderRefundCode, code, reason, price, priceTotal, paymentId, paymentType, localWePayCallBackUrl, nowTime);
break;
case DragonConstant.REFUND_TYPE_APPLETB_WEPAY:
dto = weyPayRefund(code, orderRefundCode, code, reason, price, priceTotal, paymentId, paymentType, localWePayCallBackUrl, nowTime);
break;
case DragonConstant.REFUND_TYPE_APPLET_DOUYIN:
dataUtilsDragon.setOrderCode(orderRefundCode, orderCode);
dto = douYinRefund(code, orderRefundCode, code, reason, price, priceTotal, paymentId, paymentType, localDouYinCallBackUrl, nowTime);
......@@ -406,13 +409,18 @@ public class DragonOrderRefundsServiceImpl implements IDragonOrderRefundsService
String nonceStr = PayWepayUtils.getInstance().getNonceStr();
SortedMap<String, Object> parameters = new TreeMap<>();
parameters.put("mch_id", PayWepayUtils.getInstance().getMerchantId());
int type = 0;// 0代表正在 1代表摩登
if (paymentType.equalsIgnoreCase(DragonConstant.PayTypeEnum.PAYMENT_TYPE_JS_WEPAY.getCode())) {
parameters.put("appid", PayWepayUtils.getInstance().getJS_APP_ID());
} else if (paymentType.equalsIgnoreCase(DragonConstant.PayTypeEnum.PAYMENT_TYPE_WEB_WEPAY.getCode())) {
parameters.put("appid", PayWepayUtils.getInstance().getWEB_APP_ID());
} else if (paymentType.equalsIgnoreCase(DragonConstant.PayTypeEnum.PAYMENT_TYPE_APP_WEPAY.getCode())) {
parameters.put("appid", PayWepayUtils.getInstance().getAPP_ID());
} else if (paymentType.equalsIgnoreCase(DragonConstant.PayTypeEnum.PAYMENT_TYPE_APPLET_WEPAY.getCode())) {
} else if(paymentType.equalsIgnoreCase(DragonConstant.PayTypeEnum.PAYMENT_TYPE_APPLET_WEPAY.getCode()) && code.contains("PAYB")){
parameters.put("appid", PayWepayUtils.getInstance().getAPPLETB_APPID());
parameters.put("mch_id", PayWepayUtils.getInstance().getMerchantBId());
type = 1;
}else if (paymentType.equalsIgnoreCase(DragonConstant.PayTypeEnum.PAYMENT_TYPE_APPLET_WEPAY.getCode())) {
parameters.put("appid", PayWepayUtils.getInstance().getAPPLET_APP_ID());
} else if (paymentType.equalsIgnoreCase(DragonConstant.PayTypeEnum.PAYMENT_TYPE_WAP_WEPAY.getCode())) {
parameters.put("appid", PayWepayUtils.getInstance().getWAP_APP_ID());
......@@ -434,7 +442,12 @@ public class DragonOrderRefundsServiceImpl implements IDragonOrderRefundsService
try {
HttpPost httpost = new HttpPost("https://api.mch.weixin.qq.com/secapi/pay/refund");
httpost.setEntity(new StringEntity(data, "UTF-8"));
CloseableHttpResponse response = PayWepayUtils.getInstance().getHttpClient().execute(httpost);
CloseableHttpResponse response = null;
if(type ==0 ) {
response = PayWepayUtils.getInstance().getHttpClient().execute(httpost);
}else{
response = PayWepayUtils.getInstance().getHttpClientM().execute(httpost);
}
try {
HttpEntity entity = response.getEntity();
entity.getContent();
......
......@@ -66,14 +66,20 @@ public class DragonOrdersServiceImpl implements IDragonOrdersService {
return ResponseDto.failure("微信支付openId不能为空!");
}
//设置支付编号
dragonPayBaseReqDto.setCode(IDGenerator.payCode());
if(dragonPayBaseReqDto.getDeviceFrom().equals("appletb")){
dragonPayBaseReqDto.setDeviceFrom("applet");
dragonPayBaseReqDto.setAppIdType("b");
dragonPayBaseReqDto.setCode(IDGenerator.payCodeByType());
}else{
dragonPayBaseReqDto.setCode(IDGenerator.payCode());
}
log.info("dragon:dragonPay:req:dragonPayBaseReqDto : {}",dragonPayBaseReqDto.toString());
return payChannelStrategyContext.getStrategy(dragonPayBaseReqDto.getPayType()).dragonPay(dragonPayBaseReqDto);
}
public Map validateDragonPay(DragonPayBaseReqDto dragonPayBaseReqDto){
HashMap<String, Object> map= ObjectUtilDragon.cloneHashMapStringAndObj();
if (dragonPayBaseReqDto.getPayType().equalsIgnoreCase(DragonConstant.PayChannelEnum.WEPAY.getCode())) {
if (dragonPayBaseReqDto.getDeviceFrom().equalsIgnoreCase(DragonConstant.DeviceFromEnum.JS.getCode()) || dragonPayBaseReqDto.getDeviceFrom().equalsIgnoreCase(DragonConstant.DeviceFromEnum.APPLET.getCode())) {
if (dragonPayBaseReqDto.getDeviceFrom().equalsIgnoreCase(DragonConstant.DeviceFromEnum.JS.getCode()) || dragonPayBaseReqDto.getDeviceFrom().equalsIgnoreCase(DragonConstant.DeviceFromEnum.APPLET.getCode()) ||dragonPayBaseReqDto.getDeviceFrom().equalsIgnoreCase(DragonConstant.DeviceFromEnum.APPLETB.getCode()) ) {
if (StringUtil.isEmpty(dragonPayBaseReqDto.getOpenId())) {
map.put("resultStatus",false);
map.put("erro","微信支付openId不能为空!");
......
......@@ -33,16 +33,18 @@ public class PayWepayUtils {
private static PayWepayUtils instance = new PayWepayUtils();
// 池化管理
private static PoolingHttpClientConnectionManager poolConnManager =null;
private static PoolingHttpClientConnectionManager poolConnManager = null;
private final String merchantId = "1551961491";
private final String partnerKey = "itIuO65O9yKmemOu3S8g1S4orqvCGwXK";
private final String APP_ID="wx86f9777acf2cb585";
private final String WEB_APP_ID="wx3498304dda39c5a1";
private final String JS_APP_ID="wx3498304dda39c5a1";
private final String WAP_APP_ID="wx3498304dda39c5a1";
private final String APPLET_APP_ID="wx4732efeaa2b08086";
private final String APP_ID = "wx86f9777acf2cb585";
private final String WEB_APP_ID = "wx3498304dda39c5a1";
private final String JS_APP_ID = "wx3498304dda39c5a1";
private final String WAP_APP_ID = "wx3498304dda39c5a1";
private final String APPLET_APP_ID = "wx4732efeaa2b08086";
private final String APPLETB_APPID="wxe3a093ce7278d5b1";
private final String merchantBId="1551961491";//1614003616
public PayWepayUtils() {
}
......@@ -76,6 +78,14 @@ public class PayWepayUtils {
return merchantId;
}
public String getAPPLETB_APPID() {
return APPLETB_APPID;
}
public String getMerchantBId() {
return merchantBId;
}
// public CloseableHttpClient getHttpClient() {
// try {
// if (httpClient == null) {
......@@ -133,7 +143,46 @@ public class PayWepayUtils {
// 配置同时支持 HTTP 和 HTPPS
Registry<ConnectionSocketFactory> socketFactoryRegistry = RegistryBuilder.<ConnectionSocketFactory>create().register("http", PlainConnectionSocketFactory.getSocketFactory()).register("https", sslsf).build();
// 初始化连接管理器
poolConnManager =new PoolingHttpClientConnectionManager(socketFactoryRegistry);
poolConnManager = new PoolingHttpClientConnectionManager(socketFactoryRegistry);
poolConnManager.setMaxTotal(4000);// 同时最多连接数
// 设置最大路由
poolConnManager.setDefaultMaxPerRoute(2000);
// 初始化httpClient
httpClient = getConnection();
}
} catch (Exception e) {
e.printStackTrace();
}
return httpClient;
}
public CloseableHttpClient getHttpClientM() {
try {
if (httpClient == null) {
InputStream certStream = PayWepayUtils.class.getClassLoader().getResourceAsStream("payCert/wepay/wepay_apiclient_cert.p12");
byte[] certData = IOUtils.toByteArray(certStream);
certStream.read(certData);
certStream.close();
KeyStore keyStore = KeyStore.getInstance("PKCS12");
ByteArrayInputStream inputStream = new ByteArrayInputStream(certData);
try {
keyStore.load(inputStream, merchantBId.toCharArray());
} finally {
inputStream.close();
}
SSLContext sslcontext = SSLContexts.custom()
.loadKeyMaterial(keyStore, merchantBId.toCharArray())
.build();
SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(
sslcontext,
SSLConnectionSocketFactory.getDefaultHostnameVerifier());
// 配置同时支持 HTTP 和 HTPPS
Registry<ConnectionSocketFactory> socketFactoryRegistry = RegistryBuilder.<ConnectionSocketFactory>create().register("http", PlainConnectionSocketFactory.getSocketFactory()).register("https", sslsf).build();
// 初始化连接管理器
poolConnManager = new PoolingHttpClientConnectionManager(socketFactoryRegistry);
poolConnManager.setMaxTotal(4000);// 同时最多连接数
// 设置最大路由
poolConnManager.setDefaultMaxPerRoute(2000);
......@@ -154,7 +203,7 @@ public class PayWepayUtils {
.setConnectionManager(poolConnManager)
.setDefaultRequestConfig(config)
// 设置重试次数
.setRetryHandler(new DefaultHttpRequestRetryHandler(2,false)).build();
.setRetryHandler(new DefaultHttpRequestRetryHandler(2, false)).build();
return httpClient;
}
......@@ -208,7 +257,7 @@ public class PayWepayUtils {
public String unCodeReqInfo(String reqInfo) {
try {
Cipher cipher ;
Cipher cipher;
String key = MD5Utils.md5(partnerKey);
SecretKeySpec secretKeySpec = new SecretKeySpec(key.getBytes(), "AES");
Security.addProvider(new BouncyCastleProvider());
......@@ -266,8 +315,8 @@ public class PayWepayUtils {
SortedMap<String, Object> smap = new TreeMap<String, Object>(map);
StringBuffer sb = new StringBuffer();
for (Map.Entry<String, Object> m : smap.entrySet()) {
if(null!=m.getValue()){
if(StringUtils.isNotBlank(m.getValue().toString())){
if (null != m.getValue()) {
if (StringUtils.isNotBlank(m.getValue().toString())) {
sb.append(m.getKey()).append("=").append(m.getValue()).append("&");
}
}
......@@ -286,6 +335,6 @@ public class PayWepayUtils {
paramMap.put("noncestr", "rGcsOnNdZ4d9zu6k3yCbVJRG8Ombp8VW");
paramMap.put("timestamp", "1627276483");
String sign = PayWepayUtils.getInstance().createSign(paramMap);
System.out.println("1627274771===="+sign);
System.out.println("1627274771====" + sign);
}
}
......@@ -462,7 +462,7 @@ public class GoblinNftOrderServiceImpl implements IGoblinNftOrderService {
httpData.add("expireTime", "5");
httpData.add("payType", nftOrder.getPayType());
httpData.add("deviceFrom", nftOrder.getDeviceFrom());
if (nftOrder.getDeviceFrom().equals("js") || nftOrder.getDeviceFrom().equals("applet")) {
if (nftOrder.getDeviceFrom().equals("js") || nftOrder.getDeviceFrom().equals("applet") || nftOrder.getDeviceFrom().equals("appletb")) {
httpData.add("openId", payParam.getOpenId());
}
httpData.add("showUrl", showUrl);
......
......@@ -436,7 +436,7 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
DragonPayBaseReqDto dragonPayBaseReqDto = DragonPayBaseReqDto.getNew();
dragonPayBaseReqDto.setPayType(preParam.getPayType());
dragonPayBaseReqDto.setDeviceFrom(preParam.getDeviceFrom());
if (preParam.getDeviceFrom().equals("js") || preParam.getDeviceFrom().equals("applet")) {
if (preParam.getDeviceFrom().equals("js") || preParam.getDeviceFrom().equals("applet") || preParam.getDeviceFrom().equals("appletb")) {
dragonPayBaseReqDto.setOpenId(preParam.getOpenId());
}
dragonPayBaseReqDto.setType("PRODUCT");
......@@ -709,17 +709,17 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
// } else
if (!storeOrderVo.getPayType().equals("FREE")) {
// 调用支付
if (param.getPayType().equalsIgnoreCase(DragonConstant.PayChannelEnum.WEPAY.getCode())) {
if (param.getDeviceFrom().equalsIgnoreCase(DragonConstant.DeviceFromEnum.JS.getCode()) || param.getDeviceFrom().equalsIgnoreCase(DragonConstant.DeviceFromEnum.APPLET.getCode())) {
if (StringUtil.isEmpty(param.getOpenId())) {
return ResponseDto.failure("微信支付openId不能为空!");
}
}
}
// if (param.getPayType().equalsIgnoreCase(DragonConstant.PayChannelEnum.WEPAY.getCode())) {
// if (param.getDeviceFrom().equalsIgnoreCase(DragonConstant.DeviceFromEnum.JS.getCode()) || param.getDeviceFrom().equalsIgnoreCase(DragonConstant.DeviceFromEnum.APPLET.getCode())) {
// if (StringUtil.isEmpty(param.getOpenId())) {
// return ResponseDto.failure("微信支付openId不能为空!");
// }
// }
// }
DragonPayBaseReqDto dragonPayBaseReqDto = DragonPayBaseReqDto.getNew();
dragonPayBaseReqDto.setPayType(param.getPayType());
dragonPayBaseReqDto.setDeviceFrom(param.getDeviceFrom());
if (param.getDeviceFrom().equals("js") || param.getDeviceFrom().equals("applet")) {
if (param.getDeviceFrom().equals("js") || param.getDeviceFrom().equals("applet") || param.getDeviceFrom().equals("appletb")) {
dragonPayBaseReqDto.setOpenId(param.getOpenId());
}
dragonPayBaseReqDto.setType("PRODUCT");
......
......@@ -569,7 +569,7 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
orderTicketRelations.setAgentStatus(agentVo.getIsBlack() == 1 ? 2 : 1);
orderTicketRelations.setAgentIdMaster(agentVo.getAgentMasterId());
orderTicketRelations.setAgentDistributionsMaster(agentVo.getExCarry());
}else{
} else {
orderTicketRelations.setAgentDistributions(BigDecimal.ZERO);
orderTicketRelations.setAgentStatus(0);
orderTicketRelations.setAgentIdMaster("0");
......@@ -683,7 +683,7 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
DragonPayBaseReqDto dragonPayBaseReqDto = DragonPayBaseReqDto.getNew();
dragonPayBaseReqDto.setPayType(payOrderParam.getPayType());
dragonPayBaseReqDto.setDeviceFrom(payOrderParam.getDeviceFrom());
if (payOrderParam.getDeviceFrom().equals("js") || payOrderParam.getDeviceFrom().equals("applet")) {
if (payOrderParam.getDeviceFrom().equals("js") || payOrderParam.getDeviceFrom().equals("applet") || payOrderParam.getDeviceFrom().equals("appletb")) {
dragonPayBaseReqDto.setOpenId(payOrderParam.getOpenId());
}
dragonPayBaseReqDto.setType("TICKET");
......@@ -703,7 +703,7 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
ResponseDto<DragonPayBaseRespDto> responseDto = dragonOrdersService.dragonPay(dragonPayBaseReqDto);
String returnData = JsonUtils.toJson(responseDto);
log.debug("调用 DRAGON 结果 = " + returnData);
log.info("调用 DRAGON 结果 = " + returnData);
payResultVo = JsonUtils.fromJson(returnData, PayResultVo.class);
payResultVo.getData().setOrderId(orderTicketId);
payResultVo.getData().setPayType(orderTickets.getPayType());
......@@ -812,7 +812,7 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
DragonPayBaseReqDto dragonPayBaseReqDto = DragonPayBaseReqDto.getNew();
dragonPayBaseReqDto.setPayType(payAgainParam.getPayType());
dragonPayBaseReqDto.setDeviceFrom(payAgainParam.getDeviceFrom());
if (payAgainParam.getDeviceFrom().equals("js") || payAgainParam.getDeviceFrom().equals("applet")) {
if (payAgainParam.getDeviceFrom().equals("js") || payAgainParam.getDeviceFrom().equals("applet") || payAgainParam.getDeviceFrom().equals("appletb")) {
dragonPayBaseReqDto.setOpenId(payAgainParam.getOpenId());
}
dragonPayBaseReqDto.setType("TICKET");
......
package com.liquidnet.service.platform.controller.goblin;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.support.ExcelTypeEnum;
import com.liquidnet.common.exception.LiquidnetServiceException;
import com.liquidnet.commons.lang.constant.LnsRegex;
import com.liquidnet.commons.lang.util.CollectionUtil;
import com.liquidnet.commons.lang.util.CurrentUtil;
import com.liquidnet.commons.lang.util.DateUtil;
import com.liquidnet.commons.lang.util.JsonUtils;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.goblin.constant.GoblinStatusConst;
import com.liquidnet.service.goblin.dto.GoblinZhengzaiMarketOrderExcelDto;
import com.liquidnet.service.goblin.service.IGoblinExportService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.util.CollectionUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.Pattern;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.HashMap;
import java.util.List;
@Slf4j
@Api(tags = "商城-订单信息导出")
@Controller
@RequestMapping("/tools/export")
......@@ -47,4 +71,57 @@ public class GoblinExportDataController {
return iGoblinExportService.exportMallOrder(response, beginTime, endTime, state, mailType, storeId);
}
@GetMapping("zzMarketOrder")
@ApiOperation(value = "正在下单-销售数据")
@ResponseBody
@ApiImplicitParams({
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "storeId", value = "店铺ID"),
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "marketId", value = "活动ID"),
@ApiImplicitParam(type = "form", required = false, dataType = "String", name = "bDate", value = "开始时间[yyyy-MM-dd]"),
@ApiImplicitParam(type = "form", required = false, dataType = "String", name = "eDate", value = "结束时间[yyyy-MM-dd]"),
})
public void exportZhengzaiMarketOrder(@RequestParam(required = false, name = "bDate") @Pattern(regexp = LnsRegex.Valid.DATETIME_YMD, message = "开始日期格式有误") String beginDate,
@RequestParam(required = false, name = "eDate") @Pattern(regexp = LnsRegex.Valid.DATETIME_YMD, message = "结束日期格式有误") String endDate,
@RequestParam String marketId, @RequestParam String storeId, HttpServletResponse response) {
String currentUid = CurrentUtil.getCurrentUid();
ServletOutputStream servletOutputStream = null;
try {
log.debug("数据导出:正在下单-销售数据:[uid:{},storeId:{},marketId:{},date:{}~{}]", currentUid, storeId, marketId, beginDate, endDate);
String fileName = DateUtil.Formatter.yyyyMMddHHmmssTrim.format(LocalDateTime.now())
.concat(new String(("正在下单-销售数据").getBytes("gb2312"), StandardCharsets.ISO_8859_1));
response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=".concat(fileName).concat(ExcelTypeEnum.XLSX.getValue()));
response.setContentType(MediaType.MULTIPART_FORM_DATA_VALUE);
response.setCharacterEncoding(StandardCharsets.UTF_8.name());
servletOutputStream = response.getOutputStream();
HashMap<String, Object> paramMap = CollectionUtil.mapStringObject();
paramMap.put("storeId", storeId);
paramMap.put("marketId", GoblinStatusConst.MarketPreStatus.MARKET_PRE_ZHENGZAI.getValue() + marketId);
LocalDate beginLocalDate = DateUtil.Formatter.yyyy_MM_dd.parse2LocalDate(beginDate);
LocalDate endLocalDate = DateUtil.Formatter.yyyy_MM_dd.parse2LocalDate(endDate);
paramMap.put("beginTime", null == beginLocalDate ? beginLocalDate : LocalDateTime.of(beginLocalDate, LocalTime.MIN));
paramMap.put("endTime", null == endLocalDate ? endLocalDate : LocalDateTime.of(endLocalDate, LocalTime.MAX));
if (log.isDebugEnabled()) {
log.debug("数据导出:正在下单-销售数据:[uid:{},paramMap:{}]", currentUid, JsonUtils.toJson(paramMap));
}
List<GoblinZhengzaiMarketOrderExcelDto> excelDtos = iGoblinExportService.exportZhengzaiMarketOrder(paramMap);
if (CollectionUtils.isEmpty(excelDtos)) {
log.warn("数据导出:正在下单-销售数据:无数据,请核实:[uid:{},paramMap:{}]", currentUid, JsonUtils.toJson(paramMap));
return;
}
EasyExcel.write(servletOutputStream, GoblinZhengzaiMarketOrderExcelDto.class).sheet("销售数据").doWrite(excelDtos);
} catch (IOException e) {
log.error("数据导出:正在下单-销售数据:异常[uid:{},storeId:{},marketId:{},date:{}~{},ex.msg={}]",
currentUid, storeId, marketId, beginDate, endDate, e.getLocalizedMessage());
throw new LiquidnetServiceException("-1","导出失败,请联系网站管理员");
} finally {
if (null != servletOutputStream) {
try {
servletOutputStream.close();
} catch (Exception ignored) {
}
}
}
}
}
......@@ -7,6 +7,7 @@ import com.alibaba.excel.write.style.HorizontalCellStyleStrategy;
import com.alibaba.excel.write.style.column.SimpleColumnWidthStyleStrategy;
import com.liquidnet.commons.lang.util.CollectionUtil;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.goblin.dto.GoblinZhengzaiMarketOrderExcelDto;
import com.liquidnet.service.goblin.dto.MallOrdertDao;
import com.liquidnet.service.goblin.mapper.GoblinStoreOrderMapper;
import com.liquidnet.service.goblin.service.IGoblinExportService;
......@@ -26,10 +27,14 @@ import java.util.*;
@Service
@Slf4j
public class GoblinExportServiceImpl implements IGoblinExportService {
@Autowired
GoblinStoreOrderMapper goblinStoreOrderMapper;
@Override
public List<GoblinZhengzaiMarketOrderExcelDto> exportZhengzaiMarketOrder(Map<String, Object> paramMap) {
return goblinStoreOrderMapper.exportZhengzaiMarketOrder(paramMap);
}
@Override
public ResponseDto<String> exportMallOrder(HttpServletResponse response, String beginTime, String endTime, String state, Integer mailType, String storeId) {
if (!timeIsNotNull(beginTime, endTime)) {
......
......@@ -38,6 +38,9 @@ public class WechatMaConfigure {
private static String appletAppidSmile;
private static String appletSecretSmile;
private static String appletAppidModern;
private static String appletSecretModern;
@Value("${liquidnet.wechat.applet.strawberry.appid}")
public void setAppletAppidStrawberry(String appletAppidStrawberry) {
WechatMaConfigure.appletAppidStrawberry = appletAppidStrawberry;
......@@ -92,12 +95,22 @@ public class WechatMaConfigure {
WechatMaConfigure.appletSecretSmile = appletSecretSmile;
}
@Value("${liquidnet.wechat.applet.modern.appid}")
public void setAppletAppidModern(String appletAppidModern) {
WechatMaConfigure.appletAppidModern = appletAppidModern;
}
@Value("${liquidnet.wechat.applet.modern.secret}")
public void setAppletSecretModern(String appletSecretModern) {
WechatMaConfigure.appletSecretModern = appletSecretModern;
}
private WxMaService wxMaAppletStrawberryService;
private WxMaService wxMaAppletFiveService;
private WxMaService wxMaAppletMdskService;
private WxMaService wxMaAppletZhengzaiService;
private WxMaService wxMaAppletAirshipService;
private WxMaService wxMaAppletSmileService;
private WxMaService wxMaAppletModernService;
private WxMaMessageRouter wxMaStrawberryMessageRouter;
private WxMaMessageRouter wxMaFiveMessageRouter;
......@@ -105,6 +118,7 @@ public class WechatMaConfigure {
private WxMaMessageRouter wxMaZhengzaiMessageRouter;
private WxMaMessageRouter wxMaAirshipMessageRouter;
private WxMaMessageRouter wxMaSmileMessageRouter;
private WxMaMessageRouter wxMaModernMessageRouter;
@Autowired
private StringRedisTemplate stringRedisTemplate;
......@@ -183,12 +197,24 @@ public class WechatMaConfigure {
this.setWxMaConfig(wxMaDefaultConfig);
}
};
wxMaAppletModernService = new WxMaServiceImpl() {
{
RedisTemplateWxRedisOps redisTemplateWxRedisOps = new RedisTemplateWxRedisOps(stringRedisTemplate);
WxMaRedisBetterConfigImpl wxMaDefaultConfig = new WxMaRedisBetterConfigImpl(redisTemplateWxRedisOps, "sweet:accessToken:applet:modern");
wxMaDefaultConfig.setAppid(appletAppidModern);
wxMaDefaultConfig.setSecret(appletSecretModern);
wxMaDefaultConfig.setMsgDataFormat("JSON");
this.setWxMaConfig(wxMaDefaultConfig);
}
};
wxMaStrawberryMessageRouter = new WxMaMessageRouter(wxMaAppletStrawberryService);
wxMaFiveMessageRouter = new WxMaMessageRouter(wxMaAppletFiveService);
wxMaMdskMessageRouter = new WxMaMessageRouter(wxMaAppletMdskService);
wxMaZhengzaiMessageRouter = new WxMaMessageRouter(wxMaAppletZhengzaiService);
wxMaAirshipMessageRouter = new WxMaMessageRouter(wxMaAppletAirshipService);
wxMaSmileMessageRouter = new WxMaMessageRouter(wxMaAppletSmileService);
wxMaModernMessageRouter = new WxMaMessageRouter(wxMaAppletModernService);
}
public WxMaService getWxMaService(Integer anum) {
......@@ -205,6 +231,8 @@ public class WechatMaConfigure {
return wxMaAppletAirshipService;
case 6:
return wxMaAppletSmileService;
case 7:
return wxMaAppletModernService;
}
return null;
}
......@@ -223,6 +251,8 @@ public class WechatMaConfigure {
return appletAppidAirship;
case 6:
return appletAppidSmile;
case 7:
return appletAppidModern;
}
return "";
}
......@@ -241,6 +271,8 @@ public class WechatMaConfigure {
return wxMaAirshipMessageRouter;
case 6:
return wxMaSmileMessageRouter;
case 7:
return wxMaModernMessageRouter;
}
return null;
}
......@@ -268,4 +300,4 @@ public class WechatMaConfigure {
return router;
}
}
}
\ No newline at end of file
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