Commit 443381c8 by 徐高华

Merge branch 'feature/企微许可账号购买' into 'master'

Feature/企微许可账号购买

See merge request !1113
parents 2f8335a5 29a333ab
......@@ -144,5 +144,12 @@ public interface LicenceOrderApiService {
*/
ServiceResponse<Boolean> cancelQywxOrder(Long orderId);
/**
* 是否显示弹窗 true 显示 false 不显示
* @param wxEnterpriseId
* @return
*/
ServiceResponse<HashMap<String, Integer>> hasPopup(String wxEnterpriseId);
}
......@@ -41,6 +41,17 @@ public class Config {
@Value("${bankName}")
private String bankName;
@Value("${dingUrl}")
private String dingUrl;
public String getDingUrl() {
return dingUrl;
}
public void setDingUrl(String dingUrl) {
this.dingUrl = dingUrl;
}
public String getAccountName() {
return accountName;
}
......
......@@ -129,4 +129,11 @@ public interface TabHaobanLicenceOrderMapper {
*/
Integer saveCallBackTime(@Param("orderId") Long orderId, @Param("type") Integer type, @Param("time") Date time);
/**
* 根据wxEnterpriseId查询企业订单已支付数量
*
* @param wxEnterpriseId
*/
Integer selectCountByWxEnterpriseId(@Param("wxEnterpriseId") String wxEnterpriseId);
}
......@@ -140,6 +140,12 @@ public interface LicenceOrderService {
* @return
*/
Boolean saveCallBackTime(Long orderId,Integer type,Date time);
/**
* 根据wxEnterpriseId查询企业订单已支付数量
*
* @param wxEnterpriseId
*/
Integer selectCountByWxEnterpriseId(String wxEnterpriseId);
}
......@@ -189,6 +189,8 @@ public class LicenceOrderServiceImpl implements LicenceOrderService {
String dateToStr = DateUtil.dateToStr(new Date(), DateUtil.FORMAT_DATETIME_19);
//发送钉钉消息通知
String host = config.getHost();
//拿到钉钉群机器人url
String dingUrl = config.getDingUrl();
// 最后一个分隔符位置
int lastIndex = host.lastIndexOf("/");
// 倒数第二个分隔符位置
......@@ -197,7 +199,7 @@ public class LicenceOrderServiceImpl implements LicenceOrderService {
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);
DingUtils.send(msg,dingUrl,false);
return true;
}
......@@ -307,4 +309,9 @@ public class LicenceOrderServiceImpl implements LicenceOrderService {
tabHaobanLicenceOrderMapper.saveCallBackTime(orderId,type,time);
return true;
}
@Override
public Integer selectCountByWxEnterpriseId(String wxEnterpriseId) {
return tabHaobanLicenceOrderMapper.selectCountByWxEnterpriseId(wxEnterpriseId);
}
}
package com.gic.haoban.manage.service.service.out.impl.licence;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
......@@ -10,6 +11,7 @@ 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.StaffActiveDataDTO;
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;
......@@ -19,9 +21,13 @@ 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.fee.TabHaobanQywxFeeOrder;
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.StaffClerkRelationService;
import com.gic.haoban.manage.service.service.WxEnterpriseActiveDataService;
import com.gic.haoban.manage.service.service.WxEnterpriseService;
import com.gic.haoban.manage.service.service.fee.HaobanQywxFeeOrderService;
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;
......@@ -78,6 +84,10 @@ public class LicenceOrderApiServiceImpl implements LicenceOrderApiService {
private Pay4WXService pay4WXService;
@Autowired
private QywxUserApiService qywxUserApiService;
@Autowired
private StaffClerkRelationService staffClerkRelationService;
@Autowired
private WxEnterpriseActiveDataService wxEnterpriseActiveDataService;
@Override
public ServiceResponse<LicenceOrderDTO> getLicenceOrderDetail(Long orderId, Integer type) {
......@@ -239,6 +249,8 @@ public class LicenceOrderApiServiceImpl implements LicenceOrderApiService {
String dateToStr = DateUtil.dateToStr(new Date(), DateUtil.FORMAT_DATETIME_19);
//发送钉钉消息通知
String host = config.getHost();
//拿到钉钉群机器人url
String dingUrl = config.getDingUrl();
// 最后一个分隔符位置
int lastIndex = host.lastIndexOf("/");
// 倒数第二个分隔符位置
......@@ -247,7 +259,7 @@ public class LicenceOrderApiServiceImpl implements LicenceOrderApiService {
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);
DingUtils.send(msg, dingUrl, false);
return ServiceResponse.success(true);
}
......@@ -359,6 +371,8 @@ public class LicenceOrderApiServiceImpl implements LicenceOrderApiService {
}
//发送钉钉消息通知
String host = config.getHost();
//拿到钉钉群机器人url
String dingUrl = config.getDingUrl();
// 最后一个分隔符位置
int lastIndex = host.lastIndexOf("/");
// 倒数第二个分隔符位置
......@@ -367,7 +381,7 @@ public class LicenceOrderApiServiceImpl implements LicenceOrderApiService {
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);
DingUtils.send(msg, dingUrl, false);
return ServiceResponse.failure(refund.getResult_code(), refund.getErr_code_des());
}
//更新微信订单状态
......@@ -411,4 +425,26 @@ public class LicenceOrderApiServiceImpl implements LicenceOrderApiService {
return ServiceResponse.failure(response.getCode(),response.getMessage());
}
@Override
public ServiceResponse<HashMap<String, Integer>> hasPopup(String wxEnterpriseId) {
HashMap<String, Integer> map = new HashMap<>();
map.put("hasPopup",0);
map.put("count",0);
List<String> list = staffClerkRelationService.listByWxEnterpriseId(wxEnterpriseId);
if (CollUtil.isEmpty(list)){
return ServiceResponse.success(map);
}
Integer count = licenceOrderService.selectCountByWxEnterpriseId(wxEnterpriseId);
if (count==0){
StaffActiveDataDTO dto = wxEnterpriseActiveDataService.getWxEnterpriseActiveDataByWxEnterpriseId(wxEnterpriseId);
if (null != dto && dto.getPurchased()!=null && dto.getPurchased() > 0){
return ServiceResponse.success(map);
}
map.put("hasPopup",1);
map.put("count",list.size());
return ServiceResponse.success(map);
}
return ServiceResponse.success(map);
}
}
......@@ -345,4 +345,11 @@
and delete_flag = 0
</update>
<select id="selectCountByWxEnterpriseId" resultType="java.lang.Integer">
SELECT count(*)
FROM tab_haoban_licence_order
WHERE wx_enterprise_id = #{wxEnterpriseId}
and delete_flag = 0 and order_status = 1
</select>
</mapper>
\ No newline at end of file
......@@ -64,4 +64,8 @@ public class LicenceOrderServiceTest {
licenceOrderApiService.qywxCallBack(JSON.toJSONString(json));
}
@Test
public void test7(){
licenceOrderApiService.hasPopup("ca66a01b79474c40b3e7c7f93daf1a3b");
}
}
......@@ -349,5 +349,19 @@ public class LicenceOrderController {
return RestResponse.successResult(orderIdList.getResult());
}
/**
* 是否显示弹窗 hasPopup 0不弹出 1弹出
* count 关联数量
*/
@RequestMapping("licence-order-hasPopup")
public RestResponse<HashMap<String, Integer>> hasPopup() {
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<HashMap<String, Integer>> response = licenceOrderApiService.hasPopup(loginUser.getWxEnterpriseId());
return RestResponse.successResult(response.getResult());
}
}
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