去掉不要的文件

This commit is contained in:
2022-12-20 15:41:38 +08:00
parent 0d95485f97
commit fff8ac4be7
14 changed files with 2 additions and 822 deletions

View File

@@ -1,59 +0,0 @@
package org.nl.modules.system.rest;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.nl.modules.logging.annotation.Log;
import org.nl.modules.system.service.CodeDetailService;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
@RestController
@Api(tags = "系统:编码详情管理")
@RequiredArgsConstructor
@RequestMapping("/api/codeDetail2")
public class CodeDetailController {
private final CodeDetailService codeDetailService;
@ApiOperation("查询编码明细")
@GetMapping
@SaCheckPermission("genCode:list")
public ResponseEntity<Object> queryAll(@RequestParam Map form, Pageable pageable){
return new ResponseEntity<>(codeDetailService.queryAll(form,pageable), HttpStatus.OK);
}
@Log("新增编码")
@ApiOperation("新增编码")
@PostMapping
@SaCheckPermission("genCode:add")
public ResponseEntity<Object> create(@Validated @RequestBody Map form){
codeDetailService.create(form);
return new ResponseEntity<>(HttpStatus.CREATED);
}
@Log("删除编码")
@ApiOperation("删除编码")
@DeleteMapping(value = "/{id}")
@SaCheckPermission("genCode:del")
public ResponseEntity<Object> delete(@PathVariable String id){
codeDetailService.delete(id);
return new ResponseEntity<>(HttpStatus.OK);
}
@Log("修改字典")
@ApiOperation("修改字典")
@PutMapping
@SaCheckPermission("dict:edit")
public ResponseEntity<Object> update(@RequestBody JSONObject json){
codeDetailService.update(json);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
}

View File

@@ -1,69 +0,0 @@
package org.nl.modules.system.rest;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.nl.modules.logging.annotation.Log;
import org.nl.modules.system.service.GenCodeService;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.io.IOException;
import java.util.Map;
import java.util.Set;
@RestController
@Api(tags = "系统:编码生成")
@RequiredArgsConstructor
@RequestMapping("/api/genCode2")
public class GenCodeController {
private final GenCodeService genCodeService;
@ApiOperation("查询编码")
@GetMapping
@SaCheckPermission("genCode:list")
public ResponseEntity<Object> queryAll(@RequestParam Map form, Pageable pageable) {
return new ResponseEntity<>(genCodeService.queryAll(form, pageable), HttpStatus.OK);
}
@Log("新增编码")
@ApiOperation("新增编码")
@PostMapping
@SaCheckPermission("genCode:add")
public ResponseEntity<Object> create(@Validated @RequestBody Map form) {
genCodeService.create(form);
return new ResponseEntity<>(HttpStatus.CREATED);
}
@Log("删除编码")
@ApiOperation("删除编码")
@DeleteMapping
@SaCheckPermission("genCode:del")
public ResponseEntity<Object> delete(@RequestBody Set<String> ids) {
genCodeService.delete(ids);
return new ResponseEntity<>(HttpStatus.OK);
}
@Log("修改编码")
@ApiOperation("修改编码")
@PutMapping
@SaCheckPermission("genCode:edit")
public ResponseEntity<Object> update(@RequestBody JSONObject json) {
genCodeService.update(json);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@ApiOperation("导出任务数据")
@GetMapping(value = "/codeDemo")
@SaCheckPermission("genCode:list")
public ResponseEntity<Object> CodeDemo(@RequestParam Map form) throws IOException {
return new ResponseEntity<>(genCodeService.codeDemo(form), HttpStatus.OK);
}
}

View File

@@ -1,22 +0,0 @@
package org.nl.modules.system.service;
import com.alibaba.fastjson.JSONObject;
import org.springframework.data.domain.Pageable;
import java.util.Map;
public interface CodeDetailService {
/**
* 分页查询
* @param form 条件
* @param pageable 分页参数
* @return /
*/
JSONObject queryAll(Map form, Pageable pageable);
public void create(Map form);
public void delete(String id);
public void update(JSONObject json);
}

View File

@@ -1,46 +0,0 @@
package org.nl.modules.system.service;
import com.alibaba.fastjson.JSONObject;
import org.springframework.data.domain.Pageable;
import java.util.Map;
import java.util.Set;
public interface GenCodeService {
/**
* 分页查询
*
* @param form 条件
* @param pageable 分页参数
* @return /
*/
JSONObject queryAll(Map form, Pageable pageable);
/**
* 新增编码
* @param form
*/
public void create(Map form);
/**
* 删除编码
* @param ids
*/
public void delete(Set<String> ids);
/**
* 更新编码
* @param json
*/
public void update(JSONObject json);
public String codeDemo(Map form);
/**
* 根据编码获取id
* @param code
* @return
*/
public String queryIdByCode(String code);
}

View File

@@ -1,77 +0,0 @@
package org.nl.modules.system.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
import org.nl.modules.common.utils.SecurityUtils;
import org.nl.modules.system.service.CodeDetailService;
import org.nl.modules.wql.core.bean.ResultBean;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.modules.wql.util.WqlUtil;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.Map;
@Service
@RequiredArgsConstructor
public class CodeDetailServiceImpl implements CodeDetailService {
@Override
public JSONObject queryAll(Map form, Pageable pageable) {
String where = "code_rule_id = '"+form.get("id")+"'";
ResultBean rb = WQLObject.getWQLObject("sys_code_rule_detail").pagequery(WqlUtil.getHttpContext(pageable), where, "sort_num desc ");
final JSONObject json = rb.pageResult();
return json;
}
@Override
public void create(Map form) {
JSONObject json = new JSONObject();
String id = IdUtil.simpleUUID();
String now = DateUtil.now();
json.put("id",id);
json.put("type",form.get("type"));
json.put("init_value",form.get("init_value"));
json.put("current_value",form.get("init_value"));
json.put("max_value",form.get("max_value"));
json.put("step",form.get("step"));
json.put("fillchar",form.get("fillchar"));
json.put("format",form.get("format"));
json.put("length",form.get("length"));
json.put("sort_num",form.get("sort_num")+"");
json.put("remark",form.get("remark"));
Map dict = (Map) form.get("dict");
json.put("code_rule_id",dict.get("id"));
json.put("is_active","1");
json.put("is_delete","0");
json.put("create_id", SecurityUtils.getCurrentUserId());
json.put("create_name", SecurityUtils.getCurrentNickName());
json.put("create_time", now);
if(form.get("type").equals("02")){
Date date = DateUtil.date();
String format = (String) form.get("format");
String now_date = DateUtil.format(date, format);
json.put("init_value",now_date);
json.put("current_value",now_date);
}
WQLObject.getWQLObject("sys_code_rule_detail").insert(json);
}
@Override
public void delete(String id) {
WQLObject.getWQLObject("sys_code_rule_detail").delete("id = '"+id+"'");
}
@Override
public void update(JSONObject json) {
String now = DateUtil.now();
json.put("update_time",now);
json.put("update_id", SecurityUtils.getCurrentUserId());
json.put("update_optname", SecurityUtils.getCurrentNickName());
WQLObject.getWQLObject("sys_code_rule_detail").update(json);
}
}

View File

@@ -1,180 +0,0 @@
package org.nl.modules.system.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.common.utils.SecurityUtils;
import org.nl.modules.system.service.GenCodeService;
import org.nl.modules.wql.core.bean.ResultBean;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.modules.wql.util.WqlUtil;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
@Service
@RequiredArgsConstructor
public class GenCodeServiceImpl implements GenCodeService {
@Override
public JSONObject queryAll(Map form, Pageable pageable) {
String where = "1=1";
if (form.get("blurry") != null) {
where = "code like '%" + (String) form.get("blurry") + "%' OR name = '%" + form.get("blurry") + "%'";
}
ResultBean rb = WQLObject.getWQLObject("sys_code_rule").pagequery(WqlUtil.getHttpContext(pageable), where, "code desc ");
final JSONObject json = rb.pageResult();
JSONArray ja = json.getJSONArray("content");
JSONArray new_ja = new JSONArray();
for (int i = 0; i < ja.size(); i++) {
JSONObject jo = ja.getJSONObject(i);
HashMap map = new HashMap();
map.put("code", jo.getString("code"));
map.put("flag", "0");
String demo = this.codeDemo(map);
jo.put("demo", demo);
new_ja.add(jo);
}
json.put("content", new_ja);
return json;
}
@Override
public void create(Map form) {
String currentUserId = SecurityUtils.getCurrentUserId();
String currentUsername = SecurityUtils.getCurrentUsername();
WQLObject wql = WQLObject.getWQLObject("sys_code_rule");
JSONObject json = new JSONObject();
String id = IdUtil.simpleUUID();
String now = DateUtil.now();
String code = (String) form.get("code");
JSONObject jo = wql.query("code = '" + code + "'").uniqueResult(0);
if (jo != null){
throw new BadRequestException("该编码code已存在请校验");
}
json.put("id", id);
json.put("code", form.get("code"));
json.put("name", form.get("name"));
json.put("create_id", currentUserId);
json.put("update_id", currentUserId);
json.put("create_name", currentUsername);
json.put("update_optname", currentUsername);
json.put("create_time", now);
json.put("update_time", now);
WQLObject.getWQLObject("sys_code_rule").insert(json);
}
@Override
public void delete(Set<String> ids) {
for (String code : ids) {
WQLObject.getWQLObject("sys_code_rule").delete("id = '" + code + "'");
WQLObject.getWQLObject("sys_code_rule_detail").delete("code_rule_id = '" + code + "'");
}
}
@Override
public void update(JSONObject json) {
WQLObject wql = WQLObject.getWQLObject("sys_code_rule");
String code = json.getString("code");
String id = json.getString("id");
JSONObject jo = wql.query("id <> '"+id+"' and code = '"+code+"'").uniqueResult(0);
if (jo != null){
throw new BadRequestException("该编码code已存在请校验");
}
String now = DateUtil.now();
json.put("update_id", SecurityUtils.getCurrentUserId());
json.put("update_time", now);
json.put("update_optname", SecurityUtils.getCurrentUsername());
WQLObject.getWQLObject("sys_code_rule").update(json);
}
@Override
public synchronized String codeDemo(Map form) {
String code = (String) form.get("code");
String id = this.queryIdByCode(code);
//如果flag=1就执行更新数据库的操作
String flag = (String) form.get("flag");
WQLObject wo = WQLObject.getWQLObject("sys_code_rule_detail");
JSONArray ja = wo.query("code_rule_id = '" + id + "'", " sort_num").getResultJSONArray(0);
String demo = "";
boolean is_same = true;
for (int i = 0; i < ja.size(); i++) {
String value = "";
JSONObject jo = ja.getJSONObject(i);
//固定直接取值
if (jo.getString("type").equals("01")) {
value = jo.getString("init_value");
}
//日期判断数据库的值与当前值是否相同来决定顺序的值
if (jo.getString("type").equals("02")) {
String current_value = jo.getString("current_value");
Date date = DateUtil.date();
String format = jo.getString("format");
String now_date = DateUtil.format(date, format);
if (!now_date.equals(current_value)) {
is_same = false;
}
if (flag.equals("1")) {
jo.put("init_value", now_date);
jo.put("current_value", now_date);
}
value = now_date;
}
//顺序的值:如果日期一样就+步长,等于最大值就归为初始值;日期不一样就归为初始值
if (jo.getString("type").equals("03")) {
String num_value = "";
int step = jo.getInteger("step");
Long max_value = jo.getLong("max_value");
if (!is_same || (jo.getLongValue("current_value") + step > max_value)) {
num_value = jo.getString("init_value");
} else {
num_value = (jo.getInteger("current_value") + step) + "";
}
int size = num_value.length();
int length = jo.getInteger("length");
String fillchar = jo.getString("fillchar");
for (int m = 0; m < (length - size); m++) {
value += fillchar;
}
value += num_value;
if (flag.equals("1")) {
if (!is_same) {
int init_value = jo.getInteger("init_value");
if (StrUtil.isEmpty((init_value + ""))) {
throw new BadRequestException("请完善编码数值的初始值!");
}
jo.put("current_value", init_value + "");
} else {
int num_curr = jo.getInteger("current_value");
if (num_curr >= max_value) {
num_curr = jo.getInteger("init_value");
jo.put("current_value", num_curr + "");
}else{
jo.put("current_value", (num_curr + step) + "");
}
}
}
}
demo += value;
if (flag.equals("1")) {
wo.update(jo,"id = '"+jo.getString("id")+"'");
}
}
return demo;
}
@Override
public String queryIdByCode(String code) {
JSONObject jo = WQLObject.getWQLObject("sys_code_rule").query("code = '" + code + "'").uniqueResult(0);
String id = jo.getString("id");
return id;
}
}

View File

@@ -1,8 +1,7 @@
package org.nl.modules.system.util;
import org.nl.modules.system.service.GenCodeService;
import org.nl.modules.wql.util.SpringContextHolder;
import org.springframework.beans.BeanUtils;
import org.nl.system.service.coderule.ISysCodeRuleService;
import java.util.*;
@@ -13,7 +12,7 @@ public class CodeUtil {
HashMap<String,String> map = new HashMap<>();
map.put("flag",flag);
map.put("code",ruleCode);
return SpringContextHolder.getBean(GenCodeService.class).codeDemo(map);
return SpringContextHolder.getBean(ISysCodeRuleService.class).codeDemo(map);
}

View File

@@ -1,78 +0,0 @@
package org.nl.modules.tools.domain;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import org.nl.modules.common.utils.SecurityUtils;
import java.io.Serializable;
/**
* @author: lyd
* @description:
* @Date: 2022/12/6
*/
@Data
public class LocalStorage implements Serializable {
/** 标识 */
/** 防止精度丢失 */
@JsonSerialize(using= ToStringSerializer.class)
private Long storage_id;
/** 文件真实的名称 */
private String real_name;
/** 文件名 */
private String name;
/** 后缀 */
private String suffix;
/** 路径 */
private String path;
/** 类型 */
private String type;
/** 大小 */
private String size;
/** 创建人标识 */
private String create_id;
/** 创建人 */
private String create_name;
/** 创建时间 */
private String create_time;
/** 修改人标识 */
private String update_id;
/** 修改人 */
private String update_optname;
/** 修改时间 */
private String update_time;
public LocalStorage(String realName,String name, String suffix, String path, String type, String size) {
this.storage_id = IdUtil.getSnowflake(1,1).nextId();
this.real_name = realName;
this.name = name;
this.suffix = suffix;
this.path = path;
this.type = type;
this.size = size;
this.create_id = this.update_id = SecurityUtils.getCurrentUserId().toString();
this.create_name = this.update_optname = SecurityUtils.getCurrentNickName();
this.create_time = this.update_time = DateUtil.now();
}
public void copy(LocalStorage source){
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
}
}

View File

@@ -1,76 +0,0 @@
package org.nl.modules.tools.rest;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.annotation.SaIgnore;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.common.utils.FileUtil;
import org.nl.modules.logging.annotation.Log;
import org.nl.modules.tools.domain.LocalStorage;
import org.nl.modules.tools.service.LocalStorageService;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.Map;
/**
* @author: lyd
* @description: 本地存储管理
* @Date: 2022/12/5
*/
@RestController
@RequiredArgsConstructor
@Api(tags = "工具:本地存储管理")
@RequestMapping("/api/localStorage2")
public class LocalStorageController {
private final LocalStorageService localStorageService;
@ApiOperation("查询文件")
@GetMapping
// @SaCheckPermission("storage:list")
public ResponseEntity<Object> query(@RequestParam Map criteria, Pageable pageable) {
return new ResponseEntity<>(localStorageService.queryAll(criteria, pageable), HttpStatus.OK);
}
@ApiOperation("上传文件")
@PostMapping
@SaIgnore
// @SaCheckPermission("storage:add")
public ResponseEntity<Object> create(@RequestParam String name, @RequestParam("file") MultipartFile file) {
return new ResponseEntity<>(localStorageService.create(name, file), HttpStatus.CREATED);
}
@PostMapping("/pictures")
@ApiOperation("上传图片")
public ResponseEntity<Object> upload(@RequestParam MultipartFile file) {
// 判断文件是否为图片
String suffix = FileUtil.getExtensionName(file.getOriginalFilename());
if (!FileUtil.IMAGE.equals(FileUtil.getFileType(suffix))) {
throw new BadRequestException("只能上传图片");
}
return new ResponseEntity<>(localStorageService.create(null, file), HttpStatus.OK);
}
@Log("修改文件")
@ApiOperation("修改文件")
@PutMapping
@SaCheckPermission("storage:edit")
public ResponseEntity<Object> update(@Validated @RequestBody LocalStorage resources) {
localStorageService.update(resources);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@Log("删除文件")
@DeleteMapping
@ApiOperation("多选删除")
public ResponseEntity<Object> delete(@RequestBody String[] ids) {
localStorageService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@@ -1,50 +0,0 @@
package org.nl.modules.tools.service;
import com.alibaba.fastjson.JSONObject;
import org.nl.modules.tools.domain.LocalStorage;
import org.springframework.data.domain.Pageable;
import org.springframework.web.multipart.MultipartFile;
import java.util.Map;
/**
* @author: lyd
* @description:
* @Date: 2022/12/5
*/
public interface LocalStorageService {
/**
*
* @param criteria
* @param pageable
* @return
*/
Object queryAll(Map criteria, Pageable pageable);
/**
* 上传
* @param name 文件名称
* @return
*/
JSONObject create(String name, MultipartFile multipartFile);
/**
* 编辑
* @param resources 文件信息
*/
void update(LocalStorage resources);
/**
* 通过id找文件信息
* @param id
* @return
*/
JSONObject findById(String id);
/**
* 多选删除
* @param ids /
*/
void deleteAll(String[] ids);
}

View File

@@ -1,153 +0,0 @@
package org.nl.modules.tools.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
import org.nl.modules.common.config.FileProperties;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.common.utils.FileUtil;
import org.nl.modules.common.utils.SecurityUtils;
import org.nl.modules.tools.domain.LocalStorage;
import org.nl.modules.tools.service.LocalStorageService;
import org.nl.modules.wql.core.bean.ResultBean;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.modules.wql.util.WqlUtil;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.util.Map;
/**
* @author: lyd
* @description:
* @Date: 2022/12/5
*/
@Service
@RequiredArgsConstructor
public class LocalStorageServiceImpl implements LocalStorageService {
private final FileProperties properties;
/**
* @param criteria
* @param pageable
* @return
*/
@Override
public Object queryAll(Map criteria, Pageable pageable) {
WQLObject toolTab = WQLObject.getWQLObject("tool_local_storage");
String param = "1=1";
if (ObjectUtil.isNotEmpty(criteria.get("blurry"))) {
param = param + " AND name = '%" + criteria.get("blurry").toString() + "%'";
}
ResultBean rb = toolTab.pagequery(WqlUtil.getHttpContext(pageable), param, "create_time desc");
final JSONObject json = rb.pageResult();
return json;
}
/**
* 上传
*
* @param name 文件名称
* @param multipartFile 文件
* @return
*/
@Override
@Transactional(rollbackFor = Exception.class)
public JSONObject create(String name, MultipartFile multipartFile) {
WQLObject toolTab = WQLObject.getWQLObject("tool_local_storage");
FileUtil.checkSize(properties.getMaxSize(), multipartFile.getSize());
String suffix = FileUtil.getExtensionName(multipartFile.getOriginalFilename());
String type = FileUtil.getFileType(suffix);
File file = FileUtil.upload(multipartFile, properties.getPath().getPath() + type + File.separator);
if(ObjectUtil.isNull(file)){
throw new BadRequestException("上传失败");
}
try {
String userId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getCurrentNickName();
String now = DateUtil.now();
name = StrUtil.isEmpty(name) ? FileUtil.getFileNameNoEx(multipartFile.getOriginalFilename()) : name;
JSONObject localStorage = new JSONObject();
localStorage.put("storage_id", IdUtil.getSnowflake(1,1).nextId());
localStorage.put("real_name", file.getName());
localStorage.put("name", name);
localStorage.put("suffix", suffix);
localStorage.put("path", file.getPath());
localStorage.put("type", type);
localStorage.put("size", FileUtil.getSize(multipartFile.getSize()));
localStorage.put("create_id", userId);
localStorage.put("update_id", userId);
localStorage.put("create_name", nickName);
localStorage.put("update_optname", nickName);
localStorage.put("create_time", now);
localStorage.put("update_time", now);
// LocalStorage localStorage = new LocalStorage(
// file.getName(),
// name,
// suffix,
// file.getPath(),
// type,
// FileUtil.getSize(multipartFile.getSize())
// );
// JSONObject json = JSONObject.parseObject(JSON.toJSONString(localStorage));
toolTab.insert(localStorage);
return localStorage;
}catch (Exception e){
FileUtil.del(file);
throw e;
}
}
/**
* 编辑
*
* @param resources 文件信息
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void update(LocalStorage resources) {
JSONObject entity = this.findById(resources.getCreate_id());
if (ObjectUtil.isEmpty(entity)) throw new BadRequestException("文件信息不存在");
WQLObject toolTab = WQLObject.getWQLObject("tool_local_storage");
JSONObject json = JSONObject.parseObject(JSON.toJSONString(resources));
toolTab.update(json);
}
/**
* 通过id找文件信息
*
* @param id
* @return
*/
@Override
public JSONObject findById(String id) {
WQLObject toolTab = WQLObject.getWQLObject("tool_local_storage");
JSONObject object = toolTab.query("storage_id = '" + id + "'").uniqueResult(0);
return object;
}
/**
* 多选删除
*
* @param ids /
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void deleteAll(String[] ids) {
WQLObject toolTab = WQLObject.getWQLObject("tool_local_storage");
for (String id : ids) {
JSONObject storage = this.findById(id.toString());
if (ObjectUtil.isEmpty(storage)) continue;
FileUtil.del(storage.getString("path"));
toolTab.delete(storage);
}
}
}

View File

@@ -2,7 +2,6 @@ package org.nl.system.controller.coderule;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
@@ -12,7 +11,6 @@ import org.nl.modules.logging.annotation.Log;
import org.nl.system.service.coderule.ISysCodeRuleService;
import org.nl.system.service.coderule.dao.SysCodeRule;
import org.nl.system.service.coderule.dto.CodeRuleQuery;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;

View File

@@ -2,25 +2,19 @@ package org.nl.system.controller.coderule;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.nl.common.TableDataInfo;
import org.nl.common.domain.query.PageQuery;
import org.nl.modules.logging.annotation.Log;
import org.nl.modules.system.service.CodeDetailService;
import org.nl.system.service.coderule.ISysCodeRuleDetailService;
import org.nl.system.service.coderule.dao.SysCodeRuleDetail;
import org.nl.system.service.coderule.dto.CodeRuleDetailQuery;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
/**
* <p>
* 编码规则明细表 前端控制器

View File

@@ -11,7 +11,6 @@ import org.nl.common.domain.query.PageQuery;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.common.utils.FileUtil;
import org.nl.modules.logging.annotation.Log;
import org.nl.modules.tools.domain.LocalStorage;
import org.nl.system.service.tools.IToolLocalStorageService;
import org.nl.system.service.tools.dao.ToolLocalStorage;
import org.nl.system.service.tools.dto.ToolLocalStorageQuery;