Compare commits

...

3 Commits

Author SHA1 Message Date
1378012178@qq.com 7d25e18967 Merge branch 'master' of http://47.115.223.229:8888/yangjun/hldy_java_monomer 2025-05-30 16:47:42 +08:00
1378012178@qq.com 7161b4307e Merge branch 'master' of http://47.115.223.229:8888/yangjun/hldy_java_monomer
# Conflicts:
#	nursing-unit-system/nu-system-start/src/main/resources/application-dev.yml
#	nursing-unit-system/nu-system-start/src/main/resources/application-uat.yml
2025-05-30 16:47:34 +08:00
1378012178@qq.com 6841a8f56f 服务指令文件同步 2025-05-27 14:14:46 +08:00
39 changed files with 2757 additions and 873 deletions

View File

@ -9,5 +9,11 @@
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>nu-admin-local-api</artifactId>
<dependencies>
<dependency>
<groupId>com.nursingunit.boot</groupId>
<artifactId>nursing-unit-common</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,20 @@
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);
}

View File

@ -144,4 +144,6 @@ public class H5ApiAdvisoryInfoController extends JeecgController<NuBizAdvisoryIn
nuBizAdvisoryInfoService.update(updateWrapper);
return Result.OK("编辑成功!");
}
}

View File

@ -0,0 +1,180 @@
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);
}
}

View File

@ -0,0 +1,53 @@
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;
}

View File

@ -0,0 +1,17 @@
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> {
}

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.nu.modules.mediaasyncerrorlog.mapper.MediaAsyncErrorLogMapper">
</mapper>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.nu.modules.mediaasyncerrorlog.mapper.NuMediaAsyncErrorLogMapper">
</mapper>

View File

@ -0,0 +1,14 @@
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> {
}

View File

@ -0,0 +1,19 @@
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 {
}

View File

@ -0,0 +1,180 @@
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);
}
}

View File

@ -0,0 +1,126 @@
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;
}

View File

@ -0,0 +1,17 @@
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> {
}

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.nu.modules.mediamanage.mapper.MediaManageMapper">
</mapper>

View File

@ -0,0 +1,14 @@
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> {
}

View File

@ -0,0 +1,70 @@
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);
}
}
}

View File

@ -0,0 +1,28 @@
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);
// }
}
}

View File

@ -0,0 +1,184 @@
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();
}
}
}

View File

@ -17,5 +17,9 @@
<artifactId>nursing-unit-base-core</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>com.nursingunit.boot</groupId>
<artifactId>nursing-unit-common</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,118 @@
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();
}
}
}

View File

@ -119,6 +119,7 @@ public class ShiroConfig {
filterChainDefinitionMap.put("/sys/checkAuth", "anon"); //授权接口排除
filterChainDefinitionMap.put("/api/pad/versionUpdate", "anon");//pad端版本检测接口
filterChainDefinitionMap.put("/nuIpadApi/versionManage/versionUpdate", "anon");//pad端版本检测接口
filterChainDefinitionMap.put("/api/ocr/**", "anon");//阿里云证件识别
//update-begin--Author:scott Date:20221116 for排除静态资源后缀
filterChainDefinitionMap.put("/", "anon");

View File

@ -22,6 +22,24 @@
<artifactId>nu-system-local-api</artifactId>
<version>2.0.0</version>
</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>
</project>

View File

@ -0,0 +1,44 @@
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;
}

View File

@ -0,0 +1,117 @@
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());
}
}

View File

@ -0,0 +1,83 @@
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;
}
}

View File

@ -0,0 +1,166 @@
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;
}
}
}

View File

@ -0,0 +1,126 @@
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();
}
/**
* 计算字符串的 MD532位小写
*/
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);
}
}

View File

@ -58,6 +58,7 @@ public class SysCategoryController {
/**
* 分页列表查询
*
* @param sysCategory
* @param pageNo
* @param pageSize
@ -69,9 +70,6 @@ public class SysCategoryController {
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
if(oConvertUtils.isEmpty(sysCategory.getPid())){
sysCategory.setPid("0");
}
Result<IPage<SysCategory>> result = new Result<IPage<SysCategory>>();
//------------------------------------------------------------------------------------------------
//是否开启系统管理模块的多租户数据隔离SAAS多租户模式
@ -87,7 +85,7 @@ public class SysCategoryController {
String code = sysCategory.getCode();
//QueryWrapper<SysCategory> queryWrapper = new QueryWrapper<SysCategory>();
if (StringUtils.isBlank(name) && StringUtils.isBlank(code)) {
queryWrapper.eq("pid", sysCategory.getPid());
queryWrapper.eq("pid","0");
}
//--author:liusq---date:20211119 -----for: 分类字典页面查询条件配置--------end
//--author:os_chengtgen---date:20190804 -----for:vue3 分类字典页面显示错误,issues:377--------end
@ -109,6 +107,7 @@ public class SysCategoryController {
//------------------------------------------------------------------------------------------------
Result<List<SysCategory>> result = new Result<List<SysCategory>>();
QueryWrapper<SysCategory> queryWrapper = QueryGenerator.initQueryWrapper(sysCategory, req.getParameterMap());
queryWrapper.orderByAsc("code");
List<SysCategory> list = sysCategoryService.list(queryWrapper);
result.setSuccess(true);
result.setResult(list);
@ -118,6 +117,7 @@ public class SysCategoryController {
/**
* 添加
*
* @param sysCategory
* @return
*/
@ -129,13 +129,14 @@ public class SysCategoryController {
result.success("添加成功!");
} catch (Exception e) {
log.error(e.getMessage(), e);
result.error500("操作失败");
result.error500("编码重复!");
}
return result;
}
/**
* 编辑
*
* @param sysCategory
* @return
*/
@ -144,7 +145,7 @@ public class SysCategoryController {
Result<SysCategory> result = new Result<SysCategory>();
SysCategory sysCategoryEntity = sysCategoryService.getById(sysCategory.getId());
if (sysCategoryEntity == null) {
result.error500("未找到对应实体");
result.error500("编码重复!");
} else {
sysCategoryService.updateSysCategory(sysCategory);
result.success("修改成功!");
@ -154,6 +155,7 @@ public class SysCategoryController {
/**
* 通过id删除
*
* @param id
* @return
*/
@ -173,6 +175,7 @@ public class SysCategoryController {
/**
* 批量删除
*
* @param ids
* @return
*/
@ -190,6 +193,7 @@ public class SysCategoryController {
/**
* 通过id查询
*
* @param id
* @return
*/
@ -313,7 +317,6 @@ public class SysCategoryController {
}
/**
* 加载单个数据 用于回显
*/
@ -375,7 +378,10 @@ public class SysCategoryController {
try {
List<TreeSelectModel> ls = this.sysCategoryService.queryListByCode(pcode);
if (!async) {
loadAllCategoryChildren(ls);
//框架自带傻逼for循环套sql 慎用 慢到想骂人 实测几百个非叶节点就已经爆炸了
// loadAllCategoryChildren(ls);
//一次sql查所有系统代码处理循环生成树结构
loadAllCategoryChildrenQO(ls);
}
result.setResult(ls);
result.setSuccess(true);
@ -400,8 +406,46 @@ public class SysCategoryController {
}
}
/**
* 只查询一次数据库代码内容循环处理避免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 code
* @return
@ -426,6 +470,7 @@ public class SysCategoryController {
/**
* 分类字典树控件 加载节点
*
* @param pid
* @param pcode
* @param condition
@ -488,6 +533,7 @@ public class SysCategoryController {
/**
* [列表页面]加载分类字典数据 用于值的替换
*
* @param code
* @return
*/
@ -515,6 +561,7 @@ public class SysCategoryController {
/**
* 根据父级id批量查询子节点
*
* @param parentIds
* @return
*/

View File

@ -1,6 +1,7 @@
package org.jeecg.modules.system.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
@ -9,6 +10,7 @@ import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.List;
/**
* @Description: 分类字典
@ -21,38 +23,66 @@ import java.io.Serializable;
public class SysCategory implements Serializable, Comparable<SysCategory> {
private static final long serialVersionUID = 1L;
/**主键*/
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
private java.lang.String id;
/**父级节点*/
/**
* 父级节点
*/
private java.lang.String pid;
/**类型名称*/
/**
* 类型名称
*/
@Excel(name = "类型名称", width = 15)
private java.lang.String name;
/**类型编码*/
/**
* 类型编码
*/
@Excel(name = "类型编码", width = 15)
private java.lang.String code;
/**创建人*/
/**
* 创建人
*/
private java.lang.String createBy;
/**创建日期*/
/**
* 创建日期
*/
@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.lang.String updateBy;
/**更新日期*/
/**
* 更新日期
*/
@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.lang.String sysOrgCode;
/**是否有子节点*/
/**
* 是否有子节点
*/
@Excel(name = "是否有子节点(1:有)", width = 15)
private java.lang.String hasChild;
/**租户ID*/
/**
* 租户ID
*/
private java.lang.Integer tenantId;
/**
* 子节点列表 - 非数据库字段
*/
@TableField(exist = false)
private List<SysCategory> children;
@Override
public int compareTo(SysCategory o) {
//比较条件我们定的是按照code的长度升序
@ -62,8 +92,17 @@ public class SysCategory implements Serializable,Comparable<SysCategory>{
int s = this.code.length() - o.code.length();
return s;
}
@Override
public String toString() {
return "SysCategory [code=" + code + ", name=" + name + "]";
}
public List<SysCategory> getChildren() {
return children;
}
public void setChildren(List<SysCategory> children) {
this.children = children;
}
}

View File

@ -27,103 +27,184 @@ import java.util.Objects;
public class SysDepart implements Serializable {
private static final long serialVersionUID = 1L;
/**ID*/
/**
* ID
*/
@TableId(type = IdType.ASSIGN_ID)
private String id;
/**父机构ID*/
/**
* 父机构ID
*/
private String parentId;
/**机构/部门名称*/
/**
* 机构/部门名称
*/
@Excel(name = "机构/部门名称", width = 15)
private String departName;
/**英文名*/
/**
* 英文名
*/
@Excel(name = "英文名", width = 15)
private String departNameEn;
/**缩写*/
/**
* 缩写
*/
private String departNameAbbr;
/**排序*/
/**
* 排序
*/
@Excel(name = "排序", width = 15)
private Integer departOrder;
/**描述*/
/**
* 描述
*/
@Excel(name = "描述", width = 15)
private String description;
/**机构类别 1=公司2=组织机构3=岗位*/
/**
* 机构类别 1=公司2=组织机构3=岗位
*/
@Excel(name = "机构类别", width = 15, dicCode = "org_category")
private String orgCategory;
/**机构类型*/
/**
* 机构类型
*/
private String orgType;
/**机构编码*/
/**
* 机构编码
*/
@Excel(name = "机构编码", width = 15)
private String orgCode;
/**业务平台类型*/
/**
* 省份
*/
@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")
private String platType;
/**运营开始时间*/
/**
* 运营开始时间
*/
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date operationStartTime;
/**运营到期时间*/
/**
* 运营到期时间
*/
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date operationEndTime;
/**合同开始时间*/
/**
* 合同开始时间
*/
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date contractStartTime;
/**合同到期时间*/
/**
* 合同到期时间
*/
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date contractEndTime;
/**手机号*/
/**
* 手机号
*/
@Excel(name = "手机号", width = 15)
private String mobile;
/**传真*/
/**
* 传真
*/
@Excel(name = "传真", width = 15)
private String fax;
/**地址*/
/**
* 地址
*/
@Excel(name = "地址", width = 15)
private String address;
/**备注*/
/**
* 备注
*/
@Excel(name = "备注", width = 15)
private String memo;
/**状态1启用0不启用*/
/**
* 状态1启用0不启用
*/
@Dict(dicCode = "depart_status")
private String status;
/**删除状态0正常1已删除*/
/**
* 删除状态0正常1已删除
*/
@Dict(dicCode = "del_flag")
private String delFlag;
/**对接企业微信的ID*/
/**
* 对接企业微信的ID
*/
private String qywxIdentifier;
/**对接钉钉的部门ID*/
/**
* 对接钉钉的部门ID
*/
private String dingIdentifier;
/**创建人*/
/**
* 创建人
*/
private String createBy;
/**创建日期*/
/**
* 创建日期
*/
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
/**更新人*/
/**
* 更新人
*/
private String updateBy;
/**更新日期*/
/**
* 更新日期
*/
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
/**租户ID*/
/**
* 租户ID
*/
private java.lang.Integer tenantId;
/**是否有叶子节点: 1是0否*/
/**
* 是否有叶子节点: 1是0否
*/
private Integer izLeaf;
/**各机构服务器后台接口地址*/
/**
* 各机构服务器后台接口地址
*/
private String serverUrl;
/**各机构服务器后台接口地址*/
/**
* 各机构服务器后台接口地址
*/
private String picUrl;
//update-begin---author:wangshuai ---date:20200308 for[JTC-119]在部门管理菜单下设置部门负责人新增字段负责人ids和旧的负责人ids
/**部门负责人的ids*/
/**
* 部门负责人的ids
*/
@TableField(exist = false)
private String directorUserIds;
/**旧的部门负责人的ids(用于比较删除和新增)*/
/**
* 旧的部门负责人的ids(用于比较删除和新增)
*/
@TableField(exist = false)
private String oldDirectorUserIds;
//update-end---author:wangshuai ---date:20200308 for[JTC-119]新增字段负责人ids和旧的负责人ids
@ -153,6 +234,9 @@ public class SysDepart implements Serializable {
Objects.equals(orgCategory, depart.orgCategory) &&
Objects.equals(orgType, depart.orgType) &&
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(fax, depart.fax) &&
Objects.equals(address, depart.address) &&
@ -173,7 +257,7 @@ public class SysDepart implements Serializable {
public int hashCode() {
return Objects.hash(super.hashCode(), id, parentId, departName,
departNameEn, departNameAbbr, departOrder, description, orgCategory,
orgType, orgCode, mobile, fax, address, memo, status,
orgType, orgCode, province, city, district, mobile, fax, address, memo, status,
delFlag, createBy, createTime, updateBy, updateTime, tenantId);
}
}

View File

@ -48,4 +48,6 @@ public interface SysCategoryMapper extends BaseMapper<SysCategory> {
@InterceptorIgnore(tenantLine = "true")
@Select("SELECT code FROM sys_category WHERE ID = #{id}")
SysCategory selectSysCategoryById(@Param("id") String id);
List<TreeSelectModel> queryAllCategories();
}

View File

@ -32,6 +32,15 @@
</if>
</if>
</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>

View File

@ -22,13 +22,19 @@ public class SysDepartTreeModel implements Serializable{
private static final long serialVersionUID = 1L;
/** 对应SysDepart中的id字段,前端数据树中的key*/
/**
* 对应SysDepart中的id字段,前端数据树中的key
*/
private String key;
/** 对应SysDepart中的id字段,前端数据树中的value*/
/**
* 对应SysDepart中的id字段,前端数据树中的value
*/
private String value;
/** 对应depart_name字段,前端数据树中的title*/
/**
* 对应depart_name字段,前端数据树中的title
*/
private String title;
@ -57,6 +63,12 @@ public class SysDepartTreeModel implements Serializable{
private String orgCode;
private String province;
private String city;
private String district;
private Date operationStartTime;
private Date operationEndTime;
@ -90,7 +102,9 @@ public class SysDepartTreeModel implements Serializable{
private String picUrl;
//update-begin---author:wangshuai ---date:20200308 for[JTC-119]在部门管理菜单下设置部门负责人新增字段部门负责人ids
/**部门负责人ids*/
/**
* 部门负责人ids
*/
private String directorUserIds;
//update-end---author:wangshuai ---date:20200308 for[JTC-119]在部门管理菜单下设置部门负责人新增字段部门负责人ids
@ -99,6 +113,7 @@ public class SysDepartTreeModel implements Serializable{
/**
* 将SysDepart对象转换成SysDepartTreeModel对象
*
* @param sysDepart
*/
public SysDepartTreeModel(SysDepart sysDepart) {
@ -116,6 +131,9 @@ public class SysDepartTreeModel implements Serializable{
this.orgCategory = sysDepart.getOrgCategory();
this.orgType = sysDepart.getOrgType();
this.orgCode = sysDepart.getOrgCode();
this.province = sysDepart.getProvince();
this.city = sysDepart.getCity();
this.district = sysDepart.getDistrict();
this.operationStartTime = sysDepart.getOperationStartTime();
this.operationEndTime = sysDepart.getOperationEndTime();
this.contractStartTime = sysDepart.getContractStartTime();
@ -401,7 +419,8 @@ public class SysDepartTreeModel implements Serializable{
this.updateTime = updateTime;
}
public SysDepartTreeModel() { }
public SysDepartTreeModel() {
}
public String getDirectorUserIds() {
return directorUserIds;
@ -419,6 +438,30 @@ public class SysDepartTreeModel implements Serializable{
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方法
*/
@ -442,6 +485,9 @@ public class SysDepartTreeModel implements Serializable{
Objects.equals(orgCategory, model.orgCategory) &&
Objects.equals(orgType, model.orgType) &&
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(operationEndTime, model.operationEndTime) &&
Objects.equals(contractStartTime, model.contractStartTime) &&
@ -468,7 +514,7 @@ public class SysDepartTreeModel implements Serializable{
public int hashCode() {
return Objects.hash(id, parentId, platType, departName, departNameEn, departNameAbbr,
departOrder, description, orgCategory, orgType, orgCode,
departOrder, description, orgCategory, orgType, orgCode, province, city, district,
operationStartTime, operationEndTime, contractStartTime, contractEndTime,
mobile, fax, address, memo, status, delFlag, qywxIdentifier,
createBy, createTime, updateBy, updateTime, children, directorUserIds);

View File

@ -51,6 +51,8 @@ public interface ISysCategoryService extends IService<SysCategory> {
*/
public List<TreeSelectModel> queryListByPid(String pid);
public List<TreeSelectModel> queryAllCategories();
/**
* 根据pid查询子节点集合,支持查询条件
* @param pid

View File

@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
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.SymbolConstant;
import org.jeecg.common.exception.JeecgBootException;
@ -52,7 +53,9 @@ public class SysCategoryServiceImpl extends ServiceImpl<SysCategoryMapper, SysCa
formData.put("pid", categoryPid);
categoryCode = (String) FillRuleUtil.executeRule(FillRuleConstant.CATEGORY, formData);
//update-end--Author:baihailong Date:20191209 for分类字典编码规则生成器做成公用配置
if (StringUtils.isBlank(sysCategory.getCode())) {
sysCategory.setCode(categoryCode);
}
sysCategory.setPid(categoryPid);
baseMapper.insert(sysCategory);
}
@ -96,6 +99,11 @@ public class SysCategoryServiceImpl extends ServiceImpl<SysCategoryMapper, SysCa
return baseMapper.queryListByPid(pid, null);
}
@Override
public List<TreeSelectModel> queryAllCategories() {
return baseMapper.queryAllCategories();
}
@Override
public List<TreeSelectModel> queryListByPid(String pid, Map<String, String> condition) {
if (oConvertUtils.isEmpty(pid)) {
@ -128,6 +136,7 @@ public class SysCategoryServiceImpl extends ServiceImpl<SysCategoryMapper, SysCa
/**
* 查询节点下所有子节点
*
* @param ids
* @return
*/
@ -151,6 +160,7 @@ public class SysCategoryServiceImpl extends ServiceImpl<SysCategoryMapper, SysCa
/**
* 查询需修改标识的父节点ids
*
* @param ids
* @return
*/
@ -184,6 +194,7 @@ public class SysCategoryServiceImpl extends ServiceImpl<SysCategoryMapper, SysCa
/**
* 递归 根据父id获取子节点id
*
* @param pidVal
* @param sb
* @return

View File

@ -26,7 +26,7 @@ public class DictMQListener {
bindings = @QueueBinding(
value = @Queue(name = "sysdict.async.result", durable = "true"),
exchange = @Exchange(name = "hldy.sysdict", type = ExchangeTypes.DIRECT),
key = "sysconfig.async.result"
key = "sysdict.async.result"
),
errorHandler = "dictMQErrorHandler"
)

View File

@ -248,6 +248,8 @@ jeecg:
pc: http://localhost:3100
app: http://localhost:8051
path:
#服务指令上传目录
directivepath: /opt/upFiles/directive
#文件上传根目录 设置
upload: /opt/upFiles
#webapp文件路径
@ -362,6 +364,16 @@ justauth:
prefix: 'demo::'
timeout: 1h
#zmy
aliyun:
ocr:
# accessKeyId: LTAI5tMoCTt4sb9VQrcnZFsb
# accessKeySecret: pQBMT6TlUWgRfvvDnOu0IKVYXCfKee
accessKeyId: LTAI5tJxmaqyXSG1T8Q6PSE9
accessKeySecret: baBJyQOvph6dVugiSnx3tsiEuJeMy3
#文件传输秘钥
downloadkey: hP2K9Z!WLuj"M#8,
# 微信
wechat:
appId: wx8fc3e4305d2fbf0b

View File

@ -247,6 +247,8 @@ jeecg:
pc: http://localhost:3100
app: http://localhost:8051
path:
#服务指令上传目录
directivepath: /opt/upFiles/directive
#文件上传根目录 设置
upload: /opt/nu/upFiles
#webapp文件路径
@ -361,6 +363,14 @@ justauth:
prefix: 'demo::'
timeout: 1h
#zmy
aliyun:
ocr:
accessKeyId: LTAI5tMoCTt4sb9VQrcnZFsb
accessKeySecret: pQBMT6TlUWgRfvvDnOu0IKVYXCfKee
#文件传输秘钥
downloadkey: hP2K9Z!WLuj"M#8,
# 微信
wechat:
appId: wx8fc3e4305d2fbf0b

View File

@ -16,7 +16,7 @@
<properties>
<nursingunit.version>2.0.0</nursingunit.version>
<java.version>1.8</java.version>
<java.version>11</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- 微服务 -->