Browse Source

解决雪花id重复问题

lamphua 1 year ago
parent
commit
2b6d8a2a3c

+ 2
- 1
oa-back/ruoyi-admin/src/main/java/com/ruoyi/web/controller/oa/CmcBorrowDetailController.java View File

72
      */
72
      */
73
     @Log(title = "cmc借款明细", businessType = BusinessType.INSERT)
73
     @Log(title = "cmc借款明细", businessType = BusinessType.INSERT)
74
     @PostMapping
74
     @PostMapping
75
-    public AjaxResult add(@RequestBody CmcBorrowDetail cmcBorrowDetail)
75
+    public AjaxResult add(@RequestBody CmcBorrowDetail cmcBorrowDetail) throws InterruptedException
76
     {
76
     {
77
+        Thread.sleep(1);
77
         cmcBorrowDetail.setBorrowDetailId(new SnowFlake().generateId());
78
         cmcBorrowDetail.setBorrowDetailId(new SnowFlake().generateId());
78
         return toAjax(cmcBorrowDetailService.insertCmcBorrowDetail(cmcBorrowDetail));
79
         return toAjax(cmcBorrowDetailService.insertCmcBorrowDetail(cmcBorrowDetail));
79
     }
80
     }

+ 2
- 1
oa-back/ruoyi-admin/src/main/java/com/ruoyi/web/controller/oa/CmcBudgetCarController.java View File

73
      */
73
      */
74
     @Log(title = "cmc车辆预算", businessType = BusinessType.INSERT)
74
     @Log(title = "cmc车辆预算", businessType = BusinessType.INSERT)
75
     @PostMapping
75
     @PostMapping
76
-    public AjaxResult add(@RequestBody CmcBudgetCar cmcBudgetCar)
76
+    public AjaxResult add(@RequestBody CmcBudgetCar cmcBudgetCar) throws InterruptedException
77
     {
77
     {
78
+        Thread.sleep(1);
78
         cmcBudgetCar.setBudgetCarId(new SnowFlake().generateId());
79
         cmcBudgetCar.setBudgetCarId(new SnowFlake().generateId());
79
         return toAjax(cmcBudgetCarService.insertCmcBudgetCar(cmcBudgetCar));
80
         return toAjax(cmcBudgetCarService.insertCmcBudgetCar(cmcBudgetCar));
80
     }
81
     }

+ 2
- 1
oa-back/ruoyi-admin/src/main/java/com/ruoyi/web/controller/oa/CmcBudgetDeviceController.java View File

73
      */
73
      */
74
     @Log(title = "cmc设备预算", businessType = BusinessType.INSERT)
74
     @Log(title = "cmc设备预算", businessType = BusinessType.INSERT)
75
     @PostMapping
75
     @PostMapping
76
-    public AjaxResult add(@RequestBody CmcBudgetDevice cmcBudgetDevice)
76
+    public AjaxResult add(@RequestBody CmcBudgetDevice cmcBudgetDevice) throws InterruptedException
77
     {
77
     {
78
+        Thread.sleep(1);
78
         cmcBudgetDevice.setBudgetDeviceId(new SnowFlake().generateId());
79
         cmcBudgetDevice.setBudgetDeviceId(new SnowFlake().generateId());
79
         return toAjax(cmcBudgetDeviceService.insertCmcBudgetDevice(cmcBudgetDevice));
80
         return toAjax(cmcBudgetDeviceService.insertCmcBudgetDevice(cmcBudgetDevice));
80
     }
81
     }

+ 2
- 1
oa-back/ruoyi-admin/src/main/java/com/ruoyi/web/controller/oa/CmcBudgetSettleController.java View File

73
      */
73
      */
74
     @Log(title = "cmc预结算", businessType = BusinessType.INSERT)
74
     @Log(title = "cmc预结算", businessType = BusinessType.INSERT)
75
     @PostMapping
75
     @PostMapping
76
-    public AjaxResult add(@RequestBody CmcBudgetSettle cmcBudgetSettle)
76
+    public AjaxResult add(@RequestBody CmcBudgetSettle cmcBudgetSettle) throws InterruptedException
77
     {
77
     {
78
+        Thread.sleep(1);
78
         cmcBudgetSettle.setBudgetSettleId(new SnowFlake().generateId());
79
         cmcBudgetSettle.setBudgetSettleId(new SnowFlake().generateId());
79
         return toAjax(cmcBudgetSettleService.insertCmcBudgetSettle(cmcBudgetSettle));
80
         return toAjax(cmcBudgetSettleService.insertCmcBudgetSettle(cmcBudgetSettle));
80
     }
81
     }

+ 2
- 1
oa-back/ruoyi-admin/src/main/java/com/ruoyi/web/controller/oa/CmcBudgetStaffController.java View File

73
      */
73
      */
74
     @Log(title = "cmc人员预算", businessType = BusinessType.INSERT)
74
     @Log(title = "cmc人员预算", businessType = BusinessType.INSERT)
75
     @PostMapping
75
     @PostMapping
76
-    public AjaxResult add(@RequestBody CmcBudgetStaff cmcBudgetStaff)
76
+    public AjaxResult add(@RequestBody CmcBudgetStaff cmcBudgetStaff) throws InterruptedException
77
     {
77
     {
78
+        Thread.sleep(1);
78
         cmcBudgetStaff.setBudgetStaffId(new SnowFlake().generateId());
79
         cmcBudgetStaff.setBudgetStaffId(new SnowFlake().generateId());
79
         return toAjax(cmcBudgetStaffService.insertCmcBudgetStaff(cmcBudgetStaff));
80
         return toAjax(cmcBudgetStaffService.insertCmcBudgetStaff(cmcBudgetStaff));
80
     }
81
     }

+ 6
- 1
oa-back/ruoyi-admin/src/main/java/com/ruoyi/web/controller/oa/CmcContractCommentController.java View File

1
 package com.ruoyi.web.controller.oa;
1
 package com.ruoyi.web.controller.oa;
2
 
2
 
3
+import java.util.Date;
3
 import java.util.List;
4
 import java.util.List;
5
+import java.util.Objects;
4
 import javax.servlet.http.HttpServletResponse;
6
 import javax.servlet.http.HttpServletResponse;
5
 
7
 
6
 import com.ruoyi.common.utils.SnowFlake;
8
 import com.ruoyi.common.utils.SnowFlake;
73
      */
75
      */
74
     @Log(title = "cmc合同意见", businessType = BusinessType.INSERT)
76
     @Log(title = "cmc合同意见", businessType = BusinessType.INSERT)
75
     @PostMapping
77
     @PostMapping
76
-    public AjaxResult add(@RequestBody CmcContractComment cmcContractComment)
78
+    public AjaxResult add(@RequestBody CmcContractComment cmcContractComment) throws InterruptedException
77
     {
79
     {
80
+        Thread.sleep(1);
78
         cmcContractComment.setCommentId(new SnowFlake().generateId());
81
         cmcContractComment.setCommentId(new SnowFlake().generateId());
79
         return toAjax(cmcContractCommentService.insertCmcContractComment(cmcContractComment));
82
         return toAjax(cmcContractCommentService.insertCmcContractComment(cmcContractComment));
80
     }
83
     }
86
     @PutMapping
89
     @PutMapping
87
     public AjaxResult edit(@RequestBody CmcContractComment cmcContractComment)
90
     public AjaxResult edit(@RequestBody CmcContractComment cmcContractComment)
88
     {
91
     {
92
+        if (Objects.equals(cmcContractComment.getUserId(), getLoginUser().getUserId()))
93
+            cmcContractComment.setCommentTime(new Date());
89
         return toAjax(cmcContractCommentService.updateCmcContractComment(cmcContractComment));
94
         return toAjax(cmcContractCommentService.updateCmcContractComment(cmcContractComment));
90
     }
95
     }
91
 
96
 

+ 5
- 0
oa-back/ruoyi-admin/src/main/java/com/ruoyi/web/controller/oa/CmcContractController.java View File

1
 package com.ruoyi.web.controller.oa;
1
 package com.ruoyi.web.controller.oa;
2
 
2
 
3
+import java.util.Date;
3
 import java.util.List;
4
 import java.util.List;
4
 import javax.servlet.http.HttpServletResponse;
5
 import javax.servlet.http.HttpServletResponse;
5
 import org.springframework.beans.factory.annotation.Autowired;
6
 import org.springframework.beans.factory.annotation.Autowired;
82
     @PutMapping
83
     @PutMapping
83
     public AjaxResult edit(@RequestBody CmcContract cmcContract)
84
     public AjaxResult edit(@RequestBody CmcContract cmcContract)
84
     {
85
     {
86
+        if (cmcContract.getManagerComment() != null && cmcContract.getSignDate() == null) {
87
+            cmcContract.setManagerUserId(getLoginUser().getUserId());
88
+            cmcContract.setManagerTime(new Date());
89
+        }
85
         return toAjax(cmcContractService.updateCmcContract(cmcContract));
90
         return toAjax(cmcContractService.updateCmcContract(cmcContract));
86
     }
91
     }
87
 
92
 

+ 2
- 1
oa-back/ruoyi-admin/src/main/java/com/ruoyi/web/controller/oa/CmcContractPaymentController.java View File

73
      */
73
      */
74
     @Log(title = "cmc合同回款", businessType = BusinessType.INSERT)
74
     @Log(title = "cmc合同回款", businessType = BusinessType.INSERT)
75
     @PostMapping
75
     @PostMapping
76
-    public AjaxResult add(@RequestBody CmcContractPayment cmcContractPayment)
76
+    public AjaxResult add(@RequestBody CmcContractPayment cmcContractPayment) throws InterruptedException
77
     {
77
     {
78
+        Thread.sleep(1);
78
         cmcContractPayment.setPaymentId(new SnowFlake().generateId());
79
         cmcContractPayment.setPaymentId(new SnowFlake().generateId());
79
         return toAjax(cmcContractPaymentService.insertCmcContractPayment(cmcContractPayment));
80
         return toAjax(cmcContractPaymentService.insertCmcContractPayment(cmcContractPayment));
80
     }
81
     }

+ 2
- 1
oa-back/ruoyi-admin/src/main/java/com/ruoyi/web/controller/oa/CmcContractWorkController.java View File

73
      */
73
      */
74
     @Log(title = "cmc合同内容", businessType = BusinessType.INSERT)
74
     @Log(title = "cmc合同内容", businessType = BusinessType.INSERT)
75
     @PostMapping
75
     @PostMapping
76
-    public AjaxResult add(@RequestBody CmcContractWork cmcContractWork)
76
+    public AjaxResult add(@RequestBody CmcContractWork cmcContractWork) throws InterruptedException
77
     {
77
     {
78
+        Thread.sleep(1);
78
         cmcContractWork.setWorkId(new SnowFlake().generateId());
79
         cmcContractWork.setWorkId(new SnowFlake().generateId());
79
         return toAjax(cmcContractWorkService.insertCmcContractWork(cmcContractWork));
80
         return toAjax(cmcContractWorkService.insertCmcContractWork(cmcContractWork));
80
     }
81
     }

+ 2
- 1
oa-back/ruoyi-admin/src/main/java/com/ruoyi/web/controller/oa/CmcProjectProgressController.java View File

72
      */
72
      */
73
     @Log(title = "cmc项目进度", businessType = BusinessType.INSERT)
73
     @Log(title = "cmc项目进度", businessType = BusinessType.INSERT)
74
     @PostMapping
74
     @PostMapping
75
-    public AjaxResult add(@RequestBody CmcProjectProgress cmcProjectProgress)
75
+    public AjaxResult add(@RequestBody CmcProjectProgress cmcProjectProgress) throws InterruptedException
76
     {
76
     {
77
+        Thread.sleep(1);
77
         cmcProjectProgress.setProgressId(new SnowFlake().generateId());
78
         cmcProjectProgress.setProgressId(new SnowFlake().generateId());
78
         return toAjax(cmcProjectProgressService.insertCmcProjectProgress(cmcProjectProgress));
79
         return toAjax(cmcProjectProgressService.insertCmcProjectProgress(cmcProjectProgress));
79
     }
80
     }

+ 2
- 1
oa-back/ruoyi-admin/src/main/java/com/ruoyi/web/controller/oa/CmcProjectWorkController.java View File

72
      */
72
      */
73
     @Log(title = "cmc项目内容", businessType = BusinessType.INSERT)
73
     @Log(title = "cmc项目内容", businessType = BusinessType.INSERT)
74
     @PostMapping
74
     @PostMapping
75
-    public AjaxResult add(@RequestBody CmcProjectWork cmcProjectWork)
75
+    public AjaxResult add(@RequestBody CmcProjectWork cmcProjectWork) throws InterruptedException
76
     {
76
     {
77
+        Thread.sleep(1);
77
         cmcProjectWork.setWorkId(new SnowFlake().generateId());
78
         cmcProjectWork.setWorkId(new SnowFlake().generateId());
78
         return toAjax(cmcProjectWorkService.insertCmcProjectWork(cmcProjectWork));
79
         return toAjax(cmcProjectWorkService.insertCmcProjectWork(cmcProjectWork));
79
     }
80
     }

+ 20
- 18
oa-ui/src/views/flowable/form/contractForm.vue View File

136
             <el-button icon="el-icon-plus" size="mini" @click="addPaymentList()" type="primary" plain></el-button>
136
             <el-button icon="el-icon-plus" size="mini" @click="addPaymentList()" type="primary" plain></el-button>
137
           </el-form-item>
137
           </el-form-item>
138
           <el-form-item label="合同备注" prop="remark">
138
           <el-form-item label="合同备注" prop="remark">
139
-            <el-input v-model="form.remark" placeholder="请输入合同备注" />
139
+            <el-input v-model="form.remark" placeholder="请输入合同备注" :disabled="taskName != '合同拟稿'" />
140
           </el-form-item>
140
           </el-form-item>
141
           <el-row>
141
           <el-row>
142
             <el-col :span="6" :xs="24" :offset="12">
142
             <el-col :span="6" :xs="24" :offset="12">
189
                 </td>
189
                 </td>
190
                 <td>
190
                 <td>
191
                   <el-input v-model="comment.comment" type="textarea" clearable :autosize="{ minRows: 4, maxRows: 10 }"
191
                   <el-input v-model="comment.comment" type="textarea" clearable :autosize="{ minRows: 4, maxRows: 10 }"
192
-                    :disabled="taskName == '合同拟稿' || !comment.commentUser"></el-input>
192
+                    :disabled="taskName != '线上会审' || (taskName == '线上会审' && !comment.commentUser)"></el-input>
193
                 </td>
193
                 </td>
194
                 <td>
194
                 <td>
195
                   <el-input v-model="comment.document" clearable
195
                   <el-input v-model="comment.document" clearable
196
-                    :disabled="taskName == '合同拟稿' || !comment.commentUser"></el-input>
196
+                    :disabled="taskName != '线上会审' || (taskName == '线上会审' && !comment.commentUser)"></el-input>
197
                 </td>
197
                 </td>
198
                 <td>
198
                 <td>
199
                   <span class="auditor"> {{ comment.commentUser ? comment.commentUser.nickName : '' }} </span>
199
                   <span class="auditor"> {{ comment.commentUser ? comment.commentUser.nickName : '' }} </span>
265
             </table>
265
             </table>
266
           </el-form-item>
266
           </el-form-item>
267
           <el-form-item label="分管审批意见" prop="remark">
267
           <el-form-item label="分管审批意见" prop="remark">
268
-            <el-input v-model="form.managerComment" placeholder="请输入分管审批意见" />
268
+            <el-input v-model="form.managerComment" placeholder="请输入分管审批意见" :disabled="taskName != '分管审核'" />
269
           </el-form-item>
269
           </el-form-item>
270
           <el-row>
270
           <el-row>
271
             <el-col :span="6" :xs="24" :offset="12">
271
             <el-col :span="6" :xs="24" :offset="12">
281
           </el-row>
281
           </el-row>
282
           <el-divider></el-divider>
282
           <el-divider></el-divider>
283
           <el-form-item label="签订日期" prop="signDate">
283
           <el-form-item label="签订日期" prop="signDate">
284
-            <el-date-picker clearable v-model="form.signDate" type="date" value-format="yyyy-MM-dd" placeholder="请选择签订日期">
284
+            <el-date-picker clearable v-model="form.signDate" type="date" value-format="yyyy-MM-dd" placeholder="请选择签订日期"
285
+              :disabled="taskName != '合同签订'">
285
             </el-date-picker>
286
             </el-date-picker>
286
           </el-form-item>
287
           </el-form-item>
287
           <el-form-item label="签订备注" prop="signRemark">
288
           <el-form-item label="签订备注" prop="signRemark">
288
-            <el-input v-model="form.signRemark" placeholder="请输入签订备注" />
289
+            <el-input v-model="form.signRemark" placeholder="请输入签订备注" :disabled="taskName != '合同签订'" />
289
           </el-form-item>
290
           </el-form-item>
290
           <el-form-item label="签订扫描件" prop="signScan">
291
           <el-form-item label="签订扫描件" prop="signScan">
291
-            <el-input v-model="form.signScan" placeholder="请输入签订扫描件" />
292
+            <el-input v-model="form.signScan" placeholder="请输入签订扫描件" :disabled="taskName != '合同签订'" />
292
           </el-form-item>
293
           </el-form-item>
293
         </el-form>
294
         </el-form>
294
         <div style="text-align: center;">
295
         <div style="text-align: center;">
315
 import { listContract, getContract, delContract, addContract, updateContract } from "@/api/oa/contract/contract";
316
 import { listContract, getContract, delContract, addContract, updateContract } from "@/api/oa/contract/contract";
316
 import { getContractWork, addContractWork } from "@/api/oa/contract/contractWork";
317
 import { getContractWork, addContractWork } from "@/api/oa/contract/contractWork";
317
 import { getContractPayment, addContractPayment } from "@/api/oa/contract/contractPayment";
318
 import { getContractPayment, addContractPayment } from "@/api/oa/contract/contractPayment";
318
-import { getContractComment, addContractComment, delContractComment } from "@/api/oa/contract/contractComment";
319
+import { getContractComment, addContractComment, updateContractComment } from "@/api/oa/contract/contractComment";
319
 import { getContractMeeting, addContractMeeting } from "@/api/oa/contract/contractMeeting";
320
 import { getContractMeeting, addContractMeeting } from "@/api/oa/contract/contractMeeting";
320
 import { complete, rejectTask, returnList, returnTask, getNextFlowNode, delegate, flowTaskForm, } from "@/api/flowable/todo";
321
 import { complete, rejectTask, returnList, returnTask, getNextFlowNode, delegate, flowTaskForm, } from "@/api/flowable/todo";
321
 import { listTender, getTender } from "@/api/oa/tender/tender";
322
 import { listTender, getTender } from "@/api/oa/tender/tender";
501
             if (res.data)
502
             if (res.data)
502
               this.commentList = res.data;
503
               this.commentList = res.data;
503
             for (let comment of this.commentList) {
504
             for (let comment of this.commentList) {
504
-              if (comment.userId != this.$store.getters.userId) {
505
-                comment.commentUser = undefined;
505
+              if (comment.commentTime == undefined) {
506
+                if (comment.userId != this.$store.getters.userId) {
507
+                  comment.commentUser = undefined;
508
+                }
509
+                else {
510
+                  comment.commentTime = parseTime(new Date(), '{y}-{m}-{d}');
511
+                }
506
               }
512
               }
507
-              else
508
-                comment.commentTime = parseTime(new Date(), '{y}-{m}-{d}');
509
             }
513
             }
510
           });
514
           });
511
           getContractMeeting(this.taskForm.formId).then(res => {
515
           getContractMeeting(this.taskForm.formId).then(res => {
759
                 });
763
                 });
760
               }
764
               }
761
               else if (this.taskName == '线上会审') {
765
               else if (this.taskName == '线上会审') {
762
-                delContractComment([this.form.contractId]).then(res => {
763
-                  for (let comment of this.commentList) {
764
-                    commment.contractId = this.form.contractId
765
-                    addContractComment(comment);
766
-                  }
767
-                })
766
+                console.log(this.commentList);
767
+                for (let comment of this.commentList) {
768
+                  updateContractComment(comment);
769
+                }
768
                 getUsersManageLeader({ userId: this.form.drafter }).then(res => {
770
                 getUsersManageLeader({ userId: this.form.drafter }).then(res => {
769
                   let userId = res.data.userId;
771
                   let userId = res.data.userId;
770
                   this.$set(this.taskForm.variables, "approval", userId);
772
                   this.$set(this.taskForm.variables, "approval", userId);

Loading…
Cancel
Save