parent
050a9fa253
commit
87939fb555
|
@ -29,7 +29,7 @@ import java.util.Map;
|
|||
|
||||
/**
|
||||
* @Description: 咨询信息
|
||||
* @Author: jeecg-boot
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-04-07
|
||||
* @Version: V1.0
|
||||
*/
|
||||
|
|
|
@ -41,7 +41,7 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|||
|
||||
/**
|
||||
* @Description: 咨询信息
|
||||
* @Author: jeecg-boot
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-04-07
|
||||
* @Version: V1.0
|
||||
*/
|
||||
|
|
|
@ -20,7 +20,7 @@ import lombok.experimental.Accessors;
|
|||
|
||||
/**
|
||||
* @Description: 咨询信息
|
||||
* @Author: jeecg-boot
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-04-07
|
||||
* @Version: V1.0
|
||||
*/
|
||||
|
|
|
@ -8,7 +8,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|||
|
||||
/**
|
||||
* @Description: 咨询信息
|
||||
* @Author: jeecg-boot
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-04-07
|
||||
* @Version: V1.0
|
||||
*/
|
||||
|
|
|
@ -5,7 +5,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||
|
||||
/**
|
||||
* @Description: 咨询信息
|
||||
* @Author: jeecg-boot
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-04-07
|
||||
* @Version: V1.0
|
||||
*/
|
||||
|
|
|
@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||
|
||||
/**
|
||||
* @Description: 咨询信息
|
||||
* @Author: jeecg-boot
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-04-07
|
||||
* @Version: V1.0
|
||||
*/
|
||||
|
|
|
@ -23,7 +23,7 @@ import java.util.Arrays;
|
|||
|
||||
/**
|
||||
* @Description: app版本记录
|
||||
* @Author: jeecg-boot
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-04-07
|
||||
* @Version: V1.0
|
||||
*/
|
||||
|
|
|
@ -22,7 +22,7 @@ import lombok.experimental.Accessors;
|
|||
|
||||
/**
|
||||
* @Description: app版本记录
|
||||
* @Author: jeecg-boot
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-04-07
|
||||
* @Version: V1.0
|
||||
*/
|
||||
|
|
|
@ -6,7 +6,7 @@ import com.nu.modules.pad.appversionconfig.entity.AppConfig;
|
|||
|
||||
/**
|
||||
* @Description: app版本记录
|
||||
* @Author: jeecg-boot
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-04-07
|
||||
* @Version: V1.0
|
||||
*/
|
||||
|
|
|
@ -5,7 +5,7 @@ import com.nu.modules.appversionconfig.entity.AppVersionConfig;
|
|||
|
||||
/**
|
||||
* @Description: app版本记录
|
||||
* @Author: jeecg-boot
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-04-07
|
||||
* @Version: V1.0
|
||||
*/
|
||||
|
|
|
@ -12,7 +12,7 @@ import org.springframework.stereotype.Service;
|
|||
|
||||
/**
|
||||
* @Description: app版本记录
|
||||
* @Author: jeecg-boot
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-04-07
|
||||
* @Version: V1.0
|
||||
*/
|
||||
|
|
|
@ -8,7 +8,7 @@ import org.springframework.stereotype.Service;
|
|||
|
||||
/**
|
||||
* @Description: app版本记录
|
||||
* @Author: jeecg-boot
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-04-07
|
||||
* @Version: V1.0
|
||||
*/
|
||||
|
|
|
@ -0,0 +1,167 @@
|
|||
package com.nu.modules.sysconfig.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.nu.modules.sysconfig.entity.SysConfig;
|
||||
import com.nu.modules.sysconfig.service.ISysConfigService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* @Description: 系统参数配置
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-05-09
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags="系统参数配置")
|
||||
@RestController
|
||||
@RequestMapping("/sysconfig/sysConfig")
|
||||
@Slf4j
|
||||
public class SysConfigController extends JeecgController<SysConfig, ISysConfigService> {
|
||||
@Autowired
|
||||
private ISysConfigService sysConfigService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param sysConfig
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "系统参数配置-分页列表查询")
|
||||
@ApiOperation(value="系统参数配置-分页列表查询", notes="系统参数配置-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<SysConfig>> queryPageList(SysConfig sysConfig,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<SysConfig> queryWrapper = QueryGenerator.initQueryWrapper(sysConfig, req.getParameterMap());
|
||||
Page<SysConfig> page = new Page<SysConfig>(pageNo, pageSize);
|
||||
IPage<SysConfig> pageList = sysConfigService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param sysConfig
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "系统参数配置-添加")
|
||||
@ApiOperation(value="系统参数配置-添加", notes="系统参数配置-添加")
|
||||
@RequiresPermissions("sysconfig:nu_sys_config:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody SysConfig sysConfig) {
|
||||
sysConfigService.save(sysConfig);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param sysConfig
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "系统参数配置-编辑")
|
||||
@ApiOperation(value="系统参数配置-编辑", notes="系统参数配置-编辑")
|
||||
@RequiresPermissions("sysconfig:nu_sys_config:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody SysConfig sysConfig) {
|
||||
sysConfigService.updateById(sysConfig);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "系统参数配置-通过id删除")
|
||||
@ApiOperation(value="系统参数配置-通过id删除", notes="系统参数配置-通过id删除")
|
||||
@RequiresPermissions("sysconfig:nu_sys_config:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
||||
sysConfigService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "系统参数配置-批量删除")
|
||||
@ApiOperation(value="系统参数配置-批量删除", notes="系统参数配置-批量删除")
|
||||
@RequiresPermissions("sysconfig:nu_sys_config:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
this.sysConfigService.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<SysConfig> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
SysConfig sysConfig = sysConfigService.getById(id);
|
||||
if(sysConfig==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(sysConfig);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param sysConfig
|
||||
*/
|
||||
@RequiresPermissions("sysconfig:nu_sys_config:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, SysConfig sysConfig) {
|
||||
return super.exportXls(request, sysConfig, SysConfig.class, "系统参数配置");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("sysconfig:nu_sys_config:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, SysConfig.class);
|
||||
}
|
||||
|
||||
@PostMapping("/async")
|
||||
public Result<String> async(@RequestBody SysConfig sysDict){
|
||||
sysConfigService.async(sysDict);
|
||||
return Result.ok();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,84 @@
|
|||
package com.nu.modules.sysconfig.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.Date;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
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: 张明远
|
||||
* @Date: 2025-05-09
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("nu_sys_config")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="nu_sys_config对象", description="系统参数配置")
|
||||
public class SysConfig implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**id*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "id")
|
||||
private java.lang.String id;
|
||||
/**参数名称*/
|
||||
@Excel(name = "参数名称", width = 15)
|
||||
@ApiModelProperty(value = "参数名称")
|
||||
private java.lang.String name;
|
||||
/**键名*/
|
||||
@Excel(name = "键名", width = 15)
|
||||
@ApiModelProperty(value = "键名")
|
||||
private java.lang.String configKey;
|
||||
/**键值*/
|
||||
@Excel(name = "键值", width = 15)
|
||||
@ApiModelProperty(value = "键值")
|
||||
private java.lang.String configValue;
|
||||
/**备注*/
|
||||
@Excel(name = "备注", width = 15)
|
||||
@ApiModelProperty(value = "备注")
|
||||
private java.lang.String descr;
|
||||
/**是否启用 0启用 1未启用*/
|
||||
@Excel(name = "是否启用", width = 15)
|
||||
@ApiModelProperty(value = "是否启用 0启用 1未启用")
|
||||
@Dict(dicCode = "iz_enabled")
|
||||
private java.lang.String izEnabled;
|
||||
/**是否删除 0未删除 1删除*/
|
||||
@Excel(name = "是否删除 0未删除 1删除", width = 15)
|
||||
@ApiModelProperty(value = "是否删除 0未删除 1删除")
|
||||
@TableLogic
|
||||
private java.lang.String delFlag;
|
||||
/**创建人*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
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 = "创建日期")
|
||||
private java.util.Date createTime;
|
||||
/**更新人*/
|
||||
@ApiModelProperty(value = "更新人")
|
||||
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 = "更新日期")
|
||||
private java.util.Date updateTime;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String orgCode;
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package com.nu.modules.sysconfig.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.nu.modules.sysconfig.entity.SysConfig;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @Description: 系统参数配置
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-05-09
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface SysConfigMapper extends BaseMapper<SysConfig> {
|
||||
|
||||
}
|
|
@ -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.sysconfig.mapper.SysConfigMapper">
|
||||
|
||||
</mapper>
|
|
@ -0,0 +1,15 @@
|
|||
package com.nu.modules.sysconfig.service;
|
||||
|
||||
import com.nu.modules.sysconfig.entity.SysConfig;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @Description: 系统参数配置
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-05-09
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface ISysConfigService extends IService<SysConfig> {
|
||||
|
||||
void async(SysConfig sysDict);
|
||||
}
|
|
@ -0,0 +1,83 @@
|
|||
package com.nu.modules.sysconfig.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.nu.dto.SysConfigMQDto;
|
||||
import com.nu.modules.async.entity.AsyncMain;
|
||||
import com.nu.modules.async.service.IAsyncMainService;
|
||||
import com.nu.modules.sysconfig.entity.SysConfig;
|
||||
import com.nu.modules.sysconfig.mapper.SysConfigMapper;
|
||||
import com.nu.modules.sysconfig.service.ISysConfigService;
|
||||
import com.nu.utils.RabbitMQUtil;
|
||||
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 java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 系统参数配置
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-05-09
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class SysConfigServiceImpl extends ServiceImpl<SysConfigMapper, SysConfig> implements ISysConfigService {
|
||||
|
||||
@Autowired
|
||||
private IAsyncMainService asyncMainService;
|
||||
@Autowired
|
||||
private RabbitMQUtil rabbitMQUtil;
|
||||
@Autowired
|
||||
private ISysBaseAPI sysBaseAPI;
|
||||
|
||||
@Override
|
||||
public void async(SysConfig sysConfig) {
|
||||
|
||||
List<JSONObject> depts = sysBaseAPI.queryOpeDept();
|
||||
if (StringUtils.isNotBlank(sysConfig.getOrgCode())) {
|
||||
depts.removeIf(dept -> !sysConfig.getOrgCode().equals(dept.getString("code")));
|
||||
}
|
||||
|
||||
List<AsyncMain> ams = Lists.newArrayList();
|
||||
List<String> orgCodes = Lists.newArrayList();
|
||||
if (depts != null && !depts.isEmpty()) {
|
||||
depts.forEach(dept -> {
|
||||
AsyncMain asyncMain = new AsyncMain();
|
||||
asyncMain.setPrimaryKey(sysConfig.getId());
|
||||
asyncMain.setStatus("100");
|
||||
asyncMain.setOrgCode(dept.getString("code"));
|
||||
asyncMain.setOrgName(dept.getString("name"));
|
||||
asyncMain.setType("sys_config");
|
||||
asyncMain.setDescr("同步中(如果同步时间过久,请检查该业务系统是否正确配置机构编码)");
|
||||
ams.add(asyncMain);
|
||||
orgCodes.add(dept.getString("code"));
|
||||
});
|
||||
}
|
||||
|
||||
QueryWrapper<AsyncMain> asyncMainQueryWrapper = new QueryWrapper<>();
|
||||
asyncMainQueryWrapper.eq("primary_key", sysConfig.getId());
|
||||
if (StringUtils.isNotBlank(sysConfig.getOrgCode())) {
|
||||
asyncMainQueryWrapper.eq("org_code", sysConfig.getOrgCode());
|
||||
} else {
|
||||
asyncMainQueryWrapper.in("org_code", orgCodes);
|
||||
}
|
||||
asyncMainService.remove(asyncMainQueryWrapper);
|
||||
asyncMainService.saveBatch(ams);
|
||||
|
||||
|
||||
SysConfig sc = baseMapper.selectById(sysConfig.getId());
|
||||
SysConfigMQDto sysConfigMQDto = new SysConfigMQDto();
|
||||
BeanUtils.copyProperties(sc, sysConfigMQDto);
|
||||
|
||||
if (StringUtils.isNotBlank(sysConfig.getOrgCode())) {
|
||||
rabbitMQUtil.sendToExchange("hldy.sysconfig.direct", sysConfig.getOrgCode() + ".sysconfig.async", sysConfigMQDto);
|
||||
} else {
|
||||
rabbitMQUtil.sendToExchange("hldy.sysconfig.fanout", "", sysConfigMQDto);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package com.nu.mq.sysconfig.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("sysConfigMQErrorHandler")
|
||||
public class SysConfigMQExceptionHandler 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);
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
package com.nu.mq.sysconfig.listener;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.nu.dto.StatusMQDto;
|
||||
import com.nu.modules.async.entity.AsyncMain;
|
||||
import com.nu.modules.async.service.IAsyncMainService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
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.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class SysConfigMQListener {
|
||||
|
||||
@Autowired
|
||||
private IAsyncMainService asyncMainService;
|
||||
|
||||
@RabbitListener(
|
||||
bindings = @QueueBinding(
|
||||
value = @Queue(name = "sysconfig.async.result", durable = "true"),
|
||||
exchange = @Exchange(name = "hldy.sysconfig", type = ExchangeTypes.DIRECT),
|
||||
key = "sysconfig.async.result"
|
||||
),
|
||||
errorHandler = "sysConfigMQErrorHandler"
|
||||
)
|
||||
public void handleMessage(StatusMQDto dto) {
|
||||
AsyncMain asyncMain = new AsyncMain();
|
||||
asyncMain.setPrimaryKey(dto.getPrimaryKey());
|
||||
asyncMain.setStatus(dto.getStatus() + "");
|
||||
asyncMain.setOrgCode(dto.getOrgCode());
|
||||
asyncMain.setOrgName(dto.getOrgName());
|
||||
asyncMain.setDescr(dto.getMessage());
|
||||
|
||||
QueryWrapper<AsyncMain> qw = new QueryWrapper<>();
|
||||
qw.eq("primary_key",asyncMain.getPrimaryKey());
|
||||
qw.eq("org_code",asyncMain.getOrgCode());
|
||||
qw.eq("type","sys_config");
|
||||
asyncMainService.update(asyncMain,qw);
|
||||
}
|
||||
|
||||
}
|
|
@ -14,8 +14,7 @@ public class StatusMQDto {
|
|||
//同步表子表code
|
||||
private String code;
|
||||
|
||||
private String dictId;
|
||||
private String primaryKey;
|
||||
private String orgCode;
|
||||
private String orgName;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
package com.nu.dto;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Description: 系统参数配置
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-05-09
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
public class SysConfigMQDto implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**id*/
|
||||
private String id;
|
||||
/**参数名称*/
|
||||
private String name;
|
||||
/**键名*/
|
||||
private String configKey;
|
||||
/**键值*/
|
||||
private String configValue;
|
||||
/**备注*/
|
||||
private String descr;
|
||||
/**是否启用 0启用 1未启用*/
|
||||
private String izEnabled;
|
||||
/**是否删除 0未删除 1删除*/
|
||||
private String delFlag;
|
||||
/**创建人*/
|
||||
private String createBy;
|
||||
/**创建日期*/
|
||||
private Date createTime;
|
||||
/**更新人*/
|
||||
private String updateBy;
|
||||
/**更新日期*/
|
||||
private Date updateTime;
|
||||
|
||||
private String orgCode;
|
||||
}
|
|
@ -47,6 +47,7 @@ public class AsyncMainServiceImpl extends ServiceImpl<AsyncMainMapper, AsyncMain
|
|||
QueryWrapper<AsyncMain> asyncMainQueryWrapper = new QueryWrapper<>();
|
||||
asyncMainQueryWrapper.eq("primary_key", am.getPrimaryKey());
|
||||
asyncMainQueryWrapper.orderByAsc("org_code");
|
||||
asyncMainQueryWrapper.eq("type",am.getType());
|
||||
List<AsyncMain> asyncMains = baseMapper.selectList(asyncMainQueryWrapper);
|
||||
if (asyncMains != null && !asyncMains.isEmpty()) {
|
||||
asyncMains.stream().forEach(a -> {
|
||||
|
|
|
@ -89,12 +89,18 @@ public class ConfigServiceDirectiveController extends JeecgController<ConfigServ
|
|||
directiveIds = configServiceDirectiveService.queryDirectiveIdByBodyTagIds(configServiceDirective.getBodyTags());
|
||||
if (directiveIds != null && !directiveIds.isEmpty()) {
|
||||
queryWrapper.in("id", directiveIds.stream().map(ConfigServiceDirective::getId).collect(Collectors.toList()));
|
||||
} else {
|
||||
//体重标签下没有数据
|
||||
queryWrapper.eq("id", "null");
|
||||
}
|
||||
}
|
||||
if (StringUtils.isNotBlank(configServiceDirective.getEmotionTags())) {
|
||||
directiveIds = configServiceDirectiveService.queryDirectiveIdByEmotionTagIds(configServiceDirective.getEmotionTags());
|
||||
if (directiveIds != null && !directiveIds.isEmpty()) {
|
||||
queryWrapper.in("id", directiveIds.stream().map(ConfigServiceDirective::getId).collect(Collectors.toList()));
|
||||
} else {
|
||||
//情绪标签下没有数据
|
||||
queryWrapper.eq("id", "null");
|
||||
}
|
||||
}
|
||||
Page<ConfigServiceDirective> page = new Page<ConfigServiceDirective>(pageNo, pageSize);
|
||||
|
|
|
@ -929,6 +929,7 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
|||
asyncMain.setStatus("100");
|
||||
asyncMain.setOrgCode(d.getOrgCode());
|
||||
asyncMain.setOrgName(d.getDepartName());
|
||||
asyncMain.setType("sys_dict");
|
||||
asyncMain.setDescr("同步中(如果同步时间过久,请检查该业务系统是否正确配置机构编码)");
|
||||
ams.add(asyncMain);
|
||||
orgCodes.add(d.getOrgCode());
|
||||
|
|
|
@ -5,6 +5,10 @@ import com.nu.dto.StatusMQDto;
|
|||
import com.nu.modules.async.entity.AsyncMain;
|
||||
import com.nu.modules.async.service.IAsyncMainService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
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.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
@ -18,10 +22,17 @@ public class DictMQListener {
|
|||
@Autowired
|
||||
private IAsyncMainService asyncMainService;
|
||||
|
||||
@RabbitListener(queues = "sysdict.async.result", errorHandler = "dictMQErrorHandler")
|
||||
@RabbitListener(
|
||||
bindings = @QueueBinding(
|
||||
value = @Queue(name = "sysdict.async.result", durable = "true"),
|
||||
exchange = @Exchange(name = "hldy.sysdict", type = ExchangeTypes.DIRECT),
|
||||
key = "sysconfig.async.result"
|
||||
),
|
||||
errorHandler = "dictMQErrorHandler"
|
||||
)
|
||||
public void handleMessage(StatusMQDto dto) {
|
||||
AsyncMain asyncMain = new AsyncMain();
|
||||
asyncMain.setPrimaryKey(dto.getDictId());
|
||||
asyncMain.setPrimaryKey(dto.getPrimaryKey());
|
||||
asyncMain.setStatus(dto.getStatus() + "");
|
||||
asyncMain.setOrgCode(dto.getOrgCode());
|
||||
asyncMain.setOrgName(dto.getOrgName());
|
||||
|
@ -30,6 +41,7 @@ public class DictMQListener {
|
|||
QueryWrapper<AsyncMain> qw = new QueryWrapper<>();
|
||||
qw.eq("primary_key",asyncMain.getPrimaryKey());
|
||||
qw.eq("org_code",asyncMain.getOrgCode());
|
||||
qw.eq("type","sys_dict");
|
||||
asyncMainService.update(asyncMain,qw);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue