Browse Source

合同回退功能开发

ly 2 weeks ago
parent
commit
8ee1d5ceb4

+ 37 - 0
src/main/java/com/liang/controller/PrjContractXgController.java

@@ -4,8 +4,10 @@ import com.liang.common.JsonTool;
4 4
 import com.liang.common.base.BaseController;
5 5
 import com.liang.common.base.BaseResult;
6 6
 import com.liang.entity.PrjAnnualBudgetRecord;
7
+import com.liang.entity.PrjApproverecord;
7 8
 import com.liang.entity.PrjContract;
8 9
 import com.liang.entity.PrjContractXg;
10
+import com.liang.service.PrjApproverecordService;
9 11
 import com.liang.service.PrjContractXgService;
10 12
 import org.springframework.stereotype.Controller;
11 13
 import org.springframework.transaction.annotation.Transactional;
@@ -13,6 +15,8 @@ import org.springframework.ui.Model;
13 15
 import org.springframework.web.bind.annotation.*;
14 16
 
15 17
 import javax.annotation.Resource;
18
+import java.text.SimpleDateFormat;
19
+import java.util.Date;
16 20
 import java.util.List;
17 21
 
18 22
 /**
@@ -97,4 +101,37 @@ public class PrjContractXgController extends BaseController {
97 101
 
98 102
 
99 103
     }
104
+
105
+    @Resource
106
+    private  PrjApproverecordService prjApproverecordService;
107
+    @ResponseBody
108
+    @RequestMapping(value = "/updateHtht",method = RequestMethod.POST)
109
+    public BaseResult updateSpzt(@RequestBody PrjContractXg prjContractXg){
110
+        // 获取回退的数据
111
+        // 获取当前系统时间
112
+        Date data = new Date();
113
+        // 转换时间格式
114
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
115
+        prjContractXg.setSpzt("未锁定");
116
+        int mun = prjContractXgService.updateHtht(prjContractXg);
117
+        if (mun == 0){
118
+            return BaseResult.failure(1,"合同数据回退失败!");
119
+        }
120
+        PrjApproverecord prjApproverecord = new PrjApproverecord();
121
+        prjApproverecord.setTablename("prj_Contract");
122
+        prjApproverecord.setWc(true);
123
+        prjApproverecord.setTjsj(format.format(data));
124
+        prjApproverecord.setShsj(format.format(data));
125
+        prjApproverecord.setXmid(prjContractXg.getId());
126
+        prjApproverecord.setTjr(getSysUserId());
127
+        prjApproverecord.setShr(getSysUserId());
128
+        prjApproverecord.setSpcz("合同数据解锁");
129
+        prjApproverecord.setSffh(true);
130
+        prjApproverecord.setZt("合同解锁");
131
+        int num = prjApproverecordService.insert(prjApproverecord);
132
+        if (num == 0){
133
+            return BaseResult.failure(1,"合同数据回退失败");
134
+        }
135
+        return BaseResult.success("合同数据回退成功!");
136
+    }
100 137
 }

+ 2 - 0
src/main/java/com/liang/dao/PrjContractXgDao.java

@@ -19,4 +19,6 @@ public interface PrjContractXgDao {
19 19
     PrjContractXg queryRecordByHtId(Integer htId);
20 20
 
21 21
     int updateXg(@Param("Xg") PrjContractXg prjContractXg);
22
+
23
+    int updateHtht(PrjContractXg prjContractXg);
22 24
 }

+ 7 - 0
src/main/java/com/liang/service/PrjContractXgService.java

@@ -16,4 +16,11 @@ public interface PrjContractXgService {
16 16
     void deldteById(Integer id);
17 17
 
18 18
     void doUpdate(Integer xmid);
19
+
20
+    /**
21
+     * 合同状态回退
22
+     * @param prjContractXg
23
+     * @return
24
+     */
25
+    int updateHtht(PrjContractXg prjContractXg);
19 26
 }

+ 5 - 0
src/main/java/com/liang/service/impl/PrjContractXgServiceImpl.java

@@ -64,4 +64,9 @@ public class PrjContractXgServiceImpl implements PrjContractXgService {
64 64
         prjPayplanXgDao.deleteBtHtId(htId);
65 65
         }
66 66
     }
67
+
68
+    @Override
69
+    public int updateHtht(PrjContractXg prjContractXg) {
70
+        return this.prjContractXgDao.updateHtht(prjContractXg);
71
+    }
67 72
 }

+ 8 - 0
src/main/resources/mapper/PrjContractXgDao.xml

@@ -57,5 +57,13 @@
57 57
         where HTID = #{htId}
58 58
     </select>
59 59
 
60
+    <update id="updateHtht">
61
+        update prj_Contract
62
+        set
63
+            SPZT =#{spzt}
64
+        where ID =#{id}
65
+
66
+    </update>
67
+
60 68
 </mapper>
61 69
 

+ 30 - 2
src/main/resources/templates/prjcontract/list.html

@@ -526,10 +526,38 @@
526 526
                         layer.close(index);
527 527
                     }
528 528
                 });
529
-            }else if (obj.event === 'htht'){
530
-                console.log('回退按钮');
529
+            }
530
+        });
531
+        table.on('tool(currentTableFilter)',function (obj) {
532
+            var data = obj.data;
533
+            if (obj.event ==='htht'){
534
+                if (userId != 1 && userId != 42){
535
+                    layer.msg("暂无权限!",{icon: 2});
536
+                    return;
537
+                }else if (data.spzt != '已锁定'){
538
+                    layer.msg('数据未锁定,无需回退!',{icon: 2});
539
+                    return;
540
+                }else {
541
+                    AjaxUtil.post({
542
+                        url: AjaxUtil.ctx +'prjContractXg/updateHtht',
543
+                        contentType:"application/json",
544
+                        data: JSON.stringify(data),
545
+                        success: function (res) {
546
+                            if (res.code === 0){
547
+                                layer.msg(res.message,{icon:1});
548
+                                // 表格重载
549
+                                currTable.reload();
550
+                            }
551
+                        },
552
+                        error:function (error) {
553
+                            layer.msg('系统异常,请联系管理员!',{icon:3});
554
+
555
+                        }
556
+                    });
557
+                }
531 558
 
532 559
             }
560
+
533 561
         });
534 562
 
535 563
         //双击