Browse Source

Merge remote-tracking branch 'origin/master'

yusm 6 tháng trước cách đây
mục cha
commit
3467fbabe5

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

@@ -375,7 +375,8 @@ public class ReportController {
                                   Integer[] sapServiceId,//依斯贝的服务Id
                                   String summary,         //针对工作总结的字段
                                   String[] multiDegrId,
-                                  Integer[] reportTargetDeptId
+                                  Integer[] reportTargetDeptId,
+                                  String weeklyAttachment
                                     ) {
         List<Report> reportList = new ArrayList<>();
         String token = request.getHeader("Token");
@@ -1889,7 +1890,7 @@ public class ReportController {
                 }
             }
         }
-        HttpRespMsg httpRespMsg = reportService.editReport(reportList, createDate.length > 0 ? createDate[0] : null, targetUserList, hourCost, user.getCompanyId(), summary);
+        HttpRespMsg httpRespMsg = reportService.editReport(reportList, createDate.length > 0 ? createDate[0] : null, targetUserList, hourCost, user.getCompanyId(), summary, weeklyAttachment);
         //填报自动通过功能:【上海绎维】、【火石演示】、【博通容合】、【威派格】使用
         if (company.getId() == 862 || company.getId() == 10 || company.getId() == 3344 || company.getId() == 936) {
             //项目审核人是提交人的情况,直接审核

+ 13 - 10
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/ReportBatch.java

@@ -22,7 +22,7 @@ import org.springframework.format.annotation.DateTimeFormat;
  * </p>
  *
  * @author Seyason
- * @since 2023-11-27
+ * @since 2024-10-30
  */
 @Data
 @EqualsAndHashCode(callSuper = false)
@@ -68,13 +68,23 @@ public class ReportBatch extends Model<ReportBatch> {
     private Integer state;
 
     @TableField("create_time")
-    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private LocalDateTime createTime;
 
     @TableField("company_id")
     private Integer companyId;
 
+    /**
+     * 周总结
+     */
+    @TableField("summary")
+    private String summary;
+
+    /**
+     * 附件
+     */
+    @TableField("attachment")
+    private String attachment;
+
     @TableField(exist = false)
     private String name;
 
@@ -91,13 +101,6 @@ public class ReportBatch extends Model<ReportBatch> {
     @TableField(exist = false)
     private String reportIds;
 
-    /**
-     * 周总结
-     */
-    @TableField("summary")
-    private String summary;
-
-
     @Override
     protected Serializable pkVal() {
         return this.id;

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

@@ -33,7 +33,7 @@ public interface ReportService extends IService<Report> {
 
     HttpRespMsg getCardTime(String date, HttpServletRequest request);
 
-    HttpRespMsg editReport(List<Report> reportList, String date, List<User> userList, BigDecimal hourCost, Integer companyId, String summary);
+    HttpRespMsg editReport(List<Report> reportList, String date, List<User> userList, BigDecimal hourCost, Integer companyId, String summary, String weeklyAttachment);
 
     HttpRespMsg deleteReport(String userId, String date);
 

+ 10 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ReportServiceImpl.java

@@ -523,6 +523,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
                                 ReportBatch batchItem = first.get();
                                 map.put("summaryTitle", sdf.format(batchItem.getStartDate())+"至"+sdf.format(batchItem.getEndDate())+"周总结:");
                                 map.put("summary", batchItem.getSummary());
+                                map.put("attachment", batchItem.getAttachment());
                             }
                         }
                     }
@@ -1177,12 +1178,15 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
     //新增或编辑报告
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public HttpRespMsg editReport(List<Report> reportList, String date, List<User> userList, BigDecimal hourCost, Integer companyId, String summary) {
+    public HttpRespMsg editReport(List<Report> reportList, String date, List<User> userList, BigDecimal hourCost, Integer companyId, String summary, String weeklyAttachment) {
         HttpRespMsg httpRespMsg = new HttpRespMsg();
         TimeType timeType = timeTypeMapper.selectById(companyId);
         if ("null".equals(summary)) {
             summary = null;
         }
+        if ("null".equals(weeklyAttachment)) {
+            weeklyAttachment = null;
+        }
         //删除不在本次更新名单中的老记录
         List<Integer> idList = reportList.stream().filter(r->r.getId() != null).map(Report::getId).collect(Collectors.toList());
         List<Report> allDateReportList = reportList;
@@ -1285,6 +1289,8 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
                         batch.setEndDate(maxDate);
                         //周总结
                         batch.setSummary(summary);
+                        batch.setAttachment(weeklyAttachment);
+                        System.out.println("weeklyAttachment========"+weeklyAttachment);
                         batch.setTotalWorkTime(allDateReportList.stream().filter(item->item.getCreatorId().equals(creatorId)).mapToDouble(Report::getWorkingTime).sum());
                         reportBatchMapper.insert(batch);
                         //更新batchId
@@ -8684,6 +8690,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
         Map<String, Object> reportMap = new HashMap<>();
         if (needFill) {
             String summary = null;
+            String attachment = null;
             String startDate = firstDayOfWeek.format(dtf);
             String endDate = lastDayOfWeek.format(dtf);
             TimeType timeType = timeTypeMapper.selectById(user.getCompanyId());
@@ -8698,6 +8705,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
                     //老数据可能出现batchId错误的情况,已经被删掉了,就不处理了。
                     if (batch != null) {
                         summary = batch.getSummary();
+                        attachment = batch.getAttachment();
                     }
                 }
                 List<String> collect = reportList.stream().map(Report::getProjectAuditorId).distinct().collect(Collectors.toList());
@@ -8798,6 +8806,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
             }
             reportMap.put("dateList", dateList);
             reportMap.put("summary", summary);
+            reportMap.put("weeklyAttachment", attachment);
         } else {
             reportMap.put("dateList", new ArrayList());
         }

+ 2 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/ReportBatchMapper.xml

@@ -13,11 +13,12 @@
         <result column="create_time" property="createTime" />
         <result column="company_id" property="companyId" />
         <result column="summary" property="summary" />
+        <result column="attachment" property="attachment" />
     </resultMap>
 
     <!-- 通用查询结果列 -->
     <sql id="Base_Column_List">
-        id, creator_id, start_date, end_date, total_work_time, state, create_time, company_id, summary
+        id, creator_id, start_date, end_date, total_work_time, state, create_time, company_id, summary, attachment
     </sql>
 
 </mapper>

+ 1 - 0
fhKeeper/formulahousekeeper/timesheet/src/i18n/en.json

@@ -1,4 +1,5 @@
 {
+  "attachUpload": "Upload Attachment",
   "workingHoursHousekeeper": "TimeSheet",
   "navigation": {
     "reports": "Hours report",

+ 1 - 0
fhKeeper/formulahousekeeper/timesheet/src/i18n/zh.json

@@ -1,4 +1,5 @@
 {
+  "attachUpload": "附件上传",
   "workingHoursHousekeeper": "工时管家",
   "navigation": {
     "reports": "工时报告",

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

@@ -186,8 +186,11 @@
                                         <el-button v-if="item1.state >= 2 && user.id == item1.id && user.timeType.enableNewWeeklyfill != 1" type="primary" size="small" @click="isSubstitude=false; fillInReport(index1,0)">{{$t('btn.editWorkReport')}}</el-button>
                                         <el-button v-if="permissions.reportsDeleteAll && item1.state != 1" size="small" @click="guanli(item1)" style="float: right;">{{$t('btn.delete')}}</el-button>
                                     </div>
-                                    <div v-if="user.timeType.enableNewWeeklyfill == 1 && item1.summary != null" style="margin-left:20px;">
-                                        <p v-html="'<b>'+item1.summaryTitle+'</b><br>'+item1.summary.replace(/[\r\n]/g,'<br>')"> </p>
+                                    <div v-if="user.timeType.enableNewWeeklyfill == 1" style="margin-left:20px;">
+                                        <p v-if="item1.summary != null" v-html="'<b>'+item1.summaryTitle+'</b><br>'+item1.summary.replace(/[\r\n]/g,'<br>')"> </p>
+                                        <p v-if="item1.attachment != null" >附件
+                                            <a v-for="file in JSON.parse(item1.attachment)" style="margin-right:5px;" :href="'/upload/'+file.serverName" :download="file.originName">{{ file.originName }}</a>
+                                        </p>
                                     </div>
                                     <div class="one_daily_body">
                                         <el-timeline>

+ 138 - 9
fhKeeper/formulahousekeeper/timesheet/src/views/workReport/weeklyCustomization.vue

@@ -36,11 +36,11 @@
                             </el-select>
                         </template>
                     </el-table-column>
-                    <el-table-column prop="content" :label="$t('gongZuoNeiRong')" width="300">
+                    <el-table-column prop="content" :label="user.companyId == wuqiId ? '日报' : $t('gongZuoNeiRong')" width="300">
                         <template slot-scope="scope">
-                            <el-input size="small" type="textarea" :rows="2" v-model="scope.row.content"
+                            <el-input size="small" type="textarea" :rows="2" v-model.trim="scope.row.content"
                                 :disabled="scope.row.state == 1 || scope.row.state == 0 || !scope.row.canFill"
-                                resize="none"></el-input>
+                                resize="none" :maxlength="user.companyId == wuqiId && 30" :show-word-limit="user.companyId == wuqiId" :placeholder="user.companyId == wuqiId ? '所在项目负责哪一模块(可重复填写),无需涉及技术细节。' : '' "></el-input>
                         </template>
                     </el-table-column>
                     <el-table-column prop="workingTime" :label="$t('shiJianXiaoShi')" width="160">
@@ -77,10 +77,29 @@
                     </el-table-column>
                 </el-table>
             </div>
-            <div>
+            <div class="weeklySummary">
+                <div class="weekly" v-if="user.companyId == wuqiId"><span style="font: size 14px;">周报</span>
+                    <br/>
+                <!-- <el-upload ref="upload" action="#" :http-request="uploadFile" :file-list="fileList" :show-file-list="true" :limit="5" multiple >
+                    <el-link type="primary" :underline="false" style="margin-left:10px;"><i class="iconfont firerock-iconshangchuan"></i><span style="margin-left:5px;">{{ $t('attachUpload') }}</span></el-link>
+                </el-upload> -->
+                <el-upload
+                class="upload-demo"
+                :on-preview="handlePreview"
+                :on-remove="handleRemove"
+                :before-remove="beforeRemove"
+                :http-request="uploadFile"
+                multiple
+                :limit="5"
+                :on-exceed="handleExceed"
+                :file-list="fileList">
+                <el-button size="small" type="primary" :loading="upLoading">上传附件</el-button>
+                <div slot="tip" class="el-upload__tip">附件大小不超过10M</div>
+                </el-upload>
+                </div>
                 <el-input type="textarea" :autosize="{ minRows: 4, maxRows: 6}" maxlength="1000" show-word-limit
-                    :placeholder="$t('qingShuRuZhouZongJie')"
-                    v-model="summaryContent">
+                    :placeholder="user.companyId == wuqiId ? '本周主要工作回顾、遗留事宜的初步处理方案和预计完成时间、下周工作的计划,尽可能详细。' : $t('qingShuRuZhouZongJie')"
+                    v-model="summaryContent" style="flex: 1;">
                     </el-input>
             </div>
             <div class="weeklyCustomization_btn">
@@ -107,6 +126,9 @@ export default {
     },
     data() {
         return {
+            serverFileList:[],
+            upLoading: false,
+            fileList:[],
             summaryContent: null,
             weekTableData: [],
             projectList: [],
@@ -114,6 +136,7 @@ export default {
             submitLoading: false,
             permissions: JSON.parse(sessionStorage.getItem("permissions")),
             user: JSON.parse(sessionStorage.getItem("user")),
+            wuqiId: '1071'
         }
     },
     computed: {},
@@ -125,10 +148,70 @@ export default {
         this.getProjectList()
     },
     methods: {
+        handleRemove(file, fileList) {
+            console.log(file, fileList);
+            console.log('删除的文件名=='+file.name);
+            console.log('服务器文件数组=='+this.serverFileList);
+            for (var i=0;i<this.serverFileList.length; i++) {
+                if (this.serverFileList[i].originName == file.name) {
+                    this.serverFileList.splice(i,1);
+                    break;
+                }
+            }
+        },
+        handlePreview(file) {
+            console.log(file);
+        },
+        handleExceed(files, fileList) {
+            this.$message.warning(`最多上传5个文件`);
+        },
+        beforeRemove(file, fileList) {
+            return this.$confirm(`确定移除 ${ file.name }?`);
+        },
+        //上传
+        uploadFile(params) {
+            this.upLoading = true;
+            var fileObj = params.file;
+            var form = new FormData();
+            form.append("multipartFile", fileObj);
+            this.http.uploadFile('/common/uploadFile', form , res => {
+                this.upLoading = false;
+                if (res.code == "ok") {
+                    this.$message({
+                        message: this.$t('uploadedsuccessfully'),
+                        type: 'success'
+                    });
+                    this.serverFileList.push({'originName':fileObj.name,'serverName':res.data});
+                } else {
+                    this.$message({
+                        message: res.msg,
+                        type: 'error'
+                    });
+                }
+                console.log(this.fileList);
+            }, error => {
+                this.upLoading = false;
+                this.$message({
+                    message: error,
+                    type: 'error'
+                });
+            })
+        },
+
+        //下载
+        dowloadFile(row) {
+            this.http.post(this.port.project.dowloadFile, {
+                id: row.id
+            } , res => {
+                this.getOperList();
+            }, error => {
+            })
+        },
         // 提交与暂存
         submitWeekData(draft) { // draft 暂存(1)提交(0)
             const newWeekData = cloneDeep(this.weekTableData)
-
+            console.log('总文件数=='+this.serverFileList.length);
+            console.log(this.serverFileList);
             let strArr = this.judgmentData(newWeekData)
             const { allday } = this.user.timeType // 系统设置的每日工作时间
             if (strArr.length > 0) {
@@ -142,6 +225,9 @@ export default {
             let formData = new FormData();
             formData.append("draft", draft);
             formData.append('summary', this.summaryContent);
+            if (this.serverFileList.length > 0) {
+                formData.append('weeklyAttachment', JSON.stringify(this.serverFileList));
+            }
             let fixation = {
                 id: -1,
                 projectId: '',
@@ -175,13 +261,33 @@ export default {
                     groupId: data.groupId,
                     id: data.id || -1,
                 }));
-
+            let flag = false
             arr.forEach(item => {
+                if(item.projectId && !item.content && this.user.companyId == this.wuqiId) {
+                    this.$message({
+                        type: 'warning',
+                        message: `${item.createDate} 日报请填写完整`,
+                    })
+                    flag = true
+                    return
+                } else {
+                    flag = false
+                }
                 Object.entries(item).forEach(([key, value]) => {
                     formData.append(key, value);
                 });
             });
-
+            const hasProjectIdValue = arr.some(obj => obj.projectId && obj.projectId !== '');
+            if(hasProjectIdValue && !this.summaryContent && this.user.companyId == this.wuqiId) {
+                this.$message({
+                    type: 'warning',
+                    message: `请填写周报`,
+                })
+                return
+            }
+            if(flag) {
+                return
+            }
             this.submitLoading = true
             this.http.uploadFile(this.port.report.editPort, formData,
                 res => {
@@ -265,6 +371,14 @@ export default {
             let { data } = await this.getData('/report/getWeeklyFillReportData', { targetDate: this.nowTime })
             console.log(JSON.parse(JSON.stringify(data)), '<===== 处理之前的')
             this.summaryContent = data.summary;
+            this.serverFileList = data.weeklyAttachment?JSON.parse(data.weeklyAttachment):[];
+            if (this.serverFileList) {
+                for (var i=0;i<this.serverFileList.length; i++) {
+                    var item = this.serverFileList[i];
+                    this.fileList.push({name:item.originName, url:this.serverFileList[i].serverName});
+                }
+            }
+            
             data.dateList.forEach(dateItem => {
                 const reportList = dateItem.reportList;
                 reportList.forEach(report => {
@@ -406,6 +520,21 @@ export default {
 }
 </script>
 <style scoped lang='scss'>
+.weeklySummary {
+    width: 100%;
+    display: flex;
+    flex-direction: row;
+    align-items: center;
+    border: 1px solid #EBEEF5;
+    border-top: 0px;
+    padding: 10px 20px;
+    box-sizing: border-box;
+    .weekly {
+        padding: 0 20px;
+        font-size: 20px;
+        color: #909399;
+    }
+}
 .flexColumn {
     display: flex;
     flex-direction: column;