需求:
综治子系统:统一受理平台和矛盾纠纷系统合二为一,因为流程一样,主要流程如下图
1、网格员上报到社区综治中心
2、社区综治中心可以选择上报到街镇综治中心或派遣给社区单位签收或派遣给具体的网格员进行处理
3、社区单位签收(派遣)具体的处理人员进行处理
4、街镇综治中心可以选择上报到区综治中心或派遣到街镇单位签收或下派到社区综治中心处理
5、街镇单位签收(派遣)具体的处理人员进行处理
6、区综治中心可以派遣到区具体的区处理单位进行处理或下派到具体的街镇综治中心
其中所有单位和具体处理人员可以进行退回操作,退回到上一级
其中所有综治中心和单位可以进行撤回操作
表设计
1、事件上报表
2、流程实例表
3、流程记录表
java流程设计(采用状态设计模式)
1、创建抽象类,定义handle方法和setEventBase两个方法,让具体实现者实现
public abstract class ProcessHandle {
protected ProcessRecordingMapper processRecordingMapper;
protected InstanceMapper mapper;
protected IEventBaseService baseService;
protected ProcessContent content;
public ProcessHandle(ProcessContent content) {
this.content = content;
this.mapper = this.content.getMapper();
this.baseService = this.content.getBaseService();
this.processRecordingMapper = this.content.getProcessRecordingMapper();
}
/**
* 执行处理
*
* @throws ProcessHandleException
*/
abstract void handle() throws ProcessHandleException;
/**
* 设置事件状态
*
* @param eventId
* @throws ProcessHandleException
*/
void setEventBase(Long eventId) {
}
}
2、网格员上报操作实现
public class ReportHandle extends ProcessHandle {
public ReportHandle(ProcessContent content) {
super(content);
}
@Override
public void handle() {
if (this.content == null || !this.content.getInstanceVO().getCategory().equals(ProcessConstant.PROCESS_TYPE_REPORT)) {
log.info("上报处理初始化异常!");
throw new ProcessHandleException("上报处理初始化异常!");
}
InstanceVO instanceVO = this.content.getInstanceVO();
//生成当前节点
setEventBase(instanceVO.getEventId());
//设置当前实例动作
switch (instanceVO.getRoleName()) {
case ProcessConstant.PROCESS_ROLE_GRIDEMP:
instanceVO.setNowNode(ProcessConstant.NODE_LOCATION_WGYSB);
instanceVO.setActionInfomation(ProcessConstant.PROCESS_DETILE_TYPE_SB);
break;
case ProcessConstant.PROCESS_ROLE_COMMUNITY:
instanceVO.setNowNode(ProcessConstant.NODE_LOCATION_SQZXSL);
instanceVO.setActionInfomation(ProcessConstant.PROCESS_DETILE_TYPE_SBJZZZZX);
break;
case ProcessConstant.PROCESS_ROLE_STREET_TOWN:
instanceVO.setNowNode(ProcessConstant.NODE_LOCATION_JZZXSL);
instanceVO.setActionInfomation(ProcessConstant.PROCESS_DETILE_TYPE_SBQZZZX);
break;
default:
throw new ProcessHandleException("上报处理异常!");
}
this.setEventBase(instanceVO.getEventId());
if (mapper.insert(instanceVO) == 0) {
throw new ProcessHandleException("上报处理异常!");
}
}
@Override
public void setEventBase(Long eventId) {
this.content.setEventBase(baseService.getById(eventId));
this.content.getEventBase().setHandleStatus(ProcessConstant.PROCESS_PENDING);
}
}
3、派遣操作流程实现
public class SendHandle extends ProcessHandle {
SendHandle(ProcessContent content) {
super(content);
}
@Override
public void handle() {
if (this.content == null || !this.content.getInstanceVO().getCategory().equals(ProcessConstant.PROCESS_TYPE_SEND)) {
log.info("派遣处理初始化异常!");
throw new ProcessHandleException("派遣处理初始化异常!");
}
InstanceVO instanceVO = this.content.getInstanceVO();
instanceVO.setHandleStatus(ProcessConstant.UNTREATED);
switch (instanceVO.getRoleName()) {
case ProcessConstant.PROCESS_ROLE_COMMUNITY:
instanceVO.setNowNode(ProcessConstant.NODE_LOCATION_SQZXSL);
if (instanceVO.getIsSendGridEmp() == 1) {
instanceVO.setActionInfomation(ProcessConstant.PROCESS_DETILE_TYPE_ZPWGYCL);
} else {
instanceVO.setActionInfomation(ProcessConstant.PROCESS_DETILE_TYPE_ZPSCDWCL);
}
break;
case ProcessConstant.PROCESS_ROLE_STREET_TOWN:
instanceVO.setNowNode(ProcessConstant.NODE_LOCATION_JZZXSL);
instanceVO.setActionInfomation(ProcessConstant.PROCESS_DETILE_TYPE_ZPJZDWCL);
break;
case ProcessConstant.PROCESS_ROLE_STREET_AREA:
instanceVO.setNowNode(ProcessConstant.NODE_LOCATION_QZXSL);
instanceVO.setActionInfomation(ProcessConstant.PROCESS_DETILE_TYPE_ZPQDWCL);
break;
default:
throw new ProcessHandleException("派遣处理异常!");
}
setEventBase(instanceVO.getEventId());
if (mapper.insert(instanceVO) == 0) {
throw new ProcessHandleException("派遣处理异常!");
}
}
@Override
public void setEventBase(Long eventId) {
this.content.setEventBase(baseService.getById(eventId));
this.content.getEventBase().setHandleStatus(ProcessConstant.PROCESS_SIGN_FOR);
}
}
4、处理单位签收处理
public class SignForHandle extends ProcessHandle {
public SignForHandle(ProcessContent content) {
super(content);
}
@Override
public void handle() {
if (this.content == null || !this.content.getInstanceVO().getCategory().equals(ProcessConstant.PROCESS_TYPE_SIGN_FOR)) {
log.info("签收处理初始化异常!");
throw new ProcessHandleException("签收处理初始化异常!");
}
InstanceVO instance = this.content.getInstanceVO();
Instance preInstance = content.getPreInstance();
instance.setOrders(preInstance.getOrders() + 1);
if (instance.getRoleName().equals(ProcessConstant.PROCESS_ROLE_COMMUNITY_UNIT)) {
//生成当前节点(社区单位签收)
instance.setNowNode(ProcessConstant.NODE_LOCATION_SQDWQS);
instance.setActionInfomation(ProcessConstant.PROCESS_DETILE_TYPE_SQDWQS);
} else if (instance.getRoleName().equals(ProcessConstant.PROCESS_ROLE_STREET_UNIT)) {
//生成当前节点(街镇单位签收)
instance.setNowNode(ProcessConstant.NODE_LOCATION_JZDWQS);
instance.setActionInfomation(ProcessConstant.PROCESS_DETILE_TYPE_JZDWQS);
} else if (instance.getRoleName().equals(ProcessConstant.PROCESS_ROLE_AREA_UNIT)) {
//生成当前节点(区单位签收)
instance.setNowNode(ProcessConstant.NODE_LOCATION_QDWQS);
instance.setActionInfomation(ProcessConstant.PROCESS_DETILE_TYPE_QDWQS);
} else {
throw new ProcessHandleException("请正确分配角色!");
}
if (mapper.insert(instance) == 0) {
throw new ProcessHandleException("签收处理异常!");
}
//改变事件主表状态
this.setEventBase(instance.getEventId());
}
@Override
public void setEventBase(Long eventId) {
this.content.setEventBase(baseService.getById(eventId))