|
@@ -2,7 +2,6 @@ package cn.gov.customs.wxjy.system.controller;
|
|
|
|
|
|
|
|
import cn.gov.customs.cacp.sdks.core.result.CacpResultCodeMessage;
|
|
import cn.gov.customs.cacp.sdks.core.result.CacpResultCodeMessage;
|
|
|
import cn.gov.customs.cacp.sdks.core.result.Result;
|
|
import cn.gov.customs.cacp.sdks.core.result.Result;
|
|
|
-import cn.gov.customs.cacp.sdks.core.result.ResultCodeMessage;
|
|
|
|
|
import cn.gov.customs.wxjy.common.annotation.Log;
|
|
import cn.gov.customs.wxjy.common.annotation.Log;
|
|
|
import cn.gov.customs.wxjy.common.core.controller.BaseController;
|
|
import cn.gov.customs.wxjy.common.core.controller.BaseController;
|
|
|
import cn.gov.customs.wxjy.common.core.domain.AjaxResult;
|
|
import cn.gov.customs.wxjy.common.core.domain.AjaxResult;
|
|
@@ -11,12 +10,14 @@ import cn.gov.customs.wxjy.system.pojo.DictType;
|
|
|
import cn.gov.customs.wxjy.system.pojo.DictTypeQuery;
|
|
import cn.gov.customs.wxjy.system.pojo.DictTypeQuery;
|
|
|
import cn.gov.customs.wxjy.system.service.DictDataService;
|
|
import cn.gov.customs.wxjy.system.service.DictDataService;
|
|
|
import cn.gov.customs.wxjy.system.service.DictTypeService;
|
|
import cn.gov.customs.wxjy.system.service.DictTypeService;
|
|
|
|
|
+import cn.gov.customs.wxjy.utils.SysBusLogUtil;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
import com.github.pagehelper.PageInfo;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
|
+import java.io.UnsupportedEncodingException;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -33,6 +34,7 @@ public class DictTypeController extends BaseController {
|
|
|
private DictTypeService dictTypeService;
|
|
private DictTypeService dictTypeService;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private DictDataService dictDataService;
|
|
private DictDataService dictDataService;
|
|
|
|
|
+ private final String subject = "系统管理-字典管理";
|
|
|
|
|
|
|
|
// @PreAuthorize("@ss.hasPermi('system:dict:list')")
|
|
// @PreAuthorize("@ss.hasPermi('system:dict:list')")
|
|
|
@PostMapping("/list")
|
|
@PostMapping("/list")
|
|
@@ -67,14 +69,14 @@ public class DictTypeController extends BaseController {
|
|
|
// @PreAuthorize("@ss.hasPermi('system:dict:add')")
|
|
// @PreAuthorize("@ss.hasPermi('system:dict:add')")
|
|
|
@Log(title = "字典类型", businessType = BusinessType.INSERT)
|
|
@Log(title = "字典类型", businessType = BusinessType.INSERT)
|
|
|
@PostMapping
|
|
@PostMapping
|
|
|
- public AjaxResult add(@RequestBody DictType dict)
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ public AjaxResult add(@RequestBody DictType dict) throws UnsupportedEncodingException {
|
|
|
if (!dictTypeService.checkDictTypeUnique(dict))
|
|
if (!dictTypeService.checkDictTypeUnique(dict))
|
|
|
{
|
|
{
|
|
|
return error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
|
return error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
|
|
}
|
|
}
|
|
|
dict.setCreateDept(getUserDeptGuid());
|
|
dict.setCreateDept(getUserDeptGuid());
|
|
|
dict.setCreateUser(getUsername());
|
|
dict.setCreateUser(getUsername());
|
|
|
|
|
+ SysBusLogUtil.log(subject, true,dict.getPkDictType().toString(), SysBusLogUtil.ACT_TYPE_CREATE);
|
|
|
return toAjax(dictTypeService.insertDictType(dict));
|
|
return toAjax(dictTypeService.insertDictType(dict));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -84,13 +86,13 @@ public class DictTypeController extends BaseController {
|
|
|
// @PreAuthorize("@ss.hasPermi('system:dict:edit')")
|
|
// @PreAuthorize("@ss.hasPermi('system:dict:edit')")
|
|
|
@Log(title = "字典类型", businessType = BusinessType.UPDATE)
|
|
@Log(title = "字典类型", businessType = BusinessType.UPDATE)
|
|
|
@PutMapping
|
|
@PutMapping
|
|
|
- public AjaxResult edit(@Validated @RequestBody DictType dict)
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ public AjaxResult edit(@Validated @RequestBody DictType dict) throws UnsupportedEncodingException {
|
|
|
if (!dictTypeService.checkDictTypeUnique(dict))
|
|
if (!dictTypeService.checkDictTypeUnique(dict))
|
|
|
{
|
|
{
|
|
|
return error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
|
return error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
|
|
}
|
|
}
|
|
|
dict.setUpdateUser(getUsername());
|
|
dict.setUpdateUser(getUsername());
|
|
|
|
|
+ SysBusLogUtil.log(subject, true,dict.getPkDictType().toString(), SysBusLogUtil.ACT_TYPE_UPDATE);
|
|
|
return toAjax(dictTypeService.updateDictType(dict));
|
|
return toAjax(dictTypeService.updateDictType(dict));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -98,7 +100,7 @@ public class DictTypeController extends BaseController {
|
|
|
* 删除字典类型
|
|
* 删除字典类型
|
|
|
*/
|
|
*/
|
|
|
@PostMapping("/delete-dictTypes")
|
|
@PostMapping("/delete-dictTypes")
|
|
|
- public Result<Integer> remove(@RequestBody Long[] ids) {
|
|
|
|
|
|
|
+ public Result<Integer> remove(@RequestBody Long[] ids) throws UnsupportedEncodingException {
|
|
|
for (Long PkDictType : ids)
|
|
for (Long PkDictType : ids)
|
|
|
{
|
|
{
|
|
|
DictType dictType = dictTypeService.selectDictTypeById(PkDictType);
|
|
DictType dictType = dictTypeService.selectDictTypeById(PkDictType);
|
|
@@ -106,6 +108,7 @@ public class DictTypeController extends BaseController {
|
|
|
{
|
|
{
|
|
|
return Result.fail(CacpResultCodeMessage.WARNING,"字典类型'" + dictType.getDictType() + "'已被使用,不能删除,请先删除字典项值");
|
|
return Result.fail(CacpResultCodeMessage.WARNING,"字典类型'" + dictType.getDictType() + "'已被使用,不能删除,请先删除字典项值");
|
|
|
}
|
|
}
|
|
|
|
|
+ SysBusLogUtil.log(subject, true,PkDictType.toString(), SysBusLogUtil.ACT_TYPE_DELETE);
|
|
|
}
|
|
}
|
|
|
return Result.success(dictTypeService.deleteDictTypeByIds(ids));
|
|
return Result.success(dictTypeService.deleteDictTypeByIds(ids));
|
|
|
}
|
|
}
|