修改卡日志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") @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); R<Object> onlineCardBind(BindCardInfo bindCardInfo);
/** /**
* 查询卡用户信息 * 查询卡用户信息
* *
* @param userAccount 用户信息
* @param userType 用户类型
* @return 卡用户的完整信息 * @return 卡用户的完整信息
* @author WH * @author WH
* @date 2022/2/9 17:50 * @date 2022/2/9 17:50
* @since version-1.0 * @since version-1.0
*/ */
R<CardUserInfo> queryWholeUserInfo(String userAccount, Integer userType); R<CardUserInfo> queryWholeUserInfo(Long cardRecordId);
/** /**
* Platform query that it own all grantOperators * 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.MyDateUtil;
import com.xhpc.card.utils.MyPagingUtil; import com.xhpc.card.utils.MyPagingUtil;
import com.xhpc.common.api.CardHistoryOrderService; import com.xhpc.common.api.CardHistoryOrderService;
import com.xhpc.common.constant.ConstantClass;
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;
@ -156,7 +157,7 @@ public class XhpcCardServiceImpl implements IXhpcCardService {
tIccardLog.setUniqueid(tIccardDevice1.getSerialnumber()); tIccardLog.setUniqueid(tIccardDevice1.getSerialnumber());
tIccardLog.setType((byte) 1); tIccardLog.setType((byte) 1);
tIccardLog.setOperate((byte) 10); tIccardLog.setOperate((byte) 10);
tIccardLog.setOperatorid(Math.toIntExact(operatorId)); tIccardLog.setOperatorid(Math.toIntExact(tokenService.getLoginUser().getSysUser().getUserId()));
String log = JSONUtil.toJsonStr(deviceLogInfo); String log = JSONUtil.toJsonStr(deviceLogInfo);
tIccardLog.setLog(log); tIccardLog.setLog(log);
tIccardLogMapper.insertSelective(tIccardLog); tIccardLogMapper.insertSelective(tIccardLog);
@ -403,11 +404,11 @@ public class XhpcCardServiceImpl implements IXhpcCardService {
tIccardLog.setUniqueid(tIccardInfo.getCardno()); tIccardLog.setUniqueid(tIccardInfo.getCardno());
tIccardLog.setType((byte) 0); tIccardLog.setType((byte) 0);
tIccardLog.setOperate((byte) 11); tIccardLog.setOperate((byte) 11);
tIccardLog.setOperatorid(Math.toIntExact(sysUser.getOperatorId())); tIccardLog.setOperatorid(Math.toIntExact(sysUser.getUserId()));
tIccardLog.setCreatetime(new Date()); tIccardLog.setCreatetime(new Date());
CardLogInfo cardLogInfo = new CardLogInfo(); CardLogInfo cardLogInfo = new CardLogInfo();
cardLogInfo.setOperate(11); cardLogInfo.setOperate(11);
cardLogInfo.setOperatorId(sysUser.getOperatorId()); cardLogInfo.setOperatorId(sysUser.getUserId());
CardLogInfo.CardInfoDTO cardInfoDTO = new CardLogInfo.CardInfoDTO(); CardLogInfo.CardInfoDTO cardInfoDTO = new CardLogInfo.CardInfoDTO();
cardInfoDTO.setCardID(tIccardInfo.getCardid()); cardInfoDTO.setCardID(tIccardInfo.getCardid());
cardInfoDTO.setCardNo(tIccardInfo.getCardno()); cardInfoDTO.setCardNo(tIccardInfo.getCardno());
@ -427,34 +428,47 @@ public class XhpcCardServiceImpl implements IXhpcCardService {
} }
@Override @Override
public R<CardUserInfo> queryWholeUserInfo(String userAccount, Integer userType) { public R<CardUserInfo> queryWholeUserInfo(Long cardRecordId) {
CardUserInfo cardUserInfo = new CardUserInfo(); CardUserInfo cardUserInfo = new CardUserInfo();
//离线用户 TIccardInfo tIccardInfo = tIccardInfoMapper.selectByPrimaryKey(Math.toIntExact(cardRecordId));
if (userType == 10) { Integer cardType = tIccardInfo.getCardtype();
cardUserInfo.setUserType(userType); if (cardType.equals(ConstantClass.OFFLINE_CARD)) {
Map<String, Object> userData = tIccardInfoMapper.selectByPhone(userAccount); cardUserInfo.setUserType(10);
if (userData == null) { //公共部分
return R.fail("没有此类型用户"); cardUserInfo.setCardSerialNumber(tIccardInfo.getCardid());
} cardUserInfo.setCardPhysicalNumber(tIccardInfo.getCardno());
cardUserInfo.setUserAge((Integer) userData.get("userAge")); cardUserInfo.setCardClassification(tIccardInfo.getIsPlatform());
cardUserInfo.setUserName((String) userData.get("userName")); cardUserInfo.setCashPledge(tIccardInfo.getCashpledge());
cardUserInfo.setUserSex((Integer) userData.get("userSex")); cardUserInfo.setBalance(tIccardInfo.getBalance());
cardUserInfo.setIdCardNumber((String) userData.get("idNumber")); cardUserInfo.setCardType(tIccardInfo.getCardtype());
cardUserInfo.setPhoneNumber((String) userData.get("phone")); XhpcOperator xhpcOperator = xhpcOperatorMapper.selectOneByCorpNoAndTenantId(tIccardInfo.getCorpno(), tokenService.getLoginUser().getSysUser().getTenantId());
cardUserInfo.setLicencePlate((String) userData.get("licencePlate")); cardUserInfo.setGrantOperatorName(xhpcOperator.getName());
fillUserInfo(cardUserInfo, userData); //离线用户账号
cardUserInfo.setBalance((Integer) userData.get("balance")); 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); return R.ok(cardUserInfo);
} else { } else {
//联网卡用户 XhpcIcCardInfo xhpcIcCardInfo = xhpcCardMapper.getXhpcIcCardInfo(tIccardInfo.getCardid());
cardUserInfo.setUserType(userType); cardUserInfo.setUserAccount(xhpcIcCardInfo.getUserAccount());
Map<String, Object> userData = xhpcCardMapper.selectByAccount(userAccount, userType); cardUserInfo.setUserType(xhpcIcCardInfo.getUserType());
cardUserInfo.setUserAccount((String) userData.get("user_account")); //公共部分
fillUserInfo(cardUserInfo, userData); 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); return R.ok(cardUserInfo);
} }
} }
@Override @Override
@ -500,7 +514,7 @@ public class XhpcCardServiceImpl implements IXhpcCardService {
tIccardLog.setUniqueid(tIccardInfo.getCardno()); tIccardLog.setUniqueid(tIccardInfo.getCardno());
tIccardLog.setType((byte) 0); tIccardLog.setType((byte) 0);
tIccardLog.setOperate((byte) 5); tIccardLog.setOperate((byte) 5);
tIccardLog.setOperatorid(Integer.valueOf(tIccardInfo.getCorpno())); tIccardLog.setOperatorid(Math.toIntExact(tokenService.getLoginUser().getSysUser().getUserId()));
tIccardLog.setCreatetime(new Date()); tIccardLog.setCreatetime(new Date());
CardLogInfo cardLogInfo = new CardLogInfo(); CardLogInfo cardLogInfo = new CardLogInfo();
/** /**
@ -718,10 +732,7 @@ public class XhpcCardServiceImpl implements IXhpcCardService {
tIccardLog.setOperate((byte) 11); tIccardLog.setOperate((byte) 11);
LoginUser loginUser = tokenService.getLoginUser(); LoginUser loginUser = tokenService.getLoginUser();
SysUser sysUser = loginUser.getSysUser(); SysUser sysUser = loginUser.getSysUser();
Long operatorId = sysUser.getOperatorId(); tIccardLog.setOperatorid(Math.toIntExact(sysUser.getUserId()));
if (operatorId != null) {
tIccardLog.setOperatorid(Math.toIntExact(operatorId));
}
tIccardLog.setCreatetime(new Date()); tIccardLog.setCreatetime(new Date());
//log部分 //log部分
CardLogInfo.CardInfoDTO cardInfoDTO = new CardLogInfo.CardInfoDTO(); CardLogInfo.CardInfoDTO cardInfoDTO = new CardLogInfo.CardInfoDTO();
@ -738,9 +749,7 @@ public class XhpcCardServiceImpl implements IXhpcCardService {
CardLogInfo cardLogInfo = new CardLogInfo(); CardLogInfo cardLogInfo = new CardLogInfo();
cardLogInfo.setCardInfo(cardInfoDTO); cardLogInfo.setCardInfo(cardInfoDTO);
cardLogInfo.setOperate(11); cardLogInfo.setOperate(11);
if (operatorId != null) { cardLogInfo.setOperatorId(sysUser.getUserId());
cardLogInfo.setOperatorId(operatorId);
}
String cardLogInfoStr = JSONUtil.toJsonStr(cardLogInfo); String cardLogInfoStr = JSONUtil.toJsonStr(cardLogInfo);
tIccardLog.setLog(cardLogInfoStr); tIccardLog.setLog(cardLogInfoStr);
tIccardLogMapper.updateByPrimaryKeySelective(tIccardLog); tIccardLogMapper.updateByPrimaryKeySelective(tIccardLog);
@ -802,9 +811,7 @@ public class XhpcCardServiceImpl implements IXhpcCardService {
tIccardLog.setOperate((byte) 6); tIccardLog.setOperate((byte) 6);
String corpno = tIccardInfo.getCorpno(); String corpno = tIccardInfo.getCorpno();
String tenantId = tokenService.getLoginUser().getSysUser().getTenantId(); String tenantId = tokenService.getLoginUser().getSysUser().getTenantId();
XhpcOperator xhpcOperator = xhpcOperatorMapper.selectOneByCorpNoAndTenantId(corpno, tenantId); tIccardLog.setOperatorid(Math.toIntExact(tokenService.getLoginUser().getSysUser().getUserId()));
Long operatorId = xhpcOperator.getOperatorId();
tIccardLog.setOperatorid(Math.toIntExact(operatorId));
tIccardLog.setCreatetime(new Date()); tIccardLog.setCreatetime(new Date());
CardLogInfo cardLogInfo = new CardLogInfo(); CardLogInfo cardLogInfo = new CardLogInfo();
/** /**
@ -826,7 +833,7 @@ public class XhpcCardServiceImpl implements IXhpcCardService {
* } * }
*/ */
cardLogInfo.setOperate(6); cardLogInfo.setOperate(6);
cardLogInfo.setOperatorId(operatorId); cardLogInfo.setOperatorId(tokenService.getLoginUser().getSysUser().getUserId());
CardLogInfo.CardInfoDTO cardInfoDTO = new CardLogInfo.CardInfoDTO(); CardLogInfo.CardInfoDTO cardInfoDTO = new CardLogInfo.CardInfoDTO();
cardInfoDTO.setCardID(tIccardInfo.getCardid()); cardInfoDTO.setCardID(tIccardInfo.getCardid());
cardInfoDTO.setCardNo(tIccardInfo.getCardno()); cardInfoDTO.setCardNo(tIccardInfo.getCardno());

View File

@ -92,6 +92,9 @@
<if test="delFlag != null"> <if test="delFlag != null">
del_flag, del_flag,
</if> </if>
<if test="tenantId != null">
tenant_id
</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="tIccardInfoId != null"> <if test="tIccardInfoId != null">
@ -133,6 +136,9 @@
<if test="delFlag != null"> <if test="delFlag != null">
#{delFlag,jdbcType=BIGINT}, #{delFlag,jdbcType=BIGINT},
</if> </if>
<if test="tenantId != null">
#{tenantId,jdbcType=VARCHAR}
</if>
</trim> </trim>
</insert> </insert>
<update id="updateByPrimaryKeySelective" parameterType="com.xhpc.card.pojo.XhpcIcCardInfo"> <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 AREA = 1;
public static final Integer POINT = 2; public static final Integer POINT = 2;
/**
* 刷卡的卡类型
*/
public static final Integer OFFLINE_CARD = 0;
public static final Integer ONLINE_CARD = 1;
} }