1.我的收藏列表查询增加融合服务查询

2.增加超级管理员删除能力和流程实例接口
3.删除区划标识修改
This commit is contained in:
dinggang 2022-11-09 15:32:13 +08:00
parent 8d36ad1e56
commit d8e306efc4
22 changed files with 279 additions and 43 deletions

View File

@ -34,4 +34,6 @@ public interface TMeetingroomBookMapper extends BaseDao<TMeetingroomBook> {
@Param("state") Integer state);
List<TMeetingroomBook> selectInvalid(Date date);
List<Long> selectBookIdByRoomId(Long id);
}

View File

@ -45,4 +45,6 @@ public interface TAbilityApplicationDao extends BaseDao<TAbilityApplicationEntit
Long countUserResourceApply(Long userId, Long resourceId);
Integer getDeptInfrastructureApply(Long deptId);
List<Long> getInstanceIdByResId(Long id);
}

View File

@ -22,8 +22,11 @@ import io.renren.modules.resource.service.ResourceService;
import io.renren.modules.resource.videoPreview.AbstractVideoPreviewService;
import io.renren.modules.resource.videoPreview.VideoPreviewFactory;
import io.renren.modules.security.user.SecurityUser;
import io.renren.modules.security.user.UserDetail;
import io.renren.modules.security.user.SecurityUser;
import io.renren.modules.sys.dao.SysUserDao;
import io.renren.modules.sys.dto.SysDeptDTO;
import io.renren.modules.sys.enums.SuperAdminEnum;
import io.renren.modules.sys.dto.SysUserDTO;
import io.renren.modules.sys.entity.SysUserEntity;
import io.renren.modules.sys.service.SysDeptService;
@ -830,4 +833,40 @@ public class ResourceController {
}
@PostMapping("/delResBySuAd")
@ApiOperation("/超级管理员删除能力数据")
@LogOperation("/超级管理员删除能力数据")
public Result delResBySuAd(Long id) {
UserDetail user = SecurityUser.getUser();
//不是超级管理员不能执行删除操作
if (SuperAdminEnum.NO.value() == user.getSuperAdmin()) {
return new Result().error("请使用超级管理员账号进行此操作!");
} else {
try {
resourceService.delResBySuAd(id);
}catch (Exception e) {
return new Result().error("清除能力及相关数据失败!");
}
return new Result().ok("能力及相关数据已清除。");
}
}
@PostMapping("/delProcinstBySuAd")
@ApiOperation("/超级管理员删除流程数据")
@LogOperation("/超级管理员删除流程数据")
public Result delProcinstBySuAd(Long id, String type, Long resourceId) {
UserDetail user = SecurityUser.getUser();
//不是超级管理员不能执行删除操作
if (SuperAdminEnum.NO.value() == user.getSuperAdmin()) {
return new Result().error("请使用超级管理员账号进行此操作!");
} else {
try {
resourceService.delProcinstBySuAd(id, type, resourceId);
}catch (Exception e) {
return new Result().error("清除流程及相关数据失败!");
}
return new Result().ok("流程及相关数据已清除。");
}
}
}

View File

@ -221,4 +221,6 @@ public interface ResourceDao extends BaseDao<ResourceEntity> {
Integer getSquareListCount(@Param("type") String type, @Param("deptType") Integer deptType, @Param("area") String area);
List<Map> getAppListByDept(@Param("deptId") Long deptId, @Param("key") String key);
Integer updateByDelProcinst(@Param("resourceId") Long resourceId);
}

View File

@ -162,4 +162,7 @@ public interface ResourceService extends CrudService<ResourceEntity, ResourceDTO
Object getAppListByDept(String key);
void delResBySuAd(Long id);
void delProcinstBySuAd(Long id, String type, Long resourceId);
}

View File

@ -16,12 +16,16 @@ import io.renren.common.domain.Tsingtao_xhaProperties;
import io.renren.common.page.PageData;
import io.renren.common.service.impl.CrudServiceImpl;
import io.renren.common.utils.DateUtils;
import io.renren.modules.demanData.dao.TDemandDataDao;
import io.renren.modules.demandComment.dao.TDemandCommentDao;
import io.renren.modules.enke.service.EnkeService;
import io.renren.modules.meeting.dao.TMeetingroomBookMapper;
import io.renren.modules.meeting.dao.TMeetingroomMapper;
import io.renren.modules.meeting.entity.TMeetingroom;
import io.renren.modules.monitor.dto.CameraChannelDto1;
import io.renren.modules.monitor.entity.CameraChannel;
import io.renren.modules.monitor.mapper.CameraChannelMapper;
import io.renren.modules.notice.dao.SysNoticeDao;
import io.renren.modules.processForm.dao.TAbilityApplicationDao;
import io.renren.modules.processForm.dto.TAbilityApplicationDTO;
import io.renren.modules.processForm.entity.TAbilityApplicationEntity;
@ -39,8 +43,10 @@ import io.renren.modules.resource.entity.ResourceEntity;
import io.renren.modules.resource.entity.ResourceEntityDelFlag;
import io.renren.modules.resource.entity.TbDataResourceRelEntity;
import io.renren.modules.resource.service.ResourceService;
import io.renren.modules.resourceBrowse.dao.ResourceBrowseDao;
import io.renren.modules.resourceCar.dao.ResourceCarDao;
import io.renren.modules.resourceCollection.dao.ResourceCollectionDao;
import io.renren.modules.resourceMountApply.dao.TResourceMountApplyDao;
import io.renren.modules.resourceMountApply.dto.TResourceMountApplyDTO;
import io.renren.modules.resourceMountApply.service.TResourceMountApplyService;
import io.renren.modules.resourceScore.dao.ResourceScoreDao;
@ -57,6 +63,7 @@ import io.renren.modules.sys.service.SysUserService;
import lombok.SneakyThrows;
import okhttp3.*;
import org.activiti.engine.HistoryService;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.history.HistoricProcessInstance;
import org.activiti.engine.history.HistoricProcessInstanceQuery;
import org.apache.commons.lang3.BooleanUtils;
@ -204,6 +211,33 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
@Autowired
private EnkeService enkeService;
@Autowired
private ResourceBrowseDao resourceBrowseDao;
@Autowired
private TResourceMountApplyDao resourceMountApplyDao;
@Autowired
private TAbilityApplicationDao abilityApplicationDao;
@Autowired
private RuntimeService runtimeService;
@Autowired
private SysNoticeDao sysNoticeDao;
@Autowired
private TMeetingroomMapper meetingroomMapper;
@Autowired
private TMeetingroomBookMapper meetingroomBookMapper;
@Autowired
private TDemandCommentDao demandCommentDao;
@Autowired
private TDemandDataDao tDemandDataDao;
@Override
public QueryWrapper<ResourceEntity> getWrapper(Map<String, Object> params) {
@ -2554,4 +2588,145 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
return resourceDao.getAppListByDept(deptId, key);
}
@Override
@Transactional
public void delResBySuAd(Long id) {
//resource,attr表
CompletableFuture<Void> delRes = CompletableFuture.runAsync(() -> {
resourceDao.deleteById(id);
Map<String, Object> map = new HashMap<>();
map.put("data_resource_id", id);
attrDao.deleteByMap(map);
}, executor);
//browse,collection,score,car表
CompletableFuture<Void> delResOthers = CompletableFuture.runAsync(() -> {
Map<String, Object> map = new HashMap<>();
map.put("resource_id", id);
resourceBrowseDao.deleteByMap(map);
resourceCarDao.deleteByMap(map);
resourceCollectionDao.deleteByMap(map);
resourceScoreDao.deleteByMap(map);
}, executor);
//删除上架流程实例及通知消息数据
CompletableFuture<Void> delMountData = CompletableFuture.runAsync(() -> {
List<Long> instanceIdList = resourceMountApplyDao.getInstanceIdByResId(id);
if (!instanceIdList.isEmpty()) {
instanceIdList.forEach(index -> this.delProcinstBySuAd(index, "能力上架", null));
}
}, executor);
//删除使用流程表单相关数据及通知消息数据
CompletableFuture<Void> delAbilityData = CompletableFuture.runAsync(() -> {
List<Long> instanceIdList = abilityApplicationDao.getInstanceIdByResId(id);
if (!instanceIdList.isEmpty()) {
instanceIdList.forEach(index -> this.delProcinstBySuAd(index, "能力使用", null));
}
}, executor);
//会客厅
CompletableFuture<Void> delRoom = CompletableFuture.runAsync(() -> {
Map<String, Object> map = new HashMap<>();
map.put("room_id", id);
meetingroomMapper.deleteById(id);
//获取当前会客厅预约记录用于删除消息数据
List<Long> idList = meetingroomBookMapper.selectBookIdByRoomId(id);
if (!idList.isEmpty()) {
//清除消息数据
idList.forEach(x -> {
Map<String, Object> deleteMap = new HashMap() {{
put("apply_id", x.toString());
}};
sysNoticeDao.deleteByMap(deleteMap);
});
}
meetingroomBookMapper.deleteByMap(map);
}, executor);
//删除申请表单数据
CompletableFuture<Void> delFormData = CompletableFuture.runAsync(() -> {
Map<String, Object> map = new HashMap<>();
map.put("resource_id", id);
resourceMountApplyDao.deleteByMap(map);
abilityApplicationDao.deleteByMap(map);
}, executor);
CompletableFuture<Void> all = CompletableFuture.allOf(delRes, delResOthers, delMountData, delAbilityData, delRoom, delFormData);
all.join();
}
@Override
public void delProcinstBySuAd(Long id, String type, Long resourceId) {
//删除会客厅申请单独处理
if ("会客厅申请".equals(type)) {
meetingroomBookMapper.deleteById(id);
} else {
//清除流程实例数据
CompletableFuture<Void> delProcinstHis = CompletableFuture.runAsync(() -> {
try {
historyService.deleteHistoricProcessInstance(id.toString());
} catch (Exception e) {
logger.info("该流程实例为运行中实例,已调用运行中实例相关方法删除!");
}
}, executor);
//清除流程实例数据
CompletableFuture<Void> delProcinstRun = CompletableFuture.runAsync(() -> {
try {
runtimeService.deleteProcessInstance(id.toString(), "");
} catch (Exception e) {
logger.info("该流程实例为已完成实例,已调用历史流程实例相关方法删除!");
}
}, executor);
//清除消息数据
CompletableFuture<Void> delMessage = CompletableFuture.runAsync(() -> {
Map<String, Object> deleteMap = new HashMap() {{
put("apply_id", id.toString());
}};
sysNoticeDao.deleteByMap(deleteMap);
}, executor);
//删除申请表单数据
CompletableFuture<Void> delFrom = CompletableFuture.runAsync(() -> {
Map<String, Object> deleteMap = new HashMap() {{
put("instance_id", id.toString());
}};
switch (type) {
case "能力上架": {
resourceMountApplyDao.deleteByMap(deleteMap);
}
break;
case "能力使用": {
abilityApplicationDao.deleteByMap(deleteMap);
}
break;
case "能力下架": {
resourceDao.updateByDelProcinst(resourceId);
}
break;
case "需求评论": {
demandCommentDao.deleteByMap(deleteMap);
}
break;
case "能力需求": {
tDemandDataDao.deleteByMap(deleteMap);
}
break;
default:
break;
}
}, executor);
CompletableFuture<Void> all = CompletableFuture.allOf(delProcinstHis, delProcinstRun, delMessage, delFrom);
all.join();
}
}
}

View File

@ -55,7 +55,7 @@ public class ResourceCollectionServiceImpl extends CrudServiceImpl<ResourceColle
List<ResourceCollectionDTO> resourceCollectionDTOS = resourceCollectionDao.selectWithResource(params);
resourceCollectionDTOS.forEach(item -> item.setResourceDTO(resourceService.selectWithAttrs(item.getResourceId())));
result.addAll(resourceCollectionDTOS);
if (params.get("type") == null || "".equals(params.get("type"))) {
if (params.get("type") == null || "".equals(params.get("type")) || "融合服务".equals(params.get("type"))) {
List<ResourceCollectionDTO> fuseCollectionDTOS = resourceCollectionDao.selectWithFuse(params);
fuseCollectionDTOS.forEach(item -> item.setFuseDTO(fuseService.getFuseById(item.getResourceId())));
result.addAll(fuseCollectionDTOS);

View File

@ -4,6 +4,10 @@ import io.renren.common.dao.BaseDao;
import io.renren.modules.resourceMountApply.entity.TResourceMountApplyEntity;
import org.apache.ibatis.annotations.Mapper;
import java.util.Collection;
import java.util.List;
import java.util.Map;
/**
* 资源挂载申请表单
*
@ -13,4 +17,6 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface TResourceMountApplyDao extends BaseDao<TResourceMountApplyEntity> {
void updateInstanceId(String instanceId, Long id);
List<Long> getInstanceIdByResId(Long id);
}

View File

@ -55,7 +55,7 @@ public class SysRegionController {
@GetMapping("{id}")
@ApiOperation("信息")
// @RequiresPermissions("sys:region:info")
public Result<SysRegionDTO> get(@PathVariable("id") String id) {
public Result<SysRegionDTO> get(@PathVariable("id") Long id) {
SysRegionDTO data = sysRegionService.get(id);
return new Result<SysRegionDTO>().ok(data);
@ -91,7 +91,7 @@ public class SysRegionController {
@ApiOperation("删除")
@LogOperation("删除")
// @RequiresPermissions("sys:region:delete")
public Result delete(@PathVariable("id") String id) {
public Result delete(@PathVariable("id") Long id) {
////效验数据
//AssertUtils.isNull(id, "id");

View File

@ -19,8 +19,8 @@ public interface SysRegionDao extends BaseDao<SysRegionEntity> {
List<Map<String, Object>> getTreeList();
SysRegionEntity getById(String id);
SysRegionEntity getById(Long id);
int getCountByPid(String pid);
int getCountByPid(Long pid);
}

View File

@ -41,7 +41,7 @@ public class SysDeptDTO extends TreeNode implements Serializable {
private Integer type;
@ApiModelProperty(value = "地区")
private String district;
private Long district;
@ApiModelProperty(value = "排序")
@Min(value = 0, message = "{sort.number}", groups = DefaultGroup.class)
@ -95,11 +95,11 @@ public class SysDeptDTO extends TreeNode implements Serializable {
this.type = type;
}
public String getDistrict() {
public Long getDistrict() {
return district;
}
public void setDistrict(String district) {
public void setDistrict(Long district) {
this.district = district;
}

View File

@ -23,11 +23,11 @@ public class SysRegionDTO implements Serializable {
@ApiModelProperty(value = "区域标识")
@NotNull(message = "{id.require}", groups = DefaultGroup.class)
private String id;
private Long id;
@ApiModelProperty(value = "上级区域ID")
@NotNull(message = "{region.pid.require}", groups = DefaultGroup.class)
private String pid;
private Long pid;
@ApiModelProperty(value = "区域名称")
@NotBlank(message = "{region.name.require}", groups = DefaultGroup.class)
@ -49,7 +49,4 @@ public class SysRegionDTO implements Serializable {
@ApiModelProperty(value = "更新时间")
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
private Date updateDate;
@ApiModelProperty(value = "id")
private Integer regionId;
}

View File

@ -37,7 +37,7 @@ public class SysDeptEntity extends BaseEntity {
/**
* 地区
*/
private String district;
private Long district;
/**
* 排序
*/

View File

@ -17,11 +17,12 @@ public class SysRegionEntity implements Serializable {
/**
* id
*/
private String id;
@TableId(type = IdType.INPUT)
private Long id;
/**
* 上级ID一级为0
*/
private String pid;
private Long pid;
/**
* 名称
*/
@ -63,7 +64,4 @@ public class SysRegionEntity implements Serializable {
*/
@TableField(exist = false)
private String parentName;
@TableId
private Long regionId;
}

View File

@ -18,20 +18,20 @@ public interface SysRegionService extends BaseService<SysRegionEntity> {
List<Map<String, Object>> getTreeList();
SysRegionDTO get(String id);
SysRegionDTO get(Long id);
void save(SysRegionDTO dto);
void update(SysRegionDTO dto);
void delete(String id);
void delete(Long id);
int getCountByPid(String pid);
int getCountByPid(Long pid);
List<RegionProvince> getRegion(boolean threeLevel);
/**
* 根据level获取当前或父级region
*/
SysRegionEntity getByLevel(String regionId, RegionLevelEnum levelEnum);
SysRegionEntity getByLevel(Long regionId, RegionLevelEnum levelEnum);
}

View File

@ -56,7 +56,7 @@ public class SysRegionServiceImpl extends BaseServiceImpl<SysRegionDao, SysRegio
}
@Override
public SysRegionDTO get(String id) {
public SysRegionDTO get(Long id) {
SysRegionEntity entity = baseDao.getById(id);
return ConvertUtils.sourceToTarget(entity, SysRegionDTO.class);
@ -121,13 +121,13 @@ public class SysRegionServiceImpl extends BaseServiceImpl<SysRegionDao, SysRegio
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String id) {
public void delete(Long id) {
//删除
baseDao.deleteById(id);
}
@Override
public int getCountByPid(String pid) {
public int getCountByPid(Long pid) {
return baseDao.getCountByPid(pid);
}
@ -165,7 +165,7 @@ public class SysRegionServiceImpl extends BaseServiceImpl<SysRegionDao, SysRegio
return provinces;
}
public SysRegionEntity getByLevel(String regionId, RegionLevelEnum levelEnum) {
public SysRegionEntity getByLevel(Long regionId, RegionLevelEnum levelEnum) {
SysRegionEntity entity = baseDao.getById(regionId);
if (entity.getTreeLevel() > levelEnum.value()) {
entity = getByLevel(entity.getPid(), levelEnum);

View File

@ -274,7 +274,7 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUserDao, SysUserEntit
});
//给district和type赋值
String districtName;
String distict;
Long distict;
switch (key) {
case "新市北区":
districtName = "市北区";
@ -365,7 +365,7 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUserDao, SysUserEntit
deptNew.setId(Long.valueOf(list.get("id").toString()));
deptNew.setPid(Long.valueOf(list.get("pid").toString()));
deptNew.setPids(list.get("pids").toString());
deptNew.setDistrict(list.get("district").toString());
deptNew.setDistrict(Long.valueOf(list.get("district").toString()));
deptNew.setType(Integer.parseInt(list.get("type").toString()));
if (dept == null) {
sysDeptDao.insert(deptNew);
@ -476,12 +476,12 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUserDao, SysUserEntit
}
}
public String getDistict(String deptName) {
public Long getDistict(String deptName) {
QueryWrapper<SysRegionEntity> regionWrapper = new QueryWrapper<>();
regionWrapper.eq("name", deptName);
SysRegionEntity entity = regionDao.selectOne(regionWrapper);
if (entity == null) {
return "0";
return 0L;
} else {
return entity.getId();
}

View File

@ -1,11 +0,0 @@
-- 1.新增一列存储新主键
ALTER TABLE sys_region ADD COLUMN region_id BIGINT(20) NOT NULL COMMENT '主键';
-- 2.用id的值作为region_id的值以后的用生成的随机id
UPDATE sys_region sr1, sys_region sr2 SET sr1.region_id = sr2.id WHERE sr1.id = sr2.id;
-- 2.取消原id列为主键将region_id列设为主键
ALTER TABLE sys_region DROP PRIMARY KEY;
ALTER TABLE sys_region ADD PRIMARY KEY (region_id);
-- 3.修改相关列类型为varchar
ALTER TABLE sys_region MODIFY COLUMN id VARCHAR(50) NOT NULL COMMENT '区划标识';
ALTER TABLE sys_region MODIFY COLUMN pid VARCHAR(50) NOT NULL COMMENT '父级ID一级为0';
ALTER TABLE sys_dept MODIFY COLUMN district VARCHAR(50) NOT NULL COMMENT '地区';

View File

@ -142,5 +142,8 @@
where t.state = 1
and #{date} > t.book_date
</select>
<select id="selectBookIdByRoomId" resultType="java.lang.Long">
SELECT id FROM t_meetingroom_book WHERE room_id = #{id}
</select>
</mapper>

View File

@ -288,4 +288,8 @@
AND taa.expire_date > now()
AND sd.id = #{deptId}
</select>
<select id="getInstanceIdByResId" resultType="java.lang.Long">
SELECT instance_id FROM t_ability_application WHERE resource_id = #{id}
</select>
</mapper>

View File

@ -104,6 +104,19 @@
</foreach>
</update>
<update id="updateByDelProcinst">
UPDATE tb_data_resource
SET del_flag = 0,
undercarriage_reason = NULL,
undercarriage_user_name = NULL,
apply_number = NULL,
undercarriage_enclosure = NULL,
undercarriage_title = NULL,
undercarriage_phone = NULL,
undercarriage_enclosure_name = NULL
WHERE id = #{resourceId}
</update>
<select id="selectWithAttrs" resultMap="resourceDTO">
SELECT
DISTINCT tdr.id,

View File

@ -16,12 +16,15 @@
<result property="resourceId" column="resource_id"/>
<result property="resourceDTO" column="resource_dto"
typeHandler="com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler"/>
<result property="createtime" column="createtime"/>
<result property="createDate" column="create_date"/>
<result property="applyNumber" column="apply_number"/>
</resultMap>
<update id="updateInstanceId">
update t_resource_mount_apply set instance_id = #{instanceId} where id = #{id};
</update>
<select id="getInstanceIdByResId" resultType="java.lang.Long">
SELECT CAST(instance_id AS DECIMAL(20)) FROM t_resource_mount_apply WHERE resource_id = #{id}
</select>
</mapper>