|
|
@@ -35,7 +35,7 @@ public class AgencyConfigManagerImpl extends RedisCacheManager implements Agency |
|
|
|
|
|
|
|
@Override |
|
|
|
public AgencyConfigResponse delete(AgencyConfigDeleteRequest req) throws ManagerException { |
|
|
|
AssAgencyConfig agencyConfig = agencyConfigRepo.findByAgencyId(req.getAgencyId()); |
|
|
|
AssAgencyConfig agencyConfig = agencyConfigRepo.findById(req.getId()).orElse(null); |
|
|
|
if (agencyConfig == null){ |
|
|
|
throw new ManagerException("未找到该条渠道信息。"); |
|
|
|
} |
|
|
@@ -53,12 +53,13 @@ public class AgencyConfigManagerImpl extends RedisCacheManager implements Agency |
|
|
|
if (agencyConfig != null){ |
|
|
|
throw new ManagerException("该渠道已有权限记录。"); |
|
|
|
} |
|
|
|
checkReq(req.getDeviceChange(),req.getDealType(),req.getDeviceChangeNotice()); |
|
|
|
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); |
|
|
|
agencyConfigRepo.persist(agencyConfig); |
|
|
|
AgencyConfigResponse response = copyProperties(req, new AgencyConfigResponse()); |
|
|
|
return response; |
|
|
|
} |
|
|
@@ -69,8 +70,10 @@ public class AgencyConfigManagerImpl extends RedisCacheManager implements Agency |
|
|
|
if (agencyConfig == null){ |
|
|
|
throw new ManagerException("未找到该条渠道信息。"); |
|
|
|
} |
|
|
|
checkReq(req.getDeviceChange(),req.getDealType(),req.getDeviceChangeNotice()); |
|
|
|
BeanUtils.copyProperties(req,agencyConfig); |
|
|
|
agencyConfig.setUpdateTime(LocalDateTime.now()); |
|
|
|
agencyConfigRepo.merge(agencyConfig); |
|
|
|
AgencyConfigResponse response = copyProperties(req, new AgencyConfigResponse()); |
|
|
|
return response; |
|
|
|
} |
|
|
@@ -81,4 +84,17 @@ public class AgencyConfigManagerImpl extends RedisCacheManager implements Agency |
|
|
|
throw new ManagerException("没找到渠道。"); |
|
|
|
} |
|
|
|
} |
|
|
|
public void checkReq(Boolean deviceChange, Integer dealType, String deviceChangeNotice) throws ManagerException{ |
|
|
|
if (!deviceChange){ |
|
|
|
if (dealType == null){ |
|
|
|
throw new ManagerException("请选择处理方式。"); |
|
|
|
} else { |
|
|
|
if (dealType == 2){ |
|
|
|
if (deviceChangeNotice == null){ |
|
|
|
throw new ManagerException("请填写提示。"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |