| | |
| | | package com.vci.web.controller; |
| | | |
| | | import com.vci.corba.common.PLException; |
| | | import com.vci.dto.DeleteDataDTO; |
| | | import com.vci.dto.DeleteLinkDataDTO; |
| | | import com.vci.dto.FormDataDTO; |
| | | import com.vci.dto.FormLinkDataDTO; |
| | | import com.vci.starter.web.annotation.controller.VciUnCheckRight; |
| | | import com.vci.starter.web.annotation.log.VciBusinessLog; |
| | | import com.vci.starter.web.exception.VciBaseException; |
| | | import com.vci.starter.web.pagemodel.*; |
| | | import com.vci.web.dto.*; |
| | | import com.vci.web.pageModel.ReferConfigVO; |
| | | import com.vci.web.pageModel.UIFormDataVO; |
| | | import com.vci.pagemodel.ReferConfigVO; |
| | | import com.vci.pagemodel.UIFormDataVO; |
| | | import com.vci.starter.web.util.VciBaseUtil; |
| | | import com.vci.web.query.UIDataGridQuery; |
| | | import com.vci.web.query.UIFormQuery; |
| | | import com.vci.web.query.UITreeQuery; |
| | | import com.vci.web.service.UIDataServiceI; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | private UIDataServiceI uiDataService; |
| | | |
| | | /** |
| | | * 日志 |
| | | */ |
| | | private Logger logger = LoggerFactory.getLogger(getClass()); |
| | | |
| | | /** |
| | | * 列表查询 |
| | | * @param dataGridQuery 查询对象 |
| | | * @return 列表数据 |
| | |
| | | @PostMapping("/dataGridQuery") |
| | | @VciUnCheckRight |
| | | @VciBusinessLog(operateName = "列表数据的查询",description = "${param.btmname}里的${param.tableDefineId}") |
| | | public DataGrid dataGrid(UIDataGridQuery dataGridQuery){ |
| | | public DataGrid dataGrid(UIDataGridQuery dataGridQuery) throws PLException { |
| | | return uiDataService.getDataForGrid(dataGridQuery); |
| | | } |
| | | |
| | |
| | | @VciUnCheckRight |
| | | @VciBusinessLog(operateName = "表单的查询",description = "${param.btmname}里的${param.formDefineId}") |
| | | public BaseResult<UIFormDataVO> getDataForForm(UIFormQuery formQuery){ |
| | | return BaseResult.success(uiDataService.getDataForForm(formQuery)); |
| | | try { |
| | | return BaseResult.success(uiDataService.getDataForForm(formQuery)); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | String errorMsg = "表单数据查询时出现错误,原因:"+ VciBaseUtil.getExceptionMessage(e); |
| | | logger.error(errorMsg); |
| | | throw new VciBaseException(errorMsg); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | @PostMapping("/getDataForTree") |
| | | @VciUnCheckRight |
| | | @VciBusinessLog(operateName = "树的查询",description = "${param.btmname}") |
| | | public List<Tree> getDataForTree(UITreeQuery treeQuery){ |
| | | return uiDataService.getDataForTree(treeQuery); |
| | | public BaseResult getDataForTree(UITreeQuery treeQuery){ |
| | | try { |
| | | return BaseResult.tree(uiDataService.getDataForTree(treeQuery)); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | String errorMsg = "树的数据查询出现错误,原因:"+ VciBaseUtil.getExceptionMessage(e); |
| | | logger.error(errorMsg); |
| | | throw new VciBaseException(errorMsg); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据查询模板查询数据,返回值按照页面定义 |
| | | * @param treeQuery 树查询对象 |
| | | * @return 树的数据 |
| | | */ |
| | | @PostMapping("/getDataByTemp") |
| | | @VciUnCheckRight |
| | | @VciBusinessLog(operateName = "查询") |
| | | public BaseResult getDataByTemp(UITreeQuery treeQuery){ |
| | | try { |
| | | return uiDataService.getDataByTemp(treeQuery); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | String errorMsg = "数据查询出现错误,原因:"+ VciBaseUtil.getExceptionMessage(e); |
| | | logger.error(errorMsg); |
| | | throw new VciBaseException(errorMsg); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | @VciUnCheckRight |
| | | @VciBusinessLog(operateName = "添加数据",description = "${param.btmname}") |
| | | public BaseResult<Map<String,Object>> addSave(@RequestBody FormDataDTO formDataDTO){ |
| | | return uiDataService.addSave(formDataDTO); |
| | | try { |
| | | return uiDataService.addSave(formDataDTO); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | String errorMsg = "添加数据时出现错误,原因:"+ VciBaseUtil.getExceptionMessage(e); |
| | | logger.error(errorMsg); |
| | | throw new VciBaseException(errorMsg); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | @PostMapping("/linkAddSave") |
| | | @VciBusinessLog(operateName = "添加链接数据",description = "${param.linkType}") |
| | | public BaseResult<String> linkAddSave(@RequestBody FormLinkDataDTO formLinkDataDTO){ |
| | | return uiDataService.linkAddSave(formLinkDataDTO); |
| | | try { |
| | | return uiDataService.linkAddSave(formLinkDataDTO); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | String errorMsg = "添加链接类型数据时出现错误,原因:"+ VciBaseUtil.getExceptionMessage(e); |
| | | logger.error(errorMsg); |
| | | throw new VciBaseException(errorMsg); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | @VciUnCheckRight |
| | | @VciBusinessLog(operateName = "修改数据",description = "${param.btmname}里的${param.oid}") |
| | | public BaseResult<Map<String,Object>> editSave(@RequestBody FormDataDTO formDataDTO){ |
| | | return uiDataService.editSave(formDataDTO); |
| | | try { |
| | | return uiDataService.editSave(formDataDTO); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | String errorMsg = "修改数据时出现错误,原因:"+ VciBaseUtil.getExceptionMessage(e); |
| | | logger.error(errorMsg); |
| | | throw new VciBaseException(errorMsg); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | @VciBusinessLog(operateName = "修改链接类型数据",description = "${param.linkType}里的${param.oid}") |
| | | @PutMapping("/linkEditSave") |
| | | public BaseResult linkEditSave(@RequestBody FormLinkDataDTO formLinkDataDTO){ |
| | | return uiDataService.linkEditSave(formLinkDataDTO); |
| | | try { |
| | | return uiDataService.linkEditSave(formLinkDataDTO); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | String errorMsg = "修改链接类型的数据时出现错误,原因:"+ VciBaseUtil.getExceptionMessage(e); |
| | | logger.error(errorMsg); |
| | | throw new VciBaseException(errorMsg); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 数据升版,前端使用JSON提交 |
| | | * 数据升版本/次,前端使用JSON提交 |
| | | * @param formDataDTO 表单数据 |
| | | * @return 执行的结果 |
| | | */ |
| | | @PutMapping("/upRevision") |
| | | @VciBusinessLog(operateName = "数据升版",description = "${param.btmname}里的${param.copyFromVersion}") |
| | | public BaseResult<Map<String,Object>> upRevision(@RequestBody FormDataDTO formDataDTO){ |
| | | public BaseResult<Map<String, Object>> upRevision(@RequestBody FormDataDTO formDataDTO) throws PLException { |
| | | return uiDataService.upRevision(formDataDTO); |
| | | } |
| | | |
| | | /** |
| | | * 数据升版本/次,前端使用JSON提交 |
| | | * @param btmname 业务类型的信息 |
| | | * @param oid 业务数据的主键 |
| | | * @param type 1:版次对象;2:版本对象;3:主对象 |
| | | * @return 执行的结果 |
| | | */ |
| | | @DeleteMapping("/deleteBusinessObject") |
| | | public BaseResult deleteBusinessObject(String btmname , String oid, int type) { |
| | | try { |
| | | return uiDataService.deleteBusinessObject(btmname, oid, type); |
| | | }catch (PLException e){ |
| | | BaseResult<Object> objectBaseResult = new BaseResult<>(); |
| | | objectBaseResult.setCode(Integer.parseInt(e.code)); |
| | | objectBaseResult.setMsg(Arrays.toString(e.messages)); |
| | | return objectBaseResult; |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return 执行的结果 |
| | | */ |
| | | @DeleteMapping("/deleteData") |
| | | @VciUnCheckRight |
| | | //@VciUnCheckRight |
| | | @VciBusinessLog(operateName = "删除数据",description = "${param.dataList.0.btmname}的${param.dataList.${join}.oid}") |
| | | public BaseResult deleteData(@RequestBody DeleteDataDTO deleteDataDTO){ |
| | | return uiDataService.batchDelete(deleteDataDTO); |
| | | try { |
| | | return uiDataService.batchDelete(deleteDataDTO); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | String errorMsg = "删除数据时出现错误,原因:"+ VciBaseUtil.getExceptionMessage(e); |
| | | logger.error(errorMsg); |
| | | throw new VciBaseException(errorMsg); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | @GetMapping("/defaultReferDataGrid") |
| | | @VciBusinessLog(operateName = "获取参照的列表数据",description = "") |
| | | public DataGrid defaultReferDataGrid(ReferConfigVO referConfigVO,PageHelper pageHelper){ |
| | | return uiDataService.referDataGrid(referConfigVO,pageHelper); |
| | | try { |
| | | return uiDataService.referDataGrid(referConfigVO,pageHelper); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | String errorMsg = "默认的参照列表时出现错误,原因:"+ VciBaseUtil.getExceptionMessage(e); |
| | | logger.error(errorMsg); |
| | | throw new VciBaseException(errorMsg); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | re.setData(dataMapList); |
| | | return re; |
| | | } |
| | | /** |
| | | * 变更所有者 |
| | | * @param btmname 业务类型 |
| | | * @param oid 主键 |
| | | * @return 执行的结果 |
| | | */ |
| | | @PutMapping("/changeBusinessObjectOwner") |
| | | public BaseResult changeBusinessObjectOwner(String btmname , String oid) { |
| | | try { |
| | | return uiDataService.changeBusinessObjectOwner(btmname, oid); |
| | | } catch (PLException e) { |
| | | BaseResult<Object> objectBaseResult = new BaseResult<>(); |
| | | objectBaseResult.setCode(Integer.parseInt(e.code)); |
| | | objectBaseResult.setMsg(Arrays.toString(e.messages)); |
| | | return objectBaseResult; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 状态跃迁 |
| | | * @param btmname 业务类型 |
| | | * @param oid 主键 |
| | | * @param releaseStatus 发布状态 |
| | | * @return 执行的结果 |
| | | */ |
| | | @PutMapping("/transferBusinessObject") |
| | | public BaseResult transferBusinessObject(String btmname , String oid, String toStatus, String releaseStatus) { |
| | | try { |
| | | return uiDataService.transferBusinessObject(btmname, oid, toStatus, releaseStatus); |
| | | } catch (PLException e) { |
| | | BaseResult<Object> objectBaseResult = new BaseResult<>(); |
| | | objectBaseResult.setCode(Integer.parseInt(e.code)); |
| | | objectBaseResult.setMsg(Arrays.toString(e.messages)); |
| | | return objectBaseResult; |
| | | } |
| | | } |
| | | } |