| @@ -35,14 +35,13 @@ public class WxMallApplyController extends BaseController { | |||||
| public ResultData add(@RequestBody WxMallApply wxMallApply) { | public ResultData add(@RequestBody WxMallApply wxMallApply) { | ||||
| //Assert.notNull(wxMallApply.getName(), "角色名不能为空"); | //Assert.notNull(wxMallApply.getName(), "角色名不能为空"); | ||||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | ||||
| wxMallApplyService.saveOrUpdate(wxMallApply); | |||||
| return new ResultData(); | |||||
| return wxMallApplyService.saveOrUpdate(wxMallApply); | |||||
| } | } | ||||
| @PostMapping("update") | @PostMapping("update") | ||||
| public ResultData update(@RequestBody WxMallApply wxMallApply) { | public ResultData update(@RequestBody WxMallApply wxMallApply) { | ||||
| wxMallApplyService.saveOrUpdate(wxMallApply); | |||||
| return new ResultData(); | |||||
| return wxMallApplyService.saveOrUpdate(wxMallApply); | |||||
| } | } | ||||
| @GetMapping("/del") | @GetMapping("/del") | ||||
| @@ -186,7 +186,7 @@ public enum ErrorCode{ | |||||
| MSG_TEMPLATE_REPEAT(12101,"您添加的短信模板已存在"), | MSG_TEMPLATE_REPEAT(12101,"您添加的短信模板已存在"), | ||||
| MSG_SIGNATURE_CONTENT_ERROR(12102,"短信签名或内容错误"), | MSG_SIGNATURE_CONTENT_ERROR(12102,"短信签名或内容错误"), | ||||
| MSG_TEMPLATE_CREATE_ERROR(12103,"创建模板失败"), | MSG_TEMPLATE_CREATE_ERROR(12103,"创建模板失败"), | ||||
| MSG_VERIFY_CODE_NOT_FOUND(12104,"短信验证码不存在或失效"), | |||||
| ; | ; | ||||
| @@ -36,8 +36,9 @@ public class WxMallApply implements Serializable { | |||||
| public void setIds(List<String> ids) { | public void setIds(List<String> ids) { | ||||
| this.ids = ids; | this.ids = ids; | ||||
| } | } | ||||
| @Transient | |||||
| protected String verifyCode; | |||||
| /*购物中心名称**/ | /*购物中心名称**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="购物中心名称",name="mallName") | @io.swagger.annotations.ApiModelProperty(value="购物中心名称",name="mallName") | ||||
| @@ -76,7 +77,13 @@ public class WxMallApply implements Serializable { | |||||
| applyDate = _applyDate; | applyDate = _applyDate; | ||||
| } | } | ||||
| public String getVerifyCode() { | |||||
| return verifyCode; | |||||
| } | |||||
| public void setVerifyCode(String verifyCode) { | |||||
| this.verifyCode = verifyCode; | |||||
| } | |||||
| public static enum Field | public static enum Field | ||||
| { | { | ||||
| @@ -28,9 +28,9 @@ public interface WxMallApplyService { | |||||
| /** | /** | ||||
| * 保存或更新实体 | * 保存或更新实体 | ||||
| * | * | ||||
| * @param record | |||||
| */ | |||||
| void saveOrUpdate(WxMallApply record); | |||||
| * @param record | |||||
| */ | |||||
| ResultData saveOrUpdate(WxMallApply record); | |||||
| /** | /** | ||||
| * 根据Id删除实体 | * 根据Id删除实体 | ||||
| @@ -53,7 +53,18 @@ public class WxMallApplyServiceImpl implements WxMallApplyService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| public void saveOrUpdate(WxMallApply record) { | |||||
| public ResultData saveOrUpdate(WxMallApply record) { | |||||
| WxMsgValidationcode wxMsgValidationcode = new WxMsgValidationcode(); | |||||
| wxMsgValidationcode.setTenantId("1"); | |||||
| wxMsgValidationcode.setCode(record.getVerifyCode()); | |||||
| wxMsgValidationcode.setPhone(record.getPhone()); | |||||
| List<WxMsgValidationcode> wxmsgvalidationcodelist = wxMsgValidationcodeMapper.findList(wxMsgValidationcode); | |||||
| Date currentdate = new Date(); | |||||
| wxmsgvalidationcodelist = wxmsgvalidationcodelist.stream().filter(validationcode -> | |||||
| validationcode.getExpiretime().after(currentdate)).collect(Collectors.toList()); | |||||
| if(wxmsgvalidationcodelist.size()==0) return new ResultData(ErrorCode.MSG_VERIFY_CODE_NOT_FOUND.getCode(),ErrorCode.MSG_VERIFY_CODE_NOT_FOUND.getMessage(),true); | |||||
| if (record.getId() == null) { | if (record.getId() == null) { | ||||
| final IdWorker idWorker = IdWorker.get(); | final IdWorker idWorker = IdWorker.get(); | ||||
| record.setId(idWorker.nextId()); | record.setId(idWorker.nextId()); | ||||
| @@ -62,6 +73,7 @@ public class WxMallApplyServiceImpl implements WxMallApplyService { | |||||
| } else { | } else { | ||||
| wxMallApplyMapper.updateByPrimaryKeySelective(record); | wxMallApplyMapper.updateByPrimaryKeySelective(record); | ||||
| } | } | ||||
| return new ResultData(200,"操作成功",true); | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -120,8 +120,6 @@ public class WxMsgModelServiceImpl implements WxMsgModelService { | |||||
| final IdWorker idWorker = IdWorker.get(); | final IdWorker idWorker = IdWorker.get(); | ||||
| wxMsgModel.setId(idWorker.nextId()); | wxMsgModel.setId(idWorker.nextId()); | ||||
| wxMsgModel.setTenantId(wxMsgModel.getTenantId()); | wxMsgModel.setTenantId(wxMsgModel.getTenantId()); | ||||
| String data = jsonObjectResult.get("data").toString(); | |||||
| wxMsgModel.setModelId(Integer.valueOf(data)); | |||||
| wxMsgModel.setCreatetime(new Date()); | wxMsgModel.setCreatetime(new Date()); | ||||
| wxMsgModel.setStatus(1); | wxMsgModel.setStatus(1); | ||||
| wxMsgModelMapper.insertSelective(wxMsgModel); | wxMsgModelMapper.insertSelective(wxMsgModel); | ||||
| @@ -126,8 +126,6 @@ public class WxMsgValidationcodeModelServiceImpl implements WxMsgValidationcodeM | |||||
| final IdWorker idWorker = IdWorker.get(); | final IdWorker idWorker = IdWorker.get(); | ||||
| wxMsgModel.setId(idWorker.nextId()); | wxMsgModel.setId(idWorker.nextId()); | ||||
| wxMsgModel.setTenantId(wxMsgModel.getTenantId()); | wxMsgModel.setTenantId(wxMsgModel.getTenantId()); | ||||
| String data = jsonObjectResult.get("data").toString(); | |||||
| wxMsgModel.setModelId(Integer.valueOf(data)); | |||||
| wxMsgModel.setCreatetime(new Date()); | wxMsgModel.setCreatetime(new Date()); | ||||
| wxMsgModel.setStatus(1); | wxMsgModel.setStatus(1); | ||||
| wxMsgValidationcodeModelMapper.insertSelective(wxMsgModel); | wxMsgValidationcodeModelMapper.insertSelective(wxMsgModel); | ||||