diff --git a/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/controller/XhpcCardController.java b/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/controller/XhpcCardController.java index f42e97af..62124bf8 100644 --- a/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/controller/XhpcCardController.java +++ b/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/controller/XhpcCardController.java @@ -120,15 +120,12 @@ public class XhpcCardController extends BaseController { } /** - * 查看完整用户信息接口 - * - * @param userAccount 用户账号 - * @param userType 用户类型( 0 C端用户 1 流量方用户 2社区用户 3B端用户,10离线用户) + * 查看卡用户信息接口 */ @GetMapping("/user") - public R queryWholeUserInfo(@RequestParam String userAccount, @RequestParam Integer userType) { + public R queryWholeUserInfo(@RequestParam Long cardRecordId) { - return xhpcCardService.queryWholeUserInfo(userAccount, userType); + return xhpcCardService.queryWholeUserInfo(cardRecordId); } /** diff --git a/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/service/IXhpcCardService.java b/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/service/IXhpcCardService.java index f69bda64..92339e0f 100644 --- a/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/service/IXhpcCardService.java +++ b/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/service/IXhpcCardService.java @@ -90,16 +90,14 @@ public interface IXhpcCardService { R onlineCardBind(BindCardInfo bindCardInfo); /** - * 查询绑卡用户信息 + * 查询卡用户信息 * - * @param userAccount 用户信息 - * @param userType 用户类型 * @return 卡用户的完整信息 * @author WH * @date 2022/2/9 17:50 * @since version-1.0 */ - R queryWholeUserInfo(String userAccount, Integer userType); + R queryWholeUserInfo(Long cardRecordId); /** * Platform query that it own all grantOperators diff --git a/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/service/impl/XhpcCardServiceImpl.java b/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/service/impl/XhpcCardServiceImpl.java index 1dcd7ee6..37b62760 100644 --- a/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/service/impl/XhpcCardServiceImpl.java +++ b/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/service/impl/XhpcCardServiceImpl.java @@ -8,6 +8,7 @@ import com.xhpc.card.service.IXhpcCardService; import com.xhpc.card.utils.MyDateUtil; import com.xhpc.card.utils.MyPagingUtil; import com.xhpc.common.api.CardHistoryOrderService; +import com.xhpc.common.constant.ConstantClass; import com.xhpc.common.core.constant.Constants; import com.xhpc.common.core.domain.R; import com.xhpc.common.domain.IccardInfo; @@ -156,7 +157,7 @@ public class XhpcCardServiceImpl implements IXhpcCardService { tIccardLog.setUniqueid(tIccardDevice1.getSerialnumber()); tIccardLog.setType((byte) 1); tIccardLog.setOperate((byte) 10); - tIccardLog.setOperatorid(Math.toIntExact(operatorId)); + tIccardLog.setOperatorid(Math.toIntExact(tokenService.getLoginUser().getSysUser().getUserId())); String log = JSONUtil.toJsonStr(deviceLogInfo); tIccardLog.setLog(log); tIccardLogMapper.insertSelective(tIccardLog); @@ -403,11 +404,11 @@ public class XhpcCardServiceImpl implements IXhpcCardService { tIccardLog.setUniqueid(tIccardInfo.getCardno()); tIccardLog.setType((byte) 0); tIccardLog.setOperate((byte) 11); - tIccardLog.setOperatorid(Math.toIntExact(sysUser.getOperatorId())); + tIccardLog.setOperatorid(Math.toIntExact(sysUser.getUserId())); tIccardLog.setCreatetime(new Date()); CardLogInfo cardLogInfo = new CardLogInfo(); cardLogInfo.setOperate(11); - cardLogInfo.setOperatorId(sysUser.getOperatorId()); + cardLogInfo.setOperatorId(sysUser.getUserId()); CardLogInfo.CardInfoDTO cardInfoDTO = new CardLogInfo.CardInfoDTO(); cardInfoDTO.setCardID(tIccardInfo.getCardid()); cardInfoDTO.setCardNo(tIccardInfo.getCardno()); @@ -427,34 +428,47 @@ public class XhpcCardServiceImpl implements IXhpcCardService { } @Override - public R queryWholeUserInfo(String userAccount, Integer userType) { + public R queryWholeUserInfo(Long cardRecordId) { CardUserInfo cardUserInfo = new CardUserInfo(); - //离线用户 - if (userType == 10) { - cardUserInfo.setUserType(userType); - Map userData = tIccardInfoMapper.selectByPhone(userAccount); - if (userData == null) { - return R.fail("没有此类型用户"); - } - cardUserInfo.setUserAge((Integer) userData.get("userAge")); - cardUserInfo.setUserName((String) userData.get("userName")); - cardUserInfo.setUserSex((Integer) userData.get("userSex")); - cardUserInfo.setIdCardNumber((String) userData.get("idNumber")); - cardUserInfo.setPhoneNumber((String) userData.get("phone")); - cardUserInfo.setLicencePlate((String) userData.get("licencePlate")); - fillUserInfo(cardUserInfo, userData); - cardUserInfo.setBalance((Integer) userData.get("balance")); + TIccardInfo tIccardInfo = tIccardInfoMapper.selectByPrimaryKey(Math.toIntExact(cardRecordId)); + Integer cardType = tIccardInfo.getCardtype(); + if (cardType.equals(ConstantClass.OFFLINE_CARD)) { + cardUserInfo.setUserType(10); + //公共部分 + cardUserInfo.setCardSerialNumber(tIccardInfo.getCardid()); + cardUserInfo.setCardPhysicalNumber(tIccardInfo.getCardno()); + cardUserInfo.setCardClassification(tIccardInfo.getIsPlatform()); + cardUserInfo.setCashPledge(tIccardInfo.getCashpledge()); + cardUserInfo.setBalance(tIccardInfo.getBalance()); + cardUserInfo.setCardType(tIccardInfo.getCardtype()); + XhpcOperator xhpcOperator = xhpcOperatorMapper.selectOneByCorpNoAndTenantId(tIccardInfo.getCorpno(), tokenService.getLoginUser().getSysUser().getTenantId()); + cardUserInfo.setGrantOperatorName(xhpcOperator.getName()); + //离线用户账号 + TIccardUsers tIccardUser = tIccardUsersMapper.selectByPrimaryKey(tIccardInfo.getUserindex()); + cardUserInfo.setUserAccount(tIccardUser.getPhone()); + cardUserInfo.setUserAge(Integer.valueOf(tIccardUser.getUserage())); + cardUserInfo.setUserName(tIccardUser.getUsername()); + cardUserInfo.setUserSex(Integer.valueOf(tIccardUser.getUsersex())); + cardUserInfo.setIdCardNumber(tIccardUser.getIdnumber()); + cardUserInfo.setPhoneNumber(tIccardUser.getPhone()); + cardUserInfo.setLicencePlate(tIccardUser.getLicenceplate()); return R.ok(cardUserInfo); } else { - //联网卡用户 - cardUserInfo.setUserType(userType); - Map userData = xhpcCardMapper.selectByAccount(userAccount, userType); - cardUserInfo.setUserAccount((String) userData.get("user_account")); - fillUserInfo(cardUserInfo, userData); + XhpcIcCardInfo xhpcIcCardInfo = xhpcCardMapper.getXhpcIcCardInfo(tIccardInfo.getCardid()); + cardUserInfo.setUserAccount(xhpcIcCardInfo.getUserAccount()); + cardUserInfo.setUserType(xhpcIcCardInfo.getUserType()); + //公共部分 + cardUserInfo.setCardSerialNumber(tIccardInfo.getCardid()); + cardUserInfo.setCardPhysicalNumber(tIccardInfo.getCardno()); + cardUserInfo.setCardClassification(tIccardInfo.getIsPlatform()); + cardUserInfo.setCashPledge(tIccardInfo.getCashpledge()); + cardUserInfo.setBalance(tIccardInfo.getBalance()); + cardUserInfo.setCardType(tIccardInfo.getCardtype()); + XhpcOperator xhpcOperator = xhpcOperatorMapper.selectOneByCorpNoAndTenantId(tIccardInfo.getCorpno(), tokenService.getLoginUser().getSysUser().getTenantId()); + cardUserInfo.setGrantOperatorName(xhpcOperator.getName()); return R.ok(cardUserInfo); } - } @Override @@ -500,7 +514,7 @@ public class XhpcCardServiceImpl implements IXhpcCardService { tIccardLog.setUniqueid(tIccardInfo.getCardno()); tIccardLog.setType((byte) 0); tIccardLog.setOperate((byte) 5); - tIccardLog.setOperatorid(Integer.valueOf(tIccardInfo.getCorpno())); + tIccardLog.setOperatorid(Math.toIntExact(tokenService.getLoginUser().getSysUser().getUserId())); tIccardLog.setCreatetime(new Date()); CardLogInfo cardLogInfo = new CardLogInfo(); /** @@ -718,10 +732,7 @@ public class XhpcCardServiceImpl implements IXhpcCardService { tIccardLog.setOperate((byte) 11); LoginUser loginUser = tokenService.getLoginUser(); SysUser sysUser = loginUser.getSysUser(); - Long operatorId = sysUser.getOperatorId(); - if (operatorId != null) { - tIccardLog.setOperatorid(Math.toIntExact(operatorId)); - } + tIccardLog.setOperatorid(Math.toIntExact(sysUser.getUserId())); tIccardLog.setCreatetime(new Date()); //log部分 CardLogInfo.CardInfoDTO cardInfoDTO = new CardLogInfo.CardInfoDTO(); @@ -738,9 +749,7 @@ public class XhpcCardServiceImpl implements IXhpcCardService { CardLogInfo cardLogInfo = new CardLogInfo(); cardLogInfo.setCardInfo(cardInfoDTO); cardLogInfo.setOperate(11); - if (operatorId != null) { - cardLogInfo.setOperatorId(operatorId); - } + cardLogInfo.setOperatorId(sysUser.getUserId()); String cardLogInfoStr = JSONUtil.toJsonStr(cardLogInfo); tIccardLog.setLog(cardLogInfoStr); tIccardLogMapper.updateByPrimaryKeySelective(tIccardLog); @@ -802,9 +811,7 @@ public class XhpcCardServiceImpl implements IXhpcCardService { tIccardLog.setOperate((byte) 6); String corpno = tIccardInfo.getCorpno(); String tenantId = tokenService.getLoginUser().getSysUser().getTenantId(); - XhpcOperator xhpcOperator = xhpcOperatorMapper.selectOneByCorpNoAndTenantId(corpno, tenantId); - Long operatorId = xhpcOperator.getOperatorId(); - tIccardLog.setOperatorid(Math.toIntExact(operatorId)); + tIccardLog.setOperatorid(Math.toIntExact(tokenService.getLoginUser().getSysUser().getUserId())); tIccardLog.setCreatetime(new Date()); CardLogInfo cardLogInfo = new CardLogInfo(); /** @@ -826,7 +833,7 @@ public class XhpcCardServiceImpl implements IXhpcCardService { * } */ cardLogInfo.setOperate(6); - cardLogInfo.setOperatorId(operatorId); + cardLogInfo.setOperatorId(tokenService.getLoginUser().getSysUser().getUserId()); CardLogInfo.CardInfoDTO cardInfoDTO = new CardLogInfo.CardInfoDTO(); cardInfoDTO.setCardID(tIccardInfo.getCardid()); cardInfoDTO.setCardNo(tIccardInfo.getCardno()); diff --git a/xhpc-modules/xhpc-card/src/main/resources/mapper/XhpcCardMapper.xml b/xhpc-modules/xhpc-card/src/main/resources/mapper/XhpcCardMapper.xml index 26c5a473..f2c05fd5 100644 --- a/xhpc-modules/xhpc-card/src/main/resources/mapper/XhpcCardMapper.xml +++ b/xhpc-modules/xhpc-card/src/main/resources/mapper/XhpcCardMapper.xml @@ -92,6 +92,9 @@ del_flag, + + tenant_id + @@ -133,6 +136,9 @@ #{delFlag,jdbcType=BIGINT}, + + #{tenantId,jdbcType=VARCHAR} + diff --git a/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/constant/ConstantClass.java b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/constant/ConstantClass.java index 8da714f8..c5f768c0 100644 --- a/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/constant/ConstantClass.java +++ b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/constant/ConstantClass.java @@ -31,4 +31,10 @@ public class ConstantClass { public static final Integer AREA = 1; public static final Integer POINT = 2; + /** + * 刷卡的卡类型 + */ + public static final Integer OFFLINE_CARD = 0; + public static final Integer ONLINE_CARD = 1; + }