Commit 021660e6 by jinxin

许可购买流程优化

parent b5fdb548
......@@ -153,6 +153,18 @@ public class LicenceOrderDTO implements Serializable {
* 微信url
*/
private String wxUrl;
/**
* 企业微信订单过期时间
*/
private Date qywxExpireTime;
public Date getQywxExpireTime() {
return qywxExpireTime;
}
public void setQywxExpireTime(Date qywxExpireTime) {
this.qywxExpireTime = qywxExpireTime;
}
public String getWxUrl() {
return wxUrl;
......
......@@ -131,6 +131,18 @@ public class LicenceOrderPageDTO implements Serializable {
* 微信订单id
*/
private String wxOrderId;
/**
* 企业微信订单过期时间
*/
private Date qywxExpireTime;
public Date getQywxExpireTime() {
return qywxExpireTime;
}
public void setQywxExpireTime(Date qywxExpireTime) {
this.qywxExpireTime = qywxExpireTime;
}
public String getWxOrderId() {
return wxOrderId;
......
......@@ -170,6 +170,10 @@ public class TabHaobanLicenceOrder implements Serializable {
* 微信url
*/
private String wxUrl;
/**
* 企业微信订单过期时间
*/
private Date qywxExpireTime;
}
......@@ -86,6 +86,7 @@ public class LicenceOrderServiceImpl implements LicenceOrderService {
order.setQywxOrderStatus(0);
order.setCreateTime(now);
order.setUpdateTime(now);
order.setQywxExpireTime(DateUtil.addDay(now, 10));
//生成订单编号
String num = "ZH"+orderId;
order.setOrderNumber(num);
......@@ -226,13 +227,6 @@ public class LicenceOrderServiceImpl implements LicenceOrderService {
}
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);
}
......
......@@ -168,8 +168,27 @@ public class LicenceOrderApiServiceImpl implements LicenceOrderApiService {
@Override
public ServiceResponse<Page<LicenceOrderPageDTO>> getLicenceOrderPage(LicenceOrderPageQDTO licenceOrderPageQDTO) {
Page<LicenceOrderPageDTO> licenceOrderPage = licenceOrderService.getLicenceOrderPage(licenceOrderPageQDTO);
List<LicenceOrderPageDTO> list = licenceOrderPage.getResult();
if (CollUtil.isNotEmpty(list)){
//判断订单状态,支付时间已过的订单的需要更改订单状态为已过期
for (LicenceOrderPageDTO dto : list){
Date now = new Date();
if (dto.getExpireTime().before(now) && dto.getOrderStatus() == 0){
dto.setOrderStatus(3);
updateLicenceOrderType(dto.getOrderId(), 3,dto.getEnterpriseId(), dto.getWxEnterpriseId(), "系统",1);
//取消企业微信订单
cancelQywxOrder(dto.getOrderId());
}
if (dto.getQywxExpireTime().before(now) && dto.getQywxOrderStatus() == 0){
dto.setQywxOrderStatus(3);
updateLicenceOrderType(dto.getOrderId(), 3,dto.getEnterpriseId(), dto.getWxEnterpriseId(), "系统",0);
}
}
licenceOrderPage.setResult(list);
return ServiceResponse.success(licenceOrderPage);
}
return ServiceResponse.success(new Page<>());
}
@Override
public ServiceResponse<Boolean> updateLicenceOrderType(Long orderId, Integer type, String enterpriseId, String wxEnterpriseId, String creatorName, Integer wxFlag) {
......@@ -179,6 +198,23 @@ public class LicenceOrderApiServiceImpl implements LicenceOrderApiService {
@Override
public ServiceResponse<Boolean> uploadLicenceOrderVoucher(Long orderId, String voucher, String enterpriseId, String wxEnterpriseId, String creatorName) {
//查询企业微信订单状态是否过期,过期则不能上传订单支付凭证
TabHaobanLicenceOrder order = licenceOrderService.getLicenceOrderDetail(orderId);
WxEnterpriseDTO wxEnterpriseDTO = wxEnterpriseService.selectById(wxEnterpriseId);
if (wxEnterpriseDTO == null) {
return ServiceResponse.failure("-9999", "微信企业不存在!!");
}
String openCorpid = wxEnterpriseDTO.getOpenCorpid();
String serviceCorpid = config.getCorpid();
FeeOrderDeatilResponseDTO dto = qywxUserApiService.getOrder(openCorpid, serviceCorpid, order.getQywxOrderId());
if (null != dto && null != dto.getOrder() && dto.getOrder().getOrderStatus() == 3){
//订单失效,记录订单状态
licenceOrderService.updateLicenceOrderType(order.getOrderId(), 3, order.getEnterpriseId(),
order.getWxEnterpriseId(), "系统", 0);
licenceOrderService.updateLicenceOrderType(order.getOrderId(), 2, order.getEnterpriseId(),
order.getWxEnterpriseId(), "系统", 1);
return ServiceResponse.failure("9999","企业微信订单已过期!");
}
licenceOrderService.uploadLicenceOrderVoucher(orderId, voucher, enterpriseId, wxEnterpriseId, creatorName);
return ServiceResponse.success(true);
}
......@@ -387,8 +423,8 @@ public class LicenceOrderApiServiceImpl implements LicenceOrderApiService {
licenceOrderService.updateLicenceOrderType(order.getOrderId(), 4, order.getEnterpriseId(), order.getWxEnterpriseId(), "系统", 1);
return ServiceResponse.success(true);
}
if (4 == order.getOrderStatus()){
return ServiceResponse.failure("-9999", "该笔订单已退款!");
if (1 != order.getOrderStatus()){
return ServiceResponse.failure("-9999", "该笔订单不是已支付状态!");
}
RefundReqDataDTO reqData = new RefundReqDataDTO(order.getWxOrderId(), null, null, String.valueOf(orderId), order.getPrice(),
order.getPrice(), null, null);
......@@ -449,8 +485,8 @@ public class LicenceOrderApiServiceImpl implements LicenceOrderApiService {
if (wxEnterpriseDTO == null) {
return ServiceResponse.failure("-9999", "微信企业不存在!!");
}
//先申请微信退款,再取消企业微信订单
wxRefund(orderId);
//取消企业微信订单,退款由财务人员手动触发
// wxRefund(orderId);
String openCorpid = wxEnterpriseDTO.getOpenCorpid();
String serviceCorpid = config.getCorpid();
ServiceResponse<QywxResponseDTO> response = qywxOrderApiService.cancelOrder(serviceCorpid, openCorpid, order.getQywxOrderId());
......
......@@ -33,6 +33,7 @@
<result column="prepay_id" property="prepayId"/>
<result column="wx_order_id" property="wxOrderId"/>
<result column="wx_url" property="wxUrl"/>
<result column="qywx_expire_time" property="qywxExpireTime"/>
</resultMap>
<sql id="Base_Column_List">
order_id,
......@@ -65,7 +66,8 @@
expire_time,
prepay_id,
wx_order_id,
wx_url
wx_url,
qywx_expire_time
</sql>
<!-- ===================== 新增 ======================== -->
<insert id="insert" parameterType="com.gic.haoban.manage.service.entity.licence.TabHaobanLicenceOrder"
......
......@@ -154,7 +154,7 @@ public class LicenceOrderController {
}
/**
* 取消订单/订单已经过期
* 取消订单
*/
@RequestMapping("licence-order-cancel")
@GicLogRecord(value = "${#logValue}", category = GicLogRecordCategoryEnum.HB_LICENCE_ORDER,
......@@ -172,11 +172,18 @@ public class LicenceOrderController {
String enterpriseId = loginUser.getEnterpriseId();
String wxEnterpriseId = loginUser.getWxEnterpriseId();
String clerkName = loginUser.getClerkName();
//取消企业微信订单
ServiceResponse<Boolean> response = licenceOrderApiService.cancelQywxOrder(orderId);
if (response.isSuccess()){
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);
}
return RestResponse.failure(response.getCode(),response.getMessage());
}
/**
* 订单凭证上传
......@@ -197,10 +204,13 @@ public class LicenceOrderController {
String enterpriseId = loginUser.getEnterpriseId();
String wxEnterpriseId = loginUser.getWxEnterpriseId();
String clerkName = loginUser.getClerkName();
Boolean result = licenceOrderApiService.uploadLicenceOrderVoucher(orderId, voucher, enterpriseId, wxEnterpriseId, clerkName).getResult();
ServiceResponse<Boolean> response = licenceOrderApiService.uploadLicenceOrderVoucher(orderId, voucher, enterpriseId, wxEnterpriseId, clerkName);
if(response.isSuccess()){
String logValue = "【上传购买企微许可账号支付凭证】:订单编号" + dto.getOrderNumber() + ",上传时间" + DateUtil.dateToStr(new Date(), DateUtil.FORMAT_DATETIME_19);
GicLogRecordEvaluationContext.putAttribute("logValue", logValue);
return RestResponse.successResult(result);
return RestResponse.successResult(true);
}
return RestResponse.failure(response.getCode(),response.getMessage());
}
/**
......
......@@ -154,5 +154,9 @@ public class LicenceOrderVO implements Serializable {
* 订单进度list
*/
private List<LicenceOrderProgressVO> OrderProgressList;
/**
* 企业微信订单过期时间
*/
private Date qywxExpireTime;
}
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