Commit afbef9f2 authored by fangxinjiang's avatar fangxinjiang

新增定时任务服务及配置

parent b92e4d48
...@@ -141,4 +141,9 @@ public interface ErrorCodes { ...@@ -141,4 +141,9 @@ public interface ErrorCodes {
* 已存在对应名称的角色 * 已存在对应名称的角色
*/ */
String SYS_ROLE_UPDATE_ERROR_NAME_EXIST ="sys.role.update.error.name.exist"; String SYS_ROLE_UPDATE_ERROR_NAME_EXIST ="sys.role.update.error.name.exist";
/**
* 已存在对应编码的字典
*/
String SYS_DICT_ADD_TYPE_EXISTS = "sys.dict.add.type.exist";
} }
...@@ -28,6 +28,7 @@ sys.app.phone.unregistered={0} \u624B\u673A\u53F7\u672A\u6CE8\u518C ...@@ -28,6 +28,7 @@ sys.app.phone.unregistered={0} \u624B\u673A\u53F7\u672A\u6CE8\u518C
sys.dict.delete.system=\u7CFB\u7EDF\u5185\u7F6E\u5B57\u5178\u9879\u76EE\u4E0D\u80FD\u5220\u9664 sys.dict.delete.system=\u7CFB\u7EDF\u5185\u7F6E\u5B57\u5178\u9879\u76EE\u4E0D\u80FD\u5220\u9664
sys.dict.update.system=\u7CFB\u7EDF\u5185\u7F6E\u5B57\u5178\u9879\u76EE\u4E0D\u80FD\u4FEE\u6539 sys.dict.update.system=\u7CFB\u7EDF\u5185\u7F6E\u5B57\u5178\u9879\u76EE\u4E0D\u80FD\u4FEE\u6539
sys.dict.delete.existing=\u5B57\u5178\u5B58\u5728\u4E0B\u7EA7\u8282\u70B9\u4E0D\u80FD\u5220\u9664 sys.dict.delete.existing=\u5B57\u5178\u5B58\u5728\u4E0B\u7EA7\u8282\u70B9\u4E0D\u80FD\u5220\u9664
sys.dict.add.type.exist=\u5DF2\u5B58\u5728\u5BF9\u5E94\u7F16\u7801\u7684\u5B57\u5178
sys.role.delete.system=\u7CFB\u7EDF\u5185\u7F6E\u89D2\u8272\u4E0D\u80FD\u5220\u9664 sys.role.delete.system=\u7CFB\u7EDF\u5185\u7F6E\u89D2\u8272\u4E0D\u80FD\u5220\u9664
sys.role.update.system=\u7CFB\u7EDF\u5185\u7F6E\u89D2\u8272\u4E0D\u80FD\u4FEE\u6539 sys.role.update.system=\u7CFB\u7EDF\u5185\u7F6E\u89D2\u8272\u4E0D\u80FD\u4FEE\u6539
......
...@@ -26,6 +26,10 @@ import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysRoleMenu; ...@@ -26,6 +26,10 @@ import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysRoleMenu;
import com.yifu.cloud.plus.v1.yifu.admin.service.SysDictItemService; import com.yifu.cloud.plus.v1.yifu.admin.service.SysDictItemService;
import com.yifu.cloud.plus.v1.yifu.admin.service.SysDictService; import com.yifu.cloud.plus.v1.yifu.admin.service.SysDictService;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants; import com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.exception.ErrorCodes;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.MsgUtils;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R; import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog; import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
...@@ -101,6 +105,13 @@ public class DictController { ...@@ -101,6 +105,13 @@ public class DictController {
@PostMapping @PostMapping
@PreAuthorize("@pms.hasPermission('sys_dict_add')") @PreAuthorize("@pms.hasPermission('sys_dict_add')")
public R<Boolean> save(@Valid @RequestBody SysDict sysDict) { public R<Boolean> save(@Valid @RequestBody SysDict sysDict) {
SysDict dict = sysDictService.getOne(Wrappers.<SysDict>query().lambda()
.eq(SysDict::getType,sysDict.getType())
.eq(SysDict::getDelFlag, CommonConstants.ZERO_STRING)
.last(CommonConstants.LAST_ONE_SQL));
if (Common.isNotNull(dict)){
return R.failed(MsgUtils.getMessage(ErrorCodes.SYS_DICT_ADD_TYPE_EXISTS));
}
return R.ok(sysDictService.save(sysDict)); return R.ok(sysDictService.save(sysDict));
} }
...@@ -126,6 +137,14 @@ public class DictController { ...@@ -126,6 +137,14 @@ public class DictController {
@SysLog("修改字典") @SysLog("修改字典")
@PreAuthorize("@pms.hasPermission('sys_dict_edit')") @PreAuthorize("@pms.hasPermission('sys_dict_edit')")
public R updateById(@Valid @RequestBody SysDict sysDict) { public R updateById(@Valid @RequestBody SysDict sysDict) {
SysDict dict = sysDictService.getOne(Wrappers.<SysDict>query().lambda()
.eq(SysDict::getType,sysDict.getType())
.ne(SysDict::getId,sysDict.getId())
.eq(SysDict::getDelFlag, CommonConstants.ZERO_STRING)
.last(CommonConstants.LAST_ONE_SQL));
if (Common.isNotNull(dict)){
return R.failed(MsgUtils.getMessage(ErrorCodes.SYS_DICT_ADD_TYPE_EXISTS));
}
sysDictService.updateDict(sysDict); sysDictService.updateDict(sysDict);
return R.ok(); return R.ok();
} }
......
...@@ -30,6 +30,7 @@ import com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants; ...@@ -30,6 +30,7 @@ import com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.enums.DictTypeEnum; import com.yifu.cloud.plus.v1.yifu.common.core.constant.enums.DictTypeEnum;
import com.yifu.cloud.plus.v1.yifu.common.core.exception.ErrorCodes; import com.yifu.cloud.plus.v1.yifu.common.core.exception.ErrorCodes;
import com.yifu.cloud.plus.v1.yifu.common.core.util.MsgUtils; import com.yifu.cloud.plus.v1.yifu.common.core.util.MsgUtils;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.cache.annotation.CacheEvict; import org.springframework.cache.annotation.CacheEvict;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -114,7 +115,7 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl ...@@ -114,7 +115,7 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
if (StrUtil.isNotBlank(sysDict.getDescription())){ if (StrUtil.isNotBlank(sysDict.getDescription())){
wrapper.likeRight(SysDict::getDescription,sysDict.getDescription()); wrapper.likeRight(SysDict::getDescription,sysDict.getDescription());
} }
wrapper.orderByDesc(BaseEntity::getCreateTime);
return wrapper; return wrapper;
} }
} }
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