Commit 42af698c by 杨清松

用印审批工作流

parent d6f21da0
...@@ -12,6 +12,11 @@ import com.beecode.inz.workflow.config.TriggerAction; ...@@ -12,6 +12,11 @@ import com.beecode.inz.workflow.config.TriggerAction;
import com.beecode.inz.workflow.config.TriggerCondition; import com.beecode.inz.workflow.config.TriggerCondition;
import com.xyst.dinas.oa.constant.BusinessTripApplyConstant; import com.xyst.dinas.oa.constant.BusinessTripApplyConstant;
import com.xyst.dinas.oa.constant.SealBorrowConstant; import com.xyst.dinas.oa.constant.SealBorrowConstant;
import com.xyst.dinas.oa.dao.SealBorrowDao;
import com.xyst.dinas.oa.internal.dao.SealBorrowDaoImpl;
import com.xyst.dinas.oa.internal.service.SealBorrowServiceImpl;
import com.xyst.dinas.oa.service.SealBorrowService;
import com.xyst.dinas.oa.web.SealBorrowController;
public class OaConfiguration { public class OaConfiguration {
...@@ -61,4 +66,19 @@ public class OaConfiguration { ...@@ -61,4 +66,19 @@ public class OaConfiguration {
configuration.setProcessConfiguration(processConfig); configuration.setProcessConfiguration(processConfig);
return configuration; return configuration;
} }
@Bean
public SealBorrowController sealBorrowController() {
return new SealBorrowController();
}
@Bean
public SealBorrowService sealBorrowService() {
return new SealBorrowServiceImpl();
}
@Bean
public SealBorrowDao sealBorrowDao() {
return new SealBorrowDaoImpl();
}
} }
package com.xyst.dinas.oa.dao;
import java.util.UUID;
import com.beecode.bcp.type.KObject;
public interface SealBorrowDao {
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.SealBorrowConstant;
import com.xyst.dinas.oa.dao.SealBorrowDao;
public class SealBorrowDaoImpl implements SealBorrowDao, SealBorrowConstant {
@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.SealBorrowConstant;
import com.xyst.dinas.oa.dao.SealBorrowDao;
import com.xyst.dinas.oa.service.SealBorrowService;
public class SealBorrowServiceImpl implements SealBorrowService{
@Autowired
private InzWorkflowService inzWorkflowService;
@Autowired
private SealBorrowDao sealBorrowDao;
@Override
@Transactional
public void submitFlow(UUID id) {
KObject kobject = sealBorrowDao.load(id);
if (needSubmitFlow(kobject)) {
// 调用流程接口发起流程
inzWorkflowService.startWorkflow("SUBMIT",
SealBorrowConstant.BIZ_TYPE,
kobject.getString("lendReason"), kobject);
}
}
/**
* 判断提交是否需要走流程
*
* @param data
* @return
*/
private boolean needSubmitFlow(KObject data) {
return inzWorkflowService.canStartWotkflow("SUBMIT",
SealBorrowConstant.BIZ_TYPE, data);
}
}
package com.xyst.dinas.oa.service;
import java.util.UUID;
public interface SealBorrowService {
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.SealBorrowService;
@RestController
public class SealBorrowController {
private static final Logger logger = LoggerFactory.getLogger(SealBorrowController.class);
@Autowired
private SealBorrowService sealBorrowService;
@ResponseBody
@RequestMapping(value = "/oa/sealBorrow/submitFlow", method = RequestMethod.POST, consumes = "application/json")
public Object repairDealWayAccept(@RequestBody String body) {
JSONObject obj = new JSONObject(body);
UUID id = UUID.fromString(obj.getString("id"));
sealBorrowService.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