From 2c16ba7f4cdfedf4ec05395e20caf9c87f2b5101 Mon Sep 17 00:00:00 2001 From: liusheng <337615773@qq.com> Date: 星期三, 09 八月 2023 18:15:50 +0800 Subject: [PATCH] 修改funddetail文件上传 --- ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceReimbursementdetailController.java | 21 ++++++++++++++++++--- 1 files changed, 18 insertions(+), 3 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceReimbursementdetailController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceReimbursementdetailController.java index ac0ea3e..a8dd91f 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceReimbursementdetailController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceReimbursementdetailController.java @@ -4,11 +4,17 @@ import java.util.Arrays; import java.util.List; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.bean.DtoConversionUtils; +import com.ruoyi.project.domain.ServiceReimbursementdetailVO; import com.ruoyi.project.service.IServiceReimbursementdetailSharedService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.util.CollectionUtils; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; @@ -95,7 +101,11 @@ @Log(title = "鎶ラ攢鐢宠鏄庣粏", businessType = BusinessType.INSERT) @PostMapping @RepeatSubmit - public AjaxResult add(@RequestBody ServiceReimbursementdetail serviceReimbursementdetail) { + public AjaxResult add(@RequestBody ServiceReimbursementdetailVO serviceReimbursementdetailVO) { + ServiceReimbursementdetail serviceReimbursementdetail = DtoConversionUtils.sourceToTarget(serviceReimbursementdetailVO, ServiceReimbursementdetail.class); + if (!CollectionUtils.isEmpty(serviceReimbursementdetailVO.getAnnexfilesList())) { + serviceReimbursementdetail.setAnnexfiles(JSON.toJSONString(serviceReimbursementdetailVO.getAnnexfilesList())); + } return toAjax(serviceReimbursementdetailService.save(serviceReimbursementdetail)); } @@ -120,9 +130,14 @@ @ApiOperation("淇敼鎶ラ攢鐢宠鏄庣粏") //@PreAuthorize("@ss.hasPermi('project:reimbursementdetail:edit')") @Log(title = "鎶ラ攢鐢宠鏄庣粏", businessType = BusinessType.UPDATE) - @PutMapping + @PostMapping("/reimbursementdetailEdit") //@RepeatSubmit - public AjaxResult edit(@RequestBody ServiceReimbursementdetail serviceReimbursementdetail) { + public AjaxResult edit(@RequestBody ServiceReimbursementdetailVO serviceReimbursementdetailVO) { + ServiceReimbursementdetail serviceReimbursementdetail = DtoConversionUtils.sourceToTarget(serviceReimbursementdetailVO, ServiceReimbursementdetail.class); + if (!CollectionUtils.isEmpty(serviceReimbursementdetailVO.getAnnexfilesList())) { + //瀵瑰墠绔紶杩囨潵鐨勬暟缁勶紝杩涜JSON搴忓垪鍖栵紝骞惰祴鍊肩粰Annexfiles + serviceReimbursementdetail.setAnnexfiles(JSON.toJSONString(serviceReimbursementdetailVO.getAnnexfilesList())); + } return toAjax(serviceReimbursementdetailService.updateById(serviceReimbursementdetail)); } -- Gitblit v1.9.3