修改卡日志operatorId来源为当前登录用户的userId

修复卡绑定接口
修复卡查看接口
This commit is contained in:
wenhui 2022-03-10 16:30:28 +08:00
parent e9d31f3010
commit d1cfc4d8da
5 changed files with 61 additions and 47 deletions

View File

@ -120,15 +120,12 @@ public class XhpcCardController extends BaseController {
}
/**
* 查看完整用户信息接口
*
* @param userAccount 用户账号
* @param userType 用户类型 0 C端用户 1 流量方用户 2社区用户 3B端用户10离线用户
* 查看卡用户信息接口
*/
@GetMapping("/user")
public R<CardUserInfo> queryWholeUserInfo(@RequestParam String userAccount, @RequestParam Integer userType) {
public R<CardUserInfo> queryWholeUserInfo(@RequestParam Long cardRecordId) {
return xhpcCardService.queryWholeUserInfo(userAccount, userType);
return xhpcCardService.queryWholeUserInfo(cardRecordId);
}
/**

View File

@ -90,16 +90,14 @@ public interface IXhpcCardService {
R<Object> onlineCardBind(BindCardInfo bindCardInfo);
/**
* 查询卡用户信息
* 查询卡用户信息
*
* @param userAccount 用户信息
* @param userType 用户类型
* @return 卡用户的完整信息
* @author WH
* @date 2022/2/9 17:50
* @since version-1.0
*/
R<CardUserInfo> queryWholeUserInfo(String userAccount, Integer userType);
R<CardUserInfo> queryWholeUserInfo(Long cardRecordId);
/**
* Platform query that it own all grantOperators

View File

@ -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<CardUserInfo> queryWholeUserInfo(String userAccount, Integer userType) {
public R<CardUserInfo> queryWholeUserInfo(Long cardRecordId) {
CardUserInfo cardUserInfo = new CardUserInfo();
//离线用户
if (userType == 10) {
cardUserInfo.setUserType(userType);
Map<String, Object> 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<String, Object> 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());

View File

@ -92,6 +92,9 @@
<if test="delFlag != null">
del_flag,
</if>
<if test="tenantId != null">
tenant_id
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="tIccardInfoId != null">
@ -133,6 +136,9 @@
<if test="delFlag != null">
#{delFlag,jdbcType=BIGINT},
</if>
<if test="tenantId != null">
#{tenantId,jdbcType=VARCHAR}
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.xhpc.card.pojo.XhpcIcCardInfo">

View File

@ -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;
}