|
@@ -540,11 +540,16 @@ public class WeiXinCorpController {
|
|
|
jsonObject = jsonObject.getJSONObject("xml");
|
|
|
|
|
|
//存储更新订单、更新公司续费情况
|
|
|
- if (jsonObject.has("OrderId")){
|
|
|
- boolean b = saveOrderAndUpCompany(jsonObject);
|
|
|
- if (!b){
|
|
|
- System.out.println("+++++++++++++++++++微信应用市场付费回调处理失败+++++++++++++++++++++++");
|
|
|
- System.out.println(jsonObject);
|
|
|
+ if (jsonObject.has("InfoType")){
|
|
|
+ String infoType = jsonObject.getString("InfoType");
|
|
|
+ //open_order:下单成功通知; change_order:改单通知; pay_for_app_success:支付成功通知;
|
|
|
+ //refund:退款通知; change_editon:付费版本变更通知;
|
|
|
+ if ("open_order".equals(infoType) || "change_order".equals(infoType) || "pay_for_app_success".equals(infoType) || "refund".equals(infoType) || "change_editon".equals(infoType)){
|
|
|
+ boolean b = saveOrderAndUpCompany(jsonObject);
|
|
|
+ if (!b){
|
|
|
+ System.out.println("+++++++++++++++++++微信应用市场付费回调处理失败+++++++++++++++++++++++");
|
|
|
+ System.out.println(jsonObject);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -2721,8 +2726,8 @@ public class WeiXinCorpController {
|
|
|
ResponseEntity<String> detailResponseEntity = restTemplate.postForEntity(url, detailEntity, String.class);
|
|
|
JSONObject json = JSONObject.parseObject(detailResponseEntity.getBody());
|
|
|
if (json.containsKey("auth_corp_info")){
|
|
|
- String editionName = json.getString("edition_id");
|
|
|
- switch (editionName){
|
|
|
+ String edition_id = json.getString("edition_id");
|
|
|
+ switch (edition_id){
|
|
|
//基础版
|
|
|
case "sp17da4a6e6f2a91f8":
|
|
|
company.setPackageProject(0);
|
|
@@ -2825,26 +2830,28 @@ public class WeiXinCorpController {
|
|
|
}
|
|
|
//获取该公司对象
|
|
|
WxCorpInfo corpid = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("corpid", wxOrder.getPaidCorpid()));
|
|
|
- Company company = companyMapper.selectById(corpid.getCompanyId());
|
|
|
- if ("open_order".equals(infoType)){
|
|
|
- wxOrderMapper.insert(wxOrder);
|
|
|
- }else if ("change_order".equals(infoType)){
|
|
|
- wxOrder.setOldOrderid(jsonObject.getString("OldOrderId"));
|
|
|
- wxOrderMapper.insert(wxOrder);
|
|
|
- }else if("pay_for_app_success".equals(infoType)){
|
|
|
- wxOrderMapper.updateById(wxOrder);
|
|
|
- if (wxOrder.getOrderPeriod().equals(365)){
|
|
|
+ if (corpid!=null){
|
|
|
+ Company company = companyMapper.selectById(corpid.getCompanyId());
|
|
|
+ if("pay_for_app_success".equals(infoType)){
|
|
|
+ wxOrderMapper.updateById(wxOrder);
|
|
|
+ Integer orderPeriod = wxOrder.getOrderPeriod();
|
|
|
//若到期时间早已过期,则取当前时间加上开通时长
|
|
|
if (LocalDateTime.now().isAfter(company.getExpirationDate())){
|
|
|
- company.setExpirationDate(LocalDateTime.now().plusYears(1));
|
|
|
+ company.setExpirationDate(LocalDateTime.now().plusDays(orderPeriod));
|
|
|
}else {
|
|
|
- company.setExpirationDate(company.getExpirationDate().plusYears(1));
|
|
|
+ company.setExpirationDate(company.getExpirationDate().plusDays(orderPeriod));
|
|
|
}
|
|
|
+ }else if ("refund".equals(infoType)){
|
|
|
+ wxOrderMapper.updateById(wxOrder);
|
|
|
+ //退款则将其到期时间设置为现在的时间减去一天
|
|
|
+ company.setExpirationDate(LocalDateTime.now().minusDays(1));
|
|
|
}
|
|
|
- }else if ("refund".equals(infoType)){
|
|
|
- wxOrderMapper.updateById(wxOrder);
|
|
|
- //退款则将其到期时间设置为现在的时间减去一天
|
|
|
- company.setExpirationDate(LocalDateTime.now().minusDays(1));
|
|
|
+ }
|
|
|
+ if ("open_order".equals(infoType)){
|
|
|
+ wxOrderMapper.insert(wxOrder);
|
|
|
+ }else if ("change_order".equals(infoType)){
|
|
|
+ wxOrder.setOldOrderid(jsonObject.getString("OldOrderId"));
|
|
|
+ wxOrderMapper.insert(wxOrder);
|
|
|
}
|
|
|
}else {
|
|
|
System.out.println("+++++++++++++"+"微信订单查询更新失败"+"+++++++++++++++");
|