@@ -0,0 +1,13 @@ | |||
package cn.com.taiji.core.manager.tools; | |||
public class SystemFinals { | |||
public final static String appId = "52030131";// 系统APPID | |||
public final static String commonServiceHallId = "5201010600400000000";// 普通用户的专属网点编号 | |||
public final static String commonStaffId = "003d875dabaa4390b22739f6897cf570";// 普通用户的专属业务人员编号 | |||
public final static String appBaseRoleId = "d1eb3eebfac846d39aea7d39aea7s365";// APP专用的RoleId | |||
public final static String miniProgramBaseRoleId = "d1eb3eebfac846d39aea7d39aea7s124";// 微信小程序专用的RoleId | |||
public final static String zfbMiniProgramBaseRoleId = "7acb029592c84738a8f509af6e179ffc";// 支付宝小程序专用的RoleId | |||
} |
@@ -1,5 +1,6 @@ | |||
package cn.com.taiji.userw.api; | |||
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.core.entity.basic.QtkAgencyMap; | |||
@@ -30,28 +31,28 @@ public class CenterAgencyController extends MyValidController{ | |||
private CenterAgencyManager manager; | |||
@ApiOperation(value = "获取中心渠道编号信息") | |||
@GetMapping(value = "/getCenterAgencyId") | |||
@PostMapping(value = "/getCenterAgencyId") | |||
public ApiResponse<List<QtkAgencyMap>> getCenterAgencyId() { | |||
List<QtkAgencyMap> res = manager.getCenterAgencyId(); | |||
return ApiResponse.of(res); | |||
} | |||
@ApiOperation(value = "新增修改") | |||
@GetMapping(value = "/addOrUpDate") | |||
public ApiResponse<?> getCenterServiceHall(@Validated @RequestBody CenterAgencyAddOrUpdateReqDTO reqDto) { | |||
@PostMapping(value = "/addOrUpDate") | |||
public ApiResponse<?> getCenterServiceHall(@Validated @RequestBody CenterAgencyAddOrUpdateReqDTO reqDto) throws ManagerException { | |||
manager.addOrUpdate(reqDto); | |||
return ApiResponse.success().setMessage("成功"); | |||
} | |||
@ApiOperation(value = "删除") | |||
@GetMapping(value = "/delete") | |||
@PostMapping(value = "/delete") | |||
public ApiResponse<?> getCenterServiceHall(@Validated @RequestBody CenterHallOrAgencyDeleteRequestDTO reqDto) { | |||
manager.delete(reqDto); | |||
return ApiResponse.success().setMessage("删除成功"); | |||
} | |||
@ApiOperation(value = "分页查询") | |||
@GetMapping(value = "/page") | |||
@PostMapping(value = "/page") | |||
public ApiResponse<Pagination> getCenterServiceHall(@Validated @RequestBody CenterHallOrAgencyPageRequestDTO reqDto) { | |||
Pagination page = manager.page(reqDto); | |||
return ApiResponse.of(page); |
@@ -1,5 +1,6 @@ | |||
package cn.com.taiji.userw.api; | |||
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.core.entity.basic.QtkServicehallMap; | |||
@@ -29,27 +30,27 @@ public class CenterServiceHallController extends MyValidController{ | |||
@Autowired | |||
private CenterServiceHallManager manager; | |||
@ApiOperation(value = "获取中心网点编号信息") | |||
@GetMapping(value = "/getCenterServiceHall") | |||
@PostMapping(value = "/getCenterServiceHall") | |||
public ApiResponse<List<QtkServicehallMap>> getCenterServiceHall() { | |||
return ApiResponse.of(manager.getCenterServiceHall()); | |||
} | |||
@ApiOperation(value = "新增修改") | |||
@GetMapping(value = "/addOrUpDate") | |||
public ApiResponse<?> getCenterServiceHall(@Validated @RequestBody CenterHallAddOrUpdateReqDTO reqDto) { | |||
@PostMapping(value = "/addOrUpDate") | |||
public ApiResponse<?> getCenterServiceHall(@Validated @RequestBody CenterHallAddOrUpdateReqDTO reqDto) throws ManagerException { | |||
manager.addOrUpdate(reqDto); | |||
return ApiResponse.success().setMessage("成功"); | |||
} | |||
@ApiOperation(value = "删除") | |||
@GetMapping(value = "/delete") | |||
@PostMapping(value = "/delete") | |||
public ApiResponse<?> getCenterServiceHall(@Validated @RequestBody CenterHallOrAgencyDeleteRequestDTO reqDto) { | |||
manager.delete(reqDto); | |||
return ApiResponse.success().setMessage("删除成功"); | |||
} | |||
@ApiOperation(value = "分页查询") | |||
@GetMapping(value = "/page") | |||
@PostMapping(value = "/page") | |||
public ApiResponse<Pagination> getCenterServiceHall(@Validated @RequestBody CenterHallOrAgencyPageRequestDTO reqDto) { | |||
Pagination page = manager.page(reqDto); | |||
return ApiResponse.of(page); |
@@ -9,10 +9,7 @@ import io.swagger.annotations.Api; | |||
import io.swagger.annotations.ApiOperation; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.validation.annotation.Validated; | |||
import org.springframework.web.bind.annotation.GetMapping; | |||
import org.springframework.web.bind.annotation.RequestBody; | |||
import org.springframework.web.bind.annotation.RequestMapping; | |||
import org.springframework.web.bind.annotation.RestController; | |||
import org.springframework.web.bind.annotation.*; | |||
/** | |||
* @Author:ChenChao | |||
@@ -28,19 +25,19 @@ public class WxPayConfigController extends MyValidController{ | |||
@Autowired | |||
private WxPayConfigManager manager; | |||
@ApiOperation(value = "分页查询") | |||
@GetMapping(value = "/page") | |||
@PostMapping(value = "/page") | |||
public ApiResponse<Pagination> page(@Validated @RequestBody WxPayPageRequestDTO reqDto) { | |||
Pagination page = manager.page(reqDto); | |||
return ApiResponse.of(page); | |||
} | |||
@ApiOperation(value = "新增") | |||
@GetMapping(value = "/add") | |||
@PostMapping(value = "/add") | |||
public ApiResponse<?> add(@Validated @RequestBody WxPayAddReqDTO reqDto) throws ManagerException { | |||
manager.add(reqDto); | |||
return ApiResponse.success().setMessage("新增成功"); | |||
} | |||
@ApiOperation(value = "修改") | |||
@GetMapping(value = "/update") | |||
@PostMapping(value = "/update") | |||
public ApiResponse<?> update(@Validated @RequestBody WxPayUpdateReqDTO reqDto) throws ManagerException { | |||
manager.update(reqDto); | |||
return ApiResponse.success().setMessage("修改成功"); |
@@ -11,10 +11,7 @@ import io.swagger.annotations.Api; | |||
import io.swagger.annotations.ApiOperation; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.validation.annotation.Validated; | |||
import org.springframework.web.bind.annotation.GetMapping; | |||
import org.springframework.web.bind.annotation.RequestBody; | |||
import org.springframework.web.bind.annotation.RequestMapping; | |||
import org.springframework.web.bind.annotation.RestController; | |||
import org.springframework.web.bind.annotation.*; | |||
/** | |||
* @Author:ChenChao | |||
@@ -30,19 +27,19 @@ public class WxSignConfigController extends MyValidController{ | |||
@Autowired | |||
private WxSignChannelConfigManager manager; | |||
@ApiOperation(value = "分页查询") | |||
@GetMapping(value = "/page") | |||
@PostMapping(value = "/page") | |||
public ApiResponse<Pagination> page(@Validated @RequestBody WxCarPageRequestDTO reqDto) { | |||
Pagination page = manager.page(reqDto); | |||
return ApiResponse.of(page); | |||
} | |||
@ApiOperation(value = "新增") | |||
@GetMapping(value = "/add") | |||
@PostMapping(value = "/add") | |||
public ApiResponse<?> add(@Validated @RequestBody WxCarAddReqDTO reqDto) throws ManagerException { | |||
manager.add(reqDto); | |||
return ApiResponse.success().setMessage("新增成功"); | |||
} | |||
@ApiOperation(value = "修改") | |||
@GetMapping(value = "/update") | |||
@PostMapping(value = "/update") | |||
public ApiResponse<?> update(@Validated @RequestBody WxCarUpdateReqDTO reqDto) throws ManagerException { | |||
manager.update(reqDto); | |||
return ApiResponse.success().setMessage("修改成功"); |
@@ -1,10 +1,14 @@ | |||
package cn.com.taiji.userw.dto.centerHallAndAgency; | |||
import cn.com.taiji.common.valid.ViolationValidator; | |||
import cn.com.taiji.core.dto.AbstractStaffBizRequestDTO; | |||
import cn.com.taiji.core.model.comm.protocol.constraint.IntegerConstant; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import javax.validation.constraints.NotNull; | |||
/** | |||
* @Author:ChenChao | |||
* @Date:2025/5/20 13:11 | |||
@@ -20,4 +24,23 @@ public class CenterAgencyAddOrUpdateReqDTO extends AbstractStaffBizRequestDTO { | |||
@ApiModelProperty(value = "中心渠道名称") | |||
private String centerAgencyName; | |||
@ApiModelProperty(value = "ID") | |||
private String id; | |||
@ApiModelProperty(value = "操作类型 1新增 2修改") | |||
@IntegerConstant(values = "1,2", message = "操作类型错误") | |||
@NotNull | |||
private Integer optType; | |||
@Override | |||
protected void validate(ViolationValidator validator) { | |||
if (optType == 1){ | |||
validator.validFieldNotBlank("centerAgencyName",centerAgencyName); | |||
validator.validFieldNotBlank("centerAgencyId",centerAgencyId); | |||
}else { | |||
validator.validFieldNotBlank("id",id); | |||
validator.validFieldNotBlank("centerAgencyName",centerAgencyName); | |||
} | |||
} | |||
} |
@@ -1,10 +1,14 @@ | |||
package cn.com.taiji.userw.dto.centerHallAndAgency; | |||
import cn.com.taiji.common.valid.ViolationValidator; | |||
import cn.com.taiji.core.dto.AbstractStaffBizRequestDTO; | |||
import cn.com.taiji.core.model.comm.protocol.constraint.FixedLength; | |||
import cn.com.taiji.core.model.comm.protocol.constraint.IntegerConstant; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import javax.validation.constraints.NotBlank; | |||
import javax.validation.constraints.NotNull; | |||
/** | |||
* @Author:ChenChao | |||
@@ -14,9 +18,28 @@ import javax.validation.constraints.NotBlank; | |||
*/ | |||
@Data | |||
public class CenterHallAddOrUpdateReqDTO extends AbstractStaffBizRequestDTO { | |||
@NotBlank(message = "中心网点编号不能为空") | |||
@FixedLength(length = 19, message = "中心网点编号必须是19位") | |||
private String centerServiceHallId; | |||
@NotBlank(message = "网点名称不能为空") | |||
private String centerServicehallName; | |||
@ApiModelProperty(value = "ID") | |||
private String id; | |||
@ApiModelProperty(value = "操作类型 1新增 2修改") | |||
@IntegerConstant(values = "1,2", message = "操作类型错误") | |||
@NotNull | |||
private Integer optType; | |||
@Override | |||
protected void validate(ViolationValidator validator) { | |||
if (optType == 1){ | |||
validator.validFieldNotBlank("centerServiceHallId",centerServiceHallId); | |||
validator.validFieldNotBlank("centerServicehallName",centerServicehallName); | |||
}else { | |||
validator.validFieldNotBlank("id",id); | |||
validator.validFieldNotBlank("centerServicehallName",centerServicehallName); | |||
} | |||
} | |||
} |
@@ -1,6 +1,6 @@ | |||
package cn.com.taiji.userw.dto.centerHallAndAgency; | |||
import cn.com.taiji.core.dto.AbstractStaffBizRequestDTO; | |||
import cn.com.taiji.core.dto.AbstractStaffBizPageRequestDTO; | |||
import lombok.Data; | |||
/** | |||
@@ -10,6 +10,6 @@ import lombok.Data; | |||
* @description: 中心网点/渠道请求参数 | |||
*/ | |||
@Data | |||
public class CenterHallOrAgencyPageRequestDTO extends AbstractStaffBizRequestDTO { | |||
public class CenterHallOrAgencyPageRequestDTO extends AbstractStaffBizPageRequestDTO { | |||
} |
@@ -1,5 +1,6 @@ | |||
package cn.com.taiji.userw.manager.centerHallAndAgency; | |||
import cn.com.taiji.common.manager.ManagerException; | |||
import cn.com.taiji.common.model.dao.Pagination; | |||
import cn.com.taiji.core.entity.basic.QtkAgencyMap; | |||
import cn.com.taiji.userw.dto.centerHallAndAgency.CenterAgencyAddOrUpdateReqDTO; | |||
@@ -18,7 +19,7 @@ public interface CenterAgencyManager { | |||
List<QtkAgencyMap> getCenterAgencyId(); | |||
void addOrUpdate(CenterAgencyAddOrUpdateReqDTO reqDto); | |||
void addOrUpdate(CenterAgencyAddOrUpdateReqDTO reqDto) throws ManagerException; | |||
void delete(CenterHallOrAgencyDeleteRequestDTO reqDto); | |||
@@ -1,6 +1,7 @@ | |||
package cn.com.taiji.userw.manager.centerHallAndAgency; | |||
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.entity.basic.QtkAgencyMap; | |||
import cn.com.taiji.core.repo.jpa.basic.QtkAgencyMapRepo; | |||
@@ -29,14 +30,18 @@ public class CenterAgencyManagerImpl extends AbstractManager implements CenterAg | |||
} | |||
@Override | |||
public void addOrUpdate(CenterAgencyAddOrUpdateReqDTO reqDto) { | |||
QtkAgencyMap agencyMap = qtkAgencyMapRepo.findByCenterAgencyId(reqDto.getCenterAgencyId()); | |||
if (agencyMap != null) { | |||
agencyMap.setCenterAgencyName(reqDto.getCenterAgencyName()); | |||
qtkAgencyMapRepo.merge(agencyMap); | |||
public void addOrUpdate(CenterAgencyAddOrUpdateReqDTO reqDto) throws ManagerException { | |||
reqDto.validate(); | |||
if (reqDto.getOptType() == 1){ | |||
QtkAgencyMap agencyMap = qtkAgencyMapRepo.findByCenterAgencyId(reqDto.getCenterAgencyId()); | |||
if (agencyMap != null) throw new ManagerException("此中心渠道编号也存在"); | |||
agencyMap = copyProperties(reqDto, new QtkAgencyMap()); | |||
qtkAgencyMapRepo.persist(agencyMap); | |||
}else { | |||
QtkAgencyMap qtkAgencyMap = copyProperties(reqDto, new QtkAgencyMap()); | |||
qtkAgencyMapRepo.persist(qtkAgencyMap); | |||
QtkAgencyMap qtkAgencyMap = qtkAgencyMapRepo.findById(reqDto.getId()).orElse(null); | |||
if (qtkAgencyMap == null) throw new ManagerException("此中心渠道不存在"); | |||
copyProperties(reqDto,qtkAgencyMap,"id","centerAgencyName"); | |||
qtkAgencyMapRepo.merge(qtkAgencyMap); | |||
} | |||
} | |||
@@ -1,5 +1,6 @@ | |||
package cn.com.taiji.userw.manager.centerHallAndAgency; | |||
import cn.com.taiji.common.manager.ManagerException; | |||
import cn.com.taiji.common.model.dao.Pagination; | |||
import cn.com.taiji.core.entity.basic.QtkServicehallMap; | |||
import cn.com.taiji.userw.dto.centerHallAndAgency.CenterHallOrAgencyDeleteRequestDTO; | |||
@@ -18,7 +19,7 @@ public interface CenterServiceHallManager { | |||
List<QtkServicehallMap> getCenterServiceHall(); | |||
void addOrUpdate(CenterHallAddOrUpdateReqDTO reqDto); | |||
void addOrUpdate(CenterHallAddOrUpdateReqDTO reqDto) throws ManagerException; | |||
void delete(CenterHallOrAgencyDeleteRequestDTO reqDto); | |||
@@ -1,6 +1,7 @@ | |||
package cn.com.taiji.userw.manager.centerHallAndAgency; | |||
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.entity.basic.QtkServicehallMap; | |||
import cn.com.taiji.core.repo.jpa.basic.QtkServicehallMapRepo; | |||
@@ -32,14 +33,18 @@ public class CenterServiceHallManagerImpl extends AbstractManager implements Cen | |||
} | |||
@Override | |||
public void addOrUpdate(CenterHallAddOrUpdateReqDTO reqDto){ | |||
QtkServicehallMap serviceHallId = qtkServicehallMapRepo.findByCenterServiceHallId(reqDto.getCenterServiceHallId()); | |||
if (serviceHallId != null) { | |||
serviceHallId.setCenterServicehallName(reqDto.getCenterServicehallName()); | |||
qtkServicehallMapRepo.merge(serviceHallId); | |||
}else { | |||
public void addOrUpdate(CenterHallAddOrUpdateReqDTO reqDto) throws ManagerException { | |||
reqDto.validate(); | |||
if (reqDto.getOptType() == 1){ | |||
QtkServicehallMap serviceHallId = qtkServicehallMapRepo.findByCenterServiceHallId(reqDto.getCenterServiceHallId()); | |||
if (serviceHallId != null) throw new ManagerException("此中心网点已存在"); | |||
QtkServicehallMap servicehallMap = copyProperties(reqDto, new QtkServicehallMap()); | |||
qtkServicehallMapRepo.persist(servicehallMap); | |||
}else { | |||
QtkServicehallMap servicehallMap = qtkServicehallMapRepo.findById(reqDto.getId()).orElse(null); | |||
if (servicehallMap == null) throw new ManagerException("此中心网点不存在"); | |||
copyProperties(reqDto, servicehallMap,"id","centerServiceHallId"); | |||
qtkServicehallMapRepo.merge(servicehallMap); | |||
} | |||
} | |||
@@ -5,7 +5,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties; | |||
import org.springframework.stereotype.Component; | |||
@Data | |||
@ConfigurationProperties("vfj") | |||
@ConfigurationProperties(prefix = "vfj") | |||
@Component | |||
public class VfjConfigProperties { | |||
@@ -15,7 +15,6 @@ import cn.com.taiji.inss.config.VfjConfigProperties; | |||
import cn.com.taiji.inss.manager.cache.RedisWrapManager; | |||
import cn.com.taiji.inss.manager.model.VfjCommonRequest; | |||
import cn.com.taiji.inss.manager.model.VfjCommonResponse; | |||
import cn.hutool.crypto.asymmetric.KeyType; | |||
import cn.hutool.crypto.asymmetric.SM2; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
@@ -50,14 +49,19 @@ public abstract class AbstractHandleManager extends AbstractManager { | |||
sessionId = new String(sessionIdBytes); | |||
redisWrapManager.set(VFJ_SESSION_ID_KEY, sessionId, 86400, TimeUnit.SECONDS); | |||
} | |||
logger.info("VFJ sessionId :{}", sessionId); | |||
return sessionId; | |||
} | |||
protected final String excute(InssServiceCmd cmd, BaseModel req) throws ServiceHandleException { | |||
try { | |||
VfjCommonRequest vfjRequest = new VfjCommonRequest(vfjConfig, cmd, this.getSessionId(cmd), req.toJson(), this.getTermTrace()); | |||
logger.info("vfj request:{}", vfjRequest.toJson()); | |||
VfjCommonResponse vfjResponse = HttpClientHelper.jsonPost(VfjCommonResponse.class, vfjConfig.getUrl(), vfjRequest.toJson()); | |||
logger.info("vfj response:{}", vfjResponse.toJson()); | |||
if (vfjResponse.getCode().equals("E9997")) { | |||
redisWrapManager.delete(VFJ_SESSION_ID_KEY); | |||
return this.excute(cmd, req); | |||
} else if (vfjResponse.getCode().equals("0000")) { | |||
if (!hasText(vfjResponse.getBuzzData())) | |||
@@ -85,6 +89,7 @@ public abstract class AbstractHandleManager extends AbstractManager { | |||
private String getTermTrace() { | |||
long termTrace = redisWrapManager.increment(VFJ_TERM_TRACE, 1); | |||
if (termTrace > 99999999) redisWrapManager.set(VFJ_TERM_TRACE, "1", 1, TimeUnit.DAYS); | |||
return ("00000000" + termTrace).substring(0, 8); | |||
String termTraceStr = "00000000" + termTrace; | |||
return termTraceStr.substring(termTraceStr.length() - 8); | |||
} | |||
} |