Bläddra i källkod

系统基础设置中增加关闭日报填报和禁止非工作日填报的功能

seyason 1 år sedan
förälder
incheckning
ac399df52e

+ 23 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/ReportController.java

@@ -316,6 +316,12 @@ public class ReportController {
         String token = request.getHeader("Token");
         User user = userService.getById(token);
         Company company = companyService.getById(user.getCompanyId());
+        TimeType comTimeType = timeTypeMapper.selectById(user.getCompanyId());
+        if (comTimeType.getStopReport() == 1) {
+            HttpRespMsg msg = new HttpRespMsg();
+            msg.setError("系统已关闭日报填写功能,请联系管理员");
+            return msg;
+        }
         //检查当前人员账号是否停用
         if (user.getIsActive() == 0) {
             HttpRespMsg msg = new HttpRespMsg();
@@ -442,7 +448,7 @@ public class ReportController {
         //检查项目是否可填报; 修改为不校验项目,前端加载的项目已经过滤掉了完成和撤销的
         List<Integer> integers = Arrays.asList(projectId);
         List<Project> projectList = projectMapper.selectList(new QueryWrapper<Project>().in("id", integers));
-        TimeType comTimeType = timeTypeMapper.selectById(user.getCompanyId());
+
         //HARDCODE: 成都明夷电子,需要根据考勤重新计算每日工作时长;
 //        if (company.getCompanyName().equals("成都明夷电子科技有限公司")) {
 //            if (createDate.length > 0) {
@@ -1389,6 +1395,22 @@ public class ReportController {
         reportList.forEach(r->{
             r.setCreateTime(LocalDateTime.now());
         });
+        if (comTimeType.getNotAllowedOnNonWorkday() == 1) {
+            //勾选了非工作日禁止填报,需要校验日期
+            List<LocalDate> dateCollects = reportList.stream().map(Report::getCreateDate).distinct().collect(Collectors.toList());
+            StringBuilder stringBuilder = new StringBuilder();
+            dateCollects.forEach(d->{
+                if (!WorkDayCalculateUtils.isWorkDay(d)) {
+                    stringBuilder.append(dtf.format(d)).append(",");
+                }
+            });
+            if (stringBuilder.length() > 0) {
+                stringBuilder.deleteCharAt(stringBuilder.length()-1);
+                HttpRespMsg msg = new HttpRespMsg();
+                msg.setError("非工作日禁止填报: "+ stringBuilder.toString());
+                return msg;
+            }
+        }
 
         HttpRespMsg httpRespMsg = reportService.editReport(reportList, createDate.length > 0 ? createDate[0] : null, targetUserList, hourCost, user.getCompanyId());
         //【上海绎维】、【火石演示】、【博通容合】使用

+ 13 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/TimeType.java

@@ -17,7 +17,7 @@ import lombok.experimental.Accessors;
  * </p>
  *
  * @author Seyason
- * @since 2023-06-27
+ * @since 2023-08-16
  */
 @Data
 @EqualsAndHashCode(callSuper = false)
@@ -480,6 +480,18 @@ public class TimeType extends Model<TimeType> {
     @TableField("report_cc")
     private Integer reportCc;
 
+    /**
+     * 非工作日是否禁止填报
+     */
+    @TableField("not_allowed_on_non_workday")
+    private Integer notAllowedOnNonWorkday;
+
+    /**
+     * 关闭工时填报
+     */
+    @TableField("stop_report")
+    private Integer stopReport;
+
 
     @Override
     protected Serializable pkVal() {

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 3 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/TimeTypeMapper.xml


+ 10 - 1
fhKeeper/formulahousekeeper/timesheet/src/views/settings/timetype.vue

@@ -270,7 +270,7 @@
                     </el-form-item>
                 </div>
                 <el-form-item>
-                    <el-checkbox v-model="timeType.includeWeekends" label="批量/代填含周末" />
+                    <el-checkbox v-model="timeType.stopReport" label="关闭日报填报功能" />  <el-checkbox  v-model="timeType.notAllowedOnNonWorkday" label="非工作日(含周末为法定工作日)禁止填报" @change="onNonWorkDaySet()"/> <el-checkbox :disabled="timeType.notAllowedOnNonWorkday" v-model="timeType.includeWeekends" label="批量/代填含周末" />
                 </el-form-item><br/>
                 <el-form-item :label="$t('filltime')" prop="fillMonths">
                     <el-select v-model="timeType.fillMonths" >
@@ -732,6 +732,11 @@
             }, 1000)
         },
          methods: {
+            onNonWorkDaySet() {
+                if (this.timeType.notAllowedOnNonWorkday) {
+                    this.timeType.includeWeekends = false;
+                }
+            },  
             getDept(){
                 this.http.post('/department/list',{
                 },res => {
@@ -1266,6 +1271,8 @@
                         param.includeWeekends = param.includeWeekends ? 1 : 0
                         param.workOvertimeNeedCheck = param.workOvertimeNeedCheck ? 1 : 0
                         param.mainProjectState = param.mainProjectState ? 1 : 0
+                        param.stopReport = param.stopReport? 1: 0;
+                        param.notAllowedOnNonWorkday = param.notAllowedOnNonWorkday? 1: 0;
                         if(param.lockWorktime){
                             param.fillOvertime = 0
                             param.payOvertime = 0
@@ -1353,6 +1360,8 @@
                             this.timeType.customDataMaxStatus = this.timeType.customDataMaxStatus ? true : false 
                             this.timeType.customDataMaxValue = this.timeType.customDataMaxValue ? this.timeType.customDataMaxValue : 100
                             this.timeType.reportAutoApproveDays = this.timeType.reportAutoApproveDays ? this.timeType.reportAutoApproveDays : 1
+                            this.timeType.stopReport = this.timeType.stopReport? true: false;
+                            this.timeType.notAllowedOnNonWorkday = this.timeType.notAllowedOnNonWorkday? true: false;
                             // this.timeType.alertNonWorkday = this.timeType.alertNonWorkday ? true : false
 
                             if(this.timeType.alertNonWorkday) {