Commit d8bb7d0fd17588d407ce02769f29f18b605215af

Authored by yiming
1 parent 38764770

bf

bsthLineProfiles/src/main/java/com/ruoyi/project/system/line/controller/BsthTLineExamineController.java
1 1 package com.ruoyi.project.system.line.controller;
2 2  
3   -import com.ruoyi.common.utils.poi.ExcelUtil;
4   -import com.ruoyi.common.utils.security.ShiroUtils;
5   -import com.ruoyi.framework.aspectj.lang.annotation.Log;
6   -import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
  3 +
7 4 import com.ruoyi.framework.web.controller.BaseController;
8 5 import com.ruoyi.framework.web.domain.AjaxResult;
9 6 import com.ruoyi.framework.web.page.TableDataInfo;
10   -import com.ruoyi.project.system.dict.domain.DictData;
  7 +
11 8 import com.ruoyi.project.system.dict.service.IDictDataService;
12 9 import com.ruoyi.project.system.line.domain.BsthTLine;
13 10 import com.ruoyi.project.system.line.service.IBsthTLineService;
14   -import com.ruoyi.project.system.user.domain.User;
  11 +
15 12 import com.ruoyi.project.system.user.service.IUserService;
16 13 import org.apache.shiro.authz.annotation.RequiresPermissions;
17 14 import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -19,13 +16,9 @@ import org.springframework.stereotype.Controller;
19 16 import org.springframework.ui.ModelMap;
20 17 import org.springframework.web.bind.annotation.*;
21 18  
22   -import java.io.File;
23   -import java.lang.reflect.Field;
24   -import java.lang.reflect.Method;
25   -import java.util.ArrayList;
26   -import java.util.HashMap;
  19 +
27 20 import java.util.List;
28   -import java.util.Map;
  21 +
29 22  
30 23 /**
31 24 * 【请填写功能名称】Controller
... ... @@ -47,8 +40,7 @@ public class BsthTLineExamineController extends BaseController
47 40 IDictDataService dictDataService;
48 41  
49 42  
50   - @Autowired
51   - private IUserService userService;
  43 +
52 44  
53 45 @RequiresPermissions("system:line:view")
54 46 @GetMapping()
... ...
bsthLineProfiles/src/main/java/com/ruoyi/project/system/line/controller/BsthTLineHistoryController.java
... ... @@ -86,6 +86,9 @@ public class BsthTLineHistoryController extends BaseController
86 86 if(bsthTLineExamine!=null){
87 87 bsthTLine=bsthTLineExamine;
88 88 }
  89 + bsthTLine.setUpdateStatus("1");
  90 + boolean flag=bsthTLineService.selectHistoryByLineNameAndUpdateStatus(bsthTLine)!=null?true:false;
  91 + mmap.put("flag",flag);
89 92 mmap.put("bsthTLine", bsthTLine);
90 93 return prefix + "/edit";
91 94 }
... ... @@ -99,17 +102,30 @@ public class BsthTLineHistoryController extends BaseController
99 102 @ResponseBody
100 103 public AjaxResult editSave(BsthTLine bsthTLine)
101 104 {
  105 + AjaxResult ajaxResult;
102 106 User loginUser = ShiroUtils.getSysUser();
103 107 bsthTLine.setUpdateBy(loginUser.getUserName());
104 108 String lineName=bsthTLine.getLineName();
  109 +
105 110 BsthTLine bsthTLineExamine=bsthTLineService.selectBsthTLineExamineByLineName(lineName);
106 111 if(bsthTLineExamine!=null){//有没审核的直接覆盖
107 112 bsthTLine.setId(bsthTLineExamine.getId());
108   - return toAjax(bsthTLineService.updateBsthTLineExamine(bsthTLine));
  113 + ajaxResult= toAjax(bsthTLineService.updateBsthTLineExamine(bsthTLine));
109 114 }else {//没有新增
110 115 bsthTLine.setExamineType("1");
111   - return toAjax(bsthTLineService.insertBsthTLineExamine(bsthTLine));
  116 + ajaxResult= toAjax(bsthTLineService.insertBsthTLineExamine(bsthTLine));
  117 + }
  118 + BsthTLine bl=new BsthTLine();
  119 + bl.setLineName(lineName);
  120 + bl.setUpdateStatus("1");
  121 +
  122 + //重复提交删除上一次通过未执行的申请
  123 + bl=bsthTLineService.selectHistoryByLineNameAndUpdateStatus(bl);
  124 + if(bl!=null){
  125 + bsthTLineService.deleteBsthTLineHistoryById(bl.getId());
112 126 }
  127 +
  128 + return ajaxResult;
113 129 }
114 130  
115 131  
... ...
bsthLineProfiles/src/main/java/com/ruoyi/project/system/line/mapper/BsthTLineMapper.java
... ... @@ -55,7 +55,7 @@ public interface BsthTLineMapper
55 55  
56 56 List<BsthTLine> findNeedUpdateHistory();
57 57  
58   - BsthTLine historyIsExist(String lineName);
  58 + BsthTLine selectHistoryByLineNameAndUpdateStatus(BsthTLine bsthTLine);
59 59  
60 60 int insertLineEditRepot(LineEditReport lineEditReport);
61 61  
... ... @@ -67,6 +67,7 @@ public interface BsthTLineMapper
67 67  
68 68 List<BsthTLine> selectHistoryListNotUpdate(BsthTLine bsthTLine);
69 69  
  70 + int deleteBsthTLineHistoryById(Long id);
70 71  
71 72 /*int createLineMonthReport(BsthTLine line);*/
72 73  
... ...
bsthLineProfiles/src/main/java/com/ruoyi/project/system/line/service/IBsthTLineService.java
... ... @@ -41,12 +41,6 @@ public interface IBsthTLineService
41 41  
42 42 List<BsthTLine> getListByName(String object);
43 43  
44   -
45   -
46   -
47   -
48   -
49   -
50 44 List<BsthTLine> selectBsthTLineExamineList(BsthTLine bsthTLine);
51 45  
52 46 int insertBsthTLineExamine(BsthTLine bsthTLine);
... ... @@ -55,7 +49,6 @@ public interface IBsthTLineService
55 49  
56 50 int updateBsthTLineExamine(BsthTLine bsthTLine);
57 51  
58   -
59 52 int deleteBsthTLineExamineById(String ids);
60 53  
61 54 int examine(BsthTLine bsthTLine);
... ... @@ -64,5 +57,8 @@ public interface IBsthTLineService
64 57  
65 58 boolean lineNameIsExist(String lineName);
66 59  
  60 + BsthTLine selectHistoryByLineNameAndUpdateStatus(BsthTLine bsthTLine);
  61 +
  62 + int deleteBsthTLineHistoryById(Long id);
67 63 /*int createLineMonthReport();*/
68 64 }
... ...
bsthLineProfiles/src/main/java/com/ruoyi/project/system/line/service/impl/BsthTLineServiceImpl.java
... ... @@ -262,15 +262,16 @@ public class BsthTLineServiceImpl implements IBsthTLineService
262 262 lineEditReport.setVehiclesNumberBefore(line.getVehiclesNumber());
263 263 lineEditReport.setNumberPersonBefore(line.getNumberPerson());
264 264  
265   - //判断是否当前记录
266   - BsthTLine bl=bsthTLineMapper.historyIsExist(line.getLineName());
267   - if(bl!=null){//存在改为历史
268   - bl.setUpdateStatus("-1");
269   - bsthTLineMapper.updateBsthTLineHistory(bl);
270   - }else {//不存在把运营数据插入
271   - bl.setUpdateStatus("-1");
272   - bsthTLineMapper.saveEditHistory(line);
273   - }
  265 +
  266 + BsthTLine bl=new BsthTLine();
  267 + bl.setLineName(history.getLineName());
  268 + bl.setUpdateStatus("0");
  269 + bl=bsthTLineMapper.selectHistoryByLineNameAndUpdateStatus(bl);
  270 + //修改状态 当前->历史
  271 + bl.setUpdateStatus("-1");
  272 + bsthTLineMapper.updateBsthTLineHistory(bl);
  273 +
  274 +
274 275  
275 276 //更新运营数据
276 277 Date d = new Date();
... ... @@ -371,9 +372,12 @@ public class BsthTLineServiceImpl implements IBsthTLineService
371 372 if(bsthTLine.getId()!=null){
372 373 if("0".equals(bsthTLine.getExamineType())){//新增
373 374 if("2".equals(bsthTLine.getExamineStatus())){//通过
374   - //存入主表
  375 + //存入主表和历史表
375 376 bl=bsthTLineMapper.selectBsthTLineExamineById(bsthTLine.getId());
  377 + bl.setUpdateStatus("0");
  378 + bsthTLineMapper.saveEditHistory(bl);
376 379 i=bsthTLineMapper.insertBsthTLine(bl);
  380 +
377 381 //删除审核表
378 382 bsthTLineMapper.deleteBsthTLineExamineById(new String[]{bsthTLine.getId().toString()});
379 383 }else{//未通过
... ... @@ -428,4 +432,14 @@ public class BsthTLineServiceImpl implements IBsthTLineService
428 432 return flag;
429 433 }
430 434  
  435 + @Override
  436 + public BsthTLine selectHistoryByLineNameAndUpdateStatus(BsthTLine bsthTLine){
  437 + return bsthTLineMapper.selectHistoryByLineNameAndUpdateStatus(bsthTLine);
  438 + }
  439 +
  440 + @Override
  441 + public int deleteBsthTLineHistoryById(Long id){
  442 + return bsthTLineMapper.deleteBsthTLineHistoryById(id);
  443 + }
  444 +
431 445 }
... ...
bsthLineProfiles/src/main/resources/mybatis/mybatis/system/BsthTLineMapper.xml
... ... @@ -1443,10 +1443,10 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
1443 1443 </select>
1444 1444  
1445 1445  
1446   - <select id="historyIsExist" parameterType="String"
  1446 + <select id="selectHistoryByLineNameAndUpdateStatus" parameterType="BsthTLine"
1447 1447 resultMap="BsthTLineResult">
1448 1448 <include refid="selectBsthTLineHistoryVo" />
1449   - where line_name= #{lineName} and update_status='0'
  1449 + where line_name= #{lineName} and update_status=#{updateStatus}
1450 1450 </select>
1451 1451  
1452 1452  
... ... @@ -1695,6 +1695,9 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
1695 1695 </where>
1696 1696 </select>
1697 1697  
  1698 + <delete id="deleteBsthTLineHistoryById" parameterType="Long">
  1699 + delete from bsth_t_line_history where id=#{id}
  1700 + </delete>
1698 1701  
1699 1702  
1700 1703 <!--
... ...
bsthLineProfiles/src/main/resources/templates/system/lineHistory/edit.html
... ... @@ -507,7 +507,7 @@
507 507 <div class="form-group">
508 508 <label class="col-sm-3 control-label">低谷系数:</label>
509 509 <div class="col-sm-8">
510   - <input name="lowCustomerPercent" th:field="*{lowCustomerPercent}"
  510 + <input name="lowCustomerPercent" id="lowCustomerPercent" th:field="*{lowCustomerPercent}"
511 511 class="form-control" type="text">
512 512 </div>
513 513 </div>
... ... @@ -682,7 +682,7 @@
682 682 <th:block th:include="include :: bootstrap-fileinput-js" />
683 683 <script th:inline="javascript">
684 684 var prefix = ctx + "system/lineHistory";
685   -
  685 + var f=[[${flag}]];
686 686 $(function() {
687 687 /* $.get("/system/line/getUserLineInfo",function(data){
688 688 if(data.msg != null){
... ... @@ -751,12 +751,10 @@
751 751 var bsthTLineOld=data[0];
752 752 var bsthTLineNew=data[1];
753 753 if(bsthTLineNew!=null){
754   - console.log(bsthTLineNew)
755 754 for(let i in bsthTLineOld){
756 755 var o=bsthTLineOld[i]==null?'':bsthTLineOld[i];
757 756 var n=bsthTLineNew[i]==null?'':bsthTLineNew[i];
758 757 if(o!=n){
759   - console.log(i)
760 758 i=i=='fcompany'?'fCompany':i;
761 759 i=i=='plineId'?'pLineId':i;
762 760 var input=document.getElementsByName(i)[0];
... ... @@ -882,6 +880,8 @@
882 880 minView : "month",
883 881 autoclose : true
884 882 });
  883 +
  884 +
885 885 </script>
886 886 </body>
887 887 </html>
888 888 \ No newline at end of file
... ...
bsthLineProfiles/src/main/resources/templates/system/lineHistory/line.html
... ... @@ -62,10 +62,6 @@
62 62  
63 63 <script th:inline="javascript">
64 64  
65   - function add(obj){
66   - if($(obj)[0].className.indexOf("disabled") == -1)
67   - $.operate.add();
68   - }
69 65  
70 66 new Vue({
71 67 el: '#context',
... ... @@ -498,9 +494,23 @@
498 494 btn: ['变更', '返回'],
499 495 // 弹层外区域关闭
500 496 shadeClose: true,
501   - yes: callback
  497 + yes: function(index, layero){
  498 + var iframe = window["layui-layer-iframe" + index];
  499 + if(iframe.f==true){
  500 + layer.confirm("存在待执行的申请,是否重新申请",{
  501 + btn: ['是', '否']
  502 + },function (index, layero) {
  503 + iframe.submitHandler(index, layero);
  504 + layer.close(index);
  505 + });
  506 + }else {
  507 + iframe.submitHandler(index, layero);
  508 + }
  509 + },
502 510 });
  511 +
503 512 }
  513 +
504 514 </script>
505 515 <style>
506 516 .col_checkbox {
... ...