Commit 08ad065a by 墨竹

Merge branch 'feature-qywx-fee' into developer

parents f519f21a 98ae99a3
......@@ -11,6 +11,7 @@ public enum AlertTypeEnum {
ES_BID_PAGE(5, "es查询存在大分页", "https://oapi.dingtalk.com/robot/send?access_token=04b381d2b95816d28ed37c73d300537cbd2e67dc6670258ab85a6b3ef227d3b3"),
GET_NEW_EXTERNAL_USERID(6, "转换外部联系人id", null),
WEWORK_PAY(7, "向员工付款", null),
FEE_ALARM(8, "企微许可账号到期拦截提醒", "https://oapi.dingtalk.com/robot/send?access_token=8bff312a35700ae99a4b8a26d90038fe6bddc5e3e6a0a0d348c9c84c0473979a"),
;
private Integer type;
private String name;
......
......@@ -81,6 +81,9 @@ public class QywxManageController extends WebBaseController {
@RequestMapping(value = "qywx-fee-detail", method = RequestMethod.GET)
public RestResponse qywxFeeDetail(String wxEnterpriseId) {
List<HaobanQywxFeeDetailDTO> haobanQywxFeeDetailDTOS = haobanQywxFeeApiService.feeDetail(wxEnterpriseId);
if (CollectionUtils.isEmpty(haobanQywxFeeDetailDTOS)) {
return RestResponse.successResult();
}
return RestResponse.successResult(haobanQywxFeeDetailDTOS);
}
......
......@@ -3,7 +3,6 @@ package com.gic.haoban.manage.service.dao.mapper.fee;
import com.gic.haoban.manage.api.dto.fee.HaobanQywxFeeDetailDTO;
import com.gic.haoban.manage.service.entity.fee.TabHaobanQywxFeeAccountStaff;
import org.apache.ibatis.annotations.Param;
import org.springframework.data.domain.Pageable;
import java.util.Date;
import java.util.List;
......@@ -25,15 +24,6 @@ public interface TabHaobanQywxFeeAccountStaffMapper {
TabHaobanQywxFeeAccountStaff queryById(Long feeAccountId);
/**
* 查询指定行数据
*
* @param tabHaobanQywxFeeAccountStaff 查询条件
* @param pageable 分页对象
* @return 对象列表
*/
List<TabHaobanQywxFeeAccountStaff> queryAllByLimit(TabHaobanQywxFeeAccountStaff tabHaobanQywxFeeAccountStaff, @Param("pageable") Pageable pageable);
/**
* 新增数据
*
* @param tabHaobanQywxFeeAccountStaff 实例对象
......
......@@ -12,7 +12,7 @@ import java.util.Date;
public class TabHaobanQywxFeeAccountStaff implements Serializable {
private static final long serialVersionUID = -61823317787793524L;
private Long feeAccountId;
private Long feeAccountStaffId;
private String orderId;
......@@ -45,12 +45,12 @@ public class TabHaobanQywxFeeAccountStaff implements Serializable {
private Date activeTime;
public Long getFeeAccountId() {
return feeAccountId;
public Long getFeeAccountStaffId() {
return feeAccountStaffId;
}
public void setFeeAccountId(Long feeAccountId) {
this.feeAccountId = feeAccountId;
public void setFeeAccountStaffId(Long feeAccountStaffId) {
this.feeAccountStaffId = feeAccountStaffId;
}
public String getOrderId() {
......
......@@ -53,7 +53,7 @@ public class HaobanQywxFeeAccountStaffServiceImpl implements HaobanQywxFeeAccoun
@Override
public TabHaobanQywxFeeAccountStaff update(TabHaobanQywxFeeAccountStaff tabHaobanQywxFeeAccountStaff) {
this.tabHaobanQywxFeeAccountStaffMapper.update(tabHaobanQywxFeeAccountStaff);
return this.queryById(tabHaobanQywxFeeAccountStaff.getFeeAccountId());
return this.queryById(tabHaobanQywxFeeAccountStaff.getFeeAccountStaffId());
}
/**
......
......@@ -2,15 +2,20 @@ package com.gic.haoban.manage.service.service.out.impl.fee;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.Page;
import com.gic.commons.util.EntityUtil;
import com.gic.commons.util.GICMQClientUtil;
import com.gic.commons.util.UniqueIdUtils;
import com.gic.dubbo.entity.ProviderLocalTag;
import com.gic.haoban.common.utils.PageUtil;
import com.gic.haoban.manage.api.constants.Manage3Constants;
import com.gic.haoban.manage.api.dto.AlertMessageDTO;
import com.gic.haoban.manage.api.dto.fee.HaobanQywxFeeAccountInterceptLogDTO;
import com.gic.haoban.manage.api.dto.fee.HaobanQywxFeeDTO;
import com.gic.haoban.manage.api.dto.fee.HaobanQywxFeeDetailDTO;
import com.gic.haoban.manage.api.dto.qdto.QywxFeeListQDTO;
import com.gic.haoban.manage.api.enums.AlertTypeEnum;
import com.gic.haoban.manage.api.service.fee.HaobanQywxFeeApiService;
import com.gic.haoban.manage.service.config.Config;
import com.gic.haoban.manage.service.entity.TabHaobanStaff;
......@@ -20,6 +25,7 @@ import com.gic.haoban.manage.service.pojo.bo.fee.HaobanQywxFeeBO;
import com.gic.haoban.manage.service.service.StaffService;
import com.gic.haoban.manage.service.service.WxEnterpriseService;
import com.gic.haoban.manage.service.service.fee.*;
import com.gic.mq.sdk.GicMQClient;
import com.gic.wechat.api.dto.qywx.fee.*;
import com.gic.wechat.api.dto.qywx.fee.qdto.FeeOrderListQDTO;
import com.gic.wechat.api.service.qywx.QywxUserApiService;
......@@ -30,9 +36,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.*;
@Service("haobanQywxFeeApiService")
public class HaobanQywxFeeApiServiceImpl implements HaobanQywxFeeApiService {
......@@ -227,10 +231,12 @@ public class HaobanQywxFeeApiServiceImpl implements HaobanQywxFeeApiService {
tabHaobanQywxFee.setWxEnterpriseId(wxEnterpriseId);
tabHaobanQywxFee.setInterceptTime(haobanQywxFeeDetailDTO.getInterceptTime());
tabHaobanQywxFee.setInterceptUserNum(haobanQywxFeeDetailDTO.getInterceptUserNum());
tabHaobanQywxFee.setPermissionUserNum(haobanQywxFeeOrderAccountService.countOrderAccountStatus(1,wxEnterpriseId));
tabHaobanQywxFee.setPermissionUserNum(haobanQywxFeeOrderAccountService.countOrderAccountStatus(1, wxEnterpriseId));
tabHaobanQywxFee.setBuyPermissionUserNum(haobanQywxFeeOrderService.countExternalContactCount(wxEnterpriseId));
tabHaobanQywxFee.setInterceptFlag(0);
haobanQywxFeeService.insert(tabHaobanQywxFee);
//告警
messageAlert(wxEnterpriseId, wxEnterprise.getCorpName(), corpid, AlertTypeEnum.FEE_ALARM.getName());
}
List<TabHaobanQywxFeeAccountInterceptLog> tabHaobanQywxFeeAccountInterceptLogs = haobanQywxFeeAccountInterceptLogService.queryByWxEnterpriseId(wxEnterpriseId);
......@@ -240,9 +246,9 @@ public class HaobanQywxFeeApiServiceImpl implements HaobanQywxFeeApiService {
tabHaobanQywxFee.setCorpName(wxEnterprise.getCorpName());
tabHaobanQywxFee.setCorpId(corpid);
tabHaobanQywxFee.setWxEnterpriseId(wxEnterpriseId);
tabHaobanQywxFee.setInterceptTime(DateUtil.offsetDay(new Date(),-1));
tabHaobanQywxFee.setInterceptTime(DateUtil.offsetDay(new Date(), -1));
tabHaobanQywxFee.setInterceptUserNum(tabHaobanQywxFeeAccountInterceptLogs.size());
tabHaobanQywxFee.setPermissionUserNum(haobanQywxFeeOrderAccountService.countOrderAccountStatus(1,wxEnterpriseId));
tabHaobanQywxFee.setPermissionUserNum(haobanQywxFeeOrderAccountService.countOrderAccountStatus(1, wxEnterpriseId));
tabHaobanQywxFee.setBuyPermissionUserNum(haobanQywxFeeOrderService.countExternalContactCount(wxEnterpriseId));
tabHaobanQywxFee.setInterceptFlag(1);
haobanQywxFeeService.insert(tabHaobanQywxFee);
......@@ -264,7 +270,7 @@ public class HaobanQywxFeeApiServiceImpl implements HaobanQywxFeeApiService {
@Override
public void addInterceptLog(String param) {
HaobanQywxFeeAccountInterceptLogDTO haobanQywxFeeAccountInterceptLogDTO = JSON.toJavaObject(JSON.parseObject(param),HaobanQywxFeeAccountInterceptLogDTO.class);
HaobanQywxFeeAccountInterceptLogDTO haobanQywxFeeAccountInterceptLogDTO = JSON.toJavaObject(JSON.parseObject(param), HaobanQywxFeeAccountInterceptLogDTO.class);
haobanQywxFeeAccountInterceptLogDTO.setFeeAccountInterceptId(UniqueIdUtils.uniqueLong());
TabHaobanWxEnterprise haobanWxEnterprise = wxEnterpriseService.getEnterpriseBycorpId(haobanQywxFeeAccountInterceptLogDTO.getCorpId());
if (haobanWxEnterprise != null) {
......@@ -275,11 +281,37 @@ public class HaobanQywxFeeApiServiceImpl implements HaobanQywxFeeApiService {
haobanQywxFeeAccountInterceptLogDTO.setStaffId(tabHaobanStaff.getStaffId());
}
}
haobanQywxFeeAccountInterceptLogService.insert(EntityUtil.changeEntityNew(TabHaobanQywxFeeAccountInterceptLog.class,haobanQywxFeeAccountInterceptLogDTO));
haobanQywxFeeAccountInterceptLogService.insert(EntityUtil.changeEntityNew(TabHaobanQywxFeeAccountInterceptLog.class, haobanQywxFeeAccountInterceptLogDTO));
}
@Override
public HaobanQywxFeeDTO queryByWxEnterpriseId(String wxEnterpriseId) {
return EntityUtil.changeEntityNew(HaobanQywxFeeDTO.class,haobanQywxFeeService.queryByWxEnterpriseId(wxEnterpriseId));
return EntityUtil.changeEntityNew(HaobanQywxFeeDTO.class, haobanQywxFeeService.queryByWxEnterpriseId(wxEnterpriseId));
}
/**
* 告警
*
* @param wxEnterpriseId
*/
private void messageAlert(String wxEnterpriseId, String corpName, String corpid, String titleSub) {
ProviderLocalTag providerLocalTag = ProviderLocalTag.tag.get();
String traceId = providerLocalTag.traceId;
AlertMessageDTO messageDTO = new AlertMessageDTO();
messageDTO.setAlertTitle(titleSub);
messageDTO.setAlertType(AlertTypeEnum.FEE_ALARM.getType());
messageDTO.setWxEnterpriseId(wxEnterpriseId);
Map<String, Object> map = new HashMap<>();
map.put("企业名称", corpName);
map.put("企业id", corpid);
messageDTO.setContentMap(map);
messageDTO.setTraceId(traceId);
GicMQClient clientInstance = GICMQClientUtil.getClientInstance();
try {
clientInstance.sendMessage("haobanAlertMq", JSONObject.toJSONString(messageDTO), 6 * 3600);
} catch (Exception e) {
logger.info("异常:{}", e.getMessage(), e);
}
}
}
......@@ -3,7 +3,7 @@
<mapper namespace="com.gic.haoban.manage.service.dao.mapper.fee.TabHaobanQywxFeeAccountStaffMapper">
<resultMap type="com.gic.haoban.manage.service.entity.fee.TabHaobanQywxFeeAccountStaff" id="TabHaobanQywxFeeAccountStaffMap">
<result property="feeAccountId" column="fee_account_id" jdbcType="INTEGER"/>
<result property="feeAccountStaffId" column="fee_account_staff_id" jdbcType="INTEGER"/>
<result property="orderId" column="order_id" jdbcType="VARCHAR"/>
<result property="corpId" column="corp_id" jdbcType="VARCHAR"/>
<result property="wxEnterpriseId" column="wx_enterprise_id" jdbcType="VARCHAR"/>
......@@ -16,7 +16,7 @@
</resultMap>
<sql id="Base_Column_List">
fee_account_id
fee_account_staff_id
, order_id, corp_id, wx_enterprise_id, wx_user_id, staff_id, active_code, account_type, expire_time, active_time
</sql>
......@@ -71,18 +71,18 @@
<!--新增所有列-->
<insert id="insert" keyProperty="feeAccountId" useGeneratedKeys="true">
insert into tab_haoban_qywx_fee_account_staff(fee_account_id, order_id, corp_id, wx_enterprise_id, wx_user_id,
insert into tab_haoban_qywx_fee_account_staff(fee_account_staff_id, order_id, corp_id, wx_enterprise_id, wx_user_id,
staff_id, active_code, account_type, expire_time, active_time)
values (#{feeAccountId}, #{orderId}, #{corpId}, #{wxEnterpriseId}, #{wxUserId}, #{staffId}, #{activeCode},
values (#{feeAccountStaffId}, #{orderId}, #{corpId}, #{wxEnterpriseId}, #{wxUserId}, #{staffId}, #{activeCode},
#{accountType}, #{expireTime}, #{activeTime})
</insert>
<insert id="insertBatch" keyProperty="feeAccountId" useGeneratedKeys="true">
insert into tab_haoban_qywx_fee_account_staff(fee_account_id, order_id, corp_id, wx_enterprise_id, wx_user_id,
insert into tab_haoban_qywx_fee_account_staff(fee_account_staff_id, order_id, corp_id, wx_enterprise_id, wx_user_id,
staff_id, active_code, account_type, expire_time, active_time)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.feeAccountId}, #{entity.orderId}, #{entity.corpId}, #{entity.wxEnterpriseId}, #{entity.wxUserId},
(#{entity.feeAccountStaffId}, #{entity.orderId}, #{entity.corpId}, #{entity.wxEnterpriseId}, #{entity.wxUserId},
#{entity.staffId}, #{entity.activeCode}, #{entity.accountType}, #{entity.expireTime}, #{entity.activeTime})
</foreach>
</insert>
......@@ -120,14 +120,14 @@
active_time = #{activeTime},
</if>
</set>
where fee_account_id = #{feeAccountId}
where fee_account_id = #{feeAccountStaffId}
</update>
<!--通过主键删除-->
<delete id="deleteById">
delete
from tab_haoban_qywx_fee_account_staff
where fee_account_id = #{feeAccountId}
where fee_account_staff_id = #{feeAccountId}
</delete>
......
......@@ -33,15 +33,15 @@
<include refid="Base_Column_List"/>
from tab_haoban_qywx_fee
<where>
<if test="searchName != null and searchName != ''">
and (corp_name like CONCAT('%',#{searchName},'%') or corp_id like CONCAT('%',#{searchName},'%')
</if>
<if test="wxEnterpriseId != null and wxEnterpriseId != ''">
and wx_enterprise_id = #{wxEnterpriseId}
</if>
<if test="interceptFlag != null">
and intercept_flag = #{interceptFlag}
</if>
<if test="searchName != null and searchName != ''">
and ( corp_name like CONCAT('%',#{searchName},'%') or corp_id like CONCAT('%',#{searchName},'%') )
</if>
<if test="startDate != null and startDate != ''">
and intercept_time <![CDATA[ >= ]]> #{startDate}
</if>
......
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