@@ -18,98 +18,55 @@ package com.trust.ywx.customer.common.enu; | |||||
public enum FirmErrEum { | public enum FirmErrEum { | ||||
// 004x000 ~ 004x010 | // 004x000 ~ 004x010 | ||||
FIRM_CLIENT_ID_NULL("004x000","厂商id不能为空"), | |||||
FIRM_APP_SECRET_NULL("004x001","APP_SECRET不能为空"), | |||||
FIRM_NAME_NULL("004x002","厂商名称不能为空"), | |||||
FIRM_PERSON("004x003","厂商联系人不能为空"), | |||||
FIRM_PHONE("004x004","厂商联系方式不能为空"), | |||||
FIRM_UNIQUEID("004x005","厂商唯一标识不能为空"), | |||||
FIRM_CERTAGENCY("004x006","凭证类型不能为空"), | |||||
FIRM_SMS_CUSTOMIZECONTENT_TOOLONG("004x007","自定义模板短信内容不能超过100个字符"), | |||||
FIRM_NAME_CHECK_ERR("004x008","厂商名称已存在") , | |||||
CLIENTID_CHECK_ERR("004x009","厂商id已存在"), | |||||
OP_FIRM_CKECK_ERROR("004x010","开放平台无此厂商账号"), | |||||
// 004x011 ~ 004x020 | |||||
FIRM_NOT_EXIST("004x011","应用厂商不存在"), | |||||
FIRM_STATUS_ERR("004x012","应用厂商状态不正确"), | |||||
FIRM_DELETE_SUBSCRIBE_ERR("004x013","订阅服务正在使用,不能删除"), | |||||
FIRM_MODIFY_SUBSCRIBE_ERR("004x014","当前服务包中有正在使用项,不能修改或者删除"), | |||||
FIRM_CLIENT_ID_NULL(1400100,"clientId不能为空"), | |||||
FIRM_APP_SECRET_NULL(1400101,"APP_SECRET不能为空"), | |||||
FIRM_NAME_NULL(1400103,"客户名称不能为空"), | |||||
FIRM_PERSON(1400104,"客户联系人不能为空"), | |||||
FIRM_PHONE(1400105,"客户联系方式不能为空"), | |||||
FIRM_CERTAGENCY(1400106,"凭证类型不能为空"), | |||||
CLIENT_ORG_CODE_NULL(1400107,"客户的统一信用代码为空"), | |||||
FIRM_UPDATE_ERR("004x015","厂商更新数据失败"), | |||||
FIRM_NOTIFY_SERVER_ERR("004x016","厂商服务包更新数据失败"), | |||||
NOTIFY_SYN_DOCTOR_URL_MISS("004x017", "缺失医师同步通知URL地址"), | |||||
NOTIFY_SYN_PATIENT_URL_MISS("004x018", "缺失患者同步通知URL地址"), | |||||
NOTIFY_RECIPE_SIGN_URL_MISS("005x004", "缺失处方签名通知URL地址"), | |||||
FIRM_STAMP_ERR("004x019", "厂商制章失败"), | |||||
FIRM_XBY_ENTERPRISE_ERR("004x020", "信步云添加企业失败"), | |||||
FIRM_CERT_REQUEST_ERR("004x021", "厂商证书申请失败"), | |||||
NOTIFY_FIRM_PDF_SIGN_URL_MISS("004x022", "缺失厂商PDF签名通知URL地址"), | |||||
FIRM_NAME_TOO_LONG("004x023","厂商名称超过30位"), | |||||
FIRM_SUB_DEPART_EXIST_ERR("004x024","厂商下面包含子厂商,不能进行删除"), | |||||
FIRM_EXIST_ERR("004x025", "同一个openID厂商存在多个"), | |||||
FIRM_EXIST_TRUST_ERR("004x026", "该厂商已注册过"), | |||||
FIRM_SYN_ERR("004x027", "修改厂商数据库失败"), | |||||
FIRM_OPENID_NULL_ERR("004x028", "openId不能为空"), | |||||
FIRM_REALNAME_ERR("004x029", "没有进行实名认证"), | |||||
INDENTITY_SUCCESS_STATUS("004x030","调用认证接口成功"), | |||||
INDENTITY_FAIL_STATUS("004x031","调用认证接口失败"), | |||||
IDENTITY_NOPASS("004x032","认证未通过"), | |||||
IDENTITY_FAIL("004x033","认证失败"), | |||||
REALNAME_SYS_ERR("004x034","实名认证暂未开通"), | |||||
FIRM_NSID_NULL_ERR("004x035","服务类型不可为空"), | |||||
FIRM_THRESHOULD_WARN_NULL_ERR("004x036","需要阀值,请填写"), | |||||
FIRM_SMS_CUSTOMIZE_CONTENT_NULL_ERR("004x037","需要短信定制的内容,请填写"), | |||||
FIRM_FEE_MODEL_NULL_ERR("004x038","已选择服务包,收费模式不能为空"), | |||||
NOTIFY_SYN_DOCTOR_ORDER_MISS("004x039", "未获取到医师用户审核异步通知的服务订单"), | |||||
NOTIFY_SERVER_URL_NULL_ERR("004x041", "服务通知地址不能为空"), | |||||
NOTIFY_URL_CONN_TIMEOUT_ERR("004x042","回调通知地址连接超时"), | |||||
FIRM_CHANNEL_TYPE_NULL_ERR("004x043","渠道类型不能为空"), | |||||
FIRM_STAMP_TYPE_NULL_ERR("004x044","请确定厂商签章类型(圆章 or 方章)"), | |||||
FIRM_CA_CHANNEL_ERR("004x045","厂商ca渠道错误"), | |||||
FIRM_CA_CHANNEL_CHANGE_ERR("004x046","厂商ca渠道不允许更换"), | |||||
FIRM_USERCERT_APP_CHANNEL_ERR("005x001","厂商用户证书app渠道添加失败"), | |||||
FIRM_USERCERT_SDK_CHANNEL_ERR("005x002","厂商用户证书sdk渠道添加失败"), | |||||
FIRM_SMS_CUSTOMIZECONTENT_TOOLONG(1400201,"自定义模板短信内容不能超过100个字符"), | |||||
FIRM_NAME_TOO_LONG(1400202,"客户名称超过30位"), | |||||
FIRM_ICON_TOOBIG(1400203,"客户icon不能超过64K"), | |||||
SUPPORT_INFO_TOOLONG(1400204,"实施支持内容及验收标准超长,仅支持最多300字符"), | |||||
FIRM_CHANNEL_ERR("005x003","厂商渠道表数据有误"), | |||||
FIRM_DOCTOR_PUBLIC_TYPE_ERR("005x004","医师产品形态参数错误"), | |||||
NOTIFY_SERVICE_SUBSCRIBE_TYPE_ERR("005x022", "回调通知地址类型有误"), | |||||
FIRM_SER_ORDER_ERR("006x001","分页查询厂商服务包订单记录数据时出错"), | |||||
FIRM_OP_PW_UPDATE_ERR("006x002","开放平台厂商密码重置失败"), | |||||
FIRM_NAME_CHECK_ERR(1400301,"客户名称已存在") , | |||||
CLIENTID_CHECK_ERR(1400302,"客户id已存在"), | |||||
CLIENT_ORG_CODE_CHECK_ERR(1400303,"客户的统一信用代码已存在"), | |||||
FIRM_GROUP_FRIM_CHECK_ERR("007x001","厂商组关联关系异常"), | |||||
FIRM_GROUP_ADD_ERR("007x002","厂商组添加失败"), | |||||
FIRM_GROUP_LEADER_MEMBER_ERR("007x003","厂商组添加失败,组员中不能含有组长"), | |||||
FIRM_GROUP_ADD_MEMBER_ERR("007x004","厂商组添加组员失败"), | |||||
AGENT_SALE_AND_OR_UPDATE_ERR("008x001","代理商销售添加或更新失败"), | |||||
AGENT_SALE_DELETE_ERR("008x002","代理商删除失败"), | |||||
FIRM_ICON_TOOBIG("008x003","厂商icon不能超过64K"), | |||||
REJECT_REASON_TOO_LONG("008x004","拒绝原因过长"), | |||||
DEPART_NAME_EMPTY("008x005","客户名称为空"), | |||||
FIRM_NOT_EXIST(1400401,"客户不存在"), | |||||
FIRM_STATUS_ERR(1400402,"客户状态不正确"), | |||||
FIRM_SUB_DEPART_EXIST_ERR(1500101,"客户下面包含子客户,不能进行删除"), | |||||
FIRM_SYN_ERR(1500201, "操作数据库失败"), | |||||
FIRM_CA_CHANNEL_CHANGE_ERR(1500301,"客户ca渠道不允许更换"), | |||||
FIRM_CA_CHANNEL_ERR(1500302,"客户ca渠道不存在"), | |||||
FIRM_GROUP_FRIM_CHECK_ERR(1500401,"客户组关联关系异常"), | |||||
FIRM_GROUP_ADD_ERR(1500402,"客户组添加失败"), | |||||
FIRM_GROUP_LEADER_MEMBER_ERR(1500403,"客户组添加失败,组员中不能含有组长"), | |||||
FIRM_GROUP_ADD_MEMBER_ERR(1500404,"客户组添加组员失败"), | |||||
CLIENT_ORG_CODE_NULL("008x006","客户的统一信用代码为空"), | |||||
SUPPORT_INFO_TOOLONG("008x007","实施支持内容及验收标准超长,仅支持最多300字符"), | |||||
CLIENT_ORG_CODE_CHECK_ERR("008x008","客户的统一信用代码已存在"), | |||||
EMAIL("008x009","邮箱格式错误"), | |||||
; | ; | ||||
/** | /** | ||||
* 状态码 | * 状态码 | ||||
*/ | */ | ||||
private String status; | |||||
private int status; | |||||
/** | /** | ||||
* 消息 | * 消息 | ||||
*/ | */ | ||||
private String message; | private String message; | ||||
FirmErrEum(String status, String message) { | |||||
private FirmErrEum(int status, String message) { | |||||
this.status = status; | this.status = status; | ||||
this.message = message; | this.message = message; | ||||
} | } | ||||
public String getStatus() { | |||||
public int getStatus() { | |||||
return status; | return status; | ||||
} | } | ||||
@@ -1,38 +0,0 @@ | |||||
package com.trust.ywx.customer.common.exception; | |||||
import com.trust.ywx.customer.common.enu.FirmErrEum; | |||||
/** | |||||
* <pre></pre> | |||||
* | |||||
* @文件名称: BizException.java | |||||
* @包 路 径: com.trust.ywx.customer.service.exceptions | |||||
* @Copyright:北京数字医信责任有限公司 (C) 2022 * | |||||
* @Description: 客户服务返回的业务异常 | |||||
* @Version: V1.0 | |||||
* @Author: hanzhenchao | |||||
* @Date:2022/6/11 21:15 | |||||
* @Modify: | |||||
*/ | |||||
public class BizException extends Exception { | |||||
private static final long serialVersionUID = -1379865823677107053L; | |||||
private String status; | |||||
public BizException(String status, String message) { | |||||
super(message); | |||||
this.status = status; | |||||
} | |||||
public BizException(FirmErrEum enu) { | |||||
super(enu.getMessage()); | |||||
this.status = enu.getMessage(); | |||||
} | |||||
public String getStatus() { | |||||
return status; | |||||
} | |||||
public String getMessage(){ | |||||
return super.getMessage(); | |||||
} | |||||
} |
@@ -1,10 +1,8 @@ | |||||
package com.trust.ywx.customer.common.model.manager.response; | package com.trust.ywx.customer.common.model.manager.response; | ||||
import com.trust.ywx.customer.common.model.manager.request.FirmPropParam; | |||||
import lombok.Data; | import lombok.Data; | ||||
import java.io.Serializable; | import java.io.Serializable; | ||||
import java.util.Date; | |||||
/** | /** | ||||
* <pre></pre> | * <pre></pre> | ||||
@@ -20,24 +20,24 @@ import java.util.Objects; | |||||
* @Modify: | * @Modify: | ||||
*/ | */ | ||||
public class FirmPropUtil { | public class FirmPropUtil { | ||||
/** | |||||
* 对外都是0/1 或者 枚举值 | |||||
* | |||||
* @param properName | |||||
* @return | |||||
*/ | |||||
public static String convertShowValue(String properName, String propValue) { | |||||
if (isYNValue(properName)) { | |||||
return "Y".equalsIgnoreCase(propValue) ? "1" : "0"; | |||||
} | |||||
if (isTrueFalseValue(properName)) { | |||||
return "true".equalsIgnoreCase(propValue) ? "1" : "0"; | |||||
} | |||||
return propValue; | |||||
} | |||||
// /** | |||||
// * 对外都是0/1 或者 枚举值 | |||||
// * | |||||
// * @param properName | |||||
// * @return | |||||
// */ | |||||
// public static String convertShowValue(String properName, String propValue) { | |||||
// if (isYNValue(properName)) { | |||||
// return "Y".equalsIgnoreCase(propValue) ? "1" : "0"; | |||||
// } | |||||
// if (isTrueFalseValue(properName)) { | |||||
// return "true".equalsIgnoreCase(propValue) ? "1" : "0"; | |||||
// } | |||||
// return propValue; | |||||
// } | |||||
/** | /** | ||||
* 对外都是0/1 或者 枚举值 | |||||
* 对外都是0/1转换为数据库存储的值 | |||||
* | * | ||||
* @param properName | * @param properName | ||||
* @return | * @return | ||||
@@ -86,6 +86,17 @@ public class FirmExtendDao { | |||||
return Arrays.asList(); | return Arrays.asList(); | ||||
} | } | ||||
for (FirmInfoExtend extend:poList) { | |||||
if("Y".equalsIgnoreCase(extend.getPropValue())){ | |||||
extend.setPropValue("1"); | |||||
}else if("N".equalsIgnoreCase(extend.getPropValue())){ | |||||
extend.setPropValue("0"); | |||||
}else if("true".equalsIgnoreCase(extend.getPropValue())){ | |||||
extend.setPropValue("1"); | |||||
}else if("false".equalsIgnoreCase(extend.getPropValue())){ | |||||
extend.setPropValue("0"); | |||||
} | |||||
} | |||||
return poList; | return poList; | ||||
} | } | ||||
@@ -1,8 +1,8 @@ | |||||
package com.trust.ywx.customer.service.manager; | package com.trust.ywx.customer.service.manager; | ||||
import com.fiftyonetrust.common.model.exception.CodeException; | |||||
import com.trust.ywx.customer.common.model.manager.request.FirmParam; | import com.trust.ywx.customer.common.model.manager.request.FirmParam; | ||||
import com.trust.ywx.customer.common.model.manager.response.FirmBaseDto; | import com.trust.ywx.customer.common.model.manager.response.FirmBaseDto; | ||||
import com.trust.ywx.customer.common.exception.BizException; | |||||
/** | /** | ||||
* <pre></pre> | * <pre></pre> | ||||
@@ -20,6 +20,7 @@ public interface FirmManagerService { | |||||
/** | /** | ||||
* 初始化客户 | * 初始化客户 | ||||
* 返回clientId和appSecret | * 返回clientId和appSecret | ||||
* | |||||
* @param clientId | * @param clientId | ||||
* @return | * @return | ||||
*/ | */ | ||||
@@ -28,12 +29,12 @@ public interface FirmManagerService { | |||||
/** | /** | ||||
* 添加可信客户 | * 添加可信客户 | ||||
*/ | */ | ||||
boolean add(FirmParam param) throws BizException; | |||||
boolean add(FirmParam param) throws CodeException; | |||||
/** | /** | ||||
* 更新可信客户 | * 更新可信客户 | ||||
*/ | */ | ||||
boolean update(FirmParam param) throws BizException; | |||||
boolean update(FirmParam param) throws CodeException; | |||||
/** | /** | ||||
* 删除可信客户 | * 删除可信客户 | ||||
@@ -1,7 +1,7 @@ | |||||
package com.trust.ywx.customer.service.manager; | package com.trust.ywx.customer.service.manager; | ||||
import com.fiftyonetrust.common.model.exception.CodeException; | |||||
import com.trust.ywx.customer.common.model.manager.request.TempFirmParam; | import com.trust.ywx.customer.common.model.manager.request.TempFirmParam; | ||||
import com.trust.ywx.customer.common.exception.BizException; | |||||
/** | /** | ||||
* <pre></pre> | * <pre></pre> | ||||
@@ -23,29 +23,29 @@ public interface TempFirmManagerService { | |||||
* 返回clientId | * 返回clientId | ||||
* | * | ||||
*/ | */ | ||||
String add(TempFirmParam param) throws BizException; | |||||
String add(TempFirmParam param) throws CodeException; | |||||
/** | /** | ||||
* 更新临时客户 | * 更新临时客户 | ||||
* @param param | * @param param | ||||
* @return | * @return | ||||
* @throws BizException | |||||
* @throws CodeException | |||||
*/ | */ | ||||
boolean update(TempFirmParam param) throws BizException; | |||||
boolean update(TempFirmParam param) throws CodeException; | |||||
/** | /** | ||||
* 审核临时客户 | * 审核临时客户 | ||||
* @param clientId | * @param clientId | ||||
* @return | * @return | ||||
*/ | */ | ||||
boolean audit(String clientId) throws BizException; | |||||
boolean audit(String clientId) throws CodeException; | |||||
/** | /** | ||||
* 拒绝临时客户 | * 拒绝临时客户 | ||||
* @param clientId | * @param clientId | ||||
* @return | * @return | ||||
*/ | */ | ||||
boolean reject(String clientId) throws BizException; | |||||
boolean reject(String clientId) throws CodeException; | |||||
/** | /** | ||||
* 删除临时客户 | * 删除临时客户 | ||||
@@ -1,7 +1,7 @@ | |||||
package com.trust.ywx.customer.service.manager.impl; | package com.trust.ywx.customer.service.manager.impl; | ||||
import com.fiftyonetrust.common.model.exception.CodeException; | |||||
import com.trust.ywx.customer.common.enu.*; | import com.trust.ywx.customer.common.enu.*; | ||||
import com.trust.ywx.customer.common.exception.BizException; | |||||
import com.trust.ywx.customer.common.model.manager.request.FirmParam; | import com.trust.ywx.customer.common.model.manager.request.FirmParam; | ||||
import com.trust.ywx.customer.common.model.manager.response.FirmBaseDto; | import com.trust.ywx.customer.common.model.manager.response.FirmBaseDto; | ||||
import com.trust.ywx.customer.common.util.FirmPropUtil; | import com.trust.ywx.customer.common.util.FirmPropUtil; | ||||
@@ -44,20 +44,16 @@ public class FirmManagerServiceImpl implements FirmManagerService { | |||||
@Resource | @Resource | ||||
FirmExtendDao firmExtendDao; | FirmExtendDao firmExtendDao; | ||||
// @Resource | |||||
// private Config config; | |||||
@Override | @Override | ||||
public FirmBaseDto init(String clientId) { | public FirmBaseDto init(String clientId) { | ||||
FirmBaseDto dto = new FirmBaseDto(); | FirmBaseDto dto = new FirmBaseDto(); | ||||
dto.setClientId(UniqueIdUtils.generateClientId()); | dto.setClientId(UniqueIdUtils.generateClientId()); | ||||
dto.setAppSecret(UniqueIdUtils.generateAppSecret()); | dto.setAppSecret(UniqueIdUtils.generateAppSecret()); | ||||
// TODO 其他默认选项 | |||||
return dto; | return dto; | ||||
} | } | ||||
@Override | @Override | ||||
public boolean add(FirmParam param) throws BizException { | |||||
public boolean add(FirmParam param) throws CodeException { | |||||
// 参数校验 | // 参数校验 | ||||
checkParam(param, true); | checkParam(param, true); | ||||
// 业务校验 | // 业务校验 | ||||
@@ -66,59 +62,56 @@ public class FirmManagerServiceImpl implements FirmManagerService { | |||||
return doAddTrust(param); | return doAddTrust(param); | ||||
} | } | ||||
private void checkParam(FirmParam param, boolean isAdd) throws BizException { | |||||
private void checkParam(FirmParam param, boolean isAdd) throws CodeException { | |||||
if (StringUtils.isBlank(param.getClientId())) { | if (StringUtils.isBlank(param.getClientId())) { | ||||
throw new BizException(FirmErrEum.FIRM_CLIENT_ID_NULL); | |||||
throw new CodeException(FirmErrEum.FIRM_CLIENT_ID_NULL.getStatus(),FirmErrEum.FIRM_CLIENT_ID_NULL.getMessage()); | |||||
} | } | ||||
if (StringUtils.isBlank(param.getAppSecret())) { | if (StringUtils.isBlank(param.getAppSecret())) { | ||||
throw new BizException(FirmErrEum.FIRM_APP_SECRET_NULL); | |||||
throw new CodeException(FirmErrEum.FIRM_APP_SECRET_NULL.getStatus(),FirmErrEum.FIRM_APP_SECRET_NULL.getMessage()); | |||||
} | } | ||||
if (StringUtils.isBlank(param.getFirmName())) { | if (StringUtils.isBlank(param.getFirmName())) { | ||||
throw new BizException(FirmErrEum.FIRM_NAME_NULL); | |||||
throw new CodeException(FirmErrEum.FIRM_NAME_NULL.getStatus(),FirmErrEum.FIRM_NAME_NULL.getMessage()); | |||||
} | } | ||||
if (StringUtils.isNotBlank(param.getFirmName()) && param.getFirmName().length() > 30) { | if (StringUtils.isNotBlank(param.getFirmName()) && param.getFirmName().length() > 30) { | ||||
throw new BizException(FirmErrEum.FIRM_NAME_TOO_LONG); | |||||
throw new CodeException(FirmErrEum.FIRM_NAME_TOO_LONG.getStatus(),FirmErrEum.FIRM_NAME_TOO_LONG.getMessage()); | |||||
} | } | ||||
// if (StringUtils.isBlank(param.getFirmPerson())) { | // if (StringUtils.isBlank(param.getFirmPerson())) { | ||||
// throw new BizException(FirmErrEum.FIRM_PERSON); | |||||
// throw new CodeException(FirmErrEum.FIRM_PERSON); | |||||
// } | // } | ||||
// if (!ValidateUtil.checkMobile(param.getFirmPhone())) { | // if (!ValidateUtil.checkMobile(param.getFirmPhone())) { | ||||
// throw new BizException(FirmErrEum.FIRM_PHONE); | |||||
// throw new CodeException(FirmErrEum.FIRM_PHONE); | |||||
// } | // } | ||||
if (StringUtils.isBlank(param.getFirmOrgCode())) { | if (StringUtils.isBlank(param.getFirmOrgCode())) { | ||||
throw new BizException(FirmErrEum.CLIENT_ORG_CODE_NULL); | |||||
throw new CodeException(FirmErrEum.CLIENT_ORG_CODE_NULL.getStatus(),FirmErrEum.CLIENT_ORG_CODE_NULL.getMessage()); | |||||
} | } | ||||
if (CommonStatusEnum.YES.getCode().equals(param.getSmsCustomize()) && StringUtils.isNotBlank(param.getSmsCustomizeContent()) | if (CommonStatusEnum.YES.getCode().equals(param.getSmsCustomize()) && StringUtils.isNotBlank(param.getSmsCustomizeContent()) | ||||
&& param.getSmsCustomizeContent().length() > 101) { | && param.getSmsCustomizeContent().length() > 101) { | ||||
throw new BizException(FirmErrEum.FIRM_SMS_CUSTOMIZECONTENT_TOOLONG); | |||||
throw new CodeException(FirmErrEum.FIRM_SMS_CUSTOMIZECONTENT_TOOLONG.getStatus(),FirmErrEum.FIRM_SMS_CUSTOMIZECONTENT_TOOLONG.getMessage()); | |||||
} | } | ||||
// if (!StringUtils.isBlank(param.getDoctorProductType()) && !publicProductType.equals("SDK") | // if (!StringUtils.isBlank(param.getDoctorProductType()) && !publicProductType.equals("SDK") | ||||
// && !publicProductType.equals("H5")) { | // && !publicProductType.equals("H5")) { | ||||
// throw new BizException(GlobalExcpEnum.PARAM_ERROR); | |||||
// throw new CodeException(GlobalExcpEnum.PARAM_ERROR); | |||||
// } | // } | ||||
/*cachannel校验*/ | /*cachannel校验*/ | ||||
if (param.getCaChannel() != null && null == CaChannelEnum.getDes(param.getCaChannel())) { | if (param.getCaChannel() != null && null == CaChannelEnum.getDes(param.getCaChannel())) { | ||||
throw new BizException(FirmErrEum.FIRM_CA_CHANNEL_ERR); | |||||
throw new CodeException(FirmErrEum.FIRM_CA_CHANNEL_ERR.getStatus(),FirmErrEum.FIRM_CA_CHANNEL_ERR.getMessage()); | |||||
} | } | ||||
if (StringUtils.isNotBlank(param.getAppIcon())) { | if (StringUtils.isNotBlank(param.getAppIcon())) { | ||||
if (param.getAppIcon().length() > 64 * 1024) { | if (param.getAppIcon().length() > 64 * 1024) { | ||||
throw new BizException(FirmErrEum.FIRM_ICON_TOOBIG); | |||||
throw new CodeException(FirmErrEum.FIRM_ICON_TOOBIG.getStatus(),FirmErrEum.FIRM_ICON_TOOBIG.getMessage()); | |||||
} | } | ||||
} | } | ||||
if (param.getTechSupportInfo() != null && param.getTechSupportInfo().length() > 300) { | if (param.getTechSupportInfo() != null && param.getTechSupportInfo().length() > 300) { | ||||
throw new BizException(FirmErrEum.SUPPORT_INFO_TOOLONG); | |||||
throw new CodeException(FirmErrEum.SUPPORT_INFO_TOOLONG.getStatus(),FirmErrEum.SUPPORT_INFO_TOOLONG.getMessage()); | |||||
} | } | ||||
// 其他属性枚举值范围校验 TODO | |||||
} | } | ||||
@Override | @Override | ||||
public boolean update(FirmParam param) throws BizException { | |||||
public boolean update(FirmParam param) throws CodeException { | |||||
// 参数校验 | // 参数校验 | ||||
checkParam(param, true); | checkParam(param, true); | ||||
// 业务校验 | // 业务校验 | ||||
@@ -177,21 +170,21 @@ public class FirmManagerServiceImpl implements FirmManagerService { | |||||
* | * | ||||
* @param param | * @param param | ||||
*/ | */ | ||||
private void checkAddBiz(FirmParam param) throws BizException { | |||||
private void checkAddBiz(FirmParam param) throws CodeException { | |||||
//clientId冲突校验 | //clientId冲突校验 | ||||
FirmInfo firmInfo = firmDao.getFrimByClientId(param.getClientId()); | FirmInfo firmInfo = firmDao.getFrimByClientId(param.getClientId()); | ||||
if (null != firmInfo) { | if (null != firmInfo) { | ||||
throw new BizException(FirmErrEum.CLIENTID_CHECK_ERR); | |||||
throw new CodeException(FirmErrEum.CLIENTID_CHECK_ERR.getStatus(),FirmErrEum.CLIENTID_CHECK_ERR.getMessage()); | |||||
} | } | ||||
// OrgCode冲突校验 | // OrgCode冲突校验 | ||||
List<FirmInfo> list = firmDao.getListByOrgCode(param.getFirmOrgCode()); | List<FirmInfo> list = firmDao.getListByOrgCode(param.getFirmOrgCode()); | ||||
if (null != list && list.size() > 0) { | if (null != list && list.size() > 0) { | ||||
throw new BizException(FirmErrEum.CLIENT_ORG_CODE_CHECK_ERR); | |||||
throw new CodeException(FirmErrEum.CLIENT_ORG_CODE_CHECK_ERR.getStatus(),FirmErrEum.CLIENT_ORG_CODE_CHECK_ERR.getMessage()); | |||||
} | } | ||||
// firmName冲突校验 | // firmName冲突校验 | ||||
list = firmDao.getListByFirmName(param.getFirmName()); | list = firmDao.getListByFirmName(param.getFirmName()); | ||||
if (null != list && list.size() > 0) { | if (null != list && list.size() > 0) { | ||||
throw new BizException(FirmErrEum.FIRM_NAME_CHECK_ERR); | |||||
throw new CodeException(FirmErrEum.FIRM_NAME_CHECK_ERR.getStatus(),FirmErrEum.FIRM_NAME_CHECK_ERR.getMessage()); | |||||
} | } | ||||
} | } | ||||
@@ -200,23 +193,23 @@ public class FirmManagerServiceImpl implements FirmManagerService { | |||||
* | * | ||||
* @param param | * @param param | ||||
*/ | */ | ||||
private void checkUpdateBiz(FirmParam param) throws BizException { | |||||
private void checkUpdateBiz(FirmParam param) throws CodeException { | |||||
//clientId冲突校验 | //clientId冲突校验 | ||||
FirmInfo firmInfo = firmDao.getFrimByClientId(param.getClientId()); | FirmInfo firmInfo = firmDao.getFrimByClientId(param.getClientId()); | ||||
if (null == firmInfo) { | if (null == firmInfo) { | ||||
throw new BizException(FirmErrEum.FIRM_NOT_EXIST); | |||||
throw new CodeException(FirmErrEum.FIRM_NOT_EXIST.getStatus(),FirmErrEum.FIRM_NOT_EXIST.getMessage()); | |||||
} | } | ||||
// OrgCode冲突校验 | // OrgCode冲突校验 | ||||
List<FirmInfo> list = firmDao.getListByOrgCode(param.getFirmOrgCode()); | List<FirmInfo> list = firmDao.getListByOrgCode(param.getFirmOrgCode()); | ||||
if (list != null && (list.size() > 1 || Objects.equals(param.getClientId(), list.get(0).getClientId()))) { | if (list != null && (list.size() > 1 || Objects.equals(param.getClientId(), list.get(0).getClientId()))) { | ||||
throw new BizException(FirmErrEum.CLIENT_ORG_CODE_CHECK_ERR); | |||||
throw new CodeException(FirmErrEum.CLIENT_ORG_CODE_CHECK_ERR.getStatus(),FirmErrEum.CLIENT_ORG_CODE_CHECK_ERR.getMessage()); | |||||
} | } | ||||
// firmName冲突校验 | // firmName冲突校验 | ||||
list = firmDao.getListByFirmName(param.getFirmName()); | list = firmDao.getListByFirmName(param.getFirmName()); | ||||
if (list != null && (list.size() > 1 || Objects.equals(param.getClientId(), list.get(0).getClientId()))) { | if (list != null && (list.size() > 1 || Objects.equals(param.getClientId(), list.get(0).getClientId()))) { | ||||
throw new BizException(FirmErrEum.FIRM_NAME_CHECK_ERR); | |||||
throw new CodeException(FirmErrEum.FIRM_NAME_CHECK_ERR.getStatus(),FirmErrEum.FIRM_NAME_CHECK_ERR.getMessage()); | |||||
} | } | ||||
} | } | ||||
@@ -1,7 +1,7 @@ | |||||
package com.trust.ywx.customer.service.manager.impl; | package com.trust.ywx.customer.service.manager.impl; | ||||
import com.fiftyonetrust.common.model.exception.CodeException; | |||||
import com.trust.ywx.customer.common.enu.*; | import com.trust.ywx.customer.common.enu.*; | ||||
import com.trust.ywx.customer.common.exception.BizException; | |||||
import com.trust.ywx.customer.common.model.manager.request.TempFirmParam; | import com.trust.ywx.customer.common.model.manager.request.TempFirmParam; | ||||
import com.trust.ywx.customer.common.model.manager.request.FirmParam; | import com.trust.ywx.customer.common.model.manager.request.FirmParam; | ||||
import com.trust.ywx.customer.commons.UniqueIdUtils; | import com.trust.ywx.customer.commons.UniqueIdUtils; | ||||
@@ -48,7 +48,7 @@ public class TempFirmManagerServiceImpl implements TempFirmManagerService { | |||||
@Override | @Override | ||||
public String add(TempFirmParam param) throws BizException { | |||||
public String add(TempFirmParam param) throws CodeException { | |||||
// 参数校验 | // 参数校验 | ||||
checkParam(param, true); | checkParam(param, true); | ||||
// 业务校验 | // 业务校验 | ||||
@@ -59,7 +59,7 @@ public class TempFirmManagerServiceImpl implements TempFirmManagerService { | |||||
@Override | @Override | ||||
@CacheEvict(cacheNames = "firm", key = "'temp:'+#param.clientId") | @CacheEvict(cacheNames = "firm", key = "'temp:'+#param.clientId") | ||||
public boolean update(TempFirmParam param) throws BizException { | |||||
public boolean update(TempFirmParam param) throws CodeException { | |||||
// 参数校验 | // 参数校验 | ||||
checkParam(param, false); | checkParam(param, false); | ||||
// 业务校验 | // 业务校验 | ||||
@@ -69,11 +69,11 @@ public class TempFirmManagerServiceImpl implements TempFirmManagerService { | |||||
} | } | ||||
@Override | @Override | ||||
public boolean audit(String clientId) throws BizException { | |||||
public boolean audit(String clientId) throws CodeException { | |||||
// 校验clientId | // 校验clientId | ||||
FirmInfoTemp tempFirm = tempFirmDao.getByClientId(clientId); | FirmInfoTemp tempFirm = tempFirmDao.getByClientId(clientId); | ||||
if (null == tempFirm) { | if (null == tempFirm) { | ||||
throw new BizException(FirmErrEum.FIRM_NOT_EXIST); | |||||
throw new CodeException(FirmErrEum.FIRM_NOT_EXIST.getStatus(),FirmErrEum.FIRM_NOT_EXIST.getMessage()); | |||||
} | } | ||||
// 封装可信客户参数 | // 封装可信客户参数 | ||||
FirmParam firmParam = buildTrustFirmParam(tempFirm); | FirmParam firmParam = buildTrustFirmParam(tempFirm); | ||||
@@ -83,11 +83,11 @@ public class TempFirmManagerServiceImpl implements TempFirmManagerService { | |||||
@Override | @Override | ||||
public boolean reject(String clientId) throws BizException { | |||||
public boolean reject(String clientId) throws CodeException { | |||||
// 业务校验 | // 业务校验 | ||||
FirmInfoTemp tempFirm = tempFirmDao.getByClientId(clientId); | FirmInfoTemp tempFirm = tempFirmDao.getByClientId(clientId); | ||||
if (null == tempFirm) { | if (null == tempFirm) { | ||||
throw new BizException(FirmErrEum.CLIENTID_CHECK_ERR); | |||||
throw new CodeException(FirmErrEum.CLIENTID_CHECK_ERR.getStatus(),FirmErrEum.CLIENTID_CHECK_ERR.getMessage()); | |||||
} | } | ||||
int num = tempFirmDao.auditReject(clientId); | int num = tempFirmDao.auditReject(clientId); | ||||
@@ -106,23 +106,23 @@ public class TempFirmManagerServiceImpl implements TempFirmManagerService { | |||||
return tempFirmDao.update(temp) == 1; | return tempFirmDao.update(temp) == 1; | ||||
} | } | ||||
private void checkBiz(TempFirmParam param, boolean isAdd) throws BizException { | |||||
private void checkBiz(TempFirmParam param, boolean isAdd) throws CodeException { | |||||
// clientId | // clientId | ||||
if (!isAdd) { | if (!isAdd) { | ||||
FirmInfoTemp temp = tempFirmDao.getByClientId(param.getClientId()); | FirmInfoTemp temp = tempFirmDao.getByClientId(param.getClientId()); | ||||
if (null == temp) { | if (null == temp) { | ||||
throw new BizException(FirmErrEum.FIRM_NOT_EXIST); | |||||
throw new CodeException(FirmErrEum.FIRM_NOT_EXIST.getStatus(),FirmErrEum.FIRM_NOT_EXIST.getMessage()); | |||||
} | } | ||||
} | } | ||||
// firmName冲突校验 | // firmName冲突校验 | ||||
List<FirmInfoTemp> list = tempFirmDao.getListByFirmName(param.getFirmName()); | List<FirmInfoTemp> list = tempFirmDao.getListByFirmName(param.getFirmName()); | ||||
if (null != list && list.size() > 0) { | if (null != list && list.size() > 0) { | ||||
if (isAdd) { | if (isAdd) { | ||||
throw new BizException(FirmErrEum.FIRM_NAME_CHECK_ERR); | |||||
throw new CodeException(FirmErrEum.FIRM_NAME_CHECK_ERR.getStatus(),FirmErrEum.FIRM_NAME_CHECK_ERR.getMessage()); | |||||
} else { | } else { | ||||
for (FirmInfoTemp temp : list) { | for (FirmInfoTemp temp : list) { | ||||
if (!Objects.equals(temp.getClientId(), param.getClientId())) { | if (!Objects.equals(temp.getClientId(), param.getClientId())) { | ||||
throw new BizException(FirmErrEum.FIRM_NAME_CHECK_ERR); | |||||
throw new CodeException(FirmErrEum.FIRM_NAME_CHECK_ERR.getStatus(),FirmErrEum.FIRM_NAME_CHECK_ERR.getMessage()); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -167,7 +167,7 @@ public class TempFirmManagerServiceImpl implements TempFirmManagerService { | |||||
// 2、更新临时客户状态为已审核 | // 2、更新临时客户状态为已审核 | ||||
int num = tempFirmDao.auditPass(temp.getClientId()); | int num = tempFirmDao.auditPass(temp.getClientId()); | ||||
if (num != 1) { | if (num != 1) { | ||||
throw new BizException(FirmErrEum.FIRM_SYN_ERR); | |||||
throw new CodeException(FirmErrEum.FIRM_SYN_ERR.getStatus(),FirmErrEum.FIRM_SYN_ERR.getMessage()); | |||||
} | } | ||||
} | } | ||||
}); | }); | ||||
@@ -229,15 +229,15 @@ public class TempFirmManagerServiceImpl implements TempFirmManagerService { | |||||
* @param param | * @param param | ||||
* @param isAdd | * @param isAdd | ||||
*/ | */ | ||||
private void checkParam(TempFirmParam param, boolean isAdd) throws BizException { | |||||
private void checkParam(TempFirmParam param, boolean isAdd) throws CodeException { | |||||
if (!isAdd && StringUtils.isBlank(param.getClientId())) { | if (!isAdd && StringUtils.isBlank(param.getClientId())) { | ||||
throw new BizException(FirmErrEum.FIRM_CLIENT_ID_NULL); | |||||
throw new CodeException(FirmErrEum.FIRM_CLIENT_ID_NULL.getStatus(),FirmErrEum.FIRM_CLIENT_ID_NULL.getMessage()); | |||||
} | } | ||||
if (StringUtils.isBlank(param.getFirmName())) { | if (StringUtils.isBlank(param.getFirmName())) { | ||||
throw new BizException(FirmErrEum.FIRM_NAME_NULL); | |||||
throw new CodeException(FirmErrEum.FIRM_NAME_NULL.getStatus(),FirmErrEum.FIRM_NAME_NULL.getMessage()); | |||||
} | } | ||||
if (StringUtils.isNotEmpty(param.getFirmName()) && param.getFirmName().length() > 30) { | if (StringUtils.isNotEmpty(param.getFirmName()) && param.getFirmName().length() > 30) { | ||||
throw new BizException(FirmErrEum.FIRM_NAME_TOO_LONG); | |||||
throw new CodeException(FirmErrEum.FIRM_NAME_TOO_LONG.getStatus(),FirmErrEum.FIRM_NAME_TOO_LONG.getMessage()); | |||||
} | } | ||||
} | } | ||||
@@ -34,11 +34,16 @@ public interface FirmQueryService { | |||||
PageBean<FirmBaseDto> getList(SearchFirmParam param); | PageBean<FirmBaseDto> getList(SearchFirmParam param); | ||||
/** | /** | ||||
* 获取可信客户详情 (不包括证书和厂商图标信息) | |||||
* 获取可信客户基本信息 | |||||
* @param clientId | * @param clientId | ||||
* @return | * @return | ||||
*/ | */ | ||||
FirmBaseDto getBaseByClientId(String clientId); | FirmBaseDto getBaseByClientId(String clientId); | ||||
/** | |||||
* 获取可信客户详情 | |||||
* @param clientId | |||||
* @return | |||||
*/ | |||||
FirmWithExtendDto getByClientId(String clientId); | FirmWithExtendDto getByClientId(String clientId); | ||||
/** | /** | ||||
@@ -217,9 +217,6 @@ public class FirmQueryServiceImpl implements FirmQueryService { | |||||
Map<String, String> map = new HashMap<>(64); | Map<String, String> map = new HashMap<>(64); | ||||
// 1、从firm_info_extend获取全量属性 | // 1、从firm_info_extend获取全量属性 | ||||
List<FirmInfoExtend> extendList = firmExtendDao.getListByClientId(clientId); | List<FirmInfoExtend> extendList = firmExtendDao.getListByClientId(clientId); | ||||
for (FirmInfoExtend extendPo : extendList) { | |||||
map.put(extendPo.getPropName(), FirmPropUtil.convertShowValue(extendPo.getPropName(), extendPo.getPropValue())); | |||||
} | |||||
//2、从firm_usercert_channel 获取医师产品形态属性 | //2、从firm_usercert_channel 获取医师产品形态属性 | ||||
List<FirmUsercertChannel> doctorProductList = doctorProductTypeDao.getByClientId(clientId); | List<FirmUsercertChannel> doctorProductList = doctorProductTypeDao.getByClientId(clientId); | ||||
@@ -1,12 +1,12 @@ | |||||
package com.trust.ywx.customer; | package com.trust.ywx.customer; | ||||
import com.alibaba.fastjson.JSONObject; | import com.alibaba.fastjson.JSONObject; | ||||
import com.fiftyonetrust.common.model.exception.CodeException; | |||||
import com.fiftyonetrust.common.model.param.PageParam; | import com.fiftyonetrust.common.model.param.PageParam; | ||||
import com.trust.ywx.customer.common.enu.CaChannelEnum; | import com.trust.ywx.customer.common.enu.CaChannelEnum; | ||||
import com.trust.ywx.customer.common.enu.CommonStatusEnum; | import com.trust.ywx.customer.common.enu.CommonStatusEnum; | ||||
import com.trust.ywx.customer.common.enu.ProjectStatusEnum; | import com.trust.ywx.customer.common.enu.ProjectStatusEnum; | ||||
import com.trust.ywx.customer.common.model.manager.request.FirmParam; | import com.trust.ywx.customer.common.model.manager.request.FirmParam; | ||||
import com.trust.ywx.customer.common.exception.BizException; | |||||
import com.trust.ywx.customer.common.model.manager.response.FirmBaseDto; | import com.trust.ywx.customer.common.model.manager.response.FirmBaseDto; | ||||
import com.trust.ywx.customer.common.model.query.request.SearchFirmParam; | import com.trust.ywx.customer.common.model.query.request.SearchFirmParam; | ||||
import com.trust.ywx.customer.common.model.PageBean; | import com.trust.ywx.customer.common.model.PageBean; | ||||
@@ -40,14 +40,14 @@ public class FirmServiceTests { | |||||
FirmQueryService queryService; | FirmQueryService queryService; | ||||
@Test | @Test | ||||
public void addTest() throws BizException { | |||||
public void addTest() throws CodeException { | |||||
FirmParam param = new FirmParam(); | FirmParam param = new FirmParam(); | ||||
param.setClientId("12345"); | param.setClientId("12345"); | ||||
param.setAppSecret("123456"); | param.setAppSecret("123456"); | ||||
param.setFirmOrgCode("678910"); | param.setFirmOrgCode("678910"); | ||||
param.setFirmName("莆田医院"); | param.setFirmName("莆田医院"); | ||||
param.setProjectStatus(ProjectStatusEnum.NORMAL.getCode()); | param.setProjectStatus(ProjectStatusEnum.NORMAL.getCode()); | ||||
param.setCaChannel(CaChannelEnum.BJCA.getChannel()); | |||||
param.setCaChannel(null); | |||||
param.setTechSupport(CommonStatusEnum.NO.getCode()); | param.setTechSupport(CommonStatusEnum.NO.getCode()); | ||||
param.setSmsSend(CommonStatusEnum.YES.getCode()); | param.setSmsSend(CommonStatusEnum.YES.getCode()); | ||||
@@ -63,6 +63,12 @@ public class FirmServiceTests { | |||||
} | } | ||||
@Test | @Test | ||||
public void getExtendTest(){ | |||||
// queryService.getAllProp("2022062318060473"); | |||||
System.out.println(queryService.getAllProp("2022062318060473")); | |||||
} | |||||
@Test | |||||
public void queryListTest(){ | public void queryListTest(){ | ||||
SearchFirmParam param = new SearchFirmParam(); | SearchFirmParam param = new SearchFirmParam(); | ||||
PageParam pageParam = new PageParam(); | PageParam pageParam = new PageParam(); | ||||
@@ -1,12 +1,11 @@ | |||||
package com.trust.ywx.customer; | package com.trust.ywx.customer; | ||||
import com.trust.ywx.customer.common.exception.BizException; | |||||
import com.fiftyonetrust.common.model.exception.CodeException; | |||||
import com.trust.ywx.customer.common.model.manager.request.TempFirmParam; | import com.trust.ywx.customer.common.model.manager.request.TempFirmParam; | ||||
import com.trust.ywx.customer.common.model.manager.response.TempFirmDto; | import com.trust.ywx.customer.common.model.manager.response.TempFirmDto; | ||||
import com.trust.ywx.customer.common.model.query.request.SearchTempFirmParam; | import com.trust.ywx.customer.common.model.query.request.SearchTempFirmParam; | ||||
import com.trust.ywx.customer.common.model.PageBean; | import com.trust.ywx.customer.common.model.PageBean; | ||||
import com.trust.ywx.customer.service.manager.TempFirmManagerService; | import com.trust.ywx.customer.service.manager.TempFirmManagerService; | ||||
import com.trust.ywx.customer.service.query.FirmQueryService; | |||||
import com.trust.ywx.customer.service.query.TempFirmQueryService; | import com.trust.ywx.customer.service.query.TempFirmQueryService; | ||||
import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
import org.junit.jupiter.api.Test; | import org.junit.jupiter.api.Test; | ||||
@@ -36,7 +35,7 @@ public class TempFirmServiceTests { | |||||
TempFirmQueryService tempQueryService; | TempFirmQueryService tempQueryService; | ||||
@Test | @Test | ||||
public void addTest() throws BizException { | |||||
public void addTest() throws CodeException { | |||||
TempFirmParam param = new TempFirmParam(); | TempFirmParam param = new TempFirmParam(); | ||||
param.setFirmOrgCode("orgCode3"); | param.setFirmOrgCode("orgCode3"); | ||||
param.setFirmName("数字认证推送医院3"); | param.setFirmName("数字认证推送医院3"); | ||||
@@ -51,7 +50,7 @@ public class TempFirmServiceTests { | |||||
@Test | @Test | ||||
public void updateTest() throws BizException { | |||||
public void updateTest() throws CodeException { | |||||
TempFirmParam param = new TempFirmParam(); | TempFirmParam param = new TempFirmParam(); | ||||
param.setClientId("2022062117474932"); | param.setClientId("2022062117474932"); | ||||
param.setFirmOrgCode("orgCode"); | param.setFirmOrgCode("orgCode"); | ||||
@@ -67,7 +66,7 @@ public class TempFirmServiceTests { | |||||
} | } | ||||
@Test | @Test | ||||
public void auditTest() throws BizException { | |||||
public void auditTest() throws CodeException { | |||||
System.out.println("///////////////////////////////////"); | System.out.println("///////////////////////////////////"); | ||||
System.out.println(managerService.audit("2022062318060473")); | System.out.println(managerService.audit("2022062318060473")); | ||||
System.out.println("///////////////////////////////////"); | System.out.println("///////////////////////////////////"); | ||||
@@ -75,7 +74,7 @@ public class TempFirmServiceTests { | |||||
} | } | ||||
@Test | @Test | ||||
public void rejectTest() throws BizException { | |||||
public void rejectTest() throws CodeException { | |||||
System.out.println(managerService.reject("2022062117474932")); | System.out.println(managerService.reject("2022062117474932")); | ||||
} | } | ||||