Переглянути джерело

1. 手动同步获取企业微信考勤
2. 企业微信同步考勤计算请假时长方法更新优化

seyason 2 роки тому
батько
коміт
25e14df7f5

+ 4 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/WeiXinCorpController.java

@@ -174,6 +174,10 @@ public class WeiXinCorpController {
         try {
             User user = userMapper.selectById(token);
             WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", user.getCompanyId()));
+            if (wxCorpInfo == null) {
+                msg.setError("获取企业配置失败:非企业微信用户");
+                return msg;
+            }
             Item item = corpTicketMap.get(wxCorpInfo.getCorpid());
             if (item == null || item.expireTime.isBefore(LocalDateTime.now())) {
                 //重新获取

+ 3 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/WxCorpInfoServiceImpl.java

@@ -1002,8 +1002,11 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
                                     if (betweenNonWorkDays.size() > 0) {
                                         //跨天请假中含有非工作日的情况,要减去非工作日来重新计算实际工作日的每天请假时长。
                                         seconds = wxDuration * betweenTotalDays/(betweenTotalDays - betweenNonWorkDays.size());
+                                    } else {
+                                        seconds = wxDuration;
                                     }
                                     double curLeaveTime = convertDayTimeToHours(DateTimeUtil.getHoursFromSeconds(seconds));
+                                    System.out.println("j="+j+", curLeaveTime="+curLeaveTime);
                                     ct.setAskLeaveTime(leaveTime + curLeaveTime);
                                     break;
                                 case 2://补卡

+ 27 - 2
fhKeeper/formulahousekeeper/timesheet/src/views/workReport/daily.vue

@@ -352,8 +352,8 @@
                     <span v-if="reportTimeType.type == 3">{{$t('time.hour')}}</span>
 
                     <span v-if="workForm.time">{{$t('other.attendancePunch')}}: {{workForm.time.startTime}}-{{workForm.time.endTime}}, {{workForm.time.workHours}}{{$t('time.hour')}}</span>
-                    <span v-if="user.timeType.syncDingding==1&&!workForm.time">{{$t('other.noAttendanceRecord')}}</span>
-                    
+                    <span v-if="(user.timeType.syncDingding==1 || user.timeType.syncCorpwxTime==1)&&!workForm.time" >{{$t('other.noAttendanceRecord')}}</span>
+                    <el-button type="default" style="margin-left:5px;" size="mini" :loading="syncTimeLoading" v-if="user.timeType.syncCorpwxTime==1 && (workForm.createDate == today || (!workForm.time))" icon="el-icon-refresh" @click="refreshWXCardTime(workForm.createDate)"></el-button>
                 </el-form-item>
                 <!-- 000000 -->
                 <div v-for="(domain, index) in workForm.domains" :key="domain.id" :style="index>0?'margin-top:10px;':''">
@@ -1645,6 +1645,8 @@
         },
         data() {
             return {
+                today:null,
+                syncTimeLoading: false,
                 seluserText: '',
                 translation: '1', // 1、文字, 2、部门, 3、人员
                 exportLoad: false,
@@ -1924,6 +1926,7 @@
         mounted() {
             var now = new Date();
             var t = util.formatDate.format(now, 'yyyy-MM-dd');
+            this.today = t;
             var startStr = util.formatDate.format(new Date(), 'yyyy-MM') + "-01";
             this.exportParam.dateRange = [startStr,t];
             this.getAllDate(1);
@@ -1948,6 +1951,28 @@
             test(){
                 // console.log('test',this.depData,this.data[0].membCount,this.reportList.length);
             },
+            refreshWXCardTime(workdate) {
+                this.syncTimeLoading = true;
+                this.http.post('/user-corpwx-time/getPunchRecordBySelf',{
+                    date: workdate,
+                },res => {
+                    this.syncTimeLoading = false;
+                    if(res.code == 'ok'){
+                        this.workForm.time = res.data.time;
+                    }else {
+                        this.$message({
+                            message: res.msg,
+                            type: 'error'
+                        })
+                    }
+                },err => {
+                    this.syncTimeLoading = false;
+                    this.$message({
+                        message: err,
+                        type: 'error'
+                    })
+                })
+            },
             weeklyFilledTimeClick(parameterDate){ //按周填报-已填工时-点击
                 this.weeklyFilledTimeDialog = true
                 this.weeklyFilledTimeLoading = true