Browse Source

安全指数代码提交

jingyuanchao 2 năm trước cách đây
mục cha
commit
905352e51b
19 tập tin đã thay đổi với 1953 bổ sung3 xóa
  1. 74 0
      soc-common/soc-common-core/src/main/java/com/xunmei/common/core/domain/safetyindex/domain/CoreSafeMonthScore.java
  2. 68 0
      soc-common/soc-common-core/src/main/java/com/xunmei/common/core/domain/safetyindex/domain/CoreSafetyDeductData.java
  3. 79 0
      soc-common/soc-common-core/src/main/java/com/xunmei/common/core/domain/safetyindex/domain/CoreSafetySourceData.java
  4. 83 0
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/safetyindex/controller/CoreSafeMonthScoreController.java
  5. 83 0
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/safetyindex/controller/CoreSafetyDeductDataController.java
  6. 83 0
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/safetyindex/controller/CoreSafetySourceDataController.java
  7. 62 0
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/safetyindex/mapper/CoreSafeMonthScoreMapper.java
  8. 62 0
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/safetyindex/mapper/CoreSafetyDeductDataMapper.java
  9. 62 0
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/safetyindex/mapper/CoreSafetySourceDataMapper.java
  10. 71 0
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/safetyindex/service/ICoreSafeMonthScoreService.java
  11. 73 0
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/safetyindex/service/ICoreSafetyDeductDataService.java
  12. 73 0
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/safetyindex/service/ICoreSafetySourceDataService.java
  13. 120 0
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/safetyindex/service/impl/CoreSafeMonthScoreServiceImpl.java
  14. 126 0
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/safetyindex/service/impl/CoreSafetyDeductDataServiceImpl.java
  15. 299 3
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/safetyindex/service/impl/CoreSafetyExceptionDataServiceImpl.java
  16. 127 0
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/safetyindex/service/impl/CoreSafetySourceDataServiceImpl.java
  17. 136 0
      soc-modules/soc-modules-core/src/main/resources/mapper/safetyindex/CoreSafeMonthScoreMapper.xml
  18. 125 0
      soc-modules/soc-modules-core/src/main/resources/mapper/safetyindex/CoreSafetyDeductDataMapper.xml
  19. 147 0
      soc-modules/soc-modules-core/src/main/resources/mapper/safetyindex/CoreSafetySourceDataMapper.xml

+ 74 - 0
soc-common/soc-common-core/src/main/java/com/xunmei/common/core/domain/safetyindex/domain/CoreSafeMonthScore.java

@@ -0,0 +1,74 @@
+package com.xunmei.common.core.domain.safetyindex.domain;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.xunmei.common.core.web.domain.BaseEntity;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+/**
+ * 安全指数机构月度得分对象 core_safe_month_score
+ *
+ * @author xunmei
+ * @date 2023-10-11
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@TableName("core_safe_month_score")
+@ApiModel(value = "CoreSafeMonthScore对象", description = "安全指数机构月度得分")
+public class CoreSafeMonthScore extends BaseEntity {
+    private static final long serialVersionUID = 1L;
+
+    @TableId
+    private Long id;
+
+    @TableField(value  = "level_id")
+    @ApiModelProperty(value = "评分等级id")
+    private Long levelId;
+
+    @TableField(value  = "org_id")
+    @ApiModelProperty(value = "机构id")
+    private Long orgId;
+
+    @TableField(value  = "data_year")
+    @ApiModelProperty(value = "数据所在年")
+    private Long dataYear;
+
+    @TableField(value  = "data_month")
+    @ApiModelProperty(value = "数据所在月")
+    private Long dataMonth;
+
+    @TableField(value  = "org_score")
+    @ApiModelProperty(value = "机构得分")
+    private Double orgScore;
+
+    @TableField(value  = "release_status")
+    @ApiModelProperty(value = "${comment}", notes = "$column.readConverterExp()")
+    private Long releaseStatus;
+
+    @TableField(value  = "org_path")
+    @ApiModelProperty(value = "机构path")
+    private String orgPath;
+
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
+                .append("id", getId())
+                .append("levelId", getLevelId())
+                .append("orgId", getOrgId())
+                .append("dataYear", getDataYear())
+                .append("dataMonth", getDataMonth())
+                .append("orgScore", getOrgScore())
+                .append("releaseStatus", getReleaseStatus())
+                .append("orgPath", getOrgPath())
+                .toString();
+    }
+}

+ 68 - 0
soc-common/soc-common-core/src/main/java/com/xunmei/common/core/domain/safetyindex/domain/CoreSafetyDeductData.java

@@ -0,0 +1,68 @@
+package com.xunmei.common.core.domain.safetyindex.domain;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.xunmei.common.core.web.domain.BaseEntity;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+/**
+ * 安全指数扣分对象 core_safety_deduct_data
+ *
+ * @author xunmei
+ * @date 2023-10-11
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@TableName("core_safety_deduct_data")
+@ApiModel(value = "CoreSafetyDeductData对象", description = "安全指数扣分")
+public class CoreSafetyDeductData extends BaseEntity {
+    private static final long serialVersionUID = 1L;
+    @TableId
+    private Long id;
+
+    @TableField(value  = "level_id")
+    @ApiModelProperty(value = "评价规则表")
+    private Long ruleId;
+
+    @TableField(value  = "org_id")
+    @ApiModelProperty(value = "机构id")
+    private Long orgId;
+
+    @TableField(value  = "data_year")
+    @ApiModelProperty(value = "数据所在年")
+    private Integer dataYear;
+
+    @TableField(value  = "data_month")
+    @ApiModelProperty(value = "数据所在月")
+    private Integer dataMonth;
+
+    @TableField(value  = "score")
+    @ApiModelProperty(value = "合计每个子项后得出安全指标的分数")
+    private Double score;
+
+    @TableField(value  = "score_real")
+    @ApiModelProperty(value = "真实扣分")
+    private Double scoreReal;
+
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
+                .append("id", getId())
+                .append("ruleId", getRuleId())
+                .append("orgId", getOrgId())
+                .append("dataYear", getDataYear())
+                .append("dataMonth", getDataMonth())
+                .append("score", getScore())
+                .append("scoreReal", getScoreReal())
+                .toString();
+    }
+}

+ 79 - 0
soc-common/soc-common-core/src/main/java/com/xunmei/common/core/domain/safetyindex/domain/CoreSafetySourceData.java

@@ -0,0 +1,79 @@
+package com.xunmei.common.core.domain.safetyindex.domain;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.xunmei.common.core.web.domain.BaseEntity;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+/**
+ * 安全指数机构扣分细项对象 core_safety_source_data
+ *
+ * @author xunmei
+ * @date 2023-10-11
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@TableName("core_safety_source_data")
+@ApiModel(value = "CoreSafetySourceData对象", description = "安全指数机构扣分细项")
+public class CoreSafetySourceData extends BaseEntity {
+    private static final long serialVersionUID = 1L;
+
+    @TableId
+    private Long id;
+
+    @TableField(value = "rule_id")
+    @ApiModelProperty(value = "评价规则id")
+    private Long ruleId;
+
+    @TableField(value = "item_id")
+    @ApiModelProperty(value = "评价规则项id")
+    private Long itemId;
+
+    @TableField(value = "org_id")
+    @ApiModelProperty(value = "机构id")
+    private Long orgId;
+
+    @TableField(value = "data_year")
+    @ApiModelProperty(value = "数据所在年")
+    private Integer dataYear;
+
+    @TableField(value = "data_month")
+    @ApiModelProperty(value = "数据所在月")
+    private Integer dataMonth;
+
+    @TableField(value = "times")
+    @ApiModelProperty(value = "出现次数")
+    private Integer times;
+
+    @TableField(value = "score")
+    @ApiModelProperty(value = "扣分值")
+    private Double score;
+
+    @TableField(value = "type_code")
+    @ApiModelProperty(value = "配置项")
+    private String typeCode;
+
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
+                .append("id", getId())
+                .append("ruleId", getRuleId())
+                .append("itemId", getItemId())
+                .append("orgId", getOrgId())
+                .append("dataYear", getDataYear())
+                .append("dataMonth", getDataMonth())
+                .append("times", getTimes())
+                .append("score", getScore())
+                .append("typeCode", getTypeCode())
+                .toString();
+    }
+}

+ 83 - 0
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/safetyindex/controller/CoreSafeMonthScoreController.java

@@ -0,0 +1,83 @@
+package com.xunmei.core.safetyindex.controller;
+
+import com.xunmei.common.core.web.controller.BaseController;
+import com.xunmei.common.core.web.domain.AjaxResult;
+import com.xunmei.common.core.web.page.TableDataInfo;
+import com.xunmei.common.log.annotation.Log;
+import com.xunmei.common.log.enums.BusinessType;
+import com.xunmei.common.security.annotation.RequiresPermissions;
+import com.xunmei.common.core.domain.safetyindex.domain.CoreSafeMonthScore;
+import com.xunmei.core.safetyindex.service.ICoreSafeMonthScoreService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * 安全指数机构月度得分Controller
+ *
+ * @author xunmei
+ * @date 2023-10-11
+ */
+@Api(tags = {"CoreSafeMonthScore"})
+@RestController
+@RequestMapping("/safeMonthScore")
+public class CoreSafeMonthScoreController extends BaseController {
+    @Autowired
+    private ICoreSafeMonthScoreService coreSafeMonthScoreService;
+
+    /**
+     * 查询安全指数机构月度得分列表
+     */
+    @ApiOperation(value = "查询CoreSafeMonthScore列表")
+    @RequiresPermissions("core:safeMonthScore:list")
+    @GetMapping("/list")
+    public TableDataInfo<CoreSafeMonthScore> list(CoreSafeMonthScore coreSafeMonthScore) {
+
+        return coreSafeMonthScoreService.selectPage(coreSafeMonthScore);
+    }
+
+
+    /**
+     * 获取安全指数机构月度得分详细信息
+     */
+    @ApiOperation(value = "获取CoreSafeMonthScore详细信息")
+    @RequiresPermissions("core:safeMonthScore:query")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id) {
+        return success(coreSafeMonthScoreService.selectCoreSafeMonthScoreById(id));
+    }
+
+    /**
+     * 新增安全指数机构月度得分
+     */
+    @ApiOperation(value = "新增CoreSafeMonthScore")
+    @RequiresPermissions("core:safeMonthScore:add")
+    @Log(title = "安全指数机构月度得分", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody CoreSafeMonthScore coreSafeMonthScore) {
+        return toAjax(coreSafeMonthScoreService.insertCoreSafeMonthScore(coreSafeMonthScore));
+    }
+
+    /**
+     * 修改安全指数机构月度得分
+     */
+    @ApiOperation(value = "修改CoreSafeMonthScore")
+    @RequiresPermissions("core:safeMonthScore:edit")
+    @Log(title = "安全指数机构月度得分", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody CoreSafeMonthScore coreSafeMonthScore) {
+        return toAjax(coreSafeMonthScoreService.updateCoreSafeMonthScore(coreSafeMonthScore));
+    }
+
+    /**
+     * 删除安全指数机构月度得分
+     */
+    @ApiOperation(value = "删除CoreSafeMonthScore")
+    @RequiresPermissions("core:safeMonthScore:remove")
+    @Log(title = "安全指数机构月度得分", businessType = BusinessType.DELETE)
+    @DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids) {
+        return toAjax(coreSafeMonthScoreService.deleteCoreSafeMonthScoreByIds(ids));
+    }
+}

+ 83 - 0
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/safetyindex/controller/CoreSafetyDeductDataController.java

@@ -0,0 +1,83 @@
+package com.xunmei.core.safetyindex.controller;
+
+import com.xunmei.common.core.web.controller.BaseController;
+import com.xunmei.common.core.web.domain.AjaxResult;
+import com.xunmei.common.core.web.page.TableDataInfo;
+import com.xunmei.common.log.annotation.Log;
+import com.xunmei.common.log.enums.BusinessType;
+import com.xunmei.common.security.annotation.RequiresPermissions;
+import com.xunmei.common.core.domain.safetyindex.domain.CoreSafetyDeductData;
+import com.xunmei.core.safetyindex.service.ICoreSafetyDeductDataService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * 安全指数扣分Controller
+ *
+ * @author xunmei
+ * @date 2023-10-11
+ */
+@Api(tags = {"CoreSafetyDeductData"})
+@RestController
+@RequestMapping("/safetyDeductData")
+public class CoreSafetyDeductDataController extends BaseController {
+    @Autowired
+    private ICoreSafetyDeductDataService coreSafetyDeductDataService;
+
+    /**
+     * 查询安全指数扣分列表
+     */
+    @ApiOperation(value = "查询CoreSafetyDeductData列表")
+    @RequiresPermissions("core:safetyDeductData:list")
+    @GetMapping("/list")
+    public TableDataInfo<CoreSafetyDeductData> list(CoreSafetyDeductData coreSafetyDeductData) {
+
+        return coreSafetyDeductDataService.selectPage(coreSafetyDeductData);
+    }
+
+
+    /**
+     * 获取安全指数扣分详细信息
+     */
+    @ApiOperation(value = "获取CoreSafetyDeductData详细信息")
+    @RequiresPermissions("core:safetyDeductData:query")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id) {
+        return success(coreSafetyDeductDataService.selectCoreSafetyDeductDataById(id));
+    }
+
+    /**
+     * 新增安全指数扣分
+     */
+    @ApiOperation(value = "新增CoreSafetyDeductData")
+    @RequiresPermissions("core:safetyDeductData:add")
+    @Log(title = "安全指数扣分", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody CoreSafetyDeductData coreSafetyDeductData) {
+        return toAjax(coreSafetyDeductDataService.insertCoreSafetyDeductData(coreSafetyDeductData));
+    }
+
+    /**
+     * 修改安全指数扣分
+     */
+    @ApiOperation(value = "修改CoreSafetyDeductData")
+    @RequiresPermissions("core:safetyDeductData:edit")
+    @Log(title = "安全指数扣分", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody CoreSafetyDeductData coreSafetyDeductData) {
+        return toAjax(coreSafetyDeductDataService.updateCoreSafetyDeductData(coreSafetyDeductData));
+    }
+
+    /**
+     * 删除安全指数扣分
+     */
+    @ApiOperation(value = "删除CoreSafetyDeductData")
+    @RequiresPermissions("core:safetyDeductData:remove")
+    @Log(title = "安全指数扣分", businessType = BusinessType.DELETE)
+    @DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids) {
+        return toAjax(coreSafetyDeductDataService.deleteCoreSafetyDeductDataByIds(ids));
+    }
+}

+ 83 - 0
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/safetyindex/controller/CoreSafetySourceDataController.java

@@ -0,0 +1,83 @@
+package com.xunmei.core.safetyindex.controller;
+
+import com.xunmei.common.core.web.controller.BaseController;
+import com.xunmei.common.core.web.domain.AjaxResult;
+import com.xunmei.common.core.web.page.TableDataInfo;
+import com.xunmei.common.log.annotation.Log;
+import com.xunmei.common.log.enums.BusinessType;
+import com.xunmei.common.security.annotation.RequiresPermissions;
+import com.xunmei.common.core.domain.safetyindex.domain.CoreSafetySourceData;
+import com.xunmei.core.safetyindex.service.ICoreSafetySourceDataService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * 安全指数机构扣分细项Controller
+ *
+ * @author xunmei
+ * @date 2023-10-11
+ */
+@Api(tags = {"CoreSafetySourceData"})
+@RestController
+@RequestMapping("/safetySourceData")
+public class CoreSafetySourceDataController extends BaseController {
+    @Autowired
+    private ICoreSafetySourceDataService coreSafetySourceDataService;
+
+    /**
+     * 查询安全指数机构扣分细项列表
+     */
+    @ApiOperation(value = "查询CoreSafetySourceData列表")
+    @RequiresPermissions("core:safetySourceData:list")
+    @GetMapping("/list")
+    public TableDataInfo<CoreSafetySourceData> list(CoreSafetySourceData coreSafetySourceData) {
+
+        return coreSafetySourceDataService.selectPage(coreSafetySourceData);
+    }
+
+
+    /**
+     * 获取安全指数机构扣分细项详细信息
+     */
+    @ApiOperation(value = "获取CoreSafetySourceData详细信息")
+    @RequiresPermissions("core:safetySourceData:query")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id) {
+        return success(coreSafetySourceDataService.selectCoreSafetySourceDataById(id));
+    }
+
+    /**
+     * 新增安全指数机构扣分细项
+     */
+    @ApiOperation(value = "新增CoreSafetySourceData")
+    @RequiresPermissions("core:safetySourceData:add")
+    @Log(title = "安全指数机构扣分细项", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody CoreSafetySourceData coreSafetySourceData) {
+        return toAjax(coreSafetySourceDataService.insertCoreSafetySourceData(coreSafetySourceData));
+    }
+
+    /**
+     * 修改安全指数机构扣分细项
+     */
+    @ApiOperation(value = "修改CoreSafetySourceData")
+    @RequiresPermissions("core:safetySourceData:edit")
+    @Log(title = "安全指数机构扣分细项", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody CoreSafetySourceData coreSafetySourceData) {
+        return toAjax(coreSafetySourceDataService.updateCoreSafetySourceData(coreSafetySourceData));
+    }
+
+    /**
+     * 删除安全指数机构扣分细项
+     */
+    @ApiOperation(value = "删除CoreSafetySourceData")
+    @RequiresPermissions("core:safetySourceData:remove")
+    @Log(title = "安全指数机构扣分细项", businessType = BusinessType.DELETE)
+    @DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids) {
+        return toAjax(coreSafetySourceDataService.deleteCoreSafetySourceDataByIds(ids));
+    }
+}

+ 62 - 0
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/safetyindex/mapper/CoreSafeMonthScoreMapper.java

@@ -0,0 +1,62 @@
+package com.xunmei.core.safetyindex.mapper;
+
+import java.util.List;
+
+import com.xunmei.common.core.domain.safetyindex.domain.CoreSafeMonthScore;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 安全指数机构月度得分Mapper接口
+ *
+ * @author xunmei
+ * @date 2023-10-11
+ */
+public interface CoreSafeMonthScoreMapper extends BaseMapper<CoreSafeMonthScore> {
+    /**
+     * 查询安全指数机构月度得分
+     *
+     * @param id 安全指数机构月度得分主键
+     * @return 安全指数机构月度得分
+     */
+    CoreSafeMonthScore selectCoreSafeMonthScoreById(Long id);
+
+    /**
+     * 查询安全指数机构月度得分列表
+     *
+     * @param coreSafeMonthScore 安全指数机构月度得分
+     * @return 安全指数机构月度得分集合
+     */
+    List<CoreSafeMonthScore> selectCoreSafeMonthScoreList(CoreSafeMonthScore coreSafeMonthScore);
+
+    /**
+     * 新增安全指数机构月度得分
+     *
+     * @param coreSafeMonthScore 安全指数机构月度得分
+     * @return 结果
+     */
+    int insertCoreSafeMonthScore(CoreSafeMonthScore coreSafeMonthScore);
+
+    /**
+     * 修改安全指数机构月度得分
+     *
+     * @param coreSafeMonthScore 安全指数机构月度得分
+     * @return 结果
+     */
+    int updateCoreSafeMonthScore(CoreSafeMonthScore coreSafeMonthScore);
+
+    /**
+     * 删除安全指数机构月度得分
+     *
+     * @param id 安全指数机构月度得分主键
+     * @return 结果
+     */
+    int deleteCoreSafeMonthScoreById(Long id);
+
+    /**
+     * 批量删除安全指数机构月度得分
+     *
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    int deleteCoreSafeMonthScoreByIds(Long[] ids);
+}

+ 62 - 0
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/safetyindex/mapper/CoreSafetyDeductDataMapper.java

@@ -0,0 +1,62 @@
+package com.xunmei.core.safetyindex.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.xunmei.common.core.domain.safetyindex.domain.CoreSafetyDeductData;
+
+import java.util.List;
+
+/**
+ * 安全指数扣分Mapper接口
+ *
+ * @author xunmei
+ * @date 2023-10-11
+ */
+public interface CoreSafetyDeductDataMapper extends BaseMapper<CoreSafetyDeductData> {
+    /**
+     * 查询安全指数扣分
+     *
+     * @param id 安全指数扣分主键
+     * @return 安全指数扣分
+     */
+    CoreSafetyDeductData selectCoreSafetyDeductDataById(Long id);
+
+    /**
+     * 查询安全指数扣分列表
+     *
+     * @param coreSafetyDeductData 安全指数扣分
+     * @return 安全指数扣分集合
+     */
+    List<CoreSafetyDeductData> selectCoreSafetyDeductDataList(CoreSafetyDeductData coreSafetyDeductData);
+
+    /**
+     * 新增安全指数扣分
+     *
+     * @param coreSafetyDeductData 安全指数扣分
+     * @return 结果
+     */
+    int insertCoreSafetyDeductData(CoreSafetyDeductData coreSafetyDeductData);
+
+    /**
+     * 修改安全指数扣分
+     *
+     * @param coreSafetyDeductData 安全指数扣分
+     * @return 结果
+     */
+    int updateCoreSafetyDeductData(CoreSafetyDeductData coreSafetyDeductData);
+
+    /**
+     * 删除安全指数扣分
+     *
+     * @param id 安全指数扣分主键
+     * @return 结果
+     */
+    int deleteCoreSafetyDeductDataById(Long id);
+
+    /**
+     * 批量删除安全指数扣分
+     *
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    int deleteCoreSafetyDeductDataByIds(Long[] ids);
+}

+ 62 - 0
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/safetyindex/mapper/CoreSafetySourceDataMapper.java

@@ -0,0 +1,62 @@
+package com.xunmei.core.safetyindex.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.xunmei.common.core.domain.safetyindex.domain.CoreSafetySourceData;
+
+import java.util.List;
+
+/**
+ * 安全指数机构扣分细项Mapper接口
+ *
+ * @author xunmei
+ * @date 2023-10-11
+ */
+public interface CoreSafetySourceDataMapper extends BaseMapper<CoreSafetySourceData> {
+    /**
+     * 查询安全指数机构扣分细项
+     *
+     * @param id 安全指数机构扣分细项主键
+     * @return 安全指数机构扣分细项
+     */
+    CoreSafetySourceData selectCoreSafetySourceDataById(Long id);
+
+    /**
+     * 查询安全指数机构扣分细项列表
+     *
+     * @param coreSafetySourceData 安全指数机构扣分细项
+     * @return 安全指数机构扣分细项集合
+     */
+    List<CoreSafetySourceData> selectCoreSafetySourceDataList(CoreSafetySourceData coreSafetySourceData);
+
+    /**
+     * 新增安全指数机构扣分细项
+     *
+     * @param coreSafetySourceData 安全指数机构扣分细项
+     * @return 结果
+     */
+    int insertCoreSafetySourceData(CoreSafetySourceData coreSafetySourceData);
+
+    /**
+     * 修改安全指数机构扣分细项
+     *
+     * @param coreSafetySourceData 安全指数机构扣分细项
+     * @return 结果
+     */
+    int updateCoreSafetySourceData(CoreSafetySourceData coreSafetySourceData);
+
+    /**
+     * 删除安全指数机构扣分细项
+     *
+     * @param id 安全指数机构扣分细项主键
+     * @return 结果
+     */
+    int deleteCoreSafetySourceDataById(Long id);
+
+    /**
+     * 批量删除安全指数机构扣分细项
+     *
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    int deleteCoreSafetySourceDataByIds(Long[] ids);
+}

+ 71 - 0
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/safetyindex/service/ICoreSafeMonthScoreService.java

@@ -0,0 +1,71 @@
+package com.xunmei.core.safetyindex.service;
+
+import java.util.List;
+
+import com.xunmei.common.core.domain.safetyindex.domain.CoreSafeMonthScore;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.xunmei.common.core.web.page.TableDataInfo;
+
+/**
+ * 安全指数机构月度得分Service接口
+ *
+ * @author xunmei
+ * @date 2023-10-11
+ */
+public interface ICoreSafeMonthScoreService extends IService<CoreSafeMonthScore> {
+    /**
+     * 查询安全指数机构月度得分
+     *
+     * @param id 安全指数机构月度得分主键
+     * @return 安全指数机构月度得分
+     */
+     CoreSafeMonthScore selectCoreSafeMonthScoreById(Long id);
+
+    /**
+     * 查询安全指数机构月度得分列表
+     *
+     * @param coreSafeMonthScore 安全指数机构月度得分
+     * @return 安全指数机构月度得分集合
+     */
+    List<CoreSafeMonthScore> selectCoreSafeMonthScoreList(CoreSafeMonthScore coreSafeMonthScore);
+
+    /**
+     * 新增安全指数机构月度得分
+     *
+     * @param coreSafeMonthScore 安全指数机构月度得分
+     * @return 结果
+     */
+    int insertCoreSafeMonthScore(CoreSafeMonthScore coreSafeMonthScore);
+
+    /**
+     * 修改安全指数机构月度得分
+     *
+     * @param coreSafeMonthScore 安全指数机构月度得分
+     * @return 结果
+     */
+    int updateCoreSafeMonthScore(CoreSafeMonthScore coreSafeMonthScore);
+
+    /**
+     * 批量删除安全指数机构月度得分
+     *
+     * @param ids 需要删除的安全指数机构月度得分主键集合
+     * @return 结果
+     */
+    int deleteCoreSafeMonthScoreByIds(Long[] ids);
+
+    /**
+     * 删除安全指数机构月度得分信息
+     *
+     * @param id 安全指数机构月度得分主键
+     * @return 结果
+     */
+    int deleteCoreSafeMonthScoreById(Long id);
+
+    /**
+     * 查询安全指数机构月度得分分页数据
+     *
+     * @param coreSafeMonthScore 查询条件对象
+     * @return Page
+     */
+    TableDataInfo<CoreSafeMonthScore> selectPage(CoreSafeMonthScore coreSafeMonthScore);
+}

+ 73 - 0
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/safetyindex/service/ICoreSafetyDeductDataService.java

@@ -0,0 +1,73 @@
+package com.xunmei.core.safetyindex.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.xunmei.common.core.domain.safetyindex.domain.CoreSafetyDeductData;
+import com.xunmei.common.core.web.page.TableDataInfo;
+
+import java.util.List;
+
+/**
+ * 安全指数扣分Service接口
+ *
+ * @author xunmei
+ * @date 2023-10-11
+ */
+public interface ICoreSafetyDeductDataService extends IService<CoreSafetyDeductData> {
+    /**
+     * 查询安全指数扣分
+     *
+     * @param id 安全指数扣分主键
+     * @return 安全指数扣分
+     */
+     CoreSafetyDeductData selectCoreSafetyDeductDataById(Long id);
+
+    /**
+     * 查询安全指数扣分列表
+     *
+     * @param coreSafetyDeductData 安全指数扣分
+     * @return 安全指数扣分集合
+     */
+    List<CoreSafetyDeductData> selectCoreSafetyDeductDataList(CoreSafetyDeductData coreSafetyDeductData);
+
+    /**
+     * 新增安全指数扣分
+     *
+     * @param coreSafetyDeductData 安全指数扣分
+     * @return 结果
+     */
+    int insertCoreSafetyDeductData(CoreSafetyDeductData coreSafetyDeductData);
+
+    /**
+     * 修改安全指数扣分
+     *
+     * @param coreSafetyDeductData 安全指数扣分
+     * @return 结果
+     */
+    int updateCoreSafetyDeductData(CoreSafetyDeductData coreSafetyDeductData);
+
+    /**
+     * 批量删除安全指数扣分
+     *
+     * @param ids 需要删除的安全指数扣分主键集合
+     * @return 结果
+     */
+    int deleteCoreSafetyDeductDataByIds(Long[] ids);
+
+    /**
+     * 删除安全指数扣分信息
+     *
+     * @param id 安全指数扣分主键
+     * @return 结果
+     */
+    int deleteCoreSafetyDeductDataById(Long id);
+
+    /**
+     * 查询安全指数扣分分页数据
+     *
+     * @param coreSafetyDeductData 查询条件对象
+     * @return Page
+     */
+    TableDataInfo<CoreSafetyDeductData> selectPage(CoreSafetyDeductData coreSafetyDeductData);
+
+    void deleteSafeDeductData(int year, int month);
+}

+ 73 - 0
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/safetyindex/service/ICoreSafetySourceDataService.java

@@ -0,0 +1,73 @@
+package com.xunmei.core.safetyindex.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.xunmei.common.core.web.page.TableDataInfo;
+import com.xunmei.common.core.domain.safetyindex.domain.CoreSafetySourceData;
+
+import java.util.List;
+
+/**
+ * 安全指数机构扣分细项Service接口
+ *
+ * @author xunmei
+ * @date 2023-10-11
+ */
+public interface ICoreSafetySourceDataService extends IService<CoreSafetySourceData> {
+    /**
+     * 查询安全指数机构扣分细项
+     *
+     * @param id 安全指数机构扣分细项主键
+     * @return 安全指数机构扣分细项
+     */
+     CoreSafetySourceData selectCoreSafetySourceDataById(Long id);
+
+    /**
+     * 查询安全指数机构扣分细项列表
+     *
+     * @param coreSafetySourceData 安全指数机构扣分细项
+     * @return 安全指数机构扣分细项集合
+     */
+    List<CoreSafetySourceData> selectCoreSafetySourceDataList(CoreSafetySourceData coreSafetySourceData);
+
+    /**
+     * 新增安全指数机构扣分细项
+     *
+     * @param coreSafetySourceData 安全指数机构扣分细项
+     * @return 结果
+     */
+    int insertCoreSafetySourceData(CoreSafetySourceData coreSafetySourceData);
+
+    /**
+     * 修改安全指数机构扣分细项
+     *
+     * @param coreSafetySourceData 安全指数机构扣分细项
+     * @return 结果
+     */
+    int updateCoreSafetySourceData(CoreSafetySourceData coreSafetySourceData);
+
+    /**
+     * 批量删除安全指数机构扣分细项
+     *
+     * @param ids 需要删除的安全指数机构扣分细项主键集合
+     * @return 结果
+     */
+    int deleteCoreSafetySourceDataByIds(Long[] ids);
+
+    /**
+     * 删除安全指数机构扣分细项信息
+     *
+     * @param id 安全指数机构扣分细项主键
+     * @return 结果
+     */
+    int deleteCoreSafetySourceDataById(Long id);
+
+    /**
+     * 查询安全指数机构扣分细项分页数据
+     *
+     * @param coreSafetySourceData 查询条件对象
+     * @return Page
+     */
+    TableDataInfo<CoreSafetySourceData> selectPage(CoreSafetySourceData coreSafetySourceData);
+
+    void deleteSourceData(int year, int month);
+}

+ 120 - 0
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/safetyindex/service/impl/CoreSafeMonthScoreServiceImpl.java

@@ -0,0 +1,120 @@
+package com.xunmei.core.safetyindex.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.xunmei.common.core.web.page.TableDataInfo;
+import com.xunmei.common.core.domain.safetyindex.domain.CoreSafeMonthScore;
+import com.xunmei.core.safetyindex.mapper.CoreSafeMonthScoreMapper;
+import com.xunmei.core.safetyindex.service.ICoreSafeMonthScoreService;
+import com.xunmei.system.api.RemoteOrgService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * 安全指数机构月度得分Service业务层处理
+ *
+ * @author xunmei
+ * @date 2023-10-11
+ */
+@Service
+public class CoreSafeMonthScoreServiceImpl extends ServiceImpl<CoreSafeMonthScoreMapper, CoreSafeMonthScore> implements ICoreSafeMonthScoreService {
+    @Autowired
+    private CoreSafeMonthScoreMapper coreSafeMonthScoreMapper;
+    @Autowired
+    private RemoteOrgService orgService;
+
+    @Override
+    public TableDataInfo<CoreSafeMonthScore> selectPage(CoreSafeMonthScore coreSafeMonthScore) {
+
+        Page<CoreSafeMonthScore> page;
+        //分页
+        if (coreSafeMonthScore.getPageNum()!=null&&coreSafeMonthScore.getPageSize()!=null)
+        {
+            page = new Page<>(coreSafeMonthScore.getPageNum(), coreSafeMonthScore.getPageSize());
+        }else{
+            page = new Page<>();
+        }
+        //查询条件
+        QueryWrapper<CoreSafeMonthScore> query = new QueryWrapper<>(coreSafeMonthScore);
+
+        //获取数据
+        page = coreSafeMonthScoreMapper.selectPage(page, query);
+        //抓换为TableDataInfo适配前端
+        return TableDataInfo.build(page);
+
+
+
+
+    }
+
+
+    /**
+     * 查询安全指数机构月度得分
+     *
+     * @param id 安全指数机构月度得分主键
+     * @return 安全指数机构月度得分
+     */
+    @Override
+    public CoreSafeMonthScore selectCoreSafeMonthScoreById(Long id) {
+        return coreSafeMonthScoreMapper.selectById(id);
+    }
+
+    /**
+     * 查询安全指数机构月度得分列表
+     *
+     * @param coreSafeMonthScore 安全指数机构月度得分
+     * @return 安全指数机构月度得分
+     */
+    @Override
+    public List<CoreSafeMonthScore> selectCoreSafeMonthScoreList(CoreSafeMonthScore coreSafeMonthScore) {
+        return coreSafeMonthScoreMapper.selectList(new QueryWrapper<>(coreSafeMonthScore));
+    }
+
+    /**
+     * 新增安全指数机构月度得分
+     *
+     * @param coreSafeMonthScore 安全指数机构月度得分
+     * @return 结果
+     */
+    @Override
+    public int insertCoreSafeMonthScore(CoreSafeMonthScore coreSafeMonthScore) {
+            return coreSafeMonthScoreMapper.insert(coreSafeMonthScore);
+    }
+
+    /**
+     * 修改安全指数机构月度得分
+     *
+     * @param coreSafeMonthScore 安全指数机构月度得分
+     * @return 结果
+     */
+    @Override
+    public int updateCoreSafeMonthScore(CoreSafeMonthScore coreSafeMonthScore) {
+        return coreSafeMonthScoreMapper.updateById(coreSafeMonthScore);
+    }
+
+    /**
+     * 批量删除安全指数机构月度得分
+     *
+     * @param ids 需要删除的安全指数机构月度得分主键
+     * @return 结果
+     */
+    @Override
+    public int deleteCoreSafeMonthScoreByIds(Long[] ids) {
+        return coreSafeMonthScoreMapper.deleteBatchIds(Arrays.asList((ids)));
+    }
+
+    /**
+     * 删除安全指数机构月度得分信息
+     *
+     * @param id 安全指数机构月度得分主键
+     * @return 结果
+     */
+    @Override
+    public int deleteCoreSafeMonthScoreById(Long id) {
+        return coreSafeMonthScoreMapper.deleteById(id);
+    }
+}

+ 126 - 0
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/safetyindex/service/impl/CoreSafetyDeductDataServiceImpl.java

@@ -0,0 +1,126 @@
+package com.xunmei.core.safetyindex.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.xunmei.common.core.domain.safetyindex.domain.CoreSafetyDeductData;
+import com.xunmei.common.core.web.page.TableDataInfo;
+import com.xunmei.core.safetyindex.mapper.CoreSafetyDeductDataMapper;
+import com.xunmei.core.safetyindex.service.ICoreSafetyDeductDataService;
+import com.xunmei.system.api.RemoteOrgService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * 安全指数扣分Service业务层处理
+ *
+ * @author xunmei
+ * @date 2023-10-11
+ */
+@Service
+public class CoreSafetyDeductDataServiceImpl extends ServiceImpl<CoreSafetyDeductDataMapper, CoreSafetyDeductData> implements ICoreSafetyDeductDataService {
+    @Autowired
+    private CoreSafetyDeductDataMapper coreSafetyDeductDataMapper;
+    @Autowired
+    private RemoteOrgService orgService;
+
+    @Override
+    public TableDataInfo<CoreSafetyDeductData> selectPage(CoreSafetyDeductData coreSafetyDeductData) {
+
+        Page<CoreSafetyDeductData> page;
+        //分页
+        if (coreSafetyDeductData.getPageNum()!=null&&coreSafetyDeductData.getPageSize()!=null)
+        {
+            page = new Page<>(coreSafetyDeductData.getPageNum(), coreSafetyDeductData.getPageSize());
+        }else{
+            page = new Page<>();
+        }
+        //查询条件
+        QueryWrapper<CoreSafetyDeductData> query = new QueryWrapper<>(coreSafetyDeductData);
+
+        //获取数据
+        page = coreSafetyDeductDataMapper.selectPage(page, query);
+        //抓换为TableDataInfo适配前端
+        return TableDataInfo.build(page);
+    }
+
+
+    /**
+     * 查询安全指数扣分
+     *
+     * @param id 安全指数扣分主键
+     * @return 安全指数扣分
+     */
+    @Override
+    public CoreSafetyDeductData selectCoreSafetyDeductDataById(Long id) {
+        return coreSafetyDeductDataMapper.selectById(id);
+    }
+
+    /**
+     * 查询安全指数扣分列表
+     *
+     * @param coreSafetyDeductData 安全指数扣分
+     * @return 安全指数扣分
+     */
+    @Override
+    public List<CoreSafetyDeductData> selectCoreSafetyDeductDataList(CoreSafetyDeductData coreSafetyDeductData) {
+        return coreSafetyDeductDataMapper.selectList(new QueryWrapper<>(coreSafetyDeductData));
+    }
+
+    /**
+     * 新增安全指数扣分
+     *
+     * @param coreSafetyDeductData 安全指数扣分
+     * @return 结果
+     */
+    @Override
+    public int insertCoreSafetyDeductData(CoreSafetyDeductData coreSafetyDeductData) {
+            return coreSafetyDeductDataMapper.insert(coreSafetyDeductData);
+    }
+
+    /**
+     * 修改安全指数扣分
+     *
+     * @param coreSafetyDeductData 安全指数扣分
+     * @return 结果
+     */
+    @Override
+    public int updateCoreSafetyDeductData(CoreSafetyDeductData coreSafetyDeductData) {
+        return coreSafetyDeductDataMapper.updateById(coreSafetyDeductData);
+    }
+
+    /**
+     * 批量删除安全指数扣分
+     *
+     * @param ids 需要删除的安全指数扣分主键
+     * @return 结果
+     */
+    @Override
+    public int deleteCoreSafetyDeductDataByIds(Long[] ids) {
+        return coreSafetyDeductDataMapper.deleteBatchIds(Arrays.asList((ids)));
+    }
+
+    /**
+     * 删除安全指数扣分信息
+     *
+     * @param id 安全指数扣分主键
+     * @return 结果
+     */
+    @Override
+    public int deleteCoreSafetyDeductDataById(Long id) {
+        return coreSafetyDeductDataMapper.deleteById(id);
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void deleteSafeDeductData(int year, int month) {
+        baseMapper.delete(new LambdaQueryWrapper<>(CoreSafetyDeductData.class)
+                .eq(CoreSafetyDeductData::getDataYear, year)
+                .eq(CoreSafetyDeductData::getDataMonth, month));
+    }
+}

+ 299 - 3
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/safetyindex/service/impl/CoreSafetyExceptionDataServiceImpl.java

@@ -5,23 +5,33 @@ import cn.hutool.core.date.DateTime;
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.ObjectUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.IdWorker;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.xunmei.common.core.constant.CacheConstants;
+import com.xunmei.common.core.domain.safetyindex.domain.CoreSafetyDeductData;
 import com.xunmei.common.core.domain.safetyindex.domain.CoreSafetyExceptionData;
+import com.xunmei.common.core.domain.safetyindex.domain.CoreSafetySourceData;
 import com.xunmei.common.core.domain.safetyindex.vo.SafeIndexRuleCountVo;
+import com.xunmei.common.redis.utils.RedisUtils;
 import com.xunmei.core.question.service.IQuestionService;
 import com.xunmei.core.resumption.service.ResumptionService;
 import com.xunmei.core.retrieval.service.ICoreMonitoringRetrievalTaskService;
 import com.xunmei.core.safetyindex.mapper.CoreSafetyExceptionDataMapper;
+import com.xunmei.core.safetyindex.service.ICoreSafetyDeductDataService;
 import com.xunmei.core.safetyindex.service.ICoreSafetyExceptionDataService;
 import com.xunmei.core.safetyindex.service.ICoreSafetyIndexCalculateRuleService;
+import com.xunmei.core.safetyindex.service.ICoreSafetySourceDataService;
 import com.xunmei.system.api.RemoteOrgService;
+import com.xunmei.system.api.vo.SysOrgVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
-import java.util.Date;
-import java.util.List;
-import java.util.TimeZone;
+import java.text.SimpleDateFormat;
+import java.time.LocalDate;
+import java.time.format.DateTimeFormatter;
+import java.util.*;
+import java.util.concurrent.atomic.AtomicReference;
 import java.util.stream.Collectors;
 
 /**
@@ -48,6 +58,10 @@ public class CoreSafetyExceptionDataServiceImpl extends ServiceImpl<CoreSafetyEx
 
     @Autowired
     private ICoreSafetyIndexCalculateRuleService ruleService;
+    @Autowired
+    private ICoreSafetyDeductDataService safetyDeductDataService;
+    @Autowired
+    private ICoreSafetySourceDataService sourceDataService;
 
     @Override
     @Transactional(rollbackFor = Exception.class)
@@ -70,9 +84,12 @@ public class CoreSafetyExceptionDataServiceImpl extends ServiceImpl<CoreSafetyEx
     public static final String MONITORING_DICT_CODE = "1006";
 
     @Override
+    @Transactional(rollbackFor = Exception.class)
     public void calculateSafetyIndex(String date) {
 
         DateTime time = dealTimeParam(date);
+        int year = time.year();
+        int month = time.month();
         //获取指标配置
         List<SafeIndexRuleCountVo> safeIndexConfigVoList = ruleService.findSafeIndexRuleVoList();
         //履职的指标配置
@@ -88,6 +105,253 @@ public class CoreSafetyExceptionDataServiceImpl extends ServiceImpl<CoreSafetyEx
         //监控调阅的异常数据
         List<CoreSafetyExceptionData> monitoringExceptionDataList = queryExceptionDataList(CORE_MONITORING_RETRIEVAL_TASK, time);
 
+        //删除已有的计算数据
+        deleteOldData(year, month);
+
+
+        //计算安保履职
+        calculateResumptionData(resumptionIndexList, resumptionExceptionDataList, year, month);
+
+        //计算问题整改
+        calculateQuestionData(questionIndexList, questionExceptionDataList, year, month);
+
+
+    }
+
+    private void calculateQuestionData(List<SafeIndexRuleCountVo> questionIndexList, List<CoreSafetyExceptionData> dataList, int year, int month) {
+
+    }
+
+    private void calculateResumptionData(List<SafeIndexRuleCountVo> resumptionIndexList, List<CoreSafetyExceptionData> resumptionExceptionDataList, int year, int month) {
+        //扩展字段1:计划id  扩展字段2:计划执行时刻 (2,3,4 营业前中后)
+        //将数据按机构分组
+        Map<Long, List<CoreSafetyExceptionData>> safetyExceptionDataMapList = resumptionExceptionDataList.stream().collect(Collectors.groupingBy(CoreSafetyExceptionData::getOrgId));
+
+        List<SysOrgVO> orgList = RedisUtils.getCacheList(CacheConstants.ORG_CACHE_LIST_KEY);
+
+        for (Long orgId : safetyExceptionDataMapList.keySet()) {
+            orgList.parallelStream().filter(o -> ObjectUtil.equal(o.getId(), orgId)).findFirst().ifPresent(org -> {
+                //获取机构的指标配置
+                List<SafeIndexRuleCountVo> orgResumptionIndexList = resumptionIndexList.stream().filter(r -> ObjectUtil.equal(r.getOrgType(), org.getType())).collect(Collectors.toList());
+                if (orgResumptionIndexList.isEmpty()) {
+                    return;
+                }
+                //获取机构的异常数据
+                List<CoreSafetyExceptionData> resumptionExceptionDataListByOrg = safetyExceptionDataMapList.get(orgId);
+                //构建执行时刻的map,用于存储每个时刻的异常数据
+                Map<Integer, List<CoreSafetyExceptionData>> execTimeMap = buildExecTimeMap(resumptionExceptionDataListByOrg);
+
+
+                //营业前
+                List<SafeIndexRuleCountVo> resumptionBeforeUndoIndexList = resumptionIndexList.stream()
+                        .filter(r -> ObjectUtil.equal("10040201", r.getPointCode()))
+                        .filter(r -> r.getCalculateType() == 1)
+                        .collect(Collectors.toList());
+                if (ObjectUtil.isNotEmpty(resumptionBeforeUndoIndexList)) {
+                    List<CoreSafetySourceData> sourceDataList = calculateContinuousCumulativeCount(resumptionBeforeUndoIndexList, execTimeMap.get(2), orgId, year, month);
+                    saveSourceData(sourceDataList, resumptionBeforeUndoIndexList.get(0));
+                }
+
+                //营业中
+                List<SafeIndexRuleCountVo> resumptionMiddleIndexList = resumptionIndexList.stream()
+                        .filter(r -> ObjectUtil.equal("10040203", r.getPointCode()))
+                        .filter(r -> r.getCalculateType() == 1)
+                        .collect(Collectors.toList());
+                if (ObjectUtil.isNotEmpty(resumptionMiddleIndexList)) {
+                    List<CoreSafetySourceData> sourceDataList = calculateContinuousCumulativeCount(resumptionMiddleIndexList, execTimeMap.get(4), orgId, year, month);
+                    saveSourceData(sourceDataList, resumptionMiddleIndexList.get(0));
+                }
+
+
+                //营业后
+                List<SafeIndexRuleCountVo> resumptionAfterUndoIndexList = resumptionIndexList.stream()
+                        .filter(r -> ObjectUtil.equal("10040202", r.getPointCode()))
+                        .filter(r -> r.getCalculateType() == 1)
+                        .collect(Collectors.toList());
+                if (ObjectUtil.isNotEmpty(resumptionAfterUndoIndexList)) {
+                    List<CoreSafetySourceData> sourceDataList = calculateContinuousCumulativeCount(resumptionAfterUndoIndexList, execTimeMap.get(4), orgId, year, month);
+                    saveSourceData(sourceDataList, resumptionAfterUndoIndexList.get(0));
+                }
+
+
+            });
+        }
+    }
+
+    /**
+     * 计算连续数与累计数
+     *
+     * @param resumptionUndoIndexList
+     * @param dataList
+     * @param orgId
+     * @param year
+     * @param month
+     * @return
+     */
+    private List<CoreSafetySourceData> calculateContinuousCumulativeCount(List<SafeIndexRuleCountVo> resumptionUndoIndexList, List<CoreSafetyExceptionData> dataList, Long orgId, int year, int month) {
+        SafeIndexRuleCountVo indexConfigCountVo = resumptionUndoIndexList.get(0);
+
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+        List<CoreSafetySourceData> sourceDataList = new ArrayList<>();
+        int count = dataList.size();
+
+        double deductScore = count * indexConfigCountVo.getItemValue();
+
+        //计算累计数
+        if (count != 0) {
+            CoreSafetySourceData safeSourceData = doNewSafetySourceData(indexConfigCountVo, orgId, deductScore, year, month, count);
+            sourceDataList.add(safeSourceData);
+        }
+        //将异常数据的时间进行排序并格式化
+        List<String> dataTimeList = dataList.stream()
+                .sorted(Comparator.comparing(CoreSafetyExceptionData::getDataTime))
+                .map(CoreSafetyExceptionData::getDataTime)
+                .map(sdf::format).distinct()
+                .collect(Collectors.toList());
+
+        //获取连续数的配置,并根据配置的连续数日期进行排序
+        List<SafeIndexRuleCountVo> resumptionContinuousIndexList = resumptionUndoIndexList.stream()
+                .filter(r -> r.getCalculateType() == 2)
+                .sorted(Comparator.comparing(SafeIndexRuleCountVo::getIndicatorDays))
+                .collect(Collectors.toList());
+
+        //连续数 3/5/10 连续出现次数
+        AtomicReference<Integer> atomicContinuousThreeDays = new AtomicReference<>(0);
+        AtomicReference<Integer> atomicContinuousFiveDays = new AtomicReference<>(0);
+        AtomicReference<Integer> atomicContinuousTenDays = new AtomicReference<>(0);
+        List<Map<Integer, List<String>>> mapList = groupContinuousDays(dataTimeList);
+        mapList.stream().flatMap(m -> m.entrySet().stream()).forEach(e -> {
+            Integer key = e.getKey();
+            List<String> value = e.getValue();
+            if (key >= 3) {
+                atomicContinuousThreeDays.getAndSet(atomicContinuousThreeDays.get() + 1);
+            }
+            if (key >= 5) {
+                atomicContinuousFiveDays.getAndSet(atomicContinuousFiveDays.get() + 1);
+            }
+            if (key >= 10) {
+                atomicContinuousTenDays.getAndSet(atomicContinuousTenDays.get() + 1);
+            }
+        });
+
+        Integer continuousThreeDays = atomicContinuousThreeDays.get();
+        Integer continuousFiveDays = atomicContinuousFiveDays.get();
+        Integer continuousTenDays = atomicContinuousTenDays.get();
+
+        //第一次连续的分数
+        if (continuousThreeDays != 0) {
+            double threeDayDeductScore = continuousThreeDays * resumptionContinuousIndexList.get(0).getItemValue();
+            CoreSafetySourceData sourceData = doNewSafetySourceData(resumptionUndoIndexList.get(0), orgId, threeDayDeductScore, year, month, continuousThreeDays);
+            sourceDataList.add(sourceData);
+        }
+
+        //第二次连续的分数
+        if (continuousFiveDays != 0) {
+            double fiveDaysDeductScore = continuousFiveDays * resumptionContinuousIndexList.get(1).getItemValue();
+            CoreSafetySourceData sourceData = doNewSafetySourceData(resumptionUndoIndexList.get(1), orgId, fiveDaysDeductScore, year, month, continuousFiveDays);
+            sourceDataList.add(sourceData);
+        }
+
+        //第三次连续的分数
+        if (continuousTenDays != 0) {
+            double tenDaysDeductScore = continuousTenDays * resumptionContinuousIndexList.get(2).getItemValue();
+            CoreSafetySourceData sourceData = doNewSafetySourceData(resumptionUndoIndexList.get(2), orgId, tenDaysDeductScore, year, month, continuousTenDays);
+            sourceDataList.add(sourceData);
+        }
+
+        return sourceDataList;
+    }
+//传入一个已做好升序排序的数组,数组中的每个元素都是yyyy-MM-dd格式的时间,判断相邻元素是否是连续的时间,把所有的连续天数分组出来,放在一个map中,key为连续天数,value为连续天数的集合,最终返回一个List<Map<Integer,List<String>>这样的数据
+// 例如:传入参数:["2022-01-01", "2022-01-02", "2022-01-03", "2022-01-04", "2022-01-06", "2022-01-07", "2022-01-08", "2022-01-09", "2022-01-11"],应该返回一个List<Map<Integer,List<String>>,数组中有两个map:一个map,其中一个key为4,value为["2022-01-01", "2022-01-02", "2022-01-03", "2022-01-04"],另一个map,其中一个key也为4,value为["2022-01-06", "2022-01-07", "2022-01-08", "2022-01-09"],其中"2022-01-11" 这个元素应该被丢弃,因为它不与其他任何元素是相邻时间
+
+    public static List<Map<Integer, List<String>>> groupContinuousDays(List<String> days) {
+        List<Map<Integer, List<String>>> result = new ArrayList<>();
+        if (days == null || days.size() == 0) {
+            return result;
+        }
+        List<String> list = new ArrayList<>();
+        LocalDate preDate = LocalDate.parse(days.get(0), DateTimeFormatter.ofPattern("yyyy-MM-dd"));
+        for (int i = 1; i < days.size(); i++) {
+            Map<Integer, List<String>> map = new HashMap<>();
+            LocalDate curDate = LocalDate.parse(days.get(i), DateTimeFormatter.ofPattern("yyyy-MM-dd"));
+            if (preDate.plusDays(1).equals(curDate)) {
+                if (!list.contains(days.get(i - 1))) {
+                    list.add(days.get(i - 1));
+                }
+                if (!list.contains(days.get(i))) {
+                    list.add(days.get(i));
+                }
+            } else {
+                if (list.size() > 0) {
+                    map.put(list.size(), new ArrayList<>(list));
+                    result.add(map);
+                    list.clear();
+                }
+            }
+            preDate = curDate;
+        }
+        return result;
+    }
+
+   /* public static void main(String[] args) {
+        String[] dates = {"2022-01-01", "2022-01-02", "2022-01-03", "2022-01-04", "2022-01-06", "2022-01-07", "2022-01-08", "2022-01-09", "2022-01-11"};
+        List<Map<Integer, List<String>>> result = groupContinuousDays(dates);
+
+        for (Map<Integer, List<String>> group : result) {
+            for (Map.Entry<Integer, List<String>> entry : group.entrySet()) {
+                int count = entry.getKey();
+                List<String> datesList = entry.getValue();
+                System.out.println("连续天数:" + count);
+                System.out.println("日期集合:" + datesList);
+            }
+        }
+    }*/
+
+
+    private CoreSafetySourceData doNewSafetySourceData(SafeIndexRuleCountVo indexConfigCountVo, Long orgId, double deductScore, int year, int month, int time) {
+        CoreSafetySourceData safeSourceData = new CoreSafetySourceData();
+        safeSourceData.setId(IdWorker.getId());
+        safeSourceData.setRuleId(indexConfigCountVo.getRuleId());
+        safeSourceData.setItemId(indexConfigCountVo.getItemId());
+        safeSourceData.setOrgId(orgId);
+        safeSourceData.setTimes(time);
+        safeSourceData.setScore(deductScore);
+        safeSourceData.setDataYear(year);
+        safeSourceData.setDataMonth(month);
+        safeSourceData.setTypeCode(indexConfigCountVo.getTypeCode());
+        return safeSourceData;
+    }
+
+
+    private Map<Integer, List<CoreSafetyExceptionData>> buildExecTimeMap(List<CoreSafetyExceptionData> resumptionExceptionDataListByOrg) {
+        HashMap<Integer, List<CoreSafetyExceptionData>> hashMap = new HashMap<>();
+        //未登营业前
+        List<CoreSafetyExceptionData> undoBeforeList = new ArrayList<>();
+        //未登营业中
+        List<CoreSafetyExceptionData> undoMiddleList = new ArrayList<>();
+        //未登营业后
+        List<CoreSafetyExceptionData> undoAfterList = new ArrayList<>();
+        hashMap.put(2, undoBeforeList);
+        hashMap.put(3, undoMiddleList);
+        hashMap.put(4, undoAfterList);
+        resumptionExceptionDataListByOrg.stream().filter(r -> ObjectUtil.equal(r.getExtraField2(), "2")).forEach(r -> {
+            hashMap.get(2).add(r);
+        });
+        resumptionExceptionDataListByOrg.stream().filter(r -> ObjectUtil.equal(r.getExtraField2(), "3")).forEach(r -> {
+            hashMap.get(3).add(r);
+        });
+        resumptionExceptionDataListByOrg.stream().filter(r -> ObjectUtil.equal(r.getExtraField2(), "4")).forEach(r -> {
+            hashMap.get(4).add(r);
+        });
+
+        return hashMap;
+    }
+
+    private void deleteOldData(int year, int month) {
+        //删除已有的计算数据
+        safetyDeductDataService.deleteSafeDeductData(year, month);
+        //删除已有的计算数据
+        sourceDataService.deleteSourceData(year, month);
     }
 
     private List<CoreSafetyExceptionData> queryExceptionDataList(String dataSource, DateTime time) {
@@ -146,4 +410,36 @@ public class CoreSafetyExceptionDataServiceImpl extends ServiceImpl<CoreSafetyEx
         time.setField(DateField.MILLISECOND, 0);
         return time;
     }
+
+    /**
+     * 保存数据到数据源
+     *
+     * @param sourceDataList
+     * @param indexConfigCountVo
+     */
+    public void saveSourceData(List<CoreSafetySourceData> sourceDataList, SafeIndexRuleCountVo indexConfigCountVo) {
+        if (sourceDataList.isEmpty()) {
+            return;
+        }
+        //保存数据到数据源表
+        sourceDataService.saveBatch(sourceDataList);
+        CoreSafetySourceData sourceData = sourceDataList.get(0);
+        double total = 0;
+        for (CoreSafetySourceData s : sourceDataList) {
+            total += s.getScore();
+        }
+        CoreSafetyDeductData safeDeductData = new CoreSafetyDeductData();
+        safeDeductData.setDataMonth(sourceData.getDataMonth());
+        safeDeductData.setDataYear(sourceData.getDataYear());
+        safeDeductData.setId(IdWorker.getId());
+        safeDeductData.setRuleId(sourceData.getRuleId());
+        safeDeductData.setOrgId(sourceData.getOrgId());
+        safeDeductData.setScore(total);
+        if (total > indexConfigCountVo.getScore()) {
+            safeDeductData.setScoreReal((double) indexConfigCountVo.getScore());
+        } else {
+            safeDeductData.setScoreReal(total);
+        }
+        safetyDeductDataService.save(safeDeductData);
+    }
 }

+ 127 - 0
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/safetyindex/service/impl/CoreSafetySourceDataServiceImpl.java

@@ -0,0 +1,127 @@
+package com.xunmei.core.safetyindex.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.xunmei.common.core.web.page.TableDataInfo;
+import com.xunmei.common.core.domain.safetyindex.domain.CoreSafetySourceData;
+import com.xunmei.core.safetyindex.mapper.CoreSafetySourceDataMapper;
+import com.xunmei.core.safetyindex.service.ICoreSafetySourceDataService;
+import com.xunmei.system.api.RemoteOrgService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * 安全指数机构扣分细项Service业务层处理
+ *
+ * @author xunmei
+ * @date 2023-10-11
+ */
+@Service
+public class CoreSafetySourceDataServiceImpl extends ServiceImpl<CoreSafetySourceDataMapper, CoreSafetySourceData> implements ICoreSafetySourceDataService {
+    @Autowired
+    private CoreSafetySourceDataMapper coreSafetySourceDataMapper;
+    @Autowired
+    private RemoteOrgService orgService;
+
+    @Override
+    public TableDataInfo<CoreSafetySourceData> selectPage(CoreSafetySourceData coreSafetySourceData) {
+        //未删除
+
+        Page<CoreSafetySourceData> page;
+        //分页
+        if (coreSafetySourceData.getPageNum()!=null&&coreSafetySourceData.getPageSize()!=null)
+        {
+            page = new Page<>(coreSafetySourceData.getPageNum(), coreSafetySourceData.getPageSize());
+        }else{
+            page = new Page<>();
+        }
+        //查询条件
+        QueryWrapper<CoreSafetySourceData> query = new QueryWrapper<>(coreSafetySourceData);
+        //获取数据
+        page = coreSafetySourceDataMapper.selectPage(page, query);
+        //抓换为TableDataInfo适配前端
+        return TableDataInfo.build(page);
+
+
+
+
+    }
+
+
+    /**
+     * 查询安全指数机构扣分细项
+     *
+     * @param id 安全指数机构扣分细项主键
+     * @return 安全指数机构扣分细项
+     */
+    @Override
+    public CoreSafetySourceData selectCoreSafetySourceDataById(Long id) {
+        return coreSafetySourceDataMapper.selectById(id);
+    }
+
+    /**
+     * 查询安全指数机构扣分细项列表
+     *
+     * @param coreSafetySourceData 安全指数机构扣分细项
+     * @return 安全指数机构扣分细项
+     */
+    @Override
+    public List<CoreSafetySourceData> selectCoreSafetySourceDataList(CoreSafetySourceData coreSafetySourceData) {
+        return coreSafetySourceDataMapper.selectList(new QueryWrapper<>(coreSafetySourceData));
+    }
+
+    /**
+     * 新增安全指数机构扣分细项
+     *
+     * @param coreSafetySourceData 安全指数机构扣分细项
+     * @return 结果
+     */
+    @Override
+    public int insertCoreSafetySourceData(CoreSafetySourceData coreSafetySourceData) {
+            return coreSafetySourceDataMapper.insert(coreSafetySourceData);
+    }
+
+    /**
+     * 修改安全指数机构扣分细项
+     *
+     * @param coreSafetySourceData 安全指数机构扣分细项
+     * @return 结果
+     */
+    @Override
+    public int updateCoreSafetySourceData(CoreSafetySourceData coreSafetySourceData) {
+        return coreSafetySourceDataMapper.updateById(coreSafetySourceData);
+    }
+
+    /**
+     * 批量删除安全指数机构扣分细项
+     *
+     * @param ids 需要删除的安全指数机构扣分细项主键
+     * @return 结果
+     */
+    @Override
+    public int deleteCoreSafetySourceDataByIds(Long[] ids) {
+        return coreSafetySourceDataMapper.deleteBatchIds(Arrays.asList((ids)));
+    }
+
+    /**
+     * 删除安全指数机构扣分细项信息
+     *
+     * @param id 安全指数机构扣分细项主键
+     * @return 结果
+     */
+    @Override
+    public int deleteCoreSafetySourceDataById(Long id) {
+        return coreSafetySourceDataMapper.deleteById(id);
+    }
+
+    @Override
+    public void deleteSourceData(int year, int month) {
+        coreSafetySourceDataMapper.delete(new QueryWrapper<CoreSafetySourceData>().lambda()
+                .eq(CoreSafetySourceData::getDataYear, year)
+                .eq(CoreSafetySourceData::getDataMonth, month));
+    }
+}

+ 136 - 0
soc-modules/soc-modules-core/src/main/resources/mapper/safetyindex/CoreSafeMonthScoreMapper.xml

@@ -0,0 +1,136 @@
+<?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.xunmei.core.safetyindex.mapper.CoreSafeMonthScoreMapper">
+
+    <resultMap type="com.xunmei.common.core.domain.safetyindex.domain.CoreSafeMonthScore" id="CoreSafeMonthScoreResult">
+                <result property="id" column="id"/>
+                <result property="levelId" column="level_id"/>
+                <result property="orgId" column="org_id"/>
+                <result property="dataYear" column="data_year"/>
+                <result property="dataMonth" column="data_month"/>
+                <result property="orgScore" column="org_score"/>
+                <result property="releaseStatus" column="release_status"/>
+                <result property="orgPath" column="org_path"/>
+    </resultMap>
+
+    <sql id="selectCoreSafeMonthScoreVo">
+        select id, level_id, org_id, data_year, data_month, org_score, release_status, org_path
+        from core_safe_month_score
+    </sql>
+
+    <select id="selectCoreSafeMonthScoreList" parameterType="com.xunmei.common.core.domain.safetyindex.domain.CoreSafeMonthScore"
+            resultMap="CoreSafeMonthScoreResult">
+        <include refid="selectCoreSafeMonthScoreVo"/>
+        <where>
+                        <if test="levelId != null ">
+                            and level_id = #{levelId}
+                        </if>
+                        <if test="orgId != null ">
+                            and org_id = #{orgId}
+                        </if>
+                        <if test="dataYear != null ">
+                            and data_year = #{dataYear}
+                        </if>
+                        <if test="dataMonth != null ">
+                            and data_month = #{dataMonth}
+                        </if>
+                        <if test="orgScore != null ">
+                            and org_score = #{orgScore}
+                        </if>
+                        <if test="releaseStatus != null ">
+                            and release_status = #{releaseStatus}
+                        </if>
+                        <if test="orgPath != null  and orgPath != ''">
+                            and org_path = #{orgPath}
+                        </if>
+        </where>
+    </select>
+
+    <select id="selectCoreSafeMonthScoreById" parameterType="Long"
+            resultMap="CoreSafeMonthScoreResult">
+            <include refid="selectCoreSafeMonthScoreVo"/>
+            where id = #{id}
+    </select>
+
+    <insert id="insertCoreSafeMonthScore" parameterType="com.xunmei.common.core.domain.safetyindex.domain.CoreSafeMonthScore">
+        insert into core_safe_month_score
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+                    <if test="id != null">id,
+                    </if>
+                    <if test="levelId != null">level_id,
+                    </if>
+                    <if test="orgId != null">org_id,
+                    </if>
+                    <if test="dataYear != null">data_year,
+                    </if>
+                    <if test="dataMonth != null">data_month,
+                    </if>
+                    <if test="orgScore != null">org_score,
+                    </if>
+                    <if test="releaseStatus != null">release_status,
+                    </if>
+                    <if test="orgPath != null">org_path,
+                    </if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+                    <if test="id != null">#{id},
+                    </if>
+                    <if test="levelId != null">#{levelId},
+                    </if>
+                    <if test="orgId != null">#{orgId},
+                    </if>
+                    <if test="dataYear != null">#{dataYear},
+                    </if>
+                    <if test="dataMonth != null">#{dataMonth},
+                    </if>
+                    <if test="orgScore != null">#{orgScore},
+                    </if>
+                    <if test="releaseStatus != null">#{releaseStatus},
+                    </if>
+                    <if test="orgPath != null">#{orgPath},
+                    </if>
+        </trim>
+    </insert>
+
+    <update id="updateCoreSafeMonthScore" parameterType="com.xunmei.common.core.domain.safetyindex.domain.CoreSafeMonthScore">
+        update core_safe_month_score
+        <trim prefix="SET" suffixOverrides=",">
+                    <if test="levelId != null">level_id =
+                        #{levelId},
+                    </if>
+                    <if test="orgId != null">org_id =
+                        #{orgId},
+                    </if>
+                    <if test="dataYear != null">data_year =
+                        #{dataYear},
+                    </if>
+                    <if test="dataMonth != null">data_month =
+                        #{dataMonth},
+                    </if>
+                    <if test="orgScore != null">org_score =
+                        #{orgScore},
+                    </if>
+                    <if test="releaseStatus != null">release_status =
+                        #{releaseStatus},
+                    </if>
+                    <if test="orgPath != null">org_path =
+                        #{orgPath},
+                    </if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteCoreSafeMonthScoreById" parameterType="Long">
+        delete
+        from core_safe_month_score where id = #{id}
+    </delete>
+
+    <delete id="deleteCoreSafeMonthScoreByIds" parameterType="String">
+        delete from core_safe_month_score where id in
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>

+ 125 - 0
soc-modules/soc-modules-core/src/main/resources/mapper/safetyindex/CoreSafetyDeductDataMapper.xml

@@ -0,0 +1,125 @@
+<?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.xunmei.core.safetyindex.mapper.CoreSafetyDeductDataMapper">
+
+    <resultMap type="com.xunmei.common.core.domain.safetyindex.domain.CoreSafetyDeductData" id="CoreSafetyDeductDataResult">
+                <result property="id" column="id"/>
+                <result property="ruleId" column="rule_id"/>
+                <result property="orgId" column="org_id"/>
+                <result property="dataYear" column="data_year"/>
+                <result property="dataMonth" column="data_month"/>
+                <result property="score" column="score"/>
+                <result property="scoreReal" column="score_real"/>
+    </resultMap>
+
+    <sql id="selectCoreSafetyDeductDataVo">
+        select id, rule_id, org_id, data_year, data_month, score, score_real
+        from core_safety_deduct_data
+    </sql>
+
+    <select id="selectCoreSafetyDeductDataList" parameterType="com.xunmei.common.core.domain.safetyindex.domain.CoreSafetyDeductData"
+            resultMap="CoreSafetyDeductDataResult">
+        <include refid="selectCoreSafetyDeductDataVo"/>
+        <where>
+                        <if test="ruleId != null ">
+                            and rule_id = #{ruleId}
+                        </if>
+                        <if test="orgId != null ">
+                            and org_id = #{orgId}
+                        </if>
+                        <if test="dataYear != null ">
+                            and data_year = #{dataYear}
+                        </if>
+                        <if test="dataMonth != null ">
+                            and data_month = #{dataMonth}
+                        </if>
+                        <if test="score != null ">
+                            and score = #{score}
+                        </if>
+                        <if test="scoreReal != null ">
+                            and score_real = #{scoreReal}
+                        </if>
+        </where>
+    </select>
+
+    <select id="selectCoreSafetyDeductDataById" parameterType="Long"
+            resultMap="CoreSafetyDeductDataResult">
+            <include refid="selectCoreSafetyDeductDataVo"/>
+            where id = #{id}
+    </select>
+
+    <insert id="insertCoreSafetyDeductData" parameterType="com.xunmei.common.core.domain.safetyindex.domain.CoreSafetyDeductData">
+        insert into core_safety_deduct_data
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+                    <if test="id != null">id,
+                    </if>
+                    <if test="ruleId != null">rule_id,
+                    </if>
+                    <if test="orgId != null">org_id,
+                    </if>
+                    <if test="dataYear != null">data_year,
+                    </if>
+                    <if test="dataMonth != null">data_month,
+                    </if>
+                    <if test="score != null">score,
+                    </if>
+                    <if test="scoreReal != null">score_real,
+                    </if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+                    <if test="id != null">#{id},
+                    </if>
+                    <if test="ruleId != null">#{ruleId},
+                    </if>
+                    <if test="orgId != null">#{orgId},
+                    </if>
+                    <if test="dataYear != null">#{dataYear},
+                    </if>
+                    <if test="dataMonth != null">#{dataMonth},
+                    </if>
+                    <if test="score != null">#{score},
+                    </if>
+                    <if test="scoreReal != null">#{scoreReal},
+                    </if>
+        </trim>
+    </insert>
+
+    <update id="updateCoreSafetyDeductData" parameterType="com.xunmei.common.core.domain.safetyindex.domain.CoreSafetyDeductData">
+        update core_safety_deduct_data
+        <trim prefix="SET" suffixOverrides=",">
+                    <if test="ruleId != null">rule_id =
+                        #{ruleId},
+                    </if>
+                    <if test="orgId != null">org_id =
+                        #{orgId},
+                    </if>
+                    <if test="dataYear != null">data_year =
+                        #{dataYear},
+                    </if>
+                    <if test="dataMonth != null">data_month =
+                        #{dataMonth},
+                    </if>
+                    <if test="score != null">score =
+                        #{score},
+                    </if>
+                    <if test="scoreReal != null">score_real =
+                        #{scoreReal},
+                    </if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteCoreSafetyDeductDataById" parameterType="Long">
+        delete
+        from core_safety_deduct_data where id = #{id}
+    </delete>
+
+    <delete id="deleteCoreSafetyDeductDataByIds" parameterType="String">
+        delete from core_safety_deduct_data where id in
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>

+ 147 - 0
soc-modules/soc-modules-core/src/main/resources/mapper/safetyindex/CoreSafetySourceDataMapper.xml

@@ -0,0 +1,147 @@
+<?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.xunmei.core.safetyindex.mapper.CoreSafetySourceDataMapper">
+
+    <resultMap type="com.xunmei.common.core.domain.safetyindex.domain.CoreSafetySourceData" id="CoreSafetySourceDataResult">
+                <result property="id" column="id"/>
+                <result property="ruleId" column="rule_id"/>
+                <result property="itemId" column="item_id"/>
+                <result property="orgId" column="org_id"/>
+                <result property="dataYear" column="data_year"/>
+                <result property="dataMonth" column="data_month"/>
+                <result property="times" column="times"/>
+                <result property="score" column="score"/>
+                <result property="typeCode" column="type_code"/>
+    </resultMap>
+
+    <sql id="selectCoreSafetySourceDataVo">
+        select id, rule_id, item_id, org_id, data_year, data_month, times, score, type_code
+        from core_safety_source_data
+    </sql>
+
+    <select id="selectCoreSafetySourceDataList" parameterType="com.xunmei.common.core.domain.safetyindex.domain.CoreSafetySourceData"
+            resultMap="CoreSafetySourceDataResult">
+        <include refid="selectCoreSafetySourceDataVo"/>
+        <where>
+                        <if test="ruleId != null ">
+                            and rule_id = #{ruleId}
+                        </if>
+                        <if test="itemId != null ">
+                            and item_id = #{itemId}
+                        </if>
+                        <if test="orgId != null ">
+                            and org_id = #{orgId}
+                        </if>
+                        <if test="dataYear != null ">
+                            and data_year = #{dataYear}
+                        </if>
+                        <if test="dataMonth != null ">
+                            and data_month = #{dataMonth}
+                        </if>
+                        <if test="times != null ">
+                            and times = #{times}
+                        </if>
+                        <if test="score != null ">
+                            and score = #{score}
+                        </if>
+                        <if test="typeCode != null  and typeCode != ''">
+                            and type_code = #{typeCode}
+                        </if>
+        </where>
+    </select>
+
+    <select id="selectCoreSafetySourceDataById" parameterType="Long"
+            resultMap="CoreSafetySourceDataResult">
+            <include refid="selectCoreSafetySourceDataVo"/>
+            where id = #{id}
+    </select>
+
+    <insert id="insertCoreSafetySourceData" parameterType="com.xunmei.common.core.domain.safetyindex.domain.CoreSafetySourceData">
+        insert into core_safety_source_data
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+                    <if test="id != null">id,
+                    </if>
+                    <if test="ruleId != null">rule_id,
+                    </if>
+                    <if test="itemId != null">item_id,
+                    </if>
+                    <if test="orgId != null">org_id,
+                    </if>
+                    <if test="dataYear != null">data_year,
+                    </if>
+                    <if test="dataMonth != null">data_month,
+                    </if>
+                    <if test="times != null">times,
+                    </if>
+                    <if test="score != null">score,
+                    </if>
+                    <if test="typeCode != null">type_code,
+                    </if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+                    <if test="id != null">#{id},
+                    </if>
+                    <if test="ruleId != null">#{ruleId},
+                    </if>
+                    <if test="itemId != null">#{itemId},
+                    </if>
+                    <if test="orgId != null">#{orgId},
+                    </if>
+                    <if test="dataYear != null">#{dataYear},
+                    </if>
+                    <if test="dataMonth != null">#{dataMonth},
+                    </if>
+                    <if test="times != null">#{times},
+                    </if>
+                    <if test="score != null">#{score},
+                    </if>
+                    <if test="typeCode != null">#{typeCode},
+                    </if>
+        </trim>
+    </insert>
+
+    <update id="updateCoreSafetySourceData" parameterType="com.xunmei.common.core.domain.safetyindex.domain.CoreSafetySourceData">
+        update core_safety_source_data
+        <trim prefix="SET" suffixOverrides=",">
+                    <if test="ruleId != null">rule_id =
+                        #{ruleId},
+                    </if>
+                    <if test="itemId != null">item_id =
+                        #{itemId},
+                    </if>
+                    <if test="orgId != null">org_id =
+                        #{orgId},
+                    </if>
+                    <if test="dataYear != null">data_year =
+                        #{dataYear},
+                    </if>
+                    <if test="dataMonth != null">data_month =
+                        #{dataMonth},
+                    </if>
+                    <if test="times != null">times =
+                        #{times},
+                    </if>
+                    <if test="score != null">score =
+                        #{score},
+                    </if>
+                    <if test="typeCode != null">type_code =
+                        #{typeCode},
+                    </if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteCoreSafetySourceDataById" parameterType="Long">
+        delete
+        from core_safety_source_data where id = #{id}
+    </delete>
+
+    <delete id="deleteCoreSafetySourceDataByIds" parameterType="String">
+        delete from core_safety_source_data where id in
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>