完成查询授权卡列表部分
This commit is contained in:
parent
89674608c4
commit
9f7ec65f77
@ -1,5 +1,6 @@
|
|||||||
package com.xhpc.card.mapper;
|
package com.xhpc.card.mapper;
|
||||||
|
|
||||||
|
import com.xhpc.card.domain.QueryConditions;
|
||||||
import com.xhpc.card.pojo.TIccardInfo;
|
import com.xhpc.card.pojo.TIccardInfo;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -28,4 +29,15 @@ public interface TIccardInfoMapper {
|
|||||||
*/
|
*/
|
||||||
List<TIccardInfo> selectAll();
|
List<TIccardInfo> selectAll();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过查询条件查询所有卡记录信息
|
||||||
|
*
|
||||||
|
* @param queryConditions 查询条件
|
||||||
|
* @return 符合条件的所有卡记录信息集合
|
||||||
|
* @author WH
|
||||||
|
* @date 2022/1/27 11:21
|
||||||
|
* @since version-1.0
|
||||||
|
*/
|
||||||
|
List<TIccardInfo> selectAllBy(QueryConditions queryConditions);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -30,12 +30,12 @@ public class TIccardInfo implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 0表示平台,1表示运营商
|
* 0表示平台,1表示运营商
|
||||||
*/
|
*/
|
||||||
private Byte isPlatform;
|
private Integer isPlatform;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 卡类型。0.离线卡; 1.联网卡
|
* 卡类型。0.离线卡; 1.联网卡
|
||||||
*/
|
*/
|
||||||
private Byte cardtype;
|
private Integer cardtype;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 卡用户索引 (t_iccard_users 找用户的,没有表示没绑)
|
* 卡用户索引 (t_iccard_users 找用户的,没有表示没绑)
|
||||||
@ -65,7 +65,7 @@ public class TIccardInfo implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 0.初始化, 1.正常, 2.锁卡, 3.挂失, 4.作废
|
* 0.初始化, 1.正常, 2.锁卡, 3.挂失, 4.作废
|
||||||
*/
|
*/
|
||||||
private Byte status;
|
private Integer status;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加日期
|
* 添加日期
|
||||||
|
|||||||
@ -9,12 +9,12 @@ import com.xhpc.card.pojo.TIccardInfo;
|
|||||||
import com.xhpc.card.pojo.TIccardUsers;
|
import com.xhpc.card.pojo.TIccardUsers;
|
||||||
import com.xhpc.card.pojo.XhpcOperator;
|
import com.xhpc.card.pojo.XhpcOperator;
|
||||||
import com.xhpc.card.service.IXhpcCardService;
|
import com.xhpc.card.service.IXhpcCardService;
|
||||||
|
import com.xhpc.card.utils.MyPagingUtil;
|
||||||
import com.xhpc.common.api.CardHistoryOrderService;
|
import com.xhpc.common.api.CardHistoryOrderService;
|
||||||
import com.xhpc.common.core.constant.Constants;
|
import com.xhpc.common.core.constant.Constants;
|
||||||
import com.xhpc.common.core.domain.R;
|
import com.xhpc.common.core.domain.R;
|
||||||
import com.xhpc.common.domain.IccardInfo;
|
import com.xhpc.common.domain.IccardInfo;
|
||||||
import com.xhpc.common.domain.XhpcIcCardInfo;
|
import com.xhpc.common.domain.XhpcIcCardInfo;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
@ -28,10 +28,10 @@ import java.util.List;
|
|||||||
@Service
|
@Service
|
||||||
public class XhpcCardServiceImpl implements IXhpcCardService {
|
public class XhpcCardServiceImpl implements IXhpcCardService {
|
||||||
|
|
||||||
@Autowired
|
@Resource
|
||||||
private XhpcCardMapper xhpcCardMapper;
|
private XhpcCardMapper xhpcCardMapper;
|
||||||
|
|
||||||
@Autowired
|
@Resource
|
||||||
private CardHistoryOrderService cardHistoryOrderService;
|
private CardHistoryOrderService cardHistoryOrderService;
|
||||||
@Resource
|
@Resource
|
||||||
private TIccardDeviceMapper tIccardDeviceMapper;
|
private TIccardDeviceMapper tIccardDeviceMapper;
|
||||||
@ -130,16 +130,20 @@ public class XhpcCardServiceImpl implements IXhpcCardService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public R<CardList> queryCardListBy(QueryConditions queryConditions) {
|
public R<CardList> queryCardListBy(QueryConditions queryConditions) {
|
||||||
|
//计算分页索引
|
||||||
|
long startIndex = MyPagingUtil.calculateStartIndex(queryConditions.getCurrentPage(), queryConditions.getItems());
|
||||||
|
queryConditions.setCurrentPage(startIndex);
|
||||||
CardList cardList = new CardList();
|
CardList cardList = new CardList();
|
||||||
cardList.setTotalItems(0);
|
cardList.setTotalItems(0);
|
||||||
cardList.setData(new ArrayList<>());
|
cardList.setData(new ArrayList<>());
|
||||||
|
List<TIccardInfo> tIccardInfoList2 = tIccardInfoMapper.selectAllBy(queryConditions);
|
||||||
List<TIccardInfo> tIccardInfoList = tIccardInfoMapper.selectAll();
|
List<TIccardInfo> tIccardInfoList = tIccardInfoMapper.selectAll();
|
||||||
if (tIccardInfoList.isEmpty()) {
|
if (tIccardInfoList.isEmpty()) {
|
||||||
return R.ok(cardList);
|
return R.ok(cardList);
|
||||||
}
|
}
|
||||||
|
//1.遍历卡记录
|
||||||
for (TIccardInfo tIccardInfo : tIccardInfoList) {
|
for (TIccardInfo tIccardInfo : tIccardInfoList) {
|
||||||
//封装通用数据
|
//2.封装通用数据
|
||||||
CardList.DataDTO dataDTO = new CardList.DataDTO();
|
CardList.DataDTO dataDTO = new CardList.DataDTO();
|
||||||
dataDTO.setCardSerialNumber(tIccardInfo.getCardid());
|
dataDTO.setCardSerialNumber(tIccardInfo.getCardid());
|
||||||
dataDTO.setCardPhysicalNumber(tIccardInfo.getCardno());
|
dataDTO.setCardPhysicalNumber(tIccardInfo.getCardno());
|
||||||
@ -147,25 +151,25 @@ public class XhpcCardServiceImpl implements IXhpcCardService {
|
|||||||
String corpno = tIccardInfo.getCorpno();
|
String corpno = tIccardInfo.getCorpno();
|
||||||
XhpcOperator xhpcOperator = xhpcOperatorMapper.selectByPrimaryKey(Long.valueOf(corpno));
|
XhpcOperator xhpcOperator = xhpcOperatorMapper.selectByPrimaryKey(Long.valueOf(corpno));
|
||||||
dataDTO.setGrantOperator(xhpcOperator.getName());
|
dataDTO.setGrantOperator(xhpcOperator.getName());
|
||||||
dataDTO.setClassification(Integer.valueOf(tIccardInfo.getCardtype()));
|
dataDTO.setClassification(tIccardInfo.getCardtype());
|
||||||
//判断是否是离线卡,离线卡处理逻辑
|
//3.判断是否是离线卡,离线卡处理逻辑
|
||||||
if (dataDTO.getClassification() == 0) {
|
if (dataDTO.getClassification() == 0) {
|
||||||
dataDTO.setCardType(1);
|
dataDTO.setCardType(1);
|
||||||
//获取卡用户索引,为null表示没有该卡没有绑用户
|
//获取卡用户索引,为null表示没有该卡没有绑用户
|
||||||
Integer userIndex = tIccardInfo.getUserindex();
|
Integer userIndex = tIccardInfo.getUserindex();
|
||||||
if (userIndex == null) {
|
if (userIndex == null) {
|
||||||
dataDTO.setCardStatus(1);
|
dataDTO.setCardStatus(1);
|
||||||
continue;
|
|
||||||
} else {
|
} else {
|
||||||
dataDTO.setCardStatus(0);
|
dataDTO.setCardStatus(0);
|
||||||
dataDTO.setUserType(10);
|
dataDTO.setUserType(10);
|
||||||
TIccardUsers tIccardUsers = tIccardUsersMapper.selectByPrimaryKey(userIndex);
|
TIccardUsers tIccardUsers = tIccardUsersMapper.selectByPrimaryKey(userIndex);
|
||||||
dataDTO.setUserAccount(tIccardUsers.getPhone());
|
dataDTO.setUserAccount(tIccardUsers.getPhone());
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//联网卡处理逻辑
|
//联网卡处理逻辑
|
||||||
|
dataDTO.setCardStatus(0);
|
||||||
|
Integer isPlatform = tIccardInfo.getIsPlatform();
|
||||||
|
dataDTO.setCardType(isPlatform);
|
||||||
}
|
}
|
||||||
cardList.getData().add(dataDTO);
|
cardList.getData().add(dataDTO);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,76 @@
|
|||||||
|
package com.xhpc.card.utils;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateTime;
|
||||||
|
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 进行日期处理的工具类
|
||||||
|
*
|
||||||
|
* @author WH
|
||||||
|
* @date 2022/1/15 15:59
|
||||||
|
* @since version-1.0
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("all")
|
||||||
|
public class MyDateUtil {
|
||||||
|
|
||||||
|
public static final String DATE_FORMAT_DATE_TIME = "yyyy-MM-dd HH:mm:ss";
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
System.out.println(getCurrentDateStr());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 以xxxx年x月xx日 星期x的字符串格式展示当前时间
|
||||||
|
*
|
||||||
|
* @author WH
|
||||||
|
* @date 2022/1/15 16:15
|
||||||
|
* @since version-1.0
|
||||||
|
*/
|
||||||
|
public static String getCurrentDateStr() {
|
||||||
|
|
||||||
|
Calendar now = Calendar.getInstance();
|
||||||
|
int year = now.get(Calendar.YEAR);
|
||||||
|
int month = now.get(Calendar.MONTH) + 1;
|
||||||
|
int day = now.get(Calendar.DAY_OF_MONTH);
|
||||||
|
String dayNames[] = {"星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"};
|
||||||
|
int dayOfWeek = now.get(Calendar.DAY_OF_WEEK) - 1;
|
||||||
|
if (dayOfWeek < 0) dayOfWeek = 0;
|
||||||
|
String week = dayNames[dayOfWeek];
|
||||||
|
String nowDateStr = year + "年" + month + "月" + day + "日 " + week;
|
||||||
|
|
||||||
|
return nowDateStr;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取表示所传入的Date对象的Calendar对象
|
||||||
|
*
|
||||||
|
* @param date 要转换的Date对象
|
||||||
|
* @return 表示所传入的Date对象的Calendar对象
|
||||||
|
* @author WH
|
||||||
|
* @date 2022/1/15 16:11
|
||||||
|
* @since version-1.0
|
||||||
|
*/
|
||||||
|
public static Calendar getCalendar(Date date) {
|
||||||
|
|
||||||
|
Calendar c = Calendar.getInstance();
|
||||||
|
c.setTime(date);
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取一个yyyy-MM-dd HH:mm:ss格式的当前时间字符串
|
||||||
|
*
|
||||||
|
* @author WH
|
||||||
|
* @date 2022/1/15 16:04
|
||||||
|
* @since version-1.0
|
||||||
|
*/
|
||||||
|
public static String getCurrentDateStrInYyyyMmDdHhMmSsFormat() {
|
||||||
|
|
||||||
|
return DateTime.now().toString(DATE_FORMAT_DATE_TIME);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,46 @@
|
|||||||
|
package com.xhpc.card.utils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用于进行分页的工具类
|
||||||
|
*
|
||||||
|
* @author WH
|
||||||
|
* @date 2022/1/15 15:25
|
||||||
|
* @since version-1.0
|
||||||
|
*/
|
||||||
|
public class MyPagingUtil {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用于计算MySQL数据库中的limit子句的startIndex值
|
||||||
|
*
|
||||||
|
* @param currentPage 当前要显示的记录的页数
|
||||||
|
* @param items 当前页要显示多少条记录
|
||||||
|
* @return 返回MySQL数据库中的limit子句的startIndex值
|
||||||
|
* @throws IllegalArgumentException 传入的参数不符合要求,发生此异常
|
||||||
|
* @author WH
|
||||||
|
* @date 2022/1/15 15:27
|
||||||
|
* @since version-1.0
|
||||||
|
*/
|
||||||
|
public static long calculateStartIndex(long currentPage, long items) throws IllegalArgumentException {
|
||||||
|
|
||||||
|
if ((currentPage - 1) < 0) {
|
||||||
|
throw new IllegalArgumentException("当前页数最小为1");
|
||||||
|
}
|
||||||
|
if (items < 1) {
|
||||||
|
throw new IllegalArgumentException("当前页要显示的记录数最小为1");
|
||||||
|
}
|
||||||
|
return (currentPage - 1) * items;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重写构造方法,遵循工具类不能被实例化的规则
|
||||||
|
*
|
||||||
|
* @author WH
|
||||||
|
* @date 2022/1/27 11:52
|
||||||
|
* @since version-1.0
|
||||||
|
*/
|
||||||
|
private MyPagingUtil() {
|
||||||
|
|
||||||
|
throw new IllegalArgumentException("Utility class don't need to be instantiated");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -27,11 +27,34 @@
|
|||||||
from t_iccard_info
|
from t_iccard_info
|
||||||
where id = #{id,jdbcType=INTEGER}
|
where id = #{id,jdbcType=INTEGER}
|
||||||
</select>
|
</select>
|
||||||
<select id="selectAll" resultType="com.xhpc.card.pojo.TIccardInfo">
|
<select id="selectAll" resultMap="BaseResultMap">
|
||||||
select
|
select
|
||||||
<include refid="Base_Column_List"/>
|
<include refid="Base_Column_List"/>
|
||||||
from t_iccard_info
|
from t_iccard_info
|
||||||
</select>
|
</select>
|
||||||
|
<select id="selectAllBy" resultMap="BaseResultMap">
|
||||||
|
select
|
||||||
|
<include refid="Base_Column_List"/>
|
||||||
|
from t_iccard_info
|
||||||
|
<where>
|
||||||
|
<if test="cardSerialNumber != null and cardSerialNumber != '' ">
|
||||||
|
and cardId = #{cardSerialNumber},
|
||||||
|
</if>
|
||||||
|
<if test="cardPhysicalNumber != null cardPhysicalNumber !='' ">
|
||||||
|
and cardNo = #{cardPhysicalNumber},
|
||||||
|
</if>
|
||||||
|
<if test="grantOperator != null">
|
||||||
|
and cardID = #{grantOperator},
|
||||||
|
</if>
|
||||||
|
<if test="cardSerialNumber != null">
|
||||||
|
and cardID = #{cardSerialNumber},
|
||||||
|
</if>
|
||||||
|
<if test="userindex != null">
|
||||||
|
userIndex,
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
limit #{currentPage},#{items}
|
||||||
|
</select>
|
||||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
||||||
delete
|
delete
|
||||||
from t_iccard_info
|
from t_iccard_info
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user