| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.sql.Timestamp; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "分页查询并返回记录数") |
| | | @ApiOperation(value = "分页查询申请") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "userid", value = "用户ID", dataType = "Integer", paramType = "query", example = ""), |
| | | @ApiImplicitParam(name = "uname", value = "用户名", dataType = "String", paramType = "query", example = "员"), |
| | | @ApiImplicitParam(name = "type", value = "类型", dataType = "Integer", paramType = "query", example = "3"), |
| | | @ApiImplicitParam(name = "start", value = "开始时间", dataType = "Timestamp", paramType = "query", example = "2022-12-09 09:00:00"), |
| | | @ApiImplicitParam(name = "end", value = "结束时间", dataType = "Timestamp", paramType = "query", example = "2022-12-25 17:00:00"), |
| | | @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "Integer", paramType = "query", example = "10"), |
| | | @ApiImplicitParam(name = "pageIndex", value = "分页数(从1开始)", dataType = "Integer", paramType = "query", example = "1") |
| | | }) |
| | | @GetMapping(value = "/selectByPageAndCount") |
| | | public ResponseMsg<List<ApplyEntity>> selectByPageAndCount(Integer userid, Integer pageSize, Integer pageIndex) { |
| | | @GetMapping(value = "/selectByPage") |
| | | public ResponseMsg<Object> selectByPage(String uname, Integer type, Timestamp start, Timestamp end, Integer pageSize, Integer pageIndex) { |
| | | try { |
| | | if (pageSize < 1 || pageIndex < 1) { |
| | | return fail("每页页数或分页数小于1", null); |
| | | } |
| | | |
| | | int count = applyService.selectCount(userid); |
| | | int count = applyService.selectCount(0); |
| | | if (count == 0) { |
| | | return success(0, null); |
| | | } |
| | | |
| | | List<ApplyEntity> rs = applyService.selectByPage(userid, pageSize, pageSize * (pageIndex - 1)); |
| | | List<ApplyEntity> rs = applyService.selectByPage(0, pageSize, pageSize * (pageIndex - 1)); |
| | | |
| | | return success(count, rs); |
| | | } catch (Exception ex) { |
| | |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "插入一条") |
| | | @ApiOperation(value = "查询流程") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "entity", value = "实体类", dataType = "ApplyEntity", paramType = "body") |
| | | @ApiImplicitParam(name = "applyId", value = "数据申请ID", dataType = "Integer", paramType = "query", example = "1") |
| | | }) |
| | | @PostMapping(value = "/insert", produces = "application/json; charset=UTF-8") |
| | | public ResponseMsg<Integer> insert(@RequestBody ApplyEntity entity, HttpServletRequest req) { |
| | | @GetMapping(value = "/selectFlows") |
| | | public ResponseMsg<Object> selectFlows(Integer applyId) { |
| | | try { |
| | | UserEntity ue = tokenService.getCurrentUser(req); |
| | | if (ue != null) { |
| | | entity.setCreateUser(ue.getId()); |
| | | } |
| | | // |
| | | |
| | | int count = applyService.insert(entity); |
| | | |
| | | return success(count); |
| | | return success(null); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), -1); |
| | | return fail(ex.getMessage(), null); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "删除多条") |
| | | @ApiOperation(value = "废弃申请") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "ids", value = "ID数组", dataType = "Integer", paramType = "query", example = "1,2") |
| | | @ApiImplicitParam(name = "applyId", value = "数据申请ID", dataType = "Integer", paramType = "query", example = "1") |
| | | }) |
| | | @GetMapping(value = "/deletes") |
| | | public ResponseMsg<Integer> deletes(@RequestParam List<Integer> ids) { |
| | | @GetMapping(value = "/deleteForDiscard") |
| | | public ResponseMsg<Object> deleteForDiscard(Integer applyId) { |
| | | try { |
| | | if (ids == null || ids.isEmpty()) { |
| | | return fail("id数组不能为空", -1); |
| | | } |
| | | // |
| | | |
| | | int count = applyService.deletes(ids); |
| | | |
| | | return success(count); |
| | | return success(null); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), -1); |
| | | return fail(ex.getMessage(), null); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "更新一条") |
| | | @ApiOperation(value = "提交流程") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "entity", value = "实体类", dataType = "ApplyEntity", paramType = "body") |
| | | @ApiImplicitParam(name = "flowId", value = "申请流程ID", dataType = "Integer", paramType = "query", example = "1") |
| | | }) |
| | | @ResponseBody |
| | | @PostMapping(value = "/update", produces = "application/json; charset=UTF-8") |
| | | public ResponseMsg<Integer> update(@RequestBody ApplyEntity entity, HttpServletRequest req) { |
| | | public ResponseMsg<Object> updateForSubmit(Integer flowId) { |
| | | try { |
| | | UserEntity ue = tokenService.getCurrentUser(req); |
| | | if (ue != null) { |
| | | entity.setUpdateUser(ue.getId()); |
| | | } |
| | | |
| | | int count = applyService.update(entity); |
| | | |
| | | return success(count); |
| | | return success(null); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), -1); |
| | | return fail(ex.getMessage(), null); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "打回流程") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "flowId", value = "申请流程ID", dataType = "Integer", paramType = "query", example = "1") |
| | | }) |
| | | public ResponseMsg<Object> updateForReject(Integer flowId) { |
| | | try { |
| | | |
| | | return success(null); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | } |
| | | } |
| | | } |