|
@@ -9,6 +9,8 @@ import org.jeecg.common.api.vo.Result;
|
|
import org.jeecg.common.system.query.QueryGenerator;
|
|
import org.jeecg.common.system.query.QueryGenerator;
|
|
import org.jeecg.modules.activiti.entity.ActNode;
|
|
import org.jeecg.modules.activiti.entity.ActNode;
|
|
import org.jeecg.modules.activiti.entity.TbTableInfo;
|
|
import org.jeecg.modules.activiti.entity.TbTableInfo;
|
|
|
|
+import org.jeecg.modules.activiti.entity.TbTableInfoPractice;
|
|
|
|
+import org.jeecg.modules.activiti.service.ITbTableInfoPracticeService;
|
|
import org.jeecg.modules.activiti.service.ITbTableInfoService;
|
|
import org.jeecg.modules.activiti.service.ITbTableInfoService;
|
|
import org.jeecg.modules.activiti.service.Impl.ActNodeServiceImpl;
|
|
import org.jeecg.modules.activiti.service.Impl.ActNodeServiceImpl;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -28,11 +30,13 @@ public class TbTableInfoController {
|
|
private ITbTableInfoService tbTableInfoService;
|
|
private ITbTableInfoService tbTableInfoService;
|
|
@Autowired
|
|
@Autowired
|
|
private ActNodeServiceImpl actNodeService;
|
|
private ActNodeServiceImpl actNodeService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private ITbTableInfoPracticeService iTbTableInfoPracticeService;
|
|
|
|
|
|
@ResponseBody
|
|
@ResponseBody
|
|
@RequestMapping("/list")
|
|
@RequestMapping("/list")
|
|
public Result<Object> list(){
|
|
public Result<Object> list(){
|
|
- List<TbTableInfo> list = tbTableInfoService.list(new QueryWrapper<TbTableInfo>().orderByAsc("create_time").groupBy("business_table"));
|
|
|
|
|
|
+ List<TbTableInfo> list = tbTableInfoService.list(new QueryWrapper<TbTableInfo>().eq("del_flag","0").orderByAsc("create_time").groupBy("business_table"));
|
|
for(TbTableInfo t : list){
|
|
for(TbTableInfo t : list){
|
|
Object obj = JSONObject.parseObject(t.getContent());
|
|
Object obj = JSONObject.parseObject(t.getContent());
|
|
t.setJsonContent(obj);
|
|
t.setJsonContent(obj);
|
|
@@ -93,37 +97,83 @@ public class TbTableInfoController {
|
|
* @desc 条件查询
|
|
* @desc 条件查询
|
|
*/
|
|
*/
|
|
@RequestMapping("/query")
|
|
@RequestMapping("/query")
|
|
- public Result<Object> query(String businessTable,String taskNodeId){
|
|
|
|
- boolean isSave=false;
|
|
|
|
- QueryWrapper<TbTableInfo> queryWrapper = new QueryWrapper<TbTableInfo>().eq("business_table", businessTable);
|
|
|
|
- //查询任务节点是否关联表
|
|
|
|
- List<ActNode> actNodeList= actNodeService.list(new QueryWrapper<ActNode>().eq("node_id",taskNodeId));
|
|
|
|
- if(actNodeList!=null&&actNodeList.size()>0&&StringUtils.isNotBlank(actNodeList.get(0).getTbTableInfoId())){
|
|
|
|
- //如果任务节点id不为空则根据任务节点id查询
|
|
|
|
- queryWrapper.eq("task_node_id",taskNodeId);
|
|
|
|
- isSave=true;//分流程节点填写不同内容的表单 强制给到前台解除保存按钮禁用状态
|
|
|
|
- }else{//没有关联表则不把流程节点id当作查询条件
|
|
|
|
- queryWrapper.and(qw->qw.eq("is_initial","1").or().isNull("is_initial"));
|
|
|
|
- }
|
|
|
|
- TbTableInfo tableInfo = tbTableInfoService.getOne(queryWrapper);
|
|
|
|
- if(tableInfo==null) {
|
|
|
|
- return Result.error("未找到实体");
|
|
|
|
|
|
+ public Result<Object> query(String businessTable,String taskNodeId,String tableId){
|
|
|
|
+ if(StringUtils.isNotBlank(tableId)){
|
|
|
|
+ //表单发起申请完查询随着业务流动json
|
|
|
|
+ return queryBusiness(businessTable,taskNodeId,tableId);
|
|
|
|
+ }else{
|
|
|
|
+ //表单发起申请时查询json(新增)
|
|
|
|
+ return queryInitial(businessTable,taskNodeId);
|
|
}
|
|
}
|
|
- Object obj = JSONObject.parseObject(tableInfo.getContent());
|
|
|
|
- tableInfo.setJsonContent(obj);
|
|
|
|
- if(isSave){
|
|
|
|
- tableInfo.setIsSave(isSave);
|
|
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //获取初始表单Json
|
|
|
|
+ public Result queryInitial(String businessTable,String taskNodeId){
|
|
|
|
+ boolean isSave=false;
|
|
|
|
+ QueryWrapper<TbTableInfo> queryWrapper = new QueryWrapper<TbTableInfo>().eq("business_table", businessTable);
|
|
|
|
+ //查询任务节点是否关联表
|
|
|
|
+ List<ActNode> actNodeList= actNodeService.list(new QueryWrapper<ActNode>().eq("node_id",taskNodeId));
|
|
|
|
+ if(actNodeList!=null&&actNodeList.size()>0&&StringUtils.isNotBlank(actNodeList.get(0).getTbTableInfoId())){
|
|
|
|
+ //如果任务节点id不为空则根据任务节点id查询
|
|
|
|
+ queryWrapper.eq("task_node_id",taskNodeId);
|
|
|
|
+ isSave=true;//分流程节点填写不同内容的表单 强制给到前台解除保存按钮禁用状态
|
|
|
|
+ }else{//没有关联表则不把流程节点id当作查询条件
|
|
|
|
+ queryWrapper.and(qw->qw.eq("is_initial","1").or().isNull("is_initial"));
|
|
|
|
+ }
|
|
|
|
+ TbTableInfo tableInfo = tbTableInfoService.getOne(queryWrapper);
|
|
|
|
+ if(tableInfo==null) {
|
|
|
|
+ return Result.error("未找到实体");
|
|
|
|
+ }
|
|
|
|
+ Object obj = JSONObject.parseObject(tableInfo.getContent());
|
|
|
|
+ tableInfo.setJsonContent(obj);
|
|
|
|
+ if(isSave){
|
|
|
|
+ tableInfo.setIsSave(isSave);
|
|
|
|
+ }
|
|
|
|
+ //获取当前表名称所有的表单数据
|
|
|
|
+ QueryWrapper<TbTableInfo> queryWrapper2 = new QueryWrapper<TbTableInfo>().eq("business_table", businessTable).eq("del_flag","0").orderByAsc("create_time");
|
|
|
|
+ List<TbTableInfo> tbTableInfoList=tbTableInfoService.list(queryWrapper2);
|
|
|
|
+ if(tbTableInfoList!=null){
|
|
|
|
+ for(TbTableInfo t:tbTableInfoList){
|
|
|
|
+ Object obj2 = JSONObject.parseObject(t.getContent());
|
|
|
|
+ t.setJsonContent(obj2);
|
|
}
|
|
}
|
|
- //获取当前表名称所有的表单数据
|
|
|
|
- QueryWrapper<TbTableInfo> queryWrapper2 = new QueryWrapper<TbTableInfo>().eq("business_table", businessTable).eq("del_flag","0").orderByAsc("create_time");
|
|
|
|
- List<TbTableInfo> tbTableInfoList=tbTableInfoService.list(queryWrapper2);
|
|
|
|
- if(tbTableInfoList!=null){
|
|
|
|
- for(TbTableInfo t:tbTableInfoList){
|
|
|
|
- Object obj2 = JSONObject.parseObject(t.getContent());
|
|
|
|
- t.setJsonContent(obj2);
|
|
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
+ tableInfo.setTbTableInfoList(tbTableInfoList);
|
|
|
|
+ return Result.ok(tableInfo);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //随着业务不断变化的json
|
|
|
|
+ public Result queryBusiness(String businessTable,String taskNodeId,String tableId){
|
|
|
|
+ boolean isSave=false;
|
|
|
|
+ QueryWrapper<TbTableInfoPractice> queryWrapper = new QueryWrapper<TbTableInfoPractice>().eq("business_table_id", tableId);
|
|
|
|
+ //查询任务节点是否关联表
|
|
|
|
+ List<ActNode> actNodeList= actNodeService.list(new QueryWrapper<ActNode>().eq("node_id",taskNodeId));
|
|
|
|
+ if(actNodeList!=null&&actNodeList.size()>0&&StringUtils.isNotBlank(actNodeList.get(0).getTbTableInfoId())){
|
|
|
|
+ //如果任务节点id不为空则根据任务节点id查询
|
|
|
|
+ queryWrapper.eq("task_node_id",taskNodeId);
|
|
|
|
+ isSave=true;//分流程节点填写不同内容的表单 强制给到前台解除保存按钮禁用状态
|
|
|
|
+ }else{//没有关联表则不把流程节点id当作查询条件
|
|
|
|
+ queryWrapper.and(qw->qw.eq("is_initial","1").or().isNull("is_initial"));
|
|
|
|
+ }
|
|
|
|
+ TbTableInfoPractice tableInfo = iTbTableInfoPracticeService.getOne(queryWrapper);
|
|
|
|
+ if(tableInfo==null) {
|
|
|
|
+ return Result.error("未找到实体");
|
|
|
|
+ }
|
|
|
|
+ Object obj = JSONObject.parseObject(tableInfo.getContent());
|
|
|
|
+ tableInfo.setJsonContent(obj);
|
|
|
|
+ if(isSave){
|
|
|
|
+ tableInfo.setIsSave(isSave);
|
|
|
|
+ }
|
|
|
|
+ //获取当前表名称所有的表单数据
|
|
|
|
+ QueryWrapper<TbTableInfo> queryWrapper2 = new QueryWrapper<TbTableInfo>().eq("business_table", businessTable).eq("del_flag","0").orderByAsc("create_time");
|
|
|
|
+ List<TbTableInfo> tbTableInfoList=tbTableInfoService.list(queryWrapper2);
|
|
|
|
+ if(tbTableInfoList!=null){
|
|
|
|
+ for(TbTableInfo t:tbTableInfoList){
|
|
|
|
+ Object obj2 = JSONObject.parseObject(t.getContent());
|
|
|
|
+ t.setJsonContent(obj2);
|
|
}
|
|
}
|
|
- tableInfo.setTbTableInfoList(tbTableInfoList);
|
|
|
|
|
|
+ }
|
|
|
|
+ tableInfo.setTbTableInfoList(tbTableInfoList);
|
|
return Result.ok(tableInfo);
|
|
return Result.ok(tableInfo);
|
|
}
|
|
}
|
|
|
|
|