| | |
| | | package com.vci.ubcs.code.controller; |
| | | |
| | | import com.vci.ubcs.code.service.CodeClassifyProcessTempServiceI; |
| | | import com.vci.starter.web.pagemodel.BaseQueryObject; |
| | | import com.vci.starter.web.pagemodel.BaseResult; |
| | | import com.vci.starter.web.pagemodel.DataGrid; |
| | | import com.vci.starter.web.util.VciBaseUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.vci.ubcs.code.dto.CodeClassifyProcessTempDTO; |
| | | import com.vci.ubcs.code.entity.CodeClassifyProcessTemp; |
| | | import com.vci.ubcs.code.service.ICodeClassifyProcessTempService; |
| | | import com.vci.ubcs.code.vo.pagemodel.CodeClassifyProcessTempVO; |
| | | import com.vci.ubcs.starter.web.constant.QueryOptionConstant; |
| | | import com.vci.ubcs.starter.web.pagemodel.BaseQueryObject; |
| | | import com.vci.ubcs.starter.web.pagemodel.DataGrid; |
| | | import com.vci.ubcs.starter.web.util.VciBaseUtil; |
| | | import com.vci.ubcs.starter.web.wrapper.VciQueryWrapperForDO; |
| | | import io.swagger.annotations.Api; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.cglib.beans.BeanMap; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | import javax.validation.Valid; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | |
| | | /** |
| | | * 分类使用的流程模板控制器 |
| | |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/codeClsProcessTempController") |
| | | @AllArgsConstructor |
| | | @Api(value = "编码库定义-流程模板", tags = "编码库定义-流程模板接口") |
| | | public class CodeClassifyProcessTempController { |
| | | |
| | | /** |
| | | * 分类使用的流程模板 服务 |
| | | */ |
| | | @Autowired |
| | | private CodeClassifyProcessTempServiceI codeClassifyProcessTempService; |
| | | private ICodeClassifyProcessTempService codeClassifyProcessTempService; |
| | | |
| | | /** |
| | | * 分类使用的流程模板列表 |
| | |
| | | * @return 分类使用的流程模板显示对象列表 |
| | | */ |
| | | @GetMapping("/gridCodeClassifyProcessTemp") |
| | | public DataGrid<CodeClassifyProcessTempVO> gridCodeClassifyProcessTemp(BaseQueryObject baseQueryObject){ |
| | | public R<IPage<CodeClassifyProcessTempVO>> gridCodeClassifyProcessTemp(BaseQueryObject baseQueryObject){ |
| | | if(baseQueryObject == null){ |
| | | baseQueryObject = new BaseQueryObject(); |
| | | } |
| | | return codeClassifyProcessTempService.gridCodeClassifyProcessTemp(baseQueryObject.getConditionMap(),baseQueryObject.getPageHelper()); |
| | | return R.data(codeClassifyProcessTempService.gridCodeClassifyProcessTemp(baseQueryObject.getConditionMap(),baseQueryObject.getPageHelper())); |
| | | } |
| | | |
| | | /** |
| | | * 增加 分类使用的流程模板 |
| | | * @param codeClassifyProcessTempDTO 分类使用的流程模板数据传输对象 |
| | | * @return 执行结果,success为true表示成功,msg是失败的提示信息,obj是添加完成后的显示对象 |
| | | */ |
| | | @PostMapping( "/addSave") |
| | | public BaseResult<CodeClassifyProcessTempVO> addSave(@RequestBody CodeClassifyProcessTempDTO codeClassifyProcessTempDTO){ |
| | | public R<CodeClassifyProcessTempVO> addSave(@RequestBody CodeClassifyProcessTempDTO codeClassifyProcessTempDTO){ |
| | | CodeClassifyProcessTempVO codeClassifyProcessTempVO = codeClassifyProcessTempService.addSave(codeClassifyProcessTempDTO); |
| | | return BaseResult.success(codeClassifyProcessTempVO); |
| | | return R.data(codeClassifyProcessTempVO); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return 执行结果,success为true表示成功,msg是失败的提示信息,obj是添加完成后的显示对象 |
| | | */ |
| | | @PutMapping("/editSave") |
| | | public BaseResult<CodeClassifyProcessTempVO> editSave(@RequestBody CodeClassifyProcessTempDTO codeClassifyProcessTempDTO){ |
| | | public R<CodeClassifyProcessTempVO> editSave(@RequestBody CodeClassifyProcessTempDTO codeClassifyProcessTempDTO){ |
| | | CodeClassifyProcessTempVO codeClassifyProcessTempVO = codeClassifyProcessTempService.editSave(codeClassifyProcessTempDTO); |
| | | return BaseResult.success(codeClassifyProcessTempVO); |
| | | return R.data(codeClassifyProcessTempVO); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 删除分类使用的流程模板 |
| | |
| | | * @return 删除结果反馈::success:成功,fail:失败 |
| | | */ |
| | | @DeleteMapping( "/deleteData") |
| | | public BaseResult delCodeClassifyProcessTemp( CodeClassifyProcessTempDTO codeClassifyProcessTempDTO) { |
| | | public R delCodeClassifyProcessTemp(@Valid @RequestBody CodeClassifyProcessTempDTO codeClassifyProcessTempDTO) { |
| | | return codeClassifyProcessTempService.deleteCodeClassifyProcessTemp(codeClassifyProcessTempDTO); |
| | | } |
| | | |
| | |
| | | * @return 分类使用的流程模板显示对象 |
| | | */ |
| | | @GetMapping("/getObjectByOid") |
| | | public BaseResult<CodeClassifyProcessTempVO> getObjectByOid(String oid){ |
| | | public R<CodeClassifyProcessTempVO> getObjectByOid(String oid){ |
| | | CodeClassifyProcessTempVO codeClassifyProcessTempVO = codeClassifyProcessTempService.getObjectByOid(oid); |
| | | return BaseResult.success(codeClassifyProcessTempVO); |
| | | return R.data(codeClassifyProcessTempVO); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return 分类使用的流程模板显示对象 |
| | | */ |
| | | @GetMapping("/listDataByOids") |
| | | public BaseResult<CodeClassifyProcessTempVO> listCodeClassifyProcessTempByOids(String oids){ |
| | | public R<Collection<CodeClassifyProcessTempVO>> listCodeClassifyProcessTempByOids(String oids){ |
| | | Collection<CodeClassifyProcessTempVO> voCollection = codeClassifyProcessTempService.listCodeClassifyProcessTempByOids(VciBaseUtil.str2List(oids)); |
| | | BaseResult baseResult = BaseResult.success(); |
| | | baseResult.setData(voCollection); |
| | | return baseResult; |
| | | return R.data(voCollection); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 参照分类使用的流程模板列表 |
| | |
| | | * @return 分类使用的流程模板显示对象列表,生效的内容 |
| | | */ |
| | | @GetMapping("/refDataGrid") |
| | | public DataGrid<CodeClassifyProcessTempVO> refDataGridCodeClassifyProcessTemp(BaseQueryObject baseQueryObject){ |
| | | public R<IPage<CodeClassifyProcessTempVO>> refDataGridCodeClassifyProcessTemp(BaseQueryObject baseQueryObject){ |
| | | if(baseQueryObject == null){ |
| | | baseQueryObject = new BaseQueryObject(); |
| | | } |
| | | return codeClassifyProcessTempService.refDataGridCodeClassifyProcessTemp(baseQueryObject.getConditionMap(),baseQueryObject.getPageHelper()); |
| | | return R.data(codeClassifyProcessTempService.refDataGridCodeClassifyProcessTemp(baseQueryObject.getConditionMap(),baseQueryObject.getPageHelper())); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return 流程模板的信息 |
| | | */ |
| | | @GetMapping("/listProcessTemplate") |
| | | public BaseResult<CodeClassifyProcessTempVO> listProcessTemplate(String codeTemplateOid,String processUse){ |
| | | public R<List<CodeClassifyProcessTempVO>> listProcessTemplate(String codeTemplateOid,String processUse){ |
| | | List<CodeClassifyProcessTempVO> processTempVOList = codeClassifyProcessTempService.listProcessTemplate(codeTemplateOid,processUse); |
| | | BaseResult result = BaseResult.success(); |
| | | result.setData(processTempVOList); |
| | | return result; |
| | | return R.data(processTempVOList); |
| | | } |
| | | |
| | | /** |
| | | * 使用模板获取使用的流程模板 |
| | | * @param codeTemplateOid 模板的主键 |
| | | * @param processUse 流程的用途 |
| | | * @return 流程模板的信息 |
| | | */ |
| | | @GetMapping("/listSameProcessTemplate") |
| | | public R<CodeClassifyProcessTempVO> listSameProcessTemplate(String codeTemplateOid,String processUse){ |
| | | VciBaseUtil.alertNotNull(codeTemplateOid,"所选择的数据模板主键"); |
| | | String s3 = VciBaseUtil.toInSql(codeTemplateOid); |
| | | /*Map<String,String> conditionMap=new HashMap<>(); |
| | | conditionMap.put("classifyTemplateOid", QueryOptionConstant.IN + VciBaseUtil.toInSql(codeTemplateOid)); |
| | | conditionMap.put("codeprocessuse",processUse);*/ |
| | | LambdaQueryWrapper<CodeClassifyProcessTemp> LambdaQueryWrapper = Wrappers.<CodeClassifyProcessTemp>query() |
| | | .lambda().in(CodeClassifyProcessTemp::getClassifyTemplateOid, codeTemplateOid.split(",")) |
| | | .eq(CodeClassifyProcessTemp::getCodeProcessUse, processUse); |
| | | |
| | | List<CodeClassifyProcessTempVO> codeClassifyProcessTempVOS = codeClassifyProcessTempService.selectByWrapper(LambdaQueryWrapper); |
| | | //根据模板将数据整合在一起,去校验 |
| | | Map<String/**模板oid**/, List<CodeClassifyProcessTempVO>/**数据对象**/> templateProcessTempateVOMap = |
| | | codeClassifyProcessTempVOS.stream().collect(Collectors.toMap(CodeClassifyProcessTempVO::getId, s->{ |
| | | List<CodeClassifyProcessTempVO> l=new ArrayList<>(); |
| | | l.add(s); |
| | | return l; |
| | | },(List<CodeClassifyProcessTempVO> s1,List<CodeClassifyProcessTempVO> s2)->{ |
| | | s1.addAll(s2); |
| | | return s1; |
| | | })); |
| | | if(templateProcessTempateVOMap.size()>1){ |
| | | return R.fail("流程模板不统一,不允许发起流程"); |
| | | }else { |
| | | return R.data(codeClassifyProcessTempVOS.get(0)); |
| | | } |
| | | } |
| | | |
| | | } |