Commit 12df33d8 authored by neo's avatar neo

[Bugfix] fixed approval assert

parent 44a8b78e
...@@ -67,7 +67,7 @@ public class ApprovalController { ...@@ -67,7 +67,7 @@ public class ApprovalController {
@ResponseBody @ResponseBody
@RequestMapping(value = "/check/projectId/period",method = RequestMethod.PUT) @RequestMapping(value = "/check/projectId/period",method = RequestMethod.PUT)
public void check(@PathVariable String projectId,@PathVariable Integer period, @RequestParam String decide, @RequestParam String comment) {//only for manager role public void check(@PathVariable String projectId,@PathVariable Integer period, @RequestParam String decide, @RequestParam String comment) {//only for manager role
approvalService.checkTask(projectId,period, decide,comment); approvalService.checkTask(projectId, period, decide,comment);
} }
@ResponseBody @ResponseBody
......
...@@ -126,8 +126,9 @@ public class ApprovalService { ...@@ -126,8 +126,9 @@ public class ApprovalService {
@Transactional @Transactional
public void checkTask(String projectId,Integer period, String decide,String comment) { public void checkTask(String projectId,Integer period, String decide,String comment) {
String instanceId= periodApproveMapper.getInstanceIdByProjectIdAndPeriod(projectId,period); PeriodApprove approve= periodApproveMapper.getInstanceIdByProjectIdAndPeriod(projectId,period);
MyAsserts.assertNotEmpty(instanceId,Exceptions.NOT_FOUND_INSTANCE_EXCEPTION); MyAsserts.assertTrue(approve!=null&&approve.getStatus().equals("committed"),Exceptions.NOT_FOUND_INSTANCE_EXCEPTION);
String instanceId = approve.getInstanceId();
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
PeriodApprove pa = new PeriodApprove(); PeriodApprove pa = new PeriodApprove();
switch (decide) { switch (decide) {
......
...@@ -146,11 +146,11 @@ public interface PeriodApproveMapper extends MyVatMapper { ...@@ -146,11 +146,11 @@ public interface PeriodApproveMapper extends MyVatMapper {
@Select("" + @Select("" +
"SELECT " + "SELECT " +
" INSTANCE_ID AS instanceId " + " INSTANCE_ID AS instanceId ,STATUS AS status " +
"FROM " + "FROM " +
" ( SELECT * FROM PERIOD_APPROVE WHERE PROJECT_ID = #{projectId} AND PERIOD = #{period} ORDER BY CREATE_TIME DESC ) " + " ( SELECT * FROM PERIOD_APPROVE WHERE PROJECT_ID = #{projectId} AND PERIOD = #{period} ORDER BY CREATE_TIME DESC ) " +
"WHERE " + "WHERE " +
" ROWNUM = 1" + " ROWNUM = 1" +
"") "")
String getInstanceIdByProjectIdAndPeriod(@Param("projectId") String projectId, @Param("period") Integer period); PeriodApprove getInstanceIdByProjectIdAndPeriod(@Param("projectId") String projectId, @Param("period") Integer period);
} }
\ No newline at end of file
...@@ -2538,7 +2538,9 @@ ...@@ -2538,7 +2538,9 @@
}; };
$scope.commitApprove = function(){ $scope.commitApprove = function(){
vatApproveService.approvalStatus(vatSessionService.project.id,vatSessionService.month).success(function(result){ if(vatSessionService.month)
vatSessionService.project.period=vatSessionService.month;
vatApproveService.approvalStatus(vatSessionService.project.id,vatSessionService.project.period).success(function(result){
if(result&&result=='committed'){ if(result&&result=='committed'){
SweetAlert.error('报表提审中或审核已通过!'); SweetAlert.error('报表提审中或审核已通过!');
}else{ }else{
...@@ -2568,7 +2570,9 @@ ...@@ -2568,7 +2570,9 @@
} }
$scope.doApprove = function(){ $scope.doApprove = function(){
vatApproveService.approvalStatus(vatSessionService.project.id,vatSessionService.monthvatSessionService.month).success(function(result){ if(vatSessionService.month)
vatSessionService.project.period=vatSessionService.month;
vatApproveService.approvalStatus(vatSessionService.project.id,vatSessionService.project.period).success(function(result){
if(result&&result=='committed'){ if(result&&result=='committed'){
$("#ApprovalComment").modal('show') $("#ApprovalComment").modal('show')
}else{ }else{
...@@ -2579,13 +2583,17 @@ ...@@ -2579,13 +2583,17 @@
} }
$scope.rejectApproval =function(){ $scope.rejectApproval =function(){
vatApproveService.checkTask(vatSessionService.project.id,vatSessionService.month,'disagreed',$scope.comment).success(function(){ if(vatSessionService.month)
vatSessionService.project.period=vatSessionService.month;
vatApproveService.checkTask(vatSessionService.project.id,vatSessionService.project.period,'disagreed',$scope.comment).success(function(){
$("#ApprovalComment").modal('hide'); $("#ApprovalComment").modal('hide');
}); });
} }
$scope.agreeApproval =function(){ $scope.agreeApproval =function(){
vatApproveService.checkTask(vatSessionService.project.id,vatSessionService.month,'agreed',$scope.comment).success(function(){ if(vatSessionService.month)
vatSessionService.project.period=vatSessionService.month;
vatApproveService.checkTask(vatSessionService.project.id,vatSessionService.project.period,'agreed',$scope.comment).success(function(){
vatCommonService.setProjectStatus(vatSessionService.project.id, vatSessionService.month, constant.ProjectStatusEnum.Completed vatCommonService.setProjectStatus(vatSessionService.project.id, vatSessionService.month, constant.ProjectStatusEnum.Completed
, constant.DictionaryDictKey.WFDataProcess, enums.FinishStatusEnum.Finished); , constant.DictionaryDictKey.WFDataProcess, enums.FinishStatusEnum.Finished);
$("#ApprovalComment").modal('hide'); $("#ApprovalComment").modal('hide');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment