diff --git a/renren-admin/src/main/java/io/renren/modules/processForm/listener/CorrectionListener.java b/renren-admin/src/main/java/io/renren/modules/processForm/listener/CorrectionListener.java index 82b6acbd..04e4828d 100644 --- a/renren-admin/src/main/java/io/renren/modules/processForm/listener/CorrectionListener.java +++ b/renren-admin/src/main/java/io/renren/modules/processForm/listener/CorrectionListener.java @@ -24,6 +24,7 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; import java.util.Map; +import java.util.Optional; /** * 部门动态审批人 @@ -160,5 +161,13 @@ public class CorrectionListener implements TaskListener, ExecutionListener, Acti logger.error("未查到该部门对应的 " + roleName); taskService.setAssignee(delegateTask.getId(), "1516728698224427010"); } + + Optional 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()); + } + }); } } diff --git a/renren-admin/src/main/java/io/renren/modules/processForm/listener/DataCenterListener.java b/renren-admin/src/main/java/io/renren/modules/processForm/listener/DataCenterListener.java index 03f307e5..24cf119c 100644 --- a/renren-admin/src/main/java/io/renren/modules/processForm/listener/DataCenterListener.java +++ b/renren-admin/src/main/java/io/renren/modules/processForm/listener/DataCenterListener.java @@ -1,5 +1,10 @@ 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.SysRoleDTO; 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.stereotype.Component; +import java.util.Map; +import java.util.Optional; + /** * 大数据局动态审批人 */ @@ -39,6 +47,8 @@ public class DataCenterListener implements TaskListener, ExecutionListener, Acti private SysRoleUserService sysRoleUserService; @Autowired private SysDeptService sysDeptService; + @Autowired + private ResourceService resourceService; @Override public void notify(DelegateExecution delegateExecution) throws Exception { @@ -96,5 +106,18 @@ public class DataCenterListener implements TaskListener, ExecutionListener, Acti delegateTask.setAssignee("1516728698224427010"); logger.info("未查到该部门对应 " + roleName); } + + Map kv = delegateTask.getVariables(); + Gson gson = new Gson(); + JsonElement jsonElement = gson.toJsonTree(kv); + TAbilityApplicationDTO abilityApplicationDTO = gson.fromJson(jsonElement, TAbilityApplicationDTO.class); + Optional 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()); + } + }); + } } diff --git a/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java index d090cd7c..a421a5a2 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java @@ -15,6 +15,7 @@ import io.renren.modules.resource.dao.ResourceDao; import io.renren.modules.resource.dto.ResourceDTO; import io.renren.modules.resource.entity.AttrEntity; 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.resourceCar.dao.ResourceCarDao; import io.renren.modules.resourceCollection.dao.ResourceCollectionDao; @@ -72,13 +73,8 @@ public class ResourceServiceImpl extends CrudServiceImpl attrEntities = dto.getInfoList(); attrEntities.forEach(item -> { - item.setDelFlag(0); + item.setDelFlag(ResourceEntityDelFlag.NORMAL.getFlag()); item.setDataResourceId(resourceID); attrDao.insert(item); }); @@ -130,7 +126,7 @@ public class ResourceServiceImpl extends CrudServiceImpl attrEntities = dto.getInfoList(); attrEntities.forEach(item -> { - item.setDelFlag(0); + item.setDelFlag(ResourceEntityDelFlag.NORMAL.getFlag()); attrDao.insert(item); }); } @@ -144,7 +140,7 @@ public class ResourceServiceImpl extends CrudServiceImpl wrapper = new QueryWrapper<>(); wrapper.eq("data_resource_id", id) - .eq("del_flag", 0); + .eq("del_flag", ResourceEntityDelFlag.NORMAL.getFlag()); List attrEntities = attrDao.selectList(wrapper); resourceDTO.setInfoList(attrEntities == null ? new ArrayList<>() : attrEntities); // npe? return resourceDTO; @@ -189,7 +185,7 @@ public class ResourceServiceImpl extends CrudServiceImpl selectAttrsByResourceId(Long resourceId) { QueryWrapper wrapper = new QueryWrapper<>(); wrapper.eq("data_resource_id", resourceId) - .eq("del_flag", 0) + .eq("del_flag", ResourceEntityDelFlag.NORMAL.getFlag()) .orderByDesc("attr_type"); return attrDao.selectList(wrapper); } @@ -212,7 +208,7 @@ public class ResourceServiceImpl extends CrudServiceImpl queryWrapper = new QueryWrapper<>(); queryWrapper.orderByDesc("create_date") .eq(StringUtils.isNotBlank(jsonObject.getString("type")), "type", jsonObject.getString("type")) - .eq("del_flag", 0); + .eq("del_flag", ResourceEntityDelFlag.NORMAL.getFlag()); IPage entityIPage = resourceDao.selectPage(page, queryWrapper); return entityIPage; @@ -225,7 +221,7 @@ public class ResourceServiceImpl extends CrudServiceImpl resourceDTOS = resourceDao.selectMostPopular(selectMap); page.setRecords(resourceDTOS); QueryWrapper 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); page.setTotal(count); return page; @@ -239,7 +235,7 @@ public class ResourceServiceImpl extends CrudServiceImpl updateWrapper = new UpdateWrapper<>(); updateWrapper.lambda() .eq(ResourceEntity::getId, resourceEntity.getId()) - .eq(ResourceEntity::getDelFlag, 0); + .eq(ResourceEntity::getDelFlag, ResourceEntityDelFlag.NORMAL.getFlag()); resourceDao.update(entity, updateWrapper); } diff --git a/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml b/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml index 49df40fd..95b259f5 100644 --- a/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml +++ b/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml @@ -214,7 +214,7 @@ GROUP BY id) taa2 ON tdr.id = taa2.resource_id LEFT JOIN sys_dept sd ON tdr.dept_id = sd.id WHERE 1 = 1 - AND tdr.del_flag = 0 + AND tdr.id = #{id} diff --git a/renren-admin/src/main/resources/mapper/resourceCar/ResourceCarDao.xml b/renren-admin/src/main/resources/mapper/resourceCar/ResourceCarDao.xml index be86b2f9..ab9d3efd 100644 --- a/renren-admin/src/main/resources/mapper/resourceCar/ResourceCarDao.xml +++ b/renren-admin/src/main/resources/mapper/resourceCar/ResourceCarDao.xml @@ -45,7 +45,7 @@ select trc.* from tb_resource_car trc - 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 where 1 = 1 and trc.del_flag = 0 diff --git a/renren-admin/src/main/resources/mapper/resourceCollection/ResourceCollectionDao.xml b/renren-admin/src/main/resources/mapper/resourceCollection/ResourceCollectionDao.xml index 4850bebf..acd8783a 100644 --- a/renren-admin/src/main/resources/mapper/resourceCollection/ResourceCollectionDao.xml +++ b/renren-admin/src/main/resources/mapper/resourceCollection/ResourceCollectionDao.xml @@ -57,7 +57,7 @@ SELECT trc.* FROM tb_resource_collection trc - 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 WHERE 1 = 1 AND trc.del_flag = 0