服务指令功能完善
This commit is contained in:
parent
dafe6f3c88
commit
dbe6dc1124
|
@ -0,0 +1,137 @@
|
|||
package com.nu.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @Description: 服务指令审核
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-07-14
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
public class DirectiveAsyncMQDto implements Serializable {
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private String id;
|
||||
/**
|
||||
* 服务类别id
|
||||
*/
|
||||
private String categoryId;
|
||||
/**
|
||||
* 服务类型id
|
||||
*/
|
||||
private String typeId;
|
||||
/**
|
||||
* 分类标签
|
||||
*/
|
||||
private String instructionTagId;
|
||||
/**
|
||||
* 服务指令名称
|
||||
*/
|
||||
private String directiveName;
|
||||
/**
|
||||
* 收费价格
|
||||
*/
|
||||
private java.math.BigDecimal tollPrice;
|
||||
/**
|
||||
* 提成价格
|
||||
*/
|
||||
private java.math.BigDecimal comPrice;
|
||||
/**
|
||||
* 是否参与医保报销 0不报销 1报销
|
||||
*/
|
||||
private String izReimbursement;
|
||||
/**
|
||||
* 是否参与机构优惠 0不参与 1参与
|
||||
*/
|
||||
private String izPreferential;
|
||||
/**
|
||||
* 收费频次 1按次收费 2按天收费
|
||||
*/
|
||||
private String chargingFrequency;
|
||||
/**
|
||||
* 周期类型 1日常护理 2周期护理 3即时护理
|
||||
*/
|
||||
private String cycleType;
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
/**
|
||||
* 服务描述
|
||||
*/
|
||||
private String serviceContent;
|
||||
/**
|
||||
* 服务时长(分钟)
|
||||
*/
|
||||
private String serviceDuration;
|
||||
/**
|
||||
* 指令状态
|
||||
*/
|
||||
private String status;
|
||||
/**
|
||||
* 是否启用 0启用 1未启用
|
||||
*/
|
||||
private String izEnabled;
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
private String delFlag;
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String createBy;
|
||||
/**
|
||||
* 创建日期
|
||||
*/
|
||||
private java.util.Date createTime;
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
private String updateBy;
|
||||
/**
|
||||
* 更新日期
|
||||
*/
|
||||
private java.util.Date updateTime;
|
||||
/**
|
||||
* 所属部门
|
||||
*/
|
||||
private String sysOrgCode;
|
||||
/**
|
||||
* 指令音频文件
|
||||
*/
|
||||
private String mp3File;
|
||||
/**
|
||||
* 指令视频文件
|
||||
*/
|
||||
private String mp4File;
|
||||
/**
|
||||
* 服务指令图片
|
||||
*/
|
||||
private String previewFile;
|
||||
/**
|
||||
* 即时指令图标
|
||||
*/
|
||||
private String immediateFile;
|
||||
|
||||
|
||||
//分类标签中文名称
|
||||
private String instructionName;
|
||||
//服务类别中文名称
|
||||
private String categoryName;
|
||||
//服务类型中文名称
|
||||
private String typeName;
|
||||
//周期类型中文名称
|
||||
private String cycleTypeName;
|
||||
//体型标签id,id,id
|
||||
private String bodyTags;
|
||||
//情绪标签id,id,id
|
||||
private String emotionTags;
|
||||
//体型标签json字符串(有id、label)
|
||||
private String bodyTagsObj;
|
||||
//情绪标签json字符串(有id、label)
|
||||
private String emotionTagsObj;
|
||||
}
|
|
@ -42,6 +42,11 @@ public class DirectiveBodyTag implements Serializable {
|
|||
@Excel(name = "排序", width = 15)
|
||||
@ApiModelProperty(value = "排序")
|
||||
private Integer sort;
|
||||
/**状态 0已授权 1未授权*/
|
||||
@Excel(name = "状态 0已授权 1未授权", width = 15)
|
||||
@ApiModelProperty(value = "状态 0已授权 1未授权")
|
||||
@Dict(dicCode = "status")
|
||||
private java.lang.String status;
|
||||
/**是否启用 0启用 1未启用*/
|
||||
@Excel(name = "是否启用", width = 15, dicCode = "iz_enabled")
|
||||
@Dict(dicCode = "iz_enabled")
|
||||
|
|
|
@ -13,9 +13,8 @@ import java.util.List;
|
|||
* @Version: V1.0
|
||||
*/
|
||||
public interface DirectiveBodyTagRelationMapper extends BaseMapper<DirectiveBodyTagRelation> {
|
||||
void removeAll();
|
||||
|
||||
void removeAllRelation();
|
||||
void removeAllRelation(@Param("directiveId") String directiveId);
|
||||
|
||||
List<DirectiveBodyTagRelation> selectAllRelation(@Param("ids") List<String> ids,@Param("excludeIds") List<String> excludeIds);
|
||||
}
|
||||
|
|
|
@ -1,14 +1,12 @@
|
|||
<?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.directivetag.body.mapper.DirectiveBodyTagRelationMapper">
|
||||
<delete id="removeAll">
|
||||
delete from nu_config_body_tag
|
||||
</delete>
|
||||
|
||||
<delete id="removeAllRelation">
|
||||
delete from nu_directive_body_tag
|
||||
delete from nu_directive_body_tag where directive_id = #{directiveId}
|
||||
</delete>
|
||||
|
||||
|
||||
<select id="selectAllRelation" resultType="com.nu.modules.directivetag.body.entity.DirectiveBodyTagRelation">
|
||||
select * from nu_directive_body_tag
|
||||
<where>
|
||||
|
|
|
@ -21,7 +21,7 @@ public interface IDirectiveBodyTagService extends IService<DirectiveBodyTag> {
|
|||
*/
|
||||
boolean isUsed(String id);
|
||||
|
||||
public void removeAllRelation();
|
||||
public void removeAllByDirectiveId(String directiveId);
|
||||
|
||||
public List<DirectiveBodyTagRelation> selectAllRelation(String dataSourceCode, List<String> ids,List<String> excludeIds);
|
||||
|
||||
|
|
|
@ -44,9 +44,8 @@ public class DirectiveBodyTagServiceImpl extends ServiceImpl<DirectiveBodyTagMap
|
|||
}
|
||||
|
||||
@Override
|
||||
public void removeAllRelation() {
|
||||
tagRelationMapper.removeAll();
|
||||
tagRelationMapper.removeAllRelation();
|
||||
public void removeAllByDirectiveId(String directiveId) {
|
||||
tagRelationMapper.removeAllRelation(directiveId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -42,6 +42,11 @@ public class DirectiveEmotionTag implements Serializable {
|
|||
@Excel(name = "排序", width = 15)
|
||||
@ApiModelProperty(value = "排序")
|
||||
private java.lang.Integer sort;
|
||||
/**状态 0已授权 1未授权*/
|
||||
@Excel(name = "状态 0已授权 1未授权", width = 15)
|
||||
@ApiModelProperty(value = "状态 0已授权 1未授权")
|
||||
@Dict(dicCode = "status")
|
||||
private java.lang.String status;
|
||||
/**是否启用 0启用 1未启用*/
|
||||
@Excel(name = "是否启用", width = 15, dicCode = "iz_enabled")
|
||||
@Dict(dicCode = "iz_enabled")
|
||||
|
|
|
@ -14,9 +14,8 @@ import java.util.List;
|
|||
*/
|
||||
public interface DirectiveEmotionTagRelationMapper extends BaseMapper<DirectiveEmotionTagRelation> {
|
||||
|
||||
void removeAll();
|
||||
|
||||
void removeAllRelation();
|
||||
void removeAllRelation(@Param("directiveId") String directiveId);
|
||||
|
||||
List<DirectiveEmotionTagRelation> selectAllRelation(@Param("ids") List<String> ids, @Param("excludeIds") List<String> excludeIds);
|
||||
}
|
||||
|
|
|
@ -1,13 +1,9 @@
|
|||
<?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.directivetag.emotion.mapper.DirectiveEmotionTagRelationMapper">
|
||||
<delete id="removeAll">
|
||||
delete
|
||||
from nu_config_emotion_tag
|
||||
</delete>
|
||||
<delete id="removeAllRelation">
|
||||
delete
|
||||
from nu_directive_emotion_tag
|
||||
from nu_directive_emotion_tag where directive_id = #{directiveId}
|
||||
</delete>
|
||||
<select id="selectAllRelation" resultType="com.nu.modules.directivetag.emotion.entity.DirectiveEmotionTagRelation">
|
||||
select * from nu_directive_emotion_tag
|
||||
|
|
|
@ -21,7 +21,7 @@ public interface IDirectiveEmotionTagService extends IService<DirectiveEmotionTa
|
|||
*/
|
||||
boolean isUsed(String id);
|
||||
|
||||
public void removeAllRelation();
|
||||
public void removeAllByDirectiveId(String directiveId);
|
||||
|
||||
public List<DirectiveEmotionTagRelation> selectAllRelation(String dataSourceCode, List<String> ids,List<String> excludeIds);
|
||||
|
||||
|
|
|
@ -44,9 +44,8 @@ public class DirectiveEmotionTagServiceImpl extends ServiceImpl<DirectiveEmotion
|
|||
}
|
||||
|
||||
@Override
|
||||
public void removeAllRelation() {
|
||||
tagRelationMapper.removeAll();
|
||||
tagRelationMapper.removeAllRelation();
|
||||
public void removeAllByDirectiveId(String directiveId) {
|
||||
tagRelationMapper.removeAllRelation(directiveId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -46,6 +46,11 @@ public class InstructionTag implements Serializable {
|
|||
@Excel(name = "排序", width = 15)
|
||||
@ApiModelProperty(value = "排序")
|
||||
private java.lang.Integer sort;
|
||||
/**状态 0已授权 1未授权*/
|
||||
@Excel(name = "状态 0已授权 1未授权", width = 15)
|
||||
@ApiModelProperty(value = "状态 0已授权 1未授权")
|
||||
@Dict(dicCode = "status")
|
||||
private java.lang.String status;
|
||||
/**是否启用 0启用 1未启用*/
|
||||
@Excel(name = "是否启用", width = 15)
|
||||
@ApiModelProperty(value = "是否启用")
|
||||
|
|
|
@ -47,6 +47,11 @@ public class ConfigServiceCategory implements Serializable {
|
|||
@Excel(name = "排序", width = 15)
|
||||
@ApiModelProperty(value = "排序")
|
||||
private java.lang.Integer sort;
|
||||
/**状态 0已授权 1未授权*/
|
||||
@Excel(name = "状态 0已授权 1未授权", width = 15)
|
||||
@ApiModelProperty(value = "状态 0已授权 1未授权")
|
||||
@Dict(dicCode = "status")
|
||||
private java.lang.String status;
|
||||
/**是否启用 0启用 1未启用*/
|
||||
@Excel(name = "是否启用", width = 15)
|
||||
@ApiModelProperty(value = "是否启用")
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
package com.nu.modules.servicedirective.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
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.beust.jcommander.internal.Maps;
|
||||
import com.nu.dto.DirectiveAsyncMQDto;
|
||||
import com.nu.modules.servicedirective.entity.ConfigServiceDirective;
|
||||
import com.nu.modules.servicedirective.service.IConfigServiceDirectiveService;
|
||||
import com.nu.modules.sysconfig.ISysConfigApi;
|
||||
import com.nu.utils.RabbitMQUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
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.jeecg.common.system.query.QueryRuleEnum;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
@ -43,6 +43,8 @@ import java.util.stream.Collectors;
|
|||
public class ConfigServiceDirectiveController extends JeecgController<ConfigServiceDirective, IConfigServiceDirectiveService> {
|
||||
@Autowired
|
||||
private IConfigServiceDirectiveService configServiceDirectiveService;
|
||||
@Autowired
|
||||
private RabbitMQUtil rabbitMQUtil;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
|
@ -92,6 +94,12 @@ public class ConfigServiceDirectiveController extends JeecgController<ConfigServ
|
|||
queryWrapper.eq("id", "null");
|
||||
}
|
||||
}
|
||||
//只查询已授权(status = 0)
|
||||
if (StringUtils.isNotBlank(configServiceDirective.getStatus())) {
|
||||
queryWrapper.in("status", configServiceDirective.getStatus().split(","));
|
||||
} else {
|
||||
queryWrapper.in("status", new String[]{"0", "2"});
|
||||
}
|
||||
Page<ConfigServiceDirective> page = new Page<ConfigServiceDirective>(pageNo, pageSize);
|
||||
IPage<ConfigServiceDirective> list = configServiceDirectiveService.page(page, queryWrapper);
|
||||
List<ConfigServiceDirective> pageList = service.pageList(configServiceDirective, list);
|
||||
|
@ -111,7 +119,6 @@ public class ConfigServiceDirectiveController extends JeecgController<ConfigServ
|
|||
public Result<String> add(@RequestBody ConfigServiceDirective configServiceDirective) {
|
||||
//处理媒体资源(放在保存方法之前)
|
||||
configServiceDirectiveService.handleMediaFile(configServiceDirective);
|
||||
log.info("服务指令保存时,pre:{},immedia:{},mp3:{},mp4:{}",configServiceDirective.getPreviewFile(),configServiceDirective.getImmediateFile(),configServiceDirective.getMp3File(),configServiceDirective.getMp4File());
|
||||
configServiceDirectiveService.save(configServiceDirective);
|
||||
if (StringUtils.isNotBlank(configServiceDirective.getBodyTags())) {
|
||||
configServiceDirectiveService.saveBodyTags(configServiceDirective);
|
||||
|
@ -139,7 +146,6 @@ public class ConfigServiceDirectiveController extends JeecgController<ConfigServ
|
|||
public Result<String> edit(@RequestBody ConfigServiceDirective configServiceDirective) {
|
||||
//处理媒体资源(放在保存方法之前)
|
||||
configServiceDirectiveService.handleMediaFile(configServiceDirective);
|
||||
log.info("服务指令保存时,pre:{},immedia:{},mp3:{},mp4:{}",configServiceDirective.getPreviewFile(),configServiceDirective.getImmediateFile(),configServiceDirective.getMp3File(),configServiceDirective.getMp4File());
|
||||
configServiceDirectiveService.updateById(configServiceDirective);
|
||||
if (StringUtils.isNotBlank(configServiceDirective.getBodyTags())) {
|
||||
configServiceDirectiveService.saveBodyTags(configServiceDirective);
|
||||
|
@ -156,6 +162,31 @@ public class ConfigServiceDirectiveController extends JeecgController<ConfigServ
|
|||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 审批
|
||||
*
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "服务指令-审批")
|
||||
@ApiOperation(value = "服务指令-审批", notes = "服务指令-审批")
|
||||
@RequestMapping(value = "/audit", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||
public Result<Map> audit(@RequestBody ConfigServiceDirective dto) {
|
||||
ConfigServiceDirective configServiceDirective = new ConfigServiceDirective();
|
||||
configServiceDirective.setId(dto.getId());
|
||||
configServiceDirective.setStatus(dto.getStatus());
|
||||
configServiceDirectiveService.updateById(configServiceDirective);
|
||||
|
||||
if ("2".equals(dto.getStatus())) {
|
||||
configServiceDirectiveService.auditPass(dto);
|
||||
}
|
||||
//通知业务平台修改审核状态
|
||||
DirectiveAsyncMQDto directiveAsyncMQDto = new DirectiveAsyncMQDto();
|
||||
BeanUtils.copyProperties(dto, directiveAsyncMQDto);
|
||||
rabbitMQUtil.sendToExchange("hldy.directive", dto.getSysOrgCode() + ".directive.auditresult", directiveAsyncMQDto);
|
||||
return Result.OK(Maps.newHashMap());
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
|
|
|
@ -93,6 +93,11 @@ public class ConfigServiceDirective implements Serializable {
|
|||
@Excel(name = "服务时长(分钟)", width = 15)
|
||||
@ApiModelProperty(value = "服务时长(分钟)")
|
||||
private java.lang.String serviceDuration;
|
||||
/**指令状态*/
|
||||
@Excel(name = "指令状态", width = 15)
|
||||
@ApiModelProperty(value = "指令状态")
|
||||
@Dict(dicCode = "directive_status")
|
||||
private java.lang.String status;
|
||||
/**是否启用 0启用 1未启用*/
|
||||
@Excel(name = "是否启用", width = 15)
|
||||
@ApiModelProperty(value = "是否启用")
|
||||
|
@ -121,6 +126,7 @@ public class ConfigServiceDirective implements Serializable {
|
|||
private java.util.Date updateTime;
|
||||
/**所属部门*/
|
||||
@ApiModelProperty(value = "所属部门")
|
||||
@Dict(dicCode = "org_code" , dictTable = "sys_depart" , dicText = "depart_name")
|
||||
private java.lang.String sysOrgCode;
|
||||
/**指令音频文件*/
|
||||
@ApiModelProperty(value = "指令音频文件")
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
<result property="sort" column="sort"/>
|
||||
<result property="serviceContent" column="service_content"/>
|
||||
<result property="serviceDuration" column="service_duration"/>
|
||||
<result property="status" column="status"/>
|
||||
<result property="izEnabled" column="iz_enabled"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
|
@ -59,6 +60,7 @@
|
|||
c.sort,
|
||||
c.service_content,
|
||||
c.service_duration,
|
||||
c.status,
|
||||
c.iz_enabled,
|
||||
c.del_flag,
|
||||
c.create_by,
|
||||
|
|
|
@ -58,4 +58,6 @@ public interface IConfigServiceDirectiveService extends IService<ConfigServiceDi
|
|||
void insertAllDirectives(List<ConfigServiceDirective> directives);
|
||||
|
||||
void handleMediaFile(ConfigServiceDirective configServiceDirective);
|
||||
|
||||
void auditPass(ConfigServiceDirective dto);
|
||||
}
|
||||
|
|
|
@ -2,23 +2,33 @@ package com.nu.modules.servicedirective.service.impl;
|
|||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
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.nu.modules.directivetag.body.entity.DirectiveBodyTag;
|
||||
import com.nu.modules.directivetag.body.service.IDirectiveBodyTagService;
|
||||
import com.nu.modules.directivetag.emotion.entity.DirectiveEmotionTag;
|
||||
import com.nu.modules.directivetag.emotion.service.IDirectiveEmotionTagService;
|
||||
import com.nu.modules.instructiontag.entity.InstructionTag;
|
||||
import com.nu.modules.instructiontag.service.IInstructionTagService;
|
||||
import com.nu.modules.servicecategory.entity.ConfigServiceCategory;
|
||||
import com.nu.modules.servicecategory.service.IConfigServiceCategoryService;
|
||||
import com.nu.modules.servicedirective.entity.ConfigServiceDirective;
|
||||
import com.nu.modules.servicedirective.mapper.ConfigServiceDirectiveMapper;
|
||||
import com.nu.modules.servicedirective.service.IConfigServiceDirectiveService;
|
||||
import com.nu.modules.servicetype.entity.ConfigServiceType;
|
||||
import com.nu.modules.servicetype.service.IConfigServiceTypeService;
|
||||
import com.nu.modules.sysconfig.ISysConfigApi;
|
||||
import com.nu.utils.RabbitMQUtil;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.jeecg.common.system.api.ISysBaseAPI;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Files;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
@ -38,8 +48,21 @@ public class ConfigServiceDirectiveServiceImpl extends ServiceImpl<ConfigService
|
|||
private ISysConfigApi sysConfigApi;
|
||||
@Autowired
|
||||
private ISysBaseAPI sysBaseAPI;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private RabbitMQUtil rabbitMQUtil;
|
||||
private IInstructionTagService instructionTagService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private IConfigServiceCategoryService categoryService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private IConfigServiceTypeService typeService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private IDirectiveBodyTagService bodyTagService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private IDirectiveEmotionTagService emotionTagService;
|
||||
|
||||
@Override
|
||||
public List<ConfigServiceDirective> pageList(ConfigServiceDirective configServiceDirective, IPage<ConfigServiceDirective> list_) {
|
||||
|
@ -268,11 +291,60 @@ public class ConfigServiceDirectiveServiceImpl extends ServiceImpl<ConfigService
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void auditPass(ConfigServiceDirective dto) {
|
||||
//将相应字典项改为已授权
|
||||
|
||||
//分类标签
|
||||
UpdateWrapper<InstructionTag> instruUW = new UpdateWrapper<>();
|
||||
instruUW.eq("id",dto.getInstructionTagId());
|
||||
instruUW.eq("status","1");
|
||||
InstructionTag instructionTag = new InstructionTag();
|
||||
instructionTag.setStatus("0");
|
||||
instructionTagService.update(instructionTag,instruUW);
|
||||
//服务类别
|
||||
UpdateWrapper<ConfigServiceCategory> categoryUW = new UpdateWrapper<>();
|
||||
categoryUW.eq("id",dto.getCategoryId());
|
||||
categoryUW.eq("status","1");
|
||||
ConfigServiceCategory category = new ConfigServiceCategory();
|
||||
category.setStatus("0");
|
||||
categoryService.update(category,categoryUW);
|
||||
//服务类型
|
||||
UpdateWrapper<ConfigServiceType> typeUW = new UpdateWrapper<>();
|
||||
typeUW.eq("id",dto.getTypeId());
|
||||
typeUW.eq("status","1");
|
||||
ConfigServiceType type = new ConfigServiceType();
|
||||
type.setStatus("0");
|
||||
typeService.update(type,typeUW);
|
||||
//体型标签
|
||||
List<String> bodyTags = Arrays.asList(dto.getBodyTags().split(","));
|
||||
bodyTags.stream().forEach(b -> {
|
||||
UpdateWrapper<DirectiveBodyTag> bodyTagUW = new UpdateWrapper<>();
|
||||
bodyTagUW.eq("id",b);
|
||||
bodyTagUW.eq("status","1");
|
||||
DirectiveBodyTag bodyTag = new DirectiveBodyTag();
|
||||
bodyTag.setStatus("0");
|
||||
bodyTagService.update(bodyTag,bodyTagUW);
|
||||
});
|
||||
//情绪标签
|
||||
List<String> emotionTags = Arrays.asList(dto.getEmotionTags().split(","));
|
||||
emotionTags.stream().forEach(b -> {
|
||||
UpdateWrapper<DirectiveEmotionTag> emotionTagUW = new UpdateWrapper<>();
|
||||
emotionTagUW.eq("id",b);
|
||||
emotionTagUW.eq("status","1");
|
||||
DirectiveEmotionTag emotionTag = new DirectiveEmotionTag();
|
||||
emotionTag.setStatus("0");
|
||||
emotionTagService.update(emotionTag,emotionTagUW);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理单个文件,检查路径是否需要迁移
|
||||
* @param basePath 基础路径
|
||||
*
|
||||
* @param basePath 基础路径
|
||||
* @param targetDir 目标目录
|
||||
* @param filePath 文件路径
|
||||
* @param filePath 文件路径
|
||||
* @return 如果路径有变化返回新路径,否则返回null
|
||||
*/
|
||||
private String processFile(String basePath, String targetDir, String filePath) {
|
||||
|
|
|
@ -52,6 +52,11 @@ public class ConfigServiceType implements Serializable {
|
|||
@Excel(name = "排序", width = 15)
|
||||
@ApiModelProperty(value = "排序")
|
||||
private java.lang.Integer sort;
|
||||
/**状态 0已授权 1未授权*/
|
||||
@Excel(name = "状态 0已授权 1未授权", width = 15)
|
||||
@ApiModelProperty(value = "状态 0已授权 1未授权")
|
||||
@Dict(dicCode = "status")
|
||||
private java.lang.String status;
|
||||
/**是否启用 0启用 1未启用*/
|
||||
@Excel(name = "是否启用", width = 15)
|
||||
@ApiModelProperty(value = "是否启用")
|
||||
|
|
|
@ -1,12 +1,31 @@
|
|||
package com.nu.mq.directive.listener;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.nu.dto.DirectiveAsyncMQDto;
|
||||
import com.nu.dto.StatusMQDto;
|
||||
import com.nu.enums.MQStatus;
|
||||
import com.nu.modules.async.entity.AsyncMain;
|
||||
import com.nu.modules.async.entity.AsyncStatus;
|
||||
import com.nu.modules.async.service.IAsyncMainService;
|
||||
import com.nu.modules.async.service.IAsyncStatusService;
|
||||
import com.nu.modules.directivetag.body.entity.DirectiveBodyTag;
|
||||
import com.nu.modules.directivetag.body.entity.DirectiveBodyTagRelation;
|
||||
import com.nu.modules.directivetag.body.service.IDirectiveBodyTagService;
|
||||
import com.nu.modules.directivetag.emotion.entity.DirectiveEmotionTag;
|
||||
import com.nu.modules.directivetag.emotion.entity.DirectiveEmotionTagRelation;
|
||||
import com.nu.modules.directivetag.emotion.service.IDirectiveEmotionTagService;
|
||||
import com.nu.modules.instructiontag.entity.InstructionTag;
|
||||
import com.nu.modules.instructiontag.service.IInstructionTagService;
|
||||
import com.nu.modules.servicecategory.entity.ConfigServiceCategory;
|
||||
import com.nu.modules.servicecategory.service.IConfigServiceCategoryService;
|
||||
import com.nu.modules.servicedirective.entity.ConfigServiceDirective;
|
||||
import com.nu.modules.servicedirective.service.IConfigServiceDirectiveService;
|
||||
import com.nu.modules.servicetype.entity.ConfigServiceType;
|
||||
import com.nu.modules.servicetype.service.IConfigServiceTypeService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.compress.utils.Lists;
|
||||
import org.springframework.amqp.core.ExchangeTypes;
|
||||
|
@ -14,10 +33,13 @@ 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;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
|
@ -27,15 +49,170 @@ public class DirectiveMQListener {
|
|||
private IAsyncMainService asyncMainService;
|
||||
@Autowired
|
||||
private IAsyncStatusService asyncStatusService;
|
||||
@Autowired
|
||||
private IConfigServiceDirectiveService directiveService;
|
||||
@Autowired
|
||||
private IInstructionTagService instructionTagService;
|
||||
@Autowired
|
||||
private IConfigServiceCategoryService categoryService;
|
||||
@Autowired
|
||||
private IConfigServiceTypeService typeService;
|
||||
@Autowired
|
||||
private IDirectiveBodyTagService bodyTagService;
|
||||
@Autowired
|
||||
private IDirectiveEmotionTagService emotionTagService;
|
||||
|
||||
@RabbitListener(
|
||||
bindings = @QueueBinding(
|
||||
value = @Queue(name = "fwzl.async.result"),
|
||||
exchange = @Exchange(name = "hldy.fwzl", type = ExchangeTypes.DIRECT),
|
||||
key = "fwzl.async.result"
|
||||
),
|
||||
errorHandler = "directiveMQErrorHandler"
|
||||
)
|
||||
/**
|
||||
* 业务平台新增指令/编辑未授权指令 传给 管理平台进行审核
|
||||
*
|
||||
* @param dto
|
||||
*/
|
||||
@RabbitListener(bindings = @QueueBinding(value = @Queue(name = "hldy.directive.audit"), exchange = @Exchange(name = "hldy.directive", type = ExchangeTypes.DIRECT), key = "hldy.directive.audit"), errorHandler = "directiveMQErrorHandler")
|
||||
public void auditBizDirective(DirectiveAsyncMQDto dto) {
|
||||
//先处理各字典项 只新增,不修改
|
||||
String instructionTagId = dto.getInstructionTagId();
|
||||
String categoryId = dto.getCategoryId();
|
||||
String typeId = dto.getTypeId();
|
||||
String orgCode = dto.getSysOrgCode();
|
||||
//分类标签
|
||||
{
|
||||
QueryWrapper<InstructionTag> instructionTagQW = new QueryWrapper<>();
|
||||
instructionTagQW.eq("id", instructionTagId);
|
||||
InstructionTag instructionObj = instructionTagService.getOne(instructionTagQW);
|
||||
if (instructionObj == null) {
|
||||
//新增分类标签
|
||||
InstructionTag instructionTag = new InstructionTag();
|
||||
instructionTag.setId(instructionTagId);
|
||||
instructionTag.setInstructionName(dto.getInstructionName());
|
||||
instructionTag.setSort(999);
|
||||
instructionTag.setStatus("1");
|
||||
instructionTag.setIzEnabled("1");
|
||||
instructionTag.setDelFlag("0");
|
||||
instructionTag.setSysOrgCode(orgCode);
|
||||
instructionTagService.save(instructionTag);
|
||||
}
|
||||
}
|
||||
//服务类别
|
||||
{
|
||||
QueryWrapper<ConfigServiceCategory> categoryQW = new QueryWrapper<>();
|
||||
categoryQW.eq("id", categoryId);
|
||||
ConfigServiceCategory categoryObj = categoryService.getOne(categoryQW);
|
||||
if (categoryObj == null) {
|
||||
//新增服务类别
|
||||
ConfigServiceCategory configServiceCategory = new ConfigServiceCategory();
|
||||
configServiceCategory.setId(categoryId);
|
||||
configServiceCategory.setInstructionId(instructionTagId);
|
||||
configServiceCategory.setCategoryName(dto.getCategoryName());
|
||||
configServiceCategory.setSort(999);
|
||||
configServiceCategory.setStatus("1");
|
||||
configServiceCategory.setIzEnabled("1");
|
||||
configServiceCategory.setDelFlag("0");
|
||||
configServiceCategory.setSysOrgCode(orgCode);
|
||||
categoryService.save(configServiceCategory);
|
||||
}
|
||||
}
|
||||
//服务类型
|
||||
{
|
||||
QueryWrapper<ConfigServiceType> typeQW = new QueryWrapper<>();
|
||||
typeQW.eq("id", typeId);
|
||||
ConfigServiceType typeObj = typeService.getOne(typeQW);
|
||||
if (typeObj == null) {
|
||||
//新增服务类别
|
||||
ConfigServiceType configServiceType = new ConfigServiceType();
|
||||
configServiceType.setId(typeId);
|
||||
configServiceType.setInstructionId(instructionTagId);
|
||||
configServiceType.setCategoryId(categoryId);
|
||||
configServiceType.setTypeName(dto.getTypeName());
|
||||
configServiceType.setSort(999);
|
||||
configServiceType.setStatus("1");
|
||||
configServiceType.setIzEnabled("1");
|
||||
configServiceType.setDelFlag("0");
|
||||
configServiceType.setSysOrgCode(orgCode);
|
||||
typeService.save(configServiceType);
|
||||
}
|
||||
}
|
||||
//体型标签
|
||||
{
|
||||
String bodyTagsObj = dto.getBodyTagsObj();
|
||||
JSONArray jsonArray = JSON.parseArray(bodyTagsObj);
|
||||
//体型标签-服务指令中间表
|
||||
bodyTagService.removeAllByDirectiveId(dto.getId());
|
||||
List<DirectiveBodyTagRelation> btrList = Lists.newArrayList();
|
||||
for (int i = 0; i < jsonArray.size(); i++) {
|
||||
JSONObject item = jsonArray.getJSONObject(i);
|
||||
String bodyTagId = item.getString("id");
|
||||
String bodyTagLabel = item.getString("label");
|
||||
//处理每一个体型标签
|
||||
{
|
||||
QueryWrapper<DirectiveBodyTag> bodyTagQW = new QueryWrapper<>();
|
||||
bodyTagQW.eq("id", bodyTagId);
|
||||
DirectiveBodyTag bodyTagObj = bodyTagService.getOne(bodyTagQW);
|
||||
if (bodyTagObj == null) {
|
||||
DirectiveBodyTag directiveBodyTag = new DirectiveBodyTag();
|
||||
directiveBodyTag.setId(bodyTagId);
|
||||
directiveBodyTag.setTagName(bodyTagLabel);
|
||||
directiveBodyTag.setSort(999);
|
||||
directiveBodyTag.setStatus("1");
|
||||
directiveBodyTag.setIzEnabled("1");
|
||||
directiveBodyTag.setDelFlag("0");
|
||||
directiveBodyTag.setSysOrgCode(orgCode);
|
||||
//新增
|
||||
bodyTagService.save(directiveBodyTag);
|
||||
}
|
||||
DirectiveBodyTagRelation btr = new DirectiveBodyTagRelation();
|
||||
btr.setDirectiveId(dto.getId());
|
||||
btr.setTagId(bodyTagId);
|
||||
btrList.add(btr);
|
||||
}
|
||||
}
|
||||
//中间关系表
|
||||
bodyTagService.insertAllRelation(btrList);
|
||||
}
|
||||
//情绪标签
|
||||
{
|
||||
String emotionTagsObj = dto.getEmotionTagsObj();
|
||||
JSONArray jsonArray = JSON.parseArray(emotionTagsObj);
|
||||
//体型标签-服务指令中间表
|
||||
emotionTagService.removeAllByDirectiveId(dto.getId());
|
||||
List<DirectiveEmotionTagRelation> etrList = Lists.newArrayList();
|
||||
for (int i = 0; i < jsonArray.size(); i++) {
|
||||
JSONObject item = jsonArray.getJSONObject(i);
|
||||
String emotionTagId = item.getString("id");
|
||||
String emotionTagLabel = item.getString("label");
|
||||
//处理每一个体型标签
|
||||
{
|
||||
QueryWrapper<DirectiveEmotionTag> emotionTagQW = new QueryWrapper<>();
|
||||
emotionTagQW.eq("id", emotionTagId);
|
||||
DirectiveEmotionTag emotionTagObj = emotionTagService.getOne(emotionTagQW);
|
||||
if (emotionTagObj == null) {
|
||||
DirectiveEmotionTag directiveEmotionTag = new DirectiveEmotionTag();
|
||||
directiveEmotionTag.setId(emotionTagId);
|
||||
directiveEmotionTag.setTagName(emotionTagLabel);
|
||||
directiveEmotionTag.setSort(999);
|
||||
directiveEmotionTag.setStatus("1");
|
||||
directiveEmotionTag.setIzEnabled("1");
|
||||
directiveEmotionTag.setDelFlag("0");
|
||||
directiveEmotionTag.setSysOrgCode(orgCode);
|
||||
//新增
|
||||
emotionTagService.save(directiveEmotionTag);
|
||||
}
|
||||
DirectiveEmotionTagRelation etr = new DirectiveEmotionTagRelation();
|
||||
etr.setDirectiveId(dto.getId());
|
||||
etr.setTagId(emotionTagId);
|
||||
etrList.add(etr);
|
||||
}
|
||||
}
|
||||
//中间关系表
|
||||
emotionTagService.insertAllRelation(etrList);
|
||||
}
|
||||
|
||||
//存储服务指令
|
||||
ConfigServiceDirective directive = new ConfigServiceDirective();
|
||||
BeanUtils.copyProperties(dto, directive);
|
||||
directiveService.save(directive);
|
||||
}
|
||||
|
||||
@RabbitListener(bindings = @QueueBinding(value = @Queue(name = "fwzl.async.result"), exchange = @Exchange(name = "hldy.fwzl", type = ExchangeTypes.DIRECT), key = "fwzl.async.result"), errorHandler = "directiveMQErrorHandler")
|
||||
public void handleNu002AsyncMessageStatus(StatusMQDto dto) {
|
||||
LambdaQueryWrapper<AsyncStatus> qw = new LambdaQueryWrapper<>();
|
||||
qw.eq(AsyncStatus::getPkid, dto.getAsyncId());
|
||||
|
|
Loading…
Reference in New Issue