| | |
| | | import com.lf.server.annotation.SysLog; |
| | | import com.lf.server.controller.all.BaseController; |
| | | import com.lf.server.entity.all.ResponseMsg; |
| | | import com.lf.server.entity.ctrl.DownloadReqEntity; |
| | | import com.lf.server.entity.show.ApplyEntity; |
| | | import com.lf.server.entity.sys.UserEntity; |
| | | import com.lf.server.helper.AesHelper; |
| | | import com.lf.server.helper.StringHelper; |
| | | import com.lf.server.service.data.DownloadService; |
| | | import com.lf.server.service.show.ApplyService; |
| | | import com.lf.server.service.sys.TokenService; |
| | | import io.swagger.annotations.Api; |
| | |
| | | TokenService tokenService; |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "æ¥è¯¢è®°å½æ°") |
| | | @ApiOperation(value = "æå
¥æ°æ®ç³è¯·") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "userid", value = "ç¨æ·ID", dataType = "Integer", paramType = "query", required = false, example = "") |
| | | @ApiImplicitParam(name = "reqEntity", value = "请æ±ä¸è½½å®ä½", dataType = "DownloadReqEntity", paramType = "body") |
| | | }) |
| | | @GetMapping({"/selectCount"}) |
| | | public ResponseMsg<Integer> selectCount(Integer userid) { |
| | | @ResponseBody |
| | | @PostMapping(value = "/insertApply") |
| | | public ResponseMsg<Object> insertApply(@RequestBody DownloadReqEntity reqEntity, HttpServletRequest req) { |
| | | try { |
| | | int count = applyService.selectCount(userid); |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), -1); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "å页æ¥è¯¢") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "userid", value = "ç¨æ·ID", dataType = "Integer", paramType = "query", example = ""), |
| | | @ApiImplicitParam(name = "pageSize", value = "æ¯é¡µæ¡æ°", dataType = "Integer", paramType = "query", example = "10"), |
| | | @ApiImplicitParam(name = "pageIndex", value = "å页æ°ï¼ä»1å¼å§ï¼", dataType = "Integer", paramType = "query", example = "1") |
| | | }) |
| | | @GetMapping(value = "/selectByPage") |
| | | public ResponseMsg<List<ApplyEntity>> selectByPage(Integer userid, Integer pageSize, Integer pageIndex) { |
| | | try { |
| | | if (pageSize < 1 || pageIndex < 1) { |
| | | return fail("æ¯é¡µé¡µæ°æå页æ°å°äº1", null); |
| | | if (null == reqEntity || StringHelper.isEmpty(reqEntity.getPwd())) { |
| | | return fail("å¯ç ä¸è½ä¸ºç©º"); |
| | | } |
| | | if (null == reqEntity.getEntities() || reqEntity.getEntities().isEmpty()) { |
| | | return fail("è¯·éæ©è¦ä¸è½½çå®ä½å"); |
| | | } |
| | | if (null == reqEntity.getIds() || reqEntity.getIds().isEmpty()) { |
| | | return fail("è¯·éæ©åä½ID"); |
| | | } |
| | | reqEntity.setWkt(AesHelper.decrypt(reqEntity.getWkt())); |
| | | if (StringHelper.isEmpty(reqEntity.getWkt())) { |
| | | return fail("è¯·éæ©è¦ä¸è½½çWKTèå´"); |
| | | } |
| | | if (!DownloadService.decryptPwd(reqEntity)) { |
| | | return fail("å¯ç è§£å¯å¤±è´¥", null); |
| | | } |
| | | if (!StringHelper.checkPwdValid(reqEntity.getPwd())) { |
| | | return fail("å¯ç ä¸ç¬¦åè¦æ±"); |
| | | } |
| | | |
| | | List<ApplyEntity> rs = applyService.selectByPage(userid, pageSize, pageSize * (pageIndex - 1)); |
| | | UserEntity ue = tokenService.getCurrentUser(req); |
| | | // |
| | | |
| | | return success(rs); |
| | | return success(null); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | } |
| | |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "æ¥è¯¢ææ") |
| | | @GetMapping(value = "/selectAll") |
| | | public ResponseMsg<List<ApplyEntity>> selectAll() { |
| | | try { |
| | | List<ApplyEntity> list = applyService.selectAll(); |
| | | |
| | | return success(list); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "æ ¹æ®IDæ¥è¯¢") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "ID", dataType = "int", paramType = "query", example = "1") |
| | | }) |
| | | @GetMapping(value = "/selectById") |
| | | public ResponseMsg<ApplyEntity> selectById(int id) { |
| | | try { |
| | | ApplyEntity entity = applyService.selectById(id); |
| | | |
| | | return success(entity); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "æå
¥ä¸æ¡") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "entity", value = "å®ä½ç±»", dataType = "ApplyEntity", paramType = "body") |
| | |
| | | } |
| | | |
| | | int count = applyService.insert(entity); |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), -1); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "æå
¥å¤æ¡") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "list", value = "å®ä½ç±»éå", dataType = "ApplyEntity", paramType = "body") |
| | | }) |
| | | @PostMapping(value = "/inserts", produces = "application/json; charset=UTF-8") |
| | | public ResponseMsg<Integer> inserts(@RequestBody List<ApplyEntity> list, HttpServletRequest req) { |
| | | try { |
| | | UserEntity ue = tokenService.getCurrentUser(req); |
| | | if (ue != null) { |
| | | for (ApplyEntity entity : list) { |
| | | entity.setCreateUser(ue.getId()); |
| | | } |
| | | } |
| | | |
| | | int count = applyService.inserts(list); |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), -1); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "å é¤ä¸æ¡") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") |
| | | }) |
| | | @GetMapping(value = "/delete") |
| | | public ResponseMsg<Integer> delete(int id) { |
| | | try { |
| | | int count = applyService.delete(id); |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | |
| | | } |
| | | |
| | | int count = applyService.update(entity); |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), -1); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "æ´æ°å¤æ¡") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "list", value = "å®ä½ç±»éå", dataType = "ApplyEntity", paramType = "body") |
| | | }) |
| | | @ResponseBody |
| | | @PostMapping(value = "/updates", produces = "application/json; charset=UTF-8") |
| | | public ResponseMsg<Integer> updates(@RequestBody List<ApplyEntity> list, HttpServletRequest req) { |
| | | try { |
| | | UserEntity ue = tokenService.getCurrentUser(req); |
| | | if (ue != null) { |
| | | for (ApplyEntity entity : list) { |
| | | entity.setUpdateUser(ue.getId()); |
| | | } |
| | | } |
| | | |
| | | int count = applyService.updates(list); |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |