Commit 3a4b005a by 徐高华

保存校验

parent b7ca6282
......@@ -44,6 +44,7 @@ import com.gic.haoban.manage.api.service.hm.HmPageApiService;
import com.gic.haoban.manage.api.service.hm.WxUserAddLogApiService;
import com.gic.haoban.manage.api.service.out.WelcomeApiService;
import com.gic.haoban.manage.api.util.DataHttpUtil;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import com.gic.haoban.manage.web.log.LogRecordUserServiceImpl;
import com.gic.haoban.manage.web.qo.hm.data.HmLinkChartQO;
import com.gic.haoban.manage.web.qo.hm.data.HmLinkClerkListQO;
......@@ -69,6 +70,7 @@ import com.gic.member.tag.api.service.MemberTagApiService;
*/
@RestController
@RequestMapping("/hm/link")
@SuppressWarnings("unchecked")
public class HmLinkController {
private static org.apache.logging.log4j.Logger logger = LogManager.getLogger(HmLinkController.class);
......@@ -87,6 +89,10 @@ public class HmLinkController {
@GicLogRecord(value = "${#logValue}", category = GicLogRecordCategoryEnum.HUOMA, optType = GicLogRecordOptTypeEnum.HM_LINK_ADD, userFunc = LogRecordUserServiceImpl.class, optPage = "引流链接-新建链接")
public RestResponse<Object> save(@RequestBody HmLinkDTO dto) {
WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
RestResponse<Object> checkResp = this.saveCheck(dto) ;
if(!"0".equals(checkResp.getCode())) {
return checkResp ;
}
dto.setCreatorId(loginUser.getClerkId());
dto.setCreatorName(loginUser.getClerkName());
dto.setModifierId(loginUser.getClerkId());
......@@ -109,6 +115,10 @@ public class HmLinkController {
public RestResponse<Object> update(@RequestBody HmLinkDTO dto) {
Long linkId = dto.getLinkId();
WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
RestResponse<Object> checkResp = this.saveCheck(dto) ;
if(!"0".equals(checkResp.getCode())) {
return checkResp ;
}
ServiceResponse<HmLinkDTO> resp = this.hmLinkApiService.getByLinkId(loginUser.getWxEnterpriseId(),
loginUser.getEnterpriseId(), linkId);
if (!resp.isSuccess()) {
......@@ -131,7 +141,27 @@ public class HmLinkController {
}
return RestResponse.failure(saveResp.getCode(), saveResp.getResult());
}
// 链接类型,名称,标签,分配规则,落地页模板
private RestResponse<Object> saveCheck(HmLinkDTO dto) {
if(StringUtils.isEmpty(dto.getName())) {
return RestResponse.failure("9999", "链接名称不能为空") ;
}
if(StringUtils.isEmpty(dto.getMemberLabelId())) {
return RestResponse.failure("9999", "链接标签不能为空") ;
}
if(null == dto.getPageId()) {
return RestResponse.failure("9999", "请选择落地页模板") ;
}
if(null == dto.getLinkId()) {
return RestResponse.failure("9999", "请选择链接类型") ;
}
if(StringUtils.isEmpty(dto.getStoreRuleJson()) || StringUtils.isEmpty(dto.getCustomRuleJson())) {
return RestResponse.failure("9999", "请选择分配规则") ;
}
return RestResponse.successResult() ;
}
private String getUpdateLog(HmLinkDTO oldDTO, HmLinkDTO newDTO) {
String wxEnterpriseId = newDTO.getWxEnterpriseId();
String enterpriseId = newDTO.getEnterpriseId();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment