Sfoglia il codice sorgente

渠道权限控制

master
zouhantao 2 mesi fa
parent
commit
31f1f0d497

+ 11
- 0
gly-base-core/src/main/java/cn/com/taiji/core/repo/jpa/ass/AssAgencyConfigRepo.java Vedi File

@@ -0,0 +1,11 @@
package cn.com.taiji.core.repo.jpa.ass;

import org.springframework.data.jpa.repository.Query;

import cn.com.taiji.common.repo.jpa.AbstractJpaRepo;
import cn.com.taiji.core.entity.ass.AssAgencyConfig;

public interface AssAgencyConfigRepo extends AbstractJpaRepo<AssAgencyConfig, String> {
@Query("from AssAgencyConfig where agencyId = ?1")
AssAgencyConfig findByAgencyId(String agencyId);
}

+ 40
- 0
gly-base-core/src/main/java/cn/com/taiji/core/repo/request/ass/AssAgencyConfigPageRequest.java Vedi File

@@ -0,0 +1,40 @@
package cn.com.taiji.core.repo.request.ass;

import cn.com.taiji.common.pub.dao.HqlBuilder;
import cn.com.taiji.common.repo.request.jpa.JpaDateTimePageableDataRequest;
import cn.com.taiji.core.entity.ass.AssAgencyConfig;
import cn.com.taiji.core.entity.dict.EnableStatus;
import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
public class AssAgencyConfigPageRequest extends JpaDateTimePageableDataRequest<AssAgencyConfig>{

private String agencyId;// 渠道编号
private String noticeUrl;// 服务地址
private EnableStatus status;// 状态
private String openId;//创建人

public AssAgencyConfigPageRequest() {
this.orderBy="updateTime";
this.desc=true;
}

@Override
public HqlBuilder toSelectHql(){
HqlBuilder hql = new HqlBuilder("from AssAgencyConfig where 1=1 ");
hql.append(" and agencyId=:agencyId", agencyId);
hql.append(" and status=:status", status);
hql.append(" and noticeUrl=:noticeUrl", noticeUrl);
hql.append(" and openId=:openId", openId);
hql.append(" and updateTime>=:startTime", startTime);
hql.append(" and updateTime<=:endTime", endTime);
return hql;
}





}

+ 57
- 0
zhywpt-app-userw/src/main/java/cn/com/taiji/userw/api/AgencyConfigController.java Vedi File

@@ -0,0 +1,57 @@
package cn.com.taiji.userw.api;

import javax.validation.Valid;

import cn.com.taiji.userw.manager.agency.AgencyConfigManager;
import cn.com.taiji.userw.model.agency.config.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import cn.com.taiji.common.manager.ManagerException;
import cn.com.taiji.common.model.dao.Pagination;
import cn.com.taiji.common.web.ApiResponse;
import cn.com.taiji.userw.manager.dict.DictItemManager;
import cn.com.taiji.userw.manager.dict.DictTypeManager;
import cn.com.taiji.userw.model.protocol.dict.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

@Api(tags = {"渠道权限管理"})
@RestController
@RequestMapping("/agency/config")
public class AgencyConfigController extends MyValidController {
@Autowired
private AgencyConfigManager configManager;

@ApiOperation(value = "渠道权限管理-新增")
@PostMapping(value = "/add")
public ApiResponse<AgencyConfigResponse> add(@RequestBody @Valid AgencyConfigAddRequest req) throws ManagerException {
AgencyConfigResponse response = configManager.add(req);
return ApiResponse.of(response);
}

@ApiOperation(value = "渠道权限管理-禁用")
@PostMapping(value = "/delete")
public ApiResponse<AgencyConfigResponse> delete(@RequestBody @Valid AgencyConfigDeleteRequest req) throws ManagerException {
AgencyConfigResponse response = configManager.delete(req);
return ApiResponse.of(response);
}

@ApiOperation(value = "渠道权限管理-修改")
@PostMapping(value = "/update")
public ApiResponse<AgencyConfigResponse> update(@RequestBody @Valid AgencyConfigUpdateRequest req) throws ManagerException {
AgencyConfigResponse response = configManager.update(req);
return ApiResponse.of(response);
}

@ApiOperation(value = "渠道权限管理-查询")
@PostMapping(value = "/page")
public ApiResponse<Pagination> page(@RequestBody @Valid AgencyConfigQueryRequest req) throws ManagerException {
Pagination response = configManager.page(req);
return ApiResponse.of(response);
}

}

+ 22
- 0
zhywpt-app-userw/src/main/java/cn/com/taiji/userw/manager/agency/AgencyConfigManager.java Vedi File

@@ -0,0 +1,22 @@
package cn.com.taiji.userw.manager.agency;

import java.util.List;

import cn.com.taiji.common.manager.ManagerException;
import cn.com.taiji.common.model.StringKeyValue;
import cn.com.taiji.common.model.dao.Pagination;
import cn.com.taiji.userw.dto.agency.*;
import cn.com.taiji.userw.model.agency.AgencyQueryAllModel;
import cn.com.taiji.userw.model.agency.config.*;


public interface AgencyConfigManager {
Pagination page(AgencyConfigQueryRequest reqDto);

AgencyConfigResponse delete(AgencyConfigDeleteRequest req) throws ManagerException;

AgencyConfigResponse add(AgencyConfigAddRequest req) throws ManagerException;

AgencyConfigResponse update(AgencyConfigUpdateRequest req) throws ManagerException;

}

+ 73
- 0
zhywpt-app-userw/src/main/java/cn/com/taiji/userw/manager/agency/AgencyConfigManagerImpl.java Vedi File

@@ -0,0 +1,73 @@
package cn.com.taiji.userw.manager.agency;

import cn.com.taiji.core.entity.ass.AssAgencyConfig;
import cn.com.taiji.core.entity.dict.EnableStatus;
import cn.com.taiji.core.manager.cache.RedisCacheManager;
import cn.com.taiji.userw.model.agency.config.*;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.com.taiji.common.manager.AbstractManager;
import cn.com.taiji.common.manager.ManagerException;
import cn.com.taiji.common.model.dao.Pagination;
import cn.com.taiji.core.repo.jpa.ass.AssAgencyConfigRepo;
import cn.com.taiji.core.repo.request.ass.AssAgencyConfigPageRequest;

import java.time.LocalDateTime;


@Service
public class AgencyConfigManagerImpl extends RedisCacheManager implements AgencyConfigManager {

@Autowired
private AssAgencyConfigRepo agencyConfigRepo;

@Override
public Pagination page(AgencyConfigQueryRequest reqDto) {
AssAgencyConfigPageRequest request = copyProperties(reqDto, new AssAgencyConfigPageRequest());
return agencyConfigRepo.page(request);
}

@Override
public AgencyConfigResponse delete(AgencyConfigDeleteRequest req) throws ManagerException {
AssAgencyConfig agencyConfig = agencyConfigRepo.findByAgencyId(req.getAgencyId());
if (agencyConfig == null){
throw new ManagerException("未找到该条渠道信息。");
}
agencyConfig.setStatus(req.getStatus());
agencyConfig.setUpdateTime(LocalDateTime.now());
agencyConfigRepo.merge(agencyConfig);
AgencyConfigResponse response = copyProperties(req, new AgencyConfigResponse());
return response;
}

@Override
public AgencyConfigResponse add(AgencyConfigAddRequest req) throws ManagerException {
AssAgencyConfig agencyConfig = agencyConfigRepo.findByAgencyId(req.getAgencyId());
if (agencyConfig != null){
throw new ManagerException("该渠道已有权限记录。");
}
agencyConfig = copyProperties(req, new AssAgencyConfig());
agencyConfig.setCreateTime(LocalDateTime.now());
agencyConfig.setUpdateTime(LocalDateTime.now());
agencyConfig.setOpenId(findOpenIdByToken(req.getAccessToken()));
agencyConfig.setStatus(EnableStatus.ENABLE);
agencyConfigRepo.merge(agencyConfig);
AgencyConfigResponse response = copyProperties(req, new AgencyConfigResponse());
return response;
}

@Override
public AgencyConfigResponse update(AgencyConfigUpdateRequest req) throws ManagerException {
AssAgencyConfig agencyConfig = agencyConfigRepo.findByAgencyId(req.getAgencyId());
if (agencyConfig == null){
throw new ManagerException("未找到该条渠道信息。");
}
BeanUtils.copyProperties(req,agencyConfig);
agencyConfig.setUpdateTime(LocalDateTime.now());
AgencyConfigResponse response = copyProperties(req, new AgencyConfigResponse());
return response;
}

}

+ 34
- 0
zhywpt-app-userw/src/main/java/cn/com/taiji/userw/model/agency/config/AgencyConfigAddRequest.java Vedi File

@@ -0,0 +1,34 @@
package cn.com.taiji.userw.model.agency.config;


import cn.com.taiji.core.dto.AbstractStaffBizRequestDTO;
import cn.com.taiji.core.entity.dict.EnableStatus;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.Column;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.validation.constraints.Size;


@Getter
@Setter
public class AgencyConfigAddRequest extends AbstractStaffBizRequestDTO {

@ApiModelProperty(value = "渠道编号")
private String agencyId;// 渠道编号
private String noticeUrl;// 服务地址
private Boolean deviceChange;// 支持设备更换
private Integer dealType;// 不支持设备更换后处理方式 1-新版 2-提示用户
private Boolean deviceChangeNotice;// 提示 dealType为2时必填
private Boolean vehicleChange;// 支持车牌变更
private Boolean deviceCancel;// 支持设备注销
private Boolean signChange;// 支持签约代扣信息变更
private Boolean qtSign;// 是否黔通代扣签约
private Boolean channelSignUrl;// 渠道签约地址
private Boolean channelSignAppId;// 渠道签约小程序id
private Boolean qtUserSign;// 是否黔通产品签约

}

+ 20
- 0
zhywpt-app-userw/src/main/java/cn/com/taiji/userw/model/agency/config/AgencyConfigDeleteRequest.java Vedi File

@@ -0,0 +1,20 @@
package cn.com.taiji.userw.model.agency.config;


import cn.com.taiji.core.dto.AbstractStaffBizRequestDTO;
import cn.com.taiji.core.entity.dict.EnableStatus;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;


@Getter
@Setter
public class AgencyConfigDeleteRequest extends AbstractStaffBizRequestDTO {

@ApiModelProperty(value = "渠道编号")
private String agencyId;// 渠道编号
@ApiModelProperty(value = "状态")
private EnableStatus status;

}

+ 26
- 0
zhywpt-app-userw/src/main/java/cn/com/taiji/userw/model/agency/config/AgencyConfigQueryRequest.java Vedi File

@@ -0,0 +1,26 @@
package cn.com.taiji.userw.model.agency.config;


import cn.com.taiji.core.dto.AbstractStaffBizRequestDTO;
import cn.com.taiji.core.entity.dict.EnableStatus;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;


@Getter
@Setter
public class AgencyConfigQueryRequest extends AbstractStaffBizRequestDTO {

@ApiModelProperty(value = "渠道编号")
private String agencyId;// 渠道编号
@ApiModelProperty(value = "服务地址")
private String noticeUrl;// 服务地址
@ApiModelProperty(value = "状态")
private EnableStatus status;// 状态
@ApiModelProperty(value = "创建人Openid")
private String openId;//创建人
private int pageNo;
private int pageSize;

}

+ 10
- 0
zhywpt-app-userw/src/main/java/cn/com/taiji/userw/model/agency/config/AgencyConfigResponse.java Vedi File

@@ -0,0 +1,10 @@
package cn.com.taiji.userw.model.agency.config;

import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
public class AgencyConfigResponse {
private String agencyId;
}

+ 30
- 0
zhywpt-app-userw/src/main/java/cn/com/taiji/userw/model/agency/config/AgencyConfigUpdateRequest.java Vedi File

@@ -0,0 +1,30 @@
package cn.com.taiji.userw.model.agency.config;


import cn.com.taiji.core.dto.AbstractStaffBizRequestDTO;
import cn.com.taiji.core.entity.dict.EnableStatus;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;


@Getter
@Setter
public class AgencyConfigUpdateRequest extends AbstractStaffBizRequestDTO {

@ApiModelProperty(value = "渠道编号")
private String agencyId;// 渠道编号
private String noticeUrl;// 服务地址
private Boolean deviceChange;// 支持设备更换
private Integer dealType;// 不支持设备更换后处理方式 1-新版 2-提示用户
private Boolean deviceChangeNotice;// 提示 dealType为2时必填
private Boolean vehicleChange;// 支持车牌变更
private Boolean deviceCancel;// 支持设备注销
private Boolean signChange;// 支持签约代扣信息变更
private Boolean qtSign;// 是否黔通代扣签约
private Boolean channelSignUrl;// 渠道签约地址
private Boolean channelSignAppId;// 渠道签约小程序id
private Boolean qtUserSign;// 是否黔通产品签约


}

+ 1
- 1
zhywpt-service-ias/src/main/java/cn/com/taiji/ias/manager/vehicleInfoChange/VehicleInfoChangeManager.java Vedi File

@@ -225,7 +225,7 @@ public class VehicleInfoChangeManager extends AbstractCommManager
apply.setOrderNo(assOrderinfo.getId());
apply.setChangeType(changeType);
// 旧车辆数据
apply.setOldVehicleId(oldVehicleInfo.getVehiclePlate() + "_" + oldVehicleInfo.getVehiclePlateColor());
apply.setOldVehicleId(oldVehicleInfo.getVehicleId());
apply.setOldVehiclePlate(oldVehicleInfo.getVehiclePlate());
apply.setOldVehiclePlateColor(oldVehicleInfo.getVehiclePlateColor());
apply.setOldUseCharacter(oldVehicleInfo.getUseCharacter());

Loading…
Annulla
Salva