Commit 1d0330ed by 徐高华

Merge remote-tracking branch 'origin/feature/企微许可账号购买'

Conflicts:
	haoban-manage3-service/src/test/java/DealSyncTest.java
parents 5154ffb9 947b85f0
package com.gic.haoban.manage.api.dto.licence;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* <p>
*
* </p>
*
* @author jx
* @since 2023-03-09
*/
public class LicenceOrderDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 订单id
*/
private Long orderId;
/**
* gic商户Id
*/
private String enterpriseId;
/**
* gic品牌名称
*/
private String enterpriseName;
/**
* wx企业Id
*/
private String wxEnterpriseId;
/**
* 微信商户名称
*/
private String wxEnterpriseName;
/**
* 订单类型,1:购买帐号,2:续期帐号
*/
private Integer orderType;
/**
* 互通帐号个数
*/
private Integer externalContactCount;
/**
* 基础帐号个数
*/
private Integer baseCount;
/**
* 订单金额,单位分
*/
private Integer price;
/**
* 购买时间类型 1:按月购买,2:按天购买
*/
private Integer timeType;
/**
* 购买的时间数值
*/
private Integer timeValue;
/**
* 支付类型 1在线支付 2对公转账
*/
private Integer payType;
/**
* 订单编号
*/
private String orderNumber;
/**
* 上传凭证url
*/
private String voucher;
/**
* 订单状态,0:待支付,1:已支付,2:已取消,3:已过期,4:已退款,5:审核中
*/
private Integer orderStatus;
/**
* 订单状态更改原因
*/
private String orderStatusReason;
/**
* 支付时间 支付类型为1:微信支付时间 2:上传凭证时间
*/
private Date payTime;
/**
* 退款时间
*/
private Date refundTime;
/**
* 企业微信订单id
*/
private String qywxOrderId;
/**
* 企业微信订单状态,0:待支付,1:已支付,2:已取消,3:已过期,4:退款中,5:退款被拒绝,6:已退款,7已失效
*/
private Integer qywxOrderStatus;
/**
* 企业微信订单更改原因
*/
private String qywxOrderStatusReason;
/**
* 企业微信支付时间
*/
private Date qywxPayTime;
/**
* 企业微信退款时间
*/
private Date qywxRefundTime;
/**
* 审核不通过原因
*/
private String reason;
/**
* 创建时间
*/
private Date createTime;
/**
* 到期时间
*/
private Date expireTime;
/**
* 当前时间
*/
private Date nowTime;
/**
* 订单进度list
*/
private List<LicenceOrderProgressDTO> OrderProgressList;
/**
* 微信url
*/
private String wxUrl;
public String getWxUrl() {
return wxUrl;
}
public void setWxUrl(String wxUrl) {
this.wxUrl = wxUrl;
}
public Long getOrderId() {
return orderId;
}
public void setOrderId(Long orderId) {
this.orderId = orderId;
}
public String getEnterpriseId() {
return enterpriseId;
}
public void setEnterpriseId(String enterpriseId) {
this.enterpriseId = enterpriseId;
}
public String getEnterpriseName() {
return enterpriseName;
}
public void setEnterpriseName(String enterpriseName) {
this.enterpriseName = enterpriseName;
}
public String getWxEnterpriseId() {
return wxEnterpriseId;
}
public void setWxEnterpriseId(String wxEnterpriseId) {
this.wxEnterpriseId = wxEnterpriseId;
}
public String getWxEnterpriseName() {
return wxEnterpriseName;
}
public void setWxEnterpriseName(String wxEnterpriseName) {
this.wxEnterpriseName = wxEnterpriseName;
}
public Integer getOrderType() {
return orderType;
}
public void setOrderType(Integer orderType) {
this.orderType = orderType;
}
public Integer getExternalContactCount() {
return externalContactCount;
}
public void setExternalContactCount(Integer externalContactCount) {
this.externalContactCount = externalContactCount;
}
public Integer getBaseCount() {
return baseCount;
}
public void setBaseCount(Integer baseCount) {
this.baseCount = baseCount;
}
public Integer getPrice() {
return price;
}
public void setPrice(Integer price) {
this.price = price;
}
public Integer getTimeType() {
return timeType;
}
public void setTimeType(Integer timeType) {
this.timeType = timeType;
}
public Integer getTimeValue() {
return timeValue;
}
public void setTimeValue(Integer timeValue) {
this.timeValue = timeValue;
}
public Integer getPayType() {
return payType;
}
public void setPayType(Integer payType) {
this.payType = payType;
}
public String getOrderNumber() {
return orderNumber;
}
public void setOrderNumber(String orderNumber) {
this.orderNumber = orderNumber;
}
public String getVoucher() {
return voucher;
}
public void setVoucher(String voucher) {
this.voucher = voucher;
}
public Integer getOrderStatus() {
return orderStatus;
}
public void setOrderStatus(Integer orderStatus) {
this.orderStatus = orderStatus;
}
public String getOrderStatusReason() {
return orderStatusReason;
}
public void setOrderStatusReason(String orderStatusReason) {
this.orderStatusReason = orderStatusReason;
}
public Date getPayTime() {
return payTime;
}
public void setPayTime(Date payTime) {
this.payTime = payTime;
}
public Date getRefundTime() {
return refundTime;
}
public void setRefundTime(Date refundTime) {
this.refundTime = refundTime;
}
public String getQywxOrderId() {
return qywxOrderId;
}
public void setQywxOrderId(String qywxOrderId) {
this.qywxOrderId = qywxOrderId;
}
public Integer getQywxOrderStatus() {
return qywxOrderStatus;
}
public void setQywxOrderStatus(Integer qywxOrderStatus) {
this.qywxOrderStatus = qywxOrderStatus;
}
public String getQywxOrderStatusReason() {
return qywxOrderStatusReason;
}
public void setQywxOrderStatusReason(String qywxOrderStatusReason) {
this.qywxOrderStatusReason = qywxOrderStatusReason;
}
public Date getQywxPayTime() {
return qywxPayTime;
}
public void setQywxPayTime(Date qywxPayTime) {
this.qywxPayTime = qywxPayTime;
}
public Date getQywxRefundTime() {
return qywxRefundTime;
}
public void setQywxRefundTime(Date qywxRefundTime) {
this.qywxRefundTime = qywxRefundTime;
}
public String getReason() {
return reason;
}
public void setReason(String reason) {
this.reason = reason;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getExpireTime() {
return expireTime;
}
public void setExpireTime(Date expireTime) {
this.expireTime = expireTime;
}
public Date getNowTime() {
return nowTime;
}
public void setNowTime(Date nowTime) {
this.nowTime = nowTime;
}
public List<LicenceOrderProgressDTO> getOrderProgressList() {
return OrderProgressList;
}
public void setOrderProgressList(List<LicenceOrderProgressDTO> orderProgressList) {
OrderProgressList = orderProgressList;
}
}
package com.gic.haoban.manage.api.dto.licence;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author jx
* @since 2023-03-09
*/
public class LicenceOrderPageDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 订单id
*/
private Long orderId;
/**
* 订单类型,1:购买帐号,2:续期帐号
*/
private Integer orderType;
/**
* 互通帐号个数
*/
private Integer externalContactCount;
/**
* 基础帐号个数
*/
private Integer baseCount;
/**
* 订单金额,单位分
*/
private Integer price;
/**
* 购买时间类型 1:按月购买,2:按天购买
*/
private Integer timeType;
/**
* 购买的时间数值
*/
private Integer timeValue;
/**
* 支付类型 1在线支付 2对公转账
*/
private Integer payType;
/**
* 订单编号
*/
private String orderNumber;
/**
* 订单状态,0:待支付,1:已支付,2:已取消,3:已过期,4:已退款,5:审核中
*/
private Integer orderStatus;
/**
* 订单状态更改原因
*/
private String orderStatusReason;
/**
* 支付时间 支付类型为1:微信支付时间 2:审核确认通过的时间
*/
private Date payTime;
/**
* 企业微信订单id
*/
private String qywxOrderId;
/**
* 企业微信订单状态,0:待支付,1:已支付,2:已取消,3:已过期,4:退款中,5:退款被拒绝,6:已退款,7已失效
*/
private Integer qywxOrderStatus;
/**
* 企业微信订单更改原因
*/
private String qywxOrderStatusReason;
/**
* 创建时间
*/
private Date createTime;
/**
* 创建人
*/
private String creatorId;
/**
* 创建人名称
*/
private String creatorName;
/**
* 到期时间
*/
private Date expireTime;
/**
* 企业微信支付时间
*/
private Date qywxPayTime;
/**
* gic商户Id
*/
private String enterpriseId;
/**
* gic品牌名称
*/
private String enterpriseName;
/**
* wx企业Id
*/
private String wxEnterpriseId;
/**
* 微信商户名称
*/
private String wxEnterpriseName;
/**
* 微信订单id
*/
private String wxOrderId;
public String getWxOrderId() {
return wxOrderId;
}
public void setWxOrderId(String wxOrderId) {
this.wxOrderId = wxOrderId;
}
public Date getQywxPayTime() {
return qywxPayTime;
}
public void setQywxPayTime(Date qywxPayTime) {
this.qywxPayTime = qywxPayTime;
}
public String getEnterpriseId() {
return enterpriseId;
}
public void setEnterpriseId(String enterpriseId) {
this.enterpriseId = enterpriseId;
}
public String getEnterpriseName() {
return enterpriseName;
}
public void setEnterpriseName(String enterpriseName) {
this.enterpriseName = enterpriseName;
}
public String getWxEnterpriseId() {
return wxEnterpriseId;
}
public void setWxEnterpriseId(String wxEnterpriseId) {
this.wxEnterpriseId = wxEnterpriseId;
}
public String getWxEnterpriseName() {
return wxEnterpriseName;
}
public void setWxEnterpriseName(String wxEnterpriseName) {
this.wxEnterpriseName = wxEnterpriseName;
}
public Date getExpireTime() {
return expireTime;
}
public void setExpireTime(Date expireTime) {
this.expireTime = expireTime;
}
public Long getOrderId() {
return orderId;
}
public void setOrderId(Long orderId) {
this.orderId = orderId;
}
public Integer getOrderType() {
return orderType;
}
public void setOrderType(Integer orderType) {
this.orderType = orderType;
}
public Integer getExternalContactCount() {
return externalContactCount;
}
public void setExternalContactCount(Integer externalContactCount) {
this.externalContactCount = externalContactCount;
}
public Integer getBaseCount() {
return baseCount;
}
public void setBaseCount(Integer baseCount) {
this.baseCount = baseCount;
}
public Integer getPrice() {
return price;
}
public void setPrice(Integer price) {
this.price = price;
}
public Integer getTimeType() {
return timeType;
}
public void setTimeType(Integer timeType) {
this.timeType = timeType;
}
public Integer getTimeValue() {
return timeValue;
}
public void setTimeValue(Integer timeValue) {
this.timeValue = timeValue;
}
public Integer getPayType() {
return payType;
}
public void setPayType(Integer payType) {
this.payType = payType;
}
public String getOrderNumber() {
return orderNumber;
}
public void setOrderNumber(String orderNumber) {
this.orderNumber = orderNumber;
}
public Integer getOrderStatus() {
return orderStatus;
}
public void setOrderStatus(Integer orderStatus) {
this.orderStatus = orderStatus;
}
public String getOrderStatusReason() {
return orderStatusReason;
}
public void setOrderStatusReason(String orderStatusReason) {
this.orderStatusReason = orderStatusReason;
}
public Date getPayTime() {
return payTime;
}
public void setPayTime(Date payTime) {
this.payTime = payTime;
}
public String getQywxOrderId() {
return qywxOrderId;
}
public void setQywxOrderId(String qywxOrderId) {
this.qywxOrderId = qywxOrderId;
}
public Integer getQywxOrderStatus() {
return qywxOrderStatus;
}
public void setQywxOrderStatus(Integer qywxOrderStatus) {
this.qywxOrderStatus = qywxOrderStatus;
}
public String getQywxOrderStatusReason() {
return qywxOrderStatusReason;
}
public void setQywxOrderStatusReason(String qywxOrderStatusReason) {
this.qywxOrderStatusReason = qywxOrderStatusReason;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public String getCreatorId() {
return creatorId;
}
public void setCreatorId(String creatorId) {
this.creatorId = creatorId;
}
public String getCreatorName() {
return creatorName;
}
public void setCreatorName(String creatorName) {
this.creatorName = creatorName;
}
}
package com.gic.haoban.manage.api.dto.licence;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author jx
* @since 2023-03-09
*/
public class LicenceOrderProgressDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
private Long id;
/**
* 订单状态
*/
private String orderStatus;
/**
* 标记字段 1好办后台
*/
private Integer type;
/**
* 上传凭证url
*/
private String voucher;
/**
* 原因
*/
private String reason;
/**
* 创建时间
*/
private Date createTime;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getOrderStatus() {
return orderStatus;
}
public void setOrderStatus(String orderStatus) {
this.orderStatus = orderStatus;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public String getVoucher() {
return voucher;
}
public void setVoucher(String voucher) {
this.voucher = voucher;
}
public String getReason() {
return reason;
}
public void setReason(String reason) {
this.reason = reason;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
}
package com.gic.haoban.manage.api.dto.qdto.licence;
import com.gic.api.base.commons.BasePageInfo;
import java.io.Serializable;
/**
* <p>
*
* </p>
*
* @author jx
* @since 2023-03-09
*/
public class LicenceOrderPageQDTO extends BasePageInfo implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 订单编号
*/
private String orderNumber;
/**
* 订单状态,0:待支付,1:已支付,2:已取消,3:已过期,4:已退款,5:审核中
*/
private Integer orderStatus;
/**
* 企业微信订单id
*/
private String qywxOrderId;
/**
* 企业微信订单状态,0:待支付,1:已支付,2:已取消,3:已过期,4:退款中,5:退款被拒绝,6:已退款,7已失效
*/
private Integer qywxOrderStatus;
/**
* 订单创建开始时间
*/
private String startTime;
/**
* 订单创建结束时间
*/
private String endTime;
/**
* gic商户Id
*/
private String enterpriseId;
/**
* wx企业Id
*/
private String wxEnterpriseId;
/**
* 创建人名称
*/
private String creatorName;
/**
* 支付方式 1在线支付 2对公转账
*/
private Integer payType;
/**
* gic商户查询id
*/
private String enterpriseIdParam;
/**
* 微信订单id
*/
private String wxOrderId;
/**
* 1 好办后台 0 运维后台
*/
private Integer type;
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public String getWxOrderId() {
return wxOrderId;
}
public void setWxOrderId(String wxOrderId) {
this.wxOrderId = wxOrderId;
}
public String getEnterpriseIdParam() {
return enterpriseIdParam;
}
public void setEnterpriseIdParam(String enterpriseIdParam) {
this.enterpriseIdParam = enterpriseIdParam;
}
public Integer getPayType() {
return payType;
}
public void setPayType(Integer payType) {
this.payType = payType;
}
public String getEnterpriseId() {
return enterpriseId;
}
public void setEnterpriseId(String enterpriseId) {
this.enterpriseId = enterpriseId;
}
public String getWxEnterpriseId() {
return wxEnterpriseId;
}
public void setWxEnterpriseId(String wxEnterpriseId) {
this.wxEnterpriseId = wxEnterpriseId;
}
public String getCreatorName() {
return creatorName;
}
public void setCreatorName(String creatorName) {
this.creatorName = creatorName;
}
public String getOrderNumber() {
return orderNumber;
}
public void setOrderNumber(String orderNumber) {
this.orderNumber = orderNumber;
}
public Integer getOrderStatus() {
return orderStatus;
}
public void setOrderStatus(Integer orderStatus) {
this.orderStatus = orderStatus;
}
public String getQywxOrderId() {
return qywxOrderId;
}
public void setQywxOrderId(String qywxOrderId) {
this.qywxOrderId = qywxOrderId;
}
public Integer getQywxOrderStatus() {
return qywxOrderStatus;
}
public void setQywxOrderStatus(Integer qywxOrderStatus) {
this.qywxOrderStatus = qywxOrderStatus;
}
public String getStartTime() {
return startTime;
}
public void setStartTime(String startTime) {
this.startTime = startTime;
}
public String getEndTime() {
return endTime;
}
public void setEndTime(String endTime) {
this.endTime = endTime;
}
}
package com.gic.haoban.manage.api.dto.qdto.licence;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author jx
* @since 2023-03-09
*/
public class LicenceOrderQDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 订单id
*/
private Long orderId;
/**
* gic商户Id
*/
private String enterpriseId;
/**
* wx企业Id
*/
private String wxEnterpriseId;
/**
* 订单类型,1:购买帐号,2:续期帐号
*/
private Integer orderType;
/**
* 互通帐号个数
*/
private Integer externalContactCount;
/**
* 基础帐号个数
*/
private Integer baseCount;
/**
* 订单金额,单位分
*/
private Integer price;
/**
* 购买时间类型 1:按月购买,2:按天购买
*/
private Integer timeType;
/**
* 购买的时间数值
*/
private Integer timeValue;
/**
* 支付类型 1在线支付 2对公转账
*/
private Integer payType;
/**
* 订单编号
*/
private String transactionId;
/**
* 订单状态,0:待支付,1:已支付,2:已取消,3:已过期,4:已退款,5:审核中
*/
private Integer orderStatus;
/**
* 逻辑删除,0未删除,1删除
*/
private Integer deleteFlag;
/**
* 创建时间
*/
private Date createTime;
/**
* 过期时间 类型为在线支付 30分钟;类型为对公转账 3天
*/
private Date expireTime;
/**
* 更新时间
*/
private Date updateTime;
/**
* 创建人
*/
private String creatorId;
/**
* 创建人名称
*/
private String creatorName;
public Long getOrderId() {
return orderId;
}
public void setOrderId(Long orderId) {
this.orderId = orderId;
}
public String getEnterpriseId() {
return enterpriseId;
}
public void setEnterpriseId(String enterpriseId) {
this.enterpriseId = enterpriseId;
}
public String getWxEnterpriseId() {
return wxEnterpriseId;
}
public void setWxEnterpriseId(String wxEnterpriseId) {
this.wxEnterpriseId = wxEnterpriseId;
}
public Integer getOrderType() {
return orderType;
}
public void setOrderType(Integer orderType) {
this.orderType = orderType;
}
public Integer getExternalContactCount() {
return externalContactCount;
}
public void setExternalContactCount(Integer externalContactCount) {
this.externalContactCount = externalContactCount;
}
public Integer getBaseCount() {
return baseCount;
}
public void setBaseCount(Integer baseCount) {
this.baseCount = baseCount;
}
public Integer getPrice() {
return price;
}
public void setPrice(Integer price) {
this.price = price;
}
public Integer getTimeType() {
return timeType;
}
public void setTimeType(Integer timeType) {
this.timeType = timeType;
}
public Integer getTimeValue() {
return timeValue;
}
public void setTimeValue(Integer timeValue) {
this.timeValue = timeValue;
}
public Integer getPayType() {
return payType;
}
public void setPayType(Integer payType) {
this.payType = payType;
}
public String getTransactionId() {
return transactionId;
}
public void setTransactionId(String transactionId) {
this.transactionId = transactionId;
}
public Integer getOrderStatus() {
return orderStatus;
}
public void setOrderStatus(Integer orderStatus) {
this.orderStatus = orderStatus;
}
public Integer getDeleteFlag() {
return deleteFlag;
}
public void setDeleteFlag(Integer deleteFlag) {
this.deleteFlag = deleteFlag;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getExpireTime() {
return expireTime;
}
public void setExpireTime(Date expireTime) {
this.expireTime = expireTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public String getCreatorId() {
return creatorId;
}
public void setCreatorId(String creatorId) {
this.creatorId = creatorId;
}
public String getCreatorName() {
return creatorName;
}
public void setCreatorName(String creatorName) {
this.creatorName = creatorName;
}
}
......@@ -330,4 +330,11 @@ public interface StaffApiService {
* 转移员工许可
*/
com.gic.api.base.commons.ServiceResponse<TransferActiveCodeDTO> batchTransferLicense(List<TransferActiveCodeQDTO> transferActiveCodeQOList,String wxEnterpriseId);
/**
* 企业微信自动激活回调通知
* @param params 回调参数
* @return
*/
com.gic.api.base.commons.ServiceResponse<Boolean> autoActivateCallBack(String params) ;
}
package com.gic.haoban.manage.api.service.licence;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.haoban.manage.api.dto.licence.LicenceOrderDTO;
import com.gic.haoban.manage.api.dto.licence.LicenceOrderPageDTO;
import com.gic.haoban.manage.api.dto.qdto.licence.LicenceOrderPageQDTO;
import com.gic.haoban.manage.api.dto.qdto.licence.LicenceOrderQDTO;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
/**
* <p>
* 服务类
* </p>
*
* @author jx
* @since 2023-03-09
*/
public interface LicenceOrderApiService {
/**
* 获取订单详情
*
* @param orderId 订单id
* @return LicenceOrderDTO
*/
ServiceResponse<LicenceOrderDTO> getLicenceOrderDetail(Long orderId, Integer type);
/**
* 删除订单
*
* @param orderId 订单id
* @return
*/
ServiceResponse<Boolean> deleteLicenceOrder(Long orderId);
/**
* 新增或者修改订单详情
*
* @param licenceOrderQDTO
* @return
*/
ServiceResponse<String> saveOrUpdateLicenceOrder(LicenceOrderQDTO licenceOrderQDTO);
/**
* 分页查询订单数据
*
* @param licenceOrderPageQDTO
* @return
*/
ServiceResponse<Page<LicenceOrderPageDTO>> getLicenceOrderPage(LicenceOrderPageQDTO licenceOrderPageQDTO);
/**
* 更新订单状态
*
* @param orderId 订单id
* @param type 订单状态
* @param wxFlag 1微信订单状态 0 企业微信订单状态
* @return
*/
ServiceResponse<Boolean> updateLicenceOrderType(Long orderId, Integer type, String enterpriseId, String wxEnterpriseId, String creatorName, Integer wxFlag);
/**
* 订单凭证上传
*
* @param orderId 订单id
* @param voucher 凭证url
* @return
*/
ServiceResponse<Boolean> uploadLicenceOrderVoucher(Long orderId, String voucher, String enterpriseId, String wxEnterpriseId, String creatorName);
/**
* 订单支付接口
*
* @param orderId 订单id
* @return
*/
ServiceResponse<String> payLicenceOrder(Long orderId);
/**
* 查询企业是否存在订单未支付接口
*
* @param wxEnterpriseId 企业微信id
* @return
*/
ServiceResponse<String> isPayLicenceOrder(String wxEnterpriseId);
/**
* 微信通知回调接口
*/
ServiceResponse<Boolean> wxCallBack(String params);
/**
* 企业微信通知回调接口
*/
ServiceResponse<Boolean> qywxCallBack(String params);
/**
* 保存微信交易信息
*
* @param orderId 订单id
* @param transactionCode 订单编号
* @param prepayId 微信预支付id
* @param wxOrderId 微信支付id
* @return
*/
ServiceResponse<Boolean> saveTransactionCode(Long orderId, String transactionCode, String prepayId, String wxOrderId, Date payTime,String wxUrl);
/**
* 查询订单编号id
*
* @param param 查询参数
* @param type 0 订单编号 1 企业微信订单编号 2微信订单编号
* @param wxEnterpriseId
* @return
*/
ServiceResponse<List<String>> getOrderIdList(String param, Integer type, String wxEnterpriseId);
/**
* 审核订单
*
* @param orderId 订单id
* @param flag 是否通过 0 否 1是
* @param reason 不通过原因
* @return
*/
ServiceResponse<Boolean> checkLicenceOrder(Long orderId, Integer flag, String reason, String creatorName);
/**
* 微信退款
*
* @return
*/
ServiceResponse<Boolean> wxRefund(Long orderId);
/**
* 查询开户信息
*/
ServiceResponse<HashMap<String, String>> getAccountInfo();
/**
* 取消企业微信订单
*/
ServiceResponse<Boolean> cancelQywxOrder(Long orderId);
}
package com.gic.haoban.manage.web.config;
import com.ctrip.framework.apollo.spring.annotation.EnableApolloConfig;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
@Configuration
@EnableApolloConfig
public class Config {
@Value("${corpid}")
private String corpid;
@Value("${suiteid}")
private String suiteId;
@Value("${host}")
private String host;
@Value("${wxSuiteid}")
private String wxSuiteid;
@Value("${accountName}")
private String accountName;
@Value("${accountNumber}")
private String accountNumber;
@Value("${bankName}")
private String bankName;
public String getAccountName() {
return accountName;
}
public void setAccountName(String accountName) {
this.accountName = accountName;
}
public String getAccountNumber() {
return accountNumber;
}
public void setAccountNumber(String accountNumber) {
this.accountNumber = accountNumber;
}
public String getBankName() {
return bankName;
}
public void setBankName(String bankName) {
this.bankName = bankName;
}
public String getCorpid() {
return corpid;
}
public void setCorpid(String corpid) {
this.corpid = corpid;
}
public String getSuiteId() {
return suiteId;
}
public void setSuiteId(String suiteId) {
this.suiteId = suiteId;
}
public String getHost() {
return host;
}
public void setHost(String host) {
this.host = host;
}
public String getWxSuiteid() {
return wxSuiteid;
}
public void setWxSuiteid(String wxSuiteid) {
this.wxSuiteid = wxSuiteid;
}
}
package com.gic.haoban.manage.web.controller;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.authcenter.commons.dto.AuthcenterUserDetails;
import com.gic.authcenter.commons.util.SessionContextUtil;
import com.gic.commons.util.PageHelperUtils;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.enterprise.api.dto.EnterpriseDTO;
import com.gic.enterprise.api.service.EnterpriseService;
import com.gic.haoban.manage.api.dto.WxEnterpriseDTO;
import com.gic.haoban.manage.api.dto.licence.LicenceOrderDTO;
import com.gic.haoban.manage.api.dto.licence.LicenceOrderPageDTO;
import com.gic.haoban.manage.api.dto.qdto.licence.LicenceOrderPageQDTO;
import com.gic.haoban.manage.api.service.WxEnterpriseApiService;
import com.gic.haoban.manage.api.service.licence.LicenceOrderApiService;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import com.gic.haoban.manage.web.qo.licence.LicenceOrderPageQO;
import com.gic.haoban.manage.web.vo.licence.LicenceOrderPageVO;
import com.gic.haoban.manage.web.vo.licence.LicenceOrderVO;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
/**
* 企业微信许可账号购买
*
* @author jx
* @since 2023-03-09
*/
@RestController
@RequestMapping("/operation-licence-order")
public class LicenceOrderController {
private static Logger logger = LogManager.getLogger(LicenceOrderController.class);
@Autowired
private LicenceOrderApiService licenceOrderApiService;
@Autowired
private EnterpriseService enterpriseService;
@Autowired
private WxEnterpriseApiService wxEnterpriseApiService;
/**
* 查询订单详情
*/
@RequestMapping("licence-order-detail")
public RestResponse<LicenceOrderVO> getLicenceOrderDetail(@RequestParam Long orderId, HttpServletRequest request) {
AuthcenterUserDetails loginUser = (AuthcenterUserDetails) SessionContextUtil.getUser(request);
if (loginUser == null) {
return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_4.getCode()), HaoBanErrCode.ERR_4.getMsg());
}
ServiceResponse<LicenceOrderDTO> licenceOrderDetail = licenceOrderApiService.getLicenceOrderDetail(orderId, null);
LicenceOrderVO licenceOrderVO = JSONObject.parseObject(JSONObject.toJSONString(licenceOrderDetail.getResult()), LicenceOrderVO.class);
return RestResponse.successResult(licenceOrderVO);
}
/**
* 分页查询订单列表
*/
@RequestMapping("licence-order-page")
public RestResponse<Page<LicenceOrderPageVO>> getLicenceOrderPage(@RequestBody LicenceOrderPageQO licenceOrderPageQO, HttpServletRequest request) {
AuthcenterUserDetails loginUser = (AuthcenterUserDetails) SessionContextUtil.getUser(request);
if (loginUser == null) {
return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_4.getCode()), HaoBanErrCode.ERR_4.getMsg());
}
LicenceOrderPageQDTO qdto = JSONObject.parseObject(JSONObject.toJSONString(licenceOrderPageQO), LicenceOrderPageQDTO.class);
qdto.setType(0);
ServiceResponse<Page<LicenceOrderPageDTO>> licenceOrderPage = licenceOrderApiService.getLicenceOrderPage(qdto);
Page<LicenceOrderPageVO> result = PageHelperUtils.changePageToCurrentPage(licenceOrderPage.getResult(), LicenceOrderPageVO.class);
if (CollUtil.isNotEmpty(result.getResult())) {
for (LicenceOrderPageVO vo : result.getResult()) {
//查询gic品牌名称
EnterpriseDTO enterpriseDTO = enterpriseService.getEnterpriseById(vo.getEnterpriseId());
if (ObjectUtil.isNotNull(enterpriseDTO)) {
vo.setEnterpriseName(enterpriseDTO.getEnterpriseName());
}
WxEnterpriseDTO wxEnterpriseDTO = wxEnterpriseApiService.getOne(vo.getWxEnterpriseId());
if (ObjectUtil.isNotNull(wxEnterpriseDTO)) {
vo.setWxEnterpriseName(wxEnterpriseDTO.getCorpName());
}
}
}
return RestResponse.successResult(result);
}
/**
* 取消订单
*/
@RequestMapping("licence-order-cancel")
public RestResponse<Boolean> cancelLicenceOrder(@RequestParam Long orderId, HttpServletRequest request) {
AuthcenterUserDetails loginUser = (AuthcenterUserDetails) SessionContextUtil.getUser(request);
if (loginUser == null) {
return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_4.getCode()), HaoBanErrCode.ERR_4.getMsg());
}
ServiceResponse<Boolean> response = licenceOrderApiService.cancelQywxOrder(orderId);
if (!response.isSuccess()) {
return RestResponse.failure(response.getCode(), response.getMessage());
}
return RestResponse.successResult(true);
}
/**
* 支付订单
*/
@RequestMapping("licence-order-pay")
public RestResponse<String> payLicenceOrder(@RequestParam Long orderId, HttpServletRequest request) {
AuthcenterUserDetails loginUser = (AuthcenterUserDetails) SessionContextUtil.getUser(request);
if (loginUser == null) {
return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_4.getCode()), HaoBanErrCode.ERR_4.getMsg());
}
ServiceResponse<String> response = licenceOrderApiService.payLicenceOrder(orderId);
if (response.isSuccess()) {
return RestResponse.successResult(response.getResult());
}
return RestResponse.failure(response.getCode(), response.getMessage());
}
/**
* 审核订单
*
* @param orderId 订单id
* @param flag 是否通过 0 否 1是
* @param reason 不通过原因
* @return
*/
@RequestMapping("licence-order-check")
public RestResponse<Boolean> checkLicenceOrder(@RequestParam Long orderId, Integer flag, String reason, HttpServletRequest request) {
AuthcenterUserDetails loginUser = (AuthcenterUserDetails) SessionContextUtil.getUser(request);
if (loginUser == null) {
return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_4.getCode()), HaoBanErrCode.ERR_4.getMsg());
}
String clerkName = loginUser.getLoginName();
Boolean result = licenceOrderApiService.checkLicenceOrder(orderId, flag, reason, clerkName).getResult();
return RestResponse.successResult(result);
}
/**
* 订单编号和企业微信订单编号模糊搜索
*
* @param param 模糊查询
* @param type 0 订单编号 1 企业微信订单编号 2微信订单编号
* @return
*/
@RequestMapping("get-order-id-list")
public RestResponse<List<String>> getOrderIdList(String param, Integer type, HttpServletRequest request) {
AuthcenterUserDetails loginUser = (AuthcenterUserDetails) SessionContextUtil.getUser(request);
if (loginUser == null) {
return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_4.getCode()), HaoBanErrCode.ERR_4.getMsg());
}
ServiceResponse<List<String>> orderIdList = licenceOrderApiService.getOrderIdList(param, type, null);
return RestResponse.successResult(orderIdList.getResult());
}
/**
* 查询开户信息
*/
@RequestMapping("get-account-info")
public RestResponse<HashMap<String, String>> getAccountInfo(HttpServletRequest request) {
AuthcenterUserDetails loginUser = (AuthcenterUserDetails) SessionContextUtil.getUser(request);
if (loginUser == null) {
return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_4.getCode()), HaoBanErrCode.ERR_4.getMsg());
}
HashMap<String, String> result = licenceOrderApiService.getAccountInfo().getResult();
return RestResponse.successResult(result);
}
/**
* 申请退款
*/
@RequestMapping("licence-order-wxRefoud")
public RestResponse<Boolean> wxRefund(@RequestParam Long orderId, HttpServletRequest request) {
AuthcenterUserDetails loginUser = (AuthcenterUserDetails) SessionContextUtil.getUser(request);
if (loginUser == null) {
return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_4.getCode()), HaoBanErrCode.ERR_4.getMsg());
}
ServiceResponse<Boolean> response = licenceOrderApiService.wxRefund(orderId);
if (response.isSuccess()){
return RestResponse.successResult(true);
}
return RestResponse.failure(response.getCode(), response.getMessage());
}
}
package com.gic.haoban.manage.web.qo.licence;
import com.gic.api.base.commons.BasePageInfo;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
/**
* <p>
*
* </p>
*
* @author jx
* @since 2023-03-09
*/
@Data
@EqualsAndHashCode(callSuper = false)
public class LicenceOrderPageQO extends BasePageInfo implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 订单编号
*/
private String orderNumber;
/**
* 订单状态,0:待支付,1:已支付,2:已取消,3:已过期,4:已退款,5:审核中
*/
private Integer orderStatus;
/**
* 企业微信订单id
*/
private String qywxOrderId;
/**
* 企业微信订单状态,0:待支付,1:已支付,2:已取消,3:已过期,4:退款中,5:退款被拒绝,6:已退款,7已失效
*/
private Integer qywxOrderStatus;
/**
* 订单创建开始时间
*/
private String startTime;
/**
* 订单创建结束时间
*/
private String endTime;
/**
* 支付方式 1在线支付 2对公转账
*/
private Integer payType;
/**
* gic商户查询id
*/
private String enterpriseIdParam;
/**
* 微信订单id
*/
private String wxOrderId;
}
package com.gic.haoban.manage.web.qo.licence;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
/**
* <p>
*
* </p>
*
* @author jx
* @since 2023-03-09
*/
@Data
@EqualsAndHashCode(callSuper = false)
public class LicenceOrderQO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 订单类型,1:购买帐号,2:续期帐号
*/
private Integer orderType;
/**
* 互通帐号个数
*/
private Integer externalContactCount;
// /**
// * 基础帐号个数
// */
// private Integer baseCount;
/**
* 订单金额,单位分
*/
private Integer price;
/**
* 购买时间类型 1:按月购买,2:按天购买
*/
private Integer timeType;
/**
* 购买的时间数值
*/
private Integer timeValue;
/**
* 支付类型 1在线支付 2对公转账
*/
private Integer payType;
/**
* 校验金额
*/
public Integer checkPrice(){
if (this.externalContactCount ==null || this.externalContactCount<0){
return -1;
}
Integer myPrice=0;
//根据企业微信的计费规则计算
if (this.externalContactCount<=5){
myPrice = 50*this.externalContactCount;
} else if (this.externalContactCount<=200) {
myPrice = 250+40*(this.externalContactCount-5);
} else if (this.externalContactCount<=500) {
myPrice = 8050+30*(this.externalContactCount-200);
} else if (this.externalContactCount<=1000) {
myPrice = 17050+20*(this.externalContactCount-500);
} else if (this.externalContactCount<=10000) {
myPrice = 27050+10*(this.externalContactCount-1000);
}else {
return -1;
}
//转化为分
myPrice = myPrice*this.timeValue*100;
if (this.timeType == 1){
//企业微信的规则: 12.312,最终保留的是12.32
if (myPrice%12==0){
myPrice = myPrice/12;
}else {
myPrice = myPrice/12+1;
}
}else {
if (myPrice%372==0){
myPrice = myPrice/372;
}else {
myPrice = myPrice/372+1;
}
}
if (!this.price .equals(myPrice)){
return 0;
}
return 1;
}
}
package com.gic.haoban.manage.web.vo.licence;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author jx
* @since 2023-03-09
*/
@Data
@EqualsAndHashCode(callSuper = false)
public class LicenceOrderPageVO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 订单id
*/
private Long orderId;
/**
* 订单类型,1:购买帐号,2:续期帐号
*/
private Integer orderType;
/**
* 互通帐号个数
*/
private Integer externalContactCount;
/**
* 基础帐号个数
*/
private Integer baseCount;
/**
* 订单金额,单位分
*/
private Integer price;
/**
* 购买时间类型 1:按月购买,2:按天购买
*/
private Integer timeType;
/**
* 购买的时间数值
*/
private Integer timeValue;
/**
* 支付类型 1在线支付 2对公转账
*/
private Integer payType;
/**
* 订单编号
*/
private String orderNumber;
/**
* 订单状态,0:待支付,1:已支付,2:已取消,3:已过期,4:已退款,5:审核中
*/
private Integer orderStatus;
/**
* 订单状态更改原因
*/
private String orderStatusReason;
/**
* 支付时间 支付类型为1:微信支付时间 2:审核确认通过的时间
*/
private Date payTime;
/**
* 企业微信订单id
*/
private String qywxOrderId;
/**
* 企业微信订单状态,0:待支付,1:已支付,2:已取消,3:已过期,4:退款中,5:退款被拒绝,6:已退款,7已失效
*/
private Integer qywxOrderStatus;
/**
* 企业微信订单更改原因
*/
private String qywxOrderStatusReason;
/**
* 创建时间
*/
private Date createTime;
/**
* 创建人
*/
private String creatorId;
/**
* 创建人名称
*/
private String creatorName;
/**
* 企业微信支付时间
*/
private Date qywxPayTime;
/**
* gic商户Id
*/
private String enterpriseId;
/**
* gic品牌名称
*/
private String enterpriseName;
/**
* wx企业Id
*/
private String wxEnterpriseId;
/**
* 微信商户名称
*/
private String wxEnterpriseName;
/**
* 微信订单id
*/
private String wxOrderId;
}
package com.gic.haoban.manage.web.vo.licence;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author jx
* @since 2023-03-09
*/
@Data
@EqualsAndHashCode(callSuper = false)
public class LicenceOrderProgressVO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
private Long id;
/**
* 订单状态
*/
private String orderStatus;
/**
* 标记字段 1好办后台
*/
private Integer type;
/**
* 上传凭证url
*/
private String voucher;
/**
* 原因
*/
private String reason;
/**
* 创建时间
*/
private Date createTime;
}
package com.gic.haoban.manage.web.vo.licence;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* <p>
*
* </p>
*
* @author jx
* @since 2023-03-09
*/
@Data
@EqualsAndHashCode(callSuper = false)
public class LicenceOrderVO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 订单id
*/
private Long orderId;
/**
* gic商户Id
*/
private String enterpriseId;
/**
* gic品牌名称
*/
private String enterpriseName;
/**
* wx企业Id
*/
private String wxEnterpriseId;
/**
* 企业微信商户名称
*/
private String wxEnterpriseName;
/**
* 订单类型,1:购买帐号,2:续期帐号
*/
private Integer orderType;
/**
* 互通帐号个数
*/
private Integer externalContactCount;
/**
* 基础帐号个数
*/
private Integer baseCount;
/**
* 订单金额,单位分
*/
private Integer price;
/**
* 购买时间类型 1:按月购买,2:按天购买
*/
private Integer timeType;
/**
* 购买的时间数值
*/
private Integer timeValue;
/**
* 支付类型 1在线支付 2对公转账
*/
private Integer payType;
/**
* 订单编号
*/
private String orderNumber;
/**
* 上传凭证url
*/
private String voucher;
/**
* 订单状态,0:待支付,1:已支付,2:已取消,3:已过期,4:已退款,5:审核中
*/
private Integer orderStatus;
/**
* 订单状态更改原因
*/
private String orderStatusReason;
/**
* 支付时间 支付类型为1:微信支付时间 2:上传凭证时间
*/
private Date payTime;
/**
* 退款时间
*/
private Date refundTime;
/**
* 企业微信订单id
*/
private String qywxOrderId;
/**
* 企业微信订单状态,0:待支付,1:已支付,2:已取消,3:已过期,4:退款中,5:退款被拒绝,6:已退款,7已失效
*/
private Integer qywxOrderStatus;
/**
* 企业微信订单更改原因
*/
private String qywxOrderStatusReason;
/**
* 企业微信支付时间
*/
private Date qywxPayTime;
/**
* 企业微信退款时间
*/
private Date qywxRefundTime;
/**
* 审核不通过原因
*/
private String reason;
/**
* 创建时间
*/
private Date createTime;
/**
* 到期时间
*/
private Date expireTime;
/**
* 当前时间
*/
private Date nowTime;
/**
* 订单进度list
*/
private List<LicenceOrderProgressVO> OrderProgressList;
}
......@@ -67,4 +67,5 @@
<dubbo:reference interface="com.gic.haoban.manage.api.service.fee.HaobanQywxFeeApiService" id="haobanQywxFeeApiService"/>
<dubbo:reference interface="com.gic.haoban.manage.api.service.role.HaobanRoleApiService" id="haobanRoleApiService"/>
<dubbo:reference interface="com.gic.haoban.manage.api.service.role.HaobanMenuApiService" id="haobanMenuApiService"/>
<dubbo:reference interface="com.gic.haoban.manage.api.service.licence.LicenceOrderApiService" id="licenceOrderApiService"/>
</beans>
......@@ -29,6 +29,50 @@ public class Config {
@Value("${addDelFriendEvent}")
private String addDelFriendEvent;
@Value("${buyerUserid}")
private String buyerUserid;
/**
* 企业微信许可账号购买信息
*/
@Value("${accountName}")
private String accountName;
@Value("${accountNumber}")
private String accountNumber;
@Value("${bankName}")
private String bankName;
public String getAccountName() {
return accountName;
}
public void setAccountName(String accountName) {
this.accountName = accountName;
}
public String getAccountNumber() {
return accountNumber;
}
public void setAccountNumber(String accountNumber) {
this.accountNumber = accountNumber;
}
public String getBankName() {
return bankName;
}
public void setBankName(String bankName) {
this.bankName = bankName;
}
public String getBuyerUserid() {
return buyerUserid;
}
public void setBuyerUserid(String buyerUserid) {
this.buyerUserid = buyerUserid;
}
public String getHmLinkUrl() {
return hmLinkUrl;
}
......
package com.gic.haoban.manage.service.dao.mapper.licence;
import com.gic.haoban.manage.api.dto.qdto.licence.LicenceOrderPageQDTO;
import com.gic.haoban.manage.service.entity.licence.TabHaobanLicenceOrder;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
/**
* <p>
* Mapper 接口
* </p>
*
* @author jx
* @since 2023-03-09
*/
public interface TabHaobanLicenceOrderMapper {
/**
* 获取订单详情
*
* @param orderId
* @return
*/
TabHaobanLicenceOrder selectById(@Param("orderId") Long orderId);
/**
* 新增订单
*
* @param tabHaobanLicenceOrder
* @return
*/
Integer insert(TabHaobanLicenceOrder tabHaobanLicenceOrder);
/**
* 删除订单
*
* @param orderId
* @return
*/
Integer deleteById(@Param("orderId") Long orderId);
/**
* 跟新订单状态
*
* @param orderId
* @param type
* @return
*/
Integer updateLicenceOrderType(@Param("orderId") Long orderId, @Param("type") Integer type);
/**
* 跟新企业微信订单状态
*
* @param orderId
* @param type
* @return
*/
Integer updateQywxOrderType(@Param("orderId") Long orderId, @Param("type") Integer type);
/**
* 上传订单支付凭证
*
* @param orderId
* @param voucher
* @return
*/
Integer uploadLicenceOrderVoucher(@Param("orderId") Long orderId, @Param("voucher") String voucher);
/**
* 根据wxEnterpriseId查询企业是否存在未支付订单
*
* @param wxEnterpriseId
* @return order_id
*/
String selectByWxEnterpriseId(@Param("wxEnterpriseId") String wxEnterpriseId);
/**
* 分页查询订单列表
*
* @param licenceOrderPageQDTO
* @return
*/
List<TabHaobanLicenceOrder> getLicenceOrderPage(LicenceOrderPageQDTO licenceOrderPageQDTO);
Integer saveTransactionCode(@Param("orderId") Long orderId, @Param("orderNumber") String orderNumber, @Param("prepayId") String prepayId,
@Param("wxOrderId") String wxOrderId, @Param("payTime") Date payTime, @Param("wxUrl") String wxUrl);
/**
* 获取订单详情
*
* @param orderNumber 订单编号
* @return
*/
TabHaobanLicenceOrder selectByTransactionId(@Param("orderNumber") String orderNumber);
/**
* @param qywxOrderId 企业微信订单id
* @return
*/
TabHaobanLicenceOrder selectByQywxOrderId(@Param("qywxOrderId") String qywxOrderId);
/**
* 保存企业微信订单id
*
* @param orderId
* @param qywxOrderId
* @return
*/
Integer saveQywxOrderId(@Param("orderId") Long orderId, @Param("qywxOrderId") String qywxOrderId);
List<String> getTransactionIdList(@Param("orderNumber") String orderNumber, @Param("wxEnterpriseId") String wxEnterpriseId);
List<String> getQywxOrderId(@Param("qywxOrderId") String qywxOrderId, @Param("wxEnterpriseId") String wxEnterpriseId);
List<String> getWxOrderId(@Param("wxOrderId") String wxOrderId, @Param("wxEnterpriseId") String wxEnterpriseId);
Integer saveOrderCheckReason(@Param("orderId") Long orderId, @Param("reason") String reason, @Param("type") Integer type);
/**
* 记录回调时间
*
* @param orderId 订单id
* @param type 0 微信支付时间 1 微信退款时间 2 企业微信支付时间 3企业微信退款时间
* @param time
* @return
*/
Integer saveCallBackTime(@Param("orderId") Long orderId, @Param("type") Integer type, @Param("time") Date time);
}
package com.gic.haoban.manage.service.dao.mapper.licence;
import com.gic.haoban.manage.service.entity.licence.TabHaobanLicenceOrderProgress;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>
* Mapper 接口
* </p>
*
* @author jx
* @since 2023-03-09
*/
public interface TabHaobanLicenceOrderProgressMapper {
/**
* 插入订单进度数据
* @param tabHaobanLicenceOrderProgress
* @return
*/
Integer insert(TabHaobanLicenceOrderProgress tabHaobanLicenceOrderProgress);
List<TabHaobanLicenceOrderProgress> getListByOrderId(@Param("orderId") Long orderId,@Param("type") Integer type);
Integer deleteByOrderId(@Param("orderId") Long orderId);
Integer uploadLicenceOrderVoucher(@Param("orderId")Long orderId, @Param("voucher")String voucher);
}
package com.gic.haoban.manage.service.entity.licence;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author jx
* @since 2023-03-09
*/
@Data
@EqualsAndHashCode(callSuper = false)
public class TabHaobanLicenceOrder implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 订单id
*/
private Long orderId;
/**
* gic商户Id
*/
private String enterpriseId;
/**
* wx企业Id
*/
private String wxEnterpriseId;
/**
* 订单类型,1:购买帐号,2:续期帐号
*/
private Integer orderType;
/**
* 互通帐号个数
*/
private Integer externalContactCount;
/**
* 基础帐号个数
*/
private Integer baseCount;
/**
* 订单金额,单位分
*/
private Integer price;
/**
* 购买时间类型 1:按月购买,2:按天购买
*/
private Integer timeType;
/**
* 购买的时间数值
*/
private Integer timeValue;
/**
* 支付类型 1在线支付 2对公转账
*/
private Integer payType;
/**
* 订单编号
*/
private String orderNumber;
/**
* 上传凭证url
*/
private String voucher;
/**
* 订单状态,0:待支付,1:已支付,2:已取消,3:已过期,4:已退款,5:审核中
*/
private Integer orderStatus;
/**
* 订单状态更改原因
*/
private String orderStatusReason;
/**
* 支付类型为1:微信支付时间 2:上传凭证时间
*/
private Date payTime;
/**
* 退款时间
*/
private Date refundTime;
/**
* 企业微信订单id
*/
private String qywxOrderId;
/**
* 企业微信订单状态,0:待支付,1:已支付,2:已取消,3:已过期,4:退款中,5:退款被拒绝,6:已退款,7已失效
*/
private Integer qywxOrderStatus;
/**
* 企业微信订单更改原因
*/
private String qywxOrderStatusReason;
/**
* 企业微信支付时间
*/
private Date qywxPayTime;
/**
* 企业微信退款时间
*/
private Date qywxRefundTime;
/**
* 审核不通过原因
*/
private String reason;
/**
* 逻辑删除,0未删除,1删除
*/
private Integer deleteFlag;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
/**
* 创建人
*/
private String creatorId;
/**
* 创建人名称
*/
private String creatorName;
/**
* 到期时间
*/
private Date expireTime;
/**
* 微信预支付交易id
*/
private String prepayId;
/**
* 微信支付id
*/
private String wxOrderId;
/**
* 微信url
*/
private String wxUrl;
}
package com.gic.haoban.manage.service.entity.licence;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author jx
* @since 2023-03-09
*/
@Data
@EqualsAndHashCode(callSuper = false)
public class TabHaobanLicenceOrderProgress implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
private Long id;
/**
* gic商户Id
*/
private String enterpriseId;
/**
* wx企业Id
*/
private String wxEnterpriseId;
/**
* 订单id
*/
private Long orderId;
/**
* 订单状态
*/
private String orderStatus;
/**
* 标记字段 1好办后台
*/
private Integer type;
/**
* 上传凭证url
*/
private String voucher;
/**
* 原因
*/
private String reason;
/**
* 逻辑删除,0未删除,1删除
*/
private Integer deleteFlag;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
/**
* 创建人名称
*/
private String creatorName;
}
......@@ -9,6 +9,7 @@ public enum HaoBanErrCode {
ERR_10012("10012","企业微信不存在"),
ERR_OTHER("9999","业务异常"),
ERR_100033("100033", "活码分组已经被关联,不可删除"),
ERR_100034("100034", "无法删除该分组"),
ERR_2000("2000", "企微接口调用次数限制-月"),
ERR_2001("2001", "企微接口调用次数限制-天"),
ERR_2002("2002", "企微接口调用次数限制-小时"),
......
package com.gic.haoban.manage.service.service.licence;
import com.gic.haoban.manage.service.entity.licence.TabHaobanLicenceOrderProgress;
import java.util.List;
/**
* <p>
* 服务类
* </p>
*
* @author jx
* @since 2023-03-09
*/
public interface LicenceOrderProgressService {
Integer insert(TabHaobanLicenceOrderProgress tabHaobanLicenceOrderProgress);
List<TabHaobanLicenceOrderProgress> getListByOrderId(Long orderId,Integer type);
Integer deleteByOrderId(Long orderId);
}
package com.gic.haoban.manage.service.service.licence;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.haoban.manage.api.dto.licence.LicenceOrderPageDTO;
import com.gic.haoban.manage.api.dto.qdto.licence.LicenceOrderPageQDTO;
import com.gic.haoban.manage.api.dto.qdto.licence.LicenceOrderQDTO;
import com.gic.haoban.manage.service.entity.licence.TabHaobanLicenceOrder;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
/**
* <p>
* 企业微信许可账号购买
* </p>
*
* @author jx
* @since 2023-03-09
*/
public interface LicenceOrderService {
/**
* 查询企业微信订单详情
*
* @param orderId 订单id
* @return
*/
TabHaobanLicenceOrder getLicenceOrderDetail(Long orderId);
/**
* 删除订单
*
* @param orderId 订单id
* @return
*/
Integer deleteLicenceOrder(Long orderId);
/**
* 新增或者修改订单
*
* @param licenceOrderQDTO
* @return orderId
*/
String saveOrUpdateLicenceOrder(LicenceOrderQDTO licenceOrderQDTO);
/**
* 更新订单状态
*
* @param orderId 订单id
* @param type 订单状态
* @param wxFlag 1微信订单状态 0 企业微信订单状态
* @return
*/
Boolean updateLicenceOrderType(Long orderId, Integer type, String enterpriseId, String wxEnterpriseId, String creatorName, Integer wxFlag);
/**
* 上次订单支付凭证
*
* @param orderId 订单id
* @param voucher 凭证url
* @return
*/
Boolean uploadLicenceOrderVoucher(Long orderId, String voucher, String enterpriseId, String wxEnterpriseId, String creatorName);
/**
* 查询企业是否存在订单未支付接口
*
* @param wxEnterpriseId 企业微信id
* @return
*/
String isPayLicenceOrder(String wxEnterpriseId);
/**
* 分页查询订单列表
*
* @param licenceOrderPageQDTO
* @return
*/
Page<LicenceOrderPageDTO> getLicenceOrderPage(LicenceOrderPageQDTO licenceOrderPageQDTO);
/**
* 保存微信交易信息
*
* @param orderId 订单id
* @param transactionCode 订单编号
* @param prepayId 微信预支付id
* @param wxOrderId 微信支付id
* @return
*/
Integer saveTransactionCode(Long orderId, String transactionCode, String prepayId, String wxOrderId, Date payTime,String wxUrl);
/**
* 查询微信订单详情
*
* @param transactionId 订单编号
* @return
*/
TabHaobanLicenceOrder selectByTransactionId(String transactionId);
/**
* 查询订单详情
* @param qywxOrderId 企业微信订单id
* @return
*/
TabHaobanLicenceOrder selectByQywxOrderId(String qywxOrderId);
/**
* 保存企业微信订单id
*
* @param orderId
* @param qywxOrderId
* @return
*/
Integer saveQywxOrderId(Long orderId, String qywxOrderId);
/**
* 查询订单编号id
* @param param 查询参数
* @param type 0 微信订单编号 1 企业微信订单编号
* @param wxEnterpriseId
* @return
*/
List<String> getOrderIdList(String param, Integer type, String wxEnterpriseId);
/**
* 审核订单
* @param orderId 订单id
* @param flag 是否通过 0 否 1是
* @param reason 不通过原因
* @return
*/
Boolean checkLicenceOrder(Long orderId,Integer flag,String reason,String creatorName);
/**
* 记录回调时间
* @param orderId 订单id
* @param type 0 微信支付时间 1 微信退款时间 2 企业微信支付时间 3企业微信退款时间
* @param time
* @return
*/
Boolean saveCallBackTime(Long orderId,Integer type,Date time);
}
package com.gic.haoban.manage.service.service.licence.impl;
import com.gic.haoban.manage.service.dao.mapper.licence.TabHaobanLicenceOrderProgressMapper;
import com.gic.haoban.manage.service.entity.licence.TabHaobanLicenceOrderProgress;
import com.gic.haoban.manage.service.service.licence.LicenceOrderProgressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @description:
* @Author: wenhua
* @Date: 2023/3/9 17:02
*/
@Service
public class LicenceOrderProgressServiceImpl implements LicenceOrderProgressService {
@Autowired
private TabHaobanLicenceOrderProgressMapper tabHaobanLicenceOrderProgressMapper;
@Override
public Integer insert(TabHaobanLicenceOrderProgress tabHaobanLicenceOrderProgress) {
Integer insert = tabHaobanLicenceOrderProgressMapper.insert(tabHaobanLicenceOrderProgress);
return insert;
}
@Override
public List<TabHaobanLicenceOrderProgress> getListByOrderId(Long orderId,Integer type) {
List<TabHaobanLicenceOrderProgress> list = tabHaobanLicenceOrderProgressMapper.getListByOrderId(orderId,type);
return list;
}
@Override
public Integer deleteByOrderId(Long orderId) {
return tabHaobanLicenceOrderProgressMapper.deleteByOrderId(orderId);
}
}
package com.gic.haoban.manage.service.service.licence.impl;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.clerk.api.dto.ClerkDTO;
import com.gic.clerk.api.service.ClerkService;
import com.gic.commons.util.DateUtil;
import com.gic.commons.util.PageHelperUtils;
import com.gic.commons.util.UniqueIdUtils;
import com.gic.enterprise.api.dto.EnterpriseDTO;
import com.gic.enterprise.api.service.EnterpriseService;
import com.gic.haoban.manage.api.dto.WxEnterpriseDTO;
import com.gic.haoban.manage.api.dto.licence.LicenceOrderPageDTO;
import com.gic.haoban.manage.api.dto.qdto.licence.LicenceOrderPageQDTO;
import com.gic.haoban.manage.api.dto.qdto.licence.LicenceOrderQDTO;
import com.gic.haoban.manage.api.service.WxEnterpriseApiService;
import com.gic.haoban.manage.service.config.Config;
import com.gic.haoban.manage.service.dao.mapper.licence.TabHaobanLicenceOrderMapper;
import com.gic.haoban.manage.service.dao.mapper.licence.TabHaobanLicenceOrderProgressMapper;
import com.gic.haoban.manage.service.entity.licence.TabHaobanLicenceOrder;
import com.gic.haoban.manage.service.entity.licence.TabHaobanLicenceOrderProgress;
import com.gic.haoban.manage.service.service.licence.LicenceOrderService;
import com.gic.haoban.manage.service.util.DingUtils;
import com.gic.marketing.api.dto.SmsSendResponseDTO;
import com.gic.marketing.api.service.AccountOverdueSmsSendService;
import com.github.pagehelper.PageHelper;
import org.apache.commons.lang.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
/**
* @description:
* @Author: wenhua
* @Date: 2023/3/9 17:01
*/
@Service
public class LicenceOrderServiceImpl implements LicenceOrderService {
private static Logger logger = LogManager.getLogger(LicenceOrderServiceImpl.class);
@Autowired
private TabHaobanLicenceOrderMapper tabHaobanLicenceOrderMapper;
@Autowired
private TabHaobanLicenceOrderProgressMapper tabHaobanLicenceOrderProgressMapper;
@Autowired
private EnterpriseService enterpriseService;
@Autowired
private WxEnterpriseApiService wxEnterpriseApiService;
@Autowired
private AccountOverdueSmsSendService accountOverdueSmsSendService;
@Autowired
private ClerkService clerkService;
@Autowired
private Config config;
@Override
public TabHaobanLicenceOrder getLicenceOrderDetail(Long orderId) {
TabHaobanLicenceOrder tabHaobanLicenceOrder = tabHaobanLicenceOrderMapper.selectById(orderId);
return tabHaobanLicenceOrder;
}
@Override
public Integer deleteLicenceOrder(Long orderId) {
return tabHaobanLicenceOrderMapper.deleteById(orderId);
}
@Override
@Transactional(rollbackFor = Exception.class)
public String saveOrUpdateLicenceOrder(LicenceOrderQDTO licenceOrderQDTO) {
long orderId = UniqueIdUtils.uniqueLong();
//订单不支持修改,只能新增
TabHaobanLicenceOrder order = JSONObject.parseObject(JSONObject.toJSONString(licenceOrderQDTO), TabHaobanLicenceOrder.class);
Date now = new Date();
order.setOrderId(orderId);
//默认支付状态为待支付
order.setOrderStatus(0);
order.setCreateTime(now);
order.setUpdateTime(now);
//生成订单编号
String num = "ZH"+orderId;
order.setOrderNumber(num);
Date expireTime;
if(order.getPayType()==1){
expireTime = DateUtil.addNumForMinute(now, 30);
}else {
expireTime = DateUtil.addDay(now, 3);
}
order.setExpireTime(expireTime);
tabHaobanLicenceOrderMapper.insert(order);
//记录订单进度
saveOrderProgress(orderId,"创建订单",licenceOrderQDTO.getEnterpriseId(),licenceOrderQDTO.getWxEnterpriseId(),licenceOrderQDTO.getCreatorName(),1,null,null);
return String.valueOf(orderId);
}
private void saveOrderProgress(Long orderId,String orderStatus,String enterpriseId,String wxEnterpriseId,String creatorName,Integer type,String voucher,String reason){
TabHaobanLicenceOrderProgress orderProgress = new TabHaobanLicenceOrderProgress();
orderProgress.setId(UniqueIdUtils.uniqueLong());
orderProgress.setEnterpriseId(enterpriseId);
orderProgress.setWxEnterpriseId(wxEnterpriseId);
orderProgress.setOrderId(orderId);
orderProgress.setOrderStatus(orderStatus);
orderProgress.setType(type);
orderProgress.setVoucher(voucher);
orderProgress.setReason(reason);
orderProgress.setCreatorName(creatorName);
tabHaobanLicenceOrderProgressMapper.insert(orderProgress);
}
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean updateLicenceOrderType(Long orderId, Integer type,String enterpriseId,String wxEnterpriseId,String creatorName,Integer wxFlag) {
if(wxFlag == 1){
//更新微信订单状态
tabHaobanLicenceOrderMapper.updateLicenceOrderType(orderId,type);
}else {
//更新企业微信订单状态
tabHaobanLicenceOrderMapper.updateQywxOrderType(orderId,type);
}
//记录订单进度
switch (type){
case 0:
saveOrderProgress(orderId,"创建订单",enterpriseId,wxEnterpriseId,creatorName,wxFlag,null,null);
break;
case 1:
saveOrderProgress(orderId,"已支付",enterpriseId,wxEnterpriseId,creatorName,wxFlag,null,null);
break;
case 2:
saveOrderProgress(orderId,"已取消",enterpriseId,wxEnterpriseId,creatorName,wxFlag,null,null);
break;
case 3:
saveOrderProgress(orderId,"已过期",enterpriseId,wxEnterpriseId,creatorName,wxFlag,null,null);
break;
case 4:
if (wxFlag==1){
saveOrderProgress(orderId,"已退款",enterpriseId,wxEnterpriseId,creatorName,wxFlag,null,null);
break;
}
saveOrderProgress(orderId,"退款中",enterpriseId,wxEnterpriseId,creatorName,wxFlag,null,null);
break;
case 5:
saveOrderProgress(orderId,"退款被拒绝",enterpriseId,wxEnterpriseId,creatorName,wxFlag,null,null);
break;
case 6:
saveOrderProgress(orderId,"已退款",enterpriseId,wxEnterpriseId,creatorName,wxFlag,null,null);
break;
case 7:
saveOrderProgress(orderId,"以失效",enterpriseId,wxEnterpriseId,creatorName,wxFlag,null,null);
break;
default:
break;
}
return true;
}
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean uploadLicenceOrderVoucher(Long orderId, String voucher,String enterpriseId,String wxEnterpriseId,String creatorName) {
TabHaobanLicenceOrder tabHaobanLicenceOrder = tabHaobanLicenceOrderMapper.selectById(orderId);
if (tabHaobanLicenceOrder == null){
return false;
}
tabHaobanLicenceOrderMapper.uploadLicenceOrderVoucher(orderId,voucher);
//记录订单进度
if (StrUtil.isNotBlank(tabHaobanLicenceOrder.getVoucher())){
saveOrderProgress(orderId,"凭证已重新上传,审核中",enterpriseId,wxEnterpriseId,creatorName,1,voucher,null);
}else {
saveOrderProgress(orderId,"凭证已上传,审核中",enterpriseId,wxEnterpriseId,creatorName,1,voucher,null);
}
//查询gic品牌名称
String enterpriseName="";
String wxEnterpriseName="";
EnterpriseDTO enterpriseDTO = enterpriseService.getEnterpriseById(enterpriseId);
if (ObjectUtil.isNotNull(enterpriseDTO)){
enterpriseName=enterpriseDTO.getEnterpriseName();
}
WxEnterpriseDTO wxEnterpriseDTO = wxEnterpriseApiService.getOne(wxEnterpriseId);
if (ObjectUtil.isNotNull(wxEnterpriseDTO)){
wxEnterpriseName=wxEnterpriseDTO.getCorpName();
}
String dateToStr = DateUtil.dateToStr(new Date(), DateUtil.FORMAT_DATETIME_19);
//发送钉钉消息通知
String host = config.getHost();
// 最后一个分隔符位置
int lastIndex = host.lastIndexOf("/");
// 倒数第二个分隔符位置
int secondLastIndex = host.lastIndexOf("/", lastIndex - 1);
String subHost = host.substring(0, secondLastIndex + 1);
String url = subHost + "enterprise-operation/#/finance-config/wx-order-detail?tabId=wx_account_order&orderId="+orderId;
String msg = "标题:企微账号许可通知\n品牌名称:" + enterpriseName + "\n" + "企业名称:" + wxEnterpriseName + "\n" + "消息内容:" + dateToStr +
"新增订单(编号:" + tabHaobanLicenceOrder.getOrderNumber() + "),请尽快处理!\n" + url;
DingUtils.send(msg,"https://oapi.dingtalk.com/robot/send?access_token=63074c9fc1ac2c00aa62477facdf16e5fa2388cf6a621edba1fb05d6e55d031f",true);
return true;
}
@Override
public String isPayLicenceOrder(String wxEnterpriseId) {
String orderId = tabHaobanLicenceOrderMapper.selectByWxEnterpriseId(wxEnterpriseId);
if (StrUtil.isNotBlank(orderId)){
return orderId;
}
return null;
}
@Override
public Page<LicenceOrderPageDTO> getLicenceOrderPage(LicenceOrderPageQDTO qdto) {
//时间处理
if (StringUtils.isNotBlank(qdto.getStartTime())) {
qdto.setStartTime(qdto.getStartTime() + " 00:00:00");
}
if (StringUtils.isNotBlank(qdto.getEndTime())) {
qdto.setEndTime(qdto.getEndTime() + " 23:59:59");
}
PageHelper.startPage(qdto);
List<TabHaobanLicenceOrder> licenceOrderPage = tabHaobanLicenceOrderMapper.getLicenceOrderPage(qdto);
//判断订单状态,支付时间已过的订单的需要更改订单状态为已过期
for (TabHaobanLicenceOrder dto : licenceOrderPage){
if (dto.getExpireTime().before(new Date()) && dto.getOrderStatus() == 0){
dto.setOrderStatus(3);
updateLicenceOrderType(dto.getOrderId(), 3,dto.getEnterpriseId(), dto.getWxEnterpriseId(), "系统",1);
}
}
return PageHelperUtils.changePageHelperToCurrentPage(licenceOrderPage, LicenceOrderPageDTO.class);
}
@Override
public Integer saveTransactionCode(Long orderId, String transactionCode, String prepayId, String wxOrderId,Date payTime,String wxUrl) {
return tabHaobanLicenceOrderMapper.saveTransactionCode(orderId,transactionCode,prepayId,wxOrderId,payTime,wxUrl);
}
@Override
public TabHaobanLicenceOrder selectByTransactionId(String transactionId) {
return tabHaobanLicenceOrderMapper.selectByTransactionId(transactionId);
}
@Override
public TabHaobanLicenceOrder selectByQywxOrderId(String qywxOrderId) {
return tabHaobanLicenceOrderMapper.selectByQywxOrderId(qywxOrderId);
}
@Override
public Integer saveQywxOrderId(Long orderId, String qywxOrderId) {
return tabHaobanLicenceOrderMapper.saveQywxOrderId(orderId,qywxOrderId);
}
@Override
public List<String> getOrderIdList(String param, Integer type, String wxEnterpriseId) {
List<String> result = new ArrayList<>();
if (type == 0){
result = tabHaobanLicenceOrderMapper.getTransactionIdList(param,wxEnterpriseId);
}else if(type == 1){
result = tabHaobanLicenceOrderMapper.getQywxOrderId(param,wxEnterpriseId);
}else {
result = tabHaobanLicenceOrderMapper.getWxOrderId(param,wxEnterpriseId);
}
return result;
}
@Override
public Boolean checkLicenceOrder(Long orderId, Integer flag, String reason,String creatorName) {
TabHaobanLicenceOrder order = tabHaobanLicenceOrderMapper.selectById(orderId);
if (null ==order){
return false;
}
String enterpriseId = order.getEnterpriseId();
String wxEnterpriseId = order.getWxEnterpriseId();
String wxEnterpriseName = "";
WxEnterpriseDTO wxEnterpriseDTO = wxEnterpriseApiService.getOne(wxEnterpriseId);
if (ObjectUtil.isNotNull(wxEnterpriseDTO)){
wxEnterpriseName=wxEnterpriseDTO.getCorpName();
}
if (flag == 0){
//更新微信订单状态
tabHaobanLicenceOrderMapper.saveOrderCheckReason(orderId,reason,0);
//记录订单进度
saveOrderProgress(orderId,"审核未通过,请重新上传凭证",enterpriseId,wxEnterpriseId,creatorName,1,null,reason);
//短信通知
ClerkDTO clerkDTO = clerkService.getClerkByClerkId(order.getCreatorId());
if (clerkDTO!=null){
Map<String, String> params = new HashMap<>();
params.put("1", wxEnterpriseName);
params.put("2", order.getOrderNumber());
SmsSendResponseDTO resp = accountOverdueSmsSendService.smsSend("-1", clerkDTO.getPhoneNumber(),
"86", 106, params);
logger.info("许可账号支付凭证审核不通过短信通知返回信息:{}", JSON.toJSONString(resp));
}
}else {
//更新微信订单状态
tabHaobanLicenceOrderMapper.updateLicenceOrderType(orderId,1);
//记录订单进度
saveOrderProgress(orderId,"已支付",enterpriseId,wxEnterpriseId,creatorName,1,null,null);
}
return true;
}
@Override
public Boolean saveCallBackTime(Long orderId, Integer type, Date time) {
tabHaobanLicenceOrderMapper.saveCallBackTime(orderId,type,time);
return true;
}
}
......@@ -2,6 +2,7 @@ package com.gic.haoban.manage.service.service.out.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.Constant;
......@@ -9,6 +10,7 @@ import com.gic.api.base.commons.Page;
import com.gic.clerk.api.dto.ClerkDTO;
import com.gic.clerk.api.service.ClerkService;
import com.gic.clerk.api.service.PowerService;
import com.gic.commons.util.DateUtil;
import com.gic.commons.util.EntityUtil;
import com.gic.commons.util.ImageUtil;
import com.gic.enterprise.api.dto.EnterpriseSettingDTO;
......@@ -31,11 +33,9 @@ import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.service.config.Config;
import com.gic.haoban.manage.service.dao.mapper.StaffDepartmentRelatedMapper;
import com.gic.haoban.manage.service.dao.mapper.StaffMapper;
import com.gic.haoban.manage.service.entity.TabHaobanDepartment;
import com.gic.haoban.manage.service.entity.TabHaobanStaff;
import com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated;
import com.gic.haoban.manage.service.entity.TabHaobanSyncErrorLog;
import com.gic.haoban.manage.service.entity.*;
import com.gic.haoban.manage.service.service.*;
import com.gic.haoban.manage.service.service.chat.GroupChatService;
import com.gic.haoban.manage.service.util.EmojiFilterUtil;
import com.gic.redis.data.util.RedisUtil;
import com.gic.thirdparty.cloudfile.CloudFileUtil;
......@@ -56,6 +56,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
......@@ -104,6 +105,8 @@ public class StaffApiServiceImpl implements StaffApiService {
private Config config;
@Autowired
private QywxOrderApiService qywxOrderApiService;
@Autowired
private GroupChatService groupChatService;
@Override
public StaffDTO selectById(String staffId) {
......@@ -139,6 +142,9 @@ public class StaffApiServiceImpl implements StaffApiService {
List<String> staffIds = new ArrayList<>();
if (relationFlag != null) {
staffIds = staffClerkRelationService.listByWxEnterpriseId(wxEnterpriseId);
if (CollectionUtils.isEmpty(staffIds) && relationFlag == 1){
return new Page<>();
}
}
PageHelper.startPage(pageInfo.getPageNum(), pageInfo.getPageSize());
Page<StaffDTO> page = PageUtil.changePageHelperToCurrentPage(staffService.pageStaff(staffIds, activeFlag, keyword, departmentIds, wxEnterpriseId, relationFlag,permitState,occupy), StaffDTO.class);
......@@ -993,6 +999,8 @@ public class StaffApiServiceImpl implements StaffApiService {
successMap.put("takeoverStaffName",takeOverStaff.getStaffName());
successMap.put("takeoverStaffPhone",takeOverStaff.getPhoneNumber());
successList.add(successMap);
//更新成员群列表 todo
groupChatService.initStaffGroupChat(takeOverStaff.getStaffId());
}else{
//企微转移失败,记录失败明细
......@@ -1028,4 +1036,47 @@ public class StaffApiServiceImpl implements StaffApiService {
result.setFailedList(failedList);
return com.gic.api.base.commons.ServiceResponse.failure(listServiceResponse.getCode(),listServiceResponse.getMessage(),result);
}
@Override
public com.gic.api.base.commons.ServiceResponse<Boolean> autoActivateCallBack(String params) {
logger.info("接收企业微信自动激活回调通知:{}",JSON.toJSONString(params));
if (StrUtil.isBlank(params)) {
return com.gic.api.base.commons.ServiceResponse.success(false);
}
//1、解析参数 2、刷新企业微信群列表 3、更新成员信息
JSONObject object = JSONObject.parseObject(params, JSONObject.class);
String infoType = object.getString("infoType");
String authCorpId = object.getString("authCorpId");
String timeStamp = object.getString("timeStamp");
Object accountList = object.get("accountList");
JSONObject obj = JSONObject.parseObject(JSON.toJSONString(accountList), JSONObject.class);
String activeCode = obj.getString("ActiveCode");
String expireTime = obj.getString("ExpireTime");
String userId = obj.getString("UserId");
//将秒级时间戳转换位Date类型
SimpleDateFormat formatter = new SimpleDateFormat(DateUtil.FORMAT_DATETIME_19);
String date_time = formatter.format(new Date(Long.valueOf(timeStamp) * 1000L));
Date timeStampDate = DateUtil.strToDate(date_time, DateUtil.FORMAT_DATETIME_19);
String date_time1 = formatter.format(new Date(Long.valueOf(expireTime) * 1000L));
Date expireTimeDate = DateUtil.strToDate(date_time1, DateUtil.FORMAT_DATETIME_19);
if ("auto_activate".equals(infoType)){
// 成员许可自动激活回调通知
TabHaobanWxEnterprise wxEnterprise = this.wxEnterpriseService.getEnterpriseBycorpId(authCorpId);
if (wxEnterprise==null){
logger.info("微信企业id—>{}不存在",authCorpId);
return com.gic.api.base.commons.ServiceResponse.failure("-9999","微信企业id不存在!");
}
TabHaobanStaff staff = staffService.selectByUserIdAndEnterpriseId(userId, wxEnterprise.getWxEnterpriseId());
if (null == staff){
logger.info("成员userid—>{}不存在",userId);
return com.gic.api.base.commons.ServiceResponse.failure("-9999","成员userid不存在!");
}
String staffId = staff.getStaffId();
groupChatService.initStaffGroupChat(staffId);
staffMapper.updateActiveStatusById(staffId,timeStampDate,expireTimeDate,activeCode);
}
return com.gic.api.base.commons.ServiceResponse.success(true);
}
}
......@@ -30,6 +30,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
......@@ -181,6 +182,13 @@ public class HmGroupApiServiceImpl implements HmGroupApiService {
if (groupSettingBo.getReferNum() != null && groupSettingBo.getReferNum() > 0) {
return ServiceResponse.failure(HaoBanErrCode.ERR_100033.getCode(), HaoBanErrCode.ERR_100033.getMsg());
}
List<HmQrcodeGroupNumBO> qrcodeGroupNumBoList = qrcodeService.getGroupIdNumByEnterpriseId(groupSettingBo.getWxEnterpriseId(), groupSettingBo.getEnterpriseId(), Arrays.asList(groupDTO.getGroupId()), null);
if (CollectionUtils.isNotEmpty(qrcodeGroupNumBoList)) {
if(qrcodeGroupNumBoList.get(0).getNum() > 0) {
return ServiceResponse.failure(HaoBanErrCode.ERR_100034.getCode(), HaoBanErrCode.ERR_100034.getMsg());
}
}
groupService.deleteGroupSetting(groupDTO);
return ServiceResponse.success(Boolean.TRUE);
}
......
package com.gic.haoban.manage.service.service.out.impl.licence;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.util.DateUtil;
import com.gic.commons.util.EntityUtil;
import com.gic.enterprise.api.dto.EnterpriseDTO;
import com.gic.enterprise.api.service.EnterpriseService;
import com.gic.haoban.manage.api.dto.WxEnterpriseDTO;
import com.gic.haoban.manage.api.dto.licence.LicenceOrderDTO;
import com.gic.haoban.manage.api.dto.licence.LicenceOrderPageDTO;
import com.gic.haoban.manage.api.dto.licence.LicenceOrderProgressDTO;
import com.gic.haoban.manage.api.dto.qdto.licence.LicenceOrderPageQDTO;
import com.gic.haoban.manage.api.dto.qdto.licence.LicenceOrderQDTO;
import com.gic.haoban.manage.api.service.WxEnterpriseApiService;
import com.gic.haoban.manage.api.service.licence.LicenceOrderApiService;
import com.gic.haoban.manage.service.config.Config;
import com.gic.haoban.manage.service.entity.licence.TabHaobanLicenceOrder;
import com.gic.haoban.manage.service.entity.licence.TabHaobanLicenceOrderProgress;
import com.gic.haoban.manage.service.service.WxEnterpriseService;
import com.gic.haoban.manage.service.service.licence.LicenceOrderProgressService;
import com.gic.haoban.manage.service.service.licence.LicenceOrderService;
import com.gic.haoban.manage.service.util.DingUtils;
import com.gic.redis.data.util.RedisUtil;
import com.gic.thirdparty.api.dto.RefundReqDataDTO;
import com.gic.thirdparty.api.dto.RefundResDataDTO;
import com.gic.thirdparty.api.service.Pay4WXService;
import com.gic.wechat.api.dto.qywx.fee.CreateOrderResponseDTO;
import com.gic.wechat.api.dto.qywx.fee.FeeOrderDeatilResponseDTO;
import com.gic.wechat.api.dto.qywx.fee.qdto.CreateOrderQDTO;
import com.gic.wechat.api.dto.qywx.response.QywxResponseDTO;
import com.gic.wechat.api.service.qywx.QywxOrderApiService;
import com.gic.wechat.api.service.qywx.QywxUserApiService;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.redisson.client.RedisClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
/**
* @description:
* @Author: wenhua
* @Date: 2023/3/9 17:04
*/
@Service("licenceOrderApiServiceImpl")
public class LicenceOrderApiServiceImpl implements LicenceOrderApiService {
private static final Logger logger = LogManager.getLogger(LicenceOrderApiServiceImpl.class);
@Autowired
private LicenceOrderService licenceOrderService;
@Autowired
private LicenceOrderProgressService licenceOrderProgressService;
@Autowired
private EnterpriseService enterpriseService;
@Autowired
private WxEnterpriseApiService wxEnterpriseApiService;
@Autowired
private QywxOrderApiService qywxOrderApiService;
@Autowired
private Config config;
@Autowired
private WxEnterpriseService wxEnterpriseService;
@Autowired
private Pay4WXService pay4WXService;
@Autowired
private QywxUserApiService qywxUserApiService;
@Override
public ServiceResponse<LicenceOrderDTO> getLicenceOrderDetail(Long orderId, Integer type) {
TabHaobanLicenceOrder licenceOrderDetail = licenceOrderService.getLicenceOrderDetail(orderId);
if (licenceOrderDetail != null) {
//查询订单进度表
LicenceOrderDTO licenceOrderDTO = JSONObject.parseObject(JSONObject.toJSONString(licenceOrderDetail), LicenceOrderDTO.class);
List<TabHaobanLicenceOrderProgress> list = licenceOrderProgressService.getListByOrderId(orderId, type);
licenceOrderDTO.setOrderProgressList(EntityUtil.changeEntityListByJSON(LicenceOrderProgressDTO.class, list));
//查询gic品牌名称
EnterpriseDTO enterpriseDTO = enterpriseService.getEnterpriseById(licenceOrderDTO.getEnterpriseId());
if (ObjectUtil.isNotNull(enterpriseDTO)) {
licenceOrderDTO.setEnterpriseName(enterpriseDTO.getEnterpriseName());
}
WxEnterpriseDTO wxEnterpriseDTO = wxEnterpriseApiService.getOne(licenceOrderDTO.getWxEnterpriseId());
if (ObjectUtil.isNotNull(wxEnterpriseDTO)) {
logger.info("企业微信查询返回实体:{}", JSON.toJSONString(wxEnterpriseDTO));
licenceOrderDTO.setWxEnterpriseName(wxEnterpriseDTO.getCorpName());
}
licenceOrderDTO.setNowTime(new Date());
return ServiceResponse.success(licenceOrderDTO);
}
return ServiceResponse.success();
}
@Override
@Transactional(rollbackFor = RuntimeException.class)
public ServiceResponse<Boolean> deleteLicenceOrder(Long orderId) {
licenceOrderService.deleteLicenceOrder(orderId);
licenceOrderProgressService.deleteByOrderId(orderId);
return ServiceResponse.success(true);
}
@Override
public ServiceResponse<String> saveOrUpdateLicenceOrder(LicenceOrderQDTO licenceOrderQDTO) {
String s = licenceOrderService.saveOrUpdateLicenceOrder(licenceOrderQDTO);
return ServiceResponse.success(s);
}
@Override
public ServiceResponse<Page<LicenceOrderPageDTO>> getLicenceOrderPage(LicenceOrderPageQDTO licenceOrderPageQDTO) {
Page<LicenceOrderPageDTO> licenceOrderPage = licenceOrderService.getLicenceOrderPage(licenceOrderPageQDTO);
return ServiceResponse.success(licenceOrderPage);
}
@Override
public ServiceResponse<Boolean> updateLicenceOrderType(Long orderId, Integer type, String enterpriseId, String wxEnterpriseId, String creatorName, Integer wxFlag) {
licenceOrderService.updateLicenceOrderType(orderId, type, enterpriseId, wxEnterpriseId, creatorName, wxFlag);
return ServiceResponse.success(true);
}
@Override
public ServiceResponse<Boolean> uploadLicenceOrderVoucher(Long orderId, String voucher, String enterpriseId, String wxEnterpriseId, String creatorName) {
licenceOrderService.uploadLicenceOrderVoucher(orderId, voucher, enterpriseId, wxEnterpriseId, creatorName);
return ServiceResponse.success(true);
}
@Override
public ServiceResponse<String> payLicenceOrder(Long orderId) {
TabHaobanLicenceOrder order = licenceOrderService.getLicenceOrderDetail(orderId);
if (order == null) {
return ServiceResponse.failure("-9999", "参数有误!!");
}
WxEnterpriseDTO wxEnterpriseDTO = wxEnterpriseService.selectById(order.getWxEnterpriseId());
if (wxEnterpriseDTO == null) {
return ServiceResponse.failure("-9999", "微信企业不存在!!");
}
String openCorpid = wxEnterpriseDTO.getOpenCorpid();
String serviceCorpid = config.getCorpid();
//需要先判断是否已经下单,且订单失效的话重新下单
if (null != order.getQywxOrderId()) {
FeeOrderDeatilResponseDTO dto = qywxUserApiService.getOrder(openCorpid, serviceCorpid, order.getQywxOrderId());
if (null != dto && null != dto.getOrder() && dto.getOrder().getOrderStatus() != 3){
//企业微信订单有效,无需重复创建
return ServiceResponse.success(order.getQywxOrderId());
}
if (null != dto && null != dto.getOrder() && dto.getOrder().getOrderStatus() == 3){
//订单失效,记录企业微信订单状态
licenceOrderService.updateLicenceOrderType(order.getOrderId(), 3, order.getEnterpriseId(),
order.getWxEnterpriseId(), "系统", 0);
}
}
//创建企业微信订单
CreateOrderQDTO orderQDTO = new CreateOrderQDTO();
orderQDTO.setBaseCount(0);
orderQDTO.setExternalCount(order.getExternalContactCount());
orderQDTO.setBuyerUserid(config.getBuyerUserid());
if (order.getTimeType() == 1) {
orderQDTO.setMonths(order.getTimeValue());
orderQDTO.setDays(0);
} else {
orderQDTO.setMonths(0);
orderQDTO.setDays(order.getTimeValue());
}
ServiceResponse<CreateOrderResponseDTO> newOrder = qywxOrderApiService.createNewOrder(serviceCorpid, openCorpid, orderQDTO);
logger.info("企业微信订单返回信息:{}", JSON.toJSONString(newOrder));
if (newOrder.isSuccess()) {
//更新企业微信订单状态,保存企业微信订单id
CreateOrderResponseDTO result = newOrder.getResult();
licenceOrderService.updateLicenceOrderType(order.getOrderId(), 0, order.getEnterpriseId(),
order.getWxEnterpriseId(), "系统", 0);
licenceOrderService.saveQywxOrderId(order.getOrderId(), result.getOrderId());
return ServiceResponse.success(result.getOrderId());
}
return ServiceResponse.failure(newOrder.getCode(), newOrder.getMessage());
}
@Override
public ServiceResponse<String> isPayLicenceOrder(String wxEnterpriseId) {
String order = licenceOrderService.isPayLicenceOrder(wxEnterpriseId);
return ServiceResponse.success(order);
}
@Override
@Transactional(rollbackFor = RuntimeException.class)
public ServiceResponse<Boolean> wxCallBack(String params) {
logger.info("接收微信回调参数:{}", params);
if (StrUtil.isBlank(params)) {
return ServiceResponse.success(false);
}
JSONObject object = JSONObject.parseObject(params, JSONObject.class);
//微信的订单id,保留方便后续对账
String orderId = object.getString("orderId");
String transactionId = object.getString("transactionId");
String timeEnd = object.getString("timeEnd");
//对同一笔订单上锁
String key = "haoban_wx_licence_order_+"+transactionId;
RedisUtil.lock(key,2L);
TabHaobanLicenceOrder licenceOrder = licenceOrderService.selectByTransactionId(orderId);
if (licenceOrder == null) {
logger.info("微信回调的订单编号:{}异常!!", orderId);
RedisUtil.unlock(key);
return ServiceResponse.success(false);
}
if (licenceOrder.getOrderStatus() == 1) {
//微信会多次回调
logger.info("微信回调的订单已处理!");
RedisUtil.unlock(key);
return ServiceResponse.success(false);
}
Date payTime = DateUtil.strToDate(timeEnd,DateUtil.FORMAT_DATETIME_14);
//更新订单状态
licenceOrderService.updateLicenceOrderType(licenceOrder.getOrderId(), 1, licenceOrder.getEnterpriseId(), licenceOrder.getWxEnterpriseId(), "系统", 1);
//保存微信订单id
licenceOrderService.saveTransactionCode(licenceOrder.getOrderId(), null, null, transactionId, payTime,null);
RedisUtil.unlock(key);
//查询gic品牌名称
String enterpriseName = "";
String wxEnterpriseName = "";
EnterpriseDTO enterpriseDTO = enterpriseService.getEnterpriseById(licenceOrder.getEnterpriseId());
if (ObjectUtil.isNotNull(enterpriseDTO)) {
enterpriseName = enterpriseDTO.getEnterpriseName();
}
WxEnterpriseDTO wxEnterpriseDTO = wxEnterpriseApiService.getOne(licenceOrder.getWxEnterpriseId());
if (ObjectUtil.isNotNull(wxEnterpriseDTO)) {
wxEnterpriseName = wxEnterpriseDTO.getCorpName();
}
String dateToStr = DateUtil.dateToStr(new Date(), DateUtil.FORMAT_DATETIME_19);
//发送钉钉消息通知
String host = config.getHost();
// 最后一个分隔符位置
int lastIndex = host.lastIndexOf("/");
// 倒数第二个分隔符位置
int secondLastIndex = host.lastIndexOf("/", lastIndex - 1);
String subHost = host.substring(0, secondLastIndex + 1);
String url = subHost + "enterprise-operation/#/finance-config/wx-order-detail?tabId=wx_account_order&orderId=" + licenceOrder.getOrderId();
String msg = "标题:企微账号许可通知\n品牌名称:" + enterpriseName + "\n" + "企业名称:" + wxEnterpriseName + "\n" + "消息内容:" + dateToStr +
"新增订单(编号:" + licenceOrder.getOrderNumber() + "),请尽快处理!\n" + url;
DingUtils.send(msg, "https://oapi.dingtalk.com/robot/send?access_token=63074c9fc1ac2c00aa62477facdf16e5fa2388cf6a621edba1fb05d6e55d031f", true);
return ServiceResponse.success(true);
}
@Override
public ServiceResponse<Boolean> qywxCallBack(String params) {
logger.info("接收企业微信回调参数:{}", JSON.toJSONString(params));
if (StrUtil.isBlank(params)) {
return ServiceResponse.success(false);
}
JSONObject object = JSONObject.parseObject(params, JSONObject.class);
String infoType = object.getString("infoType");
String openCorpId = object.getString("openCorpId");
String orderId = object.getString("orderId");
String timeStamp = object.getString("timeStamp");
Integer orderStatus = object.getInteger("orderStatus");
//对同一笔订单上锁
String key = "haoban_qywx_licence_order_+"+orderId;
RedisUtil.lock(key,2L);
TabHaobanLicenceOrder order = licenceOrderService.selectByQywxOrderId(orderId);
//将秒级时间戳转换位Date类型
SimpleDateFormat formatter = new SimpleDateFormat(DateUtil.FORMAT_DATETIME_19);
String date_time = formatter.format(new Date(Long.valueOf(timeStamp) * 1000L));
Date date = DateUtil.strToDate(date_time, DateUtil.FORMAT_DATETIME_19);
if (order == null) {
RedisUtil.unlock(key);
return ServiceResponse.success(false);
}
if ("license_pay_success".equals(infoType)) {
if (order.getQywxPayTime() != null) {
//该笔订单已处理
RedisUtil.unlock(key);
return ServiceResponse.success(false);
}
//更新企业微信订单状态
licenceOrderService.updateLicenceOrderType(order.getOrderId(), 1, order.getEnterpriseId(), order.getWxEnterpriseId(), "系统", 0);
//记录支付时间
licenceOrderService.saveCallBackTime(order.getOrderId(), 2, date);
}
if ("license_refund".equals(infoType)) {
if (order.getQywxRefundTime() != null) {
//该笔订单已处理
RedisUtil.unlock(key);
return ServiceResponse.success(false);
}
//退款回调 订单状态,1:退款成功,2:退款被拒绝。
if (orderStatus == 1) {
licenceOrderService.updateLicenceOrderType(order.getOrderId(), 6, order.getEnterpriseId(), order.getWxEnterpriseId(), "系统", 0);
//记录退款时间
licenceOrderService.saveCallBackTime(order.getOrderId(), 3, date);
wxRefund(order.getOrderId());
} else if (orderStatus == 2) {
licenceOrderService.updateLicenceOrderType(order.getOrderId(), 5, order.getEnterpriseId(), order.getWxEnterpriseId(), "系统", 0);
//记录退款时间
licenceOrderService.saveCallBackTime(order.getOrderId(), 3, date);
}
}
RedisUtil.unlock(key);
return ServiceResponse.success(true);
}
@Override
public ServiceResponse<Boolean> saveTransactionCode(Long orderId, String transactionCode, String prepayId, String wxOrderId, Date payTime,String wxUrl) {
licenceOrderService.saveTransactionCode(orderId, transactionCode, prepayId, wxOrderId, payTime,wxUrl);
return ServiceResponse.success(true);
}
@Override
public ServiceResponse<List<String>> getOrderIdList(String param, Integer type, String wxEnterpriseId) {
return ServiceResponse.success(licenceOrderService.getOrderIdList(param, type, wxEnterpriseId));
}
@Override
public ServiceResponse<Boolean> checkLicenceOrder(Long orderId, Integer flag, String reason, String creatorName) {
licenceOrderService.checkLicenceOrder(orderId, flag, reason,creatorName);
return ServiceResponse.success(true);
}
@Override
public ServiceResponse<Boolean> wxRefund(Long orderId) {
TabHaobanLicenceOrder order = licenceOrderService.getLicenceOrderDetail(orderId);
if (null == order) {
return ServiceResponse.failure("-9999", "订单id有误!");
}
if (2 == order.getPayType()) {
//对公转账不需要微信退款,直接更新微信订单状态
licenceOrderService.updateLicenceOrderType(order.getOrderId(), 4, order.getEnterpriseId(), order.getWxEnterpriseId(), "系统", 1);
return ServiceResponse.success(true);
}
if (4 == order.getOrderStatus()){
return ServiceResponse.failure("-9999", "该笔订单已退款!");
}
RefundReqDataDTO reqData = new RefundReqDataDTO(order.getWxOrderId(), null, null, String.valueOf(orderId), 1,
1, null, null);
RefundResDataDTO refund = pay4WXService.refund(reqData);
logger.info("微信订单退款返回信息:{}",JSON.toJSONString(refund));
if (refund != null && ("FAIL".equals(refund.getReturn_code()) || "FAIL".equals(refund.getResult_code()))) {
//微信退款失败,钉钉通知财务人员
//查询gic品牌名称
String enterpriseName = "";
String wxEnterpriseName = "";
EnterpriseDTO enterpriseDTO = enterpriseService.getEnterpriseById(order.getEnterpriseId());
if (ObjectUtil.isNotNull(enterpriseDTO)) {
enterpriseName = enterpriseDTO.getEnterpriseName();
}
WxEnterpriseDTO wxEnterpriseDTO = wxEnterpriseApiService.getOne(order.getWxEnterpriseId());
if (ObjectUtil.isNotNull(wxEnterpriseDTO)) {
wxEnterpriseName = wxEnterpriseDTO.getCorpName();
}
//发送钉钉消息通知
String host = config.getHost();
// 最后一个分隔符位置
int lastIndex = host.lastIndexOf("/");
// 倒数第二个分隔符位置
int secondLastIndex = host.lastIndexOf("/", lastIndex - 1);
String subHost = host.substring(0, secondLastIndex + 1);
String url = subHost + "enterprise-operation/#/finance-config/wx-order-detail?tabId=wx_account_order&orderId=" + order.getOrderId();
String msg = "标题:企微账号许可通知\n品牌名称:" + enterpriseName + "\n" + "企业名称:" + wxEnterpriseName + "\n" + "消息内容:订单编号:"+order.getOrderNumber()
+",申请微信退款失败,请查看原因并处理!\n"+"失败原因:"+refund.getErr_code_des()+"\n" + url;
DingUtils.send(msg, "https://oapi.dingtalk.com/robot/send?access_token=63074c9fc1ac2c00aa62477facdf16e5fa2388cf6a621edba1fb05d6e55d031f", true);
return ServiceResponse.failure(refund.getResult_code(), refund.getErr_code_des());
}
//更新微信订单状态
licenceOrderService.updateLicenceOrderType(order.getOrderId(), 4, order.getEnterpriseId(), order.getWxEnterpriseId(), "系统", 1);
//记录支付时间
licenceOrderService.saveCallBackTime(order.getOrderId(), 1, new Date());
return ServiceResponse.success(true);
}
@Override
public ServiceResponse<HashMap<String, String>> getAccountInfo() {
HashMap<String, String> result = new HashMap<>(8);
result.put("accountName",config.getAccountName());
result.put("accountNumber",config.getAccountNumber());
result.put("bankName",config.getBankName());
return ServiceResponse.success(result);
}
@Override
public ServiceResponse<Boolean> cancelQywxOrder(Long orderId) {
TabHaobanLicenceOrder order = licenceOrderService.getLicenceOrderDetail(orderId);
if (null == order) {
return ServiceResponse.failure("-9999", "订单id有误!");
}
//企业微信订单取消
WxEnterpriseDTO wxEnterpriseDTO = wxEnterpriseService.selectById(order.getWxEnterpriseId());
if (wxEnterpriseDTO == null) {
return ServiceResponse.failure("-9999", "微信企业不存在!!");
}
//先申请微信退款,再取消企业微信订单
wxRefund(orderId);
String openCorpid = wxEnterpriseDTO.getOpenCorpid();
String serviceCorpid = config.getCorpid();
ServiceResponse<QywxResponseDTO> response = qywxOrderApiService.cancelOrder(serviceCorpid, openCorpid, order.getQywxOrderId());
logger.info("企业微信订单取消返回信息:{}",JSON.toJSONString(response));
if (response.isSuccess()){
//更新企业微信订单状态
updateLicenceOrderType(orderId, 2, order.getEnterpriseId(), order.getWxEnterpriseId(), order.getCreatorName(), 1);
return ServiceResponse.success(true);
}
return ServiceResponse.failure(response.getCode(),response.getMessage());
}
}
......@@ -132,10 +132,12 @@
timeout="10000"/>
<dubbo:service interface="com.gic.haoban.manage.api.service.ValidationCodeApiService" ref="validationCodeApiServiceImpl"/>
<dubbo:service interface="com.gic.haoban.manage.api.service.licence.LicenceOrderApiService" ref="licenceOrderApiServiceImpl"/>
<dubbo:reference interface="com.gic.enterprise.api.service.EnterpriseUseForbidService" id="enterpriseUseForbidService"/>
<dubbo:service interface="com.gic.haoban.manage.api.service.role.HaobanMenuApiService" ref="haobanMenuApiServiceImpl"/>
<dubbo:service interface="com.gic.haoban.manage.api.service.role.HaobanRoleApiService" ref="haobanRoleApiServiceImpl"/>
<dubbo:reference interface="com.gic.enterprise.api.service.DepartmentService" id="gicDepartmentService"/>
<dubbo:reference interface="com.gic.wechat.api.service.qywx.QywxDepartmentApiService"
id="qywxDepartmentApiService"/>
......@@ -203,5 +205,6 @@
<dubbo:reference interface="com.gic.member.tag.api.service.MemberTagGroupApiService" id="memberTagGroupApiService" timeout="10000" retries="0"/>
<dubbo:reference interface="com.gic.enterprise.api.service.ScreeningDetailService" id="screeningDetailService" timeout="10000" retries="0"/>
<dubbo:reference interface="com.gic.wechat.api.service.qywx.QywxOrderApiService" id="qywxOrderApiService" timeout="10000" retries="0"/>
<dubbo:reference id="pay4WXService" interface="com.gic.thirdparty.api.service.Pay4WXService" timeout="10000" retries="0" check="false"/>
</beans>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.gic.haoban.manage.service.dao.mapper.licence.TabHaobanLicenceOrderMapper">
<resultMap type="com.gic.haoban.manage.service.entity.licence.TabHaobanLicenceOrder" id="BaseResultMap">
<result column="order_id" property="orderId"/>
<result column="enterprise_id" property="enterpriseId"/>
<result column="wx_enterprise_id" property="wxEnterpriseId"/>
<result column="order_type" property="orderType"/>
<result column="external_contact_count" property="externalContactCount"/>
<result column="base_count" property="baseCount"/>
<result column="price" property="price"/>
<result column="time_type" property="timeType"/>
<result column="time_value" property="timeValue"/>
<result column="pay_type" property="payType"/>
<result column="order_number" property="orderNumber"/>
<result column="voucher" property="voucher"/>
<result column="order_status" property="orderStatus"/>
<result column="order_status_reason" property="orderStatusReason"/>
<result column="pay_time" property="payTime"/>
<result column="refund_time" property="refundTime"/>
<result column="qywx_order_id" property="qywxOrderId"/>
<result column="qywx_order_status" property="qywxOrderStatus"/>
<result column="qywx_order_status_reason" property="qywxOrderStatusReason"/>
<result column="qywx_pay_time" property="qywxPayTime"/>
<result column="qywx_refund_time" property="qywxRefundTime"/>
<result column="reason" property="reason"/>
<result column="delete_flag" property="deleteFlag"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
<result column="creator_id" property="creatorId"/>
<result column="creator_name" property="creatorName"/>
<result column="expire_time" property="expireTime"/>
<result column="prepay_id" property="prepayId"/>
<result column="wx_order_id" property="wxOrderId"/>
<result column="wx_url" property="wxUrl"/>
</resultMap>
<sql id="Base_Column_List">
order_id,
enterprise_id,
wx_enterprise_id,
order_type,
external_contact_count,
base_count,
price,
time_type,
time_value,
pay_type,
order_number,
voucher,
order_status,
order_status_reason,
pay_time,
refund_time,
qywx_order_id,
qywx_order_status,
qywx_order_status_reason,
qywx_pay_time,
qywx_refund_time,
reason,
delete_flag,
create_time,
update_time,
creator_id,
creator_name,
expire_time,
prepay_id,
wx_order_id,
wx_url
</sql>
<!-- ===================== 新增 ======================== -->
<insert id="insert" parameterType="com.gic.haoban.manage.service.entity.licence.TabHaobanLicenceOrder"
useGeneratedKeys="true" keyProperty="id">
<![CDATA[
INSERT INTO tab_haoban_licence_order(order_id,
enterprise_id,
wx_enterprise_id,
order_type,
external_contact_count,
base_count,
price,
time_type,
time_value,
pay_type,
order_number,
voucher,
order_status,
order_status_reason,
pay_time,
refund_time,
qywx_order_id,
qywx_order_status,
qywx_order_status_reason,
qywx_pay_time,
qywx_refund_time,
reason,
delete_flag,
create_time,
update_time,
creator_id,
creator_name,
expire_time)
VALUES (#{orderId,jdbcType=BIGINT},
#{enterpriseId,jdbcType=VARCHAR},
#{wxEnterpriseId,jdbcType=VARCHAR},
#{orderType,jdbcType=INTEGER},
#{externalContactCount,jdbcType=INTEGER},
#{baseCount,jdbcType=INTEGER},
#{price,jdbcType=INTEGER},
#{timeType,jdbcType=INTEGER},
#{timeValue,jdbcType=INTEGER},
#{payType,jdbcType=INTEGER},
#{orderNumber,jdbcType=CHAR},
#{voucher,jdbcType=VARCHAR},
#{orderStatus,jdbcType=INTEGER},
#{orderStatusReason,jdbcType=VARCHAR},
#{payTime,jdbcType=TIMESTAMP},
#{refundTime,jdbcType=TIMESTAMP},
#{qywxOrderId,jdbcType=VARCHAR},
#{qywxOrderStatus,jdbcType=INTEGER},
#{qywxOrderStatusReason,jdbcType=VARCHAR},
#{qywxPayTime,jdbcType=TIMESTAMP},
#{qywxRefundTime,jdbcType=TIMESTAMP},
#{reason,jdbcType=VARCHAR},
0,
now(),
now(),
#{creatorId,jdbcType=VARCHAR},
#{creatorName,jdbcType=VARCHAR},
#{expireTime,jdbcType=VARCHAR})
]]>
</insert>
<!-- =====================删除==================== -->
<update id="deleteById" parameterType="long">
UPDATE tab_haoban_licence_order
SET delete_flag = 1 ,update_time = now()
WHERE order_id = #{orderId}
</update>
<!-- ==================更新 ========== -->
<!-- <update id="update" parameterType="com.gic.haoban.manage.service.entity.licence.TabHaobanLicenceOrder">
UPDATE tab_haoban_licence_order SET
order_id=#{orderId,jdbcType=BIGINT},
enterprise_id=#{enterpriseId,jdbcType=VARCHAR},
wx_enterprise_id=#{wxEnterpriseId,jdbcType=VARCHAR},
order_type=#{orderType,jdbcType=INTEGER},
external_contact_count=#{externalContactCount,jdbcType=INTEGER},
base_count=#{baseCount,jdbcType=INTEGER},
price=#{price,jdbcType=INTEGER},
time_type=#{timeType,jdbcType=INTEGER},
time_value=#{timeValue,jdbcType=INTEGER},
pay_type=#{payType,jdbcType=INTEGER},
transaction_id=#{transactionId,jdbcType=CHAR},
voucher=#{voucher,jdbcType=VARCHAR},
order_status=#{orderStatus,jdbcType=INTEGER},
order_status_reason=#{orderStatusReason,jdbcType=VARCHAR},
pay_time=#{payTime,jdbcType=TIMESTAMP},
refund_time=#{refundTime,jdbcType=TIMESTAMP},
qywx_order_id=#{qywxOrderId,jdbcType=VARCHAR},
qywx_order_status=#{qywxOrderStatus,jdbcType=INTEGER},
qywx_order_status_reason=#{qywxOrderStatusReason,jdbcType=VARCHAR},
qywx_pay_time=#{qywxPayTime,jdbcType=TIMESTAMP},
qywx_refund_time=#{qywxRefundTime,jdbcType=TIMESTAMP},
reason=#{reason,jdbcType=VARCHAR},
delete_flag=#{deleteFlag,jdbcType=INTEGER},
create_time=#{createTime,jdbcType=TIMESTAMP},
update_time=#{updateTime,jdbcType=TIMESTAMP},
creator_id=#{creatorId,jdbcType=VARCHAR},
creator_name=#{creatorName,jdbcType=VARCHAR}
where order_id = #{orderId}
</update>-->
<!-- ============ 查询=============-->
<select id="selectById" parameterType="long" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM tab_haoban_licence_order WHERE order_id = #{orderId} and delete_flag=0
</select>
<update id="updateLicenceOrderType">
UPDATE tab_haoban_licence_order
SET order_status = #{type} ,update_time = now()
WHERE order_id = #{orderId}
and delete_flag = 0
</update>
<update id="updateQywxOrderType">
UPDATE tab_haoban_licence_order
SET qywx_order_status = #{type} ,update_time = now()
WHERE order_id = #{orderId}
and delete_flag = 0
</update>
<update id="uploadLicenceOrderVoucher">
UPDATE tab_haoban_licence_order
SET voucher = #{voucher} ,update_time = now(),pay_time = now(),order_status=5
WHERE order_id = #{orderId}
and delete_flag = 0
</update>
<select id="selectByWxEnterpriseId" resultType="java.lang.String">
SELECT order_id
FROM tab_haoban_licence_order
WHERE wx_enterprise_id = #{wxEnterpriseId}
and delete_flag = 0
and order_status = 0 limit 1
</select>
<select id="getLicenceOrderPage" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM tab_haoban_licence_order
WHERE delete_flag = 0
<if test="orderNumber != null and orderNumber !='' ">
and order_number=#{orderNumber}
</if>
<if test="orderStatus != null">
and order_status=#{orderStatus}
</if>
<if test="qywxOrderId != null and qywxOrderId !=''">
and qywx_order_id=#{qywxOrderId}
</if>
<if test="qywxOrderStatus != null and qywxOrderStatus != 0">
and qywx_order_status=#{qywxOrderStatus}
</if>
<if test="qywxOrderStatus == 0">
and (qywx_order_status=#{qywxOrderStatus} or qywx_order_status is null)
</if>
<if test="startTime != null and startTime !='' ">
and create_time <![CDATA[ >= ]]> #{startTime}
</if>
<if test="endTime != null and endTime !='' ">
and create_time <![CDATA[ <= ]]> #{endTime}
</if>
<if test="enterpriseIdParam != null and enterpriseIdParam !='' ">
and enterprise_id=#{enterpriseIdParam}
</if>
<if test="payType != null ">
and pay_type=#{payType}
</if>
<if test="wxOrderId != null and wxOrderId !='' ">
and wx_order_id=#{wxOrderId}
</if>
<if test="type != null and type ==1 ">
and wx_enterprise_id = #{wxEnterpriseId}
</if>
order by create_time desc
</select>
<update id="saveTransactionCode">
UPDATE tab_haoban_licence_order
SET
<if test="orderNumber != null">
order_number = #{orderNumber},
</if>
<if test="prepayId != null">
prepay_id = #{prepayId},
</if>
<if test="wxOrderId != null">
wx_order_id = #{wxOrderId},
</if>
<if test="payTime != null">
pay_time = #{payTime},
</if>
<if test="wxUrl != null">
wx_url = #{wxUrl},
</if>
update_time = now()
WHERE order_id = #{orderId}
and delete_flag = 0
</update>
<select id="selectByTransactionId" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM tab_haoban_licence_order WHERE order_number = #{orderNumber} and delete_flag=0
</select>
<select id="selectByQywxOrderId" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM tab_haoban_licence_order WHERE qywx_order_id = #{qywxOrderId} and delete_flag=0
</select>
<update id="saveQywxOrderId">
UPDATE tab_haoban_licence_order
SET qywx_order_id = #{qywxOrderId} ,update_time = now()
WHERE order_id = #{orderId}
and delete_flag = 0
</update>
<select id="getTransactionIdList" resultMap="BaseResultMap">
SELECT
order_number
FROM tab_haoban_licence_order WHERE order_number like concat (#{orderNumber},'%') and delete_flag=0
<if test="wxEnterpriseId != null and wxEnterpriseId !='' ">
and wx_enterprise_id = #{wxEnterpriseId}
</if>
</select>
<select id="getQywxOrderId" resultMap="BaseResultMap">
SELECT
qywx_order_id
FROM tab_haoban_licence_order WHERE qywx_order_id like concat (#{qywxOrderId},'%') and delete_flag=0
<if test="wxEnterpriseId != null and wxEnterpriseId !='' ">
and wx_enterprise_id = #{wxEnterpriseId}
</if>
</select>
<select id="getWxOrderId" resultMap="BaseResultMap">
SELECT
wx_order_id
FROM tab_haoban_licence_order WHERE wx_order_id like concat (#{wxOrderId},'%') and delete_flag=0
<if test="wxEnterpriseId != null and wxEnterpriseId !='' ">
and wx_enterprise_id = #{wxEnterpriseId}
</if>
</select>
<update id="saveOrderCheckReason">
UPDATE tab_haoban_licence_order
SET reason = #{reason} ,update_time = now(),order_status_reason = '审核未通过',order_status = #{type}
WHERE order_id = #{orderId}
and delete_flag = 0
</update>
<update id="saveCallBackTime">
UPDATE tab_haoban_licence_order
SET
<if test="type == 0">
pay_time = #{time},
</if>
<if test="type == 1">
refund_time = #{time},
</if>
<if test="type == 2">
qywx_pay_time = #{time},
</if>
<if test="type == 3">
qywx_refund_time = #{time},
</if>
update_time = now()
WHERE order_id = #{orderId}
and delete_flag = 0
</update>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.gic.haoban.manage.service.dao.mapper.licence.TabHaobanLicenceOrderProgressMapper">
<resultMap type="com.gic.haoban.manage.service.entity.licence.TabHaobanLicenceOrderProgress" id="BaseResultMap">
<result column="id" property="id"/>
<result column="enterprise_id" property="enterpriseId"/>
<result column="wx_enterprise_id" property="wxEnterpriseId"/>
<result column="order_id" property="orderId"/>
<result column="order_status" property="orderStatus"/>
<result column="type" property="type"/>
<result column="voucher" property="voucher"/>
<result column="reason" property="reason"/>
<result column="delete_flag" property="deleteFlag"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
<result column="creator_name" property="creatorName"/>
</resultMap>
<sql id="Base_Column_List">
id,
enterprise_id,
wx_enterprise_id,
order_id,
order_status,
type,
voucher,
reason,
delete_flag,
create_time,
update_time,
creator_name
</sql>
<!-- ===================== 新增 ======================== -->
<insert id="insert" parameterType="com.gic.haoban.manage.service.entity.licence.TabHaobanLicenceOrderProgress"
useGeneratedKeys="true" keyProperty="id">
INSERT INTO tab_haoban_licence_order_progress(id,
enterprise_id,
wx_enterprise_id,
order_id,
order_status,
type,
voucher,
reason,
delete_flag,
create_time,
update_time,
creator_name)
VALUES (#{id,jdbcType=BIGINT},
#{enterpriseId,jdbcType=VARCHAR},
#{wxEnterpriseId,jdbcType=VARCHAR},
#{orderId,jdbcType=BIGINT},
#{orderStatus,jdbcType=VARCHAR},
#{type,jdbcType=INTEGER},
#{voucher,jdbcType=VARCHAR},
#{reason,jdbcType=VARCHAR},
0,
now(),
now(),
#{creatorName,jdbcType=VARCHAR})
</insert>
<!-- =====================删除==================== -->
<update id="deleteByPrimaryKey" parameterType="long">
UPDATE tab_haoban_licence_order_progress
SET delete_flag = 1
WHERE id = #{id}
</update>
<!-- ==================更新 ========== -->
<update id="updateByPrimaryKey"
parameterType="com.gic.haoban.manage.service.entity.licence.TabHaobanLicenceOrderProgress">
UPDATE tab_haoban_licence_order_progress
SET id=#{id,jdbcType=BIGINT},
enterprise_id=#{enterpriseId,jdbcType=VARCHAR},
wx_enterprise_id=#{wxEnterpriseId,jdbcType=VARCHAR},
order_id=#{orderId,jdbcType=BIGINT},
order_status=#{orderStatus,jdbcType=VARCHAR},
type=#{type,jdbcType=INTEGER},
voucher=#{voucher,jdbcType=VARCHAR},
reason=#{reason,jdbcType=VARCHAR},
delete_flag=#{deleteFlag,jdbcType=INTEGER},
create_time=#{createTime,jdbcType=TIMESTAMP},
update_time=#{updateTime,jdbcType=TIMESTAMP},
creator_name=#{creatorName,jdbcType=VARCHAR}
where id = #{id}
</update>
<!-- ============ 查询=============-->
<select id="selectById" parameterType="long" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM tab_haoban_licence_order_progress WHERE id = #{id} and delete_flag=0
</select>
<select id="getListByOrderId" parameterType="long" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM tab_haoban_licence_order_progress WHERE order_id = #{orderId}
<if test="type != null">
and type=#{type}
</if>
and delete_flag=0 order by create_time desc
</select>
<update id="deleteByOrderId" parameterType="long">
UPDATE tab_haoban_licence_order_progress
SET delete_flag = 1
WHERE order_id = #{orderId}
</update>
<update id="uploadLicenceOrderVoucher" >
UPDATE tab_haoban_licence_order_progress
SET voucher = #{voucher}
WHERE order_id = #{orderId} and delete_flag = 0
</update>
</mapper>
\ No newline at end of file
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.haoban.manage.api.dto.licence.LicenceOrderDTO;
import com.gic.haoban.manage.api.dto.licence.LicenceOrderPageDTO;
import com.gic.haoban.manage.api.dto.qdto.licence.LicenceOrderPageQDTO;
import com.gic.haoban.manage.api.service.licence.LicenceOrderApiService;
import com.gic.haoban.manage.service.entity.licence.TabHaobanLicenceOrder;
import com.gic.haoban.manage.service.service.licence.LicenceOrderService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
/**
* @description:
* @Author: wenhua
* @Date: 2023/3/22 11:37
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "classpath:applicationContext-conf.xml" })
public class LicenceOrderServiceTest {
@Autowired
private LicenceOrderService licenceOrderService;
@Autowired
private LicenceOrderApiService licenceOrderApiService;
@Test
public void test1(){
Boolean qweqwe = licenceOrderService.uploadLicenceOrderVoucher(1L, "qweqwe","111","111","jx");
}
@Test
public void test2(){
LicenceOrderPageQDTO qdto = new LicenceOrderPageQDTO();
Page<LicenceOrderPageDTO> licenceOrderPage = licenceOrderService.getLicenceOrderPage(qdto);
}
@Test
public void test3(){
ServiceResponse<LicenceOrderDTO> licenceOrderDetail = licenceOrderApiService.getLicenceOrderDetail(1L, null);
}
@Test
public void test4(){
ServiceResponse<String> result = licenceOrderApiService.payLicenceOrder(512360219787935783L);
}
@Test
public void test5(){
ServiceResponse<Boolean> booleanServiceResponse = licenceOrderApiService.wxRefund(513736803677659139L);
}
@Test
public void test6(){
JSONObject json = new JSONObject();
json.put("infoType","license_refund");
json.put("openCorpId","wp59NLDQAAWfAU-uhldYZyNZnPXz_1xg");
json.put("orderId","OI00000D4BD3E76423DDEB15475B1T");
json.put("timeStamp","1680072171");
json.put("orderStatus",1);
json.put("buyerUserId","WangJianFeng");
licenceOrderApiService.qywxCallBack(JSON.toJSONString(json));
}
}
......@@ -19,6 +19,40 @@ public class Config {
@Value("${wxSuiteid}")
private String wxSuiteid;
/**
* 企业微信许可账号购买信息
*/
@Value("${accountName}")
private String accountName;
@Value("${accountNumber}")
private String accountNumber;
@Value("${bankName}")
private String bankName;
public String getAccountName() {
return accountName;
}
public void setAccountName(String accountName) {
this.accountName = accountName;
}
public String getAccountNumber() {
return accountNumber;
}
public void setAccountNumber(String accountNumber) {
this.accountNumber = accountNumber;
}
public String getBankName() {
return bankName;
}
public void setBankName(String bankName) {
this.bankName = bankName;
}
public String getCorpid() {
return corpid;
}
......
......@@ -6,6 +6,8 @@ import com.gic.clerk.api.dto.AuthorizedUser;
import com.gic.commons.util.DateUtil;
import com.gic.enterprise.api.dto.EnterpriseDTO;
import com.gic.enterprise.api.service.EnterpriseService;
import com.gic.haoban.base.api.common.pojo.dto.WebLoginDTO;
import com.gic.haoban.common.utils.AuthWebRequestUtil;
import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.common.utils.UploadUtils;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
......@@ -48,12 +50,15 @@ public class UploadController extends WebBaseController {
@RequestMapping("/upload-file")
@ResponseBody
public HaobanResponse upload(@RequestParam MultipartFile file, @RequestParam String fileType) throws Exception {
public HaobanResponse upload(@RequestParam MultipartFile file) throws Exception {
if (file == null || file.isEmpty()) {
return resultResponse(HaoBanErrCode.ERR_2);
}
//获取登录人信息
final AuthorizedUser au = SessionContextUtils.getLoginUser();
WebLoginDTO au = AuthWebRequestUtil.getLoginUser();
if(null == au){
return resultResponse(HaoBanErrCode.ERR_4);
}
EnterpriseDTO enterprise = this.enterpriseService.getEnterpriseById(au.getEnterpriseId());
if (null == enterprise) {
return resultResponse(HaoBanErrCode.ERR_OTHER, "商户不存在");
......@@ -77,7 +82,6 @@ public class UploadController extends WebBaseController {
String dayFilePath = LocalDateTime.now().format(DateTimeFormatter.ofPattern(DateUtil.FORMAT_DATETIME_14));
String nameUpload = mediaName + "." + suffix;
String key = "haoban/" + dayFilePath + "/" + nameUpload;
fileType = FILE_TYPE.contains(fileType) ? fileType : BucketNameEnum.OTHER_90000.getName();
try {
//替换新的上传接口
// String url = FileUploadUtil.simpleUploadFileFromLocal(templateFile, key, fileType);
......
package com.gic.haoban.manage.web.controller.licence;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.util.DateUtil;
import com.gic.commons.util.PageHelperUtils;
import com.gic.commons.util.UniqueIdUtils;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.enterprise.api.dto.EnterpriseDTO;
import com.gic.enterprise.api.service.EnterpriseService;
import com.gic.haoban.base.api.common.pojo.dto.WebLoginDTO;
import com.gic.haoban.common.utils.AuthWebRequestUtil;
import com.gic.haoban.manage.api.dto.WxEnterpriseDTO;
import com.gic.haoban.manage.api.dto.licence.LicenceOrderDTO;
import com.gic.haoban.manage.api.dto.licence.LicenceOrderPageDTO;
import com.gic.haoban.manage.api.dto.qdto.licence.LicenceOrderPageQDTO;
import com.gic.haoban.manage.api.dto.qdto.licence.LicenceOrderQDTO;
import com.gic.haoban.manage.api.service.WxEnterpriseApiService;
import com.gic.haoban.manage.api.service.licence.LicenceOrderApiService;
import com.gic.haoban.manage.web.config.Config;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import com.gic.haoban.manage.web.log.LogRecordUserServiceImpl;
import com.gic.haoban.manage.web.qo.licence.LicenceOrderPageQO;
import com.gic.haoban.manage.web.qo.licence.LicenceOrderQO;
import com.gic.haoban.manage.web.vo.licence.LicenceOrderPageVO;
import com.gic.haoban.manage.web.vo.licence.LicenceOrderVO;
import com.gic.log.record.anno.GicLogRecord;
import com.gic.log.record.util.GicLogRecordCategoryEnum;
import com.gic.log.record.util.GicLogRecordEvaluationContext;
import com.gic.log.record.util.GicLogRecordOptTypeEnum;
import com.gic.thirdparty.api.dto.ScanPayReqDataDTO;
import com.gic.thirdparty.api.dto.ScanPayResDataDTO;
import com.gic.thirdparty.api.service.Pay4WXService;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.*;
/**
* 企业微信许可账号购买
*
* @author jx
* @since 2023-03-09
*/
@RestController
@RequestMapping("/licence-order")
public class LicenceOrderController {
private static Logger logger = LogManager.getLogger(LicenceOrderController.class);
@Autowired
private LicenceOrderApiService licenceOrderApiService;
@Autowired
private EnterpriseService enterpriseService;
@Autowired
private WxEnterpriseApiService wxEnterpriseApiService;
@Autowired
private Pay4WXService pay4WXService;
@Autowired
private Config config;
/**
* 查询订单详情
*/
@RequestMapping("licence-order-detail")
public RestResponse<LicenceOrderVO> getLicenceOrderDetail(@RequestParam Long orderId) {
WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
if (loginUser == null || StringUtils.isBlank(loginUser.getEnterpriseId())) {
return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_4.getCode()), HaoBanErrCode.ERR_4.getMsg());
}
ServiceResponse<LicenceOrderDTO> licenceOrderDetail = licenceOrderApiService.getLicenceOrderDetail(orderId, 1);
LicenceOrderVO licenceOrderVO = JSONObject.parseObject(JSONObject.toJSONString(licenceOrderDetail.getResult()), LicenceOrderVO.class);
return RestResponse.successResult(licenceOrderVO);
}
// /**
// * 删除订单
// */
// @RequestMapping("licence-order-delete")
// public RestResponse<Boolean> deleteLicenceOrder(@RequestParam Long orderId) {
// WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
// if (loginUser == null || StringUtils.isBlank(loginUser.getEnterpriseId())) {
// return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_4.getCode()), HaoBanErrCode.ERR_4.getMsg());
// }
// ServiceResponse<Boolean> booleanServiceResponse = licenceOrderApiService.deleteLicenceOrder(orderId);
// return RestResponse.successResult(booleanServiceResponse.getResult());
// }
/**
* 新增或者修改订单
*/
@RequestMapping("licence-order-saveOrUpdate")
@GicLogRecord(value = "${#logValue}", category = GicLogRecordCategoryEnum.HB_LICENCE_ORDER,
optType = GicLogRecordOptTypeEnum.HB_1004_01, userFunc = LogRecordUserServiceImpl.class, optPage = "购买企业微信许可账号")
public RestResponse<String> saveOrUpdateLicenceOrder(@RequestBody LicenceOrderQO licenceOrderQO) {
WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
if (loginUser == null || StringUtils.isBlank(loginUser.getEnterpriseId())) {
return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_4.getCode()), HaoBanErrCode.ERR_4.getMsg());
}
//金额校验
Integer integer = licenceOrderQO.checkPrice();
if (integer == -1) {
return RestResponse.failure("-9999", "许可账号数量有误!");
} else if (integer == 0) {
return RestResponse.failure("-9999", "购买金额计算有误!");
}
LicenceOrderQDTO licenceOrderQDTO = JSONObject.parseObject(JSONObject.toJSONString(licenceOrderQO), LicenceOrderQDTO.class);
licenceOrderQDTO.setEnterpriseId(loginUser.getEnterpriseId());
licenceOrderQDTO.setWxEnterpriseId(loginUser.getWxEnterpriseId());
licenceOrderQDTO.setCreatorId(loginUser.getClerkId());
licenceOrderQDTO.setCreatorName(loginUser.getClerkName());
String result = licenceOrderApiService.saveOrUpdateLicenceOrder(licenceOrderQDTO).getResult();
String time = "";
if (licenceOrderQO.getTimeType() == 1) {
time = licenceOrderQO.getTimeValue() + "个月";
} else {
time = licenceOrderQO.getTimeValue() + "天";
}
String logValue = "【购买企微许可账号】:订单编号ZH" + result + ",企业员工账号" + licenceOrderQO.getExternalContactCount() + "个,时长" + time;
GicLogRecordEvaluationContext.putAttribute("logValue", logValue);
return RestResponse.successResult(result);
}
/**
* 分页查询订单列表
*/
@RequestMapping("licence-order-page")
public RestResponse<Page<LicenceOrderPageVO>> getLicenceOrderPage(@RequestBody LicenceOrderPageQO licenceOrderPageQO) {
WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
if (loginUser == null || StringUtils.isBlank(loginUser.getEnterpriseId())) {
return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_4.getCode()), HaoBanErrCode.ERR_4.getMsg());
}
String enterpriseId = loginUser.getEnterpriseId();
String wxEnterpriseId = loginUser.getWxEnterpriseId();
String clerkName = loginUser.getClerkName();
LicenceOrderPageQDTO qdto = JSONObject.parseObject(JSONObject.toJSONString(licenceOrderPageQO), LicenceOrderPageQDTO.class);
qdto.setEnterpriseId(enterpriseId);
qdto.setWxEnterpriseId(wxEnterpriseId);
qdto.setCreatorName(clerkName);
qdto.setType(1);
ServiceResponse<Page<LicenceOrderPageDTO>> licenceOrderPage = licenceOrderApiService.getLicenceOrderPage(qdto);
Page<LicenceOrderPageVO> result = PageHelperUtils.changePageToCurrentPage(licenceOrderPage.getResult(), LicenceOrderPageVO.class);
return RestResponse.successResult(result);
}
/**
* 取消订单/订单已经过期
*/
@RequestMapping("licence-order-cancel")
@GicLogRecord(value = "${#logValue}", category = GicLogRecordCategoryEnum.HB_LICENCE_ORDER,
optType = GicLogRecordOptTypeEnum.HB_1004_02, userFunc = LogRecordUserServiceImpl.class, optPage = "取消订单")
public RestResponse<Boolean> cancelLicenceOrder(@RequestParam Long orderId, Integer type) {
WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
if (loginUser == null || StringUtils.isBlank(loginUser.getEnterpriseId())) {
return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_4.getCode()), HaoBanErrCode.ERR_4.getMsg());
}
ServiceResponse<LicenceOrderDTO> licenceOrderDetail = licenceOrderApiService.getLicenceOrderDetail(orderId, null);
LicenceOrderDTO dto = licenceOrderDetail.getResult();
if (null == dto) {
return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_5.getCode()), HaoBanErrCode.ERR_5.getMsg());
}
String enterpriseId = loginUser.getEnterpriseId();
String wxEnterpriseId = loginUser.getWxEnterpriseId();
String clerkName = loginUser.getClerkName();
Boolean result = licenceOrderApiService.updateLicenceOrderType(orderId, type, enterpriseId, wxEnterpriseId, clerkName, 1).getResult();
String logValue = "【取消购买企微许可账号订单】:订单编号" + dto.getOrderNumber() + ",取消时间" + DateUtil.dateToStr(new Date(), DateUtil.FORMAT_DATETIME_19);
GicLogRecordEvaluationContext.putAttribute("logValue", logValue);
return RestResponse.successResult(result);
}
/**
* 订单凭证上传
*/
@RequestMapping("licence-order-voucher-upload")
@GicLogRecord(value = "${#logValue}", category = GicLogRecordCategoryEnum.HB_LICENCE_ORDER,
optType = GicLogRecordOptTypeEnum.HB_1004_03, userFunc = LogRecordUserServiceImpl.class, optPage = "上传凭证")
public RestResponse<Boolean> uploadLicenceOrderVoucher(@RequestParam Long orderId, String voucher) {
WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
if (loginUser == null || StringUtils.isBlank(loginUser.getEnterpriseId())) {
return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_4.getCode()), HaoBanErrCode.ERR_4.getMsg());
}
ServiceResponse<LicenceOrderDTO> licenceOrderDetail = licenceOrderApiService.getLicenceOrderDetail(orderId, null);
LicenceOrderDTO dto = licenceOrderDetail.getResult();
if (null == dto) {
return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_5.getCode()), HaoBanErrCode.ERR_5.getMsg());
}
String enterpriseId = loginUser.getEnterpriseId();
String wxEnterpriseId = loginUser.getWxEnterpriseId();
String clerkName = loginUser.getClerkName();
Boolean result = licenceOrderApiService.uploadLicenceOrderVoucher(orderId, voucher, enterpriseId, wxEnterpriseId, clerkName).getResult();
String logValue = "【上传购买企微许可账号支付凭证】:订单编号" + dto.getOrderNumber() + ",上传时间" + DateUtil.dateToStr(new Date(), DateUtil.FORMAT_DATETIME_19);
GicLogRecordEvaluationContext.putAttribute("logValue", logValue);
return RestResponse.successResult(result);
}
/**
* 支付订单
*/
@RequestMapping("licence-order-pay-1")
public RestResponse<Map<String, Object>> payLicenceOrder(@RequestParam Long orderId) {
WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
if (loginUser == null || StringUtils.isBlank(loginUser.getEnterpriseId())) {
return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_4.getCode()), HaoBanErrCode.ERR_4.getMsg());
}
LicenceOrderDTO result = licenceOrderApiService.getLicenceOrderDetail(orderId, 1).getResult();
if (result == null) {
return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_5.getCode()), HaoBanErrCode.ERR_5.getMsg());
}
//判断url是否存在,存在直接返回
if (null != result.getWxUrl()) {
Map<String, Object> map = new HashMap<String, Object>();
map.put("transactionCode", result.getOrderNumber());
map.put("url", result.getWxUrl());
map.put("money", result.getPrice());
return RestResponse.successResult(map);
}
Integer money = result.getPrice();
if (null != loginUser.getPhoneNumber() && Arrays.asList("13456789987", "13429152802","13383841777","13576223447").contains(loginUser.getPhoneNumber())) {
//测试账号付款一分
money = 1;
}
// 交易订单号
String transactionCode = result.getOrderNumber();
ScanPayReqDataDTO scanPayReqData = new ScanPayReqDataDTO("好办平台企业微信许可账号购买", loginUser.getEnterpriseId(),
transactionCode, money, DateUtil.dateToStr(new Date(), DateUtil.FORMAT_DATETIME_14), "",
"NATIVE");
//二维码
//通知回调的url
String host = config.getHost();
// 最后一个分隔符位置
int lastIndex = host.lastIndexOf("/");
// 倒数第二个分隔符位置
int secondLastIndex = host.lastIndexOf("/", lastIndex - 1);
String subHost = host.substring(0, secondLastIndex + 1);
String url = subHost + "gic-thirdparty/weixin_payment_result_notice_qywx";
scanPayReqData.setNotify_url(url);
ScanPayResDataDTO prePaymentOrderForQYWX = pay4WXService.createPrePaymentOrderForQYWX(scanPayReqData);
logger.info("微信预支付返回信息:{}", JSON.toJSONString(prePaymentOrderForQYWX));
if (prePaymentOrderForQYWX == null) {
logger.info("微信预支付订单二维码生成失败!!");
return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_100034.getCode()), HaoBanErrCode.ERR_100034.getMsg());
}
Map<String, Object> map = new HashMap<String, Object>();
map.put("transactionCode", transactionCode);
map.put("url", prePaymentOrderForQYWX.getCode_url());
map.put("money", money);
//记录订单号transactionCode和预支付交易会话标识
licenceOrderApiService.saveTransactionCode(orderId, transactionCode, prePaymentOrderForQYWX.getPrepay_id(), null, null, prePaymentOrderForQYWX.getCode_url());
return RestResponse.successResult(map);
}
/**
* 支付订单-判断是否支付成功
*/
@RequestMapping("licence-order-pay-2")
public RestResponse<Boolean> payLicenceOrder2(@RequestParam Long orderId) {
WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
if (loginUser == null || StringUtils.isBlank(loginUser.getEnterpriseId())) {
return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_4.getCode()), HaoBanErrCode.ERR_4.getMsg());
}
LicenceOrderDTO result = licenceOrderApiService.getLicenceOrderDetail(orderId, 1).getResult();
if (result == null) {
return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_5.getCode()), HaoBanErrCode.ERR_5.getMsg());
}
if (result.getOrderStatus() == 1) {
return RestResponse.successResult(true);
}
return RestResponse.successResult(false);
}
/**
* 查询企业品牌名称
*/
@RequestMapping("get-enterprise-name")
public RestResponse<HashMap<String, String>> getEnterpriseName() {
WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
if (loginUser == null || StringUtils.isBlank(loginUser.getEnterpriseId())) {
return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_4.getCode()), HaoBanErrCode.ERR_4.getMsg());
}
HashMap<String, String> result = new HashMap<>(8);
//查询gic品牌名称
EnterpriseDTO enterpriseDTO = enterpriseService.getEnterpriseById(loginUser.getEnterpriseId());
if (ObjectUtil.isNotNull(enterpriseDTO)) {
logger.info("gic企业查询返回实体:{}", JSON.toJSONString(enterpriseDTO));
result.put("enterpriseName", enterpriseDTO.getEnterpriseName());
}
WxEnterpriseDTO wxEnterpriseDTO = wxEnterpriseApiService.getOne(loginUser.getWxEnterpriseId());
if (ObjectUtil.isNotNull(wxEnterpriseDTO)) {
logger.info("企业微信查询返回实体:{}", JSON.toJSONString(wxEnterpriseDTO));
result.put("wxEnterpriseName", wxEnterpriseDTO.getCorpName());
}
return RestResponse.successResult(result);
}
/**
* 查询企业是否存在未支付订单
*/
@RequestMapping("licence-order-isPay")
public RestResponse<String> isPayLicenceOrder() {
WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
if (loginUser == null || StringUtils.isBlank(loginUser.getEnterpriseId())) {
return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_4.getCode()), HaoBanErrCode.ERR_4.getMsg());
}
ServiceResponse<String> payLicenceOrder = licenceOrderApiService.isPayLicenceOrder(loginUser.getWxEnterpriseId());
return RestResponse.successResult(payLicenceOrder.getResult());
}
/**
* 查询开户信息
*/
@RequestMapping("get-account-info")
public RestResponse<HashMap<String, String>> getAccountInfo() {
WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
if (loginUser == null || StringUtils.isBlank(loginUser.getEnterpriseId())) {
return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_4.getCode()), HaoBanErrCode.ERR_4.getMsg());
}
HashMap<String, String> result = new HashMap<>(8);
result.put("accountName", config.getAccountName());
result.put("accountNumber", config.getAccountNumber());
result.put("bankName", config.getBankName());
return RestResponse.successResult(result);
}
/**
* 订单编号和企业微信订单编号模糊搜索
*
* @param param 模糊查询
* @param type 0 微信订单编号 1 企业微信订单编号
* @return
*/
@RequestMapping("get-order-id-list")
public RestResponse<List<String>> getOrderIdList(String param, Integer type) {
WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
if (loginUser == null || StringUtils.isBlank(loginUser.getEnterpriseId())) {
return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_4.getCode()), HaoBanErrCode.ERR_4.getMsg());
}
ServiceResponse<List<String>> orderIdList = licenceOrderApiService.getOrderIdList(param, type, loginUser.getWxEnterpriseId());
return RestResponse.successResult(orderIdList.getResult());
}
}
......@@ -131,6 +131,7 @@ public enum HaoBanErrCode {
*
*/
ERR_100033(100033, "分组被关联,不可删除"),
ERR_100034(100034, "微信预支付订单生成失败!"),
;
private int code;
private String msg;
......
package com.gic.haoban.manage.web.qo.licence;
import com.gic.api.base.commons.BasePageInfo;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
/**
* <p>
*
* </p>
*
* @author jx
* @since 2023-03-09
*/
@Data
@EqualsAndHashCode(callSuper = false)
public class LicenceOrderPageQO extends BasePageInfo implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 订单编号
*/
private String orderNumber;
/**
* 订单状态,0:待支付,1:已支付,2:已取消,3:已过期,4:已退款,5:审核中
*/
private Integer orderStatus;
/**
* 企业微信订单id
*/
private String qywxOrderId;
/**
* 企业微信订单状态,0:待支付,1:已支付,2:已取消,3:已过期,4:退款中,5:退款被拒绝,6:已退款,7已失效
*/
private Integer qywxOrderStatus;
/**
* 订单创建开始时间
*/
private String startTime;
/**
* 订单创建结束时间
*/
private String endTime;
}
package com.gic.haoban.manage.web.qo.licence;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
/**
* <p>
*
* </p>
*
* @author jx
* @since 2023-03-09
*/
@Data
@EqualsAndHashCode(callSuper = false)
public class LicenceOrderQO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 订单类型,1:购买帐号,2:续期帐号
*/
private Integer orderType;
/**
* 互通帐号个数
*/
private Integer externalContactCount;
// /**
// * 基础帐号个数
// */
// private Integer baseCount;
/**
* 订单金额,单位分
*/
private Integer price;
/**
* 购买时间类型 1:按月购买,2:按天购买
*/
private Integer timeType;
/**
* 购买的时间数值
*/
private Integer timeValue;
/**
* 支付类型 1在线支付 2对公转账
*/
private Integer payType;
/**
* 校验金额
*/
public Integer checkPrice(){
if (this.externalContactCount ==null || this.externalContactCount<0){
return -1;
}
Integer myPrice=0;
//根据企业微信的计费规则计算
if (this.externalContactCount<=5){
myPrice = 50*this.externalContactCount;
} else if (this.externalContactCount<=200) {
myPrice = 250+40*(this.externalContactCount-5);
} else if (this.externalContactCount<=500) {
myPrice = 8050+30*(this.externalContactCount-200);
} else if (this.externalContactCount<=1000) {
myPrice = 17050+20*(this.externalContactCount-500);
} else if (this.externalContactCount<=10000) {
myPrice = 27050+10*(this.externalContactCount-1000);
}else {
return -1;
}
//转化为分
myPrice = myPrice*this.timeValue*100;
if (this.timeType == 1){
//企业微信的规则: 12.312,最终保留的是12.32
if (myPrice%12==0){
myPrice = myPrice/12;
}else {
myPrice = myPrice/12+1;
}
}else {
if (myPrice%372==0){
myPrice = myPrice/372;
}else {
myPrice = myPrice/372+1;
}
}
if (!this.price .equals(myPrice)){
return 0;
}
return 1;
}
}
package com.gic.haoban.manage.web.vo.licence;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author jx
* @since 2023-03-09
*/
@Data
@EqualsAndHashCode(callSuper = false)
public class LicenceOrderPageVO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 订单id
*/
private Long orderId;
/**
* 订单类型,1:购买帐号,2:续期帐号
*/
private Integer orderType;
/**
* 互通帐号个数
*/
private Integer externalContactCount;
/**
* 基础帐号个数
*/
private Integer baseCount;
/**
* 订单金额,单位分
*/
private Integer price;
/**
* 购买时间类型 1:按月购买,2:按天购买
*/
private Integer timeType;
/**
* 购买的时间数值
*/
private Integer timeValue;
/**
* 支付类型 1在线支付 2对公转账
*/
private Integer payType;
/**
* 订单编号
*/
private String orderNumber;
/**
* 订单状态,0:待支付,1:已支付,2:已取消,3:已过期,4:已退款,5:审核中
*/
private Integer orderStatus;
/**
* 订单状态更改原因
*/
private String orderStatusReason;
/**
* 支付时间 支付类型为1:微信支付时间 2:审核确认通过的时间
*/
private Date payTime;
/**
* 企业微信订单id
*/
private String qywxOrderId;
/**
* 企业微信订单状态,0:待支付,1:已支付,2:已取消,3:已过期,4:退款中,5:退款被拒绝,6:已退款,7已失效
*/
private Integer qywxOrderStatus;
/**
* 企业微信订单更改原因
*/
private String qywxOrderStatusReason;
/**
* 创建时间
*/
private Date createTime;
/**
* 创建人
*/
private String creatorId;
/**
* 创建人名称
*/
private String creatorName;
/**
* 企业微信支付时间
*/
private Date qywxPayTime;
}
package com.gic.haoban.manage.web.vo.licence;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author jx
* @since 2023-03-09
*/
@Data
@EqualsAndHashCode(callSuper = false)
public class LicenceOrderProgressVO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
private Long id;
/**
* 订单状态
*/
private String orderStatus;
/**
* 标记字段 1好办后台
*/
private Integer type;
/**
* 上传凭证url
*/
private String voucher;
/**
* 原因
*/
private String reason;
/**
* 创建时间
*/
private Date createTime;
}
package com.gic.haoban.manage.web.vo.licence;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* <p>
*
* </p>
*
* @author jx
* @since 2023-03-09
*/
@Data
@EqualsAndHashCode(callSuper = false)
public class LicenceOrderVO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 订单id
*/
private Long orderId;
/**
* gic商户Id
*/
private String enterpriseId;
/**
* gic品牌名称
*/
private String enterpriseName;
/**
* wx企业Id
*/
private String wxEnterpriseId;
/**
* 微信商户名称
*/
private String wxEnterpriseName;
/**
* 订单类型,1:购买帐号,2:续期帐号
*/
private Integer orderType;
/**
* 互通帐号个数
*/
private Integer externalContactCount;
/**
* 基础帐号个数
*/
private Integer baseCount;
/**
* 订单金额,单位分
*/
private Integer price;
/**
* 购买时间类型 1:按月购买,2:按天购买
*/
private Integer timeType;
/**
* 购买的时间数值
*/
private Integer timeValue;
/**
* 支付类型 1在线支付 2对公转账
*/
private Integer payType;
/**
* 订单编号
*/
private String orderNumber;
/**
* 上传凭证url
*/
private String voucher;
/**
* 订单状态,0:待支付,1:已支付,2:已取消,3:已过期,4:已退款,5:审核中
*/
private Integer orderStatus;
/**
* 订单状态更改原因
*/
private String orderStatusReason;
/**
* 支付时间 支付类型为1:微信支付时间 2:上传凭证时间
*/
private Date payTime;
/**
* 退款时间
*/
private Date refundTime;
/**
* 企业微信订单id
*/
private String qywxOrderId;
/**
* 企业微信订单状态,0:待支付,1:已支付,2:已取消,3:已过期,4:退款中,5:退款被拒绝,6:已退款,7已失效
*/
private Integer qywxOrderStatus;
/**
* 企业微信订单更改原因
*/
private String qywxOrderStatusReason;
/**
* 企业微信支付时间
*/
private Date qywxPayTime;
/**
* 企业微信退款时间
*/
private Date qywxRefundTime;
/**
* 审核不通过原因
*/
private String reason;
/**
* 创建时间
*/
private Date createTime;
/**
* 到期时间
*/
private Date expireTime;
/**
* 当前时间
*/
private Date nowTime;
/**
* 订单进度list
*/
private List<LicenceOrderProgressVO> OrderProgressList;
}
......@@ -132,5 +132,7 @@
<dubbo:reference interface="com.gic.member.api.service.MemberService" id="memberService"/>
<dubbo:reference interface="com.gic.search.engine.api.service.dynamic.ESDataDynamicOperationApiService" id="esApiService"/>
<dubbo:reference interface="com.gic.marketing.api.service.MemberTagMarketingApiService" id="memberTagMarketingApiService"/>
<dubbo:reference interface="com.gic.haoban.manage.api.service.licence.LicenceOrderApiService" id="licenceOrderApiService"/>
<dubbo:reference id="pay4WXService" interface="com.gic.thirdparty.api.service.Pay4WXService" timeout="10000" retries="0" check="false"/>
</beans>
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