| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
| | | import com.vci.ubcs.code.dto.CodeBasicSecDTO; |
| | | import com.vci.ubcs.code.dto.CodeOrderDTO; |
| | | import com.vci.ubcs.code.dto.CodeRuleDTO; |
| | | import com.vci.ubcs.code.entity.CodeBasicSec; |
| | | import com.vci.ubcs.code.service.ICodeBasicSecService; |
| | | import com.vci.ubcs.code.vo.pagemodel.CodeBasicSecVO; |
| | | import com.vci.ubcs.code.vo.pagemodel.CodeRuleVO; |
| | | import com.vci.ubcs.code.wrapper.CodeBasicSecWrapper; |
| | | import com.vci.ubcs.com.vci.starter.exception.VciBaseException; |
| | | import com.vci.ubcs.starter.exception.VciBaseException; |
| | | import com.vci.ubcs.starter.web.pagemodel.BladeQueryObject; |
| | | import com.vci.ubcs.starter.web.util.VciBaseUtil; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.rmi.ServerException; |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | |
| | | |
| | | /** |
| | |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/codeBasicSecController") |
| | | @Api(value = "码段基础信息控制器", tags = "码段基础信息控制器") |
| | | public class CodeBasicSecController { |
| | | |
| | | /** |
| | |
| | | @Autowired |
| | | private ICodeBasicSecService codeBasicSecService; |
| | | |
| | | /** |
| | | * 编码规则 分页 |
| | | */ |
| | | @GetMapping("/list") |
| | | @ApiOperationSupport(order = 1) |
| | | @ApiOperation(value = "分页", notes = "传入codeRuleVO") |
| | | public R<IPage<CodeBasicSecVO>> list(CodeBasicSec codeBasicSec, Query query) { |
| | | IPage<CodeBasicSec> pages = codeBasicSecService.page(Condition.getPage(query), Condition.getQueryWrapper(codeBasicSec)); |
| | | return R.data(CodeBasicSecWrapper.build().pageVO(pages)); |
| | | } |
| | | |
| | | /** |
| | | * 码段基础信息列表 |
| | | * @param codeBasicSecVO 基础查询对象,包含查询条件,分页,排序等 |
| | | * @param bladeQueryObject 基础查询对象,包含查询条件,分页,排序等 |
| | | * @return 码段基础信息显示对象列表 |
| | | */ |
| | | @GetMapping("/gridCodeBasicSec") |
| | | @ApiOperationSupport(order = 2) |
| | | @ApiOperation(value = "分页", notes = "传入codeRuleVO") |
| | | public R<IPage<CodeBasicSecVO>> gridCodeBasicSec(CodeBasicSecVO codeBasicSecVO, Query query){ |
| | | IPage<CodeBasicSecVO> codeRuleVOIPage = codeBasicSecService.gridCodeBasicSec(Condition.getPage(query.setAscs("ordernum")),codeBasicSecVO); |
| | | @ApiOperation(value = "分页 码段基础信息列表", notes = "传入codeRuleVO") |
| | | public R<IPage<CodeBasicSecVO>> gridCodeBasicSec(BladeQueryObject bladeQueryObject) throws Exception{ |
| | | IPage<CodeBasicSecVO> codeRuleVOIPage = codeBasicSecService.gridCodeBasicSec(bladeQueryObject.getQuery().setAscs("ordernum"),bladeQueryObject.getConditionMap()); |
| | | return R.data(codeRuleVOIPage); |
| | | } |
| | | |
| | |
| | | */ |
| | | @PostMapping( "/addSave") |
| | | @ApiOperationSupport(order = 3) |
| | | @ApiOperation(value = "增加", notes = "codeBasicSecDTO") |
| | | public R addSave(@RequestBody CodeBasicSecDTO codeBasicSecDTO){ |
| | | boolean resBoolean = false; |
| | | @ApiOperation(value = "增加 码段基础信息", notes = "codeBasicSecDTO") |
| | | public R addSave(@Valid @RequestBody CodeBasicSecDTO codeBasicSecDTO){ |
| | | boolean resBoolean; |
| | | try { |
| | | resBoolean = codeBasicSecService.addSave(codeBasicSecDTO); |
| | | } catch (VciBaseException e) { |
| | | return R.fail(e.getCode()); |
| | | } |
| | | return R.data(resBoolean); |
| | | return R.status(resBoolean); |
| | | } |
| | | |
| | | /* *//** |
| | | * 修改 码段基础信息 |
| | | /** 修改 码段基础信息 |
| | | * @param codeBasicSecDTO 码段基础信息数据传输对象 |
| | | * @return 执行结果,success为true表示成功,msg是失败的提示信息,obj是添加完成后的显示对象 |
| | | *//* |
| | | */ |
| | | @PutMapping("/editSave") |
| | | public R<CodeBasicSecVO> editSave(@RequestBody CodeBasicSecDTO codeBasicSecDTO){ |
| | | CodeBasicSecVO codeBasicSecVO = null; |
| | | @ApiOperationSupport(order = 4) |
| | | @ApiOperation(value = "修改 码段基础信息", notes = "codeBasicSecDTO") |
| | | public R editSave(@RequestBody CodeBasicSecDTO codeBasicSecDTO){ |
| | | boolean resBoolean; |
| | | try { |
| | | codeBasicSecVO = codeBasicSecService.editSave(codeBasicSecDTO); |
| | | } catch (VciBaseException e) { |
| | | resBoolean = codeBasicSecService.editSave(codeBasicSecDTO); |
| | | } catch (VciBaseException e) { |
| | | return R.fail(e.getCode()); |
| | | } |
| | | return R.success(codeBasicSecVO); |
| | | return R.status(resBoolean); |
| | | } |
| | | |
| | | |
| | | *//** |
| | | /** |
| | | * 删除码段基础信息 |
| | | * @param codeBasicSecDTO 码段基础信息数据传输对象,oid和ts需要传输 |
| | | * @return 删除结果反馈::success:成功,fail:失败 |
| | | *//* |
| | | */ |
| | | @DeleteMapping( "/deleteData") |
| | | public R delCodeBasicSec(CodeBasicSecDTO codeBasicSecDTO) { |
| | | @ApiOperationSupport(order = 5) |
| | | @ApiOperation(value = "删除码段基础信息", notes = "codeBasicSecDTO") |
| | | public R delCodeBasicSec(@Valid @RequestBody CodeBasicSecDTO codeBasicSecDTO) { |
| | | return codeBasicSecService.deleteCodeBasicSec(codeBasicSecDTO); |
| | | } |
| | | |
| | | *//** |
| | | /** |
| | | * 主键获取码段基础信息 |
| | | * @param oid 主键 |
| | | * @return 码段基础信息显示对象 |
| | | *//* |
| | | */ |
| | | @GetMapping("/getObjectByOid") |
| | | @ApiOperationSupport(order = 6) |
| | | @ApiOperation(value = "删除码段基础信息", notes = "codeBasicSecDTO") |
| | | public R<CodeBasicSecVO> getObjectByOid(String oid){ |
| | | CodeBasicSecVO codeBasicSecVO = codeBasicSecService.getObjectByOid(oid); |
| | | return BaseResult.success(codeBasicSecVO); |
| | | return R.data(codeBasicSecVO); |
| | | } |
| | | |
| | | *//** |
| | | /** |
| | | * 主键批量获取码段基础信息 |
| | | * @param oids 主键,多个以逗号分隔,但是受性能影响,建议一次查询不超过10000个 |
| | | * @return 码段基础信息显示对象 |
| | | *//* |
| | | */ |
| | | @GetMapping("/listDataByOids") |
| | | public R<CodeBasicSecVO> listCodeBasicSecByOids(String oids){ |
| | | Collection<CodeBasicSecVO> voCollection = codeBasicSecService.listCodeBasicSecByOids(VciBaseUtil.str2List(oids)); |
| | | R baseResult = R.success(); |
| | | baseResult.setData(voCollection); |
| | | return baseResult; |
| | | @ApiOperationSupport(order = 7) |
| | | @ApiOperation(value = "主键批量获取码段基础信息", notes = "oids") |
| | | public R<Collection<CodeBasicSecVO>> listCodeBasicSecByOids(String oids){ |
| | | Collection<CodeBasicSecVO> voCollection = codeBasicSecService.listCodeBasicSecByOids(VciBaseUtil.str2List(oids)); |
| | | return R.data(voCollection); |
| | | } |
| | | |
| | | |
| | | |
| | | *//** |
| | | /** |
| | | * 参照码段基础信息列表 |
| | | * @param baseQueryObject 基础查询对象,包含查询条件,分页,排序等 |
| | | * @param bladeQueryObject 基础查询对象,包含查询条件,分页,排序等 |
| | | * @return 码段基础信息显示对象列表,生效的内容 |
| | | *//* |
| | | */ |
| | | @GetMapping("/refDataGrid") |
| | | public R<IPage<CodeBasicSecVO>> refDataGridCodeBasicSec(BaseQueryObject baseQueryObject){ |
| | | if(baseQueryObject == null){ |
| | | baseQueryObject = new BaseQueryObject(); |
| | | } |
| | | return codeBasicSecService.refDataGridCodeBasicSec(baseQueryObject.getConditionMap(),baseQueryObject.getPageHelper()); |
| | | @ApiOperationSupport(order = 8) |
| | | @ApiOperation(value = "参照码段基础信息列表", notes = "codeBasicSecVO") |
| | | public R<IPage<CodeBasicSecVO>> refDataGridCodeBasicSec(BladeQueryObject bladeQueryObject){ |
| | | return R.data(codeBasicSecService.refDataGridCodeBasicSec(bladeQueryObject.getQuery(), bladeQueryObject.getConditionMap())); |
| | | } |
| | | |
| | | *//** |
| | | /** |
| | | * 参数分类码段基础信息列表 |
| | | * @param baseQueryObject 基础查询对象,包含查询条件,分页,排序等,必须要有编码规则的主键 pkCodeRule |
| | | * @param bladeQueryObject 基础查询对象,包含查询条件,分页,排序等,必须要有编码规则的主键 pkCodeRule |
| | | * @return 码段的信息 |
| | | *//* |
| | | */ |
| | | @GetMapping("/refDataGridClassifySec") |
| | | public R<IPage<CodeBasicSecVO>> refDataGridClassifySec(BaseQueryObject baseQueryObject){ |
| | | if(baseQueryObject == null){ |
| | | baseQueryObject = new BaseQueryObject(); |
| | | } |
| | | return codeBasicSecService.refDataGridClassifySec(baseQueryObject.getConditionMap(),baseQueryObject.getPageHelper()); |
| | | @ApiOperationSupport(order = 9) |
| | | @ApiOperation(value = "参数分类码段基础信息列表", notes = "codeBasicSecVO") |
| | | public R<IPage<CodeBasicSecVO>> refDataGridClassifySec(BladeQueryObject bladeQueryObject){ |
| | | return R.data(codeBasicSecService.refDataGridClassifySec(bladeQueryObject.getQuery(), bladeQueryObject.getConditionMap())); |
| | | } |
| | | |
| | | *//** |
| | | /** |
| | | * 克隆码段信息 |
| | | * @param codeBasicSecDTO 码段基础信息数据传输对象,oidArr:选择源码段主键的集合,pkCodeRule:目标编码规则的主键 |
| | | * @return 克隆结果反馈::success:成功,fail:失败 |
| | | *//* |
| | | */ |
| | | @PostMapping("/clone") |
| | | public R cloneCodeBasicSec(@RequestBody CodeBasicSecDTO codeBasicSecDTO){ |
| | | @ApiOperationSupport(order = 10) |
| | | @ApiOperation(value = "克隆码段信息", notes = "codeBasicSecDTO") |
| | | public R cloneCodeBasicSec(@RequestBody CodeBasicSecDTO codeBasicSecDTO) throws ServerException { |
| | | VciBaseUtil.alertNotNull(codeBasicSecDTO.getOidArr(),"选择码段主键"); |
| | | List<String> oidArr = VciBaseUtil.str2List(codeBasicSecDTO.getOidArr()); |
| | | if (CollectionUtils.isEmpty(oidArr)){ |
| | |
| | | return codeBasicSecService.cloneCodeBasicSec(oidArr,codeBasicSecDTO.getPkCodeRule()); |
| | | } |
| | | |
| | | *//** |
| | | /** |
| | | * 查询目标分类码段所在的树结构 |
| | | * @param oid 目标分类码段主键 |
| | | * @return 分类码段树结构 |
| | | *//* |
| | | @GetMapping("/treeCodeClassifySec") |
| | | */ |
| | | /*@GetMapping("/treeCodeClassifySec") |
| | | @ApiOperationSupport(order = 11) |
| | | @ApiOperation(value = "查询目标分类码段所在的树结构", notes = "oid") |
| | | public List<Tree> gridCodeClassifySecTree (String oid){ |
| | | VciBaseUtil.alertNotNull(oid,"分类码段主键"); |
| | | return codeBasicSecService.gridCodeClassifySecTree(oid); |
| | | } |
| | | }*/ |
| | | |
| | | *//** |
| | | /** |
| | | * 上移 |
| | | * @param oid 主键 |
| | | * @return 执行结果 |
| | | *//* |
| | | */ |
| | | @PostMapping("/upOrderNum") |
| | | public R upOrderNum(String oid){ |
| | | codeBasicSecService.upOrderNum(oid); |
| | | return R.success(); |
| | | @ApiOperationSupport(order = 11) |
| | | @ApiOperation(value = "上移", notes = "oid") |
| | | public R upOrderNum(@Valid @RequestParam String oid){ |
| | | return R.status(codeBasicSecService.upOrderNum(oid)); |
| | | } |
| | | |
| | | *//** |
| | | /** |
| | | * 下移 |
| | | * @param oid 主键 |
| | | * @return 执行结果 |
| | | *//* |
| | | */ |
| | | @PostMapping("/downOrderNum") |
| | | public R downOrderNum(String oid){ |
| | | codeBasicSecService.downOrderNum(oid); |
| | | return R.success(); |
| | | }*/ |
| | | @ApiOperationSupport(order = 12) |
| | | @ApiOperation(value = "下移", notes = "oid") |
| | | public R downOrderNum(@Valid @RequestParam String oid){ |
| | | return R.status(codeBasicSecService.downOrderNum(oid)); |
| | | } |
| | | |
| | | /** |
| | | * 查询编码规则的所有流水依赖的码段 |
| | | * @param ruleOid 编码规则主键 |
| | | * @return |
| | | */ |
| | | @GetMapping("/getCodeRuleAndBasicSecByRuleOid") |
| | | @ApiOperationSupport(order = 13) |
| | | @ApiOperation(value = "查询编码规则的所有流水依赖的码段", notes = "传入oid") |
| | | public R<CodeRuleVO> getCodeRuleAndBasicSecByRuleOid(String ruleOid){ |
| | | return R.data(codeBasicSecService.getSerialNumberDepend(ruleOid)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 设置最大流水号 |
| | | * @param codeOrderDTO 编码申请传输对象 |
| | | * @return |
| | | */ |
| | | @PostMapping("/setMaxSerialNumberForCodeRule") |
| | | @ApiOperationSupport(order = 14) |
| | | @ApiOperation(value = "设置最大流水号", notes = "codeOrderDTO") |
| | | public R setMaxSerialNumberForCodeRule(@RequestBody CodeOrderDTO codeOrderDTO){ |
| | | return R.success(codeBasicSecService.setMaxSerialNumberForCodeRule(codeOrderDTO)); |
| | | } |
| | | } |