liusheng
2023-08-11 ae29f1b7da8a405a358f5d71150b60a504af5f3a
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));
    }