浏览代码

Merge branch 'V0.0.3' of http://10.87.21.221:8000/jzyd_yyds/soc into V0.0.3

zhulu 1 年之前
父节点
当前提交
3d4147fde7
共有 14 个文件被更改,包括 197 次插入98 次删除
  1. 23 0
      project_data/sql/0.0.3/soc/soc.sql
  2. 2 2
      soc-common/soc-common-core/src/main/java/com/xunmei/common/core/enums/ExecTimeCommonEnum.java
  3. 21 14
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/TaskCreatingServiceImplBase.java
  4. 12 12
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/board/controller/AppCockpitController.java
  5. 3 0
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/board/dto/app/AppTaskRankingDto.java
  6. 14 7
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/board/service/AppCockpitService.java
  7. 19 16
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/board/service/impl/AppCockpitServiceImpl.java
  8. 4 4
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/controller/AppRuleItemController.java
  9. 74 32
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/task/ResumptionTaskBusiness.java
  10. 6 5
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/safetyCheck/controller/SafetyCheckRuleItemController.java
  11. 1 1
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/safetyCheck/vo/regsiter/AppTaskRegisterPointVo.java
  12. 1 1
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/safetyCheck/vo/regsiter/TaskRegisterPointVo.java
  13. 12 1
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/safetyCheck/vo/regsiter/TaskRegisterVo.java
  14. 5 3
      soc-modules/soc-modules-core/src/main/resources/mapper/safetycheck/CoreSafetyTaskMapper.xml

+ 23 - 0
project_data/sql/0.0.3/soc/soc.sql

@@ -1175,6 +1175,29 @@ INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (122, 0172401740487231
 
 -- 删除检查登记授权按钮权限
 DELETE from sys_menu WHERE perms='core:safetycheck:grant'  and menu_type='F';
+
+-- 删除履职内容库管理页面,改为按钮
+DELETE FROM sys_menu WHERE menu_name like '履职内容库管理%';
+DELETE FROM sys_role_menu WHERE menu_id =1726808689796902913;
+INSERT INTO `sys_menu` (`id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `platform_type`, `icon`, `image_path`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (01726808689796902913, '履职内容库管理', 2004, 5, '', NULL, NULL, 1, 0, 'F', '0', '0', 'resumption:rule:contentmanage', '1', NULL, NULL, 'jwx', '2023-11-21 11:44:08', '', NULL, '');
+INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (115, 1726808689796902913);
+INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (116, 1726808689796902913);
+INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (117, 1726808689796902913);
+INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (118, 1726808689796902913);
+INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (119, 1726808689796902913);
+INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (120, 1726808689796902913);
+
+DELETE FROM sys_menu WHERE id =2332 or parent_id=2332 or id=01726875550324551681;
+DELETE FROM sys_role_menu WHERE menu_id =01726875550324551681;
+
+INSERT INTO `sys_menu` (`id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `platform_type`, `icon`, `image_path`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (01726875550324551681, '内容库管理', 2327, 5, '', NULL, NULL, 1, 0, 'F', '0', '0', 'safetycheck.rule:contentmanage', '1', NULL, NULL, 'jwx', '2023-11-21 16:09:49', '', NULL, '');
+INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (115, 01726875550324551681);
+INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (116, 01726875550324551681);
+INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (117, 01726875550324551681);
+INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (118, 01726875550324551681);
+INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (119, 01726875550324551681);
+INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (120, 01726875550324551681);
+
 DELETE from sys_role_menu WHERE menu_id not in (SELECT id from sys_menu);
 
 -- 履职任务类型修正

+ 2 - 2
soc-common/soc-common-core/src/main/java/com/xunmei/common/core/enums/ExecTimeCommonEnum.java

@@ -13,8 +13,8 @@ public enum ExecTimeCommonEnum {
     Before(2,"营业前"),
     Business(3,"营业期间"),
     After(4,"营业期间"),
-    NoBusiness(5,"非营业时间");
-
+    NoBusiness(5,"非营业时间"),
+    WorkingTime(6,"工作时间");
 
     private final Integer code;
     private final String desc;

+ 21 - 14
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/TaskCreatingServiceImplBase.java

@@ -7,6 +7,7 @@ import cn.hutool.core.date.DateUnit;
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.ObjectUtil;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.google.common.collect.Lists;
 import com.xunmei.common.core.constant.Constants;
 import com.xunmei.common.core.constant.SecurityConstants;
 import com.xunmei.common.core.domain.DateRange;
@@ -36,6 +37,12 @@ public abstract class TaskCreatingServiceImplBase<M extends BaseMapper<T>, T> ex
     private RemoteOrgService orgService;
 
     public void rebuildTask(WorkTimeChangeEvent timeChangeEvent) {
+        List<SysOrg> orgs = remoteOrgService.selectOrgByIdList(timeChangeEvent.getOrgIds(), SecurityConstants.INNER);
+        Set<Long> bankingIds = orgs.stream().filter(o -> ObjectUtil.equal(o.getType(), OrgTypeEnum.YINGYE_WANGDIAN.getCode())).map(SysOrg::getId)
+                .collect(Collectors.toSet());
+        timeChangeEvent.setDataList(timeChangeEvent.getDataList().stream().filter(d -> bankingIds.contains(d.getOrgId())).collect(Collectors.toList()));
+        timeChangeEvent.setOrgIds(bankingIds.stream().collect(Collectors.toList()));
+
         if (containCurrentCycle(timeChangeEvent.getDataList(), CycleCommonEnum.DAILY)) {
             SysWorkTime today = timeChangeEvent.getDataList().stream().filter(d -> d.getYmdDate().equals(DateUtil.beginOfDay(new Date()))).findFirst().get();
             rebuildDayTask(timeChangeEvent.getOrgIds(), today);
@@ -159,17 +166,17 @@ public abstract class TaskCreatingServiceImplBase<M extends BaseMapper<T>, T> ex
         return allHangshe.getData();
     }
 
-    /**
-     * 获取作息变更相关机构,某个周期的作息
-     *
-     * @param now
-     * @param cycle
-     * @param event
-     * @return
-     */
-    protected List<SysWorkTime> selectWorkTimeList(Date now, CycleCommonEnum cycle, WorkTimeChangeEvent event) {
-        return selectWorkTimeList(now, cycle, event.getOrgIds());
-    }
+//    /**
+//     * 获取作息变更相关机构,某个周期的作息
+//     *
+//     * @param now
+//     * @param cycle
+//     * @param event
+//     * @return
+//     */
+//    protected List<SysWorkTime> selectWorkTimeList(Date now, CycleCommonEnum cycle, WorkTimeChangeEvent event) {
+//        return selectWorkTimeList(now, cycle, event.getOrgIds());
+//    }
 
     /**
      * 获取机构某个周期的作息
@@ -255,7 +262,7 @@ public abstract class TaskCreatingServiceImplBase<M extends BaseMapper<T>, T> ex
 
 
     /**
-     * 返回机构的值班打卡时间作息
+     * 返回机构的值班打卡时间或营业作息
      *
      * @param now
      * @param cycle
@@ -354,7 +361,7 @@ public abstract class TaskCreatingServiceImplBase<M extends BaseMapper<T>, T> ex
      * @param frequency
      * @param start
      * @param end
-     * @param workTimes
+     * @param workTimes,则认为全是营业
      * @return
      */
     protected Map<Short, StartEndTime> splitTaskTime(Short frequency, CycleCommonEnum cycle, Date start, Date end, List<SysWorkTime> workTimes) {
@@ -415,7 +422,7 @@ public abstract class TaskCreatingServiceImplBase<M extends BaseMapper<T>, T> ex
                 continue;
             }
 
-            if (containCurrentCycle(workTimes, et.getStartTime(), et.getEndTime())) {
+            if (workTimes == null || containCurrentCycle(workTimes, et.getStartTime(), et.getEndTime())) {
                 r.put(i, et);
             }
         }

+ 12 - 12
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/board/controller/AppCockpitController.java

@@ -45,8 +45,8 @@ public class AppCockpitController extends BaseController {
      */
     @ApiOperation(value = "总览", response = AppOverviewVo.class)
     @GetMapping("/overview")
-    public AjaxResult overview() throws ExecutionException, InterruptedException, TimeoutException {
-        AppOverviewVo vo = appCockpitService.overview();
+    public AjaxResult overview(Long orgId) throws ExecutionException, InterruptedException, TimeoutException {
+        AppOverviewVo vo = appCockpitService.overview(orgId);
         return success(vo);
     }
 
@@ -66,8 +66,8 @@ public class AppCockpitController extends BaseController {
     @ApiOperation(value = "基础信息")
 //    @ApiResponse(content =@Content(schema = @Schema(implementation = AppBaseInfoVo.class)))
     @GetMapping("/baseInfo")
-    public AjaxResult baseInfo() {
-        AppBaseInfoVo vo = appCockpitService.baseInfo();
+    public AjaxResult baseInfo(Long orgId) {
+        AppBaseInfoVo vo = appCockpitService.baseInfo(orgId);
         return success(vo);
     }
 
@@ -76,8 +76,8 @@ public class AppCockpitController extends BaseController {
      */
     @ApiOperation(value = "综合数据-履职", response = AppSyntheticResumptionVo.class)
     @GetMapping("/synthetic/resumption")
-    public AjaxResult syntheticResumption(@NotNull @Validated Date month) {
-        AppSyntheticResumptionVo vo = appCockpitService.syntheticResumption(month);
+    public AjaxResult syntheticResumption(Date month, Long orgId) {
+        AppSyntheticResumptionVo vo = appCockpitService.syntheticResumption(orgId, month);
         return success(vo);
     }
 
@@ -86,8 +86,8 @@ public class AppCockpitController extends BaseController {
      */
     @ApiOperation(value = "综合数据-问题整改", response = AppSyntheticQuestionVo.class)
     @GetMapping("/synthetic/question")
-    public AjaxResult syntheticQuestion(Date month) {
-        AppSyntheticQuestionVo vo = appCockpitService.syntheticQuestion(month);
+    public AjaxResult syntheticQuestion(Date month, Long orgId) {
+        AppSyntheticQuestionVo vo = appCockpitService.syntheticQuestion(orgId, month);
         return success(vo);
     }
 
@@ -96,8 +96,8 @@ public class AppCockpitController extends BaseController {
      */
     @ApiOperation(value = "综合数据-安全检查", response = AppSyntheticSafetycheckVo.class)
     @GetMapping("/synthetic/safetycheck")
-    public AjaxResult syntheticSafetycheck(@RequestParam @Valid Date month) {
-        AppSyntheticSafetycheckVo vo = appCockpitService.syntheticSafetyCheck(month);
+    public AjaxResult syntheticSafetycheck(Date month, Long orgId) {
+        AppSyntheticSafetycheckVo vo = appCockpitService.syntheticSafetyCheck(orgId, month);
         return success(vo);
     }
 
@@ -116,8 +116,8 @@ public class AppCockpitController extends BaseController {
      */
     @ApiOperation(value = "综合数据-其它", response = AppSyntheticOtherVo.class)
     @GetMapping("/synthetic/other")
-    public AjaxResult syntheticOther(Date date) throws ExecutionException, InterruptedException, TimeoutException {
-        AppSyntheticOtherVo vo = appCockpitService.syntheticOther(date);
+    public AjaxResult syntheticOther(Date date, Long orgId) throws ExecutionException, InterruptedException, TimeoutException {
+        AppSyntheticOtherVo vo = appCockpitService.syntheticOther(orgId, date);
         return success(vo);
     }
 }

+ 3 - 0
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/board/dto/app/AppTaskRankingDto.java

@@ -15,4 +15,7 @@ public class AppTaskRankingDto {
 
     @ApiModelProperty(value ="月份")
     private Date month;
+
+    @ApiModelProperty("机构id")
+    private Long orgId;
 }

+ 14 - 7
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/board/service/AppCockpitService.java

@@ -6,11 +6,12 @@ import com.xunmei.core.board.vo.app.*;
 import java.util.List;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.TimeoutException;
-import  java.util.Date;
+import java.util.Date;
 
 public interface AppCockpitService {
     /**
      * 履职排名
+     *
      * @param dto
      * @return
      */
@@ -18,36 +19,41 @@ public interface AppCockpitService {
 
     /**
      * 基础信息
+     *
      * @return
      */
-    AppBaseInfoVo baseInfo() ;
+    AppBaseInfoVo baseInfo(Long orgId);
 
     /**
      * 总览
+     *
      * @return
      */
-    AppOverviewVo overview()  throws ExecutionException, InterruptedException, TimeoutException;
+    AppOverviewVo overview(Long orgId) throws ExecutionException, InterruptedException, TimeoutException;
 
     /**
      * 综合数据-履职
+     *
      * @param month
      * @return
      */
-    AppSyntheticResumptionVo syntheticResumption(Date month);
+    AppSyntheticResumptionVo syntheticResumption(Long orgId, Date month);
 
     /**
      * 综合数据-问题整改
+     *
      * @param month
      * @return
      */
-    AppSyntheticQuestionVo syntheticQuestion(Date month);
+    AppSyntheticQuestionVo syntheticQuestion(Long orgId, Date month);
 
     /**
      * 综合数据-安全检查
+     *
      * @param month
      * @return
      */
-    AppSyntheticSafetycheckVo syntheticSafetyCheck(Date month);
+    AppSyntheticSafetycheckVo syntheticSafetyCheck(Long orgId, Date month);
 
 //    /**
 //     * 综合数据-预案演练
@@ -58,8 +64,9 @@ public interface AppCockpitService {
 
     /**
      * 综合数据-其它
+     *
      * @param date
      * @return
      */
-    AppSyntheticOtherVo syntheticOther(Date date) throws ExecutionException, InterruptedException, TimeoutException;
+    AppSyntheticOtherVo syntheticOther(Long orgId, Date date) throws ExecutionException, InterruptedException, TimeoutException;
 }

+ 19 - 16
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/board/service/impl/AppCockpitServiceImpl.java

@@ -63,7 +63,7 @@ public class AppCockpitServiceImpl implements AppCockpitService {
     @Override
     public List<AppTaskRankingVo> taskRanking(AppTaskRankingDto dto) {
         DateRange range = DateUtils.getStartAndEnd(dto.getMonth(), CycleCommonEnum.MONTHLY);
-        SysOrg org = remoteOrgService.selectOrgById(SecurityUtils.getLoginUser().getOrgId(), SecurityConstants.INNER);
+        SysOrg org =getLoginOrg(dto.getOrgId());
         String orgPath = org.getPath();
         List<TaskStatisticVo> list = cockpitMapper.resumption(range.getStartTime(), range.getEndTime(), orgPath);
 
@@ -114,8 +114,8 @@ public class AppCockpitServiceImpl implements AppCockpitService {
      * @return
      */
     @Override
-    public AppBaseInfoVo baseInfo() {
-        SysOrg org = getLoginOrg();
+    public AppBaseInfoVo baseInfo(Long orgId) {
+        SysOrg org = getLoginOrg(orgId);
 
         AppBaseInfoVo vo = new AppBaseInfoVo();
         AppOrgBaseInfoDto baseInfoDto = appCockpitMapper.selectOrgBaseInfo(org.getPath());
@@ -166,8 +166,8 @@ public class AppCockpitServiceImpl implements AppCockpitService {
      * @return
      */
     @Override
-    public AppOverviewVo overview() throws ExecutionException, InterruptedException, TimeoutException {
-        SysOrg org = getLoginOrg();
+    public AppOverviewVo overview(Long orgId) throws ExecutionException, InterruptedException, TimeoutException {
+        SysOrg org = getLoginOrg(orgId);
         AppOverviewVo vo = new AppOverviewVo();
 
         Date currentMonth = DateUtil.beginOfMonth(new Date());
@@ -241,8 +241,8 @@ public class AppCockpitServiceImpl implements AppCockpitService {
     }
 
     @Override
-    public AppSyntheticResumptionVo syntheticResumption(Date month) {
-        SysOrg org = getLoginOrg();
+    public AppSyntheticResumptionVo syntheticResumption(Long orgId, Date month) {
+        SysOrg org = getLoginOrg(orgId);
         DateRange range = DateUtils.getStartAndEnd(month, CycleCommonEnum.MONTHLY);
         List<AppSyntheticTaskCategoryDto> taskCategoryDtos = appCockpitMapper.selectSyntheticResumption(org.getPath(), range.getStartTime(), range.getEndTime());
 
@@ -273,8 +273,8 @@ public class AppCockpitServiceImpl implements AppCockpitService {
     }
 
     @Override
-    public AppSyntheticQuestionVo syntheticQuestion(Date month) {
-        SysOrg org = getLoginOrg();
+    public AppSyntheticQuestionVo syntheticQuestion(Long orgId, Date month) {
+        SysOrg org = getLoginOrg(orgId);
         DateRange range = DateUtils.getStartAndEnd(month, CycleCommonEnum.MONTHLY);
         AppSyntheticQuestionDto questionDto = appCockpitMapper.selectSyntheticQuestion(org.getPath(), range.getStartTime(), range.getEndTime());
         int overdueCount = appCockpitMapper.selectOverDueQuestionCount(org.getPath(), range.getStartTime(), range.getEndTime());
@@ -307,8 +307,8 @@ public class AppCockpitServiceImpl implements AppCockpitService {
     }
 
     @Override
-    public AppSyntheticSafetycheckVo syntheticSafetyCheck(Date month) {
-        SysOrg org = getLoginOrg();
+    public AppSyntheticSafetycheckVo syntheticSafetyCheck(Long orgId, Date month) {
+        SysOrg org = getLoginOrg(orgId);
         DateRange range = DateUtils.getStartAndEnd(month, CycleCommonEnum.MONTHLY);
         List<AppSyntheticTaskCategoryDto> taskCategoryDtos = appCockpitMapper.selectSyntheticSafetyCheck(org.getPath(), range.getStartTime(), range.getEndTime());
 
@@ -385,8 +385,8 @@ public class AppCockpitServiceImpl implements AppCockpitService {
 //    }
 
     @Override
-    public AppSyntheticOtherVo syntheticOther(Date date) throws ExecutionException, InterruptedException, TimeoutException {
-        SysOrg org = getLoginOrg();
+    public AppSyntheticOtherVo syntheticOther(Long orgId, Date date) throws ExecutionException, InterruptedException, TimeoutException {
+        SysOrg org = getLoginOrg(orgId);
         DateRange range = DateUtils.getStartAndEnd(date, CycleCommonEnum.QUARTERLY);
         CompletableFuture<AppSyntheticTaskCategoryDto> edu = CompletableFuture.supplyAsync(() ->
                 appCockpitMapper.selectSyntheticEdu(org.getPath(), range.getStartTime(), range.getEndTime()), threadPoolTaskExecutor
@@ -403,7 +403,7 @@ public class AppCockpitServiceImpl implements AppCockpitService {
         );
 
         CompletableFuture<Void> allQueries = CompletableFuture.allOf(
-                inout, edu,drill, monitor
+                inout, edu, drill, monitor
         );
 
         allQueries.get(TIMEOUT, TimeUnit.SECONDS);
@@ -451,8 +451,11 @@ public class AppCockpitServiceImpl implements AppCockpitService {
     }
 
 
-    private SysOrg getLoginOrg() {
-        SysOrg org = remoteOrgService.selectOrgById(SecurityUtils.getLoginUser().getOrgId(), SecurityConstants.INNER);
+    private SysOrg getLoginOrg(Long orgId) {
+        if (ObjectUtil.isNull(orgId)) {
+            orgId = SecurityUtils.getLoginUser().getOrgId();
+        }
+        SysOrg org = remoteOrgService.selectOrgById(orgId, SecurityConstants.INNER);
         if (ObjectUtil.isNull(org)) {
             throw new ServiceException("未获取到登录机构");
         }

+ 4 - 4
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/controller/AppRuleItemController.java

@@ -33,21 +33,21 @@ public class AppRuleItemController extends BaseController {
 
     @ApiOperation(value = "新增/编辑")
     @PostMapping("edit")
-    @RequiresPermissions(value={"resumption:ruleManager:edit","resumption:ruleManager:add"})
+    @RequiresPermissions(value={"resumption:rule:contentmanage"})
     public AjaxResult edit(@RequestBody AppRuleItemDto appRuleItemDto) {
         return success(appRuleItemService.edit(appRuleItemDto));
     }
 
     @ApiOperation(value = "分页查询")
     @GetMapping("page")
-    @RequiresPermissions("resumption:ruleManager:query")
+    @RequiresPermissions("resumption:rule:contentmanage")
     public TableDataInfo page(AppRuleItemPageDto itemPageDto) {
         return appRuleItemService.pageQuery(itemPageDto);
     }
 
     @ApiOperation(value = "删除")
     @DeleteMapping("{id}")
-    @RequiresPermissions("resumption:ruleManager:remove")
+    @RequiresPermissions("resumption:rule:contentmanage")
     public AjaxResult del(@PathVariable("id") Long id) {
         return success(appRuleItemService.del(id));
     }
@@ -60,7 +60,7 @@ public class AppRuleItemController extends BaseController {
 
     @ApiOperation(value = "机构+内容库树")
     @GetMapping("/rule/tree")
-    @RequiresPermissions("resumption:ruleManager:query")
+    @RequiresPermissions("resumption:rule:contentmanage")
     public AjaxResult getRuleTree() {
         return success(appRuleItemService.getRuleTree(SecurityUtils.getLoginUser().getSysUser().getOrgId()));
     }

+ 74 - 32
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/task/ResumptionTaskBusiness.java

@@ -14,6 +14,7 @@ import com.xunmei.common.core.domain.DateRange;
 import com.xunmei.common.core.domain.worktime.domain.SysWorkTime;
 import com.xunmei.common.core.enums.CycleCommonEnum;
 import com.xunmei.common.core.enums.ExecTimeCommonEnum;
+import com.xunmei.common.core.enums.OrgTypeEnum;
 import com.xunmei.common.core.utils.DateUtils;
 import com.xunmei.common.core.utils.StringUtils;
 import com.xunmei.common.core.utils.Ymd;
@@ -118,25 +119,25 @@ public class ResumptionTaskBusiness extends TaskCreatingServiceImplBase<Resumpti
 
             CycleCommonEnum cycleCommonEnum = CycleCommonEnum.getEnum(appPlan.getPlanCycle());
             DateRange range = DateUtils.getStartAndEnd(date, cycleCommonEnum);
-            Map<Long, List<SysWorkTime>> workTimes = null;
-            if (ObjectUtil.equal(appPlan.getPlanExec(), 5)) {
-                workTimes = orgDutyTimes(new Date(), cycleCommonEnum, orgs.stream().map(SysOrg::getId).collect(Collectors.toList()));
-            } else {
-                workTimes = orgWorkingTimes(new Date(), cycleCommonEnum, orgs.stream().map(SysOrg::getId).collect(Collectors.toList()));
-            }
+            Map<Long, List<SysWorkTime>> workTimes = orgDutyOrWorkTimes(new Date(), cycleCommonEnum, orgs.stream().map(SysOrg::getId).collect(Collectors.toList()));
+//            if (ObjectUtil.equal(appPlan.getPlanExec(), 5)) {
+//                workTimes = orgDutyTimes(new Date(), cycleCommonEnum, orgs.stream().map(SysOrg::getId).collect(Collectors.toList()));
+//            } else {
+//                workTimes = orgWorkingTimes(new Date(), cycleCommonEnum, orgs.stream().map(SysOrg::getId).collect(Collectors.toList()));
+//            }
 
             for (SysOrg org : orgs) {
-                Long orgId = org.getId();
-                if (!workTimes.containsKey(orgId) || ObjectUtil.isNull(workTimes.get(orgId)) || CollectionUtils.isEmpty(workTimes.get(orgId))) {
-                    continue;
-                }
+//                Long orgId = org.getId();
+//                if (!workTimes.containsKey(orgId) || ObjectUtil.isNull(workTimes.get(orgId)) || CollectionUtils.isEmpty(workTimes.get(orgId))) {
+//                    continue;
+//                }
 
                 List<Resumption> tasks;
                 if (ObjectUtil.equal(CycleCommonEnum.DAILY.getCode(), appPlan.getPlanCycle())) {
-                    SysWorkTime workTime = workTimes.get(orgId).get(0);
-                    tasks = buildResumptions(appPlan, org, workTime, null, workTimes.get(orgId));
+//                    SysWorkTime workTime = workTimes.get(orgId).get(0);
+                    tasks = buildResumptions(appPlan, org, null, new Date(), workTimes);
                 } else {
-                    tasks = buildResumptions(appPlan, org, range.getStartTime(), range.getEndTime(), null, workTimes.get(orgId));
+                    tasks = buildResumptions(appPlan, org, range.getStartTime(), range.getEndTime(), null, workTimes);
                 }
 
                 if (CollectionUtils.isNotEmpty(tasks)) {
@@ -351,23 +352,23 @@ public class ResumptionTaskBusiness extends TaskCreatingServiceImplBase<Resumpti
                         .map(Resumption::getTimes)
                         .collect(Collectors.toList());
 
-
-                List<SysWorkTime> workTimes = new ArrayList<>();
-                if (ObjectUtil.equal(plan.getPlanExec(), 5)) {
-                    workTimes = workingMap.get(orgId).stream().filter(wt -> ObjectUtil.equal(wt.getIsDuty(), 1L)).collect(Collectors.toList());
-                } else {
-                    workTimes = workingMap.get(orgId).stream().filter(wt -> ObjectUtil.equal(wt.getIsEnable(), 1L)).collect(Collectors.toList());
-                }
-
-                if (CollectionUtils.isEmpty(workTimes)) {
-                    continue;
-                }
+//
+//                List<SysWorkTime> workTimes = new ArrayList<>();
+//                if (ObjectUtil.equal(plan.getPlanExec(), 5)) {
+//                    workTimes = workingMap.get(orgId).stream().filter(wt -> ObjectUtil.equal(wt.getIsDuty(), 1L)).collect(Collectors.toList());
+//                } else {
+//                    workTimes = workingMap.get(orgId).stream().filter(wt -> ObjectUtil.equal(wt.getIsEnable(), 1L)).collect(Collectors.toList());
+//                }
+//
+//                if (CollectionUtils.isEmpty(workTimes)) {
+//                    continue;
+//                }
 
                 List<Resumption> planResumptionList;
                 if (ObjectUtil.equal(cycle, CycleCommonEnum.DAILY)) {
-                    planResumptionList = this.buildResumptions(plan, org, workTime, executedOrders, workTimes);
+                    planResumptionList = this.buildResumptions(plan, org, executedOrders, new Date(), workingMap);
                 } else {
-                    planResumptionList = this.buildResumptions(plan, org, startDate, endDate, executedOrders, workTimes);
+                    planResumptionList = this.buildResumptions(plan, org, startDate, endDate, executedOrders, workingMap);
                 }
 
                 if (CollectionUtils.isNotEmpty(planResumptionList)) {
@@ -389,12 +390,36 @@ public class ResumptionTaskBusiness extends TaskCreatingServiceImplBase<Resumpti
         return resumptionService.update(wrapper);
     }
 
-    private List<Resumption> buildResumptions(AppPlan appPlan, SysOrg execOrg, SysWorkTime workTime, List<Short> executedOrders, List<SysWorkTime> workTimes) {
+    private List<Resumption> buildResumptions(AppPlan appPlan, SysOrg execOrg, List<Short> executedOrders, Date date, Map<Long, List<SysWorkTime>> workTimes) {
+        DateTime planstartTime = null;
+        DateTime planendTime = null;
+        if (!ObjectUtil.equal(execOrg.getType(), OrgTypeEnum.YINGYE_WANGDIAN.getCode())) {
+            //非营业网点的机构,与作息无关
+            planstartTime = DateUtil.beginOfDay(date);
+            planendTime = DateUtil.endOfDay(date);
+            return buildResumptions(appPlan, execOrg, planstartTime, planendTime, executedOrders, workTimes);
+        }
+
+        //营业网点没有作息
+        if (!workTimes.containsKey(execOrg.getId()) || CollectionUtils.isEmpty(workTimes.get(execOrg.getId()))) {
+            return null;
+        }
+
+        Optional<SysWorkTime> workTimeOptional = workTimes.get(execOrg.getId()).stream().filter(t -> DateUtil.isSameDay(t.getYmdDate(), date)).findFirst();
+        if (!workTimeOptional.isPresent()) {
+            return null; //没有找到某天的作息
+        }
+
+        if ((ObjectUtil.equal(appPlan.getPlanExec(), ExecTimeCommonEnum.NoBusiness.getCode()) && ObjectUtil.notEqual(workTimeOptional.get().getIsDuty(), 1L)) ||
+                (ObjectUtil.notEqual(appPlan.getPlanExec(), ExecTimeCommonEnum.NoBusiness.getCode()) && ObjectUtil.notEqual(workTimeOptional.get().getIsEnable(), 1L))) {
+            //非营业时间没有值班打卡或其它时刻没有营业,不生成任务
+            return null;
+        }
+
+        SysWorkTime workTime = workTimeOptional.get();
         DateTime dateTime = new DateTime(workTime.getYmdDate());
         String opentime = workTime.getOpenTime();//营业时间
         String closetime = workTime.getCloseTime();//营业终了
-        DateTime planstartTime = null;
-        DateTime planendTime = null;
 
 
         if (ObjectUtil.notEqual(appPlan.getPlanExec(), 5) && (StringUtils.isEmpty(opentime) || StringUtils.isEmpty(closetime))) {
@@ -459,10 +484,12 @@ public class ResumptionTaskBusiness extends TaskCreatingServiceImplBase<Resumpti
         return buildResumptions(appPlan, execOrg, planstartTime, planendTime, executedOrders, workTimes);
     }
 
-    private List<Resumption> buildResumptions(AppPlan appPlan, SysOrg execOrg, Date planStartTime, Date planEndTime, List<Short> executedOrders, List<SysWorkTime> workTimes) {
+    private List<Resumption> buildResumptions(AppPlan appPlan, SysOrg execOrg, Date planStartTime, Date planEndTime, List<Short> executedOrders, Map<Long, List<SysWorkTime>> allWorkTimes) {
         if (ObjectUtil.equal(execOrg.getIsLock(), 1)) {
             return new ArrayList<>();
         }
+        Map<Short, StartEndTime> rangeMap = null;
+
 
         List<Resumption> resumptionList = new ArrayList<>();
         Short count = 1;
@@ -470,8 +497,23 @@ public class ResumptionTaskBusiness extends TaskCreatingServiceImplBase<Resumpti
             count = Short.parseShort(appPlan.getCount());
         }
 
-        Map<Short, StartEndTime> rangeMap = splitTaskTime(count, CycleCommonEnum.getEnum(appPlan.getPlanCycle()),
-                planStartTime, planEndTime, workTimes);
+        if (ObjectUtil.equal(execOrg.getType(), OrgTypeEnum.YINGYE_WANGDIAN.getCode())) {
+            List<SysWorkTime> workTimes = null;
+            //营业网点,取作息
+            if (ObjectUtil.equal(appPlan.getPlanExec(), ExecTimeCommonEnum.NoBusiness.getCode())) {
+                //非营业时间,取值班打卡
+                workTimes = allWorkTimes.get(execOrg.getId()).stream().filter(e -> ObjectUtil.equal(e.getIsDuty(), 1L)).collect(Collectors.toList());
+            } else {
+                workTimes = allWorkTimes.get(execOrg.getId()).stream().filter(e -> ObjectUtil.equal(e.getIsEnable(), 1L)).collect(Collectors.toList());
+            }
+            rangeMap = splitTaskTime(count, CycleCommonEnum.getEnum(appPlan.getPlanCycle()),
+                    planStartTime, planEndTime, workTimes);
+        } else {
+            //非营业网点,认为全是营业
+            rangeMap = splitTaskTime(count, CycleCommonEnum.getEnum(appPlan.getPlanCycle()),
+                    planStartTime, planEndTime, null);
+        }
+
         short realOrder = 0;
         for (Short i = 1; i <= count; i++) {
             if (!rangeMap.containsKey(i)) {

+ 6 - 5
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/safetyCheck/controller/SafetyCheckRuleItemController.java

@@ -1,6 +1,7 @@
 package com.xunmei.core.safetyCheck.controller;
 
 
+import cn.hutool.core.date.DateUtil;
 import com.xunmei.common.core.web.controller.BaseController;
 import com.xunmei.common.core.web.domain.AjaxResult;
 import com.xunmei.common.core.web.page.TableDataInfo;
@@ -36,35 +37,35 @@ public class SafetyCheckRuleItemController extends BaseController {
 
     @ApiOperation(value = "新增/编辑")
     @PostMapping("edit")
-    @RequiresPermissions(value={"safetycheck:ruleManager:edit","safetycheck:ruleManager:add"})
+    @RequiresPermissions(value={"safetycheck:rule:contentmanage"})
     public AjaxResult edit(@RequestBody SafetyCheckRuleItemDto appRuleItemDto) {
         return success(safetyCheckRuleItemService.edit(appRuleItemDto));
     }
 
     @ApiOperation(value = "分页查询")
     @GetMapping("page")
-    @RequiresPermissions("safetycheck:ruleManager")
+    @RequiresPermissions("safetycheck:rule:contentmanage")
     public TableDataInfo page(SafetyCheckRuleItemPageDto itemPageDto) {
         return safetyCheckRuleItemService.pageQuery(itemPageDto);
     }
 
     @ApiOperation(value = "删除")
     @DeleteMapping("{id}")
-    @RequiresPermissions("safetycheck:ruleManager:remove")
+    @RequiresPermissions("safetycheck:rule:contentmanage")
     public AjaxResult del(@PathVariable("id") Long id) {
         return success(safetyCheckRuleItemService.del(id));
     }
 
     @ApiOperation(value = "详情")
     @GetMapping("{id}")
-    @RequiresPermissions("safetycheck:ruleManager:query")
+    @RequiresPermissions("safetycheck:rule:contentmanage")
     public AjaxResult findOne(@PathVariable("id") Long id) {
         return success(safetyCheckRuleItemService.findOne(id));
     }
 
     @ApiOperation(value = "机构树")
     @GetMapping("/rule/tree")
-    @RequiresPermissions("safetycheck:ruleManager")
+    @RequiresPermissions("safetycheck:rule:contentmanage")
     public AjaxResult getRuleTree() {
         return success(safetyCheckRuleItemService.getRuleTree(SecurityUtils.getLoginUser().getSysUser().getOrgId()));
     }

+ 1 - 1
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/safetyCheck/vo/regsiter/AppTaskRegisterPointVo.java

@@ -42,7 +42,7 @@ public class AppTaskRegisterPointVo {
     private Integer isAdd;
 
     @ApiModelProperty(value = "是否正常,0:正常,1:异常")
-    private Integer status=0;
+    private Integer status;
 
     @ApiModelProperty(value = "情况描述")
     private String remark;

+ 1 - 1
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/safetyCheck/vo/regsiter/TaskRegisterPointVo.java

@@ -28,7 +28,7 @@ public class TaskRegisterPointVo {
     private Integer isAdd;
 
     @ApiModelProperty(value = "是否正常,0:正常,1:异常")
-    private Integer status=0;
+    private Integer status;
 
     @ApiModelProperty(value = "情况描述")
     private String remark;

+ 12 - 1
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/safetyCheck/vo/regsiter/TaskRegisterVo.java

@@ -41,6 +41,9 @@ public class TaskRegisterVo<T> {
     @ApiModelProperty(value = "计划结束时间")
     private Date planEndTime;
 
+    @ApiModelProperty(value = "检查时间")
+    private Date submitTime;
+
     @ApiModelProperty(value = "检查机构id")
     @JsonSerialize(using = ToStringSerializer.class)
     private Long checkOrgId;
@@ -72,9 +75,15 @@ public class TaskRegisterVo<T> {
     @ApiModelProperty(value = "任务状态")
     private Integer status;
 
+    @ApiModelProperty(value = "异常数")
+    private Integer exceptionCount;
+
     @ApiModelProperty(value = "授权目标用户id")
     private Long grantUserId;
 
+    @ApiModelProperty
+    private String submitBy;
+
     @ApiModelProperty(value = "检查列表")
     private List<T> checkList;
 
@@ -86,6 +95,7 @@ public class TaskRegisterVo<T> {
         vo.setStatus(task.getStatus());
         vo.setPlanStartTime(task.getPlanStartTime());
         vo.setPlanEndTime(task.getPlanEndTime());
+        vo.setSubmitTime(task.getSubmitTime());
         vo.setCheckOrgId(task.getCheckOrgId());
         vo.setCheckOrgName(task.getCheckOrgName());
         vo.setBeCheckedOrgId(task.getOrgId());
@@ -95,7 +105,8 @@ public class TaskRegisterVo<T> {
         vo.setCheckRoles(checkRoles);
         vo.setYmdDate(task.getYmdDate());
         vo.setGrantUserId(task.getGrantUserId());
-
+        vo.setExceptionCount(task.getExceptionCount().intValue());
+        vo.setSubmitBy(task.getSubmitBy());
         return vo;
     }
 }

+ 5 - 3
soc-modules/soc-modules-core/src/main/resources/mapper/safetycheck/CoreSafetyTaskMapper.xml

@@ -197,7 +197,8 @@
         where id = #{id}
     </select>
     <select id="selectCoreSafetyTaskPage" resultType="com.xunmei.core.safetyCheck.domain.CoreSafetyTask">
-        SELECT t.id,
+select  * from (
+SELECT t.id,
         t.title,
         o1.`short_name` as org_name,
         o2.`short_name` as check_org_name,
@@ -259,6 +260,7 @@
                 #{id}
             </foreach>
         </if>
+        ) temp group by temp.id
     </select>
 
     <insert id="insertCoreSafetyTask" parameterType="com.xunmei.core.safetyCheck.domain.CoreSafetyTask">
@@ -655,8 +657,8 @@
         a.name as pointName,
         b.required as mustCheck,
         if(rd.is_add is null, 0, rd.is_add) as isAdd,
-        if(rd.value is null, 0, rd.value) as status,
-        if(rd.remark is null, null, rd.remark) as remark,
+        rd.value as status,
+        rd.remark as remark,
         rd.rectification_deadline as rectificationDeadline,
         rd.submit_by,
         rd.submit_time