Compare commits
No commits in common. "7d25e18967b04a471fed8d92c16c17be8204ff53" and "5d60bc7772b414bd23c28dae3136bcc91ac2756a" have entirely different histories.
7d25e18967
...
5d60bc7772
|
@ -9,11 +9,5 @@
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>nu-admin-local-api</artifactId>
|
<artifactId>nu-admin-local-api</artifactId>
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.nursingunit.boot</groupId>
|
|
||||||
<artifactId>nursing-unit-common</artifactId>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
package com.nu.modules.mediamanage;
|
|
||||||
|
|
||||||
import cn.hutool.json.JSONObject;
|
|
||||||
import com.nu.dto.MediaManageMQDto;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public interface IMediaManageApi {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据ids查询数据
|
|
||||||
*
|
|
||||||
* @param ids
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
List<JSONObject> queryByIds(List<String> ids);
|
|
||||||
|
|
||||||
void saveOrUpdate(MediaManageMQDto m, boolean isSave);
|
|
||||||
}
|
|
|
@ -144,6 +144,4 @@ public class H5ApiAdvisoryInfoController extends JeecgController<NuBizAdvisoryIn
|
||||||
nuBizAdvisoryInfoService.update(updateWrapper);
|
nuBizAdvisoryInfoService.update(updateWrapper);
|
||||||
return Result.OK("编辑成功!");
|
return Result.OK("编辑成功!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,180 +0,0 @@
|
||||||
package com.nu.modules.mediaasyncerrorlog.controller;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.UnsupportedEncodingException;
|
|
||||||
import java.net.URLDecoder;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import org.jeecg.common.api.vo.Result;
|
|
||||||
import org.jeecg.common.system.query.QueryGenerator;
|
|
||||||
import org.jeecg.common.system.query.QueryRuleEnum;
|
|
||||||
import org.jeecg.common.util.oConvertUtils;
|
|
||||||
import com.nu.modules.mediaasyncerrorlog.entity.MediaAsyncErrorLog;
|
|
||||||
import com.nu.modules.mediaasyncerrorlog.service.IMediaAsyncErrorLogService;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
|
||||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
|
||||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
|
||||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
|
||||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
|
||||||
import org.jeecg.common.system.base.controller.JeecgController;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
|
||||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
|
||||||
import com.alibaba.fastjson.JSON;
|
|
||||||
import io.swagger.annotations.Api;
|
|
||||||
import io.swagger.annotations.ApiOperation;
|
|
||||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Description: 资源同步错误日志
|
|
||||||
* @Author: jeecg-boot
|
|
||||||
* @Date: 2025-05-22
|
|
||||||
* @Version: V1.0
|
|
||||||
*/
|
|
||||||
@Api(tags="资源同步错误日志")
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/mediaasyncerrorlog/mediaAsyncErrorLog")
|
|
||||||
@Slf4j
|
|
||||||
public class MediaAsyncErrorLogController extends JeecgController<MediaAsyncErrorLog, IMediaAsyncErrorLogService> {
|
|
||||||
@Autowired
|
|
||||||
private IMediaAsyncErrorLogService mediaAsyncErrorLogService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分页列表查询
|
|
||||||
*
|
|
||||||
* @param mediaAsyncErrorLog
|
|
||||||
* @param pageNo
|
|
||||||
* @param pageSize
|
|
||||||
* @param req
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
//@AutoLog(value = "资源同步错误日志-分页列表查询")
|
|
||||||
@ApiOperation(value="资源同步错误日志-分页列表查询", notes="资源同步错误日志-分页列表查询")
|
|
||||||
@GetMapping(value = "/list")
|
|
||||||
public Result<IPage<MediaAsyncErrorLog>> queryPageList(MediaAsyncErrorLog mediaAsyncErrorLog,
|
|
||||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
|
||||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
|
||||||
HttpServletRequest req) {
|
|
||||||
QueryWrapper<MediaAsyncErrorLog> queryWrapper = QueryGenerator.initQueryWrapper(mediaAsyncErrorLog, req.getParameterMap());
|
|
||||||
Page<MediaAsyncErrorLog> page = new Page<MediaAsyncErrorLog>(pageNo, pageSize);
|
|
||||||
IPage<MediaAsyncErrorLog> pageList = mediaAsyncErrorLogService.page(page, queryWrapper);
|
|
||||||
return Result.OK(pageList);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 添加
|
|
||||||
*
|
|
||||||
* @param mediaAsyncErrorLog
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@AutoLog(value = "资源同步错误日志-添加")
|
|
||||||
@ApiOperation(value="资源同步错误日志-添加", notes="资源同步错误日志-添加")
|
|
||||||
@RequiresPermissions("mediaasyncerrorlog:nu_media_async_error_log:add")
|
|
||||||
@PostMapping(value = "/add")
|
|
||||||
public Result<String> add(@RequestBody MediaAsyncErrorLog mediaAsyncErrorLog) {
|
|
||||||
mediaAsyncErrorLogService.save(mediaAsyncErrorLog);
|
|
||||||
return Result.OK("添加成功!");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 编辑
|
|
||||||
*
|
|
||||||
* @param mediaAsyncErrorLog
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@AutoLog(value = "资源同步错误日志-编辑")
|
|
||||||
@ApiOperation(value="资源同步错误日志-编辑", notes="资源同步错误日志-编辑")
|
|
||||||
@RequiresPermissions("mediaasyncerrorlog:nu_media_async_error_log:edit")
|
|
||||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
|
||||||
public Result<String> edit(@RequestBody MediaAsyncErrorLog mediaAsyncErrorLog) {
|
|
||||||
mediaAsyncErrorLogService.updateById(mediaAsyncErrorLog);
|
|
||||||
return Result.OK("编辑成功!");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过id删除
|
|
||||||
*
|
|
||||||
* @param id
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@AutoLog(value = "资源同步错误日志-通过id删除")
|
|
||||||
@ApiOperation(value="资源同步错误日志-通过id删除", notes="资源同步错误日志-通过id删除")
|
|
||||||
@RequiresPermissions("mediaasyncerrorlog:nu_media_async_error_log:delete")
|
|
||||||
@DeleteMapping(value = "/delete")
|
|
||||||
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
|
||||||
mediaAsyncErrorLogService.removeById(id);
|
|
||||||
return Result.OK("删除成功!");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除
|
|
||||||
*
|
|
||||||
* @param ids
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@AutoLog(value = "资源同步错误日志-批量删除")
|
|
||||||
@ApiOperation(value="资源同步错误日志-批量删除", notes="资源同步错误日志-批量删除")
|
|
||||||
@RequiresPermissions("mediaasyncerrorlog:nu_media_async_error_log:deleteBatch")
|
|
||||||
@DeleteMapping(value = "/deleteBatch")
|
|
||||||
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
|
||||||
this.mediaAsyncErrorLogService.removeByIds(Arrays.asList(ids.split(",")));
|
|
||||||
return Result.OK("批量删除成功!");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过id查询
|
|
||||||
*
|
|
||||||
* @param id
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
//@AutoLog(value = "资源同步错误日志-通过id查询")
|
|
||||||
@ApiOperation(value="资源同步错误日志-通过id查询", notes="资源同步错误日志-通过id查询")
|
|
||||||
@GetMapping(value = "/queryById")
|
|
||||||
public Result<MediaAsyncErrorLog> queryById(@RequestParam(name="id",required=true) String id) {
|
|
||||||
MediaAsyncErrorLog mediaAsyncErrorLog = mediaAsyncErrorLogService.getById(id);
|
|
||||||
if(mediaAsyncErrorLog==null) {
|
|
||||||
return Result.error("未找到对应数据");
|
|
||||||
}
|
|
||||||
return Result.OK(mediaAsyncErrorLog);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 导出excel
|
|
||||||
*
|
|
||||||
* @param request
|
|
||||||
* @param mediaAsyncErrorLog
|
|
||||||
*/
|
|
||||||
@RequiresPermissions("mediaasyncerrorlog:nu_media_async_error_log:exportXls")
|
|
||||||
@RequestMapping(value = "/exportXls")
|
|
||||||
public ModelAndView exportXls(HttpServletRequest request, MediaAsyncErrorLog mediaAsyncErrorLog) {
|
|
||||||
return super.exportXls(request, mediaAsyncErrorLog, MediaAsyncErrorLog.class, "资源同步错误日志");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过excel导入数据
|
|
||||||
*
|
|
||||||
* @param request
|
|
||||||
* @param response
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@RequiresPermissions("mediaasyncerrorlog:nu_media_async_error_log:importExcel")
|
|
||||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
|
||||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
|
||||||
return super.importExcel(request, response, MediaAsyncErrorLog.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,53 +0,0 @@
|
||||||
package com.nu.modules.mediaasyncerrorlog.entity;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.io.UnsupportedEncodingException;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
|
||||||
import org.jeecg.common.constant.ProvinceCityArea;
|
|
||||||
import org.jeecg.common.util.SpringContextUtils;
|
|
||||||
import lombok.Data;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
|
||||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
|
||||||
import org.jeecg.common.aspect.annotation.Dict;
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
import lombok.experimental.Accessors;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Description: 资源同步错误日志
|
|
||||||
* @Author: jeecg-boot
|
|
||||||
* @Date: 2025-05-22
|
|
||||||
* @Version: V1.0
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@TableName("nu_media_async_error_log")
|
|
||||||
@Accessors(chain = true)
|
|
||||||
@EqualsAndHashCode(callSuper = false)
|
|
||||||
@ApiModel(value="nu_media_async_error_log对象", description="资源同步错误日志")
|
|
||||||
public class MediaAsyncErrorLog implements Serializable {
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/**id*/
|
|
||||||
@TableId(type = IdType.ASSIGN_ID)
|
|
||||||
@ApiModelProperty(value = "id")
|
|
||||||
private java.lang.String id;
|
|
||||||
/**nu_media_manage.id*/
|
|
||||||
@Excel(name = "nu_media_manage.id", width = 15)
|
|
||||||
@ApiModelProperty(value = "nu_media_manage.id")
|
|
||||||
private java.lang.String mediaid;
|
|
||||||
/**找到id就是对应的nu_media_manage.id*/
|
|
||||||
@ApiModelProperty(value = "找到id就是对应的nu_media_manage.id")
|
|
||||||
private java.lang.String msg;
|
|
||||||
/**createTime*/
|
|
||||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
|
||||||
@ApiModelProperty(value = "createTime")
|
|
||||||
private java.util.Date createTime;
|
|
||||||
}
|
|
|
@ -1,17 +0,0 @@
|
||||||
package com.nu.modules.mediaasyncerrorlog.mapper;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
import com.nu.modules.mediaasyncerrorlog.entity.MediaAsyncErrorLog;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Description: 资源同步错误日志
|
|
||||||
* @Author: jeecg-boot
|
|
||||||
* @Date: 2025-05-22
|
|
||||||
* @Version: V1.0
|
|
||||||
*/
|
|
||||||
public interface MediaAsyncErrorLogMapper extends BaseMapper<MediaAsyncErrorLog> {
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,5 +0,0 @@
|
||||||
<?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.nu.modules.mediaasyncerrorlog.mapper.MediaAsyncErrorLogMapper">
|
|
||||||
|
|
||||||
</mapper>
|
|
|
@ -1,5 +0,0 @@
|
||||||
<?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.nu.modules.mediaasyncerrorlog.mapper.NuMediaAsyncErrorLogMapper">
|
|
||||||
|
|
||||||
</mapper>
|
|
|
@ -1,14 +0,0 @@
|
||||||
package com.nu.modules.mediaasyncerrorlog.service;
|
|
||||||
|
|
||||||
import com.nu.modules.mediaasyncerrorlog.entity.MediaAsyncErrorLog;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Description: 资源同步错误日志
|
|
||||||
* @Author: jeecg-boot
|
|
||||||
* @Date: 2025-05-22
|
|
||||||
* @Version: V1.0
|
|
||||||
*/
|
|
||||||
public interface IMediaAsyncErrorLogService extends IService<MediaAsyncErrorLog> {
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,19 +0,0 @@
|
||||||
package com.nu.modules.mediaasyncerrorlog.service.impl;
|
|
||||||
|
|
||||||
import com.nu.modules.mediaasyncerrorlog.entity.MediaAsyncErrorLog;
|
|
||||||
import com.nu.modules.mediaasyncerrorlog.mapper.MediaAsyncErrorLogMapper;
|
|
||||||
import com.nu.modules.mediaasyncerrorlog.service.IMediaAsyncErrorLogService;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Description: 资源同步错误日志
|
|
||||||
* @Author: jeecg-boot
|
|
||||||
* @Date: 2025-05-22
|
|
||||||
* @Version: V1.0
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class MediaAsyncErrorLogServiceImpl extends ServiceImpl<MediaAsyncErrorLogMapper, MediaAsyncErrorLog> implements IMediaAsyncErrorLogService {
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,180 +0,0 @@
|
||||||
package com.nu.modules.mediamanage.controller;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.UnsupportedEncodingException;
|
|
||||||
import java.net.URLDecoder;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import org.jeecg.common.api.vo.Result;
|
|
||||||
import org.jeecg.common.system.query.QueryGenerator;
|
|
||||||
import org.jeecg.common.system.query.QueryRuleEnum;
|
|
||||||
import org.jeecg.common.util.oConvertUtils;
|
|
||||||
import com.nu.modules.mediamanage.entity.MediaManage;
|
|
||||||
import com.nu.modules.mediamanage.service.IMediaManageService;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
|
||||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
|
||||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
|
||||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
|
||||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
|
||||||
import org.jeecg.common.system.base.controller.JeecgController;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
|
||||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
|
||||||
import com.alibaba.fastjson.JSON;
|
|
||||||
import io.swagger.annotations.Api;
|
|
||||||
import io.swagger.annotations.ApiOperation;
|
|
||||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Description: 媒体资源管理
|
|
||||||
* @Author: jeecg-boot
|
|
||||||
* @Date: 2025-05-15
|
|
||||||
* @Version: V1.0
|
|
||||||
*/
|
|
||||||
@Api(tags="媒体资源管理")
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/mediamanage/mediaManage")
|
|
||||||
@Slf4j
|
|
||||||
public class MediaManageController extends JeecgController<MediaManage, IMediaManageService> {
|
|
||||||
@Autowired
|
|
||||||
private IMediaManageService mediaManageService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分页列表查询
|
|
||||||
*
|
|
||||||
* @param mediaManage
|
|
||||||
* @param pageNo
|
|
||||||
* @param pageSize
|
|
||||||
* @param req
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
//@AutoLog(value = "媒体资源管理-分页列表查询")
|
|
||||||
@ApiOperation(value="媒体资源管理-分页列表查询", notes="媒体资源管理-分页列表查询")
|
|
||||||
@GetMapping(value = "/list")
|
|
||||||
public Result<IPage<MediaManage>> queryPageList(MediaManage mediaManage,
|
|
||||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
|
||||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
|
||||||
HttpServletRequest req) {
|
|
||||||
QueryWrapper<MediaManage> queryWrapper = QueryGenerator.initQueryWrapper(mediaManage, req.getParameterMap());
|
|
||||||
Page<MediaManage> page = new Page<MediaManage>(pageNo, pageSize);
|
|
||||||
IPage<MediaManage> pageList = mediaManageService.page(page, queryWrapper);
|
|
||||||
return Result.OK(pageList);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 添加
|
|
||||||
*
|
|
||||||
* @param mediaManage
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@AutoLog(value = "媒体资源管理-添加")
|
|
||||||
@ApiOperation(value="媒体资源管理-添加", notes="媒体资源管理-添加")
|
|
||||||
@RequiresPermissions("mediamanage:nu_media_manage:add")
|
|
||||||
@PostMapping(value = "/add")
|
|
||||||
public Result<String> add(@RequestBody MediaManage mediaManage) {
|
|
||||||
mediaManageService.save(mediaManage);
|
|
||||||
return Result.OK("添加成功!");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 编辑
|
|
||||||
*
|
|
||||||
* @param mediaManage
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@AutoLog(value = "媒体资源管理-编辑")
|
|
||||||
@ApiOperation(value="媒体资源管理-编辑", notes="媒体资源管理-编辑")
|
|
||||||
@RequiresPermissions("mediamanage:nu_media_manage:edit")
|
|
||||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
|
||||||
public Result<String> edit(@RequestBody MediaManage mediaManage) {
|
|
||||||
mediaManageService.updateById(mediaManage);
|
|
||||||
return Result.OK("编辑成功!");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过id删除
|
|
||||||
*
|
|
||||||
* @param id
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@AutoLog(value = "媒体资源管理-通过id删除")
|
|
||||||
@ApiOperation(value="媒体资源管理-通过id删除", notes="媒体资源管理-通过id删除")
|
|
||||||
@RequiresPermissions("mediamanage:nu_media_manage:delete")
|
|
||||||
@DeleteMapping(value = "/delete")
|
|
||||||
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
|
||||||
mediaManageService.removeById(id);
|
|
||||||
return Result.OK("删除成功!");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除
|
|
||||||
*
|
|
||||||
* @param ids
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@AutoLog(value = "媒体资源管理-批量删除")
|
|
||||||
@ApiOperation(value="媒体资源管理-批量删除", notes="媒体资源管理-批量删除")
|
|
||||||
@RequiresPermissions("mediamanage:nu_media_manage:deleteBatch")
|
|
||||||
@DeleteMapping(value = "/deleteBatch")
|
|
||||||
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
|
||||||
this.mediaManageService.removeByIds(Arrays.asList(ids.split(",")));
|
|
||||||
return Result.OK("批量删除成功!");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过id查询
|
|
||||||
*
|
|
||||||
* @param id
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
//@AutoLog(value = "媒体资源管理-通过id查询")
|
|
||||||
@ApiOperation(value="媒体资源管理-通过id查询", notes="媒体资源管理-通过id查询")
|
|
||||||
@GetMapping(value = "/queryById")
|
|
||||||
public Result<MediaManage> queryById(@RequestParam(name="id",required=true) String id) {
|
|
||||||
MediaManage mediaManage = mediaManageService.getById(id);
|
|
||||||
if(mediaManage==null) {
|
|
||||||
return Result.error("未找到对应数据");
|
|
||||||
}
|
|
||||||
return Result.OK(mediaManage);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 导出excel
|
|
||||||
*
|
|
||||||
* @param request
|
|
||||||
* @param mediaManage
|
|
||||||
*/
|
|
||||||
@RequiresPermissions("mediamanage:nu_media_manage:exportXls")
|
|
||||||
@RequestMapping(value = "/exportXls")
|
|
||||||
public ModelAndView exportXls(HttpServletRequest request, MediaManage mediaManage) {
|
|
||||||
return super.exportXls(request, mediaManage, MediaManage.class, "媒体资源管理");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过excel导入数据
|
|
||||||
*
|
|
||||||
* @param request
|
|
||||||
* @param response
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@RequiresPermissions("mediamanage:nu_media_manage:importExcel")
|
|
||||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
|
||||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
|
||||||
return super.importExcel(request, response, MediaManage.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,126 +0,0 @@
|
||||||
package com.nu.modules.mediamanage.entity;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.io.UnsupportedEncodingException;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
|
||||||
import org.jeecg.common.constant.ProvinceCityArea;
|
|
||||||
import org.jeecg.common.util.SpringContextUtils;
|
|
||||||
import lombok.Data;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
|
||||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
|
||||||
import org.jeecg.common.aspect.annotation.Dict;
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
import lombok.experimental.Accessors;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Description: 媒体资源管理
|
|
||||||
* @Author: jeecg-boot
|
|
||||||
* @Date: 2025-05-15
|
|
||||||
* @Version: V1.0
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@TableName("nu_media_manage")
|
|
||||||
@Accessors(chain = true)
|
|
||||||
@EqualsAndHashCode(callSuper = false, onlyExplicitlyIncluded = true)
|
|
||||||
@ApiModel(value = "nu_media_manage对象", description = "媒体资源管理")
|
|
||||||
public class MediaManage implements Serializable {
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* id
|
|
||||||
*/
|
|
||||||
@TableId(type = IdType.ASSIGN_ID)
|
|
||||||
@ApiModelProperty(value = "id")
|
|
||||||
@EqualsAndHashCode.Include//参与对象对比
|
|
||||||
private java.lang.String id;
|
|
||||||
/**
|
|
||||||
* 名称
|
|
||||||
*/
|
|
||||||
@Excel(name = "名称", width = 15)
|
|
||||||
@ApiModelProperty(value = "名称")
|
|
||||||
@EqualsAndHashCode.Include
|
|
||||||
private java.lang.String name;
|
|
||||||
/**
|
|
||||||
* 备注
|
|
||||||
*/
|
|
||||||
@Excel(name = "备注", width = 15)
|
|
||||||
@ApiModelProperty(value = "备注")
|
|
||||||
@EqualsAndHashCode.Include
|
|
||||||
private java.lang.String descr;
|
|
||||||
/**
|
|
||||||
* 文件类型
|
|
||||||
*/
|
|
||||||
@Excel(name = "文件类型", width = 15)
|
|
||||||
@ApiModelProperty(value = "文件类型")
|
|
||||||
@Dict(dicCode = "file_type")
|
|
||||||
@EqualsAndHashCode.Include
|
|
||||||
private java.lang.String fileType;
|
|
||||||
/**
|
|
||||||
* 系统功能
|
|
||||||
*/
|
|
||||||
@Excel(name = "系统功能", width = 15)
|
|
||||||
@ApiModelProperty(value = "系统功能")
|
|
||||||
@Dict(dicCode = "sys_function")
|
|
||||||
@EqualsAndHashCode.Include
|
|
||||||
private java.lang.String sysFunc;
|
|
||||||
/**
|
|
||||||
* 文件路径
|
|
||||||
*/
|
|
||||||
@Excel(name = "文件路径", width = 15)
|
|
||||||
@ApiModelProperty(value = "文件路径")
|
|
||||||
@EqualsAndHashCode.Include
|
|
||||||
private java.lang.String filePath;
|
|
||||||
/**
|
|
||||||
* 是否网络资源
|
|
||||||
*/
|
|
||||||
@Excel(name = "是否网络资源", width = 15)
|
|
||||||
@ApiModelProperty(value = "是否网络资源")
|
|
||||||
@Dict(dicCode = "iz_net_url")
|
|
||||||
@EqualsAndHashCode.Include
|
|
||||||
private java.lang.String izNetUrl;
|
|
||||||
/**
|
|
||||||
* 是否删除
|
|
||||||
*/
|
|
||||||
@Excel(name = "是否删除", width = 15)
|
|
||||||
@ApiModelProperty(value = "是否删除")
|
|
||||||
@TableLogic
|
|
||||||
@EqualsAndHashCode.Include
|
|
||||||
private java.lang.String delFlag;
|
|
||||||
/**
|
|
||||||
* 创建人
|
|
||||||
*/
|
|
||||||
@ApiModelProperty(value = "创建人")
|
|
||||||
@EqualsAndHashCode.Include
|
|
||||||
private java.lang.String createBy;
|
|
||||||
/**
|
|
||||||
* 创建日期
|
|
||||||
*/
|
|
||||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
@ApiModelProperty(value = "创建日期")
|
|
||||||
@EqualsAndHashCode.Include
|
|
||||||
private java.util.Date createTime;
|
|
||||||
/**
|
|
||||||
* 更新人
|
|
||||||
*/
|
|
||||||
@ApiModelProperty(value = "更新人")
|
|
||||||
@EqualsAndHashCode.Include
|
|
||||||
private java.lang.String updateBy;
|
|
||||||
/**
|
|
||||||
* 更新日期
|
|
||||||
*/
|
|
||||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
@ApiModelProperty(value = "更新日期")
|
|
||||||
@EqualsAndHashCode.Include
|
|
||||||
private java.util.Date updateTime;
|
|
||||||
}
|
|
|
@ -1,17 +0,0 @@
|
||||||
package com.nu.modules.mediamanage.mapper;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
import com.nu.modules.mediamanage.entity.MediaManage;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Description: 媒体资源管理
|
|
||||||
* @Author: jeecg-boot
|
|
||||||
* @Date: 2025-05-15
|
|
||||||
* @Version: V1.0
|
|
||||||
*/
|
|
||||||
public interface MediaManageMapper extends BaseMapper<MediaManage> {
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,5 +0,0 @@
|
||||||
<?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.nu.modules.mediamanage.mapper.MediaManageMapper">
|
|
||||||
|
|
||||||
</mapper>
|
|
|
@ -1,14 +0,0 @@
|
||||||
package com.nu.modules.mediamanage.service;
|
|
||||||
|
|
||||||
import com.nu.modules.mediamanage.entity.MediaManage;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Description: 媒体资源管理
|
|
||||||
* @Author: jeecg-boot
|
|
||||||
* @Date: 2025-05-15
|
|
||||||
* @Version: V1.0
|
|
||||||
*/
|
|
||||||
public interface IMediaManageService extends IService<MediaManage> {
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,70 +0,0 @@
|
||||||
package com.nu.modules.mediamanage.service.impl;
|
|
||||||
|
|
||||||
import cn.hutool.json.JSONObject;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
||||||
import com.nu.dto.MediaManageMQDto;
|
|
||||||
import com.nu.modules.mediamanage.IMediaManageApi;
|
|
||||||
import com.nu.modules.mediamanage.entity.MediaManage;
|
|
||||||
import com.nu.modules.mediamanage.mapper.MediaManageMapper;
|
|
||||||
import com.nu.modules.mediamanage.service.IMediaManageService;
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
|
||||||
import org.jeecg.common.system.api.ISysBaseAPI;
|
|
||||||
import org.springframework.beans.BeanUtils;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Description: 媒体资源管理
|
|
||||||
* @Author: jeecg-boot
|
|
||||||
* @Date: 2025-05-15
|
|
||||||
* @Version: V1.0
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class MediaManageServiceImpl extends ServiceImpl<MediaManageMapper, MediaManage> implements IMediaManageService, IMediaManageApi {
|
|
||||||
@Autowired
|
|
||||||
private ISysBaseAPI sysBaseAPI;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<JSONObject> queryByIds(List<String> ids) {
|
|
||||||
QueryWrapper<MediaManage> qw = new QueryWrapper<>();
|
|
||||||
qw.in("id", ids);
|
|
||||||
List<MediaManage> mediaManages = baseMapper.selectList(qw);
|
|
||||||
|
|
||||||
List<JSONObject> result = new ArrayList<>();
|
|
||||||
for (MediaManage media : mediaManages) {
|
|
||||||
JSONObject json = new JSONObject();
|
|
||||||
json.put("id", media.getId());
|
|
||||||
json.put("name", media.getName());
|
|
||||||
json.put("descr", media.getDescr());
|
|
||||||
json.put("sysFunc", media.getSysFunc());
|
|
||||||
json.put("fileType", media.getFileType());
|
|
||||||
json.put("filePath", media.getFilePath());
|
|
||||||
json.put("izNetUrl", media.getIzNetUrl());
|
|
||||||
json.put("delFlag", media.getDelFlag());
|
|
||||||
json.put("createBy", media.getCreateBy());
|
|
||||||
json.put("createTime", media.getCreateTime());
|
|
||||||
json.put("updateBy", media.getUpdateBy());
|
|
||||||
json.put("updateTime", media.getUpdateTime());
|
|
||||||
result.add(json);
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void saveOrUpdate(MediaManageMQDto m, boolean isSave) {
|
|
||||||
MediaManage mediaManage = new MediaManage();
|
|
||||||
BeanUtils.copyProperties(m, mediaManage);
|
|
||||||
|
|
||||||
if (isSave) {
|
|
||||||
baseMapper.insert(mediaManage);
|
|
||||||
} else {
|
|
||||||
baseMapper.updateById(mediaManage);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,28 +0,0 @@
|
||||||
package com.nu.mq.mediamanage.exceptionhandler;
|
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.amqp.AmqpRejectAndDontRequeueException;
|
|
||||||
import org.springframework.amqp.core.Message;
|
|
||||||
import org.springframework.amqp.rabbit.listener.api.RabbitListenerErrorHandler;
|
|
||||||
import org.springframework.amqp.rabbit.support.ListenerExecutionFailedException;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
@Component("mediaManageMQErrorHandler")
|
|
||||||
public class MediaManageMQExceptionHandler implements RabbitListenerErrorHandler {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object handleError(Message message, org.springframework.messaging.Message<?> message1, ListenerExecutionFailedException e) {
|
|
||||||
log.error("MQ消息处理失败 | 消息体: {} | 异常原因: {}", new String(message.getBody()), e.getCause().getMessage());
|
|
||||||
|
|
||||||
// 根据异常类型选择处理策略
|
|
||||||
// if (isRetryable(e)) {
|
|
||||||
// // 可重试异常:抛出异常触发重试
|
|
||||||
// throw e;
|
|
||||||
// } else {
|
|
||||||
// 不可恢复异常:拒绝消息且不重新入队
|
|
||||||
throw new AmqpRejectAndDontRequeueException("消息处理失败且禁止重试", e);
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,184 +0,0 @@
|
||||||
package com.nu.mq.mediamanage.listener;
|
|
||||||
|
|
||||||
import cn.hutool.json.JSONObject;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
import com.nu.dto.MediaManageMQDto;
|
|
||||||
import com.nu.dto.StatusMQDto;
|
|
||||||
import com.nu.modules.async.entity.AsyncMain;
|
|
||||||
import com.nu.modules.async.service.IAsyncMainService;
|
|
||||||
import com.nu.modules.mediaasyncerrorlog.entity.MediaAsyncErrorLog;
|
|
||||||
import com.nu.modules.mediaasyncerrorlog.service.IMediaAsyncErrorLogService;
|
|
||||||
import com.nu.modules.mediamanage.IMediaManageApi;
|
|
||||||
import com.nu.modules.mediamanage.entity.MediaManage;
|
|
||||||
import com.nu.modules.sysconfig.entity.SysConfig;
|
|
||||||
import com.nu.modules.sysconfig.service.ISysConfigService;
|
|
||||||
import com.nu.utils.FileDownloader;
|
|
||||||
import com.nu.utils.SafetyUtil;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.apache.commons.compress.utils.Lists;
|
|
||||||
import org.springframework.amqp.core.ExchangeTypes;
|
|
||||||
import org.springframework.amqp.rabbit.annotation.Exchange;
|
|
||||||
import org.springframework.amqp.rabbit.annotation.Queue;
|
|
||||||
import org.springframework.amqp.rabbit.annotation.QueueBinding;
|
|
||||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
|
||||||
import org.springframework.beans.BeanUtils;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.time.format.DateTimeFormatter;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
@Component
|
|
||||||
public class MediaManageMQListener {
|
|
||||||
|
|
||||||
@Value("${jeecg.path.upload}")
|
|
||||||
private String upLoadPath;
|
|
||||||
@Value("${jeecg.path.directivepath}")
|
|
||||||
private String directiveUpLoadPath;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private IMediaManageApi mediaManageApi;
|
|
||||||
@Autowired
|
|
||||||
private ISysConfigService sysConfigService;
|
|
||||||
@Autowired
|
|
||||||
private IMediaAsyncErrorLogService mediaAsyncErrorLogService;
|
|
||||||
|
|
||||||
@RabbitListener(bindings = @QueueBinding(value = @Queue(name = "mediamanage.async", durable = "true"), exchange = @Exchange(name = "hldy.mediamanage", type = ExchangeTypes.DIRECT), key = "mediamanage.async"), errorHandler = "mediaManageMQErrorHandler")
|
|
||||||
public void handleMessage(List<Map<String, Object>> mediaMaps) {
|
|
||||||
//转下对象,不然要改的代码太多
|
|
||||||
List<MediaManageMQDto> list = mediaMaps.stream().map(this::convertToMediaManageMQDto).collect(Collectors.toList());
|
|
||||||
|
|
||||||
List<String> mediaIds = Lists.newArrayList();
|
|
||||||
mediaMaps.stream().forEach(m -> {
|
|
||||||
mediaIds.add((String) m.get("id"));
|
|
||||||
});
|
|
||||||
// 运维系统中的数据
|
|
||||||
List<JSONObject> jsonObjects = mediaManageApi.queryByIds(mediaIds);
|
|
||||||
Map<String, JSONObject> map = Maps.newHashMap();
|
|
||||||
if (jsonObjects != null && !jsonObjects.isEmpty()) {
|
|
||||||
jsonObjects.stream().forEach(j -> {
|
|
||||||
map.put(j.getStr("id"), j);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
//map是运维系统媒体资源数据 m是试验田传过来的媒体资源数据
|
|
||||||
list.stream().forEach(m -> {
|
|
||||||
if (map.get(m.getId()) != null) {
|
|
||||||
//处理同一条数据
|
|
||||||
JSONObject enty = map.get(m.getId());
|
|
||||||
MediaManage yewu = new MediaManage();//业务
|
|
||||||
BeanUtils.copyProperties(m, yewu);
|
|
||||||
MediaManage yunwei = new MediaManage();//运维
|
|
||||||
yunwei.setId(enty.getStr("id"));
|
|
||||||
yunwei.setName(enty.getStr("name"));
|
|
||||||
yunwei.setDescr(enty.getStr("descr"));
|
|
||||||
yunwei.setFileType(enty.getStr("fileType"));
|
|
||||||
yunwei.setSysFunc(enty.getStr("sysFunc"));
|
|
||||||
yunwei.setFilePath(enty.getStr("filePath"));
|
|
||||||
yunwei.setIzNetUrl(enty.getStr("izNetUrl"));
|
|
||||||
yunwei.setDelFlag(enty.getStr("delFlag"));
|
|
||||||
yunwei.setCreateBy(enty.getStr("createBy"));
|
|
||||||
yunwei.setCreateTime(enty.getDate("createTime"));
|
|
||||||
yunwei.setUpdateBy(enty.getStr("updateBy"));
|
|
||||||
yunwei.setUpdateTime(enty.getDate("updateTime"));
|
|
||||||
//存储数据
|
|
||||||
if (!yewu.equals(yunwei)) {
|
|
||||||
mediaManageApi.saveOrUpdate(m, false);
|
|
||||||
}
|
|
||||||
//存储文件
|
|
||||||
if (!yunwei.getFilePath().equals(m.getFilePath())) {
|
|
||||||
handleSaveFile(m);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
//新增数据
|
|
||||||
mediaManageApi.saveOrUpdate(m, true);
|
|
||||||
handleSaveFile(m);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private MediaManageMQDto convertToMediaManageMQDto(Map<String, Object> map) {
|
|
||||||
MediaManageMQDto dto = new MediaManageMQDto();
|
|
||||||
dto.setId((String) map.get("id"));
|
|
||||||
dto.setName((String) map.get("name"));
|
|
||||||
dto.setDescr((String) map.get("descr"));
|
|
||||||
dto.setFileType((String) map.get("fileType"));
|
|
||||||
dto.setSysFunc((String) map.get("sysFunc"));
|
|
||||||
dto.setFilePath((String) map.get("filePath"));
|
|
||||||
dto.setIzNetUrl((String) map.get("izNetUrl"));
|
|
||||||
dto.setDelFlag((String) map.get("delFlag"));
|
|
||||||
dto.setCreateBy((String) map.get("createBy"));
|
|
||||||
dto.setUpdateBy((String) map.get("updateBy"));
|
|
||||||
dto.setNetFilePath((String) map.get("netFilePath"));
|
|
||||||
return dto;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 处理文件存储
|
|
||||||
*
|
|
||||||
* @param media
|
|
||||||
*/
|
|
||||||
private void handleSaveFile(MediaManageMQDto media) {
|
|
||||||
try {
|
|
||||||
LambdaQueryWrapper<SysConfig> qw = new LambdaQueryWrapper<>();
|
|
||||||
qw.eq(SysConfig::getDelFlag, "0");
|
|
||||||
qw.eq(SysConfig::getConfigKey, "directive_source_url");
|
|
||||||
SysConfig urlObj = sysConfigService.getOne(qw);
|
|
||||||
//试验田协议+域名(/ip+端口)
|
|
||||||
String baseUrl = urlObj.getConfigValue();
|
|
||||||
if (baseUrl.endsWith("/")) {
|
|
||||||
baseUrl = baseUrl.substring(0, baseUrl.length() - 1); // 移除末尾斜杠
|
|
||||||
}
|
|
||||||
//通过系统上传的文件
|
|
||||||
if ("local".equals(media.getIzNetUrl())) {
|
|
||||||
qw = new LambdaQueryWrapper<>();
|
|
||||||
qw.eq(SysConfig::getDelFlag, "0");
|
|
||||||
qw.eq(SysConfig::getConfigKey, "directive_source_name");
|
|
||||||
SysConfig nameObj = sysConfigService.getOne(qw);
|
|
||||||
//获取到对应试验田的服务名 用于通过接口获取对应媒体资源文件
|
|
||||||
String servName = nameObj.getConfigValue();
|
|
||||||
if (servName.startsWith("/")) {
|
|
||||||
servName = servName.substring(1);
|
|
||||||
}
|
|
||||||
//协议域名服务名
|
|
||||||
String url = baseUrl + "/" + servName + "/sys/common/open/static/" + media.getFilePath() + "?name=" + SafetyUtil.getSecureKey();
|
|
||||||
if (upLoadPath.endsWith("/") || upLoadPath.endsWith("\\")) {
|
|
||||||
upLoadPath = upLoadPath.substring(0, upLoadPath.length() - 1);
|
|
||||||
}
|
|
||||||
String filePath = media.getFilePath();
|
|
||||||
if (filePath.startsWith("/") || filePath.startsWith("\\")) {
|
|
||||||
filePath = filePath.substring(1);
|
|
||||||
}
|
|
||||||
FileDownloader.downloadFile(url, upLoadPath + File.separator + filePath.substring(0, filePath.lastIndexOf("/")), media.getFilePath().substring(media.getFilePath().lastIndexOf("/") + 1));
|
|
||||||
}
|
|
||||||
//存储到媒体资源公共目录中的媒体资源 通过nginx可以访问的静态资源
|
|
||||||
if ("net".equals(media.getIzNetUrl())) {
|
|
||||||
String filePath = media.getFilePath();
|
|
||||||
if (filePath.startsWith("/")) {
|
|
||||||
filePath = filePath.substring(1);
|
|
||||||
}
|
|
||||||
String url = baseUrl + "/" + filePath;
|
|
||||||
if (directiveUpLoadPath.endsWith("/") || directiveUpLoadPath.endsWith("\\")) {
|
|
||||||
directiveUpLoadPath = directiveUpLoadPath.substring(0, directiveUpLoadPath.length() - 1);
|
|
||||||
}
|
|
||||||
FileDownloader.downloadFile(url, directiveUpLoadPath, media.getFilePath().substring(media.getFilePath().lastIndexOf("/") + 1));
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
MediaAsyncErrorLog mediaAsyncErrorLog = new MediaAsyncErrorLog();
|
|
||||||
mediaAsyncErrorLog.setMediaid(media.getId());
|
|
||||||
mediaAsyncErrorLogService.save(mediaAsyncErrorLog);
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -17,9 +17,5 @@
|
||||||
<artifactId>nursing-unit-base-core</artifactId>
|
<artifactId>nursing-unit-base-core</artifactId>
|
||||||
<version>2.0.0</version>
|
<version>2.0.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>com.nursingunit.boot</groupId>
|
|
||||||
<artifactId>nursing-unit-common</artifactId>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -1,118 +0,0 @@
|
||||||
package com.nu.modules.documentrecognition;
|
|
||||||
|
|
||||||
import com.nu.modules.aliyun.documentrecognition.DocumentRecognitionUtils;
|
|
||||||
import org.jeecg.common.api.vo.Result;
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
|
||||||
|
|
||||||
import java.io.InputStream;
|
|
||||||
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/api/ocr")
|
|
||||||
public class DocumentRecognitionApi {
|
|
||||||
|
|
||||||
@Value("${aliyun.ocr.accessKeyId}")
|
|
||||||
private String accessKeyId;
|
|
||||||
|
|
||||||
@Value("${aliyun.ocr.accessKeySecret}")
|
|
||||||
private String accessKeySecret;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 身份证识别
|
|
||||||
* @param file 图片文件
|
|
||||||
*/
|
|
||||||
@PostMapping("/idCard")
|
|
||||||
public Result<String> recognizeIdCard(
|
|
||||||
@RequestParam("file") MultipartFile file) {
|
|
||||||
|
|
||||||
DocumentRecognitionUtils utils = new DocumentRecognitionUtils(accessKeyId, accessKeySecret);
|
|
||||||
try (InputStream inputStream = file.getInputStream()) {
|
|
||||||
String result = utils.recognizeIdCard(inputStream);
|
|
||||||
return Result.ok(result);
|
|
||||||
} catch (Exception e) {
|
|
||||||
return Result.error("身份证识别失败: " + e.getMessage());
|
|
||||||
} finally {
|
|
||||||
utils.close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 户口本首页识别
|
|
||||||
* @param file 图片文件
|
|
||||||
*/
|
|
||||||
@PostMapping("/household")
|
|
||||||
public Result<String> recognizeHousehold(
|
|
||||||
@RequestParam("file") MultipartFile file) {
|
|
||||||
|
|
||||||
DocumentRecognitionUtils utils = new DocumentRecognitionUtils(accessKeyId, accessKeySecret);
|
|
||||||
try (InputStream inputStream = file.getInputStream()) {
|
|
||||||
String result = utils.recognizeHouseholdRegister(inputStream);
|
|
||||||
return Result.ok(result);
|
|
||||||
} catch (Exception e) {
|
|
||||||
return Result.error("户口本识别失败: " + e.getMessage());
|
|
||||||
} finally {
|
|
||||||
utils.close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 银行卡识别
|
|
||||||
* @param file 图片文件
|
|
||||||
*/
|
|
||||||
@PostMapping("/bankCard")
|
|
||||||
public Result<String> recognizeBankCard(
|
|
||||||
@RequestParam("file") MultipartFile file) {
|
|
||||||
|
|
||||||
DocumentRecognitionUtils utils = new DocumentRecognitionUtils(accessKeyId, accessKeySecret);
|
|
||||||
try (InputStream inputStream = file.getInputStream()) {
|
|
||||||
String result = utils.recognizeBankCard(inputStream);
|
|
||||||
return Result.ok(result);
|
|
||||||
} catch (Exception e) {
|
|
||||||
return Result.error("银行卡识别失败: " + e.getMessage());
|
|
||||||
} finally {
|
|
||||||
utils.close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 医保卡识别
|
|
||||||
* @param file 图片文件
|
|
||||||
*/
|
|
||||||
@PostMapping("/medicalCard")
|
|
||||||
public Result<String> recognizeMedicalCard(
|
|
||||||
@RequestParam("file") MultipartFile file) {
|
|
||||||
|
|
||||||
DocumentRecognitionUtils utils = new DocumentRecognitionUtils(accessKeyId, accessKeySecret);
|
|
||||||
try (InputStream inputStream = file.getInputStream()) {
|
|
||||||
String result = utils.recognizeMedicalCard(inputStream);
|
|
||||||
return Result.ok(result);
|
|
||||||
} catch (Exception e) {
|
|
||||||
return Result.error("医保卡识别失败: " + e.getMessage());
|
|
||||||
} finally {
|
|
||||||
utils.close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 营业执照识别
|
|
||||||
* @param file 图片文件
|
|
||||||
*/
|
|
||||||
@PostMapping("/businessLicense")
|
|
||||||
public Result<String> recognizeBusinessLicense(
|
|
||||||
@RequestParam("file") MultipartFile file) {
|
|
||||||
|
|
||||||
DocumentRecognitionUtils utils = new DocumentRecognitionUtils(accessKeyId, accessKeySecret);
|
|
||||||
try (InputStream inputStream = file.getInputStream()) {
|
|
||||||
String result = utils.recognizeBusinessLicense(inputStream);
|
|
||||||
return Result.ok(result);
|
|
||||||
} catch (Exception e) {
|
|
||||||
return Result.error("营业执照识别失败: " + e.getMessage());
|
|
||||||
} finally {
|
|
||||||
utils.close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -119,7 +119,6 @@ public class ShiroConfig {
|
||||||
filterChainDefinitionMap.put("/sys/checkAuth", "anon"); //授权接口排除
|
filterChainDefinitionMap.put("/sys/checkAuth", "anon"); //授权接口排除
|
||||||
filterChainDefinitionMap.put("/api/pad/versionUpdate", "anon");//pad端版本检测接口
|
filterChainDefinitionMap.put("/api/pad/versionUpdate", "anon");//pad端版本检测接口
|
||||||
filterChainDefinitionMap.put("/nuIpadApi/versionManage/versionUpdate", "anon");//pad端版本检测接口
|
filterChainDefinitionMap.put("/nuIpadApi/versionManage/versionUpdate", "anon");//pad端版本检测接口
|
||||||
filterChainDefinitionMap.put("/api/ocr/**", "anon");//阿里云证件识别
|
|
||||||
|
|
||||||
//update-begin--Author:scott Date:20221116 for:排除静态资源后缀
|
//update-begin--Author:scott Date:20221116 for:排除静态资源后缀
|
||||||
filterChainDefinitionMap.put("/", "anon");
|
filterChainDefinitionMap.put("/", "anon");
|
||||||
|
|
|
@ -22,24 +22,6 @@
|
||||||
<artifactId>nu-system-local-api</artifactId>
|
<artifactId>nu-system-local-api</artifactId>
|
||||||
<version>2.0.0</version>
|
<version>2.0.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- 阿里云证件照识别 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.aliyun</groupId>
|
|
||||||
<artifactId>alibabacloud-ocr_api20210707</artifactId>
|
|
||||||
<version>3.0.4</version>
|
|
||||||
</dependency>
|
|
||||||
<!-- https://mvnrepository.com/artifact/com.google.guava/guava -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.google.guava</groupId>
|
|
||||||
<artifactId>guava</artifactId>
|
|
||||||
<version>33.4.8-jre</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.jsoup</groupId>
|
|
||||||
<artifactId>jsoup</artifactId>
|
|
||||||
<version>1.15.3</version>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -1,44 +0,0 @@
|
||||||
package com.nu.dto;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Description: 媒体资源管理
|
|
||||||
* @Author: jeecg-boot
|
|
||||||
* @Date: 2025-05-15
|
|
||||||
* @Version: V1.0
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class MediaManageMQDto implements Serializable {
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/**id*/
|
|
||||||
private String id;
|
|
||||||
/**名称*/
|
|
||||||
private String name;
|
|
||||||
/**备注*/
|
|
||||||
private String descr;
|
|
||||||
/**文件类型*/
|
|
||||||
private String fileType;
|
|
||||||
/**系统功能*/
|
|
||||||
private String sysFunc;
|
|
||||||
/**文件路径*/
|
|
||||||
private String filePath;
|
|
||||||
/**是否网络资源*/
|
|
||||||
private String izNetUrl;
|
|
||||||
/**是否删除*/
|
|
||||||
private String delFlag;
|
|
||||||
/**创建人*/
|
|
||||||
private String createBy;
|
|
||||||
/**创建日期*/
|
|
||||||
private Date createTime;
|
|
||||||
/**更新人*/
|
|
||||||
private String updateBy;
|
|
||||||
/**更新日期*/
|
|
||||||
private Date updateTime;
|
|
||||||
|
|
||||||
private String netFilePath;
|
|
||||||
}
|
|
|
@ -1,117 +0,0 @@
|
||||||
package com.nu.modules.aliyun.documentrecognition;
|
|
||||||
|
|
||||||
import com.aliyun.auth.credentials.Credential;
|
|
||||||
import com.aliyun.auth.credentials.provider.StaticCredentialProvider;
|
|
||||||
import com.aliyun.sdk.service.ocr_api20210707.*;
|
|
||||||
import com.aliyun.sdk.service.ocr_api20210707.models.*;
|
|
||||||
import com.google.gson.Gson;
|
|
||||||
import darabonba.core.client.ClientOverrideConfiguration;
|
|
||||||
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.util.concurrent.CompletableFuture;
|
|
||||||
|
|
||||||
public class DocumentRecognitionUtils {
|
|
||||||
|
|
||||||
private final AsyncClient client;
|
|
||||||
|
|
||||||
public DocumentRecognitionUtils(String accessKeyId, String accessKeySecret) {
|
|
||||||
// 配置认证信息
|
|
||||||
StaticCredentialProvider provider = StaticCredentialProvider.create(
|
|
||||||
Credential.builder()
|
|
||||||
.accessKeyId(accessKeyId)
|
|
||||||
.accessKeySecret(accessKeySecret)
|
|
||||||
.build());
|
|
||||||
|
|
||||||
// 配置客户端
|
|
||||||
this.client = AsyncClient.builder()
|
|
||||||
.region("cn-hangzhou")
|
|
||||||
.credentialsProvider(provider)
|
|
||||||
.overrideConfiguration(
|
|
||||||
ClientOverrideConfiguration.create()
|
|
||||||
.setEndpointOverride("ocr-api.cn-hangzhou.aliyuncs.com")
|
|
||||||
)
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 关闭客户端连接
|
|
||||||
*/
|
|
||||||
public void close() {
|
|
||||||
this.client.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 识别身份证
|
|
||||||
* @param inputStream 图片输入流
|
|
||||||
* @return 识别结果JSON字符串
|
|
||||||
*/
|
|
||||||
public String recognizeIdCard(InputStream inputStream) throws Exception {
|
|
||||||
RecognizeIdcardRequest request = RecognizeIdcardRequest.builder()
|
|
||||||
.body(inputStream)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
CompletableFuture<RecognizeIdcardResponse> future = client.recognizeIdcard(request);
|
|
||||||
RecognizeIdcardResponse response = future.get();
|
|
||||||
return new Gson().toJson(response.getBody());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 识别户口本首页
|
|
||||||
* @param inputStream 图片输入流
|
|
||||||
* @return 识别结果JSON字符串
|
|
||||||
*/
|
|
||||||
public String recognizeHouseholdRegister(InputStream inputStream) throws Exception {
|
|
||||||
RecognizeHouseholdRequest request = RecognizeHouseholdRequest.builder()
|
|
||||||
.body(inputStream)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
CompletableFuture<RecognizeHouseholdResponse> future = client.recognizeHousehold(request);
|
|
||||||
RecognizeHouseholdResponse response = future.get();
|
|
||||||
return new Gson().toJson(response.getBody());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 识别银行卡
|
|
||||||
* @param inputStream 图片输入流
|
|
||||||
* @return 识别结果JSON字符串
|
|
||||||
*/
|
|
||||||
public String recognizeBankCard(InputStream inputStream) throws Exception {
|
|
||||||
RecognizeBankCardRequest request = RecognizeBankCardRequest.builder()
|
|
||||||
.body(inputStream)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
CompletableFuture<RecognizeBankCardResponse> future = client.recognizeBankCard(request);
|
|
||||||
RecognizeBankCardResponse response = future.get();
|
|
||||||
return new Gson().toJson(response.getBody());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 识别医保卡
|
|
||||||
* @param inputStream 图片输入流
|
|
||||||
* @return 识别结果JSON字符串
|
|
||||||
*/
|
|
||||||
public String recognizeMedicalCard(InputStream inputStream) throws Exception {
|
|
||||||
RecognizeSocialSecurityCardVersionIIRequest request = RecognizeSocialSecurityCardVersionIIRequest.builder()
|
|
||||||
.body(inputStream)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
CompletableFuture<RecognizeSocialSecurityCardVersionIIResponse> future = client.recognizeSocialSecurityCardVersionII(request);
|
|
||||||
RecognizeSocialSecurityCardVersionIIResponse response = future.get();
|
|
||||||
return new Gson().toJson(response.getBody());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 识别营业执照
|
|
||||||
* @param inputStream 图片输入流
|
|
||||||
* @return 识别结果JSON字符串
|
|
||||||
*/
|
|
||||||
public String recognizeBusinessLicense(InputStream inputStream) throws Exception {
|
|
||||||
RecognizeBusinessLicenseRequest request = RecognizeBusinessLicenseRequest.builder()
|
|
||||||
.body(inputStream)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
CompletableFuture<RecognizeBusinessLicenseResponse> future = client.recognizeBusinessLicense(request);
|
|
||||||
RecognizeBusinessLicenseResponse response = future.get();
|
|
||||||
return new Gson().toJson(response.getBody());
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,83 +0,0 @@
|
||||||
package com.nu.utils;
|
|
||||||
|
|
||||||
import com.google.common.util.concurrent.RateLimiter;
|
|
||||||
|
|
||||||
import java.io.*;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.nio.file.Paths;
|
|
||||||
|
|
||||||
public class FileDownloader {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 下载网络资源到本地目录
|
|
||||||
*
|
|
||||||
* @param fileUrl 完整的文件URL(自动处理路径中的斜杠)
|
|
||||||
* @param saveDir 本地保存目录(如:/data/files)
|
|
||||||
* @param fileName 保存的文件名(如:image.jpg)
|
|
||||||
* @return 保存后的完整路径
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public static String downloadFile(String fileUrl, String saveDir, String fileName) throws Exception {
|
|
||||||
// 标准化URL路径
|
|
||||||
fileUrl = normalizeUrl(fileUrl);
|
|
||||||
|
|
||||||
// 创建保存目录
|
|
||||||
File dir = new File(saveDir);
|
|
||||||
if (!dir.exists()) {
|
|
||||||
dir.mkdirs();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 构建完整保存路径
|
|
||||||
String savePath = Paths.get(saveDir, fileName).toString();
|
|
||||||
File outputFile = new File(savePath);
|
|
||||||
|
|
||||||
// 如果文件已存在,直接返回路径
|
|
||||||
if (outputFile.exists()) {
|
|
||||||
return savePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 创建RateLimiter 限制下载速度为100k/s
|
|
||||||
RateLimiter rateLimiter = RateLimiter.create(100*1024);
|
|
||||||
|
|
||||||
// 打开URL连接
|
|
||||||
URL url = new URL(fileUrl);
|
|
||||||
InputStream in = url.openStream();
|
|
||||||
|
|
||||||
try (BufferedInputStream bis = new BufferedInputStream(in);
|
|
||||||
FileOutputStream fos = new FileOutputStream(outputFile);
|
|
||||||
BufferedOutputStream bos = new BufferedOutputStream(fos)) {
|
|
||||||
|
|
||||||
byte[] buffer = new byte[8192]; // 8KB缓冲区
|
|
||||||
int bytesRead;
|
|
||||||
|
|
||||||
while ((bytesRead = bis.read(buffer)) != -1) {
|
|
||||||
// 获取所需数量的许可
|
|
||||||
rateLimiter.acquire(bytesRead);
|
|
||||||
|
|
||||||
// 写入文件
|
|
||||||
bos.write(buffer, 0, bytesRead);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return savePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 标准化URL路径(处理开头/结尾的斜杠)
|
|
||||||
*
|
|
||||||
* @param url
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private static String normalizeUrl(String url) {
|
|
||||||
if (url == null || url.trim().isEmpty()) {
|
|
||||||
return url;
|
|
||||||
}
|
|
||||||
|
|
||||||
String normalized = url.replaceFirst("^(https?:)/", "$1//");
|
|
||||||
|
|
||||||
normalized = normalized.replaceAll("(?<!:)/{2,}", "/");
|
|
||||||
|
|
||||||
return normalized;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,166 +0,0 @@
|
||||||
package com.nu.utils;
|
|
||||||
import java.io.*;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.time.format.DateTimeFormatter;
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public class RegionCodeProcessor {
|
|
||||||
private static final String ROOT_ID = "1927641061017837570";
|
|
||||||
private static final String CREATE_BY = "admin";
|
|
||||||
private static final int TENANT_ID = 0;
|
|
||||||
private static final DateTimeFormatter DATE_FORMAT = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
||||||
private static final String CURRENT_TIME = LocalDateTime.now().format(DATE_FORMAT);
|
|
||||||
|
|
||||||
private static final String INPUT_FILE = "D:\\downLoad\\行政区划代码.txt";
|
|
||||||
private static final String OUTPUT_FILE = "D:\\downLoad\\region_inserts.sql";
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
try {
|
|
||||||
List<Region> regions = readRegionsFromFile();
|
|
||||||
Map<String, String> codeToIdMap = new HashMap<>();
|
|
||||||
Map<String, List<Region>> parentCodeToChildrenMap = new HashMap<>();
|
|
||||||
|
|
||||||
// 处理省一级(编码后四位是0000的)
|
|
||||||
for (Region region : regions) {
|
|
||||||
if (region.code.endsWith("0000")) {
|
|
||||||
region.pid = ROOT_ID;
|
|
||||||
region.level = 2;
|
|
||||||
codeToIdMap.put(region.code, region.id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 处理市一级(编码后两位是00的)和省直辖县级行政单位
|
|
||||||
for (Region region : regions) {
|
|
||||||
if (region.code.endsWith("00") && !region.code.endsWith("0000")) {
|
|
||||||
String parentCode = region.code.substring(0, 2) + "0000";
|
|
||||||
region.pid = codeToIdMap.getOrDefault(parentCode, ROOT_ID);
|
|
||||||
region.level = 3;
|
|
||||||
codeToIdMap.put(region.code, region.id);
|
|
||||||
} else if (region.name.equals("省直辖县级行政单位")) {
|
|
||||||
String parentCode = region.code.substring(0, 2) + "0000";
|
|
||||||
region.pid = codeToIdMap.getOrDefault(parentCode, ROOT_ID);
|
|
||||||
region.level = 3;
|
|
||||||
codeToIdMap.put(region.code, region.id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 处理县一级(其他情况)
|
|
||||||
for (Region region : regions) {
|
|
||||||
if (region.pid == null) {
|
|
||||||
if (region.code.endsWith("0000")) {
|
|
||||||
continue; // 已经处理过的省一级
|
|
||||||
}
|
|
||||||
|
|
||||||
// 尝试找市级父节点
|
|
||||||
String cityCode = region.code.substring(0, 4) + "00";
|
|
||||||
if (codeToIdMap.containsKey(cityCode)) {
|
|
||||||
region.pid = codeToIdMap.get(cityCode);
|
|
||||||
region.level = 4;
|
|
||||||
} else {
|
|
||||||
// 如果没有市级,则直接挂到省级下
|
|
||||||
String provinceCode = region.code.substring(0, 2) + "0000";
|
|
||||||
region.pid = codeToIdMap.getOrDefault(provinceCode, ROOT_ID);
|
|
||||||
region.level = 3;
|
|
||||||
}
|
|
||||||
codeToIdMap.put(region.code, region.id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 构建父节点到子节点的映射
|
|
||||||
for (Region region : regions) {
|
|
||||||
if (!region.pid.equals(ROOT_ID)) {
|
|
||||||
parentCodeToChildrenMap
|
|
||||||
.computeIfAbsent(region.pid, k -> new ArrayList<>())
|
|
||||||
.add(region);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 生成SQL语句
|
|
||||||
generateSqlFile(regions, parentCodeToChildrenMap);
|
|
||||||
|
|
||||||
System.out.println("SQL文件已生成到: " + OUTPUT_FILE);
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static List<Region> readRegionsFromFile() throws IOException {
|
|
||||||
List<Region> regions = new ArrayList<>();
|
|
||||||
Pattern pattern = Pattern.compile("^\\d+");
|
|
||||||
|
|
||||||
// 使用明确的GBK编码读取文件(常见的中文编码)
|
|
||||||
try (BufferedReader reader = new BufferedReader(new InputStreamReader(
|
|
||||||
new FileInputStream(INPUT_FILE), "GBK"))) {
|
|
||||||
String line;
|
|
||||||
while ((line = reader.readLine()) != null) {
|
|
||||||
line = line.trim();
|
|
||||||
if (line.isEmpty() || !pattern.matcher(line).find()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 处理行数据,考虑中文名称可能包含空格的情况
|
|
||||||
String code = line.substring(0, 6).trim();
|
|
||||||
String name = line.substring(6).trim();
|
|
||||||
|
|
||||||
// 处理特殊名称(如"省直辖县级行政单位")
|
|
||||||
if (name.equals("省直辖县级行政单位")) {
|
|
||||||
name = "省直辖县级行政单位";
|
|
||||||
}
|
|
||||||
|
|
||||||
// 生成UUID作为ID
|
|
||||||
String id = UUID.randomUUID().toString().replaceAll("-","");
|
|
||||||
|
|
||||||
regions.add(new Region(id, null, name, code));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return regions;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void generateSqlFile(List<Region> regions,
|
|
||||||
Map<String, List<Region>> parentCodeToChildrenMap) throws IOException {
|
|
||||||
// 使用UTF-8编码写入SQL文件
|
|
||||||
try (BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(
|
|
||||||
new FileOutputStream(OUTPUT_FILE), StandardCharsets.UTF_8))) {
|
|
||||||
|
|
||||||
// 先处理所有区域
|
|
||||||
for (Region region : regions) {
|
|
||||||
String hasChild = parentCodeToChildrenMap.containsKey(region.id) ? "1" : "0";
|
|
||||||
|
|
||||||
String sql = String.format(
|
|
||||||
"INSERT INTO sys_category (id, pid, name, code, create_by, create_time, update_by, update_time, sys_org_code, has_child, tenant_id) " +
|
|
||||||
"VALUES ('%s', '%s', '%s', '%s', '%s', '%s', NULL, NULL, NULL, '%s', %d);",
|
|
||||||
region.id, region.pid, escapeSql(region.name), region.code,
|
|
||||||
CREATE_BY, CURRENT_TIME, hasChild, TENANT_ID
|
|
||||||
);
|
|
||||||
|
|
||||||
writer.write(sql);
|
|
||||||
writer.newLine();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static String escapeSql(String str) {
|
|
||||||
if (str == null) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
return str.replace("'", "''");
|
|
||||||
}
|
|
||||||
|
|
||||||
static class Region {
|
|
||||||
String id;
|
|
||||||
String pid;
|
|
||||||
String name;
|
|
||||||
String code;
|
|
||||||
int level;
|
|
||||||
|
|
||||||
public Region(String id, String pid, String name, String code) {
|
|
||||||
this.id = id;
|
|
||||||
this.pid = pid;
|
|
||||||
this.name = name;
|
|
||||||
this.code = code;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,126 +0,0 @@
|
||||||
package com.nu.utils;
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import java.security.MessageDigest;
|
|
||||||
import java.security.NoSuchAlgorithmException;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.time.format.DateTimeFormatter;
|
|
||||||
|
|
||||||
@Component
|
|
||||||
public class SafetyUtil {
|
|
||||||
private static String downloadkey;
|
|
||||||
|
|
||||||
@Value("${downloadkey}")
|
|
||||||
public void setDownloadkey(String key) {
|
|
||||||
downloadkey = key;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 验证 secureKey
|
|
||||||
* 是否合法
|
|
||||||
*
|
|
||||||
* @param secureKey 客户端传入的密钥(MD5 值)
|
|
||||||
* @return true=验证通过,false=验证失败
|
|
||||||
*/
|
|
||||||
public static boolean validateSecureKey(String secureKey) {
|
|
||||||
if (secureKey == null || downloadkey == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取当前时间(精确到分钟,格式为 yyyyMMddHHmm)
|
|
||||||
String currentTime = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmm"));
|
|
||||||
// 获取前一分钟的时间(用于扩大验证窗口)
|
|
||||||
String previousMinute = LocalDateTime.now().minusMinutes(1).format(DateTimeFormatter.ofPattern("yyyyMMddHHmm"));
|
|
||||||
|
|
||||||
// 验证当前时间的密钥
|
|
||||||
String mixedKey = complexMix(downloadkey, currentTime);
|
|
||||||
String md5Hash = calculateMD5(mixedKey);
|
|
||||||
if (secureKey.equalsIgnoreCase(md5Hash)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 验证前一分钟的密钥(扩大验证窗口)
|
|
||||||
mixedKey = complexMix(downloadkey, previousMinute);
|
|
||||||
md5Hash = calculateMD5(mixedKey);
|
|
||||||
return secureKey.equalsIgnoreCase(md5Hash);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 混拼规则:
|
|
||||||
* 1.
|
|
||||||
* 交替插入 downloadkey
|
|
||||||
* 和 date
|
|
||||||
* 的字符
|
|
||||||
* 2.
|
|
||||||
* 对 date
|
|
||||||
* 进行倒序
|
|
||||||
* 3.每 3个字符插入一个固定干扰符 '#'
|
|
||||||
*/
|
|
||||||
private static String complexMix(String key, String date) {
|
|
||||||
StringBuilder mixed = new StringBuilder();
|
|
||||||
|
|
||||||
// 1. 倒序 date
|
|
||||||
String reversedDate = new StringBuilder(date).reverse().toString();
|
|
||||||
|
|
||||||
// 2. 交替插入 key 和 reversedDate
|
|
||||||
int maxLen = Math.max(key.length(), reversedDate.length());
|
|
||||||
for (int i = 0; i < maxLen; i++) {
|
|
||||||
if (i < key.length()) {
|
|
||||||
mixed.append(key.charAt(i));
|
|
||||||
}
|
|
||||||
if (i < reversedDate.length()) {
|
|
||||||
mixed.append(reversedDate.charAt(i));
|
|
||||||
}
|
|
||||||
|
|
||||||
// 3. 每 3 个字符插入 '#'
|
|
||||||
if (i % 3 == 2) {
|
|
||||||
mixed.append('#');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return mixed.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 计算字符串的 MD5(32位小写)
|
|
||||||
*/
|
|
||||||
private static String calculateMD5(String input) {
|
|
||||||
try {
|
|
||||||
MessageDigest md = MessageDigest.getInstance("MD5");
|
|
||||||
byte[] hashBytes = md.digest(input.getBytes());
|
|
||||||
|
|
||||||
StringBuilder hexString = new StringBuilder();
|
|
||||||
for (byte b : hashBytes) {
|
|
||||||
String hex = Integer.toHexString(0xff & b);
|
|
||||||
if (hex.length() == 1) {
|
|
||||||
hexString.append('0');
|
|
||||||
}
|
|
||||||
hexString.append(hex);
|
|
||||||
}
|
|
||||||
return hexString.toString();
|
|
||||||
} catch (NoSuchAlgorithmException e) {
|
|
||||||
throw new RuntimeException("MD5 algorithm not found", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取当前的安全密钥
|
|
||||||
* 现在包含精确到分钟的时间信息(yyyyMMddHHmm)
|
|
||||||
*/
|
|
||||||
public static String getSecureKey() {
|
|
||||||
if (downloadkey == null) {
|
|
||||||
return "aaa";
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取当前时间(精确到分钟,格式为 yyyyMMddHHmm)
|
|
||||||
String currentTime = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmm"));
|
|
||||||
|
|
||||||
// 复杂混拼(固定规则)
|
|
||||||
String mixedKey = complexMix(downloadkey, currentTime);
|
|
||||||
|
|
||||||
// 计算 MD5 并返回
|
|
||||||
return calculateMD5(mixedKey);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -38,7 +38,7 @@ import java.io.IOException;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: 分类字典
|
* @Description: 分类字典
|
||||||
* @Author: jeecg-boot
|
* @Author: jeecg-boot
|
||||||
* @Date: 2019-05-29
|
* @Date: 2019-05-29
|
||||||
|
@ -58,7 +58,6 @@ public class SysCategoryController {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页列表查询
|
* 分页列表查询
|
||||||
*
|
|
||||||
* @param sysCategory
|
* @param sysCategory
|
||||||
* @param pageNo
|
* @param pageNo
|
||||||
* @param pageSize
|
* @param pageSize
|
||||||
|
@ -67,14 +66,17 @@ public class SysCategoryController {
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/rootList")
|
@GetMapping(value = "/rootList")
|
||||||
public Result<IPage<SysCategory>> queryPageList(SysCategory sysCategory,
|
public Result<IPage<SysCategory>> queryPageList(SysCategory sysCategory,
|
||||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||||
HttpServletRequest req) {
|
HttpServletRequest req) {
|
||||||
|
if(oConvertUtils.isEmpty(sysCategory.getPid())){
|
||||||
|
sysCategory.setPid("0");
|
||||||
|
}
|
||||||
Result<IPage<SysCategory>> result = new Result<IPage<SysCategory>>();
|
Result<IPage<SysCategory>> result = new Result<IPage<SysCategory>>();
|
||||||
//------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------
|
||||||
//是否开启系统管理模块的多租户数据隔离【SAAS多租户模式】
|
//是否开启系统管理模块的多租户数据隔离【SAAS多租户模式】
|
||||||
if (MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL) {
|
if(MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL){
|
||||||
sysCategory.setTenantId(oConvertUtils.getInt(TenantContext.getTenant(), 0));
|
sysCategory.setTenantId(oConvertUtils.getInt(TenantContext.getTenant(),0));
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -84,8 +86,8 @@ public class SysCategoryController {
|
||||||
String name = sysCategory.getName();
|
String name = sysCategory.getName();
|
||||||
String code = sysCategory.getCode();
|
String code = sysCategory.getCode();
|
||||||
//QueryWrapper<SysCategory> queryWrapper = new QueryWrapper<SysCategory>();
|
//QueryWrapper<SysCategory> queryWrapper = new QueryWrapper<SysCategory>();
|
||||||
if (StringUtils.isBlank(name) && StringUtils.isBlank(code)) {
|
if(StringUtils.isBlank(name)&&StringUtils.isBlank(code)){
|
||||||
queryWrapper.eq("pid","0");
|
queryWrapper.eq("pid", sysCategory.getPid());
|
||||||
}
|
}
|
||||||
//--author:liusq---date:20211119 -----for: 分类字典页面查询条件配置--------end
|
//--author:liusq---date:20211119 -----for: 分类字典页面查询条件配置--------end
|
||||||
//--author:os_chengtgen---date:20190804 -----for:【vue3】 分类字典页面显示错误,issues:377--------end
|
//--author:os_chengtgen---date:20190804 -----for:【vue3】 分类字典页面显示错误,issues:377--------end
|
||||||
|
@ -98,16 +100,15 @@ public class SysCategoryController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping(value = "/childList")
|
@GetMapping(value = "/childList")
|
||||||
public Result<List<SysCategory>> queryPageList(SysCategory sysCategory, HttpServletRequest req) {
|
public Result<List<SysCategory>> queryPageList(SysCategory sysCategory,HttpServletRequest req) {
|
||||||
//------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------
|
||||||
//是否开启系统管理模块的多租户数据隔离【SAAS多租户模式】
|
//是否开启系统管理模块的多租户数据隔离【SAAS多租户模式】
|
||||||
if (MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL) {
|
if(MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL){
|
||||||
sysCategory.setTenantId(oConvertUtils.getInt(TenantContext.getTenant(), 0));
|
sysCategory.setTenantId(oConvertUtils.getInt(TenantContext.getTenant(), 0));
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------
|
||||||
Result<List<SysCategory>> result = new Result<List<SysCategory>>();
|
Result<List<SysCategory>> result = new Result<List<SysCategory>>();
|
||||||
QueryWrapper<SysCategory> queryWrapper = QueryGenerator.initQueryWrapper(sysCategory, req.getParameterMap());
|
QueryWrapper<SysCategory> queryWrapper = QueryGenerator.initQueryWrapper(sysCategory, req.getParameterMap());
|
||||||
queryWrapper.orderByAsc("code");
|
|
||||||
List<SysCategory> list = sysCategoryService.list(queryWrapper);
|
List<SysCategory> list = sysCategoryService.list(queryWrapper);
|
||||||
result.setSuccess(true);
|
result.setSuccess(true);
|
||||||
result.setResult(list);
|
result.setResult(list);
|
||||||
|
@ -117,7 +118,6 @@ public class SysCategoryController {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加
|
* 添加
|
||||||
*
|
|
||||||
* @param sysCategory
|
* @param sysCategory
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@ -128,25 +128,24 @@ public class SysCategoryController {
|
||||||
sysCategoryService.addSysCategory(sysCategory);
|
sysCategoryService.addSysCategory(sysCategory);
|
||||||
result.success("添加成功!");
|
result.success("添加成功!");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(),e);
|
||||||
result.error500("编码重复!");
|
result.error500("操作失败");
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 编辑
|
* 编辑
|
||||||
*
|
|
||||||
* @param sysCategory
|
* @param sysCategory
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
@RequestMapping(value = "/edit", method = { RequestMethod.PUT,RequestMethod.POST })
|
||||||
public Result<SysCategory> edit(@RequestBody SysCategory sysCategory) {
|
public Result<SysCategory> edit(@RequestBody SysCategory sysCategory) {
|
||||||
Result<SysCategory> result = new Result<SysCategory>();
|
Result<SysCategory> result = new Result<SysCategory>();
|
||||||
SysCategory sysCategoryEntity = sysCategoryService.getById(sysCategory.getId());
|
SysCategory sysCategoryEntity = sysCategoryService.getById(sysCategory.getId());
|
||||||
if (sysCategoryEntity == null) {
|
if(sysCategoryEntity==null) {
|
||||||
result.error500("编码重复!");
|
result.error500("未找到对应实体");
|
||||||
} else {
|
}else {
|
||||||
sysCategoryService.updateSysCategory(sysCategory);
|
sysCategoryService.updateSysCategory(sysCategory);
|
||||||
result.success("修改成功!");
|
result.success("修改成功!");
|
||||||
}
|
}
|
||||||
|
@ -155,17 +154,16 @@ public class SysCategoryController {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过id删除
|
* 通过id删除
|
||||||
*
|
|
||||||
* @param id
|
* @param id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@DeleteMapping(value = "/delete")
|
@DeleteMapping(value = "/delete")
|
||||||
public Result<SysCategory> delete(@RequestParam(name = "id", required = true) String id) {
|
public Result<SysCategory> delete(@RequestParam(name="id",required=true) String id) {
|
||||||
Result<SysCategory> result = new Result<SysCategory>();
|
Result<SysCategory> result = new Result<SysCategory>();
|
||||||
SysCategory sysCategory = sysCategoryService.getById(id);
|
SysCategory sysCategory = sysCategoryService.getById(id);
|
||||||
if (sysCategory == null) {
|
if(sysCategory==null) {
|
||||||
result.error500("未找到对应实体");
|
result.error500("未找到对应实体");
|
||||||
} else {
|
}else {
|
||||||
this.sysCategoryService.deleteSysCategory(id);
|
this.sysCategoryService.deleteSysCategory(id);
|
||||||
result.success("删除成功!");
|
result.success("删除成功!");
|
||||||
}
|
}
|
||||||
|
@ -175,16 +173,15 @@ public class SysCategoryController {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除
|
* 批量删除
|
||||||
*
|
|
||||||
* @param ids
|
* @param ids
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@DeleteMapping(value = "/deleteBatch")
|
@DeleteMapping(value = "/deleteBatch")
|
||||||
public Result<SysCategory> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
public Result<SysCategory> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||||
Result<SysCategory> result = new Result<SysCategory>();
|
Result<SysCategory> result = new Result<SysCategory>();
|
||||||
if (ids == null || "".equals(ids.trim())) {
|
if(ids==null || "".equals(ids.trim())) {
|
||||||
result.error500("参数不识别!");
|
result.error500("参数不识别!");
|
||||||
} else {
|
}else {
|
||||||
this.sysCategoryService.deleteSysCategory(ids);
|
this.sysCategoryService.deleteSysCategory(ids);
|
||||||
result.success("删除成功!");
|
result.success("删除成功!");
|
||||||
}
|
}
|
||||||
|
@ -193,17 +190,16 @@ public class SysCategoryController {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过id查询
|
* 通过id查询
|
||||||
*
|
|
||||||
* @param id
|
* @param id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/queryById")
|
@GetMapping(value = "/queryById")
|
||||||
public Result<SysCategory> queryById(@RequestParam(name = "id", required = true) String id) {
|
public Result<SysCategory> queryById(@RequestParam(name="id",required=true) String id) {
|
||||||
Result<SysCategory> result = new Result<SysCategory>();
|
Result<SysCategory> result = new Result<SysCategory>();
|
||||||
SysCategory sysCategory = sysCategoryService.getById(id);
|
SysCategory sysCategory = sysCategoryService.getById(id);
|
||||||
if (sysCategory == null) {
|
if(sysCategory==null) {
|
||||||
result.error500("未找到对应实体");
|
result.error500("未找到对应实体");
|
||||||
} else {
|
}else {
|
||||||
result.setResult(sysCategory);
|
result.setResult(sysCategory);
|
||||||
result.setSuccess(true);
|
result.setSuccess(true);
|
||||||
}
|
}
|
||||||
|
@ -219,7 +215,7 @@ public class SysCategoryController {
|
||||||
public ModelAndView exportXls(HttpServletRequest request, SysCategory sysCategory) {
|
public ModelAndView exportXls(HttpServletRequest request, SysCategory sysCategory) {
|
||||||
//------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------
|
||||||
//是否开启系统管理模块的多租户数据隔离【SAAS多租户模式】
|
//是否开启系统管理模块的多租户数据隔离【SAAS多租户模式】
|
||||||
if (MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL) {
|
if(MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL){
|
||||||
sysCategory.setTenantId(oConvertUtils.getInt(TenantContext.getTenant(), 0));
|
sysCategory.setTenantId(oConvertUtils.getInt(TenantContext.getTenant(), 0));
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------
|
||||||
|
@ -231,9 +227,9 @@ public class SysCategoryController {
|
||||||
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
|
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
|
||||||
// 过滤选中数据
|
// 过滤选中数据
|
||||||
String selections = request.getParameter("selections");
|
String selections = request.getParameter("selections");
|
||||||
if (oConvertUtils.isEmpty(selections)) {
|
if(oConvertUtils.isEmpty(selections)) {
|
||||||
mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
|
mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
|
||||||
} else {
|
}else {
|
||||||
List<String> selectionList = Arrays.asList(selections.split(","));
|
List<String> selectionList = Arrays.asList(selections.split(","));
|
||||||
List<SysCategory> exportList = pageList.stream().filter(item -> selectionList.contains(item.getId())).collect(Collectors.toList());
|
List<SysCategory> exportList = pageList.stream().filter(item -> selectionList.contains(item.getId())).collect(Collectors.toList());
|
||||||
mv.addObject(NormalExcelConstants.DATA_LIST, exportList);
|
mv.addObject(NormalExcelConstants.DATA_LIST, exportList);
|
||||||
|
@ -242,7 +238,7 @@ public class SysCategoryController {
|
||||||
mv.addObject(NormalExcelConstants.FILE_NAME, "分类字典列表");
|
mv.addObject(NormalExcelConstants.FILE_NAME, "分类字典列表");
|
||||||
mv.addObject(NormalExcelConstants.CLASS, SysCategory.class);
|
mv.addObject(NormalExcelConstants.CLASS, SysCategory.class);
|
||||||
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||||
mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("分类字典列表数据", "导出人:" + user.getRealname(), "导出信息"));
|
mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("分类字典列表数据", "导出人:"+user.getRealname(), "导出信息"));
|
||||||
return mv;
|
return mv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -254,7 +250,7 @@ public class SysCategoryController {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) throws IOException{
|
||||||
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
||||||
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
|
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
|
||||||
// 错误信息
|
// 错误信息
|
||||||
|
@ -271,19 +267,19 @@ public class SysCategoryController {
|
||||||
List<SysCategory> listSysCategorys = ExcelImportUtil.importExcel(file.getInputStream(), SysCategory.class, params);
|
List<SysCategory> listSysCategorys = ExcelImportUtil.importExcel(file.getInputStream(), SysCategory.class, params);
|
||||||
//按照编码长度排序
|
//按照编码长度排序
|
||||||
Collections.sort(listSysCategorys);
|
Collections.sort(listSysCategorys);
|
||||||
log.info("排序后的list====>", listSysCategorys);
|
log.info("排序后的list====>",listSysCategorys);
|
||||||
for (int i = 0; i < listSysCategorys.size(); i++) {
|
for (int i = 0; i < listSysCategorys.size(); i++) {
|
||||||
SysCategory sysCategoryExcel = listSysCategorys.get(i);
|
SysCategory sysCategoryExcel = listSysCategorys.get(i);
|
||||||
String code = sysCategoryExcel.getCode();
|
String code = sysCategoryExcel.getCode();
|
||||||
if (code.length() > 3) {
|
if(code.length()>3){
|
||||||
String pCode = sysCategoryExcel.getCode().substring(0, code.length() - 3);
|
String pCode = sysCategoryExcel.getCode().substring(0,code.length()-3);
|
||||||
log.info("pCode====>", pCode);
|
log.info("pCode====>",pCode);
|
||||||
String pId = sysCategoryService.queryIdByCode(pCode);
|
String pId=sysCategoryService.queryIdByCode(pCode);
|
||||||
log.info("pId====>", pId);
|
log.info("pId====>",pId);
|
||||||
if (StringUtils.isNotBlank(pId)) {
|
if(StringUtils.isNotBlank(pId)){
|
||||||
sysCategoryExcel.setPid(pId);
|
sysCategoryExcel.setPid(pId);
|
||||||
}
|
}
|
||||||
} else {
|
}else{
|
||||||
sysCategoryExcel.setPid("0");
|
sysCategoryExcel.setPid("0");
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
@ -313,15 +309,16 @@ public class SysCategoryController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ImportExcelUtil.imporReturnRes(errorLines, successLines, errorMessage);
|
return ImportExcelUtil.imporReturnRes(errorLines,successLines,errorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 加载单个数据 用于回显
|
* 加载单个数据 用于回显
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/loadOne", method = RequestMethod.GET)
|
@RequestMapping(value = "/loadOne", method = RequestMethod.GET)
|
||||||
public Result<SysCategory> loadOne(@RequestParam(name = "field") String field, @RequestParam(name = "val") String val) {
|
public Result<SysCategory> loadOne(@RequestParam(name="field") String field,@RequestParam(name="val") String val) {
|
||||||
Result<SysCategory> result = new Result<SysCategory>();
|
Result<SysCategory> result = new Result<SysCategory>();
|
||||||
try {
|
try {
|
||||||
//update-begin-author:taoyan date:2022-5-6 for: issues/3663 sql注入问题
|
//update-begin-author:taoyan date:2022-5-6 for: issues/3663 sql注入问题
|
||||||
|
@ -333,13 +330,13 @@ public class SysCategoryController {
|
||||||
QueryWrapper<SysCategory> query = new QueryWrapper<SysCategory>();
|
QueryWrapper<SysCategory> query = new QueryWrapper<SysCategory>();
|
||||||
query.eq(field, val);
|
query.eq(field, val);
|
||||||
List<SysCategory> ls = this.sysCategoryService.list(query);
|
List<SysCategory> ls = this.sysCategoryService.list(query);
|
||||||
if (ls == null || ls.size() == 0) {
|
if(ls==null || ls.size()==0) {
|
||||||
result.setMessage("查询无果");
|
result.setMessage("查询无果");
|
||||||
result.setSuccess(false);
|
result.setSuccess(false);
|
||||||
} else if (ls.size() > 1) {
|
}else if(ls.size()>1) {
|
||||||
result.setMessage("查询数据异常,[" + field + "]存在多个值:" + val);
|
result.setMessage("查询数据异常,["+field+"]存在多个值:"+val);
|
||||||
result.setSuccess(false);
|
result.setSuccess(false);
|
||||||
} else {
|
}else {
|
||||||
result.setSuccess(true);
|
result.setSuccess(true);
|
||||||
result.setResult(ls.get(0));
|
result.setResult(ls.get(0));
|
||||||
}
|
}
|
||||||
|
@ -355,7 +352,7 @@ public class SysCategoryController {
|
||||||
* 加载节点的子数据
|
* 加载节点的子数据
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/loadTreeChildren", method = RequestMethod.GET)
|
@RequestMapping(value = "/loadTreeChildren", method = RequestMethod.GET)
|
||||||
public Result<List<TreeSelectModel>> loadTreeChildren(@RequestParam(name = "pid") String pid) {
|
public Result<List<TreeSelectModel>> loadTreeChildren(@RequestParam(name="pid") String pid) {
|
||||||
Result<List<TreeSelectModel>> result = new Result<List<TreeSelectModel>>();
|
Result<List<TreeSelectModel>> result = new Result<List<TreeSelectModel>>();
|
||||||
try {
|
try {
|
||||||
List<TreeSelectModel> ls = this.sysCategoryService.queryListByPid(pid);
|
List<TreeSelectModel> ls = this.sysCategoryService.queryListByPid(pid);
|
||||||
|
@ -373,15 +370,12 @@ public class SysCategoryController {
|
||||||
* 加载一级节点/如果是同步 则所有数据
|
* 加载一级节点/如果是同步 则所有数据
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/loadTreeRoot", method = RequestMethod.GET)
|
@RequestMapping(value = "/loadTreeRoot", method = RequestMethod.GET)
|
||||||
public Result<List<TreeSelectModel>> loadTreeRoot(@RequestParam(name = "async") Boolean async, @RequestParam(name = "pcode") String pcode) {
|
public Result<List<TreeSelectModel>> loadTreeRoot(@RequestParam(name="async") Boolean async,@RequestParam(name="pcode") String pcode) {
|
||||||
Result<List<TreeSelectModel>> result = new Result<List<TreeSelectModel>>();
|
Result<List<TreeSelectModel>> result = new Result<List<TreeSelectModel>>();
|
||||||
try {
|
try {
|
||||||
List<TreeSelectModel> ls = this.sysCategoryService.queryListByCode(pcode);
|
List<TreeSelectModel> ls = this.sysCategoryService.queryListByCode(pcode);
|
||||||
if (!async) {
|
if(!async) {
|
||||||
//框架自带傻逼for循环套sql 慎用 慢到想骂人 实测几百个非叶节点就已经爆炸了
|
loadAllCategoryChildren(ls);
|
||||||
// loadAllCategoryChildren(ls);
|
|
||||||
//一次sql查所有,系统代码处理循环生成树结构
|
|
||||||
loadAllCategoryChildrenQO(ls);
|
|
||||||
}
|
}
|
||||||
result.setResult(ls);
|
result.setResult(ls);
|
||||||
result.setSuccess(true);
|
result.setSuccess(true);
|
||||||
|
@ -399,70 +393,32 @@ public class SysCategoryController {
|
||||||
private void loadAllCategoryChildren(List<TreeSelectModel> ls) {
|
private void loadAllCategoryChildren(List<TreeSelectModel> ls) {
|
||||||
for (TreeSelectModel tsm : ls) {
|
for (TreeSelectModel tsm : ls) {
|
||||||
List<TreeSelectModel> temp = this.sysCategoryService.queryListByPid(tsm.getKey());
|
List<TreeSelectModel> temp = this.sysCategoryService.queryListByPid(tsm.getKey());
|
||||||
if (temp != null && temp.size() > 0) {
|
if(temp!=null && temp.size()>0) {
|
||||||
tsm.setChildren(temp);
|
tsm.setChildren(temp);
|
||||||
loadAllCategoryChildren(temp);
|
loadAllCategoryChildren(temp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 只查询一次数据库,代码内容循环处理,避免for-sql
|
|
||||||
*
|
|
||||||
* @param ls
|
|
||||||
*/
|
|
||||||
private void loadAllCategoryChildrenQO(List<TreeSelectModel> ls) {
|
|
||||||
// 1. 首先获取所有可能的pid值
|
|
||||||
Set<String> pids = new HashSet<>();
|
|
||||||
for (TreeSelectModel tsm : ls) {
|
|
||||||
pids.add(tsm.getKey());
|
|
||||||
}
|
|
||||||
|
|
||||||
// 2. 一次性查询所有可能需要的节点
|
|
||||||
List<TreeSelectModel> allNodes = this.sysCategoryService.queryAllCategories();
|
|
||||||
|
|
||||||
// 3. 构建节点映射表
|
|
||||||
Map<String, List<TreeSelectModel>> nodeMap = new HashMap<>();
|
|
||||||
for (TreeSelectModel node : allNodes) {
|
|
||||||
String parentId = node.getParentId();
|
|
||||||
nodeMap.computeIfAbsent(parentId, k -> new ArrayList<>()).add(node);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 4. 递归构建树结构
|
|
||||||
buildTree(ls, nodeMap);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void buildTree(List<TreeSelectModel> nodes, Map<String, List<TreeSelectModel>> nodeMap) {
|
|
||||||
for (TreeSelectModel node : nodes) {
|
|
||||||
String nodeKey = node.getKey();
|
|
||||||
List<TreeSelectModel> children = nodeMap.get(nodeKey);
|
|
||||||
if (children != null && !children.isEmpty()) {
|
|
||||||
node.setChildren(children);
|
|
||||||
buildTree(children, nodeMap);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验编码
|
* 校验编码
|
||||||
*
|
|
||||||
* @param pid
|
* @param pid
|
||||||
* @param code
|
* @param code
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/checkCode")
|
@GetMapping(value = "/checkCode")
|
||||||
public Result<?> checkCode(@RequestParam(name = "pid", required = false) String pid, @RequestParam(name = "code", required = false) String code) {
|
public Result<?> checkCode(@RequestParam(name="pid",required = false) String pid,@RequestParam(name="code",required = false) String code) {
|
||||||
if (oConvertUtils.isEmpty(code)) {
|
if(oConvertUtils.isEmpty(code)){
|
||||||
return Result.error("错误,类型编码为空!");
|
return Result.error("错误,类型编码为空!");
|
||||||
}
|
}
|
||||||
if (oConvertUtils.isEmpty(pid)) {
|
if(oConvertUtils.isEmpty(pid)){
|
||||||
return Result.ok();
|
return Result.ok();
|
||||||
}
|
}
|
||||||
SysCategory parent = this.sysCategoryService.getById(pid);
|
SysCategory parent = this.sysCategoryService.getById(pid);
|
||||||
if (code.startsWith(parent.getCode())) {
|
if(code.startsWith(parent.getCode())){
|
||||||
return Result.ok();
|
return Result.ok();
|
||||||
} else {
|
}else{
|
||||||
return Result.error("编码不符合规范,须以\"" + parent.getCode() + "\"开头!");
|
return Result.error("编码不符合规范,须以\""+parent.getCode()+"\"开头!");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -470,28 +426,27 @@ public class SysCategoryController {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分类字典树控件 加载节点
|
* 分类字典树控件 加载节点
|
||||||
*
|
|
||||||
* @param pid
|
* @param pid
|
||||||
* @param pcode
|
* @param pcode
|
||||||
* @param condition
|
* @param condition
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/loadTreeData", method = RequestMethod.GET)
|
@RequestMapping(value = "/loadTreeData", method = RequestMethod.GET)
|
||||||
public Result<List<TreeSelectModel>> loadDict(@RequestParam(name = "pid", required = false) String pid, @RequestParam(name = "pcode", required = false) String pcode, @RequestParam(name = "condition", required = false) String condition) {
|
public Result<List<TreeSelectModel>> loadDict(@RequestParam(name="pid",required = false) String pid,@RequestParam(name="pcode",required = false) String pcode, @RequestParam(name="condition",required = false) String condition) {
|
||||||
Result<List<TreeSelectModel>> result = new Result<List<TreeSelectModel>>();
|
Result<List<TreeSelectModel>> result = new Result<List<TreeSelectModel>>();
|
||||||
//pid如果传值了 就忽略pcode的作用
|
//pid如果传值了 就忽略pcode的作用
|
||||||
if (oConvertUtils.isEmpty(pid)) {
|
if(oConvertUtils.isEmpty(pid)){
|
||||||
if (oConvertUtils.isEmpty(pcode)) {
|
if(oConvertUtils.isEmpty(pcode)){
|
||||||
result.setSuccess(false);
|
result.setSuccess(false);
|
||||||
result.setMessage("加载分类字典树参数有误.[null]!");
|
result.setMessage("加载分类字典树参数有误.[null]!");
|
||||||
return result;
|
return result;
|
||||||
} else {
|
}else{
|
||||||
if (ISysCategoryService.ROOT_PID_VALUE.equals(pcode)) {
|
if(ISysCategoryService.ROOT_PID_VALUE.equals(pcode)){
|
||||||
pid = ISysCategoryService.ROOT_PID_VALUE;
|
pid = ISysCategoryService.ROOT_PID_VALUE;
|
||||||
} else {
|
}else{
|
||||||
pid = this.sysCategoryService.queryIdByCode(pcode);
|
pid = this.sysCategoryService.queryIdByCode(pcode);
|
||||||
}
|
}
|
||||||
if (oConvertUtils.isEmpty(pid)) {
|
if(oConvertUtils.isEmpty(pid)){
|
||||||
result.setSuccess(false);
|
result.setSuccess(false);
|
||||||
result.setMessage("加载分类字典树参数有误.[code]!");
|
result.setMessage("加载分类字典树参数有误.[code]!");
|
||||||
return result;
|
return result;
|
||||||
|
@ -499,10 +454,10 @@ public class SysCategoryController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Map<String, String> query = null;
|
Map<String, String> query = null;
|
||||||
if (oConvertUtils.isNotEmpty(condition)) {
|
if(oConvertUtils.isNotEmpty(condition)) {
|
||||||
query = JSON.parseObject(condition, Map.class);
|
query = JSON.parseObject(condition, Map.class);
|
||||||
}
|
}
|
||||||
List<TreeSelectModel> ls = sysCategoryService.queryListByPid(pid, query);
|
List<TreeSelectModel> ls = sysCategoryService.queryListByPid(pid,query);
|
||||||
result.setSuccess(true);
|
result.setSuccess(true);
|
||||||
result.setResult(ls);
|
result.setResult(ls);
|
||||||
return result;
|
return result;
|
||||||
|
@ -533,26 +488,25 @@ public class SysCategoryController {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [列表页面]加载分类字典数据 用于值的替换
|
* [列表页面]加载分类字典数据 用于值的替换
|
||||||
*
|
|
||||||
* @param code
|
* @param code
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/loadAllData", method = RequestMethod.GET)
|
@RequestMapping(value = "/loadAllData", method = RequestMethod.GET)
|
||||||
public Result<List<DictModel>> loadAllData(@RequestParam(name = "code", required = true) String code) {
|
public Result<List<DictModel>> loadAllData(@RequestParam(name="code",required = true) String code) {
|
||||||
Result<List<DictModel>> result = new Result<List<DictModel>>();
|
Result<List<DictModel>> result = new Result<List<DictModel>>();
|
||||||
LambdaQueryWrapper<SysCategory> query = new LambdaQueryWrapper<SysCategory>();
|
LambdaQueryWrapper<SysCategory> query = new LambdaQueryWrapper<SysCategory>();
|
||||||
if (oConvertUtils.isNotEmpty(code) && !CATEGORY_ROOT_CODE.equals(code)) {
|
if(oConvertUtils.isNotEmpty(code) && !CATEGORY_ROOT_CODE.equals(code)){
|
||||||
query.likeRight(SysCategory::getCode, code);
|
query.likeRight(SysCategory::getCode,code);
|
||||||
}
|
}
|
||||||
List<SysCategory> list = this.sysCategoryService.list(query);
|
List<SysCategory> list = this.sysCategoryService.list(query);
|
||||||
if (list == null || list.size() == 0) {
|
if(list==null || list.size()==0) {
|
||||||
result.setMessage("无数据,参数有误.[code]");
|
result.setMessage("无数据,参数有误.[code]");
|
||||||
result.setSuccess(false);
|
result.setSuccess(false);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
List<DictModel> rdList = new ArrayList<DictModel>();
|
List<DictModel> rdList = new ArrayList<DictModel>();
|
||||||
for (SysCategory c : list) {
|
for (SysCategory c : list) {
|
||||||
rdList.add(new DictModel(c.getId(), c.getName()));
|
rdList.add(new DictModel(c.getId(),c.getName()));
|
||||||
}
|
}
|
||||||
result.setSuccess(true);
|
result.setSuccess(true);
|
||||||
result.setResult(rdList);
|
result.setResult(rdList);
|
||||||
|
@ -561,7 +515,6 @@ public class SysCategoryController {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据父级id批量查询子节点
|
* 根据父级id批量查询子节点
|
||||||
*
|
|
||||||
* @param parentIds
|
* @param parentIds
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package org.jeecg.modules.system.entity;
|
package org.jeecg.modules.system.entity;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
@ -10,7 +9,6 @@ import org.jeecgframework.poi.excel.annotation.Excel;
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: 分类字典
|
* @Description: 分类字典
|
||||||
|
@ -20,69 +18,41 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@TableName("sys_category")
|
@TableName("sys_category")
|
||||||
public class SysCategory implements Serializable, Comparable<SysCategory> {
|
public class SysCategory implements Serializable,Comparable<SysCategory>{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**
|
/**主键*/
|
||||||
* 主键
|
|
||||||
*/
|
|
||||||
@TableId(type = IdType.ASSIGN_ID)
|
@TableId(type = IdType.ASSIGN_ID)
|
||||||
private java.lang.String id;
|
private java.lang.String id;
|
||||||
/**
|
/**父级节点*/
|
||||||
* 父级节点
|
|
||||||
*/
|
|
||||||
private java.lang.String pid;
|
private java.lang.String pid;
|
||||||
/**
|
/**类型名称*/
|
||||||
* 类型名称
|
|
||||||
*/
|
|
||||||
@Excel(name = "类型名称", width = 15)
|
@Excel(name = "类型名称", width = 15)
|
||||||
private java.lang.String name;
|
private java.lang.String name;
|
||||||
/**
|
/**类型编码*/
|
||||||
* 类型编码
|
|
||||||
*/
|
|
||||||
@Excel(name = "类型编码", width = 15)
|
@Excel(name = "类型编码", width = 15)
|
||||||
private java.lang.String code;
|
private java.lang.String code;
|
||||||
/**
|
/**创建人*/
|
||||||
* 创建人
|
|
||||||
*/
|
|
||||||
private java.lang.String createBy;
|
private java.lang.String createBy;
|
||||||
/**
|
/**创建日期*/
|
||||||
* 创建日期
|
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
*/
|
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
private java.util.Date createTime;
|
private java.util.Date createTime;
|
||||||
/**
|
/**更新人*/
|
||||||
* 更新人
|
|
||||||
*/
|
|
||||||
private java.lang.String updateBy;
|
private java.lang.String updateBy;
|
||||||
/**
|
/**更新日期*/
|
||||||
* 更新日期
|
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
*/
|
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
private java.util.Date updateTime;
|
private java.util.Date updateTime;
|
||||||
/**
|
/**所属部门*/
|
||||||
* 所属部门
|
|
||||||
*/
|
|
||||||
private java.lang.String sysOrgCode;
|
private java.lang.String sysOrgCode;
|
||||||
/**
|
/**是否有子节点*/
|
||||||
* 是否有子节点
|
|
||||||
*/
|
|
||||||
@Excel(name = "是否有子节点(1:有)", width = 15)
|
@Excel(name = "是否有子节点(1:有)", width = 15)
|
||||||
private java.lang.String hasChild;
|
private java.lang.String hasChild;
|
||||||
|
|
||||||
/**
|
/**租户ID*/
|
||||||
* 租户ID
|
|
||||||
*/
|
|
||||||
private java.lang.Integer tenantId;
|
private java.lang.Integer tenantId;
|
||||||
|
|
||||||
/**
|
|
||||||
* 子节点列表 - 非数据库字段
|
|
||||||
*/
|
|
||||||
@TableField(exist = false)
|
|
||||||
private List<SysCategory> children;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compareTo(SysCategory o) {
|
public int compareTo(SysCategory o) {
|
||||||
//比较条件我们定的是按照code的长度升序
|
//比较条件我们定的是按照code的长度升序
|
||||||
|
@ -92,17 +62,8 @@ public class SysCategory implements Serializable, Comparable<SysCategory> {
|
||||||
int s = this.code.length() - o.code.length();
|
int s = this.code.length() - o.code.length();
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "SysCategory [code=" + code + ", name=" + name + "]";
|
return "SysCategory [code=" + code + ", name=" + name + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<SysCategory> getChildren() {
|
|
||||||
return children;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setChildren(List<SysCategory> children) {
|
|
||||||
this.children = children;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,184 +27,103 @@ import java.util.Objects;
|
||||||
public class SysDepart implements Serializable {
|
public class SysDepart implements Serializable {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**
|
/**ID*/
|
||||||
* ID
|
|
||||||
*/
|
|
||||||
@TableId(type = IdType.ASSIGN_ID)
|
@TableId(type = IdType.ASSIGN_ID)
|
||||||
private String id;
|
private String id;
|
||||||
/**
|
/**父机构ID*/
|
||||||
* 父机构ID
|
|
||||||
*/
|
|
||||||
private String parentId;
|
private String parentId;
|
||||||
/**
|
/**机构/部门名称*/
|
||||||
* 机构/部门名称
|
@Excel(name="机构/部门名称",width=15)
|
||||||
*/
|
|
||||||
@Excel(name = "机构/部门名称", width = 15)
|
|
||||||
private String departName;
|
private String departName;
|
||||||
/**
|
/**英文名*/
|
||||||
* 英文名
|
@Excel(name="英文名",width=15)
|
||||||
*/
|
|
||||||
@Excel(name = "英文名", width = 15)
|
|
||||||
private String departNameEn;
|
private String departNameEn;
|
||||||
/**
|
/**缩写*/
|
||||||
* 缩写
|
|
||||||
*/
|
|
||||||
private String departNameAbbr;
|
private String departNameAbbr;
|
||||||
/**
|
/**排序*/
|
||||||
* 排序
|
@Excel(name="排序",width=15)
|
||||||
*/
|
|
||||||
@Excel(name = "排序", width = 15)
|
|
||||||
private Integer departOrder;
|
private Integer departOrder;
|
||||||
/**
|
/**描述*/
|
||||||
* 描述
|
@Excel(name="描述",width=15)
|
||||||
*/
|
|
||||||
@Excel(name = "描述", width = 15)
|
|
||||||
private String description;
|
private String description;
|
||||||
/**
|
/**机构类别 1=公司,2=组织机构,3=岗位*/
|
||||||
* 机构类别 1=公司,2=组织机构,3=岗位
|
@Excel(name="机构类别",width=15,dicCode="org_category")
|
||||||
*/
|
|
||||||
@Excel(name = "机构类别", width = 15, dicCode = "org_category")
|
|
||||||
private String orgCategory;
|
private String orgCategory;
|
||||||
/**
|
/**机构类型*/
|
||||||
* 机构类型
|
|
||||||
*/
|
|
||||||
private String orgType;
|
private String orgType;
|
||||||
/**
|
/**机构编码*/
|
||||||
* 机构编码
|
@Excel(name="机构编码",width=15)
|
||||||
*/
|
|
||||||
@Excel(name = "机构编码", width = 15)
|
|
||||||
private String orgCode;
|
private String orgCode;
|
||||||
/**
|
/**业务平台类型*/
|
||||||
* 省份
|
@Excel(name="业务平台类型",width=15)
|
||||||
*/
|
|
||||||
@Excel(name = "省份", width = 30)
|
|
||||||
private String province;
|
|
||||||
/**
|
|
||||||
* 城市
|
|
||||||
*/
|
|
||||||
@Excel(name = "城市", width = 30)
|
|
||||||
private String city;
|
|
||||||
/**
|
|
||||||
* 区县
|
|
||||||
*/
|
|
||||||
@Excel(name = "区县", width = 30)
|
|
||||||
private String district;
|
|
||||||
/**
|
|
||||||
* 业务平台类型
|
|
||||||
*/
|
|
||||||
@Excel(name = "业务平台类型", width = 15)
|
|
||||||
@Dict(dicCode = "iz_test_site")
|
@Dict(dicCode = "iz_test_site")
|
||||||
private String platType;
|
private String platType;
|
||||||
/**
|
/**运营开始时间*/
|
||||||
* 运营开始时间
|
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||||
*/
|
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
|
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
|
||||||
private Date operationStartTime;
|
private Date operationStartTime;
|
||||||
/**
|
/**运营到期时间*/
|
||||||
* 运营到期时间
|
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||||
*/
|
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
|
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
|
||||||
private Date operationEndTime;
|
private Date operationEndTime;
|
||||||
/**
|
/**合同开始时间*/
|
||||||
* 合同开始时间
|
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||||
*/
|
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
|
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
|
||||||
private Date contractStartTime;
|
private Date contractStartTime;
|
||||||
/**
|
/**合同到期时间*/
|
||||||
* 合同到期时间
|
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||||
*/
|
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
|
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
|
||||||
private Date contractEndTime;
|
private Date contractEndTime;
|
||||||
/**
|
/**手机号*/
|
||||||
* 手机号
|
@Excel(name="手机号",width=15)
|
||||||
*/
|
|
||||||
@Excel(name = "手机号", width = 15)
|
|
||||||
private String mobile;
|
private String mobile;
|
||||||
/**
|
/**传真*/
|
||||||
* 传真
|
@Excel(name="传真",width=15)
|
||||||
*/
|
|
||||||
@Excel(name = "传真", width = 15)
|
|
||||||
private String fax;
|
private String fax;
|
||||||
/**
|
/**地址*/
|
||||||
* 地址
|
@Excel(name="地址",width=15)
|
||||||
*/
|
|
||||||
@Excel(name = "地址", width = 15)
|
|
||||||
private String address;
|
private String address;
|
||||||
/**
|
/**备注*/
|
||||||
* 备注
|
@Excel(name="备注",width=15)
|
||||||
*/
|
|
||||||
@Excel(name = "备注", width = 15)
|
|
||||||
private String memo;
|
private String memo;
|
||||||
/**
|
/**状态(1启用,0不启用)*/
|
||||||
* 状态(1启用,0不启用)
|
|
||||||
*/
|
|
||||||
@Dict(dicCode = "depart_status")
|
@Dict(dicCode = "depart_status")
|
||||||
private String status;
|
private String status;
|
||||||
/**
|
/**删除状态(0,正常,1已删除)*/
|
||||||
* 删除状态(0,正常,1已删除)
|
|
||||||
*/
|
|
||||||
@Dict(dicCode = "del_flag")
|
@Dict(dicCode = "del_flag")
|
||||||
private String delFlag;
|
private String delFlag;
|
||||||
/**
|
/**对接企业微信的ID*/
|
||||||
* 对接企业微信的ID
|
|
||||||
*/
|
|
||||||
private String qywxIdentifier;
|
private String qywxIdentifier;
|
||||||
/**
|
/**对接钉钉的部门ID*/
|
||||||
* 对接钉钉的部门ID
|
|
||||||
*/
|
|
||||||
private String dingIdentifier;
|
private String dingIdentifier;
|
||||||
/**
|
/**创建人*/
|
||||||
* 创建人
|
|
||||||
*/
|
|
||||||
private String createBy;
|
private String createBy;
|
||||||
/**
|
/**创建日期*/
|
||||||
* 创建日期
|
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
*/
|
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
/**
|
/**更新人*/
|
||||||
* 更新人
|
|
||||||
*/
|
|
||||||
private String updateBy;
|
private String updateBy;
|
||||||
/**
|
/**更新日期*/
|
||||||
* 更新日期
|
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
*/
|
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
private Date updateTime;
|
private Date updateTime;
|
||||||
/**
|
/**租户ID*/
|
||||||
* 租户ID
|
|
||||||
*/
|
|
||||||
private java.lang.Integer tenantId;
|
private java.lang.Integer tenantId;
|
||||||
|
|
||||||
/**
|
/**是否有叶子节点: 1是0否*/
|
||||||
* 是否有叶子节点: 1是0否
|
|
||||||
*/
|
|
||||||
private Integer izLeaf;
|
private Integer izLeaf;
|
||||||
|
|
||||||
/**
|
/**各机构服务器后台接口地址*/
|
||||||
* 各机构服务器后台接口地址
|
|
||||||
*/
|
|
||||||
private String serverUrl;
|
private String serverUrl;
|
||||||
/**
|
/**各机构服务器后台接口地址*/
|
||||||
* 各机构服务器后台接口地址
|
|
||||||
*/
|
|
||||||
private String picUrl;
|
private String picUrl;
|
||||||
|
|
||||||
//update-begin---author:wangshuai ---date:20200308 for:[JTC-119]在部门管理菜单下设置部门负责人,新增字段负责人ids和旧的负责人ids
|
//update-begin---author:wangshuai ---date:20200308 for:[JTC-119]在部门管理菜单下设置部门负责人,新增字段负责人ids和旧的负责人ids
|
||||||
/**
|
/**部门负责人的ids*/
|
||||||
* 部门负责人的ids
|
|
||||||
*/
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private String directorUserIds;
|
private String directorUserIds;
|
||||||
/**
|
/**旧的部门负责人的ids(用于比较删除和新增)*/
|
||||||
* 旧的部门负责人的ids(用于比较删除和新增)
|
|
||||||
*/
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private String oldDirectorUserIds;
|
private String oldDirectorUserIds;
|
||||||
//update-end---author:wangshuai ---date:20200308 for:[JTC-119]新增字段负责人ids和旧的负责人ids
|
//update-end---author:wangshuai ---date:20200308 for:[JTC-119]新增字段负责人ids和旧的负责人ids
|
||||||
|
@ -234,9 +153,6 @@ public class SysDepart implements Serializable {
|
||||||
Objects.equals(orgCategory, depart.orgCategory) &&
|
Objects.equals(orgCategory, depart.orgCategory) &&
|
||||||
Objects.equals(orgType, depart.orgType) &&
|
Objects.equals(orgType, depart.orgType) &&
|
||||||
Objects.equals(orgCode, depart.orgCode) &&
|
Objects.equals(orgCode, depart.orgCode) &&
|
||||||
Objects.equals(province, depart.province) &&
|
|
||||||
Objects.equals(city, depart.city) &&
|
|
||||||
Objects.equals(district, depart.district) &&
|
|
||||||
Objects.equals(mobile, depart.mobile) &&
|
Objects.equals(mobile, depart.mobile) &&
|
||||||
Objects.equals(fax, depart.fax) &&
|
Objects.equals(fax, depart.fax) &&
|
||||||
Objects.equals(address, depart.address) &&
|
Objects.equals(address, depart.address) &&
|
||||||
|
@ -256,8 +172,8 @@ public class SysDepart implements Serializable {
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(super.hashCode(), id, parentId, departName,
|
return Objects.hash(super.hashCode(), id, parentId, departName,
|
||||||
departNameEn, departNameAbbr, departOrder, description, orgCategory,
|
departNameEn, departNameAbbr, departOrder, description,orgCategory,
|
||||||
orgType, orgCode, province, city, district, mobile, fax, address, memo, status,
|
orgType, orgCode, mobile, fax, address, memo, status,
|
||||||
delFlag, createBy, createTime, updateBy, updateTime, tenantId);
|
delFlag, createBy, createTime, updateBy, updateTime, tenantId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,6 +48,4 @@ public interface SysCategoryMapper extends BaseMapper<SysCategory> {
|
||||||
@InterceptorIgnore(tenantLine = "true")
|
@InterceptorIgnore(tenantLine = "true")
|
||||||
@Select("SELECT code FROM sys_category WHERE ID = #{id}")
|
@Select("SELECT code FROM sys_category WHERE ID = #{id}")
|
||||||
SysCategory selectSysCategoryById(@Param("id") String id);
|
SysCategory selectSysCategoryById(@Param("id") String id);
|
||||||
|
|
||||||
List<TreeSelectModel> queryAllCategories();
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,15 +32,6 @@
|
||||||
</if>
|
</if>
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
<select id="queryAllCategories" resultType="org.jeecg.modules.system.model.TreeSelectModel">
|
|
||||||
select code,
|
|
||||||
name as "title",
|
|
||||||
id as "key",
|
|
||||||
(case when has_child = '1' then 0 else 1 end) as isLeaf,
|
|
||||||
pid as parentId
|
|
||||||
from sys_category
|
|
||||||
order by code
|
|
||||||
</select>
|
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
@ -18,23 +18,17 @@ import java.util.Objects;
|
||||||
* @Author Steve
|
* @Author Steve
|
||||||
* @Since 2019-01-22
|
* @Since 2019-01-22
|
||||||
*/
|
*/
|
||||||
public class SysDepartTreeModel implements Serializable {
|
public class SysDepartTreeModel implements Serializable{
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**
|
/** 对应SysDepart中的id字段,前端数据树中的key*/
|
||||||
* 对应SysDepart中的id字段,前端数据树中的key
|
|
||||||
*/
|
|
||||||
private String key;
|
private String key;
|
||||||
|
|
||||||
/**
|
/** 对应SysDepart中的id字段,前端数据树中的value*/
|
||||||
* 对应SysDepart中的id字段,前端数据树中的value
|
|
||||||
*/
|
|
||||||
private String value;
|
private String value;
|
||||||
|
|
||||||
/**
|
/** 对应depart_name字段,前端数据树中的title*/
|
||||||
* 对应depart_name字段,前端数据树中的title
|
|
||||||
*/
|
|
||||||
private String title;
|
private String title;
|
||||||
|
|
||||||
|
|
||||||
|
@ -63,12 +57,6 @@ public class SysDepartTreeModel implements Serializable {
|
||||||
|
|
||||||
private String orgCode;
|
private String orgCode;
|
||||||
|
|
||||||
private String province;
|
|
||||||
|
|
||||||
private String city;
|
|
||||||
|
|
||||||
private String district;
|
|
||||||
|
|
||||||
private Date operationStartTime;
|
private Date operationStartTime;
|
||||||
|
|
||||||
private Date operationEndTime;
|
private Date operationEndTime;
|
||||||
|
@ -102,9 +90,7 @@ public class SysDepartTreeModel implements Serializable {
|
||||||
private String picUrl;
|
private String picUrl;
|
||||||
|
|
||||||
//update-begin---author:wangshuai ---date:20200308 for:[JTC-119]在部门管理菜单下设置部门负责人,新增字段部门负责人ids
|
//update-begin---author:wangshuai ---date:20200308 for:[JTC-119]在部门管理菜单下设置部门负责人,新增字段部门负责人ids
|
||||||
/**
|
/**部门负责人ids*/
|
||||||
* 部门负责人ids
|
|
||||||
*/
|
|
||||||
private String directorUserIds;
|
private String directorUserIds;
|
||||||
//update-end---author:wangshuai ---date:20200308 for:[JTC-119]在部门管理菜单下设置部门负责人,新增字段部门负责人ids
|
//update-end---author:wangshuai ---date:20200308 for:[JTC-119]在部门管理菜单下设置部门负责人,新增字段部门负责人ids
|
||||||
|
|
||||||
|
@ -113,7 +99,6 @@ public class SysDepartTreeModel implements Serializable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 将SysDepart对象转换成SysDepartTreeModel对象
|
* 将SysDepart对象转换成SysDepartTreeModel对象
|
||||||
*
|
|
||||||
* @param sysDepart
|
* @param sysDepart
|
||||||
*/
|
*/
|
||||||
public SysDepartTreeModel(SysDepart sysDepart) {
|
public SysDepartTreeModel(SysDepart sysDepart) {
|
||||||
|
@ -131,9 +116,6 @@ public class SysDepartTreeModel implements Serializable {
|
||||||
this.orgCategory = sysDepart.getOrgCategory();
|
this.orgCategory = sysDepart.getOrgCategory();
|
||||||
this.orgType = sysDepart.getOrgType();
|
this.orgType = sysDepart.getOrgType();
|
||||||
this.orgCode = sysDepart.getOrgCode();
|
this.orgCode = sysDepart.getOrgCode();
|
||||||
this.province = sysDepart.getProvince();
|
|
||||||
this.city = sysDepart.getCity();
|
|
||||||
this.district = sysDepart.getDistrict();
|
|
||||||
this.operationStartTime = sysDepart.getOperationStartTime();
|
this.operationStartTime = sysDepart.getOperationStartTime();
|
||||||
this.operationEndTime = sysDepart.getOperationEndTime();
|
this.operationEndTime = sysDepart.getOperationEndTime();
|
||||||
this.contractStartTime = sysDepart.getContractStartTime();
|
this.contractStartTime = sysDepart.getContractStartTime();
|
||||||
|
@ -151,9 +133,9 @@ public class SysDepartTreeModel implements Serializable {
|
||||||
this.updateTime = sysDepart.getUpdateTime();
|
this.updateTime = sysDepart.getUpdateTime();
|
||||||
this.directorUserIds = sysDepart.getDirectorUserIds();
|
this.directorUserIds = sysDepart.getDirectorUserIds();
|
||||||
this.picUrl = sysDepart.getPicUrl();
|
this.picUrl = sysDepart.getPicUrl();
|
||||||
if (0 == sysDepart.getIzLeaf()) {
|
if(0 == sysDepart.getIzLeaf()){
|
||||||
this.isLeaf = false;
|
this.isLeaf = false;
|
||||||
} else {
|
}else{
|
||||||
this.isLeaf = true;
|
this.isLeaf = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -209,8 +191,8 @@ public class SysDepartTreeModel implements Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setChildren(List<SysDepartTreeModel> children) {
|
public void setChildren(List<SysDepartTreeModel> children) {
|
||||||
if (children == null) {
|
if (children==null){
|
||||||
this.isLeaf = true;
|
this.isLeaf=true;
|
||||||
}
|
}
|
||||||
this.children = children;
|
this.children = children;
|
||||||
}
|
}
|
||||||
|
@ -419,8 +401,7 @@ public class SysDepartTreeModel implements Serializable {
|
||||||
this.updateTime = updateTime;
|
this.updateTime = updateTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SysDepartTreeModel() {
|
public SysDepartTreeModel() { }
|
||||||
}
|
|
||||||
|
|
||||||
public String getDirectorUserIds() {
|
public String getDirectorUserIds() {
|
||||||
return directorUserIds;
|
return directorUserIds;
|
||||||
|
@ -438,30 +419,6 @@ public class SysDepartTreeModel implements Serializable {
|
||||||
this.picUrl = picUrl;
|
this.picUrl = picUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getProvince() {
|
|
||||||
return province;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProvince(String province) {
|
|
||||||
this.province = province;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCity() {
|
|
||||||
return city;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCity(String city) {
|
|
||||||
this.city = city;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDistrict() {
|
|
||||||
return district;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDistrict(String district) {
|
|
||||||
this.district = district;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 重写equals方法
|
* 重写equals方法
|
||||||
*/
|
*/
|
||||||
|
@ -485,9 +442,6 @@ public class SysDepartTreeModel implements Serializable {
|
||||||
Objects.equals(orgCategory, model.orgCategory) &&
|
Objects.equals(orgCategory, model.orgCategory) &&
|
||||||
Objects.equals(orgType, model.orgType) &&
|
Objects.equals(orgType, model.orgType) &&
|
||||||
Objects.equals(orgCode, model.orgCode) &&
|
Objects.equals(orgCode, model.orgCode) &&
|
||||||
Objects.equals(province, model.province) &&
|
|
||||||
Objects.equals(city, model.city) &&
|
|
||||||
Objects.equals(district, model.district) &&
|
|
||||||
Objects.equals(operationStartTime, model.operationStartTime) &&
|
Objects.equals(operationStartTime, model.operationStartTime) &&
|
||||||
Objects.equals(operationEndTime, model.operationEndTime) &&
|
Objects.equals(operationEndTime, model.operationEndTime) &&
|
||||||
Objects.equals(contractStartTime, model.contractStartTime) &&
|
Objects.equals(contractStartTime, model.contractStartTime) &&
|
||||||
|
@ -514,10 +468,10 @@ public class SysDepartTreeModel implements Serializable {
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
|
|
||||||
return Objects.hash(id, parentId, platType, departName, departNameEn, departNameAbbr,
|
return Objects.hash(id, parentId, platType, departName, departNameEn, departNameAbbr,
|
||||||
departOrder, description, orgCategory, orgType, orgCode, province, city, district,
|
departOrder, description, orgCategory, orgType, orgCode,
|
||||||
operationStartTime, operationEndTime, contractStartTime, contractEndTime,
|
operationStartTime, operationEndTime, contractStartTime, contractEndTime,
|
||||||
mobile, fax, address, memo, status, delFlag, qywxIdentifier,
|
mobile, fax, address, memo, status, delFlag, qywxIdentifier,
|
||||||
createBy, createTime, updateBy, updateTime, children, directorUserIds);
|
createBy, createTime, updateBy, updateTime, children,directorUserIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,8 +51,6 @@ public interface ISysCategoryService extends IService<SysCategory> {
|
||||||
*/
|
*/
|
||||||
public List<TreeSelectModel> queryListByPid(String pid);
|
public List<TreeSelectModel> queryListByPid(String pid);
|
||||||
|
|
||||||
public List<TreeSelectModel> queryAllCategories();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据pid查询子节点集合,支持查询条件
|
* 根据pid查询子节点集合,支持查询条件
|
||||||
* @param pid
|
* @param pid
|
||||||
|
|
|
@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import org.apache.commons.lang.StringUtils;
|
|
||||||
import org.jeecg.common.constant.FillRuleConstant;
|
import org.jeecg.common.constant.FillRuleConstant;
|
||||||
import org.jeecg.common.constant.SymbolConstant;
|
import org.jeecg.common.constant.SymbolConstant;
|
||||||
import org.jeecg.common.exception.JeecgBootException;
|
import org.jeecg.common.exception.JeecgBootException;
|
||||||
|
@ -35,14 +34,14 @@ public class SysCategoryServiceImpl extends ServiceImpl<SysCategoryMapper, SysCa
|
||||||
String categoryCode = "";
|
String categoryCode = "";
|
||||||
String categoryPid = ISysCategoryService.ROOT_PID_VALUE;
|
String categoryPid = ISysCategoryService.ROOT_PID_VALUE;
|
||||||
String parentCode = null;
|
String parentCode = null;
|
||||||
if (oConvertUtils.isNotEmpty(sysCategory.getPid())) {
|
if(oConvertUtils.isNotEmpty(sysCategory.getPid())){
|
||||||
categoryPid = sysCategory.getPid();
|
categoryPid = sysCategory.getPid();
|
||||||
|
|
||||||
//PID 不是根节点 说明需要设置父节点 hasChild 为1
|
//PID 不是根节点 说明需要设置父节点 hasChild 为1
|
||||||
if (!ISysCategoryService.ROOT_PID_VALUE.equals(categoryPid)) {
|
if(!ISysCategoryService.ROOT_PID_VALUE.equals(categoryPid)){
|
||||||
SysCategory parent = baseMapper.selectById(categoryPid);
|
SysCategory parent = baseMapper.selectById(categoryPid);
|
||||||
parentCode = parent.getCode();
|
parentCode = parent.getCode();
|
||||||
if (parent != null && !ISysCategoryService.HAS_CHILD.equals(parent.getHasChild())) {
|
if(parent!=null && !ISysCategoryService.HAS_CHILD.equals(parent.getHasChild())){
|
||||||
parent.setHasChild(ISysCategoryService.HAS_CHILD);
|
parent.setHasChild(ISysCategoryService.HAS_CHILD);
|
||||||
baseMapper.updateById(parent);
|
baseMapper.updateById(parent);
|
||||||
}
|
}
|
||||||
|
@ -50,24 +49,22 @@ public class SysCategoryServiceImpl extends ServiceImpl<SysCategoryMapper, SysCa
|
||||||
}
|
}
|
||||||
//update-begin--Author:baihailong Date:20191209 for:分类字典编码规则生成器做成公用配置
|
//update-begin--Author:baihailong Date:20191209 for:分类字典编码规则生成器做成公用配置
|
||||||
JSONObject formData = new JSONObject();
|
JSONObject formData = new JSONObject();
|
||||||
formData.put("pid", categoryPid);
|
formData.put("pid",categoryPid);
|
||||||
categoryCode = (String) FillRuleUtil.executeRule(FillRuleConstant.CATEGORY, formData);
|
categoryCode = (String) FillRuleUtil.executeRule(FillRuleConstant.CATEGORY,formData);
|
||||||
//update-end--Author:baihailong Date:20191209 for:分类字典编码规则生成器做成公用配置
|
//update-end--Author:baihailong Date:20191209 for:分类字典编码规则生成器做成公用配置
|
||||||
if (StringUtils.isBlank(sysCategory.getCode())) {
|
|
||||||
sysCategory.setCode(categoryCode);
|
sysCategory.setCode(categoryCode);
|
||||||
}
|
|
||||||
sysCategory.setPid(categoryPid);
|
sysCategory.setPid(categoryPid);
|
||||||
baseMapper.insert(sysCategory);
|
baseMapper.insert(sysCategory);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateSysCategory(SysCategory sysCategory) {
|
public void updateSysCategory(SysCategory sysCategory) {
|
||||||
if (oConvertUtils.isEmpty(sysCategory.getPid())) {
|
if(oConvertUtils.isEmpty(sysCategory.getPid())){
|
||||||
sysCategory.setPid(ISysCategoryService.ROOT_PID_VALUE);
|
sysCategory.setPid(ISysCategoryService.ROOT_PID_VALUE);
|
||||||
} else {
|
}else{
|
||||||
//如果当前节点父ID不为空 则设置父节点的hasChild 为1
|
//如果当前节点父ID不为空 则设置父节点的hasChild 为1
|
||||||
SysCategory parent = baseMapper.selectById(sysCategory.getPid());
|
SysCategory parent = baseMapper.selectById(sysCategory.getPid());
|
||||||
if (parent != null && !ISysCategoryService.HAS_CHILD.equals(parent.getHasChild())) {
|
if(parent!=null && !ISysCategoryService.HAS_CHILD.equals(parent.getHasChild())){
|
||||||
parent.setHasChild(ISysCategoryService.HAS_CHILD);
|
parent.setHasChild(ISysCategoryService.HAS_CHILD);
|
||||||
baseMapper.updateById(parent);
|
baseMapper.updateById(parent);
|
||||||
}
|
}
|
||||||
|
@ -76,40 +73,35 @@ public class SysCategoryServiceImpl extends ServiceImpl<SysCategoryMapper, SysCa
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<TreeSelectModel> queryListByCode(String pcode) throws JeecgBootException {
|
public List<TreeSelectModel> queryListByCode(String pcode) throws JeecgBootException{
|
||||||
String pid = ROOT_PID_VALUE;
|
String pid = ROOT_PID_VALUE;
|
||||||
if (oConvertUtils.isNotEmpty(pcode)) {
|
if(oConvertUtils.isNotEmpty(pcode)) {
|
||||||
List<SysCategory> list = baseMapper.selectList(new LambdaQueryWrapper<SysCategory>().eq(SysCategory::getCode, pcode));
|
List<SysCategory> list = baseMapper.selectList(new LambdaQueryWrapper<SysCategory>().eq(SysCategory::getCode, pcode));
|
||||||
if (list == null || list.size() == 0) {
|
if(list==null || list.size() ==0) {
|
||||||
throw new JeecgBootException("该编码【" + pcode + "】不存在,请核实!");
|
throw new JeecgBootException("该编码【"+pcode+"】不存在,请核实!");
|
||||||
}
|
}
|
||||||
if (list.size() > 1) {
|
if(list.size()>1) {
|
||||||
throw new JeecgBootException("该编码【" + pcode + "】存在多个,请核实!");
|
throw new JeecgBootException("该编码【"+pcode+"】存在多个,请核实!");
|
||||||
}
|
}
|
||||||
pid = list.get(0).getId();
|
pid = list.get(0).getId();
|
||||||
}
|
}
|
||||||
return baseMapper.queryListByPid(pid, null);
|
return baseMapper.queryListByPid(pid,null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<TreeSelectModel> queryListByPid(String pid) {
|
public List<TreeSelectModel> queryListByPid(String pid) {
|
||||||
if (oConvertUtils.isEmpty(pid)) {
|
if(oConvertUtils.isEmpty(pid)) {
|
||||||
pid = ROOT_PID_VALUE;
|
pid = ROOT_PID_VALUE;
|
||||||
}
|
}
|
||||||
return baseMapper.queryListByPid(pid, null);
|
return baseMapper.queryListByPid(pid,null);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<TreeSelectModel> queryAllCategories() {
|
|
||||||
return baseMapper.queryAllCategories();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<TreeSelectModel> queryListByPid(String pid, Map<String, String> condition) {
|
public List<TreeSelectModel> queryListByPid(String pid, Map<String, String> condition) {
|
||||||
if (oConvertUtils.isEmpty(pid)) {
|
if(oConvertUtils.isEmpty(pid)) {
|
||||||
pid = ROOT_PID_VALUE;
|
pid = ROOT_PID_VALUE;
|
||||||
}
|
}
|
||||||
return baseMapper.queryListByPid(pid, condition);
|
return baseMapper.queryListByPid(pid,condition);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -125,18 +117,17 @@ public class SysCategoryServiceImpl extends ServiceImpl<SysCategoryMapper, SysCa
|
||||||
//1.删除时将节点下所有子节点一并删除
|
//1.删除时将节点下所有子节点一并删除
|
||||||
this.baseMapper.deleteBatchIds(Arrays.asList(allIds.split(",")));
|
this.baseMapper.deleteBatchIds(Arrays.asList(allIds.split(",")));
|
||||||
//2.将父节点中已经没有下级的节点,修改为没有子节点
|
//2.将父节点中已经没有下级的节点,修改为没有子节点
|
||||||
if (oConvertUtils.isNotEmpty(pids)) {
|
if(oConvertUtils.isNotEmpty(pids)){
|
||||||
LambdaUpdateWrapper<SysCategory> updateWrapper = new UpdateWrapper<SysCategory>()
|
LambdaUpdateWrapper<SysCategory> updateWrapper = new UpdateWrapper<SysCategory>()
|
||||||
.lambda()
|
.lambda()
|
||||||
.in(SysCategory::getId, Arrays.asList(pids.split(",")))
|
.in(SysCategory::getId,Arrays.asList(pids.split(",")))
|
||||||
.set(SysCategory::getHasChild, "0");
|
.set(SysCategory::getHasChild,"0");
|
||||||
this.update(updateWrapper);
|
this.update(updateWrapper);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询节点下所有子节点
|
* 查询节点下所有子节点
|
||||||
*
|
|
||||||
* @param ids
|
* @param ids
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@ -145,13 +136,13 @@ public class SysCategoryServiceImpl extends ServiceImpl<SysCategoryMapper, SysCa
|
||||||
String[] idArr = ids.split(",");
|
String[] idArr = ids.split(",");
|
||||||
StringBuffer sb = new StringBuffer();
|
StringBuffer sb = new StringBuffer();
|
||||||
for (String pidVal : idArr) {
|
for (String pidVal : idArr) {
|
||||||
if (pidVal != null) {
|
if(pidVal != null){
|
||||||
if (!sb.toString().contains(pidVal)) {
|
if(!sb.toString().contains(pidVal)){
|
||||||
if (sb.toString().length() > 0) {
|
if(sb.toString().length() > 0){
|
||||||
sb.append(",");
|
sb.append(",");
|
||||||
}
|
}
|
||||||
sb.append(pidVal);
|
sb.append(pidVal);
|
||||||
this.getTreeChildIds(pidVal, sb);
|
this.getTreeChildIds(pidVal,sb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -160,7 +151,6 @@ public class SysCategoryServiceImpl extends ServiceImpl<SysCategoryMapper, SysCa
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询需修改标识的父节点ids
|
* 查询需修改标识的父节点ids
|
||||||
*
|
|
||||||
* @param ids
|
* @param ids
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@ -169,24 +159,24 @@ public class SysCategoryServiceImpl extends ServiceImpl<SysCategoryMapper, SysCa
|
||||||
//获取id数组
|
//获取id数组
|
||||||
String[] idArr = ids.split(",");
|
String[] idArr = ids.split(",");
|
||||||
for (String id : idArr) {
|
for (String id : idArr) {
|
||||||
if (id != null) {
|
if(id != null){
|
||||||
SysCategory category = this.baseMapper.selectById(id);
|
SysCategory category = this.baseMapper.selectById(id);
|
||||||
//根据id查询pid值
|
//根据id查询pid值
|
||||||
String metaPid = category.getPid();
|
String metaPid = category.getPid();
|
||||||
//查询此节点上一级是否还有其他子节点
|
//查询此节点上一级是否还有其他子节点
|
||||||
LambdaQueryWrapper<SysCategory> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<SysCategory> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
queryWrapper.eq(SysCategory::getPid, metaPid);
|
queryWrapper.eq(SysCategory::getPid,metaPid);
|
||||||
queryWrapper.notIn(SysCategory::getId, Arrays.asList(idArr));
|
queryWrapper.notIn(SysCategory::getId,Arrays.asList(idArr));
|
||||||
List<SysCategory> dataList = this.baseMapper.selectList(queryWrapper);
|
List<SysCategory> dataList = this.baseMapper.selectList(queryWrapper);
|
||||||
boolean flag = (dataList == null || dataList.size() == 0) && !Arrays.asList(idArr).contains(metaPid)
|
boolean flag = (dataList == null || dataList.size()==0) && !Arrays.asList(idArr).contains(metaPid)
|
||||||
&& !sb.toString().contains(metaPid);
|
&& !sb.toString().contains(metaPid);
|
||||||
if (flag) {
|
if(flag){
|
||||||
//如果当前节点原本有子节点 现在木有了,更新状态
|
//如果当前节点原本有子节点 现在木有了,更新状态
|
||||||
sb.append(metaPid).append(",");
|
sb.append(metaPid).append(",");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (sb.toString().endsWith(SymbolConstant.COMMA)) {
|
if(sb.toString().endsWith(SymbolConstant.COMMA)){
|
||||||
sb = sb.deleteCharAt(sb.length() - 1);
|
sb = sb.deleteCharAt(sb.length() - 1);
|
||||||
}
|
}
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
|
@ -194,18 +184,17 @@ public class SysCategoryServiceImpl extends ServiceImpl<SysCategoryMapper, SysCa
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 递归 根据父id获取子节点id
|
* 递归 根据父id获取子节点id
|
||||||
*
|
|
||||||
* @param pidVal
|
* @param pidVal
|
||||||
* @param sb
|
* @param sb
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private StringBuffer getTreeChildIds(String pidVal, StringBuffer sb) {
|
private StringBuffer getTreeChildIds(String pidVal,StringBuffer sb){
|
||||||
LambdaQueryWrapper<SysCategory> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<SysCategory> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
queryWrapper.eq(SysCategory::getPid, pidVal);
|
queryWrapper.eq(SysCategory::getPid,pidVal);
|
||||||
List<SysCategory> dataList = baseMapper.selectList(queryWrapper);
|
List<SysCategory> dataList = baseMapper.selectList(queryWrapper);
|
||||||
if (dataList != null && dataList.size() > 0) {
|
if(dataList != null && dataList.size()>0){
|
||||||
for (SysCategory category : dataList) {
|
for(SysCategory category : dataList) {
|
||||||
if (!sb.toString().contains(category.getId())) {
|
if(!sb.toString().contains(category.getId())){
|
||||||
sb.append(",").append(category.getId());
|
sb.append(",").append(category.getId());
|
||||||
}
|
}
|
||||||
this.getTreeChildIds(category.getId(), sb);
|
this.getTreeChildIds(category.getId(), sb);
|
||||||
|
|
|
@ -26,7 +26,7 @@ public class DictMQListener {
|
||||||
bindings = @QueueBinding(
|
bindings = @QueueBinding(
|
||||||
value = @Queue(name = "sysdict.async.result", durable = "true"),
|
value = @Queue(name = "sysdict.async.result", durable = "true"),
|
||||||
exchange = @Exchange(name = "hldy.sysdict", type = ExchangeTypes.DIRECT),
|
exchange = @Exchange(name = "hldy.sysdict", type = ExchangeTypes.DIRECT),
|
||||||
key = "sysdict.async.result"
|
key = "sysconfig.async.result"
|
||||||
),
|
),
|
||||||
errorHandler = "dictMQErrorHandler"
|
errorHandler = "dictMQErrorHandler"
|
||||||
)
|
)
|
||||||
|
|
|
@ -248,8 +248,6 @@ jeecg:
|
||||||
pc: http://localhost:3100
|
pc: http://localhost:3100
|
||||||
app: http://localhost:8051
|
app: http://localhost:8051
|
||||||
path:
|
path:
|
||||||
#服务指令上传目录
|
|
||||||
directivepath: /opt/upFiles/directive
|
|
||||||
#文件上传根目录 设置
|
#文件上传根目录 设置
|
||||||
upload: /opt/upFiles
|
upload: /opt/upFiles
|
||||||
#webapp文件路径
|
#webapp文件路径
|
||||||
|
@ -364,16 +362,6 @@ justauth:
|
||||||
prefix: 'demo::'
|
prefix: 'demo::'
|
||||||
timeout: 1h
|
timeout: 1h
|
||||||
|
|
||||||
#zmy
|
|
||||||
aliyun:
|
|
||||||
ocr:
|
|
||||||
# accessKeyId: LTAI5tMoCTt4sb9VQrcnZFsb
|
|
||||||
# accessKeySecret: pQBMT6TlUWgRfvvDnOu0IKVYXCfKee
|
|
||||||
accessKeyId: LTAI5tJxmaqyXSG1T8Q6PSE9
|
|
||||||
accessKeySecret: baBJyQOvph6dVugiSnx3tsiEuJeMy3
|
|
||||||
#文件传输秘钥
|
|
||||||
downloadkey: hP2K9Z!WLuj"M#8,
|
|
||||||
|
|
||||||
# 微信
|
# 微信
|
||||||
wechat:
|
wechat:
|
||||||
appId: wx8fc3e4305d2fbf0b
|
appId: wx8fc3e4305d2fbf0b
|
||||||
|
|
|
@ -247,8 +247,6 @@ jeecg:
|
||||||
pc: http://localhost:3100
|
pc: http://localhost:3100
|
||||||
app: http://localhost:8051
|
app: http://localhost:8051
|
||||||
path:
|
path:
|
||||||
#服务指令上传目录
|
|
||||||
directivepath: /opt/upFiles/directive
|
|
||||||
#文件上传根目录 设置
|
#文件上传根目录 设置
|
||||||
upload: /opt/nu/upFiles
|
upload: /opt/nu/upFiles
|
||||||
#webapp文件路径
|
#webapp文件路径
|
||||||
|
@ -363,14 +361,6 @@ justauth:
|
||||||
prefix: 'demo::'
|
prefix: 'demo::'
|
||||||
timeout: 1h
|
timeout: 1h
|
||||||
|
|
||||||
#zmy
|
|
||||||
aliyun:
|
|
||||||
ocr:
|
|
||||||
accessKeyId: LTAI5tMoCTt4sb9VQrcnZFsb
|
|
||||||
accessKeySecret: pQBMT6TlUWgRfvvDnOu0IKVYXCfKee
|
|
||||||
#文件传输秘钥
|
|
||||||
downloadkey: hP2K9Z!WLuj"M#8,
|
|
||||||
|
|
||||||
# 微信
|
# 微信
|
||||||
wechat:
|
wechat:
|
||||||
appId: wx8fc3e4305d2fbf0b
|
appId: wx8fc3e4305d2fbf0b
|
||||||
|
|
2
pom.xml
2
pom.xml
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<nursingunit.version>2.0.0</nursingunit.version>
|
<nursingunit.version>2.0.0</nursingunit.version>
|
||||||
<java.version>11</java.version>
|
<java.version>1.8</java.version>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
|
||||||
<!-- 微服务 -->
|
<!-- 微服务 -->
|
||||||
|
|
Loading…
Reference in New Issue