Browse Source

Merge branch 'master' of http://47.100.37.243:10191/wutt/manHourHousekeeper into master

seyason 1 year ago
parent
commit
326e13a387

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

@@ -2333,8 +2333,8 @@ public class ReportController {
 
     //todo:推送工时管家工时考勤数据到SAP
     @RequestMapping("/pushProjectReportToSap")
-    public HttpRespMsg pushProjectReportToSap(String startDate,String endDate,String userId){
-        return reportService.pushProjectReportToSap(startDate,endDate,userId);
+    public HttpRespMsg pushProjectReportToSap(String yearMonth){
+        return reportService.pushProjectReportToSap(yearMonth);
     }
 
     //todo: 提供接口(威派格) 获取项目工时数据

+ 33 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/SapSyncLogController.java

@@ -1,10 +1,23 @@
 package com.management.platform.controller;
 
 
+import com.aliyun.credentials.http.HttpRequest;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.management.platform.entity.SapSyncLog;
+import com.management.platform.mapper.UserMapper;
+import com.management.platform.service.SapSyncLogService;
+import com.management.platform.util.HttpRespMsg;
 import org.springframework.web.bind.annotation.RequestMapping;
 
 import org.springframework.web.bind.annotation.RestController;
 
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.List;
+
 /**
  * <p>
  *  前端控制器
@@ -17,5 +30,25 @@ import org.springframework.web.bind.annotation.RestController;
 @RequestMapping("/sap-sync-log")
 public class SapSyncLogController {
 
+    @Resource
+    private SapSyncLogService sapSyncLogService;
+    @Resource
+    private HttpServletRequest request;
+    @Resource
+    private UserMapper userMapper;
+
+    @RequestMapping("list")
+    public HttpRespMsg list(){
+        //只返回最近7天的数据
+        DateTimeFormatter df=DateTimeFormatter.ofPattern("yyyy-MM-dd");
+        LocalDate endDate=LocalDate.now();
+        LocalDate startDate=endDate.minusDays(7);
+        HttpRespMsg msg=new HttpRespMsg();
+        Integer companyId = userMapper.selectById(request.getHeader("token")).getCompanyId();
+        List<SapSyncLog> list = sapSyncLogService.list(new LambdaQueryWrapper<SapSyncLog>().eq(SapSyncLog::getCompanyId, companyId).between(SapSyncLog::getSyncTime,df.format(startDate)+" 00:00:00",df.format(endDate)+" 23:59:59").orderByDesc(SapSyncLog::getSyncTime));
+        msg.setData(list);
+        return msg;
+    }
+
 }
 

+ 5 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/SapSyncLog.java

@@ -4,9 +4,12 @@ import com.baomidou.mybatisplus.extension.activerecord.Model;
 import java.time.LocalDateTime;
 import com.baomidou.mybatisplus.annotation.TableField;
 import java.io.Serializable;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
+import org.springframework.format.annotation.DateTimeFormat;
 
 /**
  * <p>
@@ -42,6 +45,8 @@ public class SapSyncLog extends Model<SapSyncLog> {
      * 同步时间
      */
     @TableField("sync_time")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private LocalDateTime syncTime;
 
     /**

+ 1 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/ReportService.java

@@ -132,7 +132,7 @@ public interface ReportService extends IService<Report> {
 
     HttpRespMsg getWeeklyFillReportData(String targetDate, HttpServletRequest request);
 
-    HttpRespMsg pushProjectReportToSap(String startDate, String endDate,String userId);
+    HttpRespMsg pushProjectReportToSap(String yearMonth);
 
     HttpRespMsg getReportById(Integer reportId, HttpServletRequest request);
 

+ 6 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ProjectServiceImpl.java

@@ -11382,6 +11382,12 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
         HttpRespMsg msg=new HttpRespMsg();
         Integer companyId = userMapper.selectById(request.getHeader("token")).getCompanyId();
         //获取SAP项目服务数据 ----> 工时管家任务分组下阶段作为项目服务数据
+        if(StringUtils.isEmpty(startDate)||StringUtils.isEmpty(endDate)){
+            //没设置开始或者结束日期 同步当天新增的项目数据
+            DateTimeFormatter df=DateTimeFormatter.ofPattern("yyyy-MM-dd");
+            startDate=df.format(LocalDate.now());
+            endDate=df.format(LocalDate.now());
+        }
         XmlResponseData projectServiceData= SyncSapUtils.syncServiceData("2020-01-01", endDate, companyId);
         //已有的项目分类
         List<ProjectCategory> allProjectCategoryList = projectCategoryMapper.selectList(new QueryWrapper<ProjectCategory>().eq("company_id", companyId));

+ 6 - 2
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ReportServiceImpl.java

@@ -7448,13 +7448,17 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
     }
 
     @Override
-    public HttpRespMsg pushProjectReportToSap(String startDate, String endDate,String userId) {
+    public HttpRespMsg pushProjectReportToSap(String yearMonth) {
         HttpRespMsg httpRespMsg =new HttpRespMsg();
+        String dateStr = yearMonth+"-01";
+        DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+        LocalDate start = LocalDate.parse(dateStr,df);
+        LocalDate end =start.plusMonths(1).minusDays(1);
         List<SapSyncLog> sapSyncLogs=new ArrayList<>();
         LocalDateTime localDateTime=LocalDateTime.now();
         User user = userMapper.selectById(request.getHeader("token"));
         Integer companyId = user.getCompanyId();
-        List<Map<String,Object>> resultList=reportMapper.getPushProjectReportToSap(companyId,startDate,endDate,userId);
+        List<Map<String,Object>> resultList=reportMapper.getPushProjectReportToSap(companyId,df.format(start),df.format(end),null);
         //提前推送项目工时(工时管家相关项目任务分组阶段下任务作为SAP服务 预算工时数据推送到SAP)
         List<Map<String, Object>> pushProjectPlanHour = reportMapper.getProjectPlanData(companyId,null,null);
         List<SapSyncLog> projectPlanSyncLogs = SyncSapUtils.pushProjectPlanToSap(pushProjectPlanHour, user.getCompanyId(), user.getJobNumber());

+ 4 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/TaskMapper.xml

@@ -171,7 +171,10 @@
         SELECT task.id, task.`name`,task.executor_name,task.executor_id,DATE_FORMAT(task.`end_date`, '%Y-%m-%d') as end_date, task.`plan_hours`,
         (SELECT IFNULL(SUM(working_time),0) FROM report WHERE report.`task_id` = task.id AND report.`state` = 1) AS real_hours,
         task.`task_status`, task.`task_type`,
-        project.`project_code`, project.`project_name` FROM task LEFT JOIN project ON project.id = task.`project_id`
+        project.`project_code`, project.`project_name`,tg.name as groupName
+        FROM task
+        LEFT JOIN project ON project.id = task.`project_id`
+        LEFT JOIN task_group tg on tg.id=task.`group_id`
         WHERE project.`company_id` = #{companyId}
         <if test="projectId != null">
             and task.project_id = #{projectId}

+ 5 - 0
fhKeeper/formulahousekeeper/timesheet/src/views/corpreport/list.vue

@@ -215,6 +215,11 @@
                     <span v-else>{{scope.row.customName}}</span>
                   </template>
                 </el-table-column>
+                <el-table-column v-if="user.companyId==3092" prop="groupName" :label="'任务分组'"  width="300">
+                  <template slot-scope="scope" >
+                    {{scope.row.groupName}}
+                  </template>
+                </el-table-column>
                 <el-table-column prop="name" :label="$t('nameofthetask')"  width="300">
                   <template slot-scope="scope" >
                     {{scope.row.name}}

+ 29 - 5
fhKeeper/formulahousekeeper/timesheet/src/views/project/list.vue

@@ -84,8 +84,8 @@
                             <el-dropdown-item v-if="user.timeType.projectLevelState == 1">
                                 <el-link type="primary" :underline="false" @click="projectLevelDialog = true">{{ $t('projectlevelmanagement') }}</el-link>
                             </el-dropdown-item>
-                            <el-dropdown-item v-if="user.timeType.syncFanwei==1">
-                                <el-link type="primary" :underline="false" @click="syncProjectForFanWei()">{{'同步项目信息'}}</el-link>
+                            <el-dropdown-item v-if="user.timeType.syncFanwei==1||user.timeType.syncSap==1">
+                                <el-link type="primary" :underline="false" @click="syncProjectForThird()">{{'同步项目信息'}}</el-link>
                             </el-dropdown-item>
                             <el-dropdown-item v-if="user.companyId==3385 && permissions.projectClassification">
                                 <el-link type="primary" :underline="false" @click="functionalDivisionDig=true,getFunctionalList()">{{'职能分工设置'}}</el-link>
@@ -3939,10 +3939,30 @@ a {
                 })
                 .catch(() => {});
             },
-            // 美莱德同步项目信息到泛微
-            syncProjectForFanWei(){
-                this.http.post('/project/syncProjectWithFanwei',{},
+            
+            syncProjectForThird(){
+                let url=''
+                if(this.user.timeType.syncFanwei==1){
+                    // 美莱德同步项目信息来源泛微
+                    url='/project/syncProjectWithFanwei'
+                }else if(this.user.timeType.syncSap==1){
+                    // 依斯倍同步项目信息来源SAP
+                    url='/project/syncProjectWithSap'
+                }
+                this.$confirm('确认同步项目数据?','提示',{
+                    confirmButtonText: '确定',
+                    cancelButtonText: '取消',
+                    type: 'info'
+                }).then(()=>{
+                    const loading = this.$loading({
+                        lock: true,
+                        text: '正在同步中,请耐心等待。',
+                        spinner: 'el-icon-loading',
+                        background: 'rgba(0, 0, 0, 0.7)'
+                    });
+                    this.http.post(url,{},
                     res => {
+                        loading.close();
                         console.log(res, 'res')
                         if (res.code == "ok") {
                             this.$message({
@@ -3957,6 +3977,7 @@ a {
                         }
                     },
                     error => {
+                        loading.close();
                         console.log(error, 'res')
                         this.$message({
                             message: error,
@@ -3964,6 +3985,9 @@ a {
                         });
                         }
                     );
+                }).catch(() => {
+                });
+                
             },
             deleteBaseItem(row) {
                 this.$confirm(this.$t('operationmaycausedatalossAreyousuredeletethedata'),this.$t('deletethecostbaselineitem'), {

+ 52 - 3
fhKeeper/formulahousekeeper/timesheet/src/views/workReport/daily.vue

@@ -144,6 +144,7 @@
                                     <!--部门负责人给个导出工时的功能 -->
                                     <el-link type="primary" v-if="user.manageDeptId != 0" style="margin-right:10px;" :underline="false" @click="showExportTimeDialog">{{$t('textLink.exportingTimeStatistics')}}</el-link>
                                     <el-link type="primary" v-if="user.timeType.pushReportData == 1 && permissions.reportPush" :underline="false" @click="pushWorkTime">推送工时</el-link>
+                                    <el-link type="primary" v-if="user.timeType.pushReportData == 1 && permissions.reportPush" :underline="false" @click="pushWorkTimeLogDig=true,getPushWorkLogData()">工时推送日志</el-link>
                                     <!-- <el-button v-if="user.timeType.pushReportData == 1 && permissions.reportPush" style="margin-left:10px;" icon="iconfont firerock-icontuisong" size="mini" @click="pushWorkTime"></el-button> -->
 
                                 </span>
@@ -342,6 +343,28 @@
             </el-card>
         </div>
 
+        <!-- 工时推送日志弹窗 -->
+        <el-dialog title="工时推送日志" :visible.sync="pushWorkTimeLogDig"  width="70%" :before-close="handleClose">
+              <template>
+                <el-table :data="pushWorkTimeLogData" style="width: 100%" height="500" >
+                    <el-table-column prop="syncTime" label="推送时间" width="150"></el-table-column>
+                    <el-table-column prop="remark" label="推送名称" width="180"></el-table-column>
+                    <el-table-column prop="operator" label="操作人员" width="150"></el-table-column>
+                    <el-table-column prop="syncType" label="推送方式" width="150"></el-table-column>
+                    <el-table-column prop="result" label="推送结果" width="250">
+                        <template slot-scope="scope">
+                            <span style="color:green;" v-if="scope.row.result.includes('成功')">{{scope.row.result}}</span>
+                            <span style="color:red;" v-if="scope.row.result.includes('失败')">{{scope.row.result}}</span>
+                        </template>
+                    </el-table-column>
+                    <el-table-column prop="resultRemark" label="备注" width="400"></el-table-column>
+                </el-table>
+            </template>
+            <span slot="footer" class="dialog-footer">
+                <el-button type="primary" @click="pushWorkTimeLogDig = false">关 闭</el-button>
+            </span>
+        </el-dialog>
+
         <!-- 填写日报的dialog -->
         <el-dialog :title="editTitle[isBatch]" :visible.sync="dialogVisible" width="60%" :close-on-click-modal="false" @closed="guanbi()" :top="'5.5vh'" custom-class="editReportDialog" ref="editReportDialog">
             <div style="height: 65vh;overflow: auto;">
@@ -2223,7 +2246,9 @@
                         // id: 10,
                         name: '陕西柘中建设工程有限公司' 
                     }
-                ]
+                ],
+                pushWorkTimeLogDig:false,
+                pushWorkTimeLogData:[],
             };
         },
         watch: {
@@ -3479,6 +3504,12 @@
             },
 
     pushWorkTime(){
+        let url=''
+        if(this.user.timeType.syncSap == 1){
+            url='/report/pushProjectReportToSap'
+        }else{
+            url='/report/pushReportDataToThird'
+        }
         this.$confirm('确认推送'+this.date+'月的工时?', '提示', {
           confirmButtonText: '确定',
           cancelButtonText: '取消',
@@ -3490,8 +3521,7 @@
                 spinner: 'el-icon-loading',
                 background: 'rgba(0, 0, 0, 0.7)'
             });
-            
-            this.http.post('/report/pushReportDataToThird',{
+            this.http.post(url,{
                 yearMonth: this.date
             },res => {
                 loading.close();
@@ -6103,6 +6133,25 @@
                     zhi.he = he + 'h'
                 }
             },
+            getPushWorkLogData(){
+                this.http.post('/sap-sync-log/list', {},
+                res => {
+                    if (res.code == "ok") {
+                        this.pushWorkTimeLogData = res.data;
+                    } else {
+                        this.$message({
+                        message: res.msg,
+                        type: "error"
+                        });
+                    }
+                },
+                error => {
+                    this.$message({
+                        message: error,
+                        type: "error"
+                    });
+                });
+            },
             // 获取全部人员
             getUsers() {
                 this.http.post('/user/getSimpleActiveUserList', {},

+ 7 - 7
fhKeeper/formulahousekeeper/timesheet_h5/src/views/expense/details.vue

@@ -632,7 +632,7 @@ export default {
                     this.back()
                 } else {
                     this.confirmLoading = false
-                    this.$toast.fail('获取失败');
+                    this.$toast.fail(res.msg || res.code || '获取失败');
                 }
             }).catch(err=> {this.confirmLoading = false;this.$toast.clear();console.log(err)});
         },
@@ -676,7 +676,7 @@ export default {
                         
                     }
                 } else {
-                    this.$toast.fail('获取失败');
+                    this.$toast.fail(res.msg || res.code || '获取失败');
                 }
             }).catch(err=> {this.$toast.clear();console.log(err)});
         },
@@ -686,7 +686,7 @@ export default {
                 if(res.code == "ok") {
                     this.userList = res.data
                 } else {
-                    this.$toast.fail('获取失败');
+                    this.$toast.fail(res.msg || res.code || '获取失败');
                 }
             }).catch(err=> {this.$toast.clear();console.log(err)});
         },
@@ -696,7 +696,7 @@ export default {
                 if(res.code == "ok") {
                     this.inProjectList = res.data
                 } else {
-                    this.$toast.fail('获取失败');
+                    this.$toast.fail(res.msg || res.code || '获取失败');
                 }
             }).catch(err=> {this.$toast.clear();console.log(err)});
         },
@@ -707,7 +707,7 @@ export default {
                     this.allexTypeList = res.data
                     this.inexTypeList = this.allexTypeList.filter(a=>a.mainType == this.editForm.type)
                 } else {
-                    this.$toast.fail('获取失败');
+                    this.$toast.fail(res.msg || res.code || '获取失败');
                 }
             }).catch(err=> {this.$toast.clear();console.log(err)});
         },
@@ -721,7 +721,7 @@ export default {
                         item.approveLoading = false
                         this.getDetail();
                     } else {
-                        this.$toast.fail('获取失败');
+                        this.$toast.fail(res.msg || res.code || '获取失败');
                     }
                 }).catch(err => { this.$toast.clear(); console.log(err) });
         },
@@ -735,7 +735,7 @@ export default {
                         item.approveLoading = false
                         this.getDetail();
                     } else {
-                        this.$toast.fail('获取失败');
+                        this.$toast.fail(res.msg || res.code || '获取失败');
                     }
                 }).catch(err => { this.$toast.clear(); console.log(err) });
         },

+ 11 - 10
fhKeeper/formulahousekeeper/timesheet_h5/src/views/expense/index.vue

@@ -709,7 +709,7 @@ export default {
                                         id: this.user.id
                                     }
                                 } else {
-                                    this.$toast.fail('获取失败');
+                                    this.$toast.fail(res.msg || res.code || '填报失败');
                                 }
                             }).catch(err => { this.confirmLoading = false; this.$toast.clear(); console.log(err) });
                     } else {
@@ -739,7 +739,7 @@ export default {
                                 this.$toast.success('删除成功')
                                 this.getBillList()
                             } else {
-                                this.$toast.fail('获取失败');
+                                this.$toast.fail(res.msg || res.code || '删除失败');
                             }
                         }).catch(err => { this.$toast.clear(); console.log(err) });
                 })
@@ -773,7 +773,8 @@ export default {
                         item.approveLoading = false
                         this.getExamineList()
                     } else {
-                        this.$toast.fail('获取失败');
+                        this.$toast.fail('操作失败');
+                        
                     }
                 }).catch(err => { this.$toast.clear(); console.log(err) });
         },
@@ -793,7 +794,7 @@ export default {
                         this.denyLoading = false
                         this.getExamineList()
                     } else {
-                        this.$toast.fail('获取失败');
+                        this.$toast.fail(res.msg || res.code || '操作失败');
                     }
                 }).catch(err => { this.$toast.clear(); console.log(err) });
         },
@@ -804,7 +805,7 @@ export default {
                     if (res.code == "ok") {
                         this.userList = res.data
                     } else {
-                        this.$toast.fail('获取失败');
+                        this.$toast.fail(res.msg || res.code || '获取失败');
                     }
                 }).catch(err => { this.$toast.clear(); console.log(err) });
         },
@@ -815,7 +816,7 @@ export default {
                         this.inProjectList = res.data
                         this.inProjectListCopy = JSON.parse(JSON.stringify(res.data))
                     } else {
-                        this.$toast.fail('获取失败');
+                        this.$toast.fail(res.msg || res.code || '获取失败');
                     }
                 }).catch(err => { this.$toast.clear(); console.log(err) });
         },
@@ -826,7 +827,7 @@ export default {
                         this.allexTypeList = res.data
                         this.inexTypeList = this.allexTypeList.filter(a => a.mainType == this.editForm.type)
                     } else {
-                        this.$toast.fail('获取失败');
+                        this.$toast.fail(res.msg || res.code || '获取失败');
                     }
                 }).catch(err => { this.$toast.clear(); console.log(err) });
         },
@@ -843,7 +844,7 @@ export default {
                         this.editForm.type = res.data[0].id
                         this.getExTypeList
                     } else {
-                        this.$toast.fail('获取失败');
+                        this.$toast.fail(res.msg || res.code || '获取失败');
                     }
                 }).catch(err => { this.$toast.clear(); console.log(err) });
         },
@@ -860,7 +861,7 @@ export default {
                 if (res.code == "ok") {
                     this.billList = res.data.records
                 } else {
-                    this.$toast.fail('获取失败');
+                    this.$toast.fail(res.msg || res.code || '获取失败');
                 }
             }).catch(err => { this.$toast.clear(); console.log(err) });
         },
@@ -881,7 +882,7 @@ export default {
                         this.$set(this.examineList[i], 'approveLoading', false)
                     }
                 } else {
-                    this.$toast.fail('获取失败');
+                    this.$toast.fail(res.msg || res.code || '获取失败');
                 }
             }).catch(err => { this.$toast.clear(); console.log(err) });
         },