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

修复钢印号问题
针对赛元微电子的特殊功能先隐藏

seyason 1 рік тому
батько
коміт
f3e6388a5e

+ 8 - 0
fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/controller/ReportController.java

@@ -151,6 +151,14 @@ public class ReportController {
         msg.data = reportService.fixSteelNumData();
         return msg;
     }
+
+    @RequestMapping("/fixFinishNumData")
+    public HttpRespMsg fixFinishNumData() {
+        HttpRespMsg msg = new HttpRespMsg();
+        //修复report表中钢印号存在重复问题
+        msg.data = reportService.fixFinishNumData();
+        return msg;
+    }
 //
 //    @RequestMapping("/getCardTime")
 //    public HttpRespMsg getCardTime(@RequestParam String date) {

+ 10 - 0
fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/mapper/ReportMapper.java

@@ -209,4 +209,14 @@ public interface ReportMapper extends BaseMapper<Report> {
     List<Map<String, Object>> getPlanDataWithUser(Integer companyId, String startDate, String endDate, Integer filterDeptId);
 
     List<Map<String, Object>> getPlanDataWithUserId(Integer companyId,String userId, String startDate, String endDate);
+
+    @Select("SELECT plan.`product_scheduling_num`,plan.`product_name`, plan.`num`,prod_procedure.`name` AS '工序',report.`finish_num` AS '填报件数', report.`finish_num`/plan.`num` AS '件数占比',report.`cost`/plan_procedure_total.`total_wages` AS '实际填报工钱占比',\n" +
+            "plan_procedure_total.`total_wages` AS '总工序价钱', report.`cost` AS '填报价钱',\n" +
+            "report.* FROM report \n" +
+            "LEFT JOIN plan ON plan.id = report.`plan_id` \n" +
+            "LEFT JOIN plan_procedure_total ON plan_procedure_total.prod_procedure_id = report.`prod_procedure_id` AND plan_procedure_total.plan_id = report.`plan_id` \n" +
+            "LEFT JOIN prod_procedure_team pt ON pt.id = report.`user_procedure_team_id`\n" +
+            "LEFT JOIN prod_procedure ON prod_procedure.id = report.`prod_procedure_id`\n" +
+            "WHERE plan.`create_time` > '2024-01-01' AND report.`finish_num` > 0 AND ABS(report.`finish_num`/plan.`num`- report.`cost`/plan_procedure_total.`total_wages`) > 0.001")
+    List<Map<String, Object>> findFinishNumErrorData();
 }

+ 2 - 0
fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/service/ReportService.java

@@ -158,4 +158,6 @@ public interface ReportService extends IService<Report> {
     HttpRespMsg getUserCommentPlanResult(String pptIds);
 
     HttpRespMsg exportPlanDataWithUserId(String userId, String startDate, String endDate);
+
+    HttpRespMsg fixFinishNumData();
 }

+ 31 - 0
fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/service/impl/ReportServiceImpl.java

@@ -148,6 +148,14 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
         if (report.getFinishNum() == null) {
             report.setFinishNum(0.0);
         }
+        //对finishNum进行小数点位数控制,不得超过小数点后2位
+        int thirdPosNum = ((int)(report.getFinishNum()*1000))%10;
+        if (thirdPosNum > 0) {
+            httpRespMsg.setError("填报的件数小数点后不得超过2位");
+            return httpRespMsg;
+        }
+
+
         LocalDate targetDate = report.getCreateDate();
         report.setCompanyId(companyId);
         Plan plan = planMapper.selectById(report.getPlanId());
@@ -5900,4 +5908,27 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
         httpRespMsg.data ="/upload/"+fileName;
         return httpRespMsg;
     }
+
+    @Override
+    public HttpRespMsg fixFinishNumData() {
+        HttpRespMsg msg=new HttpRespMsg();
+        List<Map<String, Object>> dataList = reportMapper.findFinishNumErrorData();
+        System.out.println("总共找到错误数据:"+dataList.size());
+        List<Report> updateList=new ArrayList<>();
+        for (Map<String, Object> map : dataList) {
+            Integer id = Integer.valueOf(String.valueOf(map.get("id")));
+            Report report = new Report();
+            report.setId(id);
+            //完成件数=计划总件数*(实际填报工钱占比)
+            Integer num = (Integer) map.get("num");
+            double realFinishNum = num * (Double) map.get("实际填报工钱占比") ;
+            report.setFinishNum(realFinishNum);
+            updateList.add(report);
+        }
+        if (updateList.size() > 0) {
+            updateBatchById(updateList);
+        }
+        msg.setData("修复完成, 共修复"+updateList.size()+"条数据");
+        return msg;
+    }
 }

+ 4 - 3
fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/util/CodeUtil.java

@@ -1,5 +1,6 @@
 package com.management.platform.util;
 
+import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.text.DecimalFormat;
 import java.util.Random;
@@ -36,8 +37,8 @@ public class CodeUtil {
     }
 
     public static void main(String[] args) {
-        double temp = 1.45;
-        DecimalFormat decimalFormat = new DecimalFormat("0.#");
-        System.out.println(decimalFormat.format(temp));
+        double temp = 1.42;
+        int thirdPosNum = ((int)(temp*1000))%10;
+        System.out.println(thirdPosNum);
     }
 }

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

@@ -1838,7 +1838,7 @@
                             </div>
                         </template>
                     </el-table-column>
-                    <el-table-column  label="操作" v-if="user.companyId == 469 && user.roleName=='超级管理员'">
+                    <el-table-column  label="操作" v-if="showHidden && user.companyId == 469 && user.roleName=='超级管理员'">
                         <template slot-scope="scope">
                             <div>
                                 <el-button type="default" size="small" @click="openModImportTime(scope.row)">修改导入记录</el-button>
@@ -1932,12 +1932,12 @@
                 </p>
             </div>
             <div  slot="title">
-                <span style="font-size:16px;">{{$t('other.Batchimportofworkinghours')}}</span>
+                <span style="font-size:16px;" @click="showHiddenFunction">{{$t('other.Batchimportofworkinghours')}}</span>
                 <el-link v-if="active==0"  style="float:right;margin-right:100px;" type="primary" @click="toView()">{{$t('other.viewLaborImportRecords')}}</el-link>
                 <el-link v-if="active==0"  style="float:right;margin-right:100px;" type="primary" @click="downloadProjectRatio">下载填报工时占比表</el-link>
-                <el-link v-if="active==0 && user.companyId == 469 && user.roleName.indexOf('管理员') > 0"  style="float:right;margin-right:100px;" type="primary" @click="importCardTimeVisi = true">导入考勤时长</el-link>
-                <el-link v-if="active==0 && user.companyId == 469 && user.roleName == '超级管理员'"  style="float:right;margin-right:50px;" type="primary" @click="showBatchDeleteReport = true; startDeleting = false;">批量删除日报</el-link>
-                <el-link v-if="active==0 && user.companyId == 469 && user.roleName == '超级管理员'"  style="float:right;margin-right:50px;" type="primary" @click="showBatchSimpleApproveReport = true; startDeleting = false;getDepartmentForApprove();">批量审核日报</el-link>
+                <el-link v-if="active==0 && showHidden && user.companyId == 469 && user.roleName.indexOf('管理员') > 0"  style="float:right;margin-right:100px;" type="primary" @click="importCardTimeVisi = true">导入考勤时长</el-link>
+                <el-link v-if="active==0 && showHidden && user.companyId == 469 && user.roleName == '超级管理员'"  style="float:right;margin-right:50px;" type="primary" @click="showBatchDeleteReport = true; startDeleting = false;">批量删除日报</el-link>
+                <el-link v-if="active==0 && showHidden && user.companyId == 469 && user.roleName == '超级管理员'"  style="float:right;margin-right:50px;" type="primary" @click="showBatchSimpleApproveReport = true; startDeleting = false;getDepartmentForApprove();">批量审核日报</el-link>
             </div>
             
             <span slot="footer">
@@ -2150,6 +2150,7 @@
         },
         data() {
             return {
+                showHidden: false,
                 pageIndex: 0,
                 hasMore: true,
                 exportType: 0,
@@ -2567,6 +2568,9 @@
                 const isReportPictureRequired = permissionArray.some(item => item.id == companyId)
                 return isReportPictureRequired
             },
+            showHiddenFunction() {
+                this.showHidden = true;
+            },
             // 获取如何信息选的可填写部门
             getDeptMembData() {
                 this.http.post('/user/getUserInfo', {userId: this.user.id}, res => {