Merge remote-tracking branch 'origin/master'

This commit is contained in:
dinggang 2022-05-11 11:20:44 +08:00
commit f82fdcd5f3
6 changed files with 45 additions and 17 deletions

View File

@ -24,6 +24,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.Map; import java.util.Map;
import java.util.Optional;
/** /**
* 部门动态审批人 * 部门动态审批人
@ -160,5 +161,13 @@ public class CorrectionListener implements TaskListener, ExecutionListener, Acti
logger.error("未查到该部门对应的 " + roleName); logger.error("未查到该部门对应的 " + roleName);
taskService.setAssignee(delegateTask.getId(), "1516728698224427010"); taskService.setAssignee(delegateTask.getId(), "1516728698224427010");
} }
Optional<ResourceDTO> resourceDTOOptional = Optional.ofNullable(resourceService.get(Long.valueOf(abilityApplicationDTO.getResourceId())));
resourceDTOOptional.ifPresent(resource -> {
if ("免批申请".equals(resource.getShareCondition())) { // 针对免批资源申请
taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(), "免批资源申请默认通过");
taskService.complete(delegateTask.getId(), delegateTask.getVariables());
}
});
} }
} }

View File

@ -1,5 +1,10 @@
package io.renren.modules.processForm.listener; package io.renren.modules.processForm.listener;
import com.google.gson.Gson;
import com.google.gson.JsonElement;
import io.renren.modules.processForm.dto.TAbilityApplicationDTO;
import io.renren.modules.resource.dto.ResourceDTO;
import io.renren.modules.resource.service.ResourceService;
import io.renren.modules.sys.dto.SysDeptDTO; import io.renren.modules.sys.dto.SysDeptDTO;
import io.renren.modules.sys.dto.SysRoleDTO; import io.renren.modules.sys.dto.SysRoleDTO;
import io.renren.modules.sys.dto.SysUserDTO; import io.renren.modules.sys.dto.SysUserDTO;
@ -17,6 +22,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.Map;
import java.util.Optional;
/** /**
* 大数据局动态审批人 * 大数据局动态审批人
*/ */
@ -39,6 +47,8 @@ public class DataCenterListener implements TaskListener, ExecutionListener, Acti
private SysRoleUserService sysRoleUserService; private SysRoleUserService sysRoleUserService;
@Autowired @Autowired
private SysDeptService sysDeptService; private SysDeptService sysDeptService;
@Autowired
private ResourceService resourceService;
@Override @Override
public void notify(DelegateExecution delegateExecution) throws Exception { public void notify(DelegateExecution delegateExecution) throws Exception {
@ -96,5 +106,18 @@ public class DataCenterListener implements TaskListener, ExecutionListener, Acti
delegateTask.setAssignee("1516728698224427010"); delegateTask.setAssignee("1516728698224427010");
logger.info("未查到该部门对应 " + roleName); logger.info("未查到该部门对应 " + roleName);
} }
Map<String, Object> kv = delegateTask.getVariables();
Gson gson = new Gson();
JsonElement jsonElement = gson.toJsonTree(kv);
TAbilityApplicationDTO abilityApplicationDTO = gson.fromJson(jsonElement, TAbilityApplicationDTO.class);
Optional<ResourceDTO> resourceDTOOptional = Optional.ofNullable(resourceService.get(Long.valueOf(abilityApplicationDTO.getResourceId())));
resourceDTOOptional.ifPresent(resource -> {
if ("免批申请".equals(resource.getShareCondition())) { // 针对免批资源申请
taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(), "免批资源申请默认通过");
taskService.complete(delegateTask.getId(), delegateTask.getVariables());
}
});
} }
} }

View File

@ -15,6 +15,7 @@ import io.renren.modules.resource.dao.ResourceDao;
import io.renren.modules.resource.dto.ResourceDTO; import io.renren.modules.resource.dto.ResourceDTO;
import io.renren.modules.resource.entity.AttrEntity; import io.renren.modules.resource.entity.AttrEntity;
import io.renren.modules.resource.entity.ResourceEntity; import io.renren.modules.resource.entity.ResourceEntity;
import io.renren.modules.resource.entity.ResourceEntityDelFlag;
import io.renren.modules.resource.service.ResourceService; import io.renren.modules.resource.service.ResourceService;
import io.renren.modules.resourceCar.dao.ResourceCarDao; import io.renren.modules.resourceCar.dao.ResourceCarDao;
import io.renren.modules.resourceCollection.dao.ResourceCollectionDao; import io.renren.modules.resourceCollection.dao.ResourceCollectionDao;
@ -72,13 +73,8 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
} }
}); });
// wrapper.eq("type", params.get("type").toString())
// .like(StringUtils.isNotBlank(params.get("name").toString()),"name", params.get("name").toString())
// .orderByDesc("create_date")
// .eq(StringUtils.isNotBlank(params.get("creator").toString()),"creator", params.get("creator").toString())
// .eq("del_flag", 0);
wrapper.orderByDesc("create_date"); wrapper.orderByDesc("create_date");
if (!params.containsKey("creator")) { if (!params.containsKey("creator")) { // 创建者查询时
wrapper.eq("del_flag", params.get("del_flag") == null ? 0 : Integer.valueOf(params.get("del_flag").toString())); wrapper.eq("del_flag", params.get("del_flag") == null ? 0 : Integer.valueOf(params.get("del_flag").toString()));
} }
return wrapper; return wrapper;
@ -92,7 +88,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
Long resourceID = IdWorker.getId(resourceEntity); Long resourceID = IdWorker.getId(resourceEntity);
resourceEntity.setId(resourceID); resourceEntity.setId(resourceID);
if (dto.getDelFlag() == null) { if (dto.getDelFlag() == null) {
resourceEntity.setDelFlag(0); resourceEntity.setDelFlag(ResourceEntityDelFlag.NORMAL.getFlag());
} }
resourceDao.insert(resourceEntity); resourceDao.insert(resourceEntity);
@ -100,7 +96,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
List<AttrEntity> attrEntities = dto.getInfoList(); List<AttrEntity> attrEntities = dto.getInfoList();
attrEntities.forEach(item -> { attrEntities.forEach(item -> {
item.setDelFlag(0); item.setDelFlag(ResourceEntityDelFlag.NORMAL.getFlag());
item.setDataResourceId(resourceID); item.setDataResourceId(resourceID);
attrDao.insert(item); attrDao.insert(item);
}); });
@ -130,7 +126,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
attrDao.delete4Resource(list); attrDao.delete4Resource(list);
List<AttrEntity> attrEntities = dto.getInfoList(); List<AttrEntity> attrEntities = dto.getInfoList();
attrEntities.forEach(item -> { attrEntities.forEach(item -> {
item.setDelFlag(0); item.setDelFlag(ResourceEntityDelFlag.NORMAL.getFlag());
attrDao.insert(item); attrDao.insert(item);
}); });
} }
@ -144,7 +140,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
} }
QueryWrapper<AttrEntity> wrapper = new QueryWrapper<>(); QueryWrapper<AttrEntity> wrapper = new QueryWrapper<>();
wrapper.eq("data_resource_id", id) wrapper.eq("data_resource_id", id)
.eq("del_flag", 0); .eq("del_flag", ResourceEntityDelFlag.NORMAL.getFlag());
List<AttrEntity> attrEntities = attrDao.selectList(wrapper); List<AttrEntity> attrEntities = attrDao.selectList(wrapper);
resourceDTO.setInfoList(attrEntities == null ? new ArrayList<>() : attrEntities); // npe? resourceDTO.setInfoList(attrEntities == null ? new ArrayList<>() : attrEntities); // npe?
return resourceDTO; return resourceDTO;
@ -189,7 +185,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
public List<AttrEntity> selectAttrsByResourceId(Long resourceId) { public List<AttrEntity> selectAttrsByResourceId(Long resourceId) {
QueryWrapper<AttrEntity> wrapper = new QueryWrapper<>(); QueryWrapper<AttrEntity> wrapper = new QueryWrapper<>();
wrapper.eq("data_resource_id", resourceId) wrapper.eq("data_resource_id", resourceId)
.eq("del_flag", 0) .eq("del_flag", ResourceEntityDelFlag.NORMAL.getFlag())
.orderByDesc("attr_type"); .orderByDesc("attr_type");
return attrDao.selectList(wrapper); return attrDao.selectList(wrapper);
} }
@ -212,7 +208,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
QueryWrapper<ResourceEntity> queryWrapper = new QueryWrapper<>(); QueryWrapper<ResourceEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.orderByDesc("create_date") queryWrapper.orderByDesc("create_date")
.eq(StringUtils.isNotBlank(jsonObject.getString("type")), "type", jsonObject.getString("type")) .eq(StringUtils.isNotBlank(jsonObject.getString("type")), "type", jsonObject.getString("type"))
.eq("del_flag", 0); .eq("del_flag", ResourceEntityDelFlag.NORMAL.getFlag());
IPage<ResourceEntity> entityIPage = resourceDao.selectPage(page, queryWrapper); IPage<ResourceEntity> entityIPage = resourceDao.selectPage(page, queryWrapper);
return entityIPage; return entityIPage;
@ -225,7 +221,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
List<ResourceDTO> resourceDTOS = resourceDao.selectMostPopular(selectMap); List<ResourceDTO> resourceDTOS = resourceDao.selectMostPopular(selectMap);
page.setRecords(resourceDTOS); page.setRecords(resourceDTOS);
QueryWrapper<ResourceEntity> queryWrapper = new QueryWrapper<>(); QueryWrapper<ResourceEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("del_flag", 0).eq("type", jsonObject.getString("type")); queryWrapper.eq("del_flag", ResourceEntityDelFlag.NORMAL.getFlag()).eq("type", jsonObject.getString("type"));
Integer count = resourceDao.selectCount(queryWrapper); Integer count = resourceDao.selectCount(queryWrapper);
page.setTotal(count); page.setTotal(count);
return page; return page;
@ -239,7 +235,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
UpdateWrapper<ResourceEntity> updateWrapper = new UpdateWrapper<>(); UpdateWrapper<ResourceEntity> updateWrapper = new UpdateWrapper<>();
updateWrapper.lambda() updateWrapper.lambda()
.eq(ResourceEntity::getId, resourceEntity.getId()) .eq(ResourceEntity::getId, resourceEntity.getId())
.eq(ResourceEntity::getDelFlag, 0); .eq(ResourceEntity::getDelFlag, ResourceEntityDelFlag.NORMAL.getFlag());
resourceDao.update(entity, updateWrapper); resourceDao.update(entity, updateWrapper);
} }

View File

@ -214,7 +214,7 @@
GROUP BY id) taa2 ON tdr.id = taa2.resource_id GROUP BY id) taa2 ON tdr.id = taa2.resource_id
LEFT JOIN sys_dept sd ON tdr.dept_id = sd.id LEFT JOIN sys_dept sd ON tdr.dept_id = sd.id
WHERE 1 = 1 WHERE 1 = 1
AND tdr.del_flag = 0 <!-- AND tdr.del_flag = 0-->
AND tdr.id = #{id} AND tdr.id = #{id}
</select> </select>

View File

@ -45,7 +45,7 @@
select trc.* select trc.*
from tb_resource_car trc from tb_resource_car trc
<if test="(params.type != null and params.type != '') or (params.name != null and params.name != '')"> <if test="(params.type != null and params.type != '') or (params.name != null and params.name != '')">
left join tb_data_resource tdr on trc.resource_id = tdr.id and tdr.del_flag = 0 left join tb_data_resource tdr on trc.resource_id = tdr.id and tdr.del_flag != 1
</if> </if>
where 1 = 1 where 1 = 1
and trc.del_flag = 0 and trc.del_flag = 0

View File

@ -57,7 +57,7 @@
SELECT trc.* SELECT trc.*
FROM tb_resource_collection trc FROM tb_resource_collection trc
<if test="(params.type != null and params.type != '') or (params.name != null and params.name != '')"> <if test="(params.type != null and params.type != '') or (params.name != null and params.name != '')">
LEFT JOIN tb_data_resource tdr ON trc.resource_id = tdr.id AND tdr.del_flag = 0 LEFT JOIN tb_data_resource tdr ON trc.resource_id = tdr.id AND tdr.del_flag != 1
</if> </if>
WHERE 1 = 1 WHERE 1 = 1
AND trc.del_flag = 0 AND trc.del_flag = 0