Commit d8bb7d0fd17588d407ce02769f29f18b605215af

Authored by yiming
1 parent 38764770

bf

bsthLineProfiles/src/main/java/com/ruoyi/project/system/line/controller/BsthTLineExamineController.java
1 package com.ruoyi.project.system.line.controller; 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 import com.ruoyi.framework.web.controller.BaseController; 4 import com.ruoyi.framework.web.controller.BaseController;
8 import com.ruoyi.framework.web.domain.AjaxResult; 5 import com.ruoyi.framework.web.domain.AjaxResult;
9 import com.ruoyi.framework.web.page.TableDataInfo; 6 import com.ruoyi.framework.web.page.TableDataInfo;
10 -import com.ruoyi.project.system.dict.domain.DictData; 7 +
11 import com.ruoyi.project.system.dict.service.IDictDataService; 8 import com.ruoyi.project.system.dict.service.IDictDataService;
12 import com.ruoyi.project.system.line.domain.BsthTLine; 9 import com.ruoyi.project.system.line.domain.BsthTLine;
13 import com.ruoyi.project.system.line.service.IBsthTLineService; 10 import com.ruoyi.project.system.line.service.IBsthTLineService;
14 -import com.ruoyi.project.system.user.domain.User; 11 +
15 import com.ruoyi.project.system.user.service.IUserService; 12 import com.ruoyi.project.system.user.service.IUserService;
16 import org.apache.shiro.authz.annotation.RequiresPermissions; 13 import org.apache.shiro.authz.annotation.RequiresPermissions;
17 import org.springframework.beans.factory.annotation.Autowired; 14 import org.springframework.beans.factory.annotation.Autowired;
@@ -19,13 +16,9 @@ import org.springframework.stereotype.Controller; @@ -19,13 +16,9 @@ import org.springframework.stereotype.Controller;
19 import org.springframework.ui.ModelMap; 16 import org.springframework.ui.ModelMap;
20 import org.springframework.web.bind.annotation.*; 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 import java.util.List; 20 import java.util.List;
28 -import java.util.Map; 21 +
29 22
30 /** 23 /**
31 * 【请填写功能名称】Controller 24 * 【请填写功能名称】Controller
@@ -47,8 +40,7 @@ public class BsthTLineExamineController extends BaseController @@ -47,8 +40,7 @@ public class BsthTLineExamineController extends BaseController
47 IDictDataService dictDataService; 40 IDictDataService dictDataService;
48 41
49 42
50 - @Autowired  
51 - private IUserService userService; 43 +
52 44
53 @RequiresPermissions("system:line:view") 45 @RequiresPermissions("system:line:view")
54 @GetMapping() 46 @GetMapping()
bsthLineProfiles/src/main/java/com/ruoyi/project/system/line/controller/BsthTLineHistoryController.java
@@ -86,6 +86,9 @@ public class BsthTLineHistoryController extends BaseController @@ -86,6 +86,9 @@ public class BsthTLineHistoryController extends BaseController
86 if(bsthTLineExamine!=null){ 86 if(bsthTLineExamine!=null){
87 bsthTLine=bsthTLineExamine; 87 bsthTLine=bsthTLineExamine;
88 } 88 }
  89 + bsthTLine.setUpdateStatus("1");
  90 + boolean flag=bsthTLineService.selectHistoryByLineNameAndUpdateStatus(bsthTLine)!=null?true:false;
  91 + mmap.put("flag",flag);
89 mmap.put("bsthTLine", bsthTLine); 92 mmap.put("bsthTLine", bsthTLine);
90 return prefix + "/edit"; 93 return prefix + "/edit";
91 } 94 }
@@ -99,17 +102,30 @@ public class BsthTLineHistoryController extends BaseController @@ -99,17 +102,30 @@ public class BsthTLineHistoryController extends BaseController
99 @ResponseBody 102 @ResponseBody
100 public AjaxResult editSave(BsthTLine bsthTLine) 103 public AjaxResult editSave(BsthTLine bsthTLine)
101 { 104 {
  105 + AjaxResult ajaxResult;
102 User loginUser = ShiroUtils.getSysUser(); 106 User loginUser = ShiroUtils.getSysUser();
103 bsthTLine.setUpdateBy(loginUser.getUserName()); 107 bsthTLine.setUpdateBy(loginUser.getUserName());
104 String lineName=bsthTLine.getLineName(); 108 String lineName=bsthTLine.getLineName();
  109 +
105 BsthTLine bsthTLineExamine=bsthTLineService.selectBsthTLineExamineByLineName(lineName); 110 BsthTLine bsthTLineExamine=bsthTLineService.selectBsthTLineExamineByLineName(lineName);
106 if(bsthTLineExamine!=null){//有没审核的直接覆盖 111 if(bsthTLineExamine!=null){//有没审核的直接覆盖
107 bsthTLine.setId(bsthTLineExamine.getId()); 112 bsthTLine.setId(bsthTLineExamine.getId());
108 - return toAjax(bsthTLineService.updateBsthTLineExamine(bsthTLine)); 113 + ajaxResult= toAjax(bsthTLineService.updateBsthTLineExamine(bsthTLine));
109 }else {//没有新增 114 }else {//没有新增
110 bsthTLine.setExamineType("1"); 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,7 +55,7 @@ public interface BsthTLineMapper
55 55
56 List<BsthTLine> findNeedUpdateHistory(); 56 List<BsthTLine> findNeedUpdateHistory();
57 57
58 - BsthTLine historyIsExist(String lineName); 58 + BsthTLine selectHistoryByLineNameAndUpdateStatus(BsthTLine bsthTLine);
59 59
60 int insertLineEditRepot(LineEditReport lineEditReport); 60 int insertLineEditRepot(LineEditReport lineEditReport);
61 61
@@ -67,6 +67,7 @@ public interface BsthTLineMapper @@ -67,6 +67,7 @@ public interface BsthTLineMapper
67 67
68 List<BsthTLine> selectHistoryListNotUpdate(BsthTLine bsthTLine); 68 List<BsthTLine> selectHistoryListNotUpdate(BsthTLine bsthTLine);
69 69
  70 + int deleteBsthTLineHistoryById(Long id);
70 71
71 /*int createLineMonthReport(BsthTLine line);*/ 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,12 +41,6 @@ public interface IBsthTLineService
41 41
42 List<BsthTLine> getListByName(String object); 42 List<BsthTLine> getListByName(String object);
43 43
44 -  
45 -  
46 -  
47 -  
48 -  
49 -  
50 List<BsthTLine> selectBsthTLineExamineList(BsthTLine bsthTLine); 44 List<BsthTLine> selectBsthTLineExamineList(BsthTLine bsthTLine);
51 45
52 int insertBsthTLineExamine(BsthTLine bsthTLine); 46 int insertBsthTLineExamine(BsthTLine bsthTLine);
@@ -55,7 +49,6 @@ public interface IBsthTLineService @@ -55,7 +49,6 @@ public interface IBsthTLineService
55 49
56 int updateBsthTLineExamine(BsthTLine bsthTLine); 50 int updateBsthTLineExamine(BsthTLine bsthTLine);
57 51
58 -  
59 int deleteBsthTLineExamineById(String ids); 52 int deleteBsthTLineExamineById(String ids);
60 53
61 int examine(BsthTLine bsthTLine); 54 int examine(BsthTLine bsthTLine);
@@ -64,5 +57,8 @@ public interface IBsthTLineService @@ -64,5 +57,8 @@ public interface IBsthTLineService
64 57
65 boolean lineNameIsExist(String lineName); 58 boolean lineNameIsExist(String lineName);
66 59
  60 + BsthTLine selectHistoryByLineNameAndUpdateStatus(BsthTLine bsthTLine);
  61 +
  62 + int deleteBsthTLineHistoryById(Long id);
67 /*int createLineMonthReport();*/ 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,15 +262,16 @@ public class BsthTLineServiceImpl implements IBsthTLineService
262 lineEditReport.setVehiclesNumberBefore(line.getVehiclesNumber()); 262 lineEditReport.setVehiclesNumberBefore(line.getVehiclesNumber());
263 lineEditReport.setNumberPersonBefore(line.getNumberPerson()); 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 Date d = new Date(); 277 Date d = new Date();
@@ -371,9 +372,12 @@ public class BsthTLineServiceImpl implements IBsthTLineService @@ -371,9 +372,12 @@ public class BsthTLineServiceImpl implements IBsthTLineService
371 if(bsthTLine.getId()!=null){ 372 if(bsthTLine.getId()!=null){
372 if("0".equals(bsthTLine.getExamineType())){//新增 373 if("0".equals(bsthTLine.getExamineType())){//新增
373 if("2".equals(bsthTLine.getExamineStatus())){//通过 374 if("2".equals(bsthTLine.getExamineStatus())){//通过
374 - //存入主表 375 + //存入主表和历史表
375 bl=bsthTLineMapper.selectBsthTLineExamineById(bsthTLine.getId()); 376 bl=bsthTLineMapper.selectBsthTLineExamineById(bsthTLine.getId());
  377 + bl.setUpdateStatus("0");
  378 + bsthTLineMapper.saveEditHistory(bl);
376 i=bsthTLineMapper.insertBsthTLine(bl); 379 i=bsthTLineMapper.insertBsthTLine(bl);
  380 +
377 //删除审核表 381 //删除审核表
378 bsthTLineMapper.deleteBsthTLineExamineById(new String[]{bsthTLine.getId().toString()}); 382 bsthTLineMapper.deleteBsthTLineExamineById(new String[]{bsthTLine.getId().toString()});
379 }else{//未通过 383 }else{//未通过
@@ -428,4 +432,14 @@ public class BsthTLineServiceImpl implements IBsthTLineService @@ -428,4 +432,14 @@ public class BsthTLineServiceImpl implements IBsthTLineService
428 return flag; 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,10 +1443,10 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
1443 </select> 1443 </select>
1444 1444
1445 1445
1446 - <select id="historyIsExist" parameterType="String" 1446 + <select id="selectHistoryByLineNameAndUpdateStatus" parameterType="BsthTLine"
1447 resultMap="BsthTLineResult"> 1447 resultMap="BsthTLineResult">
1448 <include refid="selectBsthTLineHistoryVo" /> 1448 <include refid="selectBsthTLineHistoryVo" />
1449 - where line_name= #{lineName} and update_status='0' 1449 + where line_name= #{lineName} and update_status=#{updateStatus}
1450 </select> 1450 </select>
1451 1451
1452 1452
@@ -1695,6 +1695,9 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot; @@ -1695,6 +1695,9 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
1695 </where> 1695 </where>
1696 </select> 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,7 +507,7 @@
507 <div class="form-group"> 507 <div class="form-group">
508 <label class="col-sm-3 control-label">低谷系数:</label> 508 <label class="col-sm-3 control-label">低谷系数:</label>
509 <div class="col-sm-8"> 509 <div class="col-sm-8">
510 - <input name="lowCustomerPercent" th:field="*{lowCustomerPercent}" 510 + <input name="lowCustomerPercent" id="lowCustomerPercent" th:field="*{lowCustomerPercent}"
511 class="form-control" type="text"> 511 class="form-control" type="text">
512 </div> 512 </div>
513 </div> 513 </div>
@@ -682,7 +682,7 @@ @@ -682,7 +682,7 @@
682 <th:block th:include="include :: bootstrap-fileinput-js" /> 682 <th:block th:include="include :: bootstrap-fileinput-js" />
683 <script th:inline="javascript"> 683 <script th:inline="javascript">
684 var prefix = ctx + "system/lineHistory"; 684 var prefix = ctx + "system/lineHistory";
685 - 685 + var f=[[${flag}]];
686 $(function() { 686 $(function() {
687 /* $.get("/system/line/getUserLineInfo",function(data){ 687 /* $.get("/system/line/getUserLineInfo",function(data){
688 if(data.msg != null){ 688 if(data.msg != null){
@@ -751,12 +751,10 @@ @@ -751,12 +751,10 @@
751 var bsthTLineOld=data[0]; 751 var bsthTLineOld=data[0];
752 var bsthTLineNew=data[1]; 752 var bsthTLineNew=data[1];
753 if(bsthTLineNew!=null){ 753 if(bsthTLineNew!=null){
754 - console.log(bsthTLineNew)  
755 for(let i in bsthTLineOld){ 754 for(let i in bsthTLineOld){
756 var o=bsthTLineOld[i]==null?'':bsthTLineOld[i]; 755 var o=bsthTLineOld[i]==null?'':bsthTLineOld[i];
757 var n=bsthTLineNew[i]==null?'':bsthTLineNew[i]; 756 var n=bsthTLineNew[i]==null?'':bsthTLineNew[i];
758 if(o!=n){ 757 if(o!=n){
759 - console.log(i)  
760 i=i=='fcompany'?'fCompany':i; 758 i=i=='fcompany'?'fCompany':i;
761 i=i=='plineId'?'pLineId':i; 759 i=i=='plineId'?'pLineId':i;
762 var input=document.getElementsByName(i)[0]; 760 var input=document.getElementsByName(i)[0];
@@ -882,6 +880,8 @@ @@ -882,6 +880,8 @@
882 minView : "month", 880 minView : "month",
883 autoclose : true 881 autoclose : true
884 }); 882 });
  883 +
  884 +
885 </script> 885 </script>
886 </body> 886 </body>
887 </html> 887 </html>
888 \ No newline at end of file 888 \ No newline at end of file
bsthLineProfiles/src/main/resources/templates/system/lineHistory/line.html
@@ -62,10 +62,6 @@ @@ -62,10 +62,6 @@
62 62
63 <script th:inline="javascript"> 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 new Vue({ 66 new Vue({
71 el: '#context', 67 el: '#context',
@@ -498,9 +494,23 @@ @@ -498,9 +494,23 @@
498 btn: ['变更', '返回'], 494 btn: ['变更', '返回'],
499 // 弹层外区域关闭 495 // 弹层外区域关闭
500 shadeClose: true, 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 </script> 514 </script>
505 <style> 515 <style>
506 .col_checkbox { 516 .col_checkbox {