| | |
| | | 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.show.FlowService; |
| | | import com.lf.server.service.sys.TokenService; |
| | |
| | | @SysLog() |
| | | @ApiOperation(value = "插入数据申请") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "reqEntity", value = "请求下载实体", dataType = "DownloadReqEntity", paramType = "body") |
| | | @ApiImplicitParam(name = "dr", value = "请求下载实体", dataType = "DownloadReqEntity", paramType = "body") |
| | | }) |
| | | @ResponseBody |
| | | @PostMapping(value = "/insertApply") |
| | | public ResponseMsg<Object> insertApply(@RequestBody DownloadReqEntity reqEntity, HttpServletRequest req) { |
| | | public ResponseMsg<Object> insertApply(@RequestBody DownloadReqEntity dr, HttpServletRequest req) { |
| | | try { |
| | | if (null == reqEntity || StringHelper.isEmpty(reqEntity.getPwd())) { |
| | | return fail("密码不能为空"); |
| | | } |
| | | if (null == reqEntity.getTabs() || null == reqEntity.getEntities() || reqEntity.getTabs().size() != reqEntity.getEntities().size()) { |
| | | if (null == dr || null == dr.getEntities() || dr.getEntities().isEmpty()) { |
| | | return fail("请选择要下载的实体名"); |
| | | } |
| | | if (null == reqEntity.getDepcodes() || reqEntity.getDepcodes().isEmpty()) { |
| | | return fail("请选择单位编码"); |
| | | if (StringHelper.isEmpty(dr.getPwd())) { |
| | | return fail("密码不能为空"); |
| | | } |
| | | |
| | | reqEntity.setWkt(AesHelper.decrypt(reqEntity.getWkt())); |
| | | if (StringHelper.isEmpty(reqEntity.getWkt())) { |
| | | return fail("请选择要下载的WKT范围"); |
| | | if (!DownloadService.decryptPwd(dr)) { |
| | | return fail("密码解密失败", null); |
| | | } |
| | | |
| | | reqEntity.setPwd(AesHelper.decrypt(reqEntity.getPwd())); |
| | | if (StringHelper.isPwdInvalid(reqEntity.getPwd())) { |
| | | if (StringHelper.isPwdInvalid(dr.getPwd())) { |
| | | return fail("密码不符合要求"); |
| | | } |
| | | if (!StringHelper.isEmpty(dr.getWkt())) { |
| | | dr.setWkt(AesHelper.decrypt(dr.getWkt())); |
| | | } |
| | | if (null == dr.getTabs() || dr.getTabs().isEmpty()) { |
| | | return fail("请选择要下载的表名"); |
| | | } |
| | | if (null == dr.getDepcodes() || dr.getDepcodes().isEmpty()) { |
| | | return fail("请选择待申请的单位编码(多个以逗号隔开)"); |
| | | } |
| | | |
| | | UserEntity ue = tokenService.getCurrentUser(req); |
| | | int rows = applyService.insertApply(ue, reqEntity); |
| | | int rows = applyService.insertApply(ue, dr); |
| | | |
| | | return success(rows); |
| | | } catch (Exception ex) { |