Commit 128c0dee by 杨清松

出差申请审批流

parent 1ddf1e0c
......@@ -12,10 +12,15 @@ import com.beecode.inz.workflow.config.TriggerAction;
import com.beecode.inz.workflow.config.TriggerCondition;
import com.xyst.dinas.oa.constant.BusinessTripApplyConstant;
import com.xyst.dinas.oa.constant.SealBorrowConstant;
import com.xyst.dinas.oa.dao.BusinessTripApplyDao;
import com.xyst.dinas.oa.dao.SealBorrowDao;
import com.xyst.dinas.oa.internal.dao.BusinessTripApplyDaoImpl;
import com.xyst.dinas.oa.internal.dao.SealBorrowDaoImpl;
import com.xyst.dinas.oa.internal.service.BusinessTripApplyServiceImpl;
import com.xyst.dinas.oa.internal.service.SealBorrowServiceImpl;
import com.xyst.dinas.oa.service.BusinessTripApplyService;
import com.xyst.dinas.oa.service.SealBorrowService;
import com.xyst.dinas.oa.web.BusinessTripApplyController;
import com.xyst.dinas.oa.web.SealBorrowController;
public class OaConfiguration {
......@@ -81,4 +86,19 @@ public class OaConfiguration {
public SealBorrowDao sealBorrowDao() {
return new SealBorrowDaoImpl();
}
@Bean
public BusinessTripApplyController businessTripApplyController() {
return new BusinessTripApplyController();
}
@Bean
public BusinessTripApplyService businessTripApplyService() {
return new BusinessTripApplyServiceImpl();
}
@Bean
public BusinessTripApplyDao businessTripApplyDao() {
return new BusinessTripApplyDaoImpl();
}
}
package com.xyst.dinas.oa.dao;
import java.util.UUID;
import com.beecode.bcp.type.KObject;
public interface BusinessTripApplyDao {
KObject load(UUID id);
}
package com.xyst.dinas.oa.internal.dao;
import java.util.UUID;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate5.HibernateOperations;
import com.beecode.bcp.type.KObject;
import com.xyst.dinas.oa.constant.BusinessTripApplyConstant;
import com.xyst.dinas.oa.constant.SealBorrowConstant;
import com.xyst.dinas.oa.dao.BusinessTripApplyDao;
import com.xyst.dinas.oa.dao.SealBorrowDao;
public class BusinessTripApplyDaoImpl implements BusinessTripApplyDao, BusinessTripApplyConstant {
@Autowired
private HibernateOperations template;
@Override
public KObject load(UUID id) {
return (KObject) template.load(ENTITY, id);
}
}
package com.xyst.dinas.oa.internal.service;
import java.util.UUID;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import com.beecode.bcp.type.KObject;
import com.beecode.inz.workflow.service.InzWorkflowService;
import com.xyst.dinas.oa.constant.BusinessTripApplyConstant;
import com.xyst.dinas.oa.dao.BusinessTripApplyDao;
import com.xyst.dinas.oa.service.BusinessTripApplyService;
public class BusinessTripApplyServiceImpl implements BusinessTripApplyService{
@Autowired
private InzWorkflowService inzWorkflowService;
@Autowired
private BusinessTripApplyDao businessTripApplyDao;
@Override
@Transactional
public void submitFlow(UUID id) {
KObject kobject = businessTripApplyDao.load(id);
if (needSubmitFlow(kobject)) {
// 调用流程接口发起流程
inzWorkflowService.startWorkflow("SUBMIT",
BusinessTripApplyConstant.BIZ_TYPE,
kobject.getString("businessTripReason"), kobject);
}
}
/**
* 判断提交是否需要走流程
*
* @param data
* @return
*/
private boolean needSubmitFlow(KObject data) {
return inzWorkflowService.canStartWotkflow("SUBMIT",
BusinessTripApplyConstant.BIZ_TYPE, data);
}
}
package com.xyst.dinas.oa.service;
import java.util.UUID;
public interface BusinessTripApplyService {
void submitFlow(UUID id);
}
package com.xyst.dinas.oa.web;
import java.util.UUID;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import com.beecode.bcp.workflow.exception.WorkflowRuntimeException;
import com.xyst.dinas.oa.service.BusinessTripApplyService;
import com.xyst.dinas.oa.service.SealBorrowService;
@RestController
public class BusinessTripApplyController {
private static final Logger logger = LoggerFactory.getLogger(BusinessTripApplyController.class);
@Autowired
private BusinessTripApplyService businessTripApplyService;
@ResponseBody
@RequestMapping(value = "/oa/businessTripApply/submitFlow", method = RequestMethod.POST, consumes = "application/json")
public Object submitFlow(@RequestBody String body) {
JSONObject obj = new JSONObject(body);
UUID id = UUID.fromString(obj.getString("id"));
businessTripApplyService.submitFlow(id);
return obj.toString();
}
}
\ No newline at end of file
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