ソースを参照

iaw 切换用户

master
chenchaod 1ヶ月前
コミット
57ae9c2a5c

+ 3
- 0
gly-base-core/src/main/java/cn/com/taiji/core/entity/user/AccountInfo.java ファイルの表示

@@ -82,6 +82,9 @@ public class AccountInfo extends AbstractStringPropertyUUIDEntity {
@Column(name = "ADDRESS")
private String address;// 地址;

@Column(name = "CUSTOMER_ID")
private String customerId;//最近一次ETC用户

public AccountInfo() {
}


+ 1
- 1
zhywpt-app-iaw/src/main/java/cn/com/taiji/iaw/api/ass/ActiveController.java ファイルの表示

@@ -40,7 +40,7 @@ public class ActiveController extends MyValidController {

@ApiOperation(value = "保存记录")
@PostMapping(value = "/saveRecords")
public ApiResponse<ActivateDetailsResponseDTO> saveRecords(@Valid @RequestBody ActivateDetailsRequestDTO reqDto) throws ServiceHandleException {
public ApiResponse<ActivateDetailsResponseDTO> saveRecords(@Valid @RequestBody ActivateDetailsRequestDTO reqDto) throws ManagerException {
ActivateDetailsResponseDTO resDto = manager.saveRecords(reqDto);
return ApiResponse.of(resDto).setMessage("保存成功");
}

+ 6
- 6
zhywpt-app-iaw/src/main/java/cn/com/taiji/iaw/api/issue/H5OrderController.java ファイルの表示

@@ -57,12 +57,12 @@ public class H5OrderController extends MyValidController {
}

//todo 后面删除
@Deprecated
@ApiOperation(value = "收费车型")
@PostMapping(value = "/vehicCharge")
public ApiResponse<VehicChargeResponseDTO> vehicCharge(@RequestBody @Valid VehicChargeRequestDTO reqDTO) throws ManagerException {
return ApiResponse.of(h5OrderManage.vehicCharge(reqDTO));
}
// @Deprecated
// @ApiOperation(value = "收费车型")
// @PostMapping(value = "/vehicCharge")
// public ApiResponse<VehicChargeResponseDTO> vehicCharge(@RequestBody @Valid VehicChargeRequestDTO reqDTO) throws ManagerException {
// return ApiResponse.of(h5OrderManage.vehicCharge(reqDTO));
// }
@ApiOperation(value = "收费车型和车辆使用性质")
@PostMapping(value = "/vehicUsePropert")
public ApiResponse<VehicUsePropertRespDTO> vehicUsePropert(@RequestBody @Valid VehicUsePropertReqtDTO reqDTO) throws ManagerException {

+ 13
- 0
zhywpt-app-iaw/src/main/java/cn/com/taiji/iaw/api/portal/PortalController.java ファイルの表示

@@ -150,6 +150,12 @@ public class PortalController extends MyValidController {
return ApiResponse.of(portalManager.changeInfo(dto)).setMessage("提交成功,用户信息修改成功!");
}

/**
* 用于用户信息上传
* @param dto
* @return
* @throws ManagerException
*/
@ApiOperation(value = "获取用户信息")
@PostMapping(value = "/getAccountInfo")
public ApiResponse<GetAccountInfoResponseDTO> getAccountInfo(@Valid @RequestBody CommRequestDTO dto) throws ManagerException {
@@ -162,5 +168,12 @@ public class PortalController extends MyValidController {
return ApiResponse.of(portalManager.menuListBySystemTypeAndOpenId(dto)).setMessage("操作成功");
}

@ApiOperation(value = "ETC用户切换")
@PostMapping(value = "/etcChange")
public ApiResponse<?> etcChange(@RequestBody CommRequestDTO dto) throws ManagerException {
portalManager.etcChange(dto);
return ApiResponse.success().setMessage("切换ETC账户成功");
}


}

+ 6
- 0
zhywpt-app-iaw/src/main/java/cn/com/taiji/iaw/dto/CommRequestDTO.java ファイルの表示

@@ -1,5 +1,6 @@
package cn.com.taiji.iaw.dto;

import cn.com.taiji.common.valid.ViolationValidator;
import cn.com.taiji.core.dto.AbstractBizRequestDTO;
import io.swagger.annotations.ApiModel;
import lombok.Getter;
@@ -12,4 +13,9 @@ import lombok.experimental.Accessors;
@Accessors(chain = true)
public class CommRequestDTO extends AbstractBizRequestDTO {

//需要校验时,触发
@Override
protected void validate(ViolationValidator validator) {
validator.validFieldNotBlank("customerId",getCustomerId());
}
}

+ 7
- 15
zhywpt-app-iaw/src/main/java/cn/com/taiji/iaw/manager/AbstractIawManager.java ファイルの表示

@@ -20,7 +20,6 @@ import cn.com.taiji.core.repo.jpa.user.AccountInfoRepo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.time.LocalDateTime;
@@ -134,27 +133,20 @@ public abstract class AbstractIawManager extends AbstractCommManager {
protected void sysPersistOperateLog(OperateType operateType, String operatorDataId, SourceType source,
String openId, String msg) {
ServletRequestAttributes requestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
executor.execute(()-> {
try {
RequestContextHolder.setRequestAttributes(requestAttributes);
persistOperateLog(operateType, operatorDataId, source, openId, msg);
}finally {
RequestContextHolder.resetRequestAttributes();
}
});
HttpServletRequest request = requestAttributes.getRequest();
String ipAddr = IPTools.getIpAddr(request);
executor.execute(()-> saveOperateLog(operateType, operatorDataId, source, openId, getAccountName(openId), msg,ipAddr));
}

// 操作日志记录
protected void persistOperateLog(OperateType operateType, String operatorDataId, SourceType source,
String openId, String msg) {
saveOperateLog(operateType, operatorDataId, source, openId, getAccountName(openId), msg);
saveOperateLog(operateType, operatorDataId, source, openId, getAccountName(openId), msg,"");
}

protected void saveOperateLog(OperateType operateType, String dataId, SourceType source, String openId,
String operatorName, String msg) {
HttpServletRequest request =
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
String ip = IPTools.getIpAddr(request);
String operatorName, String msg,String ip) {
String iptemp = hasText(ip)?ip:IPTools.getIpAddr(((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
LocalDateTime now = LocalDateTime.now();
OperateLog log = new OperateLog();
log.setPartKey(Long.valueOf(now.format(TimeTools.yyyyMM)));
@@ -162,7 +154,7 @@ public abstract class AbstractIawManager extends AbstractCommManager {
log.setOperatorId(openId);
log.setOperatorName(operatorName);
log.setOperateTime(now);
log.setOperateIp(ip);
log.setOperateIp(iptemp);
log.setOperateType(operateType);
log.setOperatorDataId(dataId);
log.setMsg(msg);

+ 3
- 0
zhywpt-app-iaw/src/main/java/cn/com/taiji/iaw/manager/ResignManagerImpl.java ファイルの表示

@@ -41,6 +41,9 @@ public class ResignManagerImpl extends AbstractCommManager implements ResignMana
@Override
public Pagination rePage(RePageReqDto dto) throws ManagerException {
dto.validate();
if (!hasText(dto.getCustomerId())) {
return new Pagination();
}
AccountInfo accountInfo = findAccountInfoByToken(dto.getAccessToken());
QtkCustomerInfo customerInfo = customerInfoRepo.findByCustomerId(dto.getCustomerId());
if (customerInfo == null) throw new ManagerException("ETC用户信息不存在");

+ 1
- 0
zhywpt-app-iaw/src/main/java/cn/com/taiji/iaw/manager/portal/PortalManager.java ファイルの表示

@@ -52,4 +52,5 @@ public interface PortalManager {

RbacMenuListBySystemTypeAndOpenIdResponseDTO menuListBySystemTypeAndOpenId(RbacMenuListBySystemTypeAndOpenIdRequestDTO dto) throws ServiceHandleException;

void etcChange(CommRequestDTO dto) throws ManagerException;
}

+ 12
- 0
zhywpt-app-iaw/src/main/java/cn/com/taiji/iaw/manager/portal/PortalManagerImpl.java ファイルの表示

@@ -9,6 +9,8 @@ import cn.com.taiji.core.entity.dict.basic.SourceType;
import cn.com.taiji.core.entity.dict.user.RbacStatus;
import cn.com.taiji.core.entity.dict.user.SystemType;
import cn.com.taiji.core.entity.user.*;
import cn.com.taiji.core.manager.cache.LoginCacheFinals;
import cn.com.taiji.core.manager.cache.RedisKeyGenerator;
import cn.com.taiji.core.manager.tools.minio.MinioUtil;
import cn.com.taiji.core.model.comm.protocol.ats.weiXin.AtsGetWeChatOpenIdRequest;
import cn.com.taiji.core.model.comm.protocol.ats.weiXin.AtsGetWeChatOpenIdResponse;
@@ -30,6 +32,7 @@ import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;

import static cn.com.taiji.core.manager.tools.SystemFinals.*;
@@ -330,4 +333,13 @@ public class PortalManagerImpl extends AbstractCommManager implements PortalMana
}
}

@Override
public void etcChange(CommRequestDTO dto) throws ManagerException {
dto.validate();
AccountInfo accountInfo = findAccountInfoByToken(dto.getAccessToken());
accountInfo.setCustomerId(dto.getCustomerId());
accountInfoRepo.merge(accountInfo);
//更新缓存
redisManager.set(RedisKeyGenerator.getLoginAccountInfoKey(dto.getAccessToken()), accountInfo.toJson(), LoginCacheFinals.LOGIN_TOKEN_EXPIRED, TimeUnit.MINUTES);
}
}

読み込み中…
キャンセル
保存