Commit 44a8b78e authored by neo's avatar neo

[DEV] fixed approval with period and porject

parent def95670
......@@ -65,9 +65,9 @@ public class ApprovalController {
}
@ResponseBody
@RequestMapping(value = "/check/{taskId}",method = RequestMethod.PUT)
public void check(@PathVariable String taskId, @RequestParam String decide, @RequestParam String comment) {//only for manager role
approvalService.checkTask(taskId, decide,comment);
@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);
}
@ResponseBody
......@@ -151,29 +151,5 @@ public class ApprovalController {
}
private void mocoDisAggreAndOver() {
logger.debug("------------------------update db -----------------------------------");
logger.debug("dis aggre");
logger.debug("------------------------updage db-----------------------------------");
}
private void mocoAggreAndOver() {
logger.debug("------------------------update db-----------------------------------");
logger.debug("aggree");
logger.debug("------------------------update db-----------------------------------");
}
private void mocoHasCommittedAndOver() {
logger.debug("-------------------------update db----------------------------------");
logger.debug("has committed");
logger.debug("-------------------------update db----------------------------------");
}
private void mocoInsert(ApprovalDto dto) {
logger.debug("-------------------------insert db----------------------------------");
logger.debug("save approval {}", dto.toString());
logger.debug("-------------------------insert db----------------------------------");
}
}
......@@ -20,5 +20,6 @@ public class Exceptions {
public static final ApiException NOT_FOUND_EXCEPTION = new NotFoundException("not found resources");
public static final ApiException REPORT_IN_PROCESS_OR_AGREED_EXCEPTION = new PreconditionFailedException("report in approval or agreed result");
public static final FormulaException PROJECT_NOT_FOUND = new FormulaException("project not found");;
public static final FormulaException PSUM_CELL_TEMP_NULL = new FormulaException("cell template group is null or empty"); ;
public static final FormulaException PSUM_CELL_TEMP_NULL = new FormulaException("cell template group is null or empty");
public static final ApiException NOT_FOUND_INSTANCE_EXCEPTION = new NotFoundException("not found instance");
}
......@@ -125,7 +125,9 @@ public class ApprovalService {
@Transactional
public void checkTask(String instanceId, String decide,String comment) {
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);
Map<String, Object> map = new HashMap<>();
PeriodApprove pa = new PeriodApprove();
switch (decide) {
......
......@@ -143,4 +143,14 @@ public interface PeriodApproveMapper extends MyVatMapper {
" ROWNUM = 1" +
"")
String getStatusByProjectIdAndPeriod(@Param("projectId") String projectId, @Param("period") Integer period);
@Select("" +
"SELECT " +
" INSTANCE_ID AS instanceId " +
"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);
}
\ No newline at end of file
......@@ -2568,17 +2568,24 @@
}
$scope.doApprove = function(){
$("#ApprovalComment").modal('show');
vatApproveService.approvalStatus(vatSessionService.project.id,vatSessionService.monthvatSessionService.month).success(function(result){
if(result&&result=='committed'){
$("#ApprovalComment").modal('show')
}else{
SweetAlert.warning('当前报表未提审,请先提审!');
}
});
;
}
$scope.rejectApproval =function(){
vatApproveService.checkTask(vatSessionService.approvalInfo.instanceId,'disagreed',$scope.comment).success(function(){
vatApproveService.checkTask(vatSessionService.project.id,vatSessionService.month,'disagreed',$scope.comment).success(function(){
$("#ApprovalComment").modal('hide');
});
}
$scope.agreeApproval =function(){
vatApproveService.checkTask(vatSessionService.approvalInfo.instanceId,'agreed',$scope.comment).success(function(){
vatApproveService.checkTask(vatSessionService.project.id,vatSessionService.month,'agreed',$scope.comment).success(function(){
vatCommonService.setProjectStatus(vatSessionService.project.id, vatSessionService.month, constant.ProjectStatusEnum.Completed
, constant.DictionaryDictKey.WFDataProcess, enums.FinishStatusEnum.Finished);
$("#ApprovalComment").modal('hide');
......
......@@ -21,8 +21,8 @@
return $http.get('/approval/templateInfo/'+templateId, apiConfig.createVat());
},
checkTask:function(taskId,decide,comment){
return $http.put('/approval/check/'+taskId+'?decide='+decide+'&comment='+comment, {}, apiConfig.createVat());
checkTask:function(projectId,period,decide,comment){
return $http.put('/approval/check/'+projectId+'/'+period+'?decide='+decide+'&comment='+comment, {}, apiConfig.createVat());
},
approvalStatus:function(projectId,period){
......
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