Commit f26d0c94 by 徐高华

激活账号

parent d4c04e2a
...@@ -56,14 +56,6 @@ public interface TabHaobanQywxFeeAccountInterceptLogMapper { ...@@ -56,14 +56,6 @@ public interface TabHaobanQywxFeeAccountInterceptLogMapper {
int update(TabHaobanQywxFeeAccountInterceptLog tabHaobanQywxFeeAccountInterceptLog); int update(TabHaobanQywxFeeAccountInterceptLog tabHaobanQywxFeeAccountInterceptLog);
/** /**
* 通过主键删除数据
*
* @param feeAccountInterceptId 主键
* @return 影响行数
*/
int deleteById(Long feeAccountInterceptId);
/**
* 查询天气企业服务id * 查询天气企业服务id
* *
* @param wxEnterpriseId wx企业标识 * @param wxEnterpriseId wx企业标识
......
...@@ -21,7 +21,7 @@ public interface TabHaobanQywxFeeAccountStaffMapper { ...@@ -21,7 +21,7 @@ public interface TabHaobanQywxFeeAccountStaffMapper {
* @param feeAccountId 主键 * @param feeAccountId 主键
* @return 实例对象 * @return 实例对象
*/ */
TabHaobanQywxFeeAccountStaff queryById(Long feeAccountId); TabHaobanQywxFeeAccountStaff selectByActiveCode(@Param("wxEnterpriseId")String wxEnterpriseId , @Param("activeCode")String activeCode);
/** /**
* 新增数据 * 新增数据
...@@ -32,14 +32,6 @@ public interface TabHaobanQywxFeeAccountStaffMapper { ...@@ -32,14 +32,6 @@ public interface TabHaobanQywxFeeAccountStaffMapper {
int insert(TabHaobanQywxFeeAccountStaff tabHaobanQywxFeeAccountStaff); int insert(TabHaobanQywxFeeAccountStaff tabHaobanQywxFeeAccountStaff);
/** /**
* 批量新增数据(MyBatis原生foreach方法)
*
* @param entities List<TabHaobanQywxFeeAccountStaff> 实例对象列表
* @return 影响行数
*/
int insertBatch(@Param("entities") List<TabHaobanQywxFeeAccountStaff> entities);
/**
* 修改数据 * 修改数据
* *
* @param tabHaobanQywxFeeAccountStaff 实例对象 * @param tabHaobanQywxFeeAccountStaff 实例对象
...@@ -48,14 +40,6 @@ public interface TabHaobanQywxFeeAccountStaffMapper { ...@@ -48,14 +40,6 @@ public interface TabHaobanQywxFeeAccountStaffMapper {
int update(TabHaobanQywxFeeAccountStaff tabHaobanQywxFeeAccountStaff); int update(TabHaobanQywxFeeAccountStaff tabHaobanQywxFeeAccountStaff);
/** /**
* 通过主键删除数据
*
* @param feeAccountId 主键
* @return 影响行数
*/
int deleteById(Long feeAccountId);
/**
* 详情 * 详情
* *
* @param wxEnterpriseId wx企业标识 * @param wxEnterpriseId wx企业标识
......
...@@ -14,37 +14,12 @@ import java.util.List; ...@@ -14,37 +14,12 @@ import java.util.List;
public interface HaobanQywxFeeAccountStaffService { public interface HaobanQywxFeeAccountStaffService {
/** /**
* 通过ID查询单条数据
*
* @param feeAccountId 主键
* @return 实例对象
*/
TabHaobanQywxFeeAccountStaff queryById(Long feeAccountId);
/**
* 新增数据 * 新增数据
* *
* @param tabHaobanQywxFeeAccountStaff 实例对象 * @param tabHaobanQywxFeeAccountStaff 实例对象
* @return 实例对象 * @return 实例对象
*/ */
TabHaobanQywxFeeAccountStaff insert(TabHaobanQywxFeeAccountStaff tabHaobanQywxFeeAccountStaff); TabHaobanQywxFeeAccountStaff save(TabHaobanQywxFeeAccountStaff tabHaobanQywxFeeAccountStaff);
/**
* 修改数据
*
* @param tabHaobanQywxFeeAccountStaff 实例对象
* @return 实例对象
*/
TabHaobanQywxFeeAccountStaff update(TabHaobanQywxFeeAccountStaff tabHaobanQywxFeeAccountStaff);
/**
* 通过主键删除数据
*
* @param feeAccountId 主键
* @return 是否成功
*/
boolean deleteById(Long feeAccountId);
/** /**
* 详情 * 详情
......
...@@ -21,50 +21,21 @@ public class HaobanQywxFeeAccountStaffServiceImpl implements HaobanQywxFeeAccoun ...@@ -21,50 +21,21 @@ public class HaobanQywxFeeAccountStaffServiceImpl implements HaobanQywxFeeAccoun
private TabHaobanQywxFeeAccountStaffMapper tabHaobanQywxFeeAccountStaffMapper; private TabHaobanQywxFeeAccountStaffMapper tabHaobanQywxFeeAccountStaffMapper;
/** /**
* 通过ID查询单条数据
*
* @param feeAccountId 主键
* @return 实例对象
*/
@Override
public TabHaobanQywxFeeAccountStaff queryById(Long feeAccountId) {
return this.tabHaobanQywxFeeAccountStaffMapper.queryById(feeAccountId);
}
/**
* 新增数据 * 新增数据
* *
* @param tabHaobanQywxFeeAccountStaff 实例对象 * @param tabHaobanQywxFeeAccountStaff 实例对象
* @return 实例对象 * @return 实例对象
*/ */
@Override @Override
public TabHaobanQywxFeeAccountStaff insert(TabHaobanQywxFeeAccountStaff tabHaobanQywxFeeAccountStaff) { public TabHaobanQywxFeeAccountStaff save(TabHaobanQywxFeeAccountStaff account) {
this.tabHaobanQywxFeeAccountStaffMapper.insert(tabHaobanQywxFeeAccountStaff); TabHaobanQywxFeeAccountStaff old = this.tabHaobanQywxFeeAccountStaffMapper.selectByActiveCode(account.getWxEnterpriseId(), account.getActiveCode()) ;
return tabHaobanQywxFeeAccountStaff; if(null != old) {
} account.setFeeAccountStaffId(old.getFeeAccountStaffId());
this.tabHaobanQywxFeeAccountStaffMapper.update(account) ;
/** }else {
* 修改数据 this.tabHaobanQywxFeeAccountStaffMapper.insert(account);
* }
* @param tabHaobanQywxFeeAccountStaff 实例对象 return account ;
* @return 实例对象
*/
@Override
public TabHaobanQywxFeeAccountStaff update(TabHaobanQywxFeeAccountStaff tabHaobanQywxFeeAccountStaff) {
this.tabHaobanQywxFeeAccountStaffMapper.update(tabHaobanQywxFeeAccountStaff);
return this.queryById(tabHaobanQywxFeeAccountStaff.getFeeAccountStaffId());
}
/**
* 通过主键删除数据
*
* @param feeAccountId 主键
* @return 是否成功
*/
@Override
public boolean deleteById(Long feeAccountId) {
return this.tabHaobanQywxFeeAccountStaffMapper.deleteById(feeAccountId) > 0;
} }
@Override @Override
......
...@@ -13,6 +13,7 @@ import org.springframework.stereotype.Service; ...@@ -13,6 +13,7 @@ import org.springframework.stereotype.Service;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.gic.api.base.commons.ServiceResponse; import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.util.EntityUtil; import com.gic.commons.util.EntityUtil;
import com.gic.commons.util.UniqueIdUtils;
import com.gic.haoban.base.api.common.BasePageInfo; import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.common.utils.PageUtil; import com.gic.haoban.common.utils.PageUtil;
import com.gic.haoban.common.utils.StringUtil; import com.gic.haoban.common.utils.StringUtil;
...@@ -22,7 +23,9 @@ import com.gic.haoban.manage.service.dao.mapper.StaffMapper; ...@@ -22,7 +23,9 @@ import com.gic.haoban.manage.service.dao.mapper.StaffMapper;
import com.gic.haoban.manage.service.dao.mapper.WxEnterpriseMapper; import com.gic.haoban.manage.service.dao.mapper.WxEnterpriseMapper;
import com.gic.haoban.manage.service.entity.TabHaobanStaff; import com.gic.haoban.manage.service.entity.TabHaobanStaff;
import com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise; import com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise;
import com.gic.haoban.manage.service.entity.fee.TabHaobanQywxFeeAccountStaff;
import com.gic.haoban.manage.service.service.StaffService; import com.gic.haoban.manage.service.service.StaffService;
import com.gic.haoban.manage.service.service.fee.HaobanQywxFeeAccountStaffService;
import com.gic.wechat.api.dto.qywx.fee.AccountListDTO; import com.gic.wechat.api.dto.qywx.fee.AccountListDTO;
import com.gic.wechat.api.dto.qywx.fee.AccountListResponseDTO; import com.gic.wechat.api.dto.qywx.fee.AccountListResponseDTO;
import com.gic.wechat.api.service.qywx.QywxOrderApiService; import com.gic.wechat.api.service.qywx.QywxOrderApiService;
...@@ -30,6 +33,8 @@ import com.github.pagehelper.Page; ...@@ -30,6 +33,8 @@ import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import cn.hutool.core.date.DateUtil;
@Service @Service
public class StaffServiceImpl implements StaffService { public class StaffServiceImpl implements StaffService {
private static final Logger log = LogManager.getLogger(StaffServiceImpl.class); private static final Logger log = LogManager.getLogger(StaffServiceImpl.class);
...@@ -42,6 +47,8 @@ public class StaffServiceImpl implements StaffService { ...@@ -42,6 +47,8 @@ public class StaffServiceImpl implements StaffService {
private WxEnterpriseMapper wxEnterpriseMapper ; private WxEnterpriseMapper wxEnterpriseMapper ;
@Autowired @Autowired
private Config config ; private Config config ;
@Autowired
private HaobanQywxFeeAccountStaffService haobanQywxFeeAccountStaffService;
@Override @Override
public TabHaobanStaff selectById(String id) { public TabHaobanStaff selectById(String id) {
...@@ -220,6 +227,7 @@ public class StaffServiceImpl implements StaffService { ...@@ -220,6 +227,7 @@ public class StaffServiceImpl implements StaffService {
private void updateAccount(String wxEnterpriseId , List<AccountListDTO> list) { private void updateAccount(String wxEnterpriseId , List<AccountListDTO> list) {
for(AccountListDTO item : list) { for(AccountListDTO item : list) {
String userId = item.getUserid() ; String userId = item.getUserid() ;
String activeCode = item.getActiveCode() ;
Date start = new Date(item.getActiveTime()*1000L) ; Date start = new Date(item.getActiveTime()*1000L) ;
Date end = new Date(item.getExpireTime()*1000L) ; Date end = new Date(item.getExpireTime()*1000L) ;
TabHaobanStaff staff = this.mapper.selectByUserIdAndEnterpriseId(userId, wxEnterpriseId) ; TabHaobanStaff staff = this.mapper.selectByUserIdAndEnterpriseId(userId, wxEnterpriseId) ;
...@@ -228,6 +236,16 @@ public class StaffServiceImpl implements StaffService { ...@@ -228,6 +236,16 @@ public class StaffServiceImpl implements StaffService {
} }
if(null != staff) { if(null != staff) {
this.updateActiveStatusById(staff.getStaffId(), start, end, new Date(), 1) ; this.updateActiveStatusById(staff.getStaffId(), start, end, new Date(), 1) ;
TabHaobanQywxFeeAccountStaff accountStaff = new TabHaobanQywxFeeAccountStaff();
accountStaff.setFeeAccountStaffId(UniqueIdUtils.uniqueLong());
accountStaff.setWxEnterpriseId(wxEnterpriseId);
accountStaff.setActiveCode(activeCode);
accountStaff.setStaffId(staff.getStaffId());
accountStaff.setAccountType(item.getType());
accountStaff.setExpireTime(DateUtil.date(item.getExpireTime() * 1000));
accountStaff.setActiveTime(DateUtil.date(item.getActiveTime() * 1000));
this.haobanQywxFeeAccountStaffService.save(accountStaff);
}else { }else {
log.info("查询激活账号,用户不存在,userid={}",userId); log.info("查询激活账号,用户不存在,userid={}",userId);
} }
......
...@@ -20,54 +20,13 @@ ...@@ -20,54 +20,13 @@
</sql> </sql>
<!--查询单个--> <!--查询单个-->
<select id="queryById" resultMap="TabHaobanQywxFeeAccountStaffMap"> <select id="selectByActiveCode" resultMap="TabHaobanQywxFeeAccountStaffMap">
select select
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
from tab_haoban_qywx_fee_account_staff from tab_haoban_qywx_fee_account_staff
where fee_account_id = #{feeAccountId} where wx_enterprise_id = #{wxEnterpriseId} and active_code = #{activeCode}
</select> </select>
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="TabHaobanQywxFeeAccountStaffMap">
select
<include refid="Base_Column_List"/>
from tab_haoban_qywx_fee_account_staff
<where>
<if test="feeAccountId != null">
and fee_account_id = #{feeAccountId}
</if>
<if test="orderId != null and orderId != ''">
and order_id = #{orderId}
</if>
<if test="corpId != null and corpId != ''">
and corp_id = #{corpId}
</if>
<if test="wxEnterpriseId != null and wxEnterpriseId != ''">
and wx_enterprise_id = #{wxEnterpriseId}
</if>
<if test="wxUserId != null and wxUserId != ''">
and wx_user_id = #{wxUserId}
</if>
<if test="staffId != null and staffId != ''">
and staff_id = #{staffId}
</if>
<if test="activeCode != null and activeCode != ''">
and active_code = #{activeCode}
</if>
<if test="accountType != null">
and account_type = #{accountType}
</if>
<if test="expireTime != null">
and expire_time = #{expireTime}
</if>
<if test="activeTime != null">
and active_time = #{activeTime}
</if>
</where>
limit #{pageable.offset}, #{pageable.pageSize}
</select>
<!--新增所有列--> <!--新增所有列-->
<insert id="insert" keyProperty="feeAccountId" useGeneratedKeys="true"> <insert id="insert" keyProperty="feeAccountId" useGeneratedKeys="true">
insert into tab_haoban_qywx_fee_account_staff(fee_account_staff_id, order_id, corp_id, wx_enterprise_id, insert into tab_haoban_qywx_fee_account_staff(fee_account_staff_id, order_id, corp_id, wx_enterprise_id,
...@@ -76,17 +35,6 @@ ...@@ -76,17 +35,6 @@
#{accountType}, #{expireTime}, #{activeTime}) #{accountType}, #{expireTime}, #{activeTime})
</insert> </insert>
<insert id="insertBatch" keyProperty="feeAccountId" useGeneratedKeys="true">
insert into tab_haoban_qywx_fee_account_staff(fee_account_staff_id, order_id, corp_id, wx_enterprise_id,
staff_id, active_code, account_type, expire_time, active_time)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.feeAccountStaffId}, #{entity.orderId}, #{entity.corpId}, #{entity.wxEnterpriseId},
#{entity.staffId}, #{entity.activeCode}, #{entity.accountType}, #{entity.expireTime}, #{entity.activeTime})
</foreach>
</insert>
<!--通过主键修改数据--> <!--通过主键修改数据-->
<update id="update"> <update id="update">
update tab_haoban_qywx_fee_account_staff update tab_haoban_qywx_fee_account_staff
...@@ -119,14 +67,6 @@ ...@@ -119,14 +67,6 @@
where fee_account_id = #{feeAccountStaffId} where fee_account_id = #{feeAccountStaffId}
</update> </update>
<!--通过主键删除-->
<delete id="deleteById">
delete
from tab_haoban_qywx_fee_account_staff
where fee_account_staff_id = #{feeAccountId}
</delete>
<select id="feeDetail" resultType="com.gic.haoban.manage.api.dto.fee.HaobanQywxFeeDetailDTO"> <select id="feeDetail" resultType="com.gic.haoban.manage.api.dto.fee.HaobanQywxFeeDetailDTO">
select select
count(distinct staff_id) interceptUserNum, count(distinct staff_id) interceptUserNum,
......
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