| | |
| | | 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.UploadEntity; |
| | | import com.lf.server.entity.data.MetaEntity; |
| | | import com.lf.server.entity.data.MetaFileEntity; |
| | | import com.lf.server.entity.sys.UserEntity; |
| | |
| | | @SysLog() |
| | | @ApiOperation(value = "æå
¥æä»¶") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "entity", value = "å
æ°æ®å®ä½ç±»", dataType = "MetaEntity", paramType = "body"), |
| | | @ApiImplicitParam(name = "list", value = "å®ä½ç±»éå", dataType = "MetaFileEntity", paramType = "body") |
| | | @ApiImplicitParam(name = "entity", value = "ä¸ä¼ å®ä½ç±»", dataType = "UploadEntity", paramType = "body") |
| | | }) |
| | | @ResponseBody |
| | | @PostMapping(value = "/insertFiles") |
| | | public ResponseMsg<Object> insertFiles(@RequestBody MetaEntity entity, @RequestBody List<MetaFileEntity> list, HttpServletRequest req) { |
| | | public ResponseMsg<Object> insertFiles(@RequestBody UploadEntity entity, HttpServletRequest req) { |
| | | try { |
| | | UserEntity ue = tokenService.getCurrentUser(req); |
| | | if (ue == null) { |
| | | return fail("ç¨æ·æªç»å½", null); |
| | | } |
| | | if (null == list || list.isEmpty()) { |
| | | return fail("æ²¡ææ¾å°æä»¶", null); |
| | | } |
| | | if (null == entity) { |
| | | if (null == entity || null == entity.getMetaEntity()) { |
| | | return fail("å
æ°æ®ä¿¡æ¯ä¸ºç©º", null); |
| | | } |
| | | |
| | | entity.setCreateTime(WebHelper.getCurrentTimestamp()); |
| | | entity.setBatch(StringHelper.YMDHMS_FORMAT.format(new Date(entity.getCreateTime().getTime()))); |
| | | entity.setCreateUser(ue.getId()); |
| | | if (null == entity.getFileEntities() || entity.getFileEntities().isEmpty()) { |
| | | return fail("æ²¡ææ¾å°ä¸ä¼ æä»¶", null); |
| | | } |
| | | |
| | | int rows = dataUploadService.insertFiles(entity, list); |
| | | MetaEntity me = entity.getMetaEntity(); |
| | | me.setCreateTime(WebHelper.getCurrentTimestamp()); |
| | | me.setBatch(StringHelper.YMDHMS_FORMAT.format(new Date(me.getCreateTime().getTime()))); |
| | | me.setCreateUser(ue.getId()); |
| | | |
| | | int rows = dataUploadService.insertFiles(me, entity.getFileEntities()); |
| | | |
| | | return success("æå", rows); |
| | | } catch (Exception ex) { |