Browse Source

修改薪资导入模板

seyason 2 năm trước cách đây
mục cha
commit
3b79c5c162

+ 17 - 16
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/UserServiceImpl.java

@@ -368,23 +368,24 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
                 userSalaryService.saveBatch(salaryChangeList);
             }
             //更新该月份的日报相关的成本
-            List<Report> reportList = reportMapper.selectSimpleTime(companyId, startStr, endStr);
-
-            if (reportList.size() > 0) {
-                List<Report> updateReportList = new ArrayList<>();
-                for (Report r : reportList) {
-                    Optional<User> first = updateUserList.stream().filter(u -> u.getId().equals(r.getCreatorId())).findFirst();
-                    if (first.isPresent()) {
-                        BigDecimal hourCost = first.get().getCost();
-                        r.setCost(hourCost.multiply(new BigDecimal(r.getWorkingTime())));
-                        r.setCreatorId(null);
-                        r.setWorkingTime(null);
-                        updateReportList.add(r);
+            if (!StringUtils.isEmpty(yearMonth)) {
+                List<Report> reportList = reportMapper.selectSimpleTime(companyId, startStr, endStr);
+                if (reportList.size() > 0) {
+                    List<Report> updateReportList = new ArrayList<>();
+                    for (Report r : reportList) {
+                        Optional<User> first = updateUserList.stream().filter(u -> u.getId().equals(r.getCreatorId())).findFirst();
+                        if (first.isPresent()) {
+                            BigDecimal hourCost = first.get().getCost();
+                            r.setCost(hourCost.multiply(new BigDecimal(r.getWorkingTime())));
+                            r.setCreatorId(null);
+                            r.setWorkingTime(null);
+                            updateReportList.add(r);
+                        }
+                    }
+                    //批量更新日报的成本
+                    if (updateReportList.size() > 0) {
+                        reportService.updateBatchById(updateReportList);
                     }
-                }
-                //批量更新日报的成本
-                if (updateReportList.size() > 0) {
-                    reportService.updateBatchById(updateReportList);
                 }
             }
         }catch (IOException e){

BIN
fhKeeper/formulahousekeeper/management-platform/src/main/resources/upload/Salary Import Template.xlsx


+ 4 - 8
fhKeeper/formulahousekeeper/timesheet/src/views/team/index.vue

@@ -645,8 +645,10 @@
             <p>1. {{ $t('other.download') }}
             <el-link type="primary" style="margin-left:5px;" :underline="false" href="./upload/薪资导入模板.xlsx" :download="$t('salaryTemplate')+'.xlsx'">{{$t('salaryTemplate')}}.xlsx</el-link>
             </p>
-            <p>2. {{ $t('Selectmonth') }}
+            <p>2. 
+              {{ $t('Selectmonth') }}
               <el-date-picker v-model="ymonth" type="month" :placeholder="$t('Selectmonth')" format="yyyy-MM" value-format="yyyy-MM"></el-date-picker>
+              <br/><span style="margin-left:10px;margin-top:8px;color:#999;">({{$t('Recalculatereportedcostsforthemonth')}})</span>
             </p>
             <p>3. {{ $t('exceltemplateanduploadit') }}。</p>
             <p style="display: flex;justify-content: center;padding-bottom:1em;">
@@ -749,6 +751,7 @@ export default {
   },
   data() {
     return {
+      syncHistoryReport: true,
       ymonth: null,
       importingSalaryData: false,
       translation: '1', // 1、文字, 2、部门, 3、人员
@@ -2044,13 +2047,6 @@ export default {
           type: "error",
         });
       } else {
-        if (!this.ymonth) {
-          this.$message({
-            message: this.$t('Selectmonth'),
-            type: "error",
-          });
-          return;
-        }
         let formData = new FormData();
         formData.append("file", item.file);
         formData.append("ymonth", this.ymonth);