This commit is contained in:
yangjun 2025-08-25 15:02:21 +08:00
commit b2ca8786ad
48 changed files with 2267 additions and 67 deletions

View File

@ -0,0 +1,51 @@
package com.nu.modules.orgapplyinfo.controller;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.nu.modules.orgapplyinfo.entity.OrgAllInfo;
import com.nu.modules.orgapplyinfo.entity.OrgApplyInfo;
import com.nu.modules.orgapplyinfo.service.IOrgApplyInfoService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.base.controller.JeecgController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* @Description: 机构加盟申请信息表
* @Author: 张明远
* @Date: 2025-06-05
* @Version: V1.0
*/
@Api(tags = "机构加盟申请信息表")
@RestController
@RequestMapping("/admin/orgapplyinfo/orgApplyInfo")
@Slf4j
public class OrgApplyInfoController extends JeecgController<OrgApplyInfo, IOrgApplyInfoService> {
@Autowired
private IOrgApplyInfoService orgApplyInfoService;
/**
* 获取各机构详细信息
*
* @param orgCode 机构编码
* @return
*/
@GetMapping(value = "/getOrgInfo")
@DS("ope")
public Result<IPage<OrgAllInfo>> getModifyInfo(
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "8") Integer pageSize,
@RequestParam(value = "orgCode", defaultValue = "", required = false) String orgCode,
@RequestParam(value = "title", defaultValue = "", required = false) String title) {
IPage<OrgAllInfo> page = new Page<>(pageNo, pageSize);
IPage<OrgAllInfo> resultPage = orgApplyInfoService.queryOrgInfo(page, orgCode, title);
return Result.OK(resultPage);
}
}

View File

@ -0,0 +1,173 @@
package com.nu.modules.orgapplyinfo.entity;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* @Description: 机构全部信息
* @Author: zmy
* @Date: 2025-07-09
* @Version: V1.0
*/
@Data
public class OrgAllInfo implements Serializable {
private static final long serialVersionUID = 1L;
/**机构id*/
private String orgId;
/**
* 机构/部门名称
*/
private String departName;
/**
* 机构编码
*/
private String orgCode;
/**
* 协议+域名
*/
private String url;
/**
* 协议+域名
*/
private String contextPath;
/**
* 是否标准指令库 0是1否
*/
private String izDirectiveMain;
/**
* 是否标准标签库 0是1否
*/
private String izElderTagMain;
/**
* 媒体资源访问地址
*/
private String mediaUrl;
/**
* 省份
*/
private String province;
/**
* 城市
*/
private String city;
/**
* 区县
*/
private String district;
/**
* 业务平台类型
*/
private String platType;
/**
* 运营开始时间
*/
private Date operationStartTime;
/**
* 运营到期时间
*/
private Date operationEndTime;
/**
* 合同开始时间
*/
private Date contractStartTime;
/**
* 合同到期时间
*/
private Date contractEndTime;
/**
* 手机号
*/
private String mobile;
/**
* 传真
*/
private String fax;
/**
* 地址
*/
private String address;
/**
* 备注
*/
private String memo;
/**
* 应缴金额
*/
private BigDecimal payableAmount;
/**
* 机构图片
*/
private String picUrl;
/**微信id*/
private String openId;
/**微信名称*/
private String wechatName;
/**联系电话*/
private String tel;
/**咨询人姓名*/
private String name;
/**性别*/
private String sex;
/**民族*/
private String national;
/**出生日期*/
private Date birthDate;
/**住址(身份证上)*/
private String idCardAddress;
/**身份证号*/
private String idCard;
/**签发机关*/
private String issuingAuthority;
/**有效开始日期*/
private Date startTime;
/**有效结束日期*/
private Date endTime;
/**身份证正面*/
private String cardZmPath;
/**身份证反面*/
private String cardFmPath;
/**营业执照照片*/
private String comBusinessLicense;
/**企业名称*/
private String comName;
/**企业注册地址*/
private String comRegisterAddress;
/**企业信用代码*/
private String comCreditCode;
/**企业法人*/
private String comLegalPerson;
/**机构地址*/
private String orgAddress;
/**机构位置坐标:经度*/
private String orgCoordinateLo;
/**机构位置坐标:维度*/
private String orgCoordinateLa;
/**机构负责人*/
private String orgLeader;
/**机构负责人电话*/
private String orgLeaderPhone;
/**机构楼宇牌号*/
private String orgBuildingNumber;
/**机构房屋性质*/
private String orgPropertyType;
/**机构建筑面积*/
private Double orgBuildingArea;
/**机构省份 sys_category.id*/
private String orgProvince;
/**机构城市 sys_category.id*/
private String orgCity;
/**机构区域 sys_category.id*/
private String orgDistrict;
/**合同附件*/
private String contract;
/**合同备注*/
private String contractNote;
/** 加盟时间*/
private Date franchiseTime;
}

View File

@ -0,0 +1,257 @@
package com.nu.modules.orgapplyinfo.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;
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;
/**
* @Description: 机构加盟申请信息表
* @Author: 张明远
* @Date: 2025-06-05
* @Version: V1.0
*/
@Data
@TableName("nu_org_apply_info")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="nu_org_apply_info对象", description="机构加盟申请信息表")
public class OrgApplyInfo implements Serializable {
private static final long serialVersionUID = 1L;
/**id*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "id")
private java.lang.String id;
/**机构ID orgId 同机构相同(申请时生成数据的id)*/
@ApiModelProperty(value = "机构ID orgId 同机构相同(申请时生成数据的id)")
private java.lang.String pkId;
/**微信id*/
@Excel(name = "微信id", width = 15)
@ApiModelProperty(value = "微信id")
private java.lang.String openId;
/**微信名称*/
@Excel(name = "微信名称", width = 15)
@ApiModelProperty(value = "微信名称")
private java.lang.String wechatName;
/**联系电话*/
@Excel(name = "联系电话", width = 15)
@ApiModelProperty(value = "联系电话")
private java.lang.String tel;
/**状态 1审核中 2审核完成 3驳回 */
@Dict(dicCode = "org_apply_status")
@Excel(name = "审批状态", width = 15)
@ApiModelProperty(value = "审批状态")
private java.lang.String status;
/**变更状态 0可修改 1不可修改 */
@Excel(name = "变更状态 0可修改 1不可修改", width = 15)
@ApiModelProperty(value = "变更状态 0可修改 1不可修改")
private java.lang.String modifyStatus;
/**构建状态构建状态1、机构加盟【小程序】2、加盟审核【管理平台】3、加盟合同【管理平台】4、平台搭建【运维平台】5、账户初始化【管理平台】6、信息推送【公众号】*/
@Dict(dicCode = "org_build_status")
@Excel(name = "构建状态构建状态1、机构加盟【小程序】2、加盟审核【管理平台】3、加盟合同【管理平台】4、平台搭建【运维平台】5、账户初始化【管理平台】6、信息推送【公众号】", width = 15)
@ApiModelProperty(value = "构建状态构建状态1、机构加盟【小程序】2、加盟审核【管理平台】3、加盟合同【管理平台】4、平台搭建【运维平台】5、账户初始化【管理平台】6、信息推送【公众号】")
private java.lang.String buildStatus;
//构建状态前后台处理逻辑字段
@TableField(exist = false)
private String buildStatusVal;
/**审核备注*/
@Excel(name = "审核备注", width = 15)
@ApiModelProperty(value = "审核备注")
private java.lang.String content;
/**创建人*/
@ApiModelProperty(value = "创建人")
private java.lang.String createBy;
/**创建日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ApiModelProperty(value = "创建日期")
private java.util.Date createTime;
/**更新人*/
@ApiModelProperty(value = "更新人")
private java.lang.String updateBy;
/**更新日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ApiModelProperty(value = "更新日期")
private java.util.Date updateTime;
/**机构是否入驻0否 1是(是否入驻过)*/
@Excel(name = "机构是否入驻0否 1是(是否入驻过)", width = 15)
@ApiModelProperty(value = "机构是否入驻0否 1是(是否入驻过)")
private java.lang.String izEntry;
/**咨询人姓名*/
@Excel(name = "咨询人姓名", width = 15)
@ApiModelProperty(value = "咨询人姓名")
private java.lang.String name;
/**性别*/
@Excel(name = "性别", width = 15)
@ApiModelProperty(value = "性别")
private java.lang.String sex;
/**民族*/
@Excel(name = "民族", width = 15)
@ApiModelProperty(value = "民族")
private java.lang.String national;
/**出生日期*/
@Excel(name = "出生日期", width = 20, format = "yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ApiModelProperty(value = "出生日期")
private java.util.Date birthDate;
/**住址(身份证上)*/
@Excel(name = "住址(身份证上)", width = 15)
@ApiModelProperty(value = "住址(身份证上)")
private java.lang.String idCardAddress;
/**身份证号*/
@Excel(name = "身份证号", width = 15)
@ApiModelProperty(value = "身份证号")
private java.lang.String idCard;
/**签发机关*/
@Excel(name = "签发机关", width = 15)
@ApiModelProperty(value = "签发机关")
private java.lang.String issuingAuthority;
/**有效开始日期*/
@Excel(name = "有效开始日期", width = 20, format = "yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ApiModelProperty(value = "有效开始日期")
private java.util.Date startTime;
/**有效结束日期*/
@Excel(name = "有效结束日期", width = 20, format = "yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ApiModelProperty(value = "有效结束日期")
private java.util.Date endTime;
/**身份证正面*/
@Excel(name = "身份证正面", width = 15)
@ApiModelProperty(value = "身份证正面")
private java.lang.String cardZmPath;
/**身份证反面*/
@Excel(name = "身份证反面", width = 15)
@ApiModelProperty(value = "身份证反面")
private java.lang.String cardFmPath;
/**营业执照照片*/
@Excel(name = "营业执照照片", width = 15)
@ApiModelProperty(value = "营业执照照片")
private java.lang.String comBusinessLicense;
/**企业名称*/
@Excel(name = "企业名称", width = 15)
@ApiModelProperty(value = "企业名称")
private java.lang.String comName;
/**企业注册地址*/
@Excel(name = "企业注册地址", width = 15)
@ApiModelProperty(value = "企业注册地址")
private java.lang.String comRegisterAddress;
/**企业信用代码*/
@Excel(name = "企业信用代码", width = 15)
@ApiModelProperty(value = "企业信用代码")
private java.lang.String comCreditCode;
/**企业法人*/
@Excel(name = "企业法人", width = 15)
@ApiModelProperty(value = "企业法人")
private java.lang.String comLegalPerson;
/**机构地址*/
@Excel(name = "机构地址", width = 15)
@ApiModelProperty(value = "机构地址")
private java.lang.String orgAddress;
/**机构位置坐标:经度*/
@Excel(name = "机构位置坐标:经度", width = 15)
@ApiModelProperty(value = "机构位置坐标:经度")
private String orgCoordinateLo;
/**机构位置坐标:纬度*/
@Excel(name = "机构位置坐标:纬度", width = 15)
@ApiModelProperty(value = "机构位置坐标:纬度")
private String orgCoordinateLa;
/**机构负责人*/
@Excel(name = "机构负责人", width = 15)
@ApiModelProperty(value = "机构负责人")
private java.lang.String orgLeader;
/**机构负责人电话*/
@Excel(name = "机构负责人电话", width = 15)
@ApiModelProperty(value = "机构负责人电话")
private java.lang.String orgLeaderPhone;
/**机构楼宇牌号*/
@Excel(name = "机构楼宇牌号", width = 15)
@ApiModelProperty(value = "机构楼宇牌号")
private java.lang.String orgBuildingNumber;
/**机构房屋性质*/
@Excel(name = "机构房屋性质", width = 15)
@ApiModelProperty(value = "机构房屋性质")
private java.lang.String orgPropertyType;
/**机构建筑面积*/
@Excel(name = "机构建筑面积", width = 15)
@ApiModelProperty(value = "机构建筑面积")
private java.lang.Double orgBuildingArea;
/**机构省份 sys_category.id*/
@Excel(name = "机构省份", width = 15)
@ApiModelProperty(value = "机构省份")
@Dict(dictTable = "sys_category",dicCode = "id",dicText = "name")
private java.lang.String orgProvince;
/**机构城市 sys_category.id*/
@Excel(name = "机构城市", width = 15)
@ApiModelProperty(value = "机构城市")
@Dict(dictTable = "sys_category",dicCode = "id",dicText = "name")
private java.lang.String orgCity;
/**机构区域 sys_category.id*/
@Excel(name = "机构区域", width = 15)
@ApiModelProperty(value = "机构区域")
@Dict(dictTable = "sys_category",dicCode = "id",dicText = "name")
private java.lang.String orgDistrict;
/**合同附件*/
@Excel(name = "合同附件", width = 15)
@ApiModelProperty(value = "合同附件")
private java.lang.String contract;
/**合同备注*/
@Excel(name = "合同备注", width = 15)
@ApiModelProperty(value = "合同备注")
private java.lang.String contractNote;
@TableField(exist = false)
private java.lang.String orgProvince_dictText;
@TableField(exist = false)
private java.lang.String orgCity_dictText;
@TableField(exist = false)
private java.lang.String orgDistrict_dictText;
/**提交时间*/
@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 commitTime;
/**审核时间*/
@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 auditTime;
private String auditBy;
/**加盟时间*/
@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 franchiseTime;
private java.lang.String replyContent;
private java.lang.String replyFile;
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private java.util.Date replyTime;
private java.lang.String handleBy;
@Dict(dicCode = "work_order_status")
private java.lang.String workOrderStatus;
private java.lang.String workOrderId;
}

View File

@ -0,0 +1,22 @@
package com.nu.modules.orgapplyinfo.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.nu.modules.orgapplyinfo.entity.OrgAllInfo;
import org.apache.ibatis.annotations.Param;
import com.nu.modules.orgapplyinfo.entity.OrgApplyInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @Description: 机构加盟申请信息表
* @Author: 张明远
* @Date: 2025-06-05
* @Version: V1.0
*/
public interface OrgApplyInfoMapper extends BaseMapper<OrgApplyInfo> {
void realDelete(@Param("pkId") String pkId);
IPage<OrgAllInfo> queryOrgInfo(@Param("page") IPage<OrgAllInfo> page, @Param("orgCode") String orgCode, @Param("title") String title);
}

View File

@ -0,0 +1,68 @@
<?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.orgapplyinfo.mapper.OrgApplyInfoMapper">
<select id="queryOrgInfo" resultType="com.nu.modules.orgapplyinfo.entity.OrgAllInfo">
select
d.id as orgId,
d.depart_name,
d.org_code,
d.url,
d.plat_type,
d.iz_directive_main,
d.iz_elder_tag_main,
d.media_url,
o.open_id,
o.wechat_name,
o.tel,
o.name,
o.sex,
o.national,
o.birth_date,
o.id_card_address,
o.id_card,
o.issuing_authority,
o.start_time,
o.end_time,
o.card_zm_path,
o.card_fm_path,
o.com_business_license,
o.com_name,
o.com_register_address,
o.com_credit_code,
o.com_legal_person,
o.org_address,
o.org_leader,
o.org_leader_phone,
o.org_building_number,
o.org_property_type,
o.org_building_area,
o.org_province,
o.org_city,
o.org_district,
o.contract,
o.contract_note,
o.franchise_time
from sys_depart d
left join nu_org_apply_info o
on d.id = o.pk_id
<where>
o.status = '2'
and d.del_flag = '0'
<if test="orgCode !=null and orgCode != ''">
AND d.org_code = #{orgCode}
</if>
<if test="title != null and title != ''">
AND d.depart_name LIKE CONCAT('%', #{title}, '%')
</if>
</where>
order by (d.org_code + 0) asc
</select>
<delete id="realDelete">
delete
from nu_org_apply_info
where pk_id = #{pkId}
and status = '5'
</delete>
</mapper>

View File

@ -0,0 +1,17 @@
package com.nu.modules.orgapplyinfo.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.nu.modules.orgapplyinfo.entity.OrgAllInfo;
import com.nu.modules.orgapplyinfo.entity.OrgApplyInfo;
/**
* @Description: 机构加盟申请信息表
* @Author: 张明远
* @Date: 2025-06-05
* @Version: V1.0
*/
public interface IOrgApplyInfoService extends IService<OrgApplyInfo> {
IPage<OrgAllInfo> queryOrgInfo(IPage<OrgAllInfo> page, String orgCode, String title);
}

View File

@ -0,0 +1,24 @@
package com.nu.modules.orgapplyinfo.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.nu.modules.orgapplyinfo.entity.OrgAllInfo;
import com.nu.modules.orgapplyinfo.entity.OrgApplyInfo;
import com.nu.modules.orgapplyinfo.mapper.OrgApplyInfoMapper;
import com.nu.modules.orgapplyinfo.service.IOrgApplyInfoService;
import org.springframework.stereotype.Service;
/**
* @Description: 机构加盟申请信息表
* @Author: 张明远
* @Date: 2025-06-05
* @Version: V1.0
*/
@Service
public class OrgApplyInfoServiceImpl extends ServiceImpl<OrgApplyInfoMapper, OrgApplyInfo> implements IOrgApplyInfoService {
@Override
public IPage<OrgAllInfo> queryOrgInfo(IPage<OrgAllInfo> page, String orgCode, String title) {
return baseMapper.queryOrgInfo(page, orgCode, title);
}
}

View File

@ -109,9 +109,13 @@ public class DirectiveAsyncMQDto implements Serializable {
*/
private String mp4File;
/**
* 服务指令图片
* 服务指令图片大图
*/
private String previewFile;
/**
* 服务指令图片小图
*/
private String previewFileSmall;
/**
* 即时指令图标
*/
@ -125,9 +129,13 @@ public class DirectiveAsyncMQDto implements Serializable {
*/
private java.lang.String mp4FileMd5;
/**
* 服务指令图片md5
* 服务指令图片大图md5
*/
private java.lang.String previewFileMd5;
/**
* 服务指令图片小图md5
*/
private java.lang.String previewFileSmallMd5;
/**
* 即时指令图标md5
*/

View File

@ -10,6 +10,10 @@ public class DirectiveMQDto {
private String orgCode;//机构编码
private String idStr;
private List<String> idList;
/**
* 管理平台服务指令媒体资源管理功能发起的本地未必会有对应指令没有的话只保存物理文件
*/
private boolean izDirectiveMedia;
//同步主表id
private String asyncId;

View File

@ -1,5 +1,6 @@
package com.nu.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
@ -7,23 +8,41 @@ import java.io.Serializable;
/**
* @Description: 服务指令-分类标签
* @Author: zmy
* @Date: 2025-07-25
* @Date: 2025-07-25
* @Version: V1.0
*/
@Data
public class InstructionTagMQDto implements Serializable {
private static final long serialVersionUID = 1L;
/**id*/
/**
* id
*/
private String id;
/**分类标签名称*/
/**
* 分类标签名称
*/
private String instructionName;
/**排序*/
/**
* 排序
*/
private Integer sort;
/**状态 0已授权 1未授权*/
/**
* 状态 0已授权 1未授权
*/
private String status;
/**是否启用 0启用 1未启用*/
/**
* 是否启用 0启用 1未启用
*/
private String izEnabled;
/**是否删除 0未删除 1删除*/
/**
* 是否删除 0未删除 1删除
*/
private String delFlag;
/**
* 创建人
*/
private java.lang.String createBy;
/**
* 所属部门
*/
private java.lang.String sysOrgCode;
}

View File

@ -18,6 +18,7 @@ public class HttpRequestUtil {
*/
public static Map<String, String> createDefaultHeaders() {
Map<String, String> headers = new HashMap<>();
headers.put("Content-Type", "application/json; charset=UTF-8");
headers.put("Accept", "application/json");
return headers;
}

View File

@ -0,0 +1,144 @@
package com.nu.modules.canaddeldertag.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.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.nu.modules.sysconfig.ISysConfigApi;
import com.nu.utils.HttpRequestUtil;
import org.apache.commons.lang.StringUtils;
import org.apache.shiro.SecurityUtils;
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.system.vo.LoginUser;
import org.jeecg.common.util.oConvertUtils;
import com.nu.modules.canaddeldertag.entity.CanAddElderTag;
import com.nu.modules.canaddeldertag.service.ICanAddElderTagService;
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.jeecg.config.JeecgBaseConfig;
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-08-14
* @Version: V1.0
*/
@Api(tags = "可新增长者标签")
@RestController
@RequestMapping("/eldertag/canAddElderTag")
@Slf4j
public class CanAddElderTagController extends JeecgController<CanAddElderTag, ICanAddElderTagService> {
@Autowired
private ICanAddElderTagService canAddElderTagService;
@Resource
private JeecgBaseConfig jeecgBaseConfig;
@Autowired
private ISysConfigApi sysConfigApi;
/**
* 分页列表查询
*
* @param canAddElderTag
* @param pageNo
* @param pageSize
* @param req
* @return
*/
//@AutoLog(value = "可新增长者标签-分页列表查询")
@ApiOperation(value = "可新增长者标签-分页列表查询", notes = "可新增长者标签-分页列表查询")
@GetMapping(value = "/list")
@DS("ope")
public Result<IPage<CanAddElderTag>> queryPageList(CanAddElderTag canAddElderTag,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<CanAddElderTag> queryWrapper = QueryGenerator.initQueryWrapper(canAddElderTag, req.getParameterMap());
if (StringUtils.isNotBlank(canAddElderTag.getExistElderTagIds())) {
queryWrapper.notIn("tag_id",canAddElderTag.getExistElderTagIds().split(","));
}
Page<CanAddElderTag> page = new Page<CanAddElderTag>(pageNo, pageSize);
IPage<CanAddElderTag> pageList = canAddElderTagService.page(page, queryWrapper);
return Result.OK(pageList);
}
/**
* 导出excel
*
* @param request
* @param canAddElderTag
*/
@RequestMapping(value = "/exportXls")
@DS("ope")
public ModelAndView exportXls(HttpServletRequest request, CanAddElderTag canAddElderTag) {
String title = "差异标签";
QueryWrapper<CanAddElderTag> queryWrapper = new QueryWrapper<CanAddElderTag>();
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
if (StringUtils.isNotBlank(canAddElderTag.getSysOrgCode())) {
queryWrapper.eq("sys_org_code", canAddElderTag.getSysOrgCode());
}
if (StringUtils.isNotBlank(canAddElderTag.getExistElderTagIds())) {
queryWrapper.notIn("tag_id", canAddElderTag.getExistElderTagIds().split(","));
}
List<CanAddElderTag> exportList = service.list(queryWrapper);
//获取机构编码及名称
JSONObject opeOpenUrl = sysConfigApi.getByKeyByDS("master", "ope_open_url");
String opeApiAddress = opeOpenUrl.getString("configValue");
if (opeApiAddress.endsWith("/")) {
opeApiAddress = opeApiAddress.substring(0, opeApiAddress.length() - 1);
}
String allOrgCodeAndName = opeApiAddress + "/api/baseInfo/getOrgCodeAndName";
JSONObject result = null;
try {
String res = HttpRequestUtil.doGet(allOrgCodeAndName, HttpRequestUtil.createDefaultHeaders());
JSONObject jsonResponse = JSON.parseObject(res);
result = jsonResponse.getJSONObject("result");
} catch (Exception e) {
e.printStackTrace();
}
if (result != null) {
for (int i = 0; i < exportList.size(); i++) {
exportList.get(i).setSysOrgCode(result.getString(exportList.get(i).getSysOrgCode()));
}
}
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
mv.addObject(NormalExcelConstants.FILE_NAME, title);
mv.addObject(NormalExcelConstants.CLASS, CanAddElderTag.class);
ExportParams exportParams = new ExportParams(title + "报表", "导出人:" + sysUser.getRealname(), title);
exportParams.setImageBasePath(jeecgBaseConfig.getPath().getUpload());
mv.addObject(NormalExcelConstants.PARAMS, exportParams);
mv.addObject(NormalExcelConstants.DATA_LIST, exportList);
return mv;
}
}

View File

@ -0,0 +1,78 @@
package com.nu.modules.canaddeldertag.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: jeecg-boot
* @Date: 2025-08-14
* @Version: V1.0
*/
@Data
@TableName("nu_can_add_elder_tag")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="nu_can_add_elder_tag对象", description="可新增长者标签")
public class CanAddElderTag implements Serializable {
private static final long serialVersionUID = 1L;
/**id*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "id")
private java.lang.String id;
/**nu_elder_tag.id*/
@ApiModelProperty(value = "nu_elder_tag.id")
private java.lang.String tagId;
/**所属机构*/
@ApiModelProperty(value = "所属机构")
@Excel(name = "所属机构", width = 50)
@Dict(dictTable = "sys_depart", dicText = "depart_name", dicCode = "org_code")
private java.lang.String sysOrgCode;
/**标签类型 tx体型标签 qx情绪标签*/
@Excel(name = "标签类型", width = 20,dicCode = "elder_tag_type")
@ApiModelProperty(value = "标签类型 tx体型标签 qx情绪标签")
@Dict(dicCode = "elder_tag_type")
private java.lang.String type;
/**标签名称*/
@Excel(name = "标签名称", width = 30)
@ApiModelProperty(value = "标签名称")
private java.lang.String tagName;
/**价格*/
@Excel(name = "价格(元)", width = 20)
@ApiModelProperty(value = "价格")
private java.math.BigDecimal price;
/**图标*/
@ApiModelProperty(value = "图标")
private java.lang.String pic;
/**排序*/
@ApiModelProperty(value = "排序")
private java.lang.Integer sort;
/**创建日期*/
@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;
/**
* 已存在服务指令ids 逗号拼接
*/
@TableField(exist = false)
private String existElderTagIds;
}

View File

@ -0,0 +1,17 @@
package com.nu.modules.canaddeldertag.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.nu.modules.canaddeldertag.entity.CanAddElderTag;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @Description: 可新增长者标签
* @Author: jeecg-boot
* @Date: 2025-08-14
* @Version: V1.0
*/
public interface CanAddElderTagMapper extends BaseMapper<CanAddElderTag> {
}

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.canaddeldertag.mapper.CanAddElderTagMapper">
</mapper>

View File

@ -0,0 +1,14 @@
package com.nu.modules.canaddeldertag.service;
import com.nu.modules.canaddeldertag.entity.CanAddElderTag;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @Description: 可新增长者标签
* @Author: jeecg-boot
* @Date: 2025-08-14
* @Version: V1.0
*/
public interface ICanAddElderTagService extends IService<CanAddElderTag> {
}

View File

@ -0,0 +1,19 @@
package com.nu.modules.canaddeldertag.service.impl;
import com.nu.modules.canaddeldertag.entity.CanAddElderTag;
import com.nu.modules.canaddeldertag.mapper.CanAddElderTagMapper;
import com.nu.modules.canaddeldertag.service.ICanAddElderTagService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
* @Description: 可新增长者标签
* @Author: jeecg-boot
* @Date: 2025-08-14
* @Version: V1.0
*/
@Service
public class CanAddElderTagServiceImpl extends ServiceImpl<CanAddElderTagMapper, CanAddElderTag> implements ICanAddElderTagService {
}

View File

@ -1,6 +1,7 @@
package com.nu.modules.eldertag.controller;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@ -8,8 +9,11 @@ import javax.servlet.http.HttpServletResponse;
import cn.hutool.core.util.IdUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
import com.nu.dto.DirectiveAsyncMQDto;
import com.nu.dto.ElderTagAsyncMQDto;
import com.nu.modules.canaddeldertag.entity.CanAddElderTag;
import com.nu.modules.canaddeldertag.service.ICanAddElderTagService;
import com.nu.utils.RabbitMQUtil;
import org.apache.commons.lang.StringUtils;
import org.jeecg.common.api.vo.Result;
@ -50,6 +54,8 @@ public class ElderTagController extends JeecgController<ElderTag, IElderTagServi
private ISysBaseAPI sysBaseAPI;
@Autowired
private RabbitMQUtil rabbitMQUtil;
@Autowired
private ICanAddElderTagService canAddElderTagService;
/**
* 分页列表查询
@ -133,8 +139,39 @@ public class ElderTagController extends JeecgController<ElderTag, IElderTagServi
@RequiresPermissions("eldertag:nu_elder_tag:add")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody ElderTag elderTag) {
QueryWrapper<ElderTag> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("type", elderTag.getType());
queryWrapper.eq("tag_name", elderTag.getTagName());
ElderTag one = elderTagService.getOne(queryWrapper);
if (one != null) {
return Result.error("长者标签已存在!");
}
//临时切换至管理平台
DynamicDataSourceContextHolder.push("ope");
List<CanAddElderTag> canAddList;
try {
canAddList = canAddElderTagService.list();
} finally {
DynamicDataSourceContextHolder.clear();
}
boolean needSetId = true;
for (int i = 0; i < canAddList.size(); i++) {
CanAddElderTag canAddElderTag = canAddList.get(i);
if (
canAddElderTag.getType().equals(elderTag.getType()) &&
canAddElderTag.getTagName().equals(elderTag.getTagName())
) {
needSetId = false;
elderTag.setId(canAddElderTag.getTagId());
}
}
JSONObject deptInfo = sysBaseAPI.getDeptInfo();
elderTag.setId(deptInfo.getString("code") + IdUtil.simpleUUID());
if (needSetId) {
elderTag.setId(deptInfo.getString("code") + IdUtil.simpleUUID());
}
elderTag.setSysOrgCode(deptInfo.getString("code"));
//处理静态资源
elderTagService.handleMediaFile(elderTag);
@ -256,4 +293,17 @@ public class ElderTagController extends JeecgController<ElderTag, IElderTagServi
//发送消息
return Result.ok();
}
/**
* 差异比对
* 主标签库跟选中的机构进行比对
*
* @param elderTag
* @return
*/
@ApiOperation(value = "长者标签-差异比对", notes = "长者标签-差异比对")
@GetMapping(value = "/compareList")
public Result<List<ElderTag>> compareList(ElderTag elderTag) {
return Result.OK(elderTagService.compareList(elderTag));
}
}

View File

@ -21,4 +21,6 @@ public interface IElderTagService extends IService<ElderTag> {
List<ElderTag> allData();
void insertAllDirectives(List<ElderTag> needAddETList);
List<ElderTag> compareList(ElderTag elderTag);
}

View File

@ -13,6 +13,7 @@ import com.nu.modules.mq.eldertag.listener.ElderTagMQListener;
import com.nu.modules.sysconfig.ISysConfigApi;
import com.nu.utils.HttpRequestUtil;
import com.nu.utils.NuFileUtils;
import org.apache.commons.compress.utils.Lists;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
@ -20,9 +21,8 @@ import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.io.File;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
/**
* @Description: 长者标签
@ -47,7 +47,7 @@ public class ElderTagServiceImpl extends ServiceImpl<ElderTagMapper, ElderTag> i
@Override
public void handleMediaFile(ElderTag elderTag) {
//需要存储的路径
String mediaFileSavePath = "/eldertag/" + elderTag.getTagName() + elderTag.getId();
String mediaFileSavePath = "/eldertag/" + elderTag.getTagName();
//图标
String previewFile = elderTag.getPic();
// 处理文件并获取更新后的路径
@ -105,4 +105,81 @@ public class ElderTagServiceImpl extends ServiceImpl<ElderTagMapper, ElderTag> i
baseMapper.insert(et);
});
}
@Override
public List<ElderTag> compareList(ElderTag elderTag) {
List<ElderTag> result = Lists.newArrayList();
//查询本平台的已有指令
// List<ElderTag> ownList = baseMapper.queryAndTranslate(null);
// String existIds = "";
// if (ownList != null && ownList.size() > 0) {
// existIds = ownList.stream()
// .map(l -> l.getId())
// .map(String::valueOf)
// .collect(Collectors.joining(","));
// }
//
// // 查询目标平台已有指令
// //各平台api地址都存在管理系统中 管理系统api地址在系统参数配置中 ope_open_url
// JSONObject opeOpenUrl = sysConfigApi.getByKeyByDS("master", "ope_open_url");
// String opeApiAddress = opeOpenUrl.getString("configValue");
// if (opeApiAddress.endsWith("/")) {
// opeApiAddress = opeApiAddress.substring(0, opeApiAddress.length() - 1);
// }
// String apiAddress = opeApiAddress + "/api/services/directive/queryCompareDirectives?orgCode=" + configServiceDirective.getCompareOrgCode();
// List<ConfigServiceDirective> targetList = Lists.newArrayList();
// try {
// String res = HttpRequestUtil.doGet(apiAddress, HttpRequestUtil.createDefaultHeaders());
// JSONObject jsonResponse = JSON.parseObject(res);
// JSONObject r_ = jsonResponse.getJSONObject("result");
// targetList = r_.getJSONArray("list")
// .toJavaList(ConfigServiceDirective.class);
// } catch (Exception e) {
// e.printStackTrace();
// }
//
// Map<String, ConfigServiceDirective> merged = new LinkedHashMap<>();
//
// // 先把本平台的放进去标记 ownExist = true, targetExist = false
// if (ownList != null) {
// for (ConfigServiceDirective o : ownList) {
// if (o == null || o.getId() == null) continue;
// String id = String.valueOf(o.getId());
// // 直接在原对象上设置标志如果不想修改原对象请复制对象
// o.setOwnExist(true);
// o.setTargetExist(false);
// merged.put(id, o);
// }
// }
//
// // 再处理目标平台的数据若已存在则把 targetExist true否则加入并标记为仅 target
// if (targetList != null) {
// for (ConfigServiceDirective t : targetList) {
// if (t == null || t.getId() == null) continue;
// String id = String.valueOf(t.getId());
// if (merged.containsKey(id)) {
// // 本平台已有标记目标平台也存在
// merged.get(id).setTargetExist(true);
// } else {
// // 仅目标平台有
// t.setOwnExist(false);
// t.setTargetExist(true);
// merged.put(id, t);
// }
// }
// }
//
// // 把合并后的值放到列表并按需求排序both -> own only -> target only
// result = new ArrayList<>(merged.values());
// result.sort(Comparator.comparingInt(d -> {
// boolean own = Boolean.TRUE.equals(d.isOwnExist());
// boolean target = Boolean.TRUE.equals(d.isTargetExist());
// if (own && target) return 0; // 两个平台都有 -> 最前
// if (own) return 1; // 仅本平台有 -> 中间
// return 2; // 仅目标平台有 -> 最后
// }));
return result;
}
}

View File

@ -0,0 +1,149 @@
package com.nu.modules.canadddirective.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.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.nu.modules.sysconfig.ISysConfigApi;
import com.nu.utils.HttpRequestUtil;
import org.apache.commons.lang.StringUtils;
import org.apache.shiro.SecurityUtils;
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.system.vo.LoginUser;
import org.jeecg.common.util.oConvertUtils;
import com.nu.modules.canadddirective.entity.CanAddDirective;
import com.nu.modules.canadddirective.service.ICanAddDirectiveService;
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.jeecg.config.JeecgBaseConfig;
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-08-01
* @Version: V1.0
*/
@Api(tags = "可新增指令")
@RestController
@RequestMapping("/canadddirective/canAddDirective")
@Slf4j
public class CanAddDirectiveController extends JeecgController<CanAddDirective, ICanAddDirectiveService> {
@Autowired
private ICanAddDirectiveService canAddDirectiveService;
@Resource
private JeecgBaseConfig jeecgBaseConfig;
@Autowired
private ISysConfigApi sysConfigApi;
/**
* 分页列表查询
*
* @param canAddDirective
* @param pageNo
* @param pageSize
* @param req
* @return
*/
//@AutoLog(value = "可新增指令-分页列表查询")
@ApiOperation(value = "可新增指令-分页列表查询", notes = "可新增指令-分页列表查询")
@GetMapping(value = "/list")
@DS("ope")
public Result<IPage<CanAddDirective>> queryPageList(CanAddDirective canAddDirective,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
// 自定义查询规则
Map<String, QueryRuleEnum> customeRuleMap = new HashMap<>();
// 自定义多选的查询规则为LIKE_WITH_OR
customeRuleMap.put("orgCode", QueryRuleEnum.LIKE_WITH_OR);
QueryWrapper<CanAddDirective> queryWrapper = QueryGenerator.initQueryWrapper(canAddDirective, req.getParameterMap(), customeRuleMap);
if (StringUtils.isNotBlank(canAddDirective.getExistDirectiveIds())) {
queryWrapper.notIn("directive_id", canAddDirective.getExistDirectiveIds().split(","));
}
Page<CanAddDirective> page = new Page<CanAddDirective>(pageNo, pageSize);
IPage<CanAddDirective> pageList = canAddDirectiveService.page(page, queryWrapper);
return Result.OK(pageList);
}
/**
* 导出excel
*
* @param request
* @param canAddDirective
*/
@RequestMapping(value = "/exportXls")
@DS("ope")
public ModelAndView exportXls(HttpServletRequest request, CanAddDirective canAddDirective) {
String title = "差异指令";
QueryWrapper<CanAddDirective> queryWrapper = new QueryWrapper<CanAddDirective>();
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
if (StringUtils.isNotBlank(canAddDirective.getOrgCode())) {
queryWrapper.eq("org_code", canAddDirective.getOrgCode());
}
if (StringUtils.isNotBlank(canAddDirective.getExistDirectiveIds())) {
queryWrapper.notIn("directive_id", canAddDirective.getExistDirectiveIds().split(","));
}
List<CanAddDirective> exportList = service.list(queryWrapper);
//获取机构编码及名称
JSONObject opeOpenUrl = sysConfigApi.getByKeyByDS("master", "ope_open_url");
String opeApiAddress = opeOpenUrl.getString("configValue");
if (opeApiAddress.endsWith("/")) {
opeApiAddress = opeApiAddress.substring(0, opeApiAddress.length() - 1);
}
String allOrgCodeAndName = opeApiAddress + "/api/baseInfo/getOrgCodeAndName";
JSONObject result = null;
try {
String res = HttpRequestUtil.doGet(allOrgCodeAndName, HttpRequestUtil.createDefaultHeaders());
JSONObject jsonResponse = JSON.parseObject(res);
result = jsonResponse.getJSONObject("result");
} catch (Exception e) {
e.printStackTrace();
}
if (result != null) {
for (int i = 0; i < exportList.size(); i++) {
exportList.get(i).setOrgCode(result.getString(exportList.get(i).getOrgCode()));
}
}
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
mv.addObject(NormalExcelConstants.FILE_NAME, title);
mv.addObject(NormalExcelConstants.CLASS, CanAddDirective.class);
ExportParams exportParams = new ExportParams(title + "报表", "导出人:" + sysUser.getRealname(), title);
exportParams.setImageBasePath(jeecgBaseConfig.getPath().getUpload());
mv.addObject(NormalExcelConstants.PARAMS, exportParams);
mv.addObject(NormalExcelConstants.DATA_LIST, exportList);
return mv;
}
}

View File

@ -0,0 +1,154 @@
package com.nu.modules.canadddirective.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: jeecg-boot
* @Date: 2025-08-01
* @Version: V1.0
*/
@Data
@TableName("nu_can_add_directive")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "nu_can_add_directive对象", description = "可新增指令")
public class CanAddDirective implements Serializable {
private static final long serialVersionUID = 1L;
/**
* id
*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "id")
private java.lang.String id;
/**
* 指令ID
*/
// @Excel(name = "指令ID", width = 15)
@ApiModelProperty(value = "指令ID")
private java.lang.String directiveId;
/**
* 所属部门
*/
@Excel(name = "所属机构", width = 50)
@Dict(dictTable = "sys_depart", dicText = "depart_name", dicCode = "org_code")
@ApiModelProperty(value = "所属部门")
private java.lang.String orgCode;
/**
* 分类标签
*/
@Excel(name = "分类标签", width = 20)
@ApiModelProperty(value = "分类标签")
private java.lang.String instructionTag;
/**
* 服务类别
*/
@Excel(name = "服务类别", width = 20)
@ApiModelProperty(value = "服务类别")
private java.lang.String category;
/**
* 服务类型
*/
@Excel(name = "服务类型", width = 20)
@ApiModelProperty(value = "服务类型")
private java.lang.String type;
/**
* 服务指令
*/
@Excel(name = "服务指令", width = 40)
@ApiModelProperty(value = "服务指令")
private java.lang.String directiveName;
/**
* 周期类型 1日常护理 2周期护理 3即时护理
*/
@Excel(name = "周期类型", width = 20)
@ApiModelProperty(value = "周期类型")
private java.lang.String cycleType;
/**
* 收费价格
*/
@Excel(name = "收费价格(元)", width = 20)
@ApiModelProperty(value = "收费价格")
private java.math.BigDecimal tollPrice;
/**
* 提成价格
*/
@Excel(name = "提成价格(元)", width = 20)
@ApiModelProperty(value = "提成价格")
private java.math.BigDecimal comPrice;
/**
* 服务描述
*/
@Excel(name = "服务描述", width = 50)
@ApiModelProperty(value = "服务描述")
private java.lang.String serviceContent;
/**
* 服务时长分钟
*/
@Excel(name = "服务时长(分钟)", width = 18)
@ApiModelProperty(value = "服务时长(分钟)")
private java.lang.String serviceDuration;
/**
* 体型标签
*/
@ApiModelProperty(value = "体型标签")
private java.lang.String bodyTags;
/**
* 情绪标签
*/
@ApiModelProperty(value = "情绪标签")
private java.lang.String emotionTags;
/**
* 是否删除 0未删除 1删除
*/
@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;
/**
* 已存在服务指令ids 逗号拼接
*/
@TableField(exist = false)
private String existDirectiveIds;
}

View File

@ -0,0 +1,17 @@
package com.nu.modules.canadddirective.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.nu.modules.canadddirective.entity.CanAddDirective;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @Description: 可新增指令
* @Author: jeecg-boot
* @Date: 2025-08-01
* @Version: V1.0
*/
public interface CanAddDirectiveMapper extends BaseMapper<CanAddDirective> {
}

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.canadddirective.mapper.CanAddDirectiveMapper">
</mapper>

View File

@ -0,0 +1,14 @@
package com.nu.modules.canadddirective.service;
import com.nu.modules.canadddirective.entity.CanAddDirective;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @Description: 可新增指令
* @Author: jeecg-boot
* @Date: 2025-08-01
* @Version: V1.0
*/
public interface ICanAddDirectiveService extends IService<CanAddDirective> {
}

View File

@ -0,0 +1,19 @@
package com.nu.modules.canadddirective.service.impl;
import com.nu.modules.canadddirective.entity.CanAddDirective;
import com.nu.modules.canadddirective.mapper.CanAddDirectiveMapper;
import com.nu.modules.canadddirective.service.ICanAddDirectiveService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
* @Description: 可新增指令
* @Author: jeecg-boot
* @Date: 2025-08-01
* @Version: V1.0
*/
@Service
public class CanAddDirectiveServiceImpl extends ServiceImpl<CanAddDirectiveMapper, CanAddDirective> implements ICanAddDirectiveService {
}

View File

@ -0,0 +1,97 @@
package com.nu.modules.directivemedia.controller;
import com.baomidou.dynamic.datasource.annotation.DS;
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.directivemedia.entity.DirectiveMedia;
import com.nu.modules.directivemedia.service.IDirectiveMediaService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.system.query.QueryRuleEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;
/**
* @Description: 服务指令资源管理
* @Author: jeecg-boot
* @Date: 2025-08-18
* @Version: V1.0
*/
@Api(tags = "服务指令资源管理")
@RestController
@RequestMapping("/services/directiveMedia")
@Slf4j
public class DirectiveMediaController extends JeecgController<DirectiveMedia, IDirectiveMediaService> {
@Value("${nu.org.master.code}")
private String masterCode;
@Autowired
private IDirectiveMediaService directiveMediaService;
/**
* 分页列表查询
*
* @param directiveMedia
* @param pageNo
* @param pageSize
* @param req
* @return
*/
//@AutoLog(value = "服务指令资源管理-分页列表查询")
@ApiOperation(value = "服务指令资源管理-分页列表查询", notes = "服务指令资源管理-分页列表查询")
@GetMapping(value = "/list")
@DS("ope")
public Result<IPage<DirectiveMedia>> queryPageList(
DirectiveMedia directiveMedia,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
// 自定义查询规则
Map<String, QueryRuleEnum> customeRuleMap = new HashMap<>();
// 自定义多选的查询规则为LIKE_WITH_OR
customeRuleMap.put("instructionTagId", QueryRuleEnum.LIKE_WITH_OR);
customeRuleMap.put("categoryId", QueryRuleEnum.LIKE_WITH_OR);
customeRuleMap.put("typeId", QueryRuleEnum.LIKE_WITH_OR);
customeRuleMap.put("cycleType", QueryRuleEnum.LIKE_WITH_OR);
QueryWrapper<DirectiveMedia> queryWrapper = QueryGenerator.initQueryWrapper(directiveMedia, req.getParameterMap(), customeRuleMap);
if (StringUtils.isNotBlank(directiveMedia.getExcludeIds())) {
queryWrapper.notIn("directive_id", directiveMedia.getExcludeIds().split(","));
}
Page<DirectiveMedia> page = new Page<DirectiveMedia>(pageNo, pageSize);
IPage<DirectiveMedia> pageList = directiveMediaService.page(page, queryWrapper);
return Result.OK(pageList);
}
/**
* 通过id查询
*
* @param id
* @return
*/
//@AutoLog(value = "服务指令资源管理-通过id查询")
@ApiOperation(value = "服务指令资源管理-通过id查询", notes = "服务指令资源管理-通过id查询")
@GetMapping(value = "/queryById")
public Result<DirectiveMedia> queryById(@RequestParam(name = "id", required = true) String id) {
DirectiveMedia directiveMedia = directiveMediaService.getById(id);
if (directiveMedia == null) {
return Result.error("未找到对应数据");
}
return Result.OK(directiveMedia);
}
}

View File

@ -0,0 +1,150 @@
package com.nu.modules.directivemedia.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.beans.factory.annotation.Value;
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-08-18
* @Version: V1.0
*/
@Data
@TableName("nu_directive_media")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "nu_directive_media对象", description = "服务指令资源管理")
public class DirectiveMedia implements Serializable {
private static final long serialVersionUID = 1L;
/**
* id
*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "id")
private java.lang.String id;
/**
* 服务指令id
*/
@Excel(name = "服务指令id", width = 15)
@ApiModelProperty(value = "服务指令id")
private java.lang.String directiveId;
/**
* 服务指令名称
*/
@Excel(name = "服务指令名称", width = 15)
@ApiModelProperty(value = "服务指令名称")
private java.lang.String directiveName;
/**
* 分类标签id
*/
@Excel(name = "分类标签id", width = 15)
@ApiModelProperty(value = "分类标签id")
//数据源从配置文件读取 - 实验基地机构编码
@Dict(dicCode = "id", dictTable = "nu_config_service_instruction_tag", dicText = "instruction_name", ds = "${nu.org.master.code}")
private java.lang.String instructionTagId;
/**
* 服务类别id
*/
@Excel(name = "服务类别id", width = 15)
@ApiModelProperty(value = "服务类别id")
@Dict(dicCode = "id", dictTable = "nu_config_service_category", dicText = "category_name", ds = "${nu.org.master.code}")
private java.lang.String categoryId;
/**
* 服务类型id
*/
@Excel(name = "服务类型id", width = 15)
@ApiModelProperty(value = "服务类型id")
@Dict(dicCode = "id", dictTable = "nu_config_service_type", dicText = "type_name", ds = "${nu.org.master.code}")
private java.lang.String typeId;
/**
* 周期类型
*/
@Excel(name = "周期类型", width = 15)
@ApiModelProperty(value = "周期类型")
@Dict(dicCode = "period_type", ds = "${nu.org.master.code}")
private java.lang.String cycleType;
/**
* 服务指令图片大图
*/
@Excel(name = "服务指令图片大图", width = 15)
@ApiModelProperty(value = "服务指令图片大图")
private java.lang.String previewFile;
/**
* 服务指令图片大图md5
*/
@ApiModelProperty(value = "服务指令图片大图md5")
private java.lang.String previewFileMd5;
/**
* 服务指令图片小图
*/
@Excel(name = "服务指令图片小图", width = 15)
@ApiModelProperty(value = "服务指令图片小图")
private java.lang.String previewFileSmall;
/**
* 服务指令图片小图md5
*/
@ApiModelProperty(value = "服务指令图片小图md5")
private java.lang.String previewFileSmallMd5;
/**
* 即时指令图标
*/
@Excel(name = "即时指令图标", width = 15)
@ApiModelProperty(value = "即时指令图标")
private java.lang.String immediateFile;
/**
* 即时指令图标md5
*/
@ApiModelProperty(value = "即时指令图标md5")
private java.lang.String immediateFileMd5;
/**
* 指令音频文件
*/
@ApiModelProperty(value = "指令音频文件")
private java.lang.String mp3File;
/**
* 指令音频文件md5
*/
@ApiModelProperty(value = "指令音频文件md5")
private java.lang.String mp3FileMd5;
/**
* 指令视频文件
*/
@ApiModelProperty(value = "指令视频文件")
private java.lang.String mp4File;
/**
* 指令视频文件md5
*/
@ApiModelProperty(value = "指令视频文件md5")
private java.lang.String mp4FileMd5;
/**
* 服务描述
*/
@Excel(name = "服务描述", width = 15)
@ApiModelProperty(value = "服务描述")
private java.lang.String serviceContent;
//媒体资源存储路径名
@TableField(exist = false)
private String mediaFileSavePath;
@TableField(exist = false)
private String excludeIds;//需要排除的ids
}

View File

@ -0,0 +1,17 @@
package com.nu.modules.directivemedia.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.nu.modules.directivemedia.entity.DirectiveMedia;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @Description: 服务指令资源管理
* @Author: jeecg-boot
* @Date: 2025-08-18
* @Version: V1.0
*/
public interface DirectiveMediaMapper extends BaseMapper<DirectiveMedia> {
}

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.directivemedia.mapper.DirectiveMediaMapper">
</mapper>

View File

@ -0,0 +1,16 @@
package com.nu.modules.directivemedia.service;
import com.nu.modules.directivemedia.entity.DirectiveMedia;
import com.baomidou.mybatisplus.extension.service.IService;
import com.nu.modules.servicedirective.entity.ConfigServiceDirective;
/**
* @Description: 服务指令资源管理
* @Author: jeecg-boot
* @Date: 2025-08-18
* @Version: V1.0
*/
public interface IDirectiveMediaService extends IService<DirectiveMedia> {
void handleMediaFile(DirectiveMedia directiveMedia);
}

View File

@ -0,0 +1,73 @@
package com.nu.modules.directivemedia.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.nu.modules.directivemedia.entity.DirectiveMedia;
import com.nu.modules.directivemedia.mapper.DirectiveMediaMapper;
import com.nu.modules.directivemedia.service.IDirectiveMediaService;
import com.nu.utils.NuFileUtils;
import org.springframework.stereotype.Service;
import java.util.Map;
/**
* @Description: 服务指令资源管理
* @Author: jeecg-boot
* @Date: 2025-08-18
* @Version: V1.0
*/
@Service
public class DirectiveMediaServiceImpl extends ServiceImpl<DirectiveMediaMapper, DirectiveMedia> implements IDirectiveMediaService {
/**
* 处理资源文件
* 1检测各资源文件的存储路径是否跟路径字段的值一致
* 2如果不一致1检测缺少的路径新建目录 2然后把资源挪到新路径中 3修改媒体资源对应字段的值的路径名
*
* @param directiveMedia
*/
@Override
public void handleMediaFile(DirectiveMedia directiveMedia) {
//需要存储的路径
String mediaFileSavePath = directiveMedia.getMediaFileSavePath();
//服务指令图片大图
String previewFile = directiveMedia.getPreviewFile();
//服务指令图片小图
String previewFileSmall = directiveMedia.getPreviewFileSmall();
//即时指令图标
String immediateFile = directiveMedia.getImmediateFile();
//指令音频文件
String mp3File = directiveMedia.getMp3File();
//指令视频文件
String mp4File = directiveMedia.getMp4File();
// 处理每个文件并获取更新后的路径
Map<String, String> newPreviewFileMap = NuFileUtils.processFile(mediaFileSavePath, previewFile);
Map<String, String> newPreviewFileSmallMap = NuFileUtils.processFile(mediaFileSavePath, previewFileSmall);
Map<String, String> newImmediateFileMap = NuFileUtils.processFile(mediaFileSavePath, immediateFile);
Map<String, String> newMp3FileMap = NuFileUtils.processFile(mediaFileSavePath, mp3File);
Map<String, String> newMp4FileMap = NuFileUtils.processFile(mediaFileSavePath, mp4File);
// 如果有变化更新directiveMedia对象
if (newPreviewFileMap != null) {
directiveMedia.setPreviewFile(newPreviewFileMap.get("path"));
directiveMedia.setPreviewFileMd5(newPreviewFileMap.get("md5"));
}
if (newPreviewFileSmallMap != null) {
directiveMedia.setPreviewFileSmall(newPreviewFileSmallMap.get("path"));
directiveMedia.setPreviewFileSmallMd5(newPreviewFileSmallMap.get("md5"));
}
if (newImmediateFileMap != null) {
directiveMedia.setImmediateFile(newImmediateFileMap.get("path"));
directiveMedia.setImmediateFileMd5(newImmediateFileMap.get("md5"));
}
if (newMp3FileMap != null) {
directiveMedia.setMp3File(newMp3FileMap.get("path"));
directiveMedia.setMp3FileMd5(newMp3FileMap.get("md5"));
}
if (newMp4FileMap != null) {
directiveMedia.setMp4File(newMp4FileMap.get("path"));
directiveMedia.setMp4FileMd5(newMp4FileMap.get("md5"));
}
}
}

View File

@ -13,6 +13,8 @@ import javax.servlet.http.HttpServletResponse;
import cn.hutool.core.util.IdUtil;
import com.alibaba.fastjson.JSONObject;
import com.nu.dto.InstructionTagMQDto;
import com.nu.utils.RabbitMQUtil;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.api.ISysBaseAPI;
import org.jeecg.common.system.query.QueryGenerator;
@ -32,6 +34,7 @@ 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.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
@ -58,6 +61,8 @@ public class InstructionTagController extends JeecgController<InstructionTag, II
private IInstructionTagService instructionTagService;
@Autowired
private ISysBaseAPI sysBaseAPI;
@Autowired
private RabbitMQUtil rabbitMQUtil;
/**
* 分页列表查询
@ -95,6 +100,9 @@ public class InstructionTagController extends JeecgController<InstructionTag, II
instructionTag.setId(deptInfo.getString("code") + IdUtil.simpleUUID());
instructionTag.setSysOrgCode(deptInfo.getString("code"));
instructionTagService.save(instructionTag);
InstructionTagMQDto instructionTagMQDto = new InstructionTagMQDto();
BeanUtils.copyProperties(instructionTag,instructionTagMQDto);
rabbitMQUtil.sendToExchange("hldy.instructionTag.add.fanout", "", instructionTagMQDto);
return Result.OK("添加成功!");
}

View File

@ -1,19 +1,18 @@
package com.nu.modules.servicedirective.controller;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.IdUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
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.dto.DirectiveAsyncMQDto;
import com.nu.dto.DirectiveMQDto;
import com.nu.enums.MQStatus;
import com.nu.modules.canadddirective.entity.CanAddDirective;
import com.nu.modules.canadddirective.service.ICanAddDirectiveService;
import com.nu.modules.servicedirective.entity.ConfigServiceDirective;
import com.nu.modules.servicedirective.entity.TreeNode;
import com.nu.modules.servicedirective.service.IConfigServiceDirectiveService;
import com.nu.modules.servicetype.entity.ConfigServiceType;
import com.nu.utils.RabbitMQUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -28,15 +27,14 @@ import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.system.query.QueryRuleEnum;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
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;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
/**
@ -56,6 +54,10 @@ public class ConfigServiceDirectiveController extends JeecgController<ConfigServ
private RabbitMQUtil rabbitMQUtil;
@Autowired
private ISysBaseAPI sysBaseAPI;
@Value("${nu.org.master.code}")
private String masterCode;
@Autowired
private ICanAddDirectiveService canAddDirectiveService;
@PostMapping("/tree")
public Result<List<TreeNode>> getTree(@RequestBody ConfigServiceDirective dto) {
@ -111,6 +113,11 @@ public class ConfigServiceDirectiveController extends JeecgController<ConfigServ
queryWrapper.eq("id", "null");
}
}
if (configServiceDirective.isIzAbnormal()) {
queryWrapper.eq("toll_price", new BigDecimal("0"));
queryWrapper.eq("com_price", new BigDecimal("0"));
queryWrapper.eq("service_duration", "0");
}
Page<ConfigServiceDirective> page = new Page<ConfigServiceDirective>(pageNo, pageSize);
IPage<ConfigServiceDirective> list = configServiceDirectiveService.page(page, queryWrapper);
List<ConfigServiceDirective> pageList = service.pageList(configServiceDirective, list);
@ -216,9 +223,48 @@ public class ConfigServiceDirectiveController extends JeecgController<ConfigServ
@ApiOperation(value = "服务指令-添加", notes = "服务指令-添加")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody ConfigServiceDirective configServiceDirective) {
//检查本平台内是否有重复
QueryWrapper<ConfigServiceDirective> qw = new QueryWrapper<>();
qw.eq("instruction_tag_id", configServiceDirective.getInstructionTagId());
qw.eq("category_id", configServiceDirective.getCategoryId());
qw.eq("type_id", configServiceDirective.getTypeId());
qw.eq("directive_name", configServiceDirective.getDirectiveName());
qw.eq("cycle_type", configServiceDirective.getCycleType());
ConfigServiceDirective one = configServiceDirectiveService.getOne(qw);
if (one != null) {
return Result.error("服务指令已存在!");
}
//临时切换至管理平台
DynamicDataSourceContextHolder.push("ope");
List<CanAddDirective> canAddList;
try {
canAddList = canAddDirectiveService.list();
} finally {
//恢复数据源
DynamicDataSourceContextHolder.clear();
}
boolean needSetId = true;
for (int i = 0; i < canAddList.size(); i++) {
CanAddDirective canAddDirective = canAddList.get(i);
if (
canAddDirective.getInstructionTag().equals(configServiceDirective.getInstructionName()) &&
canAddDirective.getCategory().equals(configServiceDirective.getCategoryName()) &&
canAddDirective.getType().equals(configServiceDirective.getTypeName()) &&
canAddDirective.getDirectiveName().equals(configServiceDirective.getDirectiveName()) &&
canAddDirective.getCycleType().equals(configServiceDirective.getCycleTypeName())
) {
needSetId = false;
configServiceDirective.setId(canAddDirective.getDirectiveId());
}
}
//存储机构编码
JSONObject deptInfo = sysBaseAPI.getDeptInfo();
configServiceDirective.setId(deptInfo.getString("code") + IdUtil.simpleUUID());
if (needSetId) {
configServiceDirective.setId(deptInfo.getString("code") + IdUtil.simpleUUID());
}
configServiceDirective.setSysOrgCode(deptInfo.getString("code"));
//设置为未授权
configServiceDirective.setStatus("1");
@ -247,6 +293,53 @@ public class ConfigServiceDirectiveController extends JeecgController<ConfigServ
return Result.OK("添加成功!");
}
/**
* 批量新增
*
* @param list
* @return
*/
@AutoLog(value = "服务指令-批量新增")
@ApiOperation(value = "服务指令-批量新增", notes = "服务指令-批量新增")
@PostMapping(value = "/batchAdd")
public Result<String> batchAdd(@RequestBody List<ConfigServiceDirective> list) {
//设置
Set<String> existIds = configServiceDirectiveService.lambdaQuery()
.select(ConfigServiceDirective::getId)
.list()
.stream()
.map(ConfigServiceDirective::getId)
.collect(Collectors.toSet());
// 2. 过滤出需要新增的数据
List<ConfigServiceDirective> addList = list.stream()
.filter(item -> !existIds.contains(item.getDirectiveId()))
.collect(Collectors.toList());
addList.stream().forEach(d -> {
d.setId(d.getDirectiveId());
d.setTollPrice(new BigDecimal("0"));
d.setComPrice(new BigDecimal("0"));
d.setIzEnabled("1");
d.setServiceDuration("0");
d.setDelFlag("0");
d.setSysOrgCode(masterCode);
d.setStatus("0");
});
configServiceDirectiveService.saveBatch(list);
//同步给管理平台
{
addList.stream().forEach(configServiceDirective -> {
DirectiveAsyncMQDto directiveAsyncMQDto = new DirectiveAsyncMQDto();
BeanUtils.copyProperties(configServiceDirective, directiveAsyncMQDto);
rabbitMQUtil.sendToExchange("hldy.directive", "hldy.directive.newadd", directiveAsyncMQDto);
});
}
return Result.OK("添加成功!");
}
/**
* 编辑
*
@ -375,28 +468,41 @@ public class ConfigServiceDirectiveController extends JeecgController<ConfigServ
}
/**
* 启用/停用分类标签或服务类别或服务类型下所有服务指令
* 启用/停用分类标签或服务类别或服务类型下所有服务指令
*
* @param dto
* @return
*/
@AutoLog(value = "启用/停用分类标签或服务类别或服务类型下所有服务指令")
@ApiOperation(value="服务类别-启用/停用分类标签或服务类别或服务类型下所有服务指令", notes="服务类别-启用/停用分类标签或服务类别或服务类型下所有服务指令")
@RequestMapping(value = "/useOrStopCascade", method = {RequestMethod.PUT,RequestMethod.POST})
@ApiOperation(value = "服务类别-启用/停用分类标签或服务类别或服务类型下所有服务指令", notes = "服务类别-启用/停用分类标签或服务类别或服务类型下所有服务指令")
@RequestMapping(value = "/useOrStopCascade", method = {RequestMethod.PUT, RequestMethod.POST})
public Result<String> useOrStopCascade(@RequestBody ConfigServiceDirective dto) {
QueryWrapper<ConfigServiceDirective> qw = new QueryWrapper<>();
if(StringUtils.isNotBlank(dto.getInstructionTagId())){
qw.eq("instruction_tag_id",dto.getInstructionTagId());
if (StringUtils.isNotBlank(dto.getInstructionTagId())) {
qw.eq("instruction_tag_id", dto.getInstructionTagId());
}
if(StringUtils.isNotBlank(dto.getCategoryId())){
qw.eq("category_id",dto.getCategoryId());
if (StringUtils.isNotBlank(dto.getCategoryId())) {
qw.eq("category_id", dto.getCategoryId());
}
if(StringUtils.isNotBlank(dto.getTypeId())){
qw.eq("type_id",dto.getTypeId());
if (StringUtils.isNotBlank(dto.getTypeId())) {
qw.eq("type_id", dto.getTypeId());
}
ConfigServiceDirective e = new ConfigServiceDirective();
e.setIzEnabled(dto.getIzEnabled());
configServiceDirectiveService.update(e,qw);
configServiceDirectiveService.update(e, qw);
return Result.OK();
}
/**
* 差异比对
* 主指令库跟选中的机构进行比对
*
* @param configServiceDirective
* @return
*/
@ApiOperation(value = "服务指令-差异比对", notes = "服务指令-差异比对")
@GetMapping(value = "/compareList")
public Result<List<ConfigServiceDirective>> compareList(ConfigServiceDirective configServiceDirective) {
return Result.OK(configServiceDirectiveService.compareList(configServiceDirective));
}
}

View File

@ -211,10 +211,21 @@ public class ConfigServiceDirective implements Serializable {
@ApiModelProperty(value = "指令视频文件md5")
private java.lang.String mp4FileMd5;
/**
* 服务指令图片md5
* 服务指令图片大图md5
*/
@ApiModelProperty(value = "服务指令图片md5")
@ApiModelProperty(value = "服务指令图片大图md5")
private java.lang.String previewFileMd5;
/**
* 服务指令图片小图
*/
@Excel(name = "服务指令图片小图", width = 15)
@ApiModelProperty(value = "服务指令图片小图")
private java.lang.String previewFileSmall;
/**
* 服务指令图片小图md5
*/
@ApiModelProperty(value = "服务指令图片小图md5")
private java.lang.String previewFileSmallMd5;
/**
* 即时指令图标md5
*/
@ -287,5 +298,14 @@ public class ConfigServiceDirective implements Serializable {
private String excludeIds;//需要排除的ids
@TableField(exist = false)
private String filterIzEnabled;
@TableField(exist = false)
private String directiveId;
@TableField(exist = false)
private boolean izAbnormal;//查询服务时长收费价格提成价格 都等于 0的数据
@TableField(exist = false)
private String compareOrgCode;//对比的机构编码
@TableField(exist = false)
private boolean ownExist;//本平台是否存在该指令
@TableField(exist = false)
private boolean targetExist;//目标平台是否存在该指令
}

View File

@ -78,4 +78,7 @@ public interface ConfigServiceDirectiveMapper extends BaseMapper<ConfigServiceDi
List<DirectiveEmotionTag> getEmotionTagsByDirective(@Param("id") String directiveId);
List<ConfigServiceDirective> allData();
//字典翻译成中文
List<ConfigServiceDirective> queryAndTranslate(@Param("existIds") String[] existIds);
}

View File

@ -30,10 +30,12 @@
<result property="mp3File" column="mp3_file"/>
<result property="mp4File" column="mp4_file"/>
<result property="previewFile" column="preview_file"/>
<result property="previewFileSmall" column="preview_file_small"/>
<result property="immediateFile" column="immediate_file"/>
<result property="mp3FileMd5" column="mp3_file_md5"/>
<result property="mp4FileMd5" column="mp4_file_md5"/>
<result property="previewFileMd5" column="preview_file_md5"/>
<result property="previewFileSmallMd5" column="preview_file_small_md5"/>
<result property="immediateFileMd5" column="immediate_file_md5"/>
<collection property="bodyTagList" ofType="com.nu.modules.directivetag.body.entity.DirectiveBodyTag">
@ -75,10 +77,12 @@
c.mp3_file,
c.mp4_file,
c.preview_file,
c.preview_file_small,
c.immediate_file,
c.mp3_file_md5,
c.mp4_file_md5,
c.preview_file_md5,
c.preview_file_small_md5,
c.immediate_file_md5,
bodytag.id as bodyTagId,
bodytag.tag_name as bodyTagName,
@ -98,14 +102,16 @@
ORDER BY c.category_id ASC, c.type_id ASC, c.instruction_tag_id ASC,c.create_time desc
</select>
<select id="queryDirectiveIdByBodyTagIds" resultType="com.nu.modules.servicedirective.entity.ConfigServiceDirective">
<select id="queryDirectiveIdByBodyTagIds"
resultType="com.nu.modules.servicedirective.entity.ConfigServiceDirective">
SELECT distinct directive_id as id FROM nu_directive_body_tag WHERE tag_id IN
<foreach collection="tagIds.split(',')" item="tagId" open="(" separator="," close=")">
#{tagId}
</foreach>
</select>
<select id="queryDirectiveIdByEmotionTagIds" resultType="com.nu.modules.servicedirective.entity.ConfigServiceDirective">
<select id="queryDirectiveIdByEmotionTagIds"
resultType="com.nu.modules.servicedirective.entity.ConfigServiceDirective">
SELECT distinct directive_id as id FROM nu_directive_emotion_tag WHERE tag_id IN
<foreach collection="tagIds.split(',')" item="tagId" open="(" separator="," close=")">
#{tagId}
@ -153,25 +159,35 @@
</insert>
<delete id="removeAll">
delete from nu_config_service_directive
delete
from nu_config_service_directive
</delete>
<!-- Result map 映射 ConfigServiceDirective 包含标签列表 -->
<resultMap id="DirectiveWithTagsMap" type="com.nu.modules.servicedirective.entity.ConfigServiceDirective">
<id column="id" property="id" />
<result column="directive_name" property="directiveName" />
<result column="category_id" property="categoryId" />
<result column="type_id" property="typeId" />
<result column="cycle_type" property="cycleType" />
<id column="id" property="id"/>
<result column="directive_name" property="directiveName"/>
<result column="category_id" property="categoryId"/>
<result column="type_id" property="typeId"/>
<result column="cycle_type" property="cycleType"/>
<!-- 一级、二级、三级 ID 可根据需要添加 -->
<collection property="bodyTagList" ofType="com.nu.modules.directivetag.body.entity.DirectiveBodyTag" select="getBodyTagsByDirective" column="id"/>
<collection property="emotionTagList" ofType="com.nu.modules.directivetag.emotion.entity.DirectiveEmotionTag" select="getEmotionTagsByDirective" column="id"/>
<collection property="bodyTagList" ofType="com.nu.modules.directivetag.body.entity.DirectiveBodyTag"
select="getBodyTagsByDirective" column="id"/>
<collection property="emotionTagList" ofType="com.nu.modules.directivetag.emotion.entity.DirectiveEmotionTag"
select="getEmotionTagsByDirective" column="id"/>
</resultMap>
<!-- 查询未删除的服务指令,并映射标签 -->
<select id="getActiveDirectivesWithTags" resultMap="DirectiveWithTagsMap">
SELECT id, instruction_tag_id, category_id, type_id, directive_name, sort, iz_enabled,cycle_type
SELECT id,
instruction_tag_id,
category_id,
type_id,
directive_name,
sort,
iz_enabled,
cycle_type
FROM nu_config_service_directive
WHERE del_flag = '0'
ORDER BY sort ASC
@ -203,17 +219,46 @@
<select id="getBodyTagsByDirective" resultType="com.nu.modules.directivetag.body.entity.DirectiveBodyTag">
SELECT bt.id, bt.tag_name, bt.sort, bt.iz_enabled
FROM nu_config_body_tag bt
INNER JOIN nu_directive_body_tag dbt ON bt.id = dbt.tag_id
INNER JOIN nu_directive_body_tag dbt ON bt.id = dbt.tag_id
WHERE dbt.directive_id = #{directiveId}
</select>
<select id="getEmotionTagsByDirective" resultType="com.nu.modules.directivetag.emotion.entity.DirectiveEmotionTag">
SELECT et.id, et.tag_name, et.sort, et.iz_enabled
FROM nu_config_emotion_tag et
INNER JOIN nu_directive_emotion_tag det ON et.id = det.tag_id
INNER JOIN nu_directive_emotion_tag det ON et.id = det.tag_id
WHERE det.directive_id = #{directiveId}
</select>
<select id="allData" resultType="com.nu.modules.servicedirective.entity.ConfigServiceDirective">
select id from nu_config_service_directive
</select>
select id
from nu_config_service_directive
</select>
<select id="queryAndTranslate" resultType="com.nu.modules.servicedirective.entity.ConfigServiceDirective">
select
m.id,
i.instruction_name as instructionName,
c.category_name as categoryName,
t.type_name as typeName,
m.directive_name,
dic.dit as cycleTypeName
from nu_config_service_directive m
left join nu_config_service_instruction_tag i on m.instruction_tag_id = i.id
left join nu_config_service_category c on m.category_id = c.id
left join nu_config_service_type t on m.type_id = t.id
left join (select di.item_value as diva, di.item_text as dit
from sys_dict d
left join sys_dict_item di on d.id = di.dict_id where d.dict_code = 'period_type') dic
on m.cycle_type = dic.diva
<where>
m.iz_enabled = '0'
<if test="existIds != null and existIds.length > 0">
AND m.id NOT IN
<foreach collection="existIds" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
</where>
order by m.create_time desc
</select>
</mapper>

View File

@ -6,6 +6,7 @@ import com.nu.dto.DirectiveAsyncMQDto;
import com.nu.dto.DirectiveMQDto;
import com.nu.modules.servicedirective.entity.ConfigServiceDirective;
import com.nu.modules.servicedirective.entity.TreeNode;
import org.apache.commons.compress.utils.Lists;
import java.util.List;
@ -68,4 +69,6 @@ public interface IConfigServiceDirectiveService extends IService<ConfigServiceDi
List<ConfigServiceDirective> allData();
DirectiveMQDto syncDirective(String sourceOrgCode, String syncIds);
List<ConfigServiceDirective> compareList(ConfigServiceDirective configServiceDirective);
}

View File

@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fasterxml.jackson.core.type.TypeReference;
import com.google.common.collect.Maps;
import com.nu.dto.*;
import com.nu.enums.MQStatus;
@ -279,9 +280,11 @@ public class ConfigServiceDirectiveServiceImpl extends ServiceImpl<ConfigService
@Override
public void handleMediaFile(ConfigServiceDirective configServiceDirective) {
//需要存储的路径
String mediaFileSavePath = configServiceDirective.getMediaFileSavePath() + configServiceDirective.getId();
//服务指令图片
String mediaFileSavePath = configServiceDirective.getMediaFileSavePath();
//服务指令图片大图
String previewFile = configServiceDirective.getPreviewFile();
//服务指令图片小图
String previewFileSmall = configServiceDirective.getPreviewFileSmall();
//即时指令图标
String immediateFile = configServiceDirective.getImmediateFile();
//指令音频文件
@ -561,4 +564,81 @@ public class ConfigServiceDirectiveServiceImpl extends ServiceImpl<ConfigService
return directiveMQDto;
}
@Override
public List<ConfigServiceDirective> compareList(ConfigServiceDirective configServiceDirective) {
List<ConfigServiceDirective> result = Lists.newArrayList();
//查询本平台的已有指令
List<ConfigServiceDirective> ownList = baseMapper.queryAndTranslate(null);
String existIds = "";
if (ownList != null && ownList.size() > 0) {
existIds = ownList.stream()
.map(l -> l.getId())
.map(String::valueOf)
.collect(Collectors.joining(","));
}
// 查询目标平台已有指令
//各平台api地址都存在管理系统中 管理系统api地址在系统参数配置中 ope_open_url
JSONObject opeOpenUrl = sysConfigApi.getByKeyByDS("master", "ope_open_url");
String opeApiAddress = opeOpenUrl.getString("configValue");
if (opeApiAddress.endsWith("/")) {
opeApiAddress = opeApiAddress.substring(0, opeApiAddress.length() - 1);
}
String apiAddress = opeApiAddress + "/api/services/directive/queryCompareDirectives?orgCode=" + configServiceDirective.getCompareOrgCode();
List<ConfigServiceDirective> targetList = Lists.newArrayList();
try {
String res = HttpRequestUtil.doGet(apiAddress, HttpRequestUtil.createDefaultHeaders());
JSONObject jsonResponse = JSON.parseObject(res);
JSONObject r_ = jsonResponse.getJSONObject("result");
targetList = r_.getJSONArray("list")
.toJavaList(ConfigServiceDirective.class);
} catch (Exception e) {
e.printStackTrace();
}
Map<String, ConfigServiceDirective> merged = new LinkedHashMap<>();
// 先把本平台的放进去标记 ownExist = true, targetExist = false
if (ownList != null) {
for (ConfigServiceDirective o : ownList) {
if (o == null || o.getId() == null) continue;
String id = String.valueOf(o.getId());
// 直接在原对象上设置标志如果不想修改原对象请复制对象
o.setOwnExist(true);
o.setTargetExist(false);
merged.put(id, o);
}
}
// 再处理目标平台的数据若已存在则把 targetExist true否则加入并标记为仅 target
if (targetList != null) {
for (ConfigServiceDirective t : targetList) {
if (t == null || t.getId() == null) continue;
String id = String.valueOf(t.getId());
if (merged.containsKey(id)) {
// 本平台已有标记目标平台也存在
merged.get(id).setTargetExist(true);
} else {
// 仅目标平台有
t.setOwnExist(false);
t.setTargetExist(true);
merged.put(id, t);
}
}
}
// 把合并后的值放到列表并按需求排序both -> own only -> target only
result = new ArrayList<>(merged.values());
result.sort(Comparator.comparingInt(d -> {
boolean own = Boolean.TRUE.equals(d.isOwnExist());
boolean target = Boolean.TRUE.equals(d.isTargetExist());
if (own && target) return 0; // 两个平台都有 -> 最前
if (own) return 1; // 仅本平台有 -> 中间
return 2; // 仅目标平台有 -> 最后
}));
return result;
}
}

View File

@ -129,6 +129,10 @@ public class DirectiveMQListener {
QueryWrapper<ConfigServiceDirective> qw = new QueryWrapper<>();
qw.eq("id", dto.getId());
ConfigServiceDirective currentDirective = directiveService.getOne(qw);
if (mqDto.isIzDirectiveMedia() && currentDirective == null) {
//管理平台服务指令媒体资源管理功能发起的本地未必会有对应指令没有的话只保存物理文件
currentDirective = new ConfigServiceDirective();
}
//更新服务指令媒体资源字段
ConfigServiceDirective configServiceDirective = new ConfigServiceDirective();
@ -140,7 +144,7 @@ public class DirectiveMQListener {
//接口协议域名+上下文访问路径
String baseUrl = dto.getApi();
//处理服务指令图片
//处理服务指令图片大图
if (StringUtils.isNotBlank(dto.getPreviewFileMd5()) && !dto.getPreviewFileMd5().equals(currentDirective.getPreviewFileMd5())) {
String previewFile = dto.getPreviewFile();
if (StringUtils.isNotBlank(previewFile)) {
@ -155,14 +159,40 @@ public class DirectiveMQListener {
}
try {
FileDownloader.downloadFile(url, upLoadPath + File.separator + filePath, fileName);
configServiceDirective.setPreviewFile(dto.getPreviewFile());//服务指令图片
configServiceDirective.setPreviewFile(dto.getPreviewFile());//服务指令图片大图
configServiceDirective.setPreviewFileMd5(dto.getPreviewFileMd5());
} catch (Exception e) {
e.printStackTrace();
MediaAsyncErrorLog mediaAsyncErrorLog = new MediaAsyncErrorLog();
mediaAsyncErrorLog.setMediaid(previewFile);
mediaAsyncErrorLogService.save(mediaAsyncErrorLog);
throw new RuntimeException("服务指令图片文件拉取错误,指令id" + currentDirective.getId());
throw new RuntimeException("服务指令图片大图文件拉取错误,指令id" + dto.getId());
}
}
}
//处理服务指令图片小图
if (StringUtils.isNotBlank(dto.getPreviewFileSmallMd5()) && !dto.getPreviewFileSmallMd5().equals(currentDirective.getPreviewFileSmallMd5())) {
String previewFileSmall = dto.getPreviewFileSmall();
if (StringUtils.isNotBlank(previewFileSmall)) {
String url = baseUrl + "/sys/common/open/static/" + URLEncoder.encode(previewFileSmall, StandardCharsets.UTF_8).replace("%2F", "/") + "?name=" + SafetyUtil.getSecureKey();
if (upLoadPath.endsWith("/") || upLoadPath.endsWith("\\")) {
upLoadPath = upLoadPath.substring(0, upLoadPath.length() - 1);
}
String filePath = previewFileSmall.substring(0, previewFileSmall.lastIndexOf("/"));
String fileName = previewFileSmall.substring(previewFileSmall.lastIndexOf("/") + 1);
if (filePath.startsWith("/") || filePath.startsWith("\\")) {
filePath = filePath.substring(1);
}
try {
FileDownloader.downloadFile(url, upLoadPath + File.separator + filePath, fileName);
configServiceDirective.setPreviewFileSmall(dto.getPreviewFileSmall());//服务指令图片小图
configServiceDirective.setPreviewFileSmallMd5(dto.getPreviewFileSmallMd5());
} catch (Exception e) {
e.printStackTrace();
MediaAsyncErrorLog mediaAsyncErrorLog = new MediaAsyncErrorLog();
mediaAsyncErrorLog.setMediaid(previewFileSmall);
mediaAsyncErrorLogService.save(mediaAsyncErrorLog);
throw new RuntimeException("服务指令图片小图文件拉取错误,指令id" + dto.getId());
}
}
}
@ -188,7 +218,7 @@ public class DirectiveMQListener {
mediaAsyncErrorLog.setMediaid(immediateFile);
mediaAsyncErrorLogService.save(mediaAsyncErrorLog);
e.printStackTrace();
throw new RuntimeException("即时指令图标文件拉取错误,指令id" + currentDirective.getId());
throw new RuntimeException("即时指令图标文件拉取错误,指令id" + dto.getId());
}
}
}
@ -214,7 +244,7 @@ public class DirectiveMQListener {
mediaAsyncErrorLog.setMediaid(mp3File);
mediaAsyncErrorLogService.save(mediaAsyncErrorLog);
e.printStackTrace();
throw new RuntimeException("指令音频文件拉取错误,指令id" + currentDirective.getId());
throw new RuntimeException("指令音频文件拉取错误,指令id" + dto.getId());
}
}
}
@ -240,7 +270,7 @@ public class DirectiveMQListener {
mediaAsyncErrorLog.setMediaid(mp4File);
mediaAsyncErrorLogService.save(mediaAsyncErrorLog);
e.printStackTrace();
throw new RuntimeException("指令视频文件拉取错误,指令id" + currentDirective.getId());
throw new RuntimeException("指令视频文件拉取错误,指令id" + dto.getId());
}
}
}
@ -877,7 +907,7 @@ public class DirectiveMQListener {
//接口协议域名+上下文访问路径
String baseUrl = apiAddress;
//处理服务指令图片
//处理服务指令图片大图
if (!dto.getPreviewFileMd5().equals(currentDirective.getPreviewFileMd5())) {
String previewFile = dto.getPreviewFile();
if (StringUtils.isNotBlank(previewFile)) {
@ -892,14 +922,40 @@ public class DirectiveMQListener {
}
try {
FileDownloader.downloadFile(url, upLoadPath + File.separator + filePath, fileName);
configServiceDirective.setPreviewFile(dto.getPreviewFile());//服务指令图片
configServiceDirective.setPreviewFile(dto.getPreviewFile());//服务指令图片大图
configServiceDirective.setPreviewFileMd5(dto.getPreviewFileMd5());
} catch (Exception e) {
e.printStackTrace();
MediaAsyncErrorLog mediaAsyncErrorLog = new MediaAsyncErrorLog();
mediaAsyncErrorLog.setMediaid(previewFile);
mediaAsyncErrorLogService.save(mediaAsyncErrorLog);
throw new RuntimeException("服务指令图片文件拉取错误,指令id" + currentDirective.getId());
throw new RuntimeException("服务指令图片大图文件拉取错误,指令id" + dto.getId());
}
}
}
//处理服务指令图片小图
if (StringUtils.isNotBlank(dto.getPreviewFileSmallMd5()) && !dto.getPreviewFileSmallMd5().equals(currentDirective.getPreviewFileSmallMd5())) {
String previewFileSmall = dto.getPreviewFileSmallMd5();
if (StringUtils.isNotBlank(previewFileSmall)) {
String url = baseUrl + "/sys/common/open/static/" + URLEncoder.encode(previewFileSmall, StandardCharsets.UTF_8).replace("%2F", "/") + "?name=" + SafetyUtil.getSecureKey();
if (upLoadPath.endsWith("/") || upLoadPath.endsWith("\\")) {
upLoadPath = upLoadPath.substring(0, upLoadPath.length() - 1);
}
String filePath = previewFileSmall.substring(0, previewFileSmall.lastIndexOf("/"));
String fileName = previewFileSmall.substring(previewFileSmall.lastIndexOf("/") + 1);
if (filePath.startsWith("/") || filePath.startsWith("\\")) {
filePath = filePath.substring(1);
}
try {
FileDownloader.downloadFile(url, upLoadPath + File.separator + filePath, fileName);
configServiceDirective.setPreviewFileSmall(dto.getPreviewFileSmall());//服务指令图片小图
configServiceDirective.setPreviewFileSmallMd5(dto.getPreviewFileSmallMd5());
} catch (Exception e) {
e.printStackTrace();
MediaAsyncErrorLog mediaAsyncErrorLog = new MediaAsyncErrorLog();
mediaAsyncErrorLog.setMediaid(previewFileSmall);
mediaAsyncErrorLogService.save(mediaAsyncErrorLog);
throw new RuntimeException("服务指令图片小图文件拉取错误,指令id" + dto.getId());
}
}
}
@ -925,7 +981,7 @@ public class DirectiveMQListener {
mediaAsyncErrorLog.setMediaid(immediateFile);
mediaAsyncErrorLogService.save(mediaAsyncErrorLog);
e.printStackTrace();
throw new RuntimeException("即时指令图标文件拉取错误,指令id" + currentDirective.getId());
throw new RuntimeException("即时指令图标文件拉取错误,指令id" + dto.getId());
}
}
}
@ -951,7 +1007,7 @@ public class DirectiveMQListener {
mediaAsyncErrorLog.setMediaid(mp3File);
mediaAsyncErrorLogService.save(mediaAsyncErrorLog);
e.printStackTrace();
throw new RuntimeException("指令音频文件拉取错误,指令id" + currentDirective.getId());
throw new RuntimeException("指令音频文件拉取错误,指令id" + dto.getId());
}
}
}
@ -977,7 +1033,7 @@ public class DirectiveMQListener {
mediaAsyncErrorLog.setMediaid(mp4File);
mediaAsyncErrorLogService.save(mediaAsyncErrorLog);
e.printStackTrace();
throw new RuntimeException("指令视频文件拉取错误,指令id" + currentDirective.getId());
throw new RuntimeException("指令视频文件拉取错误,指令id" + dto.getId());
}
}
}

View File

@ -0,0 +1,28 @@
package com.nu.mq.instructiontag.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("instructionTagMQErrorHandler")
public class InstructionTagMQExceptionHandler 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,49 @@
package com.nu.mq.instructiontag.listener;
import com.nu.dto.InstructionTagMQDto;
import com.nu.modules.instructiontag.entity.InstructionTag;
import com.nu.modules.instructiontag.service.IInstructionTagService;
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.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Slf4j
@Component
public class InstructionTagMQListener {
@Autowired
private IInstructionTagService instructionTagService;
/**
* 主指令库新增分类标签后通知所有业务平台进行新增处理增量
*
* @param dto
*/
@RabbitListener(
bindings = @QueueBinding(
value = @Queue(
name = "#{T(java.util.UUID).randomUUID().toString()}",
autoDelete = "true"
),
exchange = @Exchange(
name = "hldy.instructionTag.add.fanout",
type = ExchangeTypes.FANOUT
)
), errorHandler = "instructionTagMQErrorHandler"
)
public void addInstructionMq(InstructionTagMQDto dto) {
InstructionTag r_ = instructionTagService.lambdaQuery().eq(InstructionTag::getId, dto.getId()).one();
if (r_ == null) {
InstructionTag instructionTag = new InstructionTag();
BeanUtils.copyProperties(dto, instructionTag);
instructionTagService.save(instructionTag);
}
}
}

View File

@ -403,3 +403,9 @@ wxpay:
notify-domain: https://www.focusnu.com/nursing-unit_0010507/weiXinPay/callback
# 商户私钥文件路径
private-key-path: /opt/nu001/apiclient_key.pem
nu:
org:
#试验机构信息
master:
code: 101

View File

@ -403,3 +403,9 @@ wxpay:
notify-domain: https://www.focusnu.com/nursing-unit_0010507/weiXinPay/callback
# 商户私钥文件路径
private-key-path: /opt/nu001/apiclient_key.pem
nu:
org:
#试验机构信息
master:
code: 101

View File

@ -406,3 +406,9 @@ wxpay:
notify-domain: https://www.focusnu.com/nursing-unit_0010507/weiXinPay/wx/callback
# 商户私钥文件路径
private-key-path: c://apiclient_key.pem
nu:
org:
#试验机构信息
master:
code: 101

View File

@ -403,3 +403,9 @@ wxpay:
notify-domain: https://www.focusnu.com/nursing-unit_0010507/weiXinPay/callback
# 商户私钥文件路径
private-key-path: /opt/nu001/apiclient_key.pem
nu:
org:
#试验机构信息
master:
code: 101

View File

@ -403,3 +403,9 @@ wxpay:
notify-domain: https://www.focusnu.com/nursing-unit_0010507/weiXinPay/callback
# 商户私钥文件路径
private-key-path: /opt/nu001/apiclient_key.pem
nu:
org:
#试验机构信息
master:
code: 101

View File

@ -403,3 +403,9 @@ wxpay:
notify-domain: https://www.focusnu.com/nursing-unit_0010507/weiXinPay/callback
# 商户私钥文件路径
private-key-path: /opt/nu001/apiclient_key.pem
nu:
org:
#试验机构信息
master:
code: 101