修复tradebill服务无法启动问题,

修复卡查询用户接口,增加模糊查询与绑定过滤
This commit is contained in:
wenhui 2022-03-02 11:16:51 +08:00
parent 21c5754d06
commit 70f3c8b6f4
11 changed files with 161 additions and 46 deletions

View File

@ -2,6 +2,7 @@ package com.xhpc.card.mapper;
import com.xhpc.card.domain.SearchCardUserQueryCondition;
import com.xhpc.card.pojo.XhpcAppUser;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -26,7 +27,7 @@ public interface XhpcAppUserMapper {
* @date 2022/1/28 16:30
* @since version-1.0
*/
Long selectCount(SearchCardUserQueryCondition queryCondition);
Long selectCount(@Param("queryCondition") SearchCardUserQueryCondition queryCondition, @Param("userIdList") List<Integer> userIdList);
/**
* 根据条件查询记录
@ -35,7 +36,7 @@ public interface XhpcAppUserMapper {
* @date 2022/1/28 16:29
* @since version-1.0
*/
List<XhpcAppUser> selectByCondition(SearchCardUserQueryCondition queryCondition);
List<XhpcAppUser> selectByCondition(@Param("queryCondition") SearchCardUserQueryCondition queryCondition, @Param("userIdList") List<Integer> userIdList);
/**
* 根据手机号查找C端用户充值记录

View File

@ -4,6 +4,7 @@ import com.xhpc.card.pojo.XhpcIcCardInfo;
import com.xhpc.common.domain.IccardInfo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
public interface XhpcCardMapper {
@ -42,4 +43,13 @@ public interface XhpcCardMapper {
*/
Map<String, Object> selectByAccount(@Param("userAccount") String userAccount, @Param("userType") Integer userType);
/**
* 查询出指定类型的用户
*
* @author WH
* @date 2022/3/1 17:53
* @since version-1.0
*/
List<Integer> selectUserIdsByUserType(Integer userType);
}

View File

@ -36,7 +36,7 @@ public interface XhpcCommunityPersonnelMapper {
* @date 2022/2/8 10:44
* @since version-1.0
*/
List<XhpcCommunityPersonnel> selectByCondition(SearchCardUserQueryCondition queryCondition);
List<XhpcCommunityPersonnel> selectByCondition(@Param("queryCondition") SearchCardUserQueryCondition queryCondition, @Param("userIdList") List<Integer> userIdList);
/**
* 根据分页条件查询出符合条件记录的总条数
@ -45,7 +45,7 @@ public interface XhpcCommunityPersonnelMapper {
* @date 2022/2/8 10:51
* @since version-1.0
*/
Long selectCount(SearchCardUserQueryCondition queryCondition);
Long selectCount(@Param("queryCondition") SearchCardUserQueryCondition queryCondition, @Param("userIdList") List<Integer> usrIdList);
/**
* 根据运营商id分页条件查询符合的记录
@ -53,7 +53,7 @@ public interface XhpcCommunityPersonnelMapper {
* @param operatorId 运营商id
* @return 符合条件的所有记录
*/
List<XhpcCommunityPersonnel> selectByOperatorId(@Param("operatorId") Long operatorId, @Param("currentPage") Long currentPage, @Param("items") Long items);
List<XhpcCommunityPersonnel> selectByOperatorId(@Param("operatorId") Long operatorId, @Param("currentPage") Long currentPage, @Param("items") Long items, @Param("userIdList") List<Integer> userIdList);
/**
* 根据运营商id分页条件查询符合的记录的个数
@ -61,7 +61,7 @@ public interface XhpcCommunityPersonnelMapper {
* @param operatorId 运营商id
* @return 符合条件个数
*/
Long selectCountByOperatorId(@Param("operatorId") Long operatorId);
Long selectCountByOperatorId(@Param("operatorId") Long operatorId, @Param("userIdList") List<Integer> userIdList);
/**
* query record by userAccount

View File

@ -36,7 +36,7 @@ public interface XhpcCustomersPersonnelMapper {
* @date 2022/2/8 14:39
* @since version-1.0
*/
List<XhpcCustomersPersonnel> selectByCondition(SearchCardUserQueryCondition queryCondition);
List<XhpcCustomersPersonnel> selectByCondition(@Param("queryCondition") SearchCardUserQueryCondition queryCondition, @Param("userIdList") List<Integer> userIdList);
/**
* 根据条件查询所有记录个数
@ -45,7 +45,7 @@ public interface XhpcCustomersPersonnelMapper {
* @date 2022/2/8 14:43
* @since version-1.0
*/
Long selectCount(SearchCardUserQueryCondition queryCondition);
Long selectCount(@Param("queryCondition") SearchCardUserQueryCondition queryCondition, @Param("userIdList") List<Integer> userIdList);
/**
* 根据运营商id分页条件查询对应的记录
@ -55,7 +55,7 @@ public interface XhpcCustomersPersonnelMapper {
* @param items 当前要显示的条数
* @return 对应的记录
*/
List<XhpcCustomersPersonnel> selectByOperatorId(@Param("operatorId") Long operatorId, @Param("currentPage") Long currentPage, @Param("items") Long items);
List<XhpcCustomersPersonnel> selectByOperatorId(@Param("operatorId") Long operatorId, @Param("currentPage") Long currentPage, @Param("items") Long items, @Param("userIdList") List<Integer> userIdList);
/**
* 根据运营商id查询符合条件的总条数
@ -63,7 +63,7 @@ public interface XhpcCustomersPersonnelMapper {
* @param operatorId
* @return
*/
Long selectCountByOperatorId(Long operatorId);
Long selectCountByOperatorId(@Param("operatorId") Long operatorId, @Param("userIdList") List<Integer> userIdList);
/**
* query record by user account

View File

@ -193,6 +193,10 @@ public class XhpcCardServiceImpl implements IXhpcCardService {
if (dataDTO.getClassification() == 0) {
//离线用户类型为10
dataDTO.setUserType(10L);
int userIndex = (int) data.get("userIndex");
TIccardUsers tIccardUser = tIccardUsersMapper.selectByPrimaryKey(userIndex);
String phone = tIccardUser.getPhone();
dataDTO.setUserAccount(phone);
} else {
dataDTO.setUserType((Long) data.get("user_type"));
}
@ -247,8 +251,9 @@ public class XhpcCardServiceImpl implements IXhpcCardService {
//(0 C端用户 2社区用户 3 B端用户)
switch (queryCondition.getUserType()) {
case 0:
List<XhpcAppUser> appUserList = xhpcAppUserMapper.selectByCondition(queryCondition);
Long allCount = xhpcAppUserMapper.selectCount(queryCondition);
List<Integer> userIdList = xhpcCardMapper.selectUserIdsByUserType(queryCondition.getUserType());
List<XhpcAppUser> appUserList = xhpcAppUserMapper.selectByCondition(queryCondition, userIdList);
Long allCount = xhpcAppUserMapper.selectCount(queryCondition, userIdList);
searchCardResponse.setTotalItems(allCount);
for (XhpcAppUser xhpcAppUser : appUserList) {
SearchCardResponse.DataDTO dataDTO = new SearchCardResponse.DataDTO();
@ -256,10 +261,11 @@ public class XhpcCardServiceImpl implements IXhpcCardService {
dataDTO.setUserType(0);
searchCardResponse.getData().add(dataDTO);
}
break;
return R.ok(searchCardResponse);
case 2:
List<XhpcCommunityPersonnel> xhpcCommunityPersonnelList = xhpcCommunityPersonnelMapper.selectByCondition(queryCondition);
Long allCount1 = xhpcCommunityPersonnelMapper.selectCount(queryCondition);
List<Integer> userIdList1 = xhpcCardMapper.selectUserIdsByUserType(queryCondition.getUserType());
List<XhpcCommunityPersonnel> xhpcCommunityPersonnelList = xhpcCommunityPersonnelMapper.selectByCondition(queryCondition, userIdList1);
Long allCount1 = xhpcCommunityPersonnelMapper.selectCount(queryCondition, userIdList1);
searchCardResponse.setTotalItems(allCount1);
for (XhpcCommunityPersonnel xhpcCommunityPersonnel : xhpcCommunityPersonnelList) {
SearchCardResponse.DataDTO dataDTO = new SearchCardResponse.DataDTO();
@ -267,10 +273,11 @@ public class XhpcCardServiceImpl implements IXhpcCardService {
dataDTO.setUserType(2);
searchCardResponse.getData().add(dataDTO);
}
break;
return R.ok(searchCardResponse);
case 3:
List<XhpcCustomersPersonnel> xhpcCustomersPersonnelList = xhpcCustomersPersonnelMapper.selectByCondition(queryCondition);
Long allCount2 = xhpcCustomersPersonnelMapper.selectCount(queryCondition);
List<Integer> userIdList2 = xhpcCardMapper.selectUserIdsByUserType(queryCondition.getUserType());
List<XhpcCustomersPersonnel> xhpcCustomersPersonnelList = xhpcCustomersPersonnelMapper.selectByCondition(queryCondition, userIdList2);
Long allCount2 = xhpcCustomersPersonnelMapper.selectCount(queryCondition, userIdList2);
searchCardResponse.setTotalItems(allCount2);
for (XhpcCustomersPersonnel xhpcCustomersPersonnel : xhpcCustomersPersonnelList) {
SearchCardResponse.DataDTO dataDTO = new SearchCardResponse.DataDTO();
@ -278,7 +285,7 @@ public class XhpcCardServiceImpl implements IXhpcCardService {
dataDTO.setUserType(3);
searchCardResponse.getData().add(dataDTO);
}
break;
return R.ok(searchCardResponse);
default:
return R.fail("没有此用户类型");
}
@ -291,8 +298,9 @@ public class XhpcCardServiceImpl implements IXhpcCardService {
//2社区用户 3 B端用户)
switch (queryCondition.getUserType()) {
case 2:
List<XhpcCommunityPersonnel> xhpcCommunityPersonnelList = xhpcCommunityPersonnelMapper.selectByOperatorId(operatorId, queryCondition.getCurrentPage(), queryCondition.getItems());
Long allCount1 = xhpcCommunityPersonnelMapper.selectCountByOperatorId(operatorId);
List<Integer> userIdList = xhpcCardMapper.selectUserIdsByUserType(queryCondition.getUserType());
List<XhpcCommunityPersonnel> xhpcCommunityPersonnelList = xhpcCommunityPersonnelMapper.selectByOperatorId(operatorId, queryCondition.getCurrentPage(), queryCondition.getItems(), userIdList);
Long allCount1 = xhpcCommunityPersonnelMapper.selectCountByOperatorId(operatorId, userIdList);
searchCardResponse.setTotalItems(allCount1);
for (XhpcCommunityPersonnel xhpcCommunityPersonnel : xhpcCommunityPersonnelList) {
SearchCardResponse.DataDTO dataDTO = new SearchCardResponse.DataDTO();
@ -300,10 +308,11 @@ public class XhpcCardServiceImpl implements IXhpcCardService {
dataDTO.setUserType(2);
searchCardResponse.getData().add(dataDTO);
}
break;
return R.ok(searchCardResponse);
case 3:
List<XhpcCustomersPersonnel> xhpcCustomersPersonnelList = xhpcCustomersPersonnelMapper.selectByOperatorId(operatorId, queryCondition.getCurrentPage(), queryCondition.getItems());
Long allCount2 = xhpcCustomersPersonnelMapper.selectCountByOperatorId(operatorId);
List<Integer> userIdList2 = xhpcCardMapper.selectUserIdsByUserType(queryCondition.getUserType());
List<XhpcCustomersPersonnel> xhpcCustomersPersonnelList = xhpcCustomersPersonnelMapper.selectByOperatorId(operatorId, queryCondition.getCurrentPage(), queryCondition.getItems(), userIdList2);
Long allCount2 = xhpcCustomersPersonnelMapper.selectCountByOperatorId(operatorId, userIdList2);
searchCardResponse.setTotalItems(allCount2);
for (XhpcCustomersPersonnel xhpcCustomersPersonnel : xhpcCustomersPersonnelList) {
SearchCardResponse.DataDTO dataDTO = new SearchCardResponse.DataDTO();
@ -311,7 +320,7 @@ public class XhpcCardServiceImpl implements IXhpcCardService {
dataDTO.setUserType(3);
searchCardResponse.getData().add(dataDTO);
}
break;
return R.ok(searchCardResponse);
default:
return R.fail("没有此用户类型");
}
@ -328,14 +337,40 @@ public class XhpcCardServiceImpl implements IXhpcCardService {
}
//build an association
XhpcIcCardInfo xhpcIcCardInfo = new XhpcIcCardInfo();
SysUser sysUser = tokenService.getLoginUser().getSysUser();
String tenantId = sysUser.getTenantId();
xhpcIcCardInfo.setTenantId(tenantId);
//获取指定用户类型的id
switch (bindCardInfo.getUserType()) {
case 0:
XhpcAppUser xhpcAppUser = xhpcAppUserMapper.selectByPhone(bindCardInfo.getUserAccount());
Long appUserId = xhpcAppUser.getAppUserId();
xhpcIcCardInfo.setUserId(appUserId);
break;
case 2:
XhpcCommunityPersonnel xhpcCommunityPersonnel = xhpcCommunityPersonnelMapper.selectByAccount(bindCardInfo.getUserAccount());
Long communityPersonnelId = xhpcCommunityPersonnel.getCommunityPersonnelId();
xhpcIcCardInfo.setUserId(communityPersonnelId);
break;
case 3:
XhpcCustomersPersonnel xhpcCustomersPersonnel = xhpcCustomersPersonnelMapper.selectByAccount(bindCardInfo.getUserAccount());
Long customersId = xhpcCustomersPersonnel.getCustomersId();
xhpcCustomersPersonnel.setCustomersId(customersId);
break;
default:
return R.fail("没有此用户类型");
}
xhpcIcCardInfo.setTIccardInfoId(String.valueOf(bindCardInfo.getCardRecordId()));
xhpcIcCardInfo.setUseStatus(1L);
xhpcIcCardInfo.setCreateTime(new Date());
TIccardInfo tIccardInfo = tIccardInfoMapper.selectByPrimaryKey(bindCardInfo.getCardRecordId());
xhpcIcCardInfo.setUserId(Long.valueOf(tIccardInfo.getUserindex()));
xhpcIcCardInfo.setUserAccount(bindCardInfo.getUserAccount());
xhpcIcCardInfo.setUserType(bindCardInfo.getUserType());
TIccardInfo tIccardInfo = new TIccardInfo();
tIccardInfo.setId(bindCardInfo.getCardRecordId());
tIccardInfo.setStatus(1);
tIccardInfoMapper.updateByPrimaryKeySelective(tIccardInfo);
xhpcCardMapper.insertSelective(xhpcIcCardInfo);
//todo 增加绑定日志
return R.ok();
}
@ -615,6 +650,7 @@ public class XhpcCardServiceImpl implements IXhpcCardService {
//1.find card record according card id
//2.完成联网卡表的状态改变
//3.完成朱老师那边的卡表状态改变
//4.释放关联用户
//4.写日志到log表中
XhpcIcCardInfo xhpcIcCardInfo = xhpcCardMapper.selectBytCardId(String.valueOf(cardRecordId));
if (xhpcIcCardInfo.getDelFlag() == 1) {

View File

@ -94,6 +94,7 @@
</if>
</if>
</where>
order by t_card.id desc
limit #{currentPage},#{items}
</select>
<select id="selectTotalCountBy" resultType="java.lang.Long">

View File

@ -41,8 +41,14 @@
select count(app_user_id)
from xhpc_app_user
<where>
<if test="userAccount!=null and userAccount!='' ">
and phone = #{userAccount}
<if test="queryCondition.userAccount!=null and queryCondition.userAccount!='' ">
and phone like concat('%',#{queryCondition.userAccount},'%')
</if>
<if test="userIdList!=null and userIdList.size()!=0">
and app_user_id not in
<foreach collection="userIdList" item="userId" open="(" close=")" separator=",">
#{userId}
</foreach>
</if>
</where>
</select>
@ -51,11 +57,17 @@
<include refid="Base_Column_List"/>
from xhpc_app_user
<where>
<if test="userAccount!=null and userAccount!='' ">
and phone = #{userAccount}
<if test="queryCondition.userAccount!=null and queryCondition.userAccount!='' ">
and phone like concat('%',#{queryCondition.userAccount},'%')
</if>
<if test="userIdList!=null and userIdList.size()!=0">
and app_user_id not in
<foreach collection="userIdList" item="userId" open="(" close=")" separator=",">
#{userId}
</foreach>
</if>
</where>
limit #{currentPage},#{items}
limit #{queryCondition.currentPage},#{queryCondition.items}
</select>
<select id="selectByPhone" resultMap="BaseResultMap">
select

View File

@ -233,4 +233,10 @@
WHERE o.user_account = #{userAccount}
AND o.user_type = #{userType}
</select>
<select id="selectUserIdsByUserType" resultType="java.lang.Integer">
SELECT user_id
FROM xhpc_ic_card_info
WHERE user_type = #{userType}
and del_flag = 0
</select>
</mapper>

View File

@ -54,18 +54,30 @@
<include refid="Base_Column_List"/>
from xhpc_community_personnel
<where>
<if test="userAccount!=null and userAccount!='' ">
and account = #{userAccount}
<if test="queryCondition.userAccount!=null and queryCondition.userAccount!='' ">
and account like concat('%',#{queryCondition.userAccount},'%')
</if>
<if test="userIdList!=null and userIdList.size()!=0">
and communitiy_personnel_id not in
<foreach collection="userIdList" item="userId" open="(" close=")" separator=",">
#{userId}
</foreach>
</if>
</where>
limit #{currentPage},#{items}
limit #{queryCondition.currentPage},#{queryCondition.items}
</select>
<select id="selectCount" resultType="java.lang.Long">
select count(community_personnel_id)
from xhpc_community_personnel
<where>
<if test="userAccount!=null and userAccount!='' ">
and account = #{userAccount}
<if test="queryCondition.userAccount!=null and queryCondition.userAccount!='' ">
and account like concat('%',#{queryCondition.userAccount},'%')
</if>
<if test="userIdList!=null and userIdList.size()!=0">
and communitiy_personnel_id not in
<foreach collection="userIdList" item="userId" open="(" close=")" separator=",">
#{userId}
</foreach>
</if>
</where>
</select>
@ -73,7 +85,14 @@
select
<include refid="Base_Column_List"/>
from xhpc_community_personnel
where create_type = 2 and create_id = #{operatorId}
where create_type = 2
and create_id = #{operatorId}
<if test="userIdList!=null and userIdList.size()!=0">
and community_personnel_id not in
<foreach collection="userIdList" item="userId" open="(" close=")" separator=",">
#{userId}
</foreach>
</if>
limit #{currentPage},#{items}
</select>
<select id="selectCountByOperatorId" resultType="java.lang.Long">
@ -81,6 +100,12 @@
from xhpc_community_personnel
where create_type = 2
and create_id = #{operatorId}
<if test="userIdList!=null and userIdList.size()!=0">
and community_personnel_id not in
<foreach collection="userIdList" item="userId" open="(" close=")" separator=",">
#{userId}
</foreach>
</if>
</select>
<select id="selectByAccount" resultMap="BaseResultMap">
select

View File

@ -54,18 +54,30 @@
<include refid="Base_Column_List"/>
from xhpc_customers_personnel
<where>
<if test="userAccount!=null and userAccount!='' ">
and account = #{userAccount}
<if test="queryCondition.userAccount!=null and queryCondition.userAccount!='' ">
and account like concat('%',#{queryCondition.userAccount},'%')
</if>
<if test="userIdList!=null and userIdList.size()!=0">
and customers_personnel_id not in
<foreach collection="userIdList" item="userId" open="(" close=")" separator=",">
#{userId}
</foreach>
</if>
</where>
limit #{currentPage},#{items}
limit #{queryCondition.currentPage},#{queryCondition.items}
</select>
<select id="selectCount" resultType="java.lang.Long">
select count(customers_personnel_id)
from xhpc_customers_personnel
<where>
<if test="userAccount!=null and userAccount!='' ">
and account = #{userAccount}
<if test="queryCondition.userAccount!=null and queryCondition.userAccount!='' ">
and account like concat('%',#{queryCondition.userAccount},'%')
</if>
<if test="userIdList!=null and userIdList.size()!=0">
and customers_personnel_id not in
<foreach collection="userIdList" item="userId" open="(" close=")" separator=",">
#{userId}
</foreach>
</if>
</where>
</select>
@ -74,6 +86,12 @@
<include refid="Base_Column_List"/>
from xhpc_customers_personnel
where create_type = 2 and create_id = #{operatorId}
<if test="userIdList!=null and userIdList.size()!=0">
and customers_personnel_id not in
<foreach collection="userIdList" item="userId" open="(" close=")" separator=",">
#{userId}
</foreach>
</if>
limit #{currentPage},#{items}
</select>
<select id="selectCountByOperatorId" resultType="java.lang.Long">
@ -81,6 +99,12 @@
from xhpc_customers_personnel
where create_type = 2
and create_id = #{operatorId}
<if test="userIdList!=null and userIdList.size()!=0">
and customers_personnel_id not in
<foreach collection="userIdList" item="userId" open="(" close=")" separator=",">
#{userId}
</foreach>
</if>
</select>
<select id="selectByAccount" resultMap="BaseResultMap">
select

View File

@ -1,4 +1,4 @@
package com.xhpc.tradebill;
package com.xhpc;
import com.xhpc.common.security.annotation.EnableCustomConfig;
import com.xhpc.common.security.annotation.EnableRyFeignClients;