spring mvc 取得service

/**

 *合同审核结果监听

 *用于改变合同审批结果(通过,退回)

 * Created by Bizfocus China . 

 * @author: Gary.Mo 

 * @date:2014年8月12日  

 * @time:上午10:00:23   

 * @email:[email protected]  

 * @version: 1.0

 */

public class ContractAuditResultListener  implements ExecutionListener{

/**

*/

private static final long serialVersionUID = -8405603547294739049L;

@Autowired

private SystemService systemService;

@Autowired

private InformService informService;

@Override

public void notify(DelegateExecution delegateExecution) throws Exception {

final ContractService contractService = SpringContextHolder.getBean(ContractService.class);

//业务主键

String businessKey = delegateExecution.getProcessBusinessKey();

//业务对象ID

String entityId = businessKey.substring(0,businessKey.indexOf("_"));

//业务对象类型

String entityType = businessKey.substring(businessKey.indexOf("_")+1, businessKey.lastIndexOf("_"));

if(entityType.equals("contractType")){

Contract contract = contractService.getContract(NumberUtils.toLong(entityId));

if(contract!= null){

Boolean pass = (Boolean) delegateExecution.getVariable("pass");

if(pass == null){

return ;

}

if(pass){

contract.setContractStatus(DictUtils.getDictValue("审批完成", "contract_status", "3"));

/**添加

* 当整个流程完成后,发送通知给 执行支付计划审核的财务人员。

* @author: donkey.lin 

* @date:2014年9月9日  

* @time:上午17:50:23   

Inform inform = new Inform();

inform.setType("0"); 

inform.setSendDate(new Date());

inform.setInfo("合同编号为"+contract.getId()+"的支付计划需要您审核");

inform.setReceiveBy(systemService.getUser());//发给财务人员,待确定

inform.setSendBy(UserUtils.getUser());

inform.setIsReaded("0");

informService.saveInform(inform);

*/

}else{

contract.setContractStatus(DictUtils.getDictValue("审批退回", "contract_status", "4"));

}

contractService.saveContract(contract);

}

}

}

}

猜你喜欢

转载自hai0378.iteye.com/blog/2227228