Browse Source

医健宝部门数据

吴树波 1 month ago
parent
commit
a06f31b528
19 changed files with 1055 additions and 98 deletions
  1. 103 0
      fs-admin/src/main/java/com/fs/web/controller/system/SysDeptConfigLogController.java
  2. 37 0
      fs-admin/src/main/java/com/fs/web/controller/system/SysDeptController.java
  3. 6 1
      fs-common/src/main/java/com/fs/common/core/domain/entity/SysDept.java
  4. 9 1
      fs-qw-task/src/main/java/com/fs/app/taskService/impl/QwExternalContactRatingServiceImpl.java
  5. 1 0
      fs-service/src/main/java/com/fs/course/config/CourseConfig.java
  6. 5 5
      fs-service/src/main/java/com/fs/qw/param/QwExternalContactParam.java
  7. 1 1
      fs-service/src/main/java/com/fs/sop/mapper/SopUserLogsMapper.java
  8. 52 0
      fs-service/src/main/java/com/fs/system/domain/SysDeptConfig.java
  9. 47 0
      fs-service/src/main/java/com/fs/system/domain/SysDeptConfigLog.java
  10. 61 0
      fs-service/src/main/java/com/fs/system/mapper/SysDeptConfigLogMapper.java
  11. 61 0
      fs-service/src/main/java/com/fs/system/mapper/SysDeptConfigMapper.java
  12. 63 0
      fs-service/src/main/java/com/fs/system/service/ISysDeptConfigLogService.java
  13. 70 0
      fs-service/src/main/java/com/fs/system/service/ISysDeptConfigService.java
  14. 109 0
      fs-service/src/main/java/com/fs/system/service/impl/SysDeptConfigLogServiceImpl.java
  15. 158 0
      fs-service/src/main/java/com/fs/system/service/impl/SysDeptConfigServiceImpl.java
  16. 67 89
      fs-service/src/main/java/com/fs/system/service/impl/SysDeptServiceImpl.java
  17. 101 0
      fs-service/src/main/resources/mapper/deptConfig/SysDeptConfigMapper.xml
  18. 101 0
      fs-service/src/main/resources/mapper/deptConfigLog/SysDeptConfigLogMapper.xml
  19. 3 1
      fs-service/src/main/resources/mapper/sop/SopUserLogsMapper.xml

+ 103 - 0
fs-admin/src/main/java/com/fs/web/controller/system/SysDeptConfigLogController.java

@@ -0,0 +1,103 @@
+package com.fs.web.controller.system;
+
+import java.util.List;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.fs.common.annotation.Log;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.enums.BusinessType;
+import com.fs.system.domain.SysDeptConfigLog;
+import com.fs.system.service.ISysDeptConfigLogService;
+import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.common.core.page.TableDataInfo;
+
+/**
+ * 系统部门资源配置使用记录Controller
+ * 
+ * @author fs
+ * @date 2025-09-22
+ */
+@RestController
+@RequestMapping("/deptConfigLog/sysDeptConfigLog")
+public class SysDeptConfigLogController extends BaseController
+{
+    @Autowired
+    private ISysDeptConfigLogService sysDeptConfigLogService;
+
+    /**
+     * 查询系统部门资源配置使用记录列表
+     */
+    @PreAuthorize("@ss.hasPermi('deptConfigLog:sysDeptConfigLog:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(SysDeptConfigLog sysDeptConfigLog)
+    {
+        startPage();
+        List<SysDeptConfigLog> list = sysDeptConfigLogService.selectSysDeptConfigLogList(sysDeptConfigLog);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出系统部门资源配置使用记录列表
+     */
+    @PreAuthorize("@ss.hasPermi('deptConfigLog:sysDeptConfigLog:export')")
+    @Log(title = "系统部门资源配置使用记录", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(SysDeptConfigLog sysDeptConfigLog)
+    {
+        List<SysDeptConfigLog> list = sysDeptConfigLogService.selectSysDeptConfigLogList(sysDeptConfigLog);
+        ExcelUtil<SysDeptConfigLog> util = new ExcelUtil<SysDeptConfigLog>(SysDeptConfigLog.class);
+        return util.exportExcel(list, "系统部门资源配置使用记录数据");
+    }
+
+    /**
+     * 获取系统部门资源配置使用记录详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('deptConfigLog:sysDeptConfigLog:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return AjaxResult.success(sysDeptConfigLogService.selectSysDeptConfigLogById(id));
+    }
+
+    /**
+     * 新增系统部门资源配置使用记录
+     */
+    @PreAuthorize("@ss.hasPermi('deptConfigLog:sysDeptConfigLog:add')")
+    @Log(title = "系统部门资源配置使用记录", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody SysDeptConfigLog sysDeptConfigLog)
+    {
+        return toAjax(sysDeptConfigLogService.insertSysDeptConfigLog(sysDeptConfigLog));
+    }
+
+    /**
+     * 修改系统部门资源配置使用记录
+     */
+    @PreAuthorize("@ss.hasPermi('deptConfigLog:sysDeptConfigLog:edit')")
+    @Log(title = "系统部门资源配置使用记录", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody SysDeptConfigLog sysDeptConfigLog)
+    {
+        return toAjax(sysDeptConfigLogService.updateSysDeptConfigLog(sysDeptConfigLog));
+    }
+
+    /**
+     * 删除系统部门资源配置使用记录
+     */
+    @PreAuthorize("@ss.hasPermi('deptConfigLog:sysDeptConfigLog:remove')")
+    @Log(title = "系统部门资源配置使用记录", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids)
+    {
+        return toAjax(sysDeptConfigLogService.deleteSysDeptConfigLogByIds(ids));
+    }
+}

+ 37 - 0
fs-admin/src/main/java/com/fs/web/controller/system/SysDeptController.java

@@ -1,7 +1,16 @@
 package com.fs.web.controller.system;
 
+import java.math.BigDecimal;
+import java.time.LocalDate;
 import java.util.Iterator;
 import java.util.List;
+
+import com.fs.common.core.domain.R;
+import com.fs.common.core.domain.model.LoginUser;
+import com.fs.common.utils.ServletUtils;
+import com.fs.framework.web.service.TokenService;
+import com.fs.system.service.ISysConfigService;
+import com.fs.system.service.ISysDeptConfigService;
 import org.apache.commons.lang3.ArrayUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -34,6 +43,10 @@ public class SysDeptController extends BaseController
 {
     @Autowired
     private ISysDeptService deptService;
+    @Autowired
+    private ISysDeptConfigService sysDeptConfigService;
+    @Autowired
+    private TokenService tokenService;
 
     /**
      * 获取部门列表
@@ -160,4 +173,28 @@ public class SysDeptController extends BaseController
         }
         return toAjax(deptService.deleteDeptById(deptId));
     }
+    /**
+     * 删除部门
+     */
+    @Log(title = "部门PAD数量修改", businessType = BusinessType.UPDATE)
+    @GetMapping("/updatePadNum")
+    public R updatePadNum(Long deptId, Integer num, LocalDate padTime){
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        sysDeptConfigService.updatePadNum(deptId, num, loginUser, padTime);
+        return R.ok();
+    }
+    @Log(title = "部门红包金额充值", businessType = BusinessType.UPDATE)
+    @GetMapping("/addRedMoney")
+    public R addRedMoney(Long deptId, BigDecimal money){
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        sysDeptConfigService.addRedMoney(deptId, money, loginUser);
+        return R.ok();
+    }
+    @Log(title = "部门流量充值", businessType = BusinessType.UPDATE)
+    @GetMapping("/addFlowNum")
+    public R addFlowNum(Long deptId, BigDecimal money){
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        sysDeptConfigService.addFlowNum(deptId, money, loginUser);
+        return R.ok();
+    }
 }

+ 6 - 1
fs-common/src/main/java/com/fs/common/core/domain/entity/SysDept.java

@@ -5,6 +5,8 @@ import java.util.List;
 import javax.validation.constraints.Email;
 import javax.validation.constraints.NotBlank;
 import javax.validation.constraints.Size;
+
+import lombok.Data;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
 import com.fs.common.core.domain.BaseEntity;
@@ -14,6 +16,7 @@ import com.fs.common.core.domain.BaseEntity;
  * 
 
  */
+@Data
 public class SysDept extends BaseEntity
 {
     private static final long serialVersionUID = 1L;
@@ -50,7 +53,9 @@ public class SysDept extends BaseEntity
 
     /** 父部门名称 */
     private String parentName;
-    
+
+    private Object deptConfig;
+
     /** 子部门 */
     private List<SysDept> children = new ArrayList<SysDept>();
 

+ 9 - 1
fs-qw-task/src/main/java/com/fs/app/taskService/impl/QwExternalContactRatingServiceImpl.java

@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
 import com.fs.app.taskService.QwExternalContactRatingService;
 import com.fs.common.core.domain.R;
 import com.fs.common.core.redis.RedisCache;
+import com.fs.course.config.CourseConfig;
 import com.fs.course.mapper.FsCourseWatchLogMapper;
 import com.fs.qw.domain.QwExternalContact;
 import com.fs.qw.mapper.QwExternalContactMapper;
@@ -14,6 +15,8 @@ import com.fs.sop.mapper.SopUserLogsMapper;
 import com.fs.sop.params.QwRatingConfig;
 import com.fs.sop.service.IQwSopTempDayService;
 import com.fs.sop.vo.QwRatingVO;
+import com.fs.system.domain.SysConfig;
+import com.fs.system.mapper.SysConfigMapper;
 import com.fs.system.service.ISysConfigService;
 import com.fs.voice.utils.StringUtil;
 import com.google.common.util.concurrent.AtomicDouble;
@@ -71,6 +74,8 @@ public class QwExternalContactRatingServiceImpl implements QwExternalContactRati
     private final List<CompletableFuture<Void>> updateFutures = Collections.synchronizedList(new ArrayList<>());
 
     private final Object configLock = new Object();
+    @Autowired
+    private SysConfigMapper sysConfigMapper;
 
     // 启动时初始化消费者线程
     @PostConstruct
@@ -106,13 +111,16 @@ public class QwExternalContactRatingServiceImpl implements QwExternalContactRati
     @Override
     public R ratingUserLogs() {
 
+        SysConfig courseConfig = sysConfigMapper.selectConfigByConfigKey("course.config");
+        CourseConfig config = JSON.parseObject(courseConfig.getConfigValue(), CourseConfig.class);
+
         // 分页加载并放入队列
         int pageSize = 1000;
         int offset = 0;
         List<SopUserLogs> sopUserLogs;
 
         do {
-            sopUserLogs = sopUserLogsMapper.meetsTheRatingByUserInfoWithPagination(offset, pageSize);
+            sopUserLogs = sopUserLogsMapper.meetsTheRatingByUserInfoWithPagination(offset, pageSize, config.getIsAllratingRating());
             if (!sopUserLogs.isEmpty()) {
                 sopUserLogs.forEach(item -> {
                     try {

+ 1 - 0
fs-service/src/main/java/com/fs/course/config/CourseConfig.java

@@ -62,6 +62,7 @@ public class CourseConfig implements Serializable {
      * 是否绑定
      */
     private Boolean isBound;
+    private Boolean isAllratingRating;
     private Boolean dept;
     /**
      * 是否单销售观看(只能在第一次绑定的销售头上看课)

+ 5 - 5
fs-service/src/main/java/com/fs/qw/param/QwExternalContactParam.java

@@ -100,16 +100,16 @@ public class QwExternalContactParam {
     private String isBind;
     private String isBindMini;
 
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern = "yyyy-MM-dd")
     private Date createTime;
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern = "yyyy-MM-dd")
     private Date lossTime;
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern = "yyyy-MM-dd")
     private Date delTime;
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern = "yyyy-MM-dd")
     private Date eTime;
 
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern = "yyyy-MM-dd")
     private Date sTime;
 
     /**

+ 1 - 1
fs-service/src/main/java/com/fs/sop/mapper/SopUserLogsMapper.java

@@ -59,7 +59,7 @@ public interface SopUserLogsMapper {
     public List<SopUserLogs> meetsTheRatingByUserInfo();
 
     @DataSource(DataSourceType.SOP)
-    public List<SopUserLogs> meetsTheRatingByUserInfoWithPagination(@Param("offset") int offset,@Param("pageSize") int pageSize);
+    public List<SopUserLogs> meetsTheRatingByUserInfoWithPagination(@Param("offset") int offset, @Param("pageSize") int pageSize, @Param("isAllratingRating") Boolean isAllratingRating);
 
     @DataSource(DataSourceType.SOP)
     public List<SopUserLogs> meetsTheRatingByUserInfoWithPaginationStudyDays(@Param("offset") int offset,@Param("pageSize") int pageSize,@Param("notStudyDays") Integer notStudyDays);

+ 52 - 0
fs-service/src/main/java/com/fs/system/domain/SysDeptConfig.java

@@ -0,0 +1,52 @@
+package com.fs.system.domain;
+
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.fs.common.annotation.Excel;
+import lombok.Data;
+import com.fs.common.core.domain.BaseEntity;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 部门配置对象 sys_dept_config
+ *
+ * @author fs
+ * @date 2025-09-22
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class SysDeptConfig extends BaseEntity{
+
+    /** id */
+    private Long id;
+
+    /** 部门ID */
+    @Excel(name = "部门ID")
+    private Long deptId;
+
+    /** pad 数量限制 */
+    @Excel(name = "pad 数量限制")
+    private Long padNum;
+
+    /** 剩余pad 数量 */
+    @Excel(name = "剩余pad 数量")
+    private Long padNumSub;
+
+    /** pad 过期时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "pad 过期时间", width = 30, dateFormat = "yyyy-MM-dd")
+    private LocalDate padTime;
+
+    /** 剩余红包金额 */
+    @Excel(name = "剩余红包金额")
+    private BigDecimal redPackage;
+
+    /** 流量 */
+    @Excel(name = "流量")
+    private Long flowNum;
+
+
+}

+ 47 - 0
fs-service/src/main/java/com/fs/system/domain/SysDeptConfigLog.java

@@ -0,0 +1,47 @@
+package com.fs.system.domain;
+
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.fs.common.annotation.Excel;
+import lombok.Data;
+import com.fs.common.core.domain.BaseEntity;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 系统部门资源配置使用记录对象 sys_dept_config_log
+ *
+ * @author fs
+ * @date 2025-09-22
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class SysDeptConfigLog extends BaseEntity{
+
+    /** id */
+    private Long id;
+
+    /** 部门ID */
+    @Excel(name = "部门ID")
+    private Long deptId;
+
+    /** 数据类型(0红包1流量) */
+    @Excel(name = "数据类型", readConverterExp = "0=pad1=红包2=流量")
+    private Integer logType;
+
+    /** 操作类型(0新增1减少) */
+    @Excel(name = "操作类型", readConverterExp = "0=新增1减少")
+    private Integer operateType;
+
+    /** 操作数量 */
+    @Excel(name = "操作数量")
+    private String num;
+
+    /** 操作前数量 */
+    @Excel(name = "操作前数量")
+    private String firstNum;
+
+    /** 操作完成后数量 */
+    @Excel(name = "操作完成后数量")
+    private String lastNum;
+
+
+}

+ 61 - 0
fs-service/src/main/java/com/fs/system/mapper/SysDeptConfigLogMapper.java

@@ -0,0 +1,61 @@
+package com.fs.system.mapper;
+
+import java.util.List;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.fs.system.domain.SysDeptConfigLog;
+
+/**
+ * 系统部门资源配置使用记录Mapper接口
+ * 
+ * @author fs
+ * @date 2025-09-22
+ */
+public interface SysDeptConfigLogMapper extends BaseMapper<SysDeptConfigLog>{
+    /**
+     * 查询系统部门资源配置使用记录
+     * 
+     * @param id 系统部门资源配置使用记录主键
+     * @return 系统部门资源配置使用记录
+     */
+    SysDeptConfigLog selectSysDeptConfigLogById(Long id);
+
+    /**
+     * 查询系统部门资源配置使用记录列表
+     * 
+     * @param sysDeptConfigLog 系统部门资源配置使用记录
+     * @return 系统部门资源配置使用记录集合
+     */
+    List<SysDeptConfigLog> selectSysDeptConfigLogList(SysDeptConfigLog sysDeptConfigLog);
+
+    /**
+     * 新增系统部门资源配置使用记录
+     * 
+     * @param sysDeptConfigLog 系统部门资源配置使用记录
+     * @return 结果
+     */
+    int insertSysDeptConfigLog(SysDeptConfigLog sysDeptConfigLog);
+
+    /**
+     * 修改系统部门资源配置使用记录
+     * 
+     * @param sysDeptConfigLog 系统部门资源配置使用记录
+     * @return 结果
+     */
+    int updateSysDeptConfigLog(SysDeptConfigLog sysDeptConfigLog);
+
+    /**
+     * 删除系统部门资源配置使用记录
+     * 
+     * @param id 系统部门资源配置使用记录主键
+     * @return 结果
+     */
+    int deleteSysDeptConfigLogById(Long id);
+
+    /**
+     * 批量删除系统部门资源配置使用记录
+     * 
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    int deleteSysDeptConfigLogByIds(Long[] ids);
+}

+ 61 - 0
fs-service/src/main/java/com/fs/system/mapper/SysDeptConfigMapper.java

@@ -0,0 +1,61 @@
+package com.fs.system.mapper;
+
+import java.util.List;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.fs.system.domain.SysDeptConfig;
+
+/**
+ * 部门配置Mapper接口
+ * 
+ * @author fs
+ * @date 2025-09-22
+ */
+public interface SysDeptConfigMapper extends BaseMapper<SysDeptConfig>{
+    /**
+     * 查询部门配置
+     * 
+     * @param id 部门配置主键
+     * @return 部门配置
+     */
+    SysDeptConfig selectSysDeptConfigById(Long id);
+
+    /**
+     * 查询部门配置列表
+     * 
+     * @param sysDeptConfig 部门配置
+     * @return 部门配置集合
+     */
+    List<SysDeptConfig> selectSysDeptConfigList(SysDeptConfig sysDeptConfig);
+
+    /**
+     * 新增部门配置
+     * 
+     * @param sysDeptConfig 部门配置
+     * @return 结果
+     */
+    int insertSysDeptConfig(SysDeptConfig sysDeptConfig);
+
+    /**
+     * 修改部门配置
+     * 
+     * @param sysDeptConfig 部门配置
+     * @return 结果
+     */
+    int updateSysDeptConfig(SysDeptConfig sysDeptConfig);
+
+    /**
+     * 删除部门配置
+     * 
+     * @param id 部门配置主键
+     * @return 结果
+     */
+    int deleteSysDeptConfigById(Long id);
+
+    /**
+     * 批量删除部门配置
+     * 
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    int deleteSysDeptConfigByIds(Long[] ids);
+}

+ 63 - 0
fs-service/src/main/java/com/fs/system/service/ISysDeptConfigLogService.java

@@ -0,0 +1,63 @@
+package com.fs.system.service;
+
+import java.util.List;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.fs.system.domain.SysDeptConfigLog;
+
+/**
+ * 系统部门资源配置使用记录Service接口
+ * 
+ * @author fs
+ * @date 2025-09-22
+ */
+public interface ISysDeptConfigLogService extends IService<SysDeptConfigLog>{
+    /**
+     * 查询系统部门资源配置使用记录
+     * 
+     * @param id 系统部门资源配置使用记录主键
+     * @return 系统部门资源配置使用记录
+     */
+    SysDeptConfigLog selectSysDeptConfigLogById(Long id);
+
+    /**
+     * 查询系统部门资源配置使用记录列表
+     * 
+     * @param sysDeptConfigLog 系统部门资源配置使用记录
+     * @return 系统部门资源配置使用记录集合
+     */
+    List<SysDeptConfigLog> selectSysDeptConfigLogList(SysDeptConfigLog sysDeptConfigLog);
+
+    /**
+     * 新增系统部门资源配置使用记录
+     * 
+     * @param sysDeptConfigLog 系统部门资源配置使用记录
+     * @return 结果
+     */
+    int insertSysDeptConfigLog(SysDeptConfigLog sysDeptConfigLog);
+
+    /**
+     * 修改系统部门资源配置使用记录
+     * 
+     * @param sysDeptConfigLog 系统部门资源配置使用记录
+     * @return 结果
+     */
+    int updateSysDeptConfigLog(SysDeptConfigLog sysDeptConfigLog);
+
+    /**
+     * 批量删除系统部门资源配置使用记录
+     * 
+     * @param ids 需要删除的系统部门资源配置使用记录主键集合
+     * @return 结果
+     */
+    int deleteSysDeptConfigLogByIds(Long[] ids);
+
+    /**
+     * 删除系统部门资源配置使用记录信息
+     * 
+     * @param id 系统部门资源配置使用记录主键
+     * @return 结果
+     */
+    int deleteSysDeptConfigLogById(Long id);
+
+    void addLog(Long deptId, Integer logType, Integer operateType, String num, String firstNum, String lastNum, String username, String s);
+}

+ 70 - 0
fs-service/src/main/java/com/fs/system/service/ISysDeptConfigService.java

@@ -0,0 +1,70 @@
+package com.fs.system.service;
+
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.util.List;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.fs.common.core.domain.model.LoginUser;
+import com.fs.system.domain.SysDeptConfig;
+
+/**
+ * 部门配置Service接口
+ * 
+ * @author fs
+ * @date 2025-09-22
+ */
+public interface ISysDeptConfigService extends IService<SysDeptConfig>{
+    /**
+     * 查询部门配置
+     * 
+     * @param id 部门配置主键
+     * @return 部门配置
+     */
+    SysDeptConfig selectSysDeptConfigById(Long id);
+
+    /**
+     * 查询部门配置列表
+     * 
+     * @param sysDeptConfig 部门配置
+     * @return 部门配置集合
+     */
+    List<SysDeptConfig> selectSysDeptConfigList(SysDeptConfig sysDeptConfig);
+
+    /**
+     * 新增部门配置
+     * 
+     * @param sysDeptConfig 部门配置
+     * @return 结果
+     */
+    int insertSysDeptConfig(SysDeptConfig sysDeptConfig);
+
+    /**
+     * 修改部门配置
+     * 
+     * @param sysDeptConfig 部门配置
+     * @return 结果
+     */
+    int updateSysDeptConfig(SysDeptConfig sysDeptConfig);
+
+    /**
+     * 批量删除部门配置
+     * 
+     * @param ids 需要删除的部门配置主键集合
+     * @return 结果
+     */
+    int deleteSysDeptConfigByIds(Long[] ids);
+
+    /**
+     * 删除部门配置信息
+     * 
+     * @param id 部门配置主键
+     * @return 结果
+     */
+    int deleteSysDeptConfigById(Long id);
+
+    void updatePadNum(Long deptId, Integer num, LoginUser loginUser, LocalDate endTime);
+
+    void addRedMoney(Long deptId, BigDecimal num, LoginUser loginUser);
+
+    void addFlowNum(Long deptId, BigDecimal money, LoginUser loginUser);
+}

+ 109 - 0
fs-service/src/main/java/com/fs/system/service/impl/SysDeptConfigLogServiceImpl.java

@@ -0,0 +1,109 @@
+package com.fs.system.service.impl;
+
+import java.util.Date;
+import java.util.List;
+import com.fs.common.utils.DateUtils;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+import com.fs.system.mapper.SysDeptConfigLogMapper;
+import com.fs.system.domain.SysDeptConfigLog;
+import com.fs.system.service.ISysDeptConfigLogService;
+
+/**
+ * 系统部门资源配置使用记录Service业务层处理
+ * 
+ * @author fs
+ * @date 2025-09-22
+ */
+@Service
+public class SysDeptConfigLogServiceImpl extends ServiceImpl<SysDeptConfigLogMapper, SysDeptConfigLog> implements ISysDeptConfigLogService {
+
+    /**
+     * 查询系统部门资源配置使用记录
+     * 
+     * @param id 系统部门资源配置使用记录主键
+     * @return 系统部门资源配置使用记录
+     */
+    @Override
+    public SysDeptConfigLog selectSysDeptConfigLogById(Long id)
+    {
+        return baseMapper.selectSysDeptConfigLogById(id);
+    }
+
+    /**
+     * 查询系统部门资源配置使用记录列表
+     * 
+     * @param sysDeptConfigLog 系统部门资源配置使用记录
+     * @return 系统部门资源配置使用记录
+     */
+    @Override
+    public List<SysDeptConfigLog> selectSysDeptConfigLogList(SysDeptConfigLog sysDeptConfigLog)
+    {
+        return baseMapper.selectSysDeptConfigLogList(sysDeptConfigLog);
+    }
+
+    /**
+     * 新增系统部门资源配置使用记录
+     * 
+     * @param sysDeptConfigLog 系统部门资源配置使用记录
+     * @return 结果
+     */
+    @Override
+    public int insertSysDeptConfigLog(SysDeptConfigLog sysDeptConfigLog)
+    {
+        sysDeptConfigLog.setCreateTime(DateUtils.getNowDate());
+        return baseMapper.insertSysDeptConfigLog(sysDeptConfigLog);
+    }
+
+    /**
+     * 修改系统部门资源配置使用记录
+     * 
+     * @param sysDeptConfigLog 系统部门资源配置使用记录
+     * @return 结果
+     */
+    @Override
+    public int updateSysDeptConfigLog(SysDeptConfigLog sysDeptConfigLog)
+    {
+        sysDeptConfigLog.setUpdateTime(DateUtils.getNowDate());
+        return baseMapper.updateSysDeptConfigLog(sysDeptConfigLog);
+    }
+
+    /**
+     * 批量删除系统部门资源配置使用记录
+     * 
+     * @param ids 需要删除的系统部门资源配置使用记录主键
+     * @return 结果
+     */
+    @Override
+    public int deleteSysDeptConfigLogByIds(Long[] ids)
+    {
+        return baseMapper.deleteSysDeptConfigLogByIds(ids);
+    }
+
+    /**
+     * 删除系统部门资源配置使用记录信息
+     * 
+     * @param id 系统部门资源配置使用记录主键
+     * @return 结果
+     */
+    @Override
+    public int deleteSysDeptConfigLogById(Long id)
+    {
+        return baseMapper.deleteSysDeptConfigLogById(id);
+    }
+
+    @Override
+    public void addLog(Long deptId, Integer logType, Integer operateType, String num, String firstNum, String lastNum, String username, String remark) {
+        SysDeptConfigLog log = new SysDeptConfigLog();
+        log.setDeptId(deptId);
+        log.setLogType(logType);
+        log.setOperateType(operateType);
+        log.setNum(num);
+        log.setFirstNum(firstNum);
+        log.setLastNum(lastNum);
+        log.setCreateBy(username);
+        log.setCreateTime(new Date());
+        log.setRemark(remark);
+        save(log);
+    }
+}

+ 158 - 0
fs-service/src/main/java/com/fs/system/service/impl/SysDeptConfigServiceImpl.java

@@ -0,0 +1,158 @@
+package com.fs.system.service.impl;
+
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.time.LocalDate;
+import java.util.Date;
+import java.util.List;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.fs.common.core.domain.model.LoginUser;
+import com.fs.common.utils.DateUtils;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fs.company.service.ICompanyTrafficRecordService;
+import com.fs.system.service.ISysDeptConfigLogService;
+import lombok.AllArgsConstructor;
+import org.springframework.stereotype.Service;
+import com.fs.system.mapper.SysDeptConfigMapper;
+import com.fs.system.domain.SysDeptConfig;
+import com.fs.system.service.ISysDeptConfigService;
+
+/**
+ * 部门配置Service业务层处理
+ * 
+ * @author fs
+ * @date 2025-09-22
+ */
+@Service
+@AllArgsConstructor
+public class SysDeptConfigServiceImpl extends ServiceImpl<SysDeptConfigMapper, SysDeptConfig> implements ISysDeptConfigService {
+
+
+    private final ISysDeptConfigLogService sysDeptConfigLogService;
+    private final ICompanyTrafficRecordService companyTrafficRecordService;
+
+    /**
+     * 查询部门配置
+     * 
+     * @param id 部门配置主键
+     * @return 部门配置
+     */
+    @Override
+    public SysDeptConfig selectSysDeptConfigById(Long id)
+    {
+        return baseMapper.selectSysDeptConfigById(id);
+    }
+
+    /**
+     * 查询部门配置列表
+     * 
+     * @param sysDeptConfig 部门配置
+     * @return 部门配置
+     */
+    @Override
+    public List<SysDeptConfig> selectSysDeptConfigList(SysDeptConfig sysDeptConfig)
+    {
+        return baseMapper.selectSysDeptConfigList(sysDeptConfig);
+    }
+
+    /**
+     * 新增部门配置
+     * 
+     * @param sysDeptConfig 部门配置
+     * @return 结果
+     */
+    @Override
+    public int insertSysDeptConfig(SysDeptConfig sysDeptConfig)
+    {
+        sysDeptConfig.setCreateTime(DateUtils.getNowDate());
+        return baseMapper.insertSysDeptConfig(sysDeptConfig);
+    }
+
+    /**
+     * 修改部门配置
+     * 
+     * @param sysDeptConfig 部门配置
+     * @return 结果
+     */
+    @Override
+    public int updateSysDeptConfig(SysDeptConfig sysDeptConfig)
+    {
+        sysDeptConfig.setUpdateTime(DateUtils.getNowDate());
+        return baseMapper.updateSysDeptConfig(sysDeptConfig);
+    }
+
+    /**
+     * 批量删除部门配置
+     * 
+     * @param ids 需要删除的部门配置主键
+     * @return 结果
+     */
+    @Override
+    public int deleteSysDeptConfigByIds(Long[] ids)
+    {
+        return baseMapper.deleteSysDeptConfigByIds(ids);
+    }
+    /**
+     * 删除部门配置信息
+     * 
+     * @param id 部门配置主键
+     * @return 结果
+     */
+    @Override
+    public int deleteSysDeptConfigById(Long id)
+    {
+        return baseMapper.deleteSysDeptConfigById(id);
+    }
+
+    @Override
+    public void updatePadNum(Long deptId, Integer num, LoginUser loginUser, LocalDate endTime) {
+        SysDeptConfig deptConfig = getDeptConfig(deptId, loginUser);
+        deptConfig.setUpdateBy(loginUser.getUsername());
+        deptConfig.setUpdateTime(new Date());
+        Long padNum = deptConfig.getPadNum() == null ? 0L : deptConfig.getPadNum();
+        deptConfig.setPadNum(num.longValue());
+        long n = num - padNum;
+        deptConfig.setPadNumSub((deptConfig.getPadNumSub() == null ? 0L : deptConfig.getPadNumSub()) + n);
+        deptConfig.setPadTime(endTime);
+        sysDeptConfigLogService.addLog(deptId, 2, n >= 0 ? 0 : 1, num.toString(), padNum.toString(), deptConfig.getPadNum().toString(), loginUser.getUsername(), "");
+        updateById(deptConfig);
+    }
+
+    @Override
+    public void addRedMoney(Long deptId, BigDecimal num, LoginUser loginUser) {
+        SysDeptConfig deptConfig = getDeptConfig(deptId, loginUser);
+        deptConfig.setUpdateBy(loginUser.getUsername());
+        deptConfig.setUpdateTime(new Date());
+        BigDecimal red = deptConfig.getRedPackage() == null ? BigDecimal.ZERO : deptConfig.getRedPackage();
+        deptConfig.setRedPackage(red.add(num));
+        sysDeptConfigLogService.addLog(deptId, 0, 0, num.setScale(2, RoundingMode.UP).toString(), red.setScale(2, RoundingMode.UP).toString(), deptConfig.getRedPackage().setScale(2, RoundingMode.UP).toString(), loginUser.getUsername(), "");
+        updateById(deptConfig);
+
+    }
+
+    @Override
+    public void addFlowNum(Long deptId, BigDecimal money, LoginUser loginUser) {
+        SysDeptConfig deptConfig = getDeptConfig(deptId, loginUser);
+        deptConfig.setUpdateBy(loginUser.getUsername());
+        deptConfig.setUpdateTime(new Date());
+        Long l = companyTrafficRecordService.trafficConversion(money.longValue());
+        long flowNum = deptConfig.getFlowNum() == null ? 0 : deptConfig.getFlowNum();
+        deptConfig.setFlowNum(flowNum + l);
+        sysDeptConfigLogService.addLog(deptId, 1, 0, l.toString(), flowNum + "", deptConfig.getFlowNum().toString(), loginUser.getUsername(), "");
+        updateById(deptConfig);
+
+    }
+
+    private SysDeptConfig getDeptConfig(Long deptId, LoginUser loginUser){
+        SysDeptConfig one = getOne(new QueryWrapper<SysDeptConfig>().eq("dept_id", deptId));
+        if(one == null){
+            one = new SysDeptConfig();
+            one.setDeptId(deptId);
+            one.setCreateBy(loginUser.getUsername());
+            one.setCreateTime(new Date());
+            save(one);
+        }
+        return one;
+    }
+}

+ 67 - 89
fs-service/src/main/java/com/fs/system/service/impl/SysDeptServiceImpl.java

@@ -3,7 +3,14 @@ package com.fs.system.service.impl;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
 import java.util.stream.Collectors;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.fs.common.utils.PubFun;
+import com.fs.system.domain.SysDeptConfig;
+import com.fs.system.mapper.SysDeptConfigMapper;
+import com.fs.system.service.ISysDeptConfigService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.fs.common.annotation.DataScope;
@@ -23,58 +30,57 @@ import com.fs.system.service.ISysDeptService;
 
 /**
  * 部门管理 服务实现
- * 
-
+ *
  */
 @Service
-public class SysDeptServiceImpl implements ISysDeptService
-{
+public class SysDeptServiceImpl implements ISysDeptService {
     @Autowired
     private SysDeptMapper deptMapper;
 
     @Autowired
     private SysRoleMapper roleMapper;
 
+    @Autowired
+    private SysDeptConfigMapper sysDeptConfigMapper;
+
     /**
      * 查询部门管理数据
-     * 
+     *
      * @param dept 部门信息
      * @return 部门信息集合
      */
     @Override
     @DataScope(deptAlias = "d")
-    public List<SysDept> selectDeptList(SysDept dept)
-    {
-        return deptMapper.selectDeptList(dept);
+    public List<SysDept> selectDeptList(SysDept dept) {
+        List<SysDept> list = deptMapper.selectDeptList(dept);
+        List<SysDeptConfig> configList = sysDeptConfigMapper.selectList(new QueryWrapper<SysDeptConfig>().in("dept_id", PubFun.listToNewList(list, SysDept::getDeptId)));
+        Map<Long, SysDeptConfig> deptConfig = PubFun.listToMapByGroupObject(configList, SysDeptConfig::getDeptId);
+        list.stream().filter(e -> deptConfig.containsKey(e.getDeptId())).forEach(e -> e.setDeptConfig(deptConfig.get(e.getDeptId())));
+        return list;
     }
 
     /**
      * 构建前端所需要树结构
-     * 
+     *
      * @param depts 部门列表
      * @return 树结构列表
      */
     @Override
-    public List<SysDept> buildDeptTree(List<SysDept> depts)
-    {
+    public List<SysDept> buildDeptTree(List<SysDept> depts) {
         List<SysDept> returnList = new ArrayList<SysDept>();
         List<Long> tempList = new ArrayList<Long>();
-        for (SysDept dept : depts)
-        {
+        for (SysDept dept : depts) {
             tempList.add(dept.getDeptId());
         }
-        for (Iterator<SysDept> iterator = depts.iterator(); iterator.hasNext();)
-        {
+        for (Iterator<SysDept> iterator = depts.iterator(); iterator.hasNext(); ) {
             SysDept dept = (SysDept) iterator.next();
             // 如果是顶级节点, 遍历该父节点的所有子节点
-            if (!tempList.contains(dept.getParentId()))
-            {
+            if (!tempList.contains(dept.getParentId())) {
                 recursionFn(depts, dept);
                 returnList.add(dept);
             }
         }
-        if (returnList.isEmpty())
-        {
+        if (returnList.isEmpty()) {
             returnList = depts;
         }
         return returnList;
@@ -82,93 +88,85 @@ public class SysDeptServiceImpl implements ISysDeptService
 
     /**
      * 构建前端所需要下拉树结构
-     * 
+     *
      * @param depts 部门列表
      * @return 下拉树结构列表
      */
     @Override
-    public List<TreeSelect> buildDeptTreeSelect(List<SysDept> depts)
-    {
+    public List<TreeSelect> buildDeptTreeSelect(List<SysDept> depts) {
         List<SysDept> deptTrees = buildDeptTree(depts);
         return deptTrees.stream().map(TreeSelect::new).collect(Collectors.toList());
     }
 
     /**
      * 根据角色ID查询部门树信息
-     * 
+     *
      * @param roleId 角色ID
      * @return 选中部门列表
      */
     @Override
-    public List<Integer> selectDeptListByRoleId(Long roleId)
-    {
+    public List<Integer> selectDeptListByRoleId(Long roleId) {
         SysRole role = roleMapper.selectRoleById(roleId);
         return deptMapper.selectDeptListByRoleId(roleId, role.isDeptCheckStrictly());
     }
 
     /**
      * 根据部门ID查询信息
-     * 
+     *
      * @param deptId 部门ID
      * @return 部门信息
      */
     @Override
-    public SysDept selectDeptById(Long deptId)
-    {
+    public SysDept selectDeptById(Long deptId) {
         return deptMapper.selectDeptById(deptId);
     }
 
     /**
      * 根据ID查询所有子部门(正常状态)
-     * 
+     *
      * @param deptId 部门ID
      * @return 子部门数
      */
     @Override
-    public int selectNormalChildrenDeptById(Long deptId)
-    {
+    public int selectNormalChildrenDeptById(Long deptId) {
         return deptMapper.selectNormalChildrenDeptById(deptId);
     }
 
     /**
      * 是否存在子节点
-     * 
+     *
      * @param deptId 部门ID
      * @return 结果
      */
     @Override
-    public boolean hasChildByDeptId(Long deptId)
-    {
+    public boolean hasChildByDeptId(Long deptId) {
         int result = deptMapper.hasChildByDeptId(deptId);
         return result > 0 ? true : false;
     }
 
     /**
      * 查询部门是否存在用户
-     * 
+     *
      * @param deptId 部门ID
      * @return 结果 true 存在 false 不存在
      */
     @Override
-    public boolean checkDeptExistUser(Long deptId)
-    {
+    public boolean checkDeptExistUser(Long deptId) {
         int result = deptMapper.checkDeptExistUser(deptId);
         return result > 0 ? true : false;
     }
 
     /**
      * 校验部门名称是否唯一
-     * 
+     *
      * @param dept 部门信息
      * @return 结果
      */
     @Override
-    public String checkDeptNameUnique(SysDept dept)
-    {
+    public String checkDeptNameUnique(SysDept dept) {
         Long deptId = StringUtils.isNull(dept.getDeptId()) ? -1L : dept.getDeptId();
         SysDept info = deptMapper.checkDeptNameUnique(dept.getDeptName(), dept.getParentId());
-        if (StringUtils.isNotNull(info) && info.getDeptId().longValue() != deptId.longValue())
-        {
+        if (StringUtils.isNotNull(info) && info.getDeptId().longValue() != deptId.longValue()) {
             return UserConstants.NOT_UNIQUE;
         }
         return UserConstants.UNIQUE;
@@ -176,19 +174,16 @@ public class SysDeptServiceImpl implements ISysDeptService
 
     /**
      * 校验部门是否有数据权限
-     * 
+     *
      * @param deptId 部门id
      */
     @Override
-    public void checkDeptDataScope(Long deptId)
-    {
-        if (!SysUser.isAdmin(SecurityUtils.getUserId()))
-        {
+    public void checkDeptDataScope(Long deptId) {
+        if (!SysUser.isAdmin(SecurityUtils.getUserId())) {
             SysDept dept = new SysDept();
             dept.setDeptId(deptId);
             List<SysDept> depts = SpringUtils.getAopProxy(this).selectDeptList(dept);
-            if (StringUtils.isEmpty(depts))
-            {
+            if (StringUtils.isEmpty(depts)) {
                 throw new ServiceException("没有权限访问部门数据!");
             }
         }
@@ -196,17 +191,15 @@ public class SysDeptServiceImpl implements ISysDeptService
 
     /**
      * 新增保存部门信息
-     * 
+     *
      * @param dept 部门信息
      * @return 结果
      */
     @Override
-    public int insertDept(SysDept dept)
-    {
+    public int insertDept(SysDept dept) {
         SysDept info = deptMapper.selectDeptById(dept.getParentId());
         // 如果父节点不为正常状态,则不允许新增子节点
-        if (!UserConstants.DEPT_NORMAL.equals(info.getStatus()))
-        {
+        if (!UserConstants.DEPT_NORMAL.equals(info.getStatus())) {
             throw new ServiceException("部门停用,不允许新增");
         }
         dept.setAncestors(info.getAncestors() + "," + dept.getParentId());
@@ -215,17 +208,15 @@ public class SysDeptServiceImpl implements ISysDeptService
 
     /**
      * 修改保存部门信息
-     * 
+     *
      * @param dept 部门信息
      * @return 结果
      */
     @Override
-    public int updateDept(SysDept dept)
-    {
+    public int updateDept(SysDept dept) {
         SysDept newParentDept = deptMapper.selectDeptById(dept.getParentId());
         SysDept oldDept = deptMapper.selectDeptById(dept.getDeptId());
-        if (StringUtils.isNotNull(newParentDept) && StringUtils.isNotNull(oldDept))
-        {
+        if (StringUtils.isNotNull(newParentDept) && StringUtils.isNotNull(oldDept)) {
             String newAncestors = newParentDept.getAncestors() + "," + newParentDept.getDeptId();
             String oldAncestors = oldDept.getAncestors();
             dept.setAncestors(newAncestors);
@@ -233,8 +224,7 @@ public class SysDeptServiceImpl implements ISysDeptService
         }
         int result = deptMapper.updateDept(dept);
         if (UserConstants.DEPT_NORMAL.equals(dept.getStatus()) && StringUtils.isNotEmpty(dept.getAncestors())
-                && !StringUtils.equals("0", dept.getAncestors()))
-        {
+                && !StringUtils.equals("0", dept.getAncestors())) {
             // 如果该部门是启用状态,则启用该部门的所有上级部门
             updateParentDeptStatusNormal(dept);
         }
@@ -243,11 +233,10 @@ public class SysDeptServiceImpl implements ISysDeptService
 
     /**
      * 修改该部门的父级部门状态
-     * 
+     *
      * @param dept 当前部门
      */
-    private void updateParentDeptStatusNormal(SysDept dept)
-    {
+    private void updateParentDeptStatusNormal(SysDept dept) {
         String ancestors = dept.getAncestors();
         Long[] deptIds = Convert.toLongArray(ancestors);
         deptMapper.updateDeptStatusNormal(deptIds);
@@ -255,48 +244,41 @@ public class SysDeptServiceImpl implements ISysDeptService
 
     /**
      * 修改子元素关系
-     * 
-     * @param deptId 被修改的部门ID
+     *
+     * @param deptId       被修改的部门ID
      * @param newAncestors 新的父ID集合
      * @param oldAncestors 旧的父ID集合
      */
-    public void updateDeptChildren(Long deptId, String newAncestors, String oldAncestors)
-    {
+    public void updateDeptChildren(Long deptId, String newAncestors, String oldAncestors) {
         List<SysDept> children = deptMapper.selectChildrenDeptById(deptId);
-        for (SysDept child : children)
-        {
+        for (SysDept child : children) {
             child.setAncestors(child.getAncestors().replaceFirst(oldAncestors, newAncestors));
         }
-        if (children.size() > 0)
-        {
+        if (children.size() > 0) {
             deptMapper.updateDeptChildren(children);
         }
     }
 
     /**
      * 删除部门管理信息
-     * 
+     *
      * @param deptId 部门ID
      * @return 结果
      */
     @Override
-    public int deleteDeptById(Long deptId)
-    {
+    public int deleteDeptById(Long deptId) {
         return deptMapper.deleteDeptById(deptId);
     }
 
     /**
      * 递归列表
      */
-    private void recursionFn(List<SysDept> list, SysDept t)
-    {
+    private void recursionFn(List<SysDept> list, SysDept t) {
         // 得到子节点列表
         List<SysDept> childList = getChildList(list, t);
         t.setChildren(childList);
-        for (SysDept tChild : childList)
-        {
-            if (hasChild(list, tChild))
-            {
+        for (SysDept tChild : childList) {
+            if (hasChild(list, tChild)) {
                 recursionFn(list, tChild);
             }
         }
@@ -305,15 +287,12 @@ public class SysDeptServiceImpl implements ISysDeptService
     /**
      * 得到子节点列表
      */
-    private List<SysDept> getChildList(List<SysDept> list, SysDept t)
-    {
+    private List<SysDept> getChildList(List<SysDept> list, SysDept t) {
         List<SysDept> tlist = new ArrayList<SysDept>();
         Iterator<SysDept> it = list.iterator();
-        while (it.hasNext())
-        {
+        while (it.hasNext()) {
             SysDept n = (SysDept) it.next();
-            if (StringUtils.isNotNull(n.getParentId()) && n.getParentId().longValue() == t.getDeptId().longValue())
-            {
+            if (StringUtils.isNotNull(n.getParentId()) && n.getParentId().longValue() == t.getDeptId().longValue()) {
                 tlist.add(n);
             }
         }
@@ -323,8 +302,7 @@ public class SysDeptServiceImpl implements ISysDeptService
     /**
      * 判断是否有子节点
      */
-    private boolean hasChild(List<SysDept> list, SysDept t)
-    {
+    private boolean hasChild(List<SysDept> list, SysDept t) {
         return getChildList(list, t).size() > 0 ? true : false;
     }
 }

+ 101 - 0
fs-service/src/main/resources/mapper/deptConfig/SysDeptConfigMapper.xml

@@ -0,0 +1,101 @@
+<?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.fs.system.mapper.SysDeptConfigMapper">
+    
+    <resultMap type="SysDeptConfig" id="SysDeptConfigResult">
+        <result property="id"    column="id"    />
+        <result property="deptId"    column="dept_id"    />
+        <result property="padNum"    column="pad_num"    />
+        <result property="padNumSub"    column="pad_num_sub"    />
+        <result property="padTime"    column="pad_time"    />
+        <result property="redPackage"    column="red_package"    />
+        <result property="flowNum"    column="flow_num"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="createBy"    column="create_by"    />
+        <result property="updateTime"    column="update_time"    />
+        <result property="updateBy"    column="update_by"    />
+        <result property="remark"    column="remark"    />
+    </resultMap>
+
+    <sql id="selectSysDeptConfigVo">
+        select id, dept_id, pad_num, pad_num_sub, pad_time, red_package, flow_num, create_time, create_by, update_time, update_by, remark from sys_dept_config
+    </sql>
+
+    <select id="selectSysDeptConfigList" parameterType="SysDeptConfig" resultMap="SysDeptConfigResult">
+        <include refid="selectSysDeptConfigVo"/>
+        <where>  
+            <if test="deptId != null "> and dept_id = #{deptId}</if>
+            <if test="padNum != null "> and pad_num = #{padNum}</if>
+            <if test="padNumSub != null "> and pad_num_sub = #{padNumSub}</if>
+            <if test="padTime != null "> and pad_time = #{padTime}</if>
+            <if test="redPackage != null "> and red_package = #{redPackage}</if>
+            <if test="flowNum != null "> and flow_num = #{flowNum}</if>
+        </where>
+    </select>
+    
+    <select id="selectSysDeptConfigById" parameterType="Long" resultMap="SysDeptConfigResult">
+        <include refid="selectSysDeptConfigVo"/>
+        where id = #{id}
+    </select>
+        
+    <insert id="insertSysDeptConfig" parameterType="SysDeptConfig" useGeneratedKeys="true" keyProperty="id">
+        insert into sys_dept_config
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="deptId != null">dept_id,</if>
+            <if test="padNum != null">pad_num,</if>
+            <if test="padNumSub != null">pad_num_sub,</if>
+            <if test="padTime != null">pad_time,</if>
+            <if test="redPackage != null">red_package,</if>
+            <if test="flowNum != null">flow_num,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="createBy != null">create_by,</if>
+            <if test="updateTime != null">update_time,</if>
+            <if test="updateBy != null">update_by,</if>
+            <if test="remark != null">remark,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="deptId != null">#{deptId},</if>
+            <if test="padNum != null">#{padNum},</if>
+            <if test="padNumSub != null">#{padNumSub},</if>
+            <if test="padTime != null">#{padTime},</if>
+            <if test="redPackage != null">#{redPackage},</if>
+            <if test="flowNum != null">#{flowNum},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="createBy != null">#{createBy},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+            <if test="updateBy != null">#{updateBy},</if>
+            <if test="remark != null">#{remark},</if>
+         </trim>
+    </insert>
+
+    <update id="updateSysDeptConfig" parameterType="SysDeptConfig">
+        update sys_dept_config
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="deptId != null">dept_id = #{deptId},</if>
+            <if test="padNum != null">pad_num = #{padNum},</if>
+            <if test="padNumSub != null">pad_num_sub = #{padNumSub},</if>
+            <if test="padTime != null">pad_time = #{padTime},</if>
+            <if test="redPackage != null">red_package = #{redPackage},</if>
+            <if test="flowNum != null">flow_num = #{flowNum},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="createBy != null">create_by = #{createBy},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+            <if test="updateBy != null">update_by = #{updateBy},</if>
+            <if test="remark != null">remark = #{remark},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteSysDeptConfigById" parameterType="Long">
+        delete from sys_dept_config where id = #{id}
+    </delete>
+
+    <delete id="deleteSysDeptConfigByIds" parameterType="String">
+        delete from sys_dept_config where id in 
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>

+ 101 - 0
fs-service/src/main/resources/mapper/deptConfigLog/SysDeptConfigLogMapper.xml

@@ -0,0 +1,101 @@
+<?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.fs.system.mapper.SysDeptConfigLogMapper">
+    
+    <resultMap type="SysDeptConfigLog" id="SysDeptConfigLogResult">
+        <result property="id"    column="id"    />
+        <result property="deptId"    column="dept_id"    />
+        <result property="logType"    column="log_type"    />
+        <result property="operateType"    column="operate_type"    />
+        <result property="num"    column="num"    />
+        <result property="firstNum"    column="first_num"    />
+        <result property="lastNum"    column="last_num"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="createBy"    column="create_by"    />
+        <result property="updateTime"    column="update_time"    />
+        <result property="updateBy"    column="update_by"    />
+        <result property="remark"    column="remark"    />
+    </resultMap>
+
+    <sql id="selectSysDeptConfigLogVo">
+        select id, dept_id, log_type, operate_type, num, first_num, last_num, create_time, create_by, update_time, update_by, remark from sys_dept_config_log
+    </sql>
+
+    <select id="selectSysDeptConfigLogList" parameterType="SysDeptConfigLog" resultMap="SysDeptConfigLogResult">
+        <include refid="selectSysDeptConfigLogVo"/>
+        <where>  
+            <if test="deptId != null "> and dept_id = #{deptId}</if>
+            <if test="logType != null "> and log_type = #{logType}</if>
+            <if test="operateType != null "> and operate_type = #{operateType}</if>
+            <if test="num != null "> and num = #{num}</if>
+            <if test="firstNum != null "> and first_num = #{firstNum}</if>
+            <if test="lastNum != null "> and last_num = #{lastNum}</if>
+        </where>
+    </select>
+    
+    <select id="selectSysDeptConfigLogById" parameterType="Long" resultMap="SysDeptConfigLogResult">
+        <include refid="selectSysDeptConfigLogVo"/>
+        where id = #{id}
+    </select>
+        
+    <insert id="insertSysDeptConfigLog" parameterType="SysDeptConfigLog" useGeneratedKeys="true" keyProperty="id">
+        insert into sys_dept_config_log
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="deptId != null">dept_id,</if>
+            <if test="logType != null">log_type,</if>
+            <if test="operateType != null">operate_type,</if>
+            <if test="num != null">num,</if>
+            <if test="firstNum != null">first_num,</if>
+            <if test="lastNum != null">last_num,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="createBy != null">create_by,</if>
+            <if test="updateTime != null">update_time,</if>
+            <if test="updateBy != null">update_by,</if>
+            <if test="remark != null">remark,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="deptId != null">#{deptId},</if>
+            <if test="logType != null">#{logType},</if>
+            <if test="operateType != null">#{operateType},</if>
+            <if test="num != null">#{num},</if>
+            <if test="firstNum != null">#{firstNum},</if>
+            <if test="lastNum != null">#{lastNum},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="createBy != null">#{createBy},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+            <if test="updateBy != null">#{updateBy},</if>
+            <if test="remark != null">#{remark},</if>
+         </trim>
+    </insert>
+
+    <update id="updateSysDeptConfigLog" parameterType="SysDeptConfigLog">
+        update sys_dept_config_log
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="deptId != null">dept_id = #{deptId},</if>
+            <if test="logType != null">log_type = #{logType},</if>
+            <if test="operateType != null">operate_type = #{operateType},</if>
+            <if test="num != null">num = #{num},</if>
+            <if test="firstNum != null">first_num = #{firstNum},</if>
+            <if test="lastNum != null">last_num = #{lastNum},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="createBy != null">create_by = #{createBy},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+            <if test="updateBy != null">update_by = #{updateBy},</if>
+            <if test="remark != null">remark = #{remark},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteSysDeptConfigLogById" parameterType="Long">
+        delete from sys_dept_config_log where id = #{id}
+    </delete>
+
+    <delete id="deleteSysDeptConfigLogByIds" parameterType="String">
+        delete from sys_dept_config_log where id in 
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>

+ 3 - 1
fs-service/src/main/resources/mapper/sop/SopUserLogsMapper.xml

@@ -246,7 +246,9 @@
             ul.`status` = '1'
           and qs.is_rating=1
           and qs.type=2
-          and qs.send_type=2
+        <if test="isAllratingRating == null || !isAllratingRating">
+            and qs.send_type=2
+        </if>
           and qs.`status` in (2,3)
           AND ( DATEDIFF( CURRENT_DATE, ul.start_time ) ) >= 7
         ORDER BY id ASC