初始化
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
package com.njcn.system;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @version 1.0.0
|
||||
* @createTime 2021年05月14日 15:14
|
||||
*/
|
||||
@Slf4j
|
||||
@MapperScan("com.njcn.**.mapper")
|
||||
@EnableFeignClients(basePackages = "com.njcn")
|
||||
@SpringBootApplication(scanBasePackages = "com.njcn")
|
||||
public class SystemBootMain {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(SystemBootMain.class, args);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,261 @@
|
||||
package com.njcn.system.controller;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.constant.OperateType;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.common.utils.LogUtil;
|
||||
import com.njcn.system.pojo.dto.AreaTreeDTO;
|
||||
import com.njcn.system.pojo.param.AreaParam;
|
||||
import com.njcn.system.pojo.po.Area;
|
||||
import com.njcn.system.pojo.vo.AreaTreeVO;
|
||||
import com.njcn.system.service.IAreaService;
|
||||
import io.swagger.annotations.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.njcn.web.controller.BaseController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器(行政区域)
|
||||
* </p>
|
||||
*
|
||||
* @author hongawen
|
||||
* @since 2021-12-13
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/area")
|
||||
@Api(tags = "行政区域管理")
|
||||
@AllArgsConstructor
|
||||
public class AreaController extends BaseController {
|
||||
|
||||
private final IAreaService areaService;
|
||||
|
||||
/**
|
||||
* 分页查询行政区域
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/list")
|
||||
@ApiOperation("查询企业区域")
|
||||
@ApiImplicitParam(name = "queryParam", value = "查询参数", required = true)
|
||||
public HttpResult<Page<Area>> list(@RequestBody @Validated AreaParam.QueryParam queryParam) {
|
||||
String methodDescribe = getMethodDescribe("list");
|
||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, queryParam);
|
||||
Page<Area> result = areaService.listDictData(queryParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据行政区域id详情
|
||||
*
|
||||
* @param id 行政区域id
|
||||
* @return 行政区域详情
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@GetMapping("/selectIdArea/{id}")
|
||||
@ApiOperation("根据行政区域id查询详情")
|
||||
@ApiImplicitParam(name = "id", value = "查询参数", required = true)
|
||||
public HttpResult<Area> selectIdArea(@PathVariable("id") String id) {
|
||||
String methodDescribe = getMethodDescribe("selectIdArea");
|
||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, id);
|
||||
Area result = areaService.selectIdArea(id);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据行政区域id详情
|
||||
*
|
||||
* @param list 行政区域id集合
|
||||
* @return 行政区域详情
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/areaNameByList")
|
||||
@ApiOperation("根据行政区域id集合查询名称")
|
||||
@ApiImplicitParam(name = "list", value = "查询参数", required = true)
|
||||
public HttpResult<List<Area>> areaNameByList(@RequestBody List<String> list) {
|
||||
String methodDescribe = getMethodDescribe("areaNameByList");
|
||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, list);
|
||||
List<Area> result = areaService.selectAreaByList(list);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取行政区域树(所有行政区域)
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
@PostMapping("/areaTree")
|
||||
@ApiOperation("行政区域树")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "区域id", required = false),
|
||||
@ApiImplicitParam(name = "type", value = "区域类型", required = true)
|
||||
})
|
||||
public HttpResult<Object> areaTree(@RequestParam(required = false) @ApiParam("id") String id, @RequestParam("type") Integer type) {
|
||||
String methodDescribe = getMethodDescribe("areaTree");
|
||||
List<AreaTreeVO> result = areaService.areaTree(id, type);
|
||||
if (!result.isEmpty()) {
|
||||
try {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
} catch (Exception e) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.NO_DATA, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增企业区域
|
||||
*
|
||||
* @param areaParam 企业区域
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.ADD)
|
||||
@PostMapping("/add")
|
||||
@ApiOperation("新增企业区域")
|
||||
@ApiImplicitParam(name = "areaParam", value = "企业区域数据", required = true)
|
||||
public HttpResult<Object> add(@RequestBody @Validated AreaParam areaParam) {
|
||||
String methodDescribe = getMethodDescribe("add");
|
||||
LogUtil.njcnDebug(log, "{},字典类型数据为:{}", methodDescribe, areaParam);
|
||||
boolean result = areaService.addAreaParam(areaParam);
|
||||
if (result) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改企业区域
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.UPDATE)
|
||||
@PostMapping("/update")
|
||||
@ApiOperation("修改企业区域")
|
||||
@ApiImplicitParam(name = "updateParam", value = "企业区域", required = true)
|
||||
public HttpResult<Object> update(@RequestBody @Validated AreaParam.AreaUpdateParam updateParam) {
|
||||
String methodDescribe = getMethodDescribe("update");
|
||||
LogUtil.njcnDebug(log, "{},字典数据为:{}", methodDescribe, updateParam);
|
||||
boolean result = areaService.updateArea(updateParam);
|
||||
if (result) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据选中的行政区域id查询是否含有子节点
|
||||
*
|
||||
* @param ids 行政区域ids
|
||||
* @return 行政区域查看所有子节点
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/selectPid")
|
||||
@ApiOperation("根据行政区域id查询")
|
||||
@ApiImplicitParam(name = "ids", value = "查询参数", required = true)
|
||||
public HttpResult<Object> selectPid(@RequestBody List<String> ids) {
|
||||
String methodDescribe = getMethodDescribe("selectPid");
|
||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, ids);
|
||||
List<Area> result = areaService.selectPid(ids);
|
||||
if (result.size() > 0) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.DELETE_PID_EXIST, null, methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.DELETE_PID_UNEXIST, null, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除企业区域
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.DELETE)
|
||||
@PostMapping("/delete")
|
||||
@ApiOperation("删除企业区域")
|
||||
@ApiImplicitParam(name = "ids", value = "企业区域索引", required = true)
|
||||
public HttpResult<Object> delete(@RequestBody List<String> ids) {
|
||||
String methodDescribe = getMethodDescribe("delete");
|
||||
LogUtil.njcnDebug(log, "{},企业区域数据为:{}", methodDescribe, ids);
|
||||
boolean result = areaService.deleteArea(ids);
|
||||
if (result) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取行政区域树(所有行政区域)
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
@PostMapping("/areaDeptTree")
|
||||
@ApiOperation("获取新增部门区域树")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "区域id", required = false),
|
||||
@ApiImplicitParam(name = "type", value = "区域类型", required = true)
|
||||
})
|
||||
public HttpResult<List<AreaTreeDTO>> areaDeptTree(@RequestParam(required = false) @ApiParam("id") String id, @RequestParam("type") Integer type) {
|
||||
String methodDescribe = getMethodDescribe("areaDeptTree");
|
||||
List<AreaTreeDTO> result = areaService.areaDeptTree(id, type);
|
||||
if (!result.isEmpty()) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.NO_DATA, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据区域id获取省份
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
@PostMapping("/areaPro")
|
||||
@ApiOperation("根据区域id获取省份")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "区域id", required = false),
|
||||
@ApiImplicitParam(name = "type", value = "区域类型", required = true)
|
||||
})
|
||||
public HttpResult<Area> areaPro(@RequestParam(required = false) @ApiParam("id") String id, @RequestParam("type") Integer type) {
|
||||
String methodDescribe = getMethodDescribe("areaDeptTree");
|
||||
Area result = areaService.areaPro(id, type);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所在的区域树
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
@PostMapping("/getDeptIdAreaTree")
|
||||
@ApiOperation("根据登录用户获取所在的区域树")
|
||||
public HttpResult<List<AreaTreeVO>> getDeptIdAreaTree() {
|
||||
String methodDescribe = getMethodDescribe("getDeptIdAreaTree");
|
||||
List<AreaTreeVO> result = areaService.getDeptIdAreaTree();
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据行政区域名称查询详细
|
||||
*
|
||||
* @param name 行政区域名称
|
||||
* @return 行政区域详情
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@GetMapping("/selectAreaByName/{name}")
|
||||
@ApiOperation("根据行政区域名称查询详细")
|
||||
@ApiImplicitParam(name = "name", value = "查询参数", required = true)
|
||||
public HttpResult<Area> selectAreaByName(@PathVariable("name") String name) {
|
||||
String methodDescribe = getMethodDescribe("selectAreaByName");
|
||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, name);
|
||||
Area result = areaService.selectAreaByName(name);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.njcn.system.controller;
|
||||
|
||||
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.common.utils.LogUtil;
|
||||
import com.njcn.system.pojo.po.Config;
|
||||
import com.njcn.system.service.IConfigService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author hongawen
|
||||
* @since 2021-12-13
|
||||
*/
|
||||
@Slf4j
|
||||
@Api(tags = "系统配置操作")
|
||||
@RestController
|
||||
@RequestMapping("/config")
|
||||
@RequiredArgsConstructor
|
||||
public class ConfigController extends BaseController {
|
||||
|
||||
private final IConfigService iConfigService;
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
@GetMapping("/getSysConfig")
|
||||
@ApiOperation("获取系统配置")
|
||||
public HttpResult<Config> getSysConfig() {
|
||||
String methodDescribe = getMethodDescribe("getSysConfig");
|
||||
LogUtil.njcnDebug(log, "{}", methodDescribe, methodDescribe);
|
||||
Config config = iConfigService.lambdaQuery()
|
||||
.eq(Config::getState, DataStateEnum.ENABLE.getCode())
|
||||
.one();
|
||||
if (Objects.isNull(config)) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.NO_DATA, null, methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, config, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,213 @@
|
||||
package com.njcn.system.controller;
|
||||
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.constant.OperateType;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.common.utils.LogUtil;
|
||||
import com.njcn.system.pojo.param.DictDataParam;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import com.njcn.system.pojo.po.DictType;
|
||||
import com.njcn.system.pojo.vo.DictDataVO;
|
||||
import com.njcn.system.service.IDictDataService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author hongawen
|
||||
* @since 2021-12-13
|
||||
*/
|
||||
@Validated
|
||||
@Slf4j
|
||||
@Api(tags = "字典数据操作")
|
||||
@RestController
|
||||
@RequestMapping("/dictData")
|
||||
@RequiredArgsConstructor
|
||||
public class DictDataController extends BaseController {
|
||||
|
||||
private final IDictDataService dictDataService;
|
||||
|
||||
/**
|
||||
* 分页查询字典类型数据
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
@PostMapping("/list")
|
||||
@ApiOperation("查询字典数据")
|
||||
@ApiImplicitParam(name = "queryParam", value = "查询参数", required = true)
|
||||
public HttpResult<Page<DictDataVO>> list(@RequestBody @Validated DictDataParam.DictDataQueryParam queryParam) {
|
||||
String methodDescribe = getMethodDescribe("list");
|
||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, queryParam);
|
||||
Page<DictDataVO> result = dictDataService.listDictData(queryParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增字典数据
|
||||
*
|
||||
* @param dictDataParam 字典数据
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.ADD)
|
||||
@PostMapping("/add")
|
||||
@ApiOperation("新增字典数据")
|
||||
@ApiImplicitParam(name = "dictDataParam", value = "字典数据", required = true)
|
||||
public HttpResult<Object> add(@RequestBody @Validated DictDataParam dictDataParam) {
|
||||
String methodDescribe = getMethodDescribe("add");
|
||||
LogUtil.njcnDebug(log, "{},字典数据为:{}", methodDescribe, dictDataParam);
|
||||
boolean result = dictDataService.addDictData(dictDataParam);
|
||||
if (result) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改字典数据
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.UPDATE)
|
||||
@PostMapping("/update")
|
||||
@ApiOperation("修改字典数据")
|
||||
@ApiImplicitParam(name = "updateParam", value = "字典数据", required = true)
|
||||
public HttpResult<Object> update(@RequestBody @Validated DictDataParam.DictDataUpdateParam updateParam) {
|
||||
String methodDescribe = getMethodDescribe("update");
|
||||
LogUtil.njcnDebug(log, "{},字典数据为:{}", methodDescribe, updateParam);
|
||||
boolean result = dictDataService.updateDictData(updateParam);
|
||||
if (result) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 批量删除字典数据
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.UPDATE)
|
||||
@PostMapping("/delete")
|
||||
@ApiOperation("删除字典数据")
|
||||
@ApiImplicitParam(name = "ids", value = "字典索引", required = true, dataTypeClass = List.class)
|
||||
public HttpResult<Object> delete(@RequestBody List<String> ids) {
|
||||
String methodDescribe = getMethodDescribe("delete");
|
||||
LogUtil.njcnDebug(log, "{},字典ID数据为:{}", methodDescribe, String.join(StrUtil.COMMA, ids));
|
||||
boolean result = dictDataService.deleteDictData(ids);
|
||||
if (result) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据字典类型id分页查询字典数据
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
@PostMapping("/getTypeIdData")
|
||||
@ApiOperation("根据字典类型id查询字典数据")
|
||||
@ApiImplicitParam(name = "queryParam", value = "查询参数", required = true)
|
||||
public HttpResult<Page<DictDataVO>> getTypeIdData(@RequestBody @Validated DictDataParam.DicTypeIdQueryParam queryParam) {
|
||||
String methodDescribe = getMethodDescribe("list");
|
||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, queryParam);
|
||||
Page<DictDataVO> result = dictDataService.getTypeIdData(queryParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@GetMapping("/getDicDataById")
|
||||
@ApiOperation("根据字典id查询字典数据")
|
||||
@ApiImplicitParam(name = "dicIndex", value = "查询参数", required = true)
|
||||
public HttpResult<DictData> getDicDataById(@RequestParam("dicIndex") String dicIndex) {
|
||||
String methodDescribe = getMethodDescribe("getDicDataById");
|
||||
DictData result = dictDataService.getDicDataById(dicIndex);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@GetMapping("/getDicDataByTypeName")
|
||||
@ApiOperation("根据字典类型名称查询字典数据")
|
||||
@ApiImplicitParam(name = "dictTypeName", value = "查询参数", required = true)
|
||||
public HttpResult<List<DictData>> getDicDataByTypeName(@RequestParam("dictTypeName") String dictTypeName) {
|
||||
String methodDescribe = getMethodDescribe("getDicDataByTypeName");
|
||||
List<DictData> result = dictDataService.getDicDataByTypeName(dictTypeName);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@GetMapping("/getDicDataByName")
|
||||
@ApiOperation("根据字典名称查询字典数据")
|
||||
@ApiImplicitParam(name = "dicName", value = "查询参数", required = true)
|
||||
public HttpResult<DictData> getDicDataByName(@RequestParam("dicName") String dicName) {
|
||||
String methodDescribe = getMethodDescribe("getDicDataByName");
|
||||
DictData result = dictDataService.getDicDataByName(dicName);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据系统类型获取不同指标参数
|
||||
*/
|
||||
@OperateInfo
|
||||
@GetMapping("/getLoadTypeBySys")
|
||||
@ApiOperation("根据系统类型获取不同指标参数")
|
||||
@ApiIgnore
|
||||
public HttpResult<List<DictData>> getLoadTypeBySys() {
|
||||
String methodDescribe = getMethodDescribe("getLoadTypeBySys");
|
||||
List<DictData> list = dictDataService.getLoadTypeBySys();
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 后台新增字典数据
|
||||
*
|
||||
* @param dicTypeName 类型名称
|
||||
* @param dicDataName 数据名称
|
||||
* @return 新增后的字典数据
|
||||
*/
|
||||
@ApiIgnore
|
||||
@OperateInfo
|
||||
@GetMapping("/addDicData")
|
||||
@ApiOperation("后台新增字典数据")
|
||||
public HttpResult<DictData> addDicData(String dicTypeName, String dicDataName) {
|
||||
String methodDescribe = getMethodDescribe("addDicData");
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, dictDataService.addDictData(dicTypeName,dicDataName), methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据字典类型名称&数据名称获取字典数据
|
||||
*
|
||||
* @param dicTypeName 字典类型名称
|
||||
* @param dicDataName 字典数据名称
|
||||
* @return 字典数据
|
||||
*/
|
||||
@ApiIgnore
|
||||
@OperateInfo
|
||||
@GetMapping("/getDicDataByNameAndTypeName")
|
||||
@ApiOperation("根据字典类型名称&数据名称获取字典数据")
|
||||
public HttpResult<DictData> getDicDataByNameAndTypeName(String dicTypeName, String dicDataName) {
|
||||
String methodDescribe = getMethodDescribe("getDicDataByNameAndTypeName");
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, dictDataService.getDicDataByNameAndTypeName(dicTypeName,dicDataName), methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,139 @@
|
||||
package com.njcn.system.controller;
|
||||
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.constant.OperateType;
|
||||
import com.njcn.common.pojo.dto.SimpleDTO;
|
||||
import com.njcn.common.pojo.dto.SimpleTreeDTO;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.common.utils.LogUtil;
|
||||
import com.njcn.system.pojo.param.DictTypeParam;
|
||||
import com.njcn.system.pojo.po.DictType;
|
||||
import com.njcn.system.service.IDictTypeService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.njcn.web.controller.BaseController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author hongawen
|
||||
* @since 2021-12-13
|
||||
*/
|
||||
@Slf4j
|
||||
@Api(tags = "字典类型表操作")
|
||||
@RestController
|
||||
@RequestMapping("/dictType")
|
||||
@RequiredArgsConstructor
|
||||
public class DictTypeController extends BaseController {
|
||||
|
||||
private final IDictTypeService dictTypeService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询字典类型数据
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
@PostMapping("/list")
|
||||
@ApiOperation("查询字典类型")
|
||||
@ApiImplicitParam(name = "queryParam", value = "查询参数", required = true)
|
||||
public HttpResult<Page<DictType>> list(@RequestBody @Validated DictTypeParam.DictTypeQueryParam queryParam) {
|
||||
String methodDescribe = getMethodDescribe("list");
|
||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, queryParam);
|
||||
Page<DictType> result = dictTypeService.listDictTypes(queryParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增字典类型
|
||||
*
|
||||
* @param dictTypeParam 字典类型数据
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.ADD)
|
||||
@PostMapping("/add")
|
||||
@ApiOperation("新增字典类型")
|
||||
@ApiImplicitParam(name = "dictTypeParam", value = "字典类型数据", required = true)
|
||||
public HttpResult<Object> add(@RequestBody @Validated DictTypeParam dictTypeParam) {
|
||||
String methodDescribe = getMethodDescribe("add");
|
||||
LogUtil.njcnDebug(log, "{},字典类型数据为:{}", methodDescribe, dictTypeParam);
|
||||
boolean result = dictTypeService.addDictType(dictTypeParam);
|
||||
if (result) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改字典类型
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.UPDATE)
|
||||
@PostMapping("/update")
|
||||
@ApiOperation("修改字典类型")
|
||||
@ApiImplicitParam(name = "updateParam", value = "字典类型数据", required = true)
|
||||
public HttpResult<Object> update(@RequestBody @Validated DictTypeParam.DictTypeUpdateParam updateParam) {
|
||||
String methodDescribe = getMethodDescribe("update");
|
||||
LogUtil.njcnDebug(log, "{},字典类型数据为:{}", methodDescribe, updateParam);
|
||||
boolean result = dictTypeService.updateDictType(updateParam);
|
||||
if (result) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 批量删除字典类型
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.DELETE)
|
||||
@PostMapping("/delete")
|
||||
@ApiOperation("删除字典类型")
|
||||
@ApiImplicitParam(name = "ids", value = "字典索引", required = true)
|
||||
public HttpResult<Object> delete(@RequestBody List<String> ids) {
|
||||
String methodDescribe = getMethodDescribe("delete");
|
||||
LogUtil.njcnDebug(log, "{},字典ID数据为:{}", methodDescribe, String.join(StrUtil.COMMA, ids));
|
||||
boolean result = dictTypeService.deleteDictType(ids);
|
||||
if (result) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有字典数据基础信息
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
@GetMapping("/dictDataCache")
|
||||
@ApiOperation("获取所有字典数据基础信息")
|
||||
public HttpResult<List<SimpleTreeDTO>> dictDataCache() {
|
||||
String methodDescribe = getMethodDescribe("dictDataCache");
|
||||
LogUtil.njcnDebug(log, "{},获取所有字典数据基础信息", methodDescribe);
|
||||
List<SimpleTreeDTO> dictData = dictTypeService.dictDataCache();
|
||||
if (CollectionUtil.isNotEmpty(dictData)) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, dictData, methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.NO_DATA, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
package com.njcn.system.controller;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.common.utils.LogUtil;
|
||||
import com.njcn.system.pojo.param.MxGraphParam;
|
||||
import com.njcn.system.pojo.po.MxGraph;
|
||||
import com.njcn.system.service.IMxGraphService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* pqs
|
||||
* 组态管理
|
||||
* @author cdf
|
||||
* @date 2022/1/26
|
||||
*/
|
||||
@RestController
|
||||
@Slf4j
|
||||
@Api(tags = "组态管理")
|
||||
@RequestMapping("/king")
|
||||
@AllArgsConstructor
|
||||
public class MxGraphController extends BaseController {
|
||||
|
||||
private final IMxGraphService iMxGraphService;
|
||||
|
||||
/**
|
||||
* 新增组态
|
||||
* @author cdf
|
||||
* @date 2022/1/26
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.SYSTEM_MEDIUM)
|
||||
@PostMapping("/addKingView")
|
||||
@ApiOperation("新增组态")
|
||||
@ApiImplicitParam(name = "mxGraphParam", value = "组件实体", required = true)
|
||||
HttpResult addKingView(@RequestBody @Validated MxGraphParam mxGraphParam){
|
||||
String methodDescribe = getMethodDescribe("addKingView");
|
||||
boolean result = iMxGraphService.addKingView(mxGraphParam);
|
||||
LogUtil.njcnDebug(log, "{},组态实体:{}", methodDescribe, mxGraphParam);
|
||||
if (result) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询
|
||||
* @author cdf
|
||||
* @date 2022/1/26
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.SYSTEM_MEDIUM)
|
||||
@GetMapping("/getKingViewList")
|
||||
@ApiOperation("查询组态")
|
||||
HttpResult<Object> getKingViewList(){
|
||||
String methodDescribe = getMethodDescribe("getKingViewList");
|
||||
List<MxGraph> result = iMxGraphService.getKingViewList();
|
||||
if (CollectionUtil.isNotEmpty(result)) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, result, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
* @author cdf
|
||||
* @date 2022/1/26
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.SYSTEM_MEDIUM)
|
||||
@GetMapping("/getKingViewById")
|
||||
@ApiOperation("查询组态")
|
||||
HttpResult<Object> getKingViewById(@RequestParam("id") String id){
|
||||
String methodDescribe = getMethodDescribe("getKingViewById");
|
||||
MxGraph result = iMxGraphService.getKingViewById(id);
|
||||
if (Objects.nonNull(result)) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, result, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.njcn.system.controller;
|
||||
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author hongawen
|
||||
* @since 2021-12-13
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/resource")
|
||||
public class ResourceController extends BaseController {
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.njcn.system.controller;
|
||||
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author hongawen
|
||||
* @since 2021-12-13
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/task")
|
||||
public class TaskController extends BaseController {
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,125 @@
|
||||
package com.njcn.system.controller;
|
||||
|
||||
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.constant.OperateType;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.common.utils.LogUtil;
|
||||
import com.njcn.system.pojo.param.ThemeParam;
|
||||
import com.njcn.system.pojo.po.Theme;
|
||||
import com.njcn.system.service.IThemeService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author hongawen
|
||||
* @since 2021-12-13
|
||||
*/
|
||||
@Validated
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/theme")
|
||||
@Api(tags = "主题管理")
|
||||
@AllArgsConstructor
|
||||
public class ThemeController extends BaseController {
|
||||
|
||||
private final IThemeService themeService;
|
||||
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
@GetMapping("/getAllThemes")
|
||||
@ApiOperation("主题列表")
|
||||
public HttpResult<List<Theme>> getAllThemes(){
|
||||
String methodDescribe = getMethodDescribe("getAllThemes");
|
||||
List<Theme> list = themeService.getAllThemes();
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,list,methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
@GetMapping("/getTheme")
|
||||
@ApiOperation("当前主题")
|
||||
public HttpResult<Theme> getTheme(){
|
||||
String methodDescribe = getMethodDescribe("getTheme");
|
||||
Theme theme = themeService.getTheme();
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,theme,methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON,operateType = OperateType.ADD)
|
||||
@PostMapping("/addTheme")
|
||||
@ApiOperation("新增主题")
|
||||
public HttpResult<Boolean> addTheme(@Validated ThemeParam theme) {
|
||||
String methodDescribe = getMethodDescribe("addTheme");
|
||||
boolean result = themeService.addTheme(theme);
|
||||
if (result){
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON,operateType = OperateType.UPDATE)
|
||||
@PutMapping("/updateTheme")
|
||||
@ApiOperation("修改主题")
|
||||
public HttpResult<Boolean> updateTheme(@Validated ThemeParam.ThemeUpdateParam theme) {
|
||||
String methodDescribe = getMethodDescribe("updateTheme");
|
||||
boolean result = themeService.updateTheme(theme);
|
||||
if (result){
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON,operateType = OperateType.DELETE)
|
||||
@DeleteMapping("/deleteTheme")
|
||||
@ApiOperation("删除主题")
|
||||
@ApiImplicitParam(name = "id", value = "主题id", required = true)
|
||||
public HttpResult<Boolean> deleteTheme(@RequestParam @Validated String id) {
|
||||
String methodDescribe = getMethodDescribe("deleteTheme");
|
||||
LogUtil.njcnDebug(log, "{},删除的主题id为:{}", methodDescribe, id);
|
||||
boolean result = themeService.deleteTheme(id);
|
||||
if (result){
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON,operateType = OperateType.UPDATE)
|
||||
@PutMapping("/activateTheme")
|
||||
@ApiOperation("激活主题")
|
||||
@ApiImplicitParam(name = "id", value = "主题id", required = true)
|
||||
public HttpResult<Boolean> activateTheme(@RequestParam @Validated String id) {
|
||||
String methodDescribe = getMethodDescribe("activateTheme");
|
||||
LogUtil.njcnDebug(log, "{},启用的主题id为:{}", methodDescribe, id);
|
||||
boolean result = themeService.activateTheme(id);
|
||||
if (result){
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.njcn.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.system.pojo.dto.AreaTreeDTO;
|
||||
import com.njcn.system.pojo.po.Area;
|
||||
import com.njcn.system.pojo.vo.AreaTreeVO;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author hongawen
|
||||
* @since 2021-12-13
|
||||
*/
|
||||
public interface AreaMapper extends BaseMapper<Area> {
|
||||
|
||||
/**
|
||||
*
|
||||
* @return 行政区域树(首次)
|
||||
*/
|
||||
List<AreaTreeVO> getAreaTree(@Param("id")String id,@Param("type") Integer type,@Param("state")Integer state);
|
||||
|
||||
/**
|
||||
*
|
||||
* @return 行政区域树(首次)
|
||||
*/
|
||||
List<AreaTreeVO> getAreaIdTree(@Param("type") Integer type,@Param("state")Integer state);
|
||||
|
||||
/**
|
||||
* 查询父节点的所有上层节点
|
||||
* @param id
|
||||
* @return 父节点的所有上层节点
|
||||
*/
|
||||
String getIdString(@Param("id")String id);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param ids id
|
||||
* @param state 状态
|
||||
* @return 返回的结果
|
||||
*/
|
||||
List<Area> selectPid(@Param("ids")List<String> ids,@Param("state")Integer state);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param ids id
|
||||
* @param state 状态
|
||||
* @return 返回的结果
|
||||
*/
|
||||
List<String> getPid(@Param("ids")List<String> ids,@Param("state")Integer state);
|
||||
|
||||
/**
|
||||
*
|
||||
* @return 行政区域树(首次)
|
||||
*/
|
||||
List<AreaTreeDTO> getAreaDeptTree(@Param("type") Integer type, @Param("state")Integer state);
|
||||
|
||||
/**
|
||||
* 查询所有区域
|
||||
* @return
|
||||
*/
|
||||
List<AreaTreeVO> getAreaAll();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.njcn.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.system.pojo.po.Config;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author hongawen
|
||||
* @since 2021-12-13
|
||||
*/
|
||||
public interface ConfigMapper extends BaseMapper<Config> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.njcn.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import com.njcn.system.pojo.po.DictType;
|
||||
import com.njcn.system.pojo.vo.DictDataVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author hongawen
|
||||
* @since 2021-12-13
|
||||
*/
|
||||
public interface DictDataMapper extends BaseMapper<DictData> {
|
||||
|
||||
/**
|
||||
* 分页查询字典数据
|
||||
* @param page 分页数据
|
||||
* @param queryWrapper 查询条件
|
||||
* @return 字典数据
|
||||
*/
|
||||
Page<DictDataVO> page(@Param("page")Page<DictDataVO> page, @Param("ew")QueryWrapper<DictDataVO> queryWrapper);
|
||||
|
||||
/**
|
||||
* @param dictypeName 字典类型名称
|
||||
* @return 根据字典类型名称查询字典数据
|
||||
*/
|
||||
List<DictData> getDicDataByTypeName(@Param("dictypeName")String dictypeName);
|
||||
|
||||
DictData getDicDataByName(@Param("dicName")String dicName);
|
||||
|
||||
/**
|
||||
* 根据字典类型名称&数据名称获取字典数据
|
||||
*
|
||||
* @param dicTypeName 字典类型名称
|
||||
* @param dicDataName 字典数据名称
|
||||
* @return 字典数据
|
||||
*/
|
||||
DictData getDicDataByNameAndTypeName(@Param("dicTypeName")String dicTypeName, @Param("dicDataName")String dicDataName);
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.njcn.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import com.njcn.system.pojo.po.DictType;
|
||||
import com.njcn.system.pojo.vo.DictDataCache;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author hongawen
|
||||
* @since 2021-12-13
|
||||
*/
|
||||
public interface DictTypeMapper extends BaseMapper<DictType> {
|
||||
|
||||
/**
|
||||
* 查询所有的字典简单信息
|
||||
* @return 字典信息
|
||||
*/
|
||||
List<DictDataCache> dictDataCache();
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.njcn.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.system.pojo.po.MxGraph;
|
||||
|
||||
/**
|
||||
* pqs
|
||||
*
|
||||
* @author cdf
|
||||
* @date 2022/1/26
|
||||
*/
|
||||
public interface MxGraphMapper extends BaseMapper<MxGraph> {
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.njcn.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.system.pojo.po.Resource;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author hongawen
|
||||
* @since 2021-12-13
|
||||
*/
|
||||
public interface ResourceMapper extends BaseMapper<Resource> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.njcn.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.system.pojo.po.Task;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author hongawen
|
||||
* @since 2021-12-13
|
||||
*/
|
||||
public interface TaskMapper extends BaseMapper<Task> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.njcn.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.system.pojo.po.Theme;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author hongawen
|
||||
* @since 2021-12-13
|
||||
*/
|
||||
public interface ThemeMapper extends BaseMapper<Theme> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.njcn.system.mapper.AreaMapper">
|
||||
<!--行政区域树-->
|
||||
<select id="getAreaTree" resultType="AreaTreeVO">
|
||||
SELECT sys_area.id id,
|
||||
sys_area.name name,
|
||||
sys_area.pid pid,
|
||||
sys_area.pids pids,
|
||||
sys_area.short_name shortName,
|
||||
sys_area.area_code areaCode,
|
||||
sys_area.lng lng,
|
||||
sys_area.lat lat
|
||||
FROM sys_area sys_area
|
||||
WHERE sys_area.type = #{type}
|
||||
AND sys_area.state = #{state}
|
||||
AND sys_area.pid = #{id}
|
||||
</select>
|
||||
|
||||
<!--行政区域树-->
|
||||
<select id="getAreaIdTree" resultType="AreaTreeVO">
|
||||
SELECT sys_area.id id,
|
||||
sys_area.name name,
|
||||
sys_area.pid pid,
|
||||
sys_area.pids pids,
|
||||
sys_area.short_name shortName,
|
||||
sys_area.area_code areaCode,
|
||||
sys_area.lng lng,
|
||||
sys_area.lat lat
|
||||
FROM sys_area sys_area
|
||||
WHERE sys_area.type = #{type}
|
||||
AND sys_area.state = #{state}
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<select id="selectPid" resultType="Area">
|
||||
SELECT sys_area.*
|
||||
FROM sys_area sys_area
|
||||
WHERE sys_area.pid in
|
||||
<foreach item="item" index="index" collection="ids" open="("
|
||||
separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
AND sys_area.type = 1
|
||||
AND sys_area.state = #{state}
|
||||
</select>
|
||||
|
||||
<select id="getIdString" resultType="String">
|
||||
SELECT sys_area.pids pids
|
||||
FROM sys_area sys_area
|
||||
WHERE sys_area.id = #{id}
|
||||
</select>
|
||||
|
||||
<!--行政区域树-->
|
||||
<select id="getAreaDeptTree" resultType="AreaTreeDTO">
|
||||
SELECT sys_area.id id,
|
||||
sys_area.name name,
|
||||
sys_area.pid pid,
|
||||
sys_area.pids pids,
|
||||
sys_area.short_name shortName,
|
||||
sys_area.area_code areaCode,
|
||||
sys_area.lng lng,
|
||||
sys_area.lat lat
|
||||
FROM sys_area sys_area
|
||||
WHERE sys_area.type = #{type}
|
||||
AND sys_area.state = #{state}
|
||||
</select>
|
||||
|
||||
<select id="getAreaAll" resultType="AreaTreeVO">
|
||||
SELECT sys_area.*
|
||||
FROM sys_area sys_area
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.njcn.system.mapper.ConfigMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.njcn.system.mapper.DictDataMapper">
|
||||
|
||||
|
||||
<!--获取字典分页列表-->
|
||||
<select id="page" resultType="DictDataVO">
|
||||
SELECT sys_dict_data.*,
|
||||
sys_dict_type.name typeName
|
||||
FROM sys_dict_data sys_dict_data
|
||||
,sys_dict_type sys_dict_type
|
||||
WHERE sys_dict_data.type_id = sys_dict_type.id
|
||||
AND ${ew.sqlSegment}
|
||||
</select>
|
||||
|
||||
<!-- 根据字典类型名称查询字典数据-->
|
||||
<select id="getDicDataByTypeName" resultType="DictData">
|
||||
SELECT sys_dict_data.*
|
||||
FROM sys_dict_data sys_dict_data,
|
||||
sys_dict_type sys_dict_type
|
||||
WHERE sys_dict_data.type_id = sys_dict_type.id
|
||||
AND sys_dict_type.name = #{dictypeName}
|
||||
order by sort
|
||||
</select>
|
||||
<!-- 根据字典名称查询字典数据-->
|
||||
<select id="getDicDataByName" resultType="DictData">
|
||||
SELECT sys_dict_data.*
|
||||
FROM sys_dict_data sys_dict_data
|
||||
WHERE sys_dict_data.name = #{dicName}
|
||||
</select>
|
||||
|
||||
<select id="getDicDataByNameAndTypeName" resultType="DictData">
|
||||
SELECT
|
||||
T2.*
|
||||
FROM
|
||||
sys_dict_type t1,
|
||||
sys_dict_data t2
|
||||
WHERE
|
||||
t1.id = t2.Type_Id
|
||||
AND T1.State = 1
|
||||
AND T2.State = 1
|
||||
AND t1.NAME = #{dicTypeName}
|
||||
AND t2.NAME = #{dicDataName}
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.njcn.system.mapper.DictTypeMapper">
|
||||
|
||||
<select id="dictDataCache" resultType="DictDataCache">
|
||||
select
|
||||
t1.id id,
|
||||
t1.name name,
|
||||
t1.code code,
|
||||
t1.sort sort,
|
||||
t2.id typeId,
|
||||
t2.name typeName,
|
||||
t2.code typeCode
|
||||
from
|
||||
sys_dict_data t1,
|
||||
sys_dict_type t2
|
||||
where
|
||||
t1.Type_Id = t2.id
|
||||
and
|
||||
t1.state = 1
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.njcn.system.mapper.ResourceMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.njcn.system.mapper.TaskMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.njcn.system.mapper.ThemeMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,106 @@
|
||||
package com.njcn.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.system.pojo.dto.AreaTreeDTO;
|
||||
import com.njcn.system.pojo.param.AreaParam;
|
||||
import com.njcn.system.pojo.param.DictTypeParam;
|
||||
import com.njcn.system.pojo.po.Area;
|
||||
import com.njcn.system.pojo.vo.AreaTreeVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author hongawen
|
||||
* @since 2021-12-13
|
||||
*/
|
||||
public interface IAreaService extends IService<Area> {
|
||||
|
||||
/**
|
||||
* 根据前台传递参数,分页查询行政区域信息
|
||||
*
|
||||
* @param queryParam 查询参数
|
||||
* @return 行政区域列表
|
||||
*/
|
||||
Page<Area> listDictData(AreaParam.QueryParam queryParam);
|
||||
|
||||
/**
|
||||
* 根据行政区域id查询详情
|
||||
*
|
||||
* @param id 行政区域id
|
||||
* @return 行政区域详情详情
|
||||
*/
|
||||
Area selectIdArea(String id);
|
||||
|
||||
/**
|
||||
* 根据行政区域id查询详情
|
||||
*
|
||||
* @param list 行政区域id集合
|
||||
* @return 行政区域详情详情
|
||||
*/
|
||||
List<Area> selectAreaByList(List<String> list);
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
List<Area> selectPid(List<String> ids);
|
||||
|
||||
/**
|
||||
* 行政区域树
|
||||
*
|
||||
* @param type 区域类型
|
||||
* @return 树形结构
|
||||
*/
|
||||
List<AreaTreeVO> areaTree(String id, Integer type);
|
||||
|
||||
/**
|
||||
* 新增企业区域
|
||||
* @param areaParam 企业区域
|
||||
* @return 新增结果
|
||||
*/
|
||||
boolean addAreaParam(AreaParam areaParam);
|
||||
|
||||
/**
|
||||
* 修改企业区域
|
||||
* @param updateParam 企业区域数据
|
||||
* @return 操作结果
|
||||
*/
|
||||
boolean updateArea(AreaParam.AreaUpdateParam updateParam);
|
||||
|
||||
/**
|
||||
* 批量逻辑删除企业区域数据
|
||||
* @param ids 企业区域id集合
|
||||
* @return 操作结果
|
||||
*/
|
||||
boolean deleteArea(List<String> ids);
|
||||
|
||||
/**
|
||||
* 行政区域树
|
||||
*
|
||||
* @param type 区域类型
|
||||
* @return 树形结构
|
||||
*/
|
||||
List<AreaTreeDTO> areaDeptTree(String id, Integer type);
|
||||
|
||||
/**
|
||||
* 根据区域id获取省份信息
|
||||
*
|
||||
* @param type 区域类型
|
||||
* @return 树形结构
|
||||
*/
|
||||
Area areaPro(String id, Integer type);
|
||||
|
||||
List<AreaTreeVO> getDeptIdAreaTree();
|
||||
|
||||
/**
|
||||
* 根据行政区域名称查询详细
|
||||
*
|
||||
* @param name 行政区域名称
|
||||
* @return 行政区域详情
|
||||
*/
|
||||
Area selectAreaByName(String name);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.njcn.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.system.pojo.po.Config;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author hongawen
|
||||
* @since 2021-12-13
|
||||
*/
|
||||
public interface IConfigService extends IService<Config> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
package com.njcn.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.system.pojo.param.DictDataParam;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import com.njcn.system.pojo.po.DictType;
|
||||
import com.njcn.system.pojo.vo.DictDataVO;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author hongawen
|
||||
* @since 2021-12-13
|
||||
*/
|
||||
public interface IDictDataService extends IService<DictData> {
|
||||
|
||||
/**
|
||||
* 根据前台传递参数,分页查询字典数据
|
||||
* @param queryParam 查询参数
|
||||
* @return 字典列表
|
||||
*/
|
||||
Page<DictDataVO> listDictData(DictDataParam.DictDataQueryParam queryParam);
|
||||
|
||||
/**
|
||||
* 新增数据字典
|
||||
* @param dictDataParam 字典数据
|
||||
* @return 操作结果
|
||||
*/
|
||||
boolean addDictData(DictDataParam dictDataParam);
|
||||
|
||||
/**
|
||||
* 更新字典数据
|
||||
* @param updateParam 字典数据
|
||||
* @return 操作结果
|
||||
*/
|
||||
boolean updateDictData(DictDataParam.DictDataUpdateParam updateParam);
|
||||
|
||||
/**
|
||||
* 批量逻辑删除字典数据
|
||||
* @param ids 字典id集合
|
||||
* @return 操作结果
|
||||
*/
|
||||
boolean deleteDictData(List<String> ids);
|
||||
|
||||
/**
|
||||
* 根据字典类型id查询字典信息
|
||||
*/
|
||||
Page<DictDataVO> getTypeIdData(DictDataParam.DicTypeIdQueryParam queryParam);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param dicIndex 字典id
|
||||
* @return 根据字典id查询字典数据
|
||||
*/
|
||||
DictData getDicDataById(String dicIndex);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param dictypeName 字典类型名称
|
||||
* @return 根据字典类型名称查询字典数据
|
||||
*/
|
||||
List<DictData> getDicDataByTypeName(String dictypeName);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param dicName 字典名称
|
||||
* @return 根据字典名称查询字典数据
|
||||
*/
|
||||
DictData getDicDataByName(String dicName);
|
||||
|
||||
/**
|
||||
* 根据系统获取指标参数
|
||||
* @return 操作结果
|
||||
*/
|
||||
List<DictData> getLoadTypeBySys();
|
||||
|
||||
/**
|
||||
* 根据字典类型名称&数据名称获取字典数据
|
||||
*
|
||||
* @param dicTypeName 字典类型名称
|
||||
* @param dicDataName 字典数据名称
|
||||
* @return 字典数据
|
||||
*/
|
||||
DictData getDicDataByNameAndTypeName(String dicTypeName, String dicDataName);
|
||||
|
||||
/**
|
||||
* 后台新增字典数据
|
||||
* @param dicTypeName 类型名称
|
||||
* @param dicDataName 数据名称
|
||||
* @return 新增后的字典数据
|
||||
*/
|
||||
DictData addDictData(String dicTypeName, String dicDataName);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package com.njcn.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.common.pojo.dto.SimpleDTO;
|
||||
import com.njcn.common.pojo.dto.SimpleTreeDTO;
|
||||
import com.njcn.system.pojo.param.DictTypeParam;
|
||||
import com.njcn.system.pojo.po.DictType;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @since 2021-12-13
|
||||
*/
|
||||
public interface IDictTypeService extends IService<DictType> {
|
||||
|
||||
/**
|
||||
* 根据前台传递参数,分页查询字典类型数据
|
||||
* @param queryParam 查询参数
|
||||
* @return 字典列表
|
||||
*/
|
||||
Page<DictType> listDictTypes(DictTypeParam.DictTypeQueryParam queryParam);
|
||||
|
||||
/**
|
||||
* 新增字典类型数据
|
||||
*
|
||||
* @param dictTypeParam 字典类型数据
|
||||
* @return 操作结果
|
||||
*/
|
||||
boolean addDictType(DictTypeParam dictTypeParam);
|
||||
|
||||
/**
|
||||
* 修改字典类型
|
||||
*
|
||||
* @param updateParam 字典类型数据
|
||||
* @return 操作结果
|
||||
*/
|
||||
boolean updateDictType(DictTypeParam.DictTypeUpdateParam updateParam);
|
||||
|
||||
/**
|
||||
* 批量逻辑删除字典类型数据
|
||||
* @param ids id集合
|
||||
* @return 操作结果
|
||||
*/
|
||||
boolean deleteDictType(List<String> ids);
|
||||
|
||||
/**
|
||||
* 获取所有字典数据基础信息
|
||||
* @return 返回所有字典数据
|
||||
*/
|
||||
List<SimpleTreeDTO> dictDataCache();
|
||||
|
||||
/**
|
||||
* 根据名称获取字典类型数据
|
||||
* @param dicTypeName 类型名称
|
||||
* @return 类型数据
|
||||
*/
|
||||
DictType getByName(String dicTypeName);
|
||||
|
||||
/**
|
||||
* 根据名称新增字典类型数据
|
||||
* @param dicTypeName 类型名称
|
||||
* @return 类型数据
|
||||
*/
|
||||
DictType addByName(String dicTypeName);
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.njcn.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.system.pojo.param.MxGraphParam;
|
||||
import com.njcn.system.pojo.po.MxGraph;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* pqs
|
||||
*
|
||||
* @author cdf
|
||||
* @date 2022/1/26
|
||||
*/
|
||||
public interface IMxGraphService extends IService<MxGraph> {
|
||||
|
||||
/**
|
||||
* 新增组态
|
||||
* @author cdf
|
||||
* @date 2022/1/26
|
||||
*/
|
||||
boolean addKingView(MxGraphParam mxGraphParam);
|
||||
|
||||
/**
|
||||
*
|
||||
* @author cdf
|
||||
* @date 2022/1/26
|
||||
*/
|
||||
List<MxGraph> getKingViewList();
|
||||
|
||||
|
||||
MxGraph getKingViewById(String id);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.njcn.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.system.pojo.po.Resource;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author hongawen
|
||||
* @since 2021-12-13
|
||||
*/
|
||||
public interface IResourceService extends IService<Resource> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.njcn.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.system.pojo.po.Task;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author hongawen
|
||||
* @since 2021-12-13
|
||||
*/
|
||||
public interface ITaskService extends IService<Task> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package com.njcn.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.system.pojo.param.ThemeParam;
|
||||
import com.njcn.system.pojo.po.Theme;
|
||||
import com.sun.org.apache.xpath.internal.operations.Bool;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author hongawen
|
||||
* @since 2021-12-13
|
||||
*/
|
||||
public interface IThemeService extends IService<Theme> {
|
||||
|
||||
/**
|
||||
* 功能描述: 新增主题
|
||||
* TODO
|
||||
*
|
||||
* @param themeParam
|
||||
* @return java.lang.Boolean
|
||||
* @author xy
|
||||
* @date 2022/1/12 14:13
|
||||
*/
|
||||
boolean addTheme(ThemeParam themeParam);
|
||||
|
||||
/**
|
||||
* 功能描述: 修改主题
|
||||
* TODO
|
||||
*
|
||||
* @param themeParam
|
||||
* @return boolean
|
||||
* @author xy
|
||||
* @date 2022/1/13 11:30
|
||||
*/
|
||||
boolean updateTheme(ThemeParam.ThemeUpdateParam themeParam);
|
||||
|
||||
/**
|
||||
* 功能描述: 获取所有主题
|
||||
* TODO
|
||||
*
|
||||
* @param
|
||||
* @return java.util.List<com.njcn.system.pojo.po.Theme>
|
||||
* @author xy
|
||||
* @date 2022/1/12 15:38
|
||||
*/
|
||||
List<Theme> getAllThemes();
|
||||
|
||||
/**
|
||||
* 功能描述: 获取当前主题
|
||||
* TODO
|
||||
*
|
||||
* @param
|
||||
* @return com.njcn.system.pojo.po.Theme
|
||||
* @author xy
|
||||
* @date 2022/1/12 15:39
|
||||
*/
|
||||
Theme getTheme();
|
||||
|
||||
/**
|
||||
* 功能描述: 删除主题
|
||||
* TODO
|
||||
*
|
||||
* @param id
|
||||
* @return boolean
|
||||
* @author xy
|
||||
* @date 2022/1/12 16:48
|
||||
*/
|
||||
boolean deleteTheme(String id);
|
||||
|
||||
/**
|
||||
* 功能描述: 激活主题
|
||||
* TODO
|
||||
*
|
||||
* @param id
|
||||
* @return boolean
|
||||
* @author xy
|
||||
* @date 2022/1/12 16:48
|
||||
*/
|
||||
boolean activateTheme(String id);
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,280 @@
|
||||
package com.njcn.system.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.system.enums.SystemResponseEnum;
|
||||
import com.njcn.system.mapper.AreaMapper;
|
||||
import com.njcn.system.pojo.dto.AreaTreeDTO;
|
||||
import com.njcn.system.pojo.param.AreaParam;
|
||||
import com.njcn.system.pojo.po.Area;
|
||||
import com.njcn.system.pojo.vo.AreaTreeVO;
|
||||
import com.njcn.system.service.IAreaService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.user.api.DeptFeignClient;
|
||||
import com.njcn.user.pojo.po.Dept;
|
||||
import com.njcn.web.factory.PageFactory;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author hongawen
|
||||
* @since 2021-12-13
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class AreaServiceImpl extends ServiceImpl<AreaMapper, Area> implements IAreaService {
|
||||
|
||||
private final DeptFeignClient deptFeignClient;
|
||||
|
||||
@Override
|
||||
public Page<Area> listDictData(AreaParam.QueryParam queryParam) {
|
||||
QueryWrapper<Area> queryWrapper = new QueryWrapper<>();
|
||||
if (ObjectUtil.isNotNull(queryParam)) {
|
||||
//查询参数不为空,进行条件填充
|
||||
if (StrUtil.isNotBlank(queryParam.getSearchValue())) {
|
||||
//部门根据名称模糊查询
|
||||
queryWrapper
|
||||
.and(param -> param.like("sys_area.name", queryParam.getSearchValue()));
|
||||
}
|
||||
}
|
||||
queryWrapper.ne("sys_area.state", DataStateEnum.DELETED.getCode());
|
||||
queryWrapper.ge("sys_area.type", queryParam.getType());
|
||||
//初始化分页数据
|
||||
return this.baseMapper.selectPage(new Page<>(PageFactory.getPageNum(queryParam), PageFactory.getPageSize(queryParam)), queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Area selectIdArea(String id) {
|
||||
return this.baseMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Area> selectAreaByList(List<String> list) {
|
||||
return this.lambdaQuery().in(Area::getId, list).list();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Area> selectPid(List<String> ids) {
|
||||
return this.baseMapper.selectPid(ids, DataStateEnum.ENABLE.getCode());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AreaTreeVO> areaTree(String id, Integer type) {
|
||||
List<AreaTreeVO> areaTreeVOList = new ArrayList<>();
|
||||
if (id.equals("") || id == null) {
|
||||
/**
|
||||
* 用于首次访问区域。此处需要获取当前用户所绑定的部门下的行政区域id
|
||||
* 现在默认为0
|
||||
*/
|
||||
id = deptFeignClient.getAreaIdByDeptId(RequestUtil.getDeptIndex()).getData();
|
||||
}
|
||||
List<AreaTreeVO> areaTreeVOS = new ArrayList<>();
|
||||
if (type == 1) {
|
||||
areaTreeVOList = this.baseMapper.getAreaIdTree(type, DataStateEnum.ENABLE.getCode());
|
||||
List<AreaTreeVO> finalAreaTreeVOList = areaTreeVOList;
|
||||
areaTreeVOS = areaTreeVOList.stream().filter(deptTreeVO ->
|
||||
deptTreeVO.getPid().equals("0")
|
||||
).map((deptFirst) -> {
|
||||
//map映射方法改变结果,调用getChildrens()方法,把一级部门deptFirst和所有数据allDept作为参数传递,查询所有下级部门
|
||||
deptFirst.setChildren(getChildrens(deptFirst, finalAreaTreeVOList));
|
||||
return deptFirst;
|
||||
}).collect(Collectors.toList());
|
||||
} else {
|
||||
areaTreeVOS = this.baseMapper.getAreaTree(id, type, DataStateEnum.ENABLE.getCode());
|
||||
;
|
||||
}
|
||||
return areaTreeVOS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归查找所有企业的下级
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private List<AreaTreeVO> getChildrens(AreaTreeVO areaTreeVO, List<AreaTreeVO> allArea) {
|
||||
List<AreaTreeVO> chilrdenList = allArea.stream().filter(area -> {
|
||||
//在全部数据中,找到和一级部门deptFirst的valueId相等的parentId
|
||||
return area.getPid().equals(areaTreeVO.getId());
|
||||
}).map(deptId -> {
|
||||
//递归查询找到下级部门
|
||||
deptId.setChildren(getChildrens(deptId, allArea));
|
||||
return deptId;
|
||||
}).collect(Collectors.toList());
|
||||
return chilrdenList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addAreaParam(AreaParam areaParam) {
|
||||
checkAreaCode(areaParam, false);
|
||||
Area area = new Area();
|
||||
BeanUtil.copyProperties(areaParam, area);
|
||||
if (areaParam.getPid().equals("0")) {
|
||||
//上层节点
|
||||
area.setPids("0");
|
||||
} else {
|
||||
String pids = "," + areaParam.getPid();
|
||||
String pid = this.baseMapper.getIdString(area.getPid());
|
||||
//上层节点
|
||||
area.setPids(pid + pids);
|
||||
}
|
||||
//默认为正常状态
|
||||
area.setState(DataStateEnum.ENABLE.getCode());
|
||||
return this.save(area);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateArea(AreaParam.AreaUpdateParam updateParam) {
|
||||
checkAreaCode(updateParam, true);
|
||||
Area area = new Area();
|
||||
if (updateParam.getPid().equals("0")) {
|
||||
//上层节点
|
||||
area.setPids("0");
|
||||
} else {
|
||||
String pids = "," + updateParam.getPid();
|
||||
String pid = this.baseMapper.getIdString(area.getPid());
|
||||
//上层节点
|
||||
area.setPids(pid + pids);
|
||||
}
|
||||
BeanUtil.copyProperties(updateParam, area);
|
||||
return this.updateById(area);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteArea(List<String> ids) {
|
||||
/**
|
||||
* 查询子节点
|
||||
*/
|
||||
List<Area> list = this.baseMapper.selectPid(ids, DataStateEnum.ENABLE.getCode());
|
||||
/**
|
||||
* 将子节点叶添加到需要删除中
|
||||
*/
|
||||
if (list.size() > 0) {
|
||||
for (Area area : list) {
|
||||
ids.add(area.getId());
|
||||
}
|
||||
}
|
||||
return this.lambdaUpdate().set(Area::getState, DataStateEnum.DELETED.getCode()).in(Area::getId, ids).update();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AreaTreeDTO> areaDeptTree(String id, Integer type) {
|
||||
List<AreaTreeDTO> areaTreeVOList = new ArrayList<>();
|
||||
List<AreaTreeDTO> areaTreeVOS = new ArrayList<>();
|
||||
if (id.equals("") || id == null) {
|
||||
/**
|
||||
* 用于首次访问区域。此处需要获取当前用户所绑定的部门下的行政区域id
|
||||
* 现在默认为0
|
||||
*/
|
||||
|
||||
id = deptFeignClient.getAreaIdByDeptId(RequestUtil.getDeptIndex()).getData();
|
||||
}
|
||||
areaTreeVOList = this.baseMapper.getAreaDeptTree(type, DataStateEnum.ENABLE.getCode());
|
||||
List<AreaTreeDTO> finalAreaTreeVOList = areaTreeVOList;
|
||||
String finalId = id;
|
||||
areaTreeVOS = areaTreeVOList.stream().filter(deptTreeVO ->
|
||||
deptTreeVO.getPid().equals(finalId)
|
||||
).map((deptFirst) -> {
|
||||
//map映射方法改变结果,调用getChildrens()方法,把一级部门deptFirst和所有数据allDept作为参数传递,查询所有下级部门
|
||||
deptFirst.setChildren(getChildrens(deptFirst, finalAreaTreeVOList));
|
||||
return deptFirst;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
return areaTreeVOS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Area areaPro(String id, Integer type) {
|
||||
QueryWrapper<Area> areaQueryWrapper = new QueryWrapper<>();
|
||||
areaQueryWrapper.eq("sys_area.id", id);
|
||||
areaQueryWrapper.eq("sys_area.type", type);
|
||||
areaQueryWrapper.eq("sys_area.state", DataStateEnum.ENABLE.getCode());
|
||||
Area area = this.baseMapper.selectOne(areaQueryWrapper);
|
||||
if (!area.getPid().equals("0")) {
|
||||
id = area.getPid();
|
||||
area = areaPro(id, type);
|
||||
}
|
||||
return area;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AreaTreeVO> getDeptIdAreaTree() {
|
||||
|
||||
//获取当前系统登录的部门信息
|
||||
String areaId = deptFeignClient.getAreaIdByDeptId(RequestUtil.getDeptIndex()).getData();
|
||||
List<AreaTreeVO> areaTreeVOS = this.baseMapper.getAreaAll();
|
||||
List<AreaTreeVO> areaTreeVOLists = areaTreeVOS.stream().filter(areaTreeVO ->
|
||||
areaTreeVO.getId().equals(areaId)
|
||||
).map((areaFirst) -> {
|
||||
//map映射方法改变结果,调用getChildrens()方法,把一级部门deptFirst和所有数据allDept作为参数传递,查询所有下级部门
|
||||
areaFirst.setChildren(getChildrens(areaFirst, areaTreeVOS));
|
||||
return areaFirst;
|
||||
}).collect(Collectors.toList());
|
||||
return areaTreeVOLists;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Area selectAreaByName(String name) {
|
||||
LambdaQueryWrapper<Area> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(Area::getName, name);
|
||||
return this.baseMapper.selectOne(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归查找所有企业的下级
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private List<AreaTreeDTO> getChildrens(AreaTreeDTO areaTreeVO, List<AreaTreeDTO> allArea) {
|
||||
List<AreaTreeDTO> chilrdenList = allArea.stream().filter(area -> {
|
||||
//在全部数据中,找到和一级部门deptFirst的valueId相等的parentId
|
||||
return area.getPid().equals(areaTreeVO.getId());
|
||||
}).map(deptId -> {
|
||||
//递归查询找到下级部门
|
||||
deptId.setChildren(getChildrens(deptId, allArea));
|
||||
return deptId;
|
||||
}).collect(Collectors.toList());
|
||||
return chilrdenList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验参数,检查是否存在相同编码的企业区域
|
||||
*/
|
||||
private void checkAreaCode(AreaParam areaParam, boolean isExcludeSelf) {
|
||||
LambdaQueryWrapper<Area> dictTypeLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
dictTypeLambdaQueryWrapper
|
||||
.eq(Area::getAreaCode, areaParam.getAreaCode())
|
||||
.eq(Area::getState, DataStateEnum.ENABLE.getCode());
|
||||
//更新的时候,需排除当前记录
|
||||
if (isExcludeSelf) {
|
||||
if (areaParam instanceof AreaParam.AreaUpdateParam) {
|
||||
dictTypeLambdaQueryWrapper.ne(Area::getId, ((AreaParam.AreaUpdateParam) areaParam).getId());
|
||||
}
|
||||
}
|
||||
int countByAccount = this.count(dictTypeLambdaQueryWrapper);
|
||||
//大于等于1个则表示重复
|
||||
if (countByAccount >= 1) {
|
||||
throw new BusinessException(SystemResponseEnum.AREA_CODE_REPEAT);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.njcn.system.service.impl;
|
||||
|
||||
import com.njcn.system.mapper.ConfigMapper;
|
||||
import com.njcn.system.pojo.po.Config;
|
||||
import com.njcn.system.service.IConfigService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author hongawen
|
||||
* @since 2021-12-13
|
||||
*/
|
||||
@Service
|
||||
public class ConfigServiceImpl extends ServiceImpl<ConfigMapper, Config> implements IConfigService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,201 @@
|
||||
package com.njcn.system.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.db.constant.DbConstant;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.system.enums.DicDataTypeEnum;
|
||||
import com.njcn.system.enums.SystemResponseEnum;
|
||||
import com.njcn.system.mapper.DictDataMapper;
|
||||
import com.njcn.system.pojo.constant.SystemType;
|
||||
import com.njcn.system.pojo.param.DictDataParam;
|
||||
import com.njcn.system.pojo.po.Config;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import com.njcn.system.pojo.po.DictType;
|
||||
import com.njcn.system.pojo.vo.DictDataVO;
|
||||
import com.njcn.system.service.IConfigService;
|
||||
import com.njcn.system.service.IDictDataService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.system.service.IDictTypeService;
|
||||
import com.njcn.web.factory.PageFactory;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @since 2021-12-13
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class DictDataServiceImpl extends ServiceImpl<DictDataMapper, DictData> implements IDictDataService {
|
||||
|
||||
private final IConfigService iConfigService;
|
||||
|
||||
private final IDictTypeService dictTypeService;
|
||||
|
||||
@Override
|
||||
public Page<DictDataVO> listDictData(DictDataParam.DictDataQueryParam queryParam) {
|
||||
QueryWrapper<DictDataVO> queryWrapper = new QueryWrapper<>();
|
||||
if (ObjectUtil.isNotNull(queryParam)) {
|
||||
//查询参数不为空,进行条件填充
|
||||
if (StrUtil.isNotBlank(queryParam.getSearchValue())) {
|
||||
//字典类型表,仅提供名称、编码模糊查询
|
||||
queryWrapper
|
||||
.and(param -> param.like("sys_dict_data.name", queryParam.getSearchValue())
|
||||
.or().like("sys_dict_data.code", queryParam.getSearchValue()));
|
||||
}
|
||||
//排序
|
||||
if (ObjectUtil.isAllNotEmpty(queryParam.getSortBy(), queryParam.getOrderBy())) {
|
||||
queryWrapper.orderBy(true, queryParam.getOrderBy().equals(DbConstant.ASC), StrUtil.toUnderlineCase(queryParam.getSortBy()));
|
||||
} else {
|
||||
//没有排序参数,默认根据sort字段排序,没有排序字段的,根据updateTime更新时间排序
|
||||
queryWrapper.orderBy(true, true, "sys_dict_data.sort");
|
||||
}
|
||||
}
|
||||
queryWrapper.ne("sys_dict_data.state", DataStateEnum.DELETED.getCode());
|
||||
//初始化分页数据
|
||||
return this.baseMapper.page(new Page<>(PageFactory.getPageNum(queryParam), PageFactory.getPageSize(queryParam)), queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addDictData(DictDataParam dictDataParam) {
|
||||
checkDicDataName(dictDataParam, false);
|
||||
DictData dictData = new DictData();
|
||||
BeanUtil.copyProperties(dictDataParam, dictData);
|
||||
//默认为正常状态
|
||||
dictData.setState(DataStateEnum.ENABLE.getCode());
|
||||
return this.save(dictData);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateDictData(DictDataParam.DictDataUpdateParam updateParam) {
|
||||
checkDicDataName(updateParam, true);
|
||||
DictData dictData = new DictData();
|
||||
BeanUtil.copyProperties(updateParam, dictData);
|
||||
return this.updateById(dictData);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteDictData(List<String> ids) {
|
||||
return this.lambdaUpdate()
|
||||
.set(DictData::getState, DataStateEnum.DELETED.getCode())
|
||||
.in(DictData::getId, ids)
|
||||
.update();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<DictDataVO> getTypeIdData(DictDataParam.DicTypeIdQueryParam queryParam) {
|
||||
QueryWrapper<DictDataVO> queryWrapper = new QueryWrapper<>();
|
||||
if (ObjectUtil.isNotNull(queryParam)) {
|
||||
//查询参数不为空,进行条件填充
|
||||
if (StrUtil.isNotBlank(queryParam.getSearchValue())) {
|
||||
//字典类型表,仅提供名称、编码模糊查询
|
||||
queryWrapper
|
||||
.and(param -> param.like("sys_dict_data.name", queryParam.getSearchValue())
|
||||
.or().like("sys_dict_data.code", queryParam.getSearchValue()));
|
||||
}
|
||||
//排序
|
||||
if (ObjectUtil.isAllNotEmpty(queryParam.getSortBy(), queryParam.getOrderBy())) {
|
||||
queryWrapper.orderBy(true, queryParam.getOrderBy().equals(DbConstant.ASC), StrUtil.toUnderlineCase(queryParam.getSortBy()));
|
||||
} else {
|
||||
//没有排序参数,默认根据sort字段排序,没有排序字段的,根据updateTime更新时间排序
|
||||
queryWrapper.orderBy(true, true, "sys_dict_data.sort");
|
||||
}
|
||||
}
|
||||
queryWrapper.ne("sys_dict_data.state", DataStateEnum.DELETED.getCode());
|
||||
queryWrapper.eq("sys_dict_data.type_id", queryParam.getTypeId());
|
||||
//初始化分页数据
|
||||
return this.baseMapper.page(new Page<>(PageFactory.getPageNum(queryParam), PageFactory.getPageSize(queryParam)), queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DictData getDicDataById(String dicIndex) {
|
||||
|
||||
return this.baseMapper.selectById(dicIndex);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DictData> getDicDataByTypeName(String dictTypeName) {
|
||||
return this.baseMapper.getDicDataByTypeName(dictTypeName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DictData getDicDataByName(String dicName) {
|
||||
return this.baseMapper.getDicDataByName(dicName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DictData> getLoadTypeBySys() {
|
||||
List<DictData> list = new ArrayList<>();
|
||||
Config config = iConfigService.lambdaQuery()
|
||||
.eq(Config::getState, DataStateEnum.ENABLE.getCode())
|
||||
.one();
|
||||
if (Objects.equals(config.getType(), SystemType.ENTERPRISE_SYSTEM)) {
|
||||
List<DictData> dataList = this.baseMapper.getDicDataByTypeName(DicDataTypeEnum.INDICATOR_TYPE.getName());
|
||||
return dataList.stream().filter(item -> Objects.equals(item.getName(), DicDataEnum.XBDY_ENUM.getName()) || Objects.equals(item.getName(), DicDataEnum.XBDL_ENUM.getName())).collect(Collectors.toList());
|
||||
} else {
|
||||
list = this.baseMapper.getDicDataByTypeName(DicDataTypeEnum.INDICATOR_TYPE.getName()).stream().sorted(Comparator.comparing(DictData::getSort)).collect(Collectors.toList());
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DictData getDicDataByNameAndTypeName(String dicTypeName, String dicDataName) {
|
||||
return this.baseMapper.getDicDataByNameAndTypeName(dicTypeName,dicDataName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DictData addDictData(String dicTypeName, String dicDataName) {
|
||||
//根据type名称获取index,如果不存在该字典类型,则新增该字典类型
|
||||
DictType dictType = dictTypeService.getByName(dicTypeName);
|
||||
if (Objects.isNull(dictType)) {
|
||||
dictType = dictTypeService.addByName(dicTypeName);
|
||||
}
|
||||
DictData dictData = new DictData();
|
||||
dictData.setTypeId(dictType.getId());
|
||||
dictData.setName(dicDataName);
|
||||
dictData.setCode(dicDataName);
|
||||
dictData.setSort(0);
|
||||
dictData.setLevel(0);
|
||||
dictData.setState(DataStateEnum.ENABLE.getCode());
|
||||
this.save(dictData);
|
||||
return dictData;
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验参数,检查是否存在相同名称的字典类型
|
||||
*/
|
||||
private void checkDicDataName(DictDataParam dictDataParam, boolean isExcludeSelf) {
|
||||
LambdaQueryWrapper<DictData> dictDataLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
dictDataLambdaQueryWrapper
|
||||
.eq(DictData::getName, dictDataParam.getName())
|
||||
.eq(DictData::getTypeId, dictDataParam.getTypeId())
|
||||
.eq(DictData::getState, DataStateEnum.ENABLE.getCode());
|
||||
//更新的时候,需排除当前记录
|
||||
if (isExcludeSelf) {
|
||||
if (dictDataParam instanceof DictDataParam.DictDataUpdateParam) {
|
||||
dictDataLambdaQueryWrapper.ne(DictData::getId, ((DictDataParam.DictDataUpdateParam) dictDataParam).getId());
|
||||
}
|
||||
}
|
||||
int countByAccount = this.count(dictDataLambdaQueryWrapper);
|
||||
//大于等于1个则表示重复
|
||||
if (countByAccount >= 1) {
|
||||
throw new BusinessException(SystemResponseEnum.DICT_DATA_NAME_REPEAT);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,157 @@
|
||||
package com.njcn.system.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.pojo.dto.SimpleDTO;
|
||||
import com.njcn.common.pojo.dto.SimpleTreeDTO;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.db.constant.DbConstant;
|
||||
import com.njcn.system.enums.SystemResponseEnum;
|
||||
import com.njcn.system.mapper.DictTypeMapper;
|
||||
import com.njcn.system.pojo.param.DictTypeParam;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import com.njcn.system.pojo.po.DictType;
|
||||
import com.njcn.system.pojo.vo.DictDataCache;
|
||||
import com.njcn.system.service.IDictTypeService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.web.factory.PageFactory;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @since 2021-12-13
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class DictTypeServiceImpl extends ServiceImpl<DictTypeMapper, DictType> implements IDictTypeService {
|
||||
|
||||
@Override
|
||||
public Page<DictType> listDictTypes(DictTypeParam.DictTypeQueryParam queryParam) {
|
||||
QueryWrapper<DictType> queryWrapper = new QueryWrapper<>();
|
||||
if (ObjectUtil.isNotNull(queryParam)) {
|
||||
//查询参数不为空,进行条件填充
|
||||
if (StrUtil.isNotBlank(queryParam.getSearchValue())) {
|
||||
//字典类型表,仅提供名称、编码模糊查询
|
||||
queryWrapper
|
||||
.and(param -> param.like("sys_dict_type.name", queryParam.getSearchValue())
|
||||
.or().like("sys_dict_type.code", queryParam.getSearchValue())
|
||||
);
|
||||
}
|
||||
//排序
|
||||
if (ObjectUtil.isAllNotEmpty(queryParam.getSortBy(), queryParam.getOrderBy())) {
|
||||
queryWrapper.orderBy(true, queryParam.getOrderBy().equals(DbConstant.ASC), StrUtil.toUnderlineCase(queryParam.getSortBy()));
|
||||
} else {
|
||||
//没有排序参数,默认根据sort字段排序,没有排序字段的,根据updateTime更新时间排序
|
||||
queryWrapper.orderBy(true, true, "sys_dict_type.sort");
|
||||
}
|
||||
}
|
||||
queryWrapper.ne("sys_dict_type.state", DataStateEnum.DELETED.getCode());
|
||||
return this.baseMapper.selectPage(new Page<>(PageFactory.getPageNum(queryParam), PageFactory.getPageSize(queryParam)), queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addDictType(DictTypeParam dictTypeParam) {
|
||||
checkDicTypeName(dictTypeParam, false);
|
||||
DictType dictType = new DictType();
|
||||
BeanUtil.copyProperties(dictTypeParam, dictType);
|
||||
//默认为正常状态
|
||||
dictType.setState(DataStateEnum.ENABLE.getCode());
|
||||
return this.save(dictType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateDictType(DictTypeParam.DictTypeUpdateParam updateParam) {
|
||||
checkDicTypeName(updateParam, true);
|
||||
DictType dictType = new DictType();
|
||||
BeanUtil.copyProperties(updateParam, dictType);
|
||||
return this.updateById(dictType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteDictType(List<String> ids) {
|
||||
return this.lambdaUpdate()
|
||||
.set(DictType::getState, DataStateEnum.DELETED.getCode())
|
||||
.in(DictType::getId, ids)
|
||||
.update();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<SimpleTreeDTO> dictDataCache() {
|
||||
List<DictDataCache> allDictData = this.baseMapper.dictDataCache();
|
||||
Map<Object, List<DictDataCache>> dictDataCacheMap = allDictData.stream()
|
||||
.collect(Collectors.groupingBy(dictDataCache -> dictDataCache.getTypeId()));
|
||||
List<SimpleTreeDTO> dictTypeList = dictDataCacheMap.keySet().stream().map(typeId -> {
|
||||
SimpleTreeDTO simpleTreeDTO = new SimpleTreeDTO();
|
||||
List<DictDataCache> dictDataCaches = dictDataCacheMap.get(typeId);
|
||||
List<SimpleDTO> simpleDTOs = dictDataCaches.stream().map(dictDataCache -> {
|
||||
simpleTreeDTO.setCode(dictDataCache.getTypeCode());
|
||||
simpleTreeDTO.setId(dictDataCache.getTypeId());
|
||||
simpleTreeDTO.setName(dictDataCache.getTypeName());
|
||||
SimpleDTO simpleDTO = new SimpleDTO();
|
||||
simpleDTO.setCode(dictDataCache.getCode());
|
||||
simpleDTO.setId(dictDataCache.getId());
|
||||
simpleDTO.setName(dictDataCache.getName());
|
||||
simpleDTO.setSort(dictDataCache.getSort());
|
||||
return simpleDTO;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
simpleTreeDTO.setChildren(simpleDTOs);
|
||||
return simpleTreeDTO;
|
||||
}).collect(Collectors.toList());
|
||||
return dictTypeList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DictType getByName(String dicTypeName) {
|
||||
LambdaQueryWrapper<DictType> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(DictType::getName, dicTypeName)
|
||||
.eq(DictType::getState, DataStateEnum.ENABLE.getCode());
|
||||
return this.baseMapper.selectOne(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DictType addByName(String dicTypeName) {
|
||||
DictType dictType = new DictType();
|
||||
dictType.setName(dicTypeName);
|
||||
dictType.setCode(dicTypeName);
|
||||
dictType.setSort(0);
|
||||
dictType.setOpenDescribe(0);
|
||||
dictType.setOpenLevel(0);
|
||||
dictType.setState(DataStateEnum.ENABLE.getCode());
|
||||
this.save(dictType);
|
||||
return dictType;
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验参数,检查是否存在相同名称的字典类型
|
||||
*/
|
||||
private void checkDicTypeName(DictTypeParam dictTypeParam, boolean isExcludeSelf) {
|
||||
LambdaQueryWrapper<DictType> dictTypeLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
dictTypeLambdaQueryWrapper
|
||||
.eq(DictType::getName, dictTypeParam.getName())
|
||||
.eq(DictType::getState, DataStateEnum.ENABLE.getCode());
|
||||
//更新的时候,需排除当前记录
|
||||
if (isExcludeSelf) {
|
||||
if (dictTypeParam instanceof DictTypeParam.DictTypeUpdateParam) {
|
||||
dictTypeLambdaQueryWrapper.ne(DictType::getId, ((DictTypeParam.DictTypeUpdateParam) dictTypeParam).getId());
|
||||
}
|
||||
}
|
||||
int countByAccount = this.count(dictTypeLambdaQueryWrapper);
|
||||
//大于等于1个则表示重复
|
||||
if (countByAccount >= 1) {
|
||||
throw new BusinessException(SystemResponseEnum.DICT_TYPE_NAME_REPEAT);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.njcn.system.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.system.mapper.MxGraphMapper;
|
||||
import com.njcn.system.pojo.param.MxGraphParam;
|
||||
import com.njcn.system.pojo.po.MxGraph;
|
||||
import com.njcn.system.service.IMxGraphService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* pqs
|
||||
*
|
||||
* @author cdf
|
||||
* @date 2022/1/26
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class MxGraphServiceImpl extends ServiceImpl<MxGraphMapper, MxGraph> implements IMxGraphService {
|
||||
|
||||
private final MxGraphMapper mxGraphMapper;
|
||||
|
||||
@Override
|
||||
public boolean addKingView(MxGraphParam mxGraphParam) {
|
||||
MxGraph mxGraph = new MxGraph();
|
||||
BeanUtils.copyProperties(mxGraphParam,mxGraph);
|
||||
mxGraph.setState(DataStateEnum.ENABLE.getCode());
|
||||
return this.save(mxGraph);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MxGraph> getKingViewList() {
|
||||
LambdaQueryWrapper<MxGraph> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.orderByAsc(MxGraph::getSort);
|
||||
return this.list(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MxGraph getKingViewById(String id) {
|
||||
return this.getById(id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.njcn.system.service.impl;
|
||||
|
||||
import com.njcn.system.mapper.ResourceMapper;
|
||||
import com.njcn.system.pojo.po.Resource;
|
||||
import com.njcn.system.service.IResourceService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author hongawen
|
||||
* @since 2021-12-13
|
||||
*/
|
||||
@Service
|
||||
public class ResourceServiceImpl extends ServiceImpl<ResourceMapper, Resource> implements IResourceService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.njcn.system.service.impl;
|
||||
|
||||
import com.njcn.system.mapper.TaskMapper;
|
||||
import com.njcn.system.pojo.po.Task;
|
||||
import com.njcn.system.service.ITaskService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author hongawen
|
||||
* @since 2021-12-13
|
||||
*/
|
||||
@Service
|
||||
public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements ITaskService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
package com.njcn.system.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.system.enums.SystemResponseEnum;
|
||||
import com.njcn.system.enums.ThemeEnum;
|
||||
import com.njcn.system.mapper.ThemeMapper;
|
||||
import com.njcn.system.pojo.constant.ThemeState;
|
||||
import com.njcn.system.pojo.param.DictDataParam;
|
||||
import com.njcn.system.pojo.param.ThemeParam;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import com.njcn.system.pojo.po.Theme;
|
||||
import com.njcn.system.service.IThemeService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import sun.misc.BASE64Encoder;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author hongawen
|
||||
* @since 2021-12-13
|
||||
*/
|
||||
@Service
|
||||
public class ThemeServiceImpl extends ServiceImpl<ThemeMapper, Theme> implements IThemeService {
|
||||
|
||||
@Override
|
||||
public boolean addTheme(ThemeParam themeParam) {
|
||||
checkThemeParam(themeParam,false);
|
||||
Theme theme = new Theme();
|
||||
theme.setName(themeParam.getName());
|
||||
theme.setColor(themeParam.getColor());
|
||||
theme.setActive(ThemeState.INACTIVATED);
|
||||
theme.setRemark(themeParam.getRemark());
|
||||
theme.setState(ThemeState.NORMAL);
|
||||
theme.setLogoUrl(generateBase64(themeParam.getLogoFile()));
|
||||
theme.setFaviconUrl(generateBase64(themeParam.getFaviconFile()));
|
||||
return this.save(theme);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateTheme(ThemeParam.ThemeUpdateParam themeParam) {
|
||||
checkThemeParam(themeParam,true);
|
||||
Theme theme = new Theme();
|
||||
theme.setLogoUrl(generateBase64(themeParam.getLogoFile()));
|
||||
theme.setFaviconUrl(generateBase64(themeParam.getFaviconFile()));
|
||||
BeanUtil.copyProperties(themeParam, theme);
|
||||
return this.updateById(theme);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Theme> getAllThemes() {
|
||||
return this.lambdaQuery().eq(Theme::getState,ThemeState.NORMAL).select().list();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Theme getTheme() {
|
||||
return this.lambdaQuery()
|
||||
.eq(Theme::getActive,ThemeState.ACTIVATION).one();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteTheme(String id) {
|
||||
return this.lambdaUpdate()
|
||||
.set(Theme::getState, ThemeState.DELETE)
|
||||
.in(Theme::getId,id)
|
||||
.update();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean activateTheme(String id) {
|
||||
this.lambdaUpdate()
|
||||
.eq(Theme::getActive,ThemeState.ACTIVATION)
|
||||
.set(Theme::getActive, ThemeState.INACTIVATED)
|
||||
.update();
|
||||
return this.lambdaUpdate()
|
||||
.set(Theme::getActive, ThemeState.ACTIVATION)
|
||||
.in(Theme::getId,id)
|
||||
.update();
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验参数,
|
||||
* 1.检查是否存在相同名称的主题
|
||||
* 2.检查图片是否为空
|
||||
*/
|
||||
private void checkThemeParam(ThemeParam themeParam, boolean isExcludeSelf) {
|
||||
if (themeParam.getLogoFile().isEmpty()) {
|
||||
throw new BusinessException(ThemeEnum.LOGO_FILE_BLANK);
|
||||
}
|
||||
if (themeParam.getFaviconFile().isEmpty()) {
|
||||
throw new BusinessException(ThemeEnum.FAVICON_FILE_BLANK);
|
||||
}
|
||||
LambdaQueryWrapper<Theme> themeLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
themeLambdaQueryWrapper
|
||||
.eq(Theme::getName, themeParam.getName())
|
||||
.eq(Theme::getState, ThemeState.NORMAL);
|
||||
//更新的时候,需排除当前记录
|
||||
if (isExcludeSelf) {
|
||||
if (themeParam instanceof ThemeParam.ThemeUpdateParam) {
|
||||
themeLambdaQueryWrapper.ne(Theme::getId, ((ThemeParam.ThemeUpdateParam) themeParam).getId());
|
||||
}
|
||||
}
|
||||
int countByAccount = this.count(themeLambdaQueryWrapper);
|
||||
//大于等于1个则表示重复
|
||||
if (countByAccount >= 1) {
|
||||
throw new BusinessException(ThemeEnum.SAME_THEME_NAME);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* MultipartFile转换成base64
|
||||
*/
|
||||
public static String generateBase64(MultipartFile file){
|
||||
String base64EncoderImg= null;
|
||||
try {
|
||||
BASE64Encoder bEncoder=new BASE64Encoder();
|
||||
String[] suffixArra=file.getOriginalFilename().split("\\.");
|
||||
String preffix="data:image/jpg;base64,".replace("jpg", suffixArra[suffixArra.length - 1]);
|
||||
base64EncoderImg = preffix + bEncoder.encode(file.getBytes()).replaceAll("[\\s*\t\n\r]", "");
|
||||
} catch (IOException e) {
|
||||
e.getMessage();
|
||||
}
|
||||
return base64EncoderImg;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
48
pqs-system/system-boot/src/main/resources/bootstrap.yml
Normal file
48
pqs-system/system-boot/src/main/resources/bootstrap.yml
Normal file
@@ -0,0 +1,48 @@
|
||||
#当前服务的基本信息
|
||||
microservice:
|
||||
ename: @artifactId@
|
||||
name: '@name@'
|
||||
version: @version@
|
||||
sentinel:
|
||||
url: @sentinel.url@
|
||||
gateway:
|
||||
url: @gateway.url@
|
||||
server:
|
||||
port: 10207
|
||||
#feign接口开启服务熔断降级处理
|
||||
feign:
|
||||
sentinel:
|
||||
enabled: true
|
||||
spring:
|
||||
application:
|
||||
name: @artifactId@
|
||||
#nacos注册中心以及配置中心的指定
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
server-addr: @nacos.url@
|
||||
namespace: @nacos.namespace@
|
||||
config:
|
||||
server-addr: @nacos.url@
|
||||
namespace: @nacos.namespace@
|
||||
file-extension: yaml
|
||||
shared-configs:
|
||||
- data-id: share-config.yaml
|
||||
refresh: true
|
||||
- data-Id: share-config-datasource-db.yaml
|
||||
refresh: true
|
||||
main:
|
||||
allow-bean-definition-overriding: true
|
||||
|
||||
|
||||
|
||||
#项目日志的配置
|
||||
logging:
|
||||
config: http://@nacos.url@/nacos/v1/cs/configs?tenant=@nacos.namespace@&group=DEFAULT_GROUP&dataId=logback.xml
|
||||
level:
|
||||
root: info
|
||||
|
||||
#mybatis配置信息
|
||||
mybatis-plus:
|
||||
#别名扫描
|
||||
type-aliases-package: com.njcn.system.pojo
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.njcn;
|
||||
|
||||
import com.njcn.system.SystemBootMain;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.test.context.web.WebAppConfiguration;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @version 1.0.0
|
||||
* @date 2021年12月10日 15:05
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@WebAppConfiguration
|
||||
@SpringBootTest(classes = SystemBootMain.class)
|
||||
public class BaseJunitTest {
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.njcn;
|
||||
|
||||
import com.njcn.system.service.IDictTypeService;
|
||||
import org.junit.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @version 1.0.0
|
||||
* @date 2021年12月14日 12:55
|
||||
*/
|
||||
public class DictDataTest extends BaseJunitTest{
|
||||
|
||||
@Autowired
|
||||
private IDictTypeService dictTypeService;
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void test(){
|
||||
dictTypeService.dictDataCache();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user