Commit 12df33d8 authored by neo's avatar neo

[Bugfix] fixed approval assert

parent 44a8b78e
......@@ -67,7 +67,7 @@ public class ApprovalController {
@ResponseBody
@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
approvalService.checkTask(projectId,period, decide,comment);
approvalService.checkTask(projectId, period, decide,comment);
}
@ResponseBody
......
......@@ -126,8 +126,9 @@ public class ApprovalService {
@Transactional
public void checkTask(String projectId,Integer period, String decide,String comment) {
String instanceId= periodApproveMapper.getInstanceIdByProjectIdAndPeriod(projectId,period);
MyAsserts.assertNotEmpty(instanceId,Exceptions.NOT_FOUND_INSTANCE_EXCEPTION);
PeriodApprove approve= periodApproveMapper.getInstanceIdByProjectIdAndPeriod(projectId,period);
MyAsserts.assertTrue(approve!=null&&approve.getStatus().equals("committed"),Exceptions.NOT_FOUND_INSTANCE_EXCEPTION);
String instanceId = approve.getInstanceId();
Map<String, Object> map = new HashMap<>();
PeriodApprove pa = new PeriodApprove();
switch (decide) {
......
......@@ -146,11 +146,11 @@ public interface PeriodApproveMapper extends MyVatMapper {
@Select("" +
"SELECT " +
" INSTANCE_ID AS instanceId " +
" INSTANCE_ID AS instanceId ,STATUS AS status " +
"FROM " +
" ( SELECT * FROM PERIOD_APPROVE WHERE PROJECT_ID = #{projectId} AND PERIOD = #{period} ORDER BY CREATE_TIME DESC ) " +
"WHERE " +
" 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 @@
};
$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'){
SweetAlert.error('报表提审中或审核已通过!');
}else{
......@@ -2568,7 +2570,9 @@
}
$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'){
$("#ApprovalComment").modal('show')
}else{
......@@ -2579,13 +2583,17 @@
}
$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');
});
}
$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
, constant.DictionaryDictKey.WFDataProcess, enums.FinishStatusEnum.Finished);
$("#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