From 43b617a3de865633cc142cee25ac8204e4eea2fe Mon Sep 17 00:00:00 2001 From: liusheng <337615773@qq.com> Date: 星期四, 20 七月 2023 15:39:07 +0800 Subject: [PATCH] 获取fileid --- ruoyi-project/src/main/java/com/ruoyi/project/domain/ServiceReimbursementdetail.java | 112 ++++++-- ruoyi-project/src/main/java/com/ruoyi/project/domain/RbDetailFile.java | 14 + ruoyi-project/src/main/java/com/ruoyi/project/service/IServiceReimbursementService.java | 18 ruoyi-project/src/main/java/com/ruoyi/project/domain/ServiceReimbursementdetailVO.java | 231 +++++++++++++++++++ ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceReimbursementdetailController.java | 19 + ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceReimbursementServiceImpl.java | 269 ++++++++++++++-------- ruoyi-admin/src/main/resources/application.yml | 6 7 files changed, 531 insertions(+), 138 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..3ca0ad9 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 (StringUtils.isNotBlank(serviceReimbursementdetailVO.getAnnexfilesList().toString())) { + serviceReimbursementdetail.setAnnexfiles(JSON.toJSONString(serviceReimbursementdetailVO.getAnnexfilesList())); + } return toAjax(serviceReimbursementdetailService.save(serviceReimbursementdetail)); } @@ -122,7 +132,12 @@ @Log(title = "鎶ラ攢鐢宠鏄庣粏", businessType = BusinessType.UPDATE) @PutMapping //@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)); } diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml index ca6b92a..781e7a8 100644 --- a/ruoyi-admin/src/main/resources/application.yml +++ b/ruoyi-admin/src/main/resources/application.yml @@ -9,8 +9,10 @@ # 瀹炰緥婕旂ず寮�鍏� demoEnabled: true # 鏂囦欢璺緞 绀轰緥锛� Windows閰嶇疆D:/ruoyi/uploadPath锛孡inux閰嶇疆 /home/ruoyi/uploadPath锛� - # 寮�鍙戠幆澧� - profile: D:/lihusoft/OPO/WEB/Upload + # 寮�鍙戠幆澧� window +# profile: D:/lihusoft/OPO/WEB/Upload + # 寮�鍙戠幆澧� linux + profile: /home/smartor/uploadFile # 鍖婚櫌鐜 #profile: E:/OPO/WEB/Upload # 鑾峰彇ip鍦板潃寮�鍏� diff --git a/ruoyi-project/src/main/java/com/ruoyi/project/domain/RbDetailFile.java b/ruoyi-project/src/main/java/com/ruoyi/project/domain/RbDetailFile.java new file mode 100644 index 0000000..38a7d48 --- /dev/null +++ b/ruoyi-project/src/main/java/com/ruoyi/project/domain/RbDetailFile.java @@ -0,0 +1,14 @@ +package com.ruoyi.project.domain; + +import lombok.Data; + + +@Data +public class RbDetailFile { + + private String name; + private String url; + private String fileid; + +} + diff --git a/ruoyi-project/src/main/java/com/ruoyi/project/domain/ServiceReimbursementdetail.java b/ruoyi-project/src/main/java/com/ruoyi/project/domain/ServiceReimbursementdetail.java index 077b103..f6593e2 100644 --- a/ruoyi-project/src/main/java/com/ruoyi/project/domain/ServiceReimbursementdetail.java +++ b/ruoyi-project/src/main/java/com/ruoyi/project/domain/ServiceReimbursementdetail.java @@ -11,118 +11,159 @@ import java.math.BigDecimal; import java.util.Date; +import java.util.List; +import java.util.Map; /** * 鎶ラ攢鐢宠鏄庣粏瀵硅薄 service_reimbursementdetail - * + * * @author ruoyi * @date 2022-01-24 */ @Data @ApiModel("鎶ラ攢鐢宠鏄庣粏") -public class ServiceReimbursementdetail extends BaseEntity -{ +public class ServiceReimbursementdetail extends BaseEntity { private static final long serialVersionUID = 1L; - /** 涓婚敭ID */ + /** + * 涓婚敭ID + */ @ApiModelProperty("涓婚敭ID") //鏁版嵁搴撹嚜澧炴敼鎴怈TableId(type = IdType.AUTO) @TableId(type = IdType.AUTO) private Long id; - /** 璧勯噾鐢宠涓昏〃ID */ + /** + * 璧勯噾鐢宠涓昏〃ID + */ @ApiModelProperty("璧勯噾鐢宠涓昏〃ID") @Excel(name = "璧勯噾鐢宠涓昏〃ID") private Long rbid; - /** 鍑哄彂鏃堕棿 */ + /** + * 鍑哄彂鏃堕棿 + */ @ApiModelProperty("鍑哄彂鏃堕棿") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @Excel(name = "鍑哄彂鏃堕棿", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") private Date starttime; - /** 鍑哄彂鍦扮偣 */ + /** + * 鍑哄彂鍦扮偣 + */ @ApiModelProperty("鍑哄彂鍦扮偣") @Excel(name = "鍑哄彂鍦扮偣") private String departure; - /** 鍒拌揪鏃堕棿 */ + /** + * 鍒拌揪鏃堕棿 + */ @ApiModelProperty("鍒拌揪鏃堕棿") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @Excel(name = "鍒拌揪鏃堕棿", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") private Date endtime; - /** 鍒拌揪鍦扮偣 */ + /** + * 鍒拌揪鍦扮偣 + */ @ApiModelProperty("鍒拌揪鍦扮偣") @Excel(name = "鍒拌揪鍦扮偣") private String destination; - /** 澶╂暟 */ + /** + * 澶╂暟 + */ @ApiModelProperty("澶╂暟") @Excel(name = "澶╂暟") private Long days; - /** 浜ら�氳垂 */ + /** + * 浜ら�氳垂 + */ @ApiModelProperty("浜ら�氳垂") @Excel(name = "浜ら�氳垂") private BigDecimal trafficexpense; - /** 浜ら�氬伐鍏� */ + /** + * 浜ら�氬伐鍏� + */ @ApiModelProperty("浜ら�氬伐鍏�") @Excel(name = "浜ら�氬伐鍏�") private String traffictype; - /** 浜ら�氬伐鍏� */ + /** + * 浜ら�氬伐鍏� + */ @ApiModelProperty("浜ら�氬伐鍏�") @Excel(name = "浜ら�氬伐鍏�") private String traffictype2; - /** 甯傚唴浜ら�氳垂 */ + /** + * 甯傚唴浜ら�氳垂 + */ @ApiModelProperty("甯傚唴浜ら�氳垂") @Excel(name = "甯傚唴浜ら�氳垂") private BigDecimal cityfee; - /** 浣忓璐� */ + /** + * 浣忓璐� + */ @ApiModelProperty("浣忓璐�") @Excel(name = "浣忓璐�") private BigDecimal hotelexpense; - /** 鍙戠エ寮犳暟 */ + /** + * 鍙戠エ寮犳暟 + */ @ApiModelProperty("鍙戠エ寮犳暟") @Excel(name = "鍙戠エ寮犳暟") private Long invoicecount; - /** 闄勪欢寮犳暟 */ + /** + * 闄勪欢寮犳暟 + */ @ApiModelProperty("闄勪欢寮犳暟") @Excel(name = "闄勪欢寮犳暟") private Long attachcount; - /** 鏉傝垂 */ + /** + * 鏉傝垂 + */ @ApiModelProperty("鏉傝垂") @Excel(name = "鏉傝垂") private BigDecimal otherexpense; - /** 浼欓璐� */ + /** + * 浼欓璐� + */ @ApiModelProperty("浼欓璐�") @Excel(name = "浼欓璐�") private BigDecimal foodexpenses; - /** 浼欓璐硅ˉ鍔� */ + /** + * 浼欓璐硅ˉ鍔� + */ @ApiModelProperty("浼欓璐硅ˉ鍔�") @Excel(name = "浼欓璐硅ˉ鍔�") private BigDecimal foodallowance; - /** 闄勪欢琛� */ + /** + * 闄勪欢琛� + */ @ApiModelProperty("闄勪欢琛�") @Excel(name = "闄勪欢琛�") private String annexfiles; - /** 涓婁紶鏍囪瘑 */ + /** + * 涓婁紶鏍囪瘑 + */ @ApiModelProperty("涓婁紶鏍囪瘑") @Excel(name = "涓婁紶鏍囪瘑") private String uploadFlag; - /** 涓婁紶鏃堕棿 */ + /** + * 涓婁紶鏃堕棿 + */ @ApiModelProperty("涓婁紶鏃堕棿") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @Excel(name = "涓婁紶鏃堕棿", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") @@ -130,32 +171,44 @@ private String remark; - /** 宸梾鍦板潃鐪佷唬鐮� */ + /** + * 宸梾鍦板潃鐪佷唬鐮� + */ @ApiModelProperty("宸梾鍦板潃鐪佷唬鐮�") @Excel(name = "宸梾鍦板潃鐪佷唬鐮�") private String travelprovince; - /** 宸梾鍦板潃鐪佸悕绉� */ + /** + * 宸梾鍦板潃鐪佸悕绉� + */ @ApiModelProperty("宸梾鍦板潃鐪佸悕绉�") @Excel(name = "宸梾鍦板潃鐪佸悕绉�") private String travelprovincename; - /** 甯傜紪鍙� 鏍规嵁琛屾斂鍖哄垝琛� */ + /** + * 甯傜紪鍙� 鏍规嵁琛屾斂鍖哄垝琛� + */ @ApiModelProperty("甯傜紪鍙� 鏍规嵁琛屾斂鍖哄垝琛�") @Excel(name = "甯傜紪鍙� 鏍规嵁琛屾斂鍖哄垝琛�") private String travelcity; - /** 甯傚悕绉� */ + /** + * 甯傚悕绉� + */ @ApiModelProperty("甯傚悕绉�") @Excel(name = "甯傚悕绉�") private String travelcityname; - /** 鎵�灞炶閬擄紙闀囷級鏍规嵁琛屾斂鍖哄垝琛� */ + /** + * 鎵�灞炶閬擄紙闀囷級鏍规嵁琛屾斂鍖哄垝琛� + */ @ApiModelProperty("鎵�灞炶閬擄紙闀囷級鏍规嵁琛屾斂鍖哄垝琛�") @Excel(name = "鎵�灞炶閬擄紙闀囷級鏍规嵁琛屾斂鍖哄垝琛�") private String traveltown; - /** 鎵�灞炶閬擄紙闀囷級鍚嶇О */ + /** + * 鎵�灞炶閬擄紙闀囷級鍚嶇О + */ @ApiModelProperty("鎵�灞炶閬擄紙闀囷級鍚嶇О") @Excel(name = "鎵�灞炶閬擄紙闀囷級鍚嶇О") private String traveltownname; @@ -169,5 +222,6 @@ private String persontype; private String personname; + } diff --git a/ruoyi-project/src/main/java/com/ruoyi/project/domain/ServiceReimbursementdetailVO.java b/ruoyi-project/src/main/java/com/ruoyi/project/domain/ServiceReimbursementdetailVO.java new file mode 100644 index 0000000..71e6470 --- /dev/null +++ b/ruoyi-project/src/main/java/com/ruoyi/project/domain/ServiceReimbursementdetailVO.java @@ -0,0 +1,231 @@ +package com.ruoyi.project.domain; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +/** + * 鎶ラ攢鐢宠鏄庣粏瀵硅薄 service_reimbursementdetail + * + * @author ruoyi + * @date 2022-01-24 + */ +@Data +@ApiModel("鎶ラ攢鐢宠鏄庣粏") +public class ServiceReimbursementdetailVO extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** + * 涓婚敭ID + */ + @ApiModelProperty("涓婚敭ID") + //鏁版嵁搴撹嚜澧炴敼鎴怈TableId(type = IdType.AUTO) + @TableId(type = IdType.AUTO) + private Long id; + + /** + * 璧勯噾鐢宠涓昏〃ID + */ + @ApiModelProperty("璧勯噾鐢宠涓昏〃ID") + @Excel(name = "璧勯噾鐢宠涓昏〃ID") + private Long rbid; + + /** + * 鍑哄彂鏃堕棿 + */ + @ApiModelProperty("鍑哄彂鏃堕棿") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "鍑哄彂鏃堕棿", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date starttime; + + /** + * 鍑哄彂鍦扮偣 + */ + @ApiModelProperty("鍑哄彂鍦扮偣") + @Excel(name = "鍑哄彂鍦扮偣") + private String departure; + + /** + * 鍒拌揪鏃堕棿 + */ + @ApiModelProperty("鍒拌揪鏃堕棿") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "鍒拌揪鏃堕棿", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date endtime; + + /** + * 鍒拌揪鍦扮偣 + */ + @ApiModelProperty("鍒拌揪鍦扮偣") + @Excel(name = "鍒拌揪鍦扮偣") + private String destination; + + /** + * 澶╂暟 + */ + @ApiModelProperty("澶╂暟") + @Excel(name = "澶╂暟") + private Long days; + + /** + * 浜ら�氳垂 + */ + @ApiModelProperty("浜ら�氳垂") + @Excel(name = "浜ら�氳垂") + private BigDecimal trafficexpense; + + /** + * 浜ら�氬伐鍏� + */ + @ApiModelProperty("浜ら�氬伐鍏�") + @Excel(name = "浜ら�氬伐鍏�") + private String traffictype; + /** + * 浜ら�氬伐鍏� + */ + @ApiModelProperty("浜ら�氬伐鍏�") + @Excel(name = "浜ら�氬伐鍏�") + private String traffictype2; + + + /** + * 甯傚唴浜ら�氳垂 + */ + @ApiModelProperty("甯傚唴浜ら�氳垂") + @Excel(name = "甯傚唴浜ら�氳垂") + private BigDecimal cityfee; + + /** + * 浣忓璐� + */ + @ApiModelProperty("浣忓璐�") + @Excel(name = "浣忓璐�") + private BigDecimal hotelexpense; + + /** + * 鍙戠エ寮犳暟 + */ + @ApiModelProperty("鍙戠エ寮犳暟") + @Excel(name = "鍙戠エ寮犳暟") + private Long invoicecount; + + /** + * 闄勪欢寮犳暟 + */ + @ApiModelProperty("闄勪欢寮犳暟") + @Excel(name = "闄勪欢寮犳暟") + private Long attachcount; + + /** + * 鏉傝垂 + */ + @ApiModelProperty("鏉傝垂") + @Excel(name = "鏉傝垂") + private BigDecimal otherexpense; + + /** + * 浼欓璐� + */ + @ApiModelProperty("浼欓璐�") + @Excel(name = "浼欓璐�") + private BigDecimal foodexpenses; + + /** + * 浼欓璐硅ˉ鍔� + */ + @ApiModelProperty("浼欓璐硅ˉ鍔�") + @Excel(name = "浼欓璐硅ˉ鍔�") + private BigDecimal foodallowance; + + /** + * 闄勪欢琛� + */ + @ApiModelProperty("闄勪欢琛�") + @Excel(name = "闄勪欢琛�") + private String annexfiles; + + /** + * 闄勪欢闆嗗悎琛� + */ + private List annexfilesList; + + /** + * 涓婁紶鏍囪瘑 + */ + @ApiModelProperty("涓婁紶鏍囪瘑") + @Excel(name = "涓婁紶鏍囪瘑") + private String uploadFlag; + + /** + * 涓婁紶鏃堕棿 + */ + @ApiModelProperty("涓婁紶鏃堕棿") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "涓婁紶鏃堕棿", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date uploadTime; + + private String remark; + + /** + * 宸梾鍦板潃鐪佷唬鐮� + */ + @ApiModelProperty("宸梾鍦板潃鐪佷唬鐮�") + @Excel(name = "宸梾鍦板潃鐪佷唬鐮�") + private String travelprovince; + + /** + * 宸梾鍦板潃鐪佸悕绉� + */ + @ApiModelProperty("宸梾鍦板潃鐪佸悕绉�") + @Excel(name = "宸梾鍦板潃鐪佸悕绉�") + private String travelprovincename; + + /** + * 甯傜紪鍙� 鏍规嵁琛屾斂鍖哄垝琛� + */ + @ApiModelProperty("甯傜紪鍙� 鏍规嵁琛屾斂鍖哄垝琛�") + @Excel(name = "甯傜紪鍙� 鏍规嵁琛屾斂鍖哄垝琛�") + private String travelcity; + + /** + * 甯傚悕绉� + */ + @ApiModelProperty("甯傚悕绉�") + @Excel(name = "甯傚悕绉�") + private String travelcityname; + + /** + * 鎵�灞炶閬擄紙闀囷級鏍规嵁琛屾斂鍖哄垝琛� + */ + @ApiModelProperty("鎵�灞炶閬擄紙闀囷級鏍规嵁琛屾斂鍖哄垝琛�") + @Excel(name = "鎵�灞炶閬擄紙闀囷級鏍规嵁琛屾斂鍖哄垝琛�") + private String traveltown; + + /** + * 鎵�灞炶閬擄紙闀囷級鍚嶇О + */ + @ApiModelProperty("鎵�灞炶閬擄紙闀囷級鍚嶇О") + @Excel(name = "鎵�灞炶閬擄紙闀囷級鍚嶇О") + private String traveltownname; + + private BigDecimal otherfeeamount; + + private String otherfeedesc; + + private Integer orderno; + + private String persontype; + private String personname; + + +} + diff --git a/ruoyi-project/src/main/java/com/ruoyi/project/service/IServiceReimbursementService.java b/ruoyi-project/src/main/java/com/ruoyi/project/service/IServiceReimbursementService.java index 73e7e69..aca6654 100644 --- a/ruoyi-project/src/main/java/com/ruoyi/project/service/IServiceReimbursementService.java +++ b/ruoyi-project/src/main/java/com/ruoyi/project/service/IServiceReimbursementService.java @@ -1,25 +1,23 @@ package com.ruoyi.project.service; import java.util.List; + import com.baomidou.mybatisplus.extension.service.IService; -import com.ruoyi.project.domain.ServiceReimbursement; -import com.ruoyi.project.domain.ServiceReimbursementEo; -import com.ruoyi.project.domain.ServiceReimbursementdetail; +import com.ruoyi.project.domain.*; import com.ruoyi.project.domain.dto.ServiceReimbursementDto; import com.ruoyi.project.domain.vo.SpFinancialExpensesReimbursementOut; /** * 鎶ラ攢鐢宠Service鎺ュ彛 - * + * * @author ruoyi * @date 2022-01-24 */ -public interface IServiceReimbursementService extends IService<ServiceReimbursement> -{ +public interface IServiceReimbursementService extends IService<ServiceReimbursement> { /** * 鏌ヨ鎶ラ攢鐢宠鍒楄〃 - * + * * @param serviceReimbursement 鎶ラ攢鐢宠 * @return 鎶ラ攢鐢宠闆嗗悎 */ @@ -27,10 +25,11 @@ Long getMaxId(); - List<ServiceReimbursementdetail> getRBDetailList(Long id); + List<ServiceReimbursementdetailVO> getRBDetailList(Long id); /** * 鏂板澶囦唤鏁版嵁 + * * @param id * @return */ @@ -39,11 +38,12 @@ List<ServiceReimbursement> selectSearchList(ServiceReimbursementDto serviceReimbursementdto); - List<SpFinancialExpensesReimbursementOut> getListBypower(String PAUSERNO, Integer PAFUNDTYPE, String PAAPPLICANT, String PAAPPLICATIONBEGTIME, String PAAPPLICATIONENDTIME, String PADEPARTMENT,Integer CHECKFLAG,Integer APPLYTYPE); + List<SpFinancialExpensesReimbursementOut> getListBypower(String PAUSERNO, Integer PAFUNDTYPE, String PAAPPLICANT, String PAAPPLICATIONBEGTIME, String PAAPPLICATIONENDTIME, String PADEPARTMENT, Integer CHECKFLAG, Integer APPLYTYPE); List<ServiceReimbursement> getInfoByInfoId(Long infoid); List<ServiceReimbursement> getInfoByInfoIdRelatives(Long infoid); List<ServiceReimbursementEo> getRDInfoByItem(ServiceReimbursementEo serviceReimbursementEo); + } diff --git a/ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceReimbursementServiceImpl.java b/ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceReimbursementServiceImpl.java index 6da9c5e..2ffa53f 100644 --- a/ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceReimbursementServiceImpl.java +++ b/ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceReimbursementServiceImpl.java @@ -1,9 +1,11 @@ package com.ruoyi.project.service.impl; import java.io.File; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; +import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.ruoyi.common.config.RuoYiConfig; @@ -114,8 +116,26 @@ } @Override - public List<ServiceReimbursementdetail> getRBDetailList(Long id) { - return serviceReimbursementdetailMapper.getRBDetailList(id); + public List<ServiceReimbursementdetailVO> getRBDetailList(Long id) { + List<ServiceReimbursementdetailVO> serviceReimbursementdetailVOS = new ArrayList<>(); + List<ServiceReimbursementdetail> rbDetailList = serviceReimbursementdetailMapper.getRBDetailList(id); + for (int j = 0; j < rbDetailList.size(); j++) { + + ServiceReimbursementdetail serviceReimbursementdetail = rbDetailList.get(j); + String annexfiles = serviceReimbursementdetail.getAnnexfiles(); + ServiceReimbursementdetailVO serviceReimbursementdetailVO = DtoConversionUtils.sourceToTarget(serviceReimbursementdetail, ServiceReimbursementdetailVO.class); + if (StringUtils.isNotBlank(annexfiles)) { + try { + serviceReimbursementdetailVO.setAnnexfilesList(JSON.parseArray(annexfiles)); + } catch (Exception e) { + if (e.getMessage().equals("invalid comment")) { + log.error("鎶ュ紓甯镐簡锛岃�佸ぇ涓嶈鎴戝鐞�"); + } + } + } + serviceReimbursementdetailVOS.add(serviceReimbursementdetailVO); + } + return serviceReimbursementdetailVOS; } @Override @@ -136,14 +156,17 @@ List<ServiceReimbursementpayeeShared> serviceReimbursementpayeeShareds = DtoConversionUtils.sourceToTarget(serviceReimbursementpayees, ServiceReimbursementpayeeShared.class); //灏嗙粍瑁呭ソ鐨勬暟鎹彃鍏ュ埌鍒嗕韩琛ㄤ腑 sharedService.save(serviceReimbursementShared); - //涓婁紶OA鏂囦欢 - uploadOAFileAndUpdateDb(serviceReimbursementShared); +// //涓婁紶OA鏂囦欢 +// uploadOAFileAndUpdateDb(serviceReimbursementShared); //灏唖erviceReimbursementdetail琛ㄩ噷鐨刬d璧嬪�肩粰Rdid; 灏唖erviceReimbursementShared閲岀殑ID璧嬪�肩粰RBID,骞跺皢serviceReimbursementdetailShared琛ㄩ噷鐨刬d缃┖锛岀敱鏁版嵁搴撻噸鏂扮敓鎴� for (int i = 0; i < details.size(); i++) { serviceReimbursementdetailShareds.get(i).setRdid(serviceReimbursementdetailShareds.get(i).getId()); serviceReimbursementdetailShareds.get(i).setRbid(serviceReimbursementShared.getId()); serviceReimbursementdetailShareds.get(i).setId(null); + //涓婁紶OA鏂囦欢 + uploadOAFileAndUpdateDb(serviceReimbursementdetailShareds.get(i)); } + detailSharedService.saveBatch(serviceReimbursementdetailShareds); //灏唖erviceReimbursementpayee琛ㄩ噷鐨刬d璧嬪�肩粰Rpid; 灏唖erviceReimbursementShared閲岀殑ID璧嬪�肩粰RBID,骞跺皢serviceReimbursementpayeeShared琛ㄩ噷鐨刬d缃┖锛岀敱鏁版嵁搴撻噸鏂扮敓鎴� @@ -182,14 +205,12 @@ return serviceReimbursementMapper.getRDInfoByItem(serviceReimbursementEo); } - - int uploadOAFileAndUpdateDb(ServiceReimbursementShared remShare) { + public int uploadOAFileAndUpdateDb(ServiceReimbursementdetailShared remShare) { //涓婁紶OA鏂囦欢 //String strUrl = "http://129.88.242.39:8899/seeyon/rest/token?userName=opo&password=127814f8-84e8-4304-84a5-a71573567efd&loginName=demo3"; String strUrl = "http://129.88.242.39:8899/seeyon/rest/token"; //String strUrl = "http://slb.hospitalstar.com:8899/seeyon/rest/token"; //涓婁紶鏂囦欢鎴愬姛鍚庯紝鍘绘洿鏂扮浉鍏崇殑鏁版嵁搴� - Map<String, Object> map = new HashMap<String, Object>(); map.put("userName", "opo"); @@ -205,106 +226,162 @@ JSONObject json1 = JSONObject.parseObject(strRes); strRes = json1.get("id").toString(); - ///if(strRes.isEmpty() || "" == strRes) return -1;// 涓虹┖浠h〃澶辫触 - - //涓嬮潰闇�姹傝皟鐢ㄦ枃浠剁殑鎺ュ彛锛岃皟鐢ㄦ垚鍔熻繑鍥炲悗锛屽緱鍒癴ilename鍜宖ileid 鐢ㄨ繖浜屼釜鍊煎幓鏇存柊鏁版嵁 - String filePath = RuoYiConfig.getUploadPath(); - // String strMutfileUrl = remShare.getFileurl();//鍙兘瀛樺湪澶氫釜鍦板潃锛屼互,鍒嗗紑 - String strMutfileUrl = remShare.getAnnexfiles(); String strFUrl = "http://129.88.242.39:8899/seeyon/rest/attachment?token=" + strRes; - //String strFUrl = "http://slb.hospitalstar.com:8899/seeyon/rest/attachment?token="+strRes; - //strFUrl = String.format(strFUrl, strRes); - /*File test = null; - File file = new File("E:\\YYJQ\\OPO\\WEB\\Upload\\upload\\2023\\02\\17"); - if (file.exists() && file.isDirectory()) { - // 鑾峰彇鎵�鏈夌洸鐩掓枃浠跺す - File[] ones = file.listFiles(); - for (File one : ones) { - test = one; - } - }*/ - - String filename = ""; - String fileid = ""; - - String[] urlArray = strMutfileUrl.split(","); - for (int i = 0; i < urlArray.length; i++) { - String strOneFileName = urlArray[i]; - String strTemp = strOneFileName.substring(15); - String strFile = filePath + strTemp; - //FileUploadUtils.getAbsoluteFile(filePath,strOneFileName); - String struploadResult = ""; + List<RbDetailFile> parseArray2 = new ArrayList<>(); + List<RbDetailFile> parseArray = JSON.parseArray(remShare.getAnnexfiles(), RbDetailFile.class); + for (int i = 0; i < parseArray.size(); i++) { + RbDetailFile rbDetailFile = parseArray.get(i); + String strFile = rbDetailFile.getUrl().replaceAll("/profile/upload", filePath); File filetest = new File(strFile); try { - struploadResult = HttpClientKit.sendPostWithFile(filetest, strFUrl); + String struploadResult = HttpClientKit.sendPostWithFile(filetest, strFUrl); + if (StringUtils.isEmpty(struploadResult)) { + log.info("HttpClientKit.sendPostWithFile 璇锋眰涓虹┖浜� filetest:{}, strFUrl:{} ",filetest,strFUrl); + return 0; + } + + //鑾峰彇fileid + JSONObject jsonR = JSONObject.parseObject(struploadResult); + JSONArray jsonArr = jsonR.getJSONArray("atts"); + for (int j = 0; j < jsonArr.size(); j++) { + JSONObject jsonRet = jsonArr.getJSONObject(j); + rbDetailFile.setFileid(jsonRet.get("fileUrl").toString()); + } } catch (Exception e) { e.printStackTrace(); + log.error("HttpClientKit.sendPostWithFile 鎶ラ敊浜� : " + e.getMessage()); } - - - /*CloseableHttpClient httpClient = HttpClients.createDefault(); - //鍒涘缓post鏂规硶杩炴帴瀹炰緥锛屽湪post鏂规硶涓紶鍏ュ緟杩炴帴鍦板潃 - HttpPost httpPost = new HttpPost(strFUrl); - CloseableHttpResponse response = null; - - String struploadResult = ""; - try { - //璁剧疆璇锋眰鍙傛暟锛堢被浼糷tml椤甸潰涓璶ame灞炴�э級 - MultipartEntityBuilder entity = MultipartEntityBuilder.create(); - //entity.setMode(HttpMultipartMode.BROWSER_COMPATIBLE); - entity.setCharset(Charset.forName("UTF-8")); - - byte[] fileBytes = Files.readAllBytes(Paths.get(strFile)); - if (fileBytes != null) { - //鍐呭绫诲瀷锛岀敤浜庡畾涔夌綉缁滄枃浠剁殑绫诲瀷鍜岀綉椤电殑缂栫爜锛屽喅瀹氭枃浠舵帴鏀舵柟灏嗕互浠�涔堝舰寮忋�佷粈涔堢紪鐮佽鍙栬繖涓枃浠� - ContentType OCTEC_STREAM = ContentType.create("application/octet-stream", Charset.forName("UTF-8")); - //娣诲姞鏂囦欢 - entity.addBinaryBody("file", fileBytes, OCTEC_STREAM, strTemp); - } - - httpPost.setEntity(entity.build()); - //鍙戣捣璇锋眰锛屽苟杩斿洖璇锋眰鍝嶅簲 - response = httpClient.execute(httpPost); - struploadResult = EntityUtils.toString(response.getEntity(), "utf-8"); - } - catch (Exception e) - { - e.printStackTrace(); - }*/ - - //String strFRes = HttpClientKit.postMsg(strFUrl,jsonFObj); - if (struploadResult == null) return 0; - if (struploadResult.isEmpty()) return 0; - - JSONObject jsonR = JSONObject.parseObject(struploadResult); - - JSONArray jsonArr = jsonR.getJSONArray("atts"); - for (int j = 0; j < jsonArr.size(); j++) { - JSONObject jsonRet = jsonArr.getJSONObject(j); - String name1 = jsonRet.get("filename").toString(); - String id1 = jsonRet.get("fileUrl").toString(); - filename += name1; - fileid += id1; - if (i != urlArray.length - 1) { - filename += ","; - fileid += ","; - } - } - + parseArray2.add(rbDetailFile); } - - long nId = remShare.getId(); - remShare.setId(nId); - remShare.setFilename(filename); - remShare.setFileid(fileid); - log.info("remShare鐨勬暟鎹负 : {}:", remShare.toString()); - boolean bRet = sharedService.updateById(remShare); - if (!bRet) return -1; - + remShare.setAnnexfiles(JSON.toJSONString(parseArray2)); + log.info("ServiceReimbursementdetailShared 鏄惁鍔犱笂浜唂ileid : {}",remShare); return 0; } +// int uploadOAFileAndUpdateDb(ServiceReimbursementShared remShare) { +// //涓婁紶OA鏂囦欢 +// //String strUrl = "http://129.88.242.39:8899/seeyon/rest/token?userName=opo&password=127814f8-84e8-4304-84a5-a71573567efd&loginName=demo3"; +// String strUrl = "http://129.88.242.39:8899/seeyon/rest/token"; +// //String strUrl = "http://slb.hospitalstar.com:8899/seeyon/rest/token"; +// //涓婁紶鏂囦欢鎴愬姛鍚庯紝鍘绘洿鏂扮浉鍏崇殑鏁版嵁搴� +// +// +// Map<String, Object> map = new HashMap<String, Object>(); +// map.put("userName", "opo"); +// map.put("password", "4126407a-9821-4874-be41-6568abd6dbe5"); +// map.put("loginName", "demo3"); +// +// JSONObject jsonObj = new JSONObject(map); +// +// System.out.println("uploadOAFileAndUpdateDb + jsonObject" + jsonObj.toString() + "\r\n" + jsonObj.toJSONString()); +// String strRes = HttpClientKit.postOpr(strUrl, jsonObj.toString());// +// //String strRes = HttpClientKit.postMsg(strUrl,jsonObj);//寰楀埌杩斿洖鐨則oken? +// +// JSONObject json1 = JSONObject.parseObject(strRes); +// strRes = json1.get("id").toString(); +// +// ///if(strRes.isEmpty() || "" == strRes) return -1;// 涓虹┖浠h〃澶辫触 +// +// //涓嬮潰闇�姹傝皟鐢ㄦ枃浠剁殑鎺ュ彛锛岃皟鐢ㄦ垚鍔熻繑鍥炲悗锛屽緱鍒癴ilename鍜宖ileid 鐢ㄨ繖浜屼釜鍊煎幓鏇存柊鏁版嵁 +// +// String filePath = RuoYiConfig.getUploadPath(); +// // String strMutfileUrl = remShare.getFileurl();//鍙兘瀛樺湪澶氫釜鍦板潃锛屼互,鍒嗗紑 +// String strMutfileUrl = remShare.getAnnexfiles(); +// String strFUrl = "http://129.88.242.39:8899/seeyon/rest/attachment?token=" + strRes; +// //String strFUrl = "http://slb.hospitalstar.com:8899/seeyon/rest/attachment?token="+strRes; +// //strFUrl = String.format(strFUrl, strRes); +// +// /*File test = null; +// File file = new File("E:\\YYJQ\\OPO\\WEB\\Upload\\upload\\2023\\02\\17"); +// if (file.exists() && file.isDirectory()) { +// // 鑾峰彇鎵�鏈夌洸鐩掓枃浠跺す +// File[] ones = file.listFiles(); +// for (File one : ones) { +// test = one; +// } +// }*/ +// +// String filename = ""; +// String fileid = ""; +// +// String[] urlArray = strMutfileUrl.split(","); +// for (int i = 0; i < urlArray.length; i++) { +// String strOneFileName = urlArray[i]; +// String strTemp = strOneFileName.substring(15); +// String strFile = filePath + strTemp; +// //FileUploadUtils.getAbsoluteFile(filePath,strOneFileName); +// String struploadResult = ""; +// File filetest = new File(strFile); +// try { +// struploadResult = HttpClientKit.sendPostWithFile(filetest, strFUrl); +// } catch (Exception e) { +// e.printStackTrace(); +// } +// +// +// /*CloseableHttpClient httpClient = HttpClients.createDefault(); +// //鍒涘缓post鏂规硶杩炴帴瀹炰緥锛屽湪post鏂规硶涓紶鍏ュ緟杩炴帴鍦板潃 +// HttpPost httpPost = new HttpPost(strFUrl); +// CloseableHttpResponse response = null; +// +// String struploadResult = ""; +// try { +// //璁剧疆璇锋眰鍙傛暟锛堢被浼糷tml椤甸潰涓璶ame灞炴�э級 +// MultipartEntityBuilder entity = MultipartEntityBuilder.create(); +// //entity.setMode(HttpMultipartMode.BROWSER_COMPATIBLE); +// entity.setCharset(Charset.forName("UTF-8")); +// +// byte[] fileBytes = Files.readAllBytes(Paths.get(strFile)); +// if (fileBytes != null) { +// //鍐呭绫诲瀷锛岀敤浜庡畾涔夌綉缁滄枃浠剁殑绫诲瀷鍜岀綉椤电殑缂栫爜锛屽喅瀹氭枃浠舵帴鏀舵柟灏嗕互浠�涔堝舰寮忋�佷粈涔堢紪鐮佽鍙栬繖涓枃浠� +// ContentType OCTEC_STREAM = ContentType.create("application/octet-stream", Charset.forName("UTF-8")); +// //娣诲姞鏂囦欢 +// entity.addBinaryBody("file", fileBytes, OCTEC_STREAM, strTemp); +// } +// +// httpPost.setEntity(entity.build()); +// //鍙戣捣璇锋眰锛屽苟杩斿洖璇锋眰鍝嶅簲 +// response = httpClient.execute(httpPost); +// struploadResult = EntityUtils.toString(response.getEntity(), "utf-8"); +// } +// catch (Exception e) +// { +// e.printStackTrace(); +// }*/ +// +// //String strFRes = HttpClientKit.postMsg(strFUrl,jsonFObj); +// if (struploadResult == null) return 0; +// if (struploadResult.isEmpty()) return 0; +// +// JSONObject jsonR = JSONObject.parseObject(struploadResult); +// +// JSONArray jsonArr = jsonR.getJSONArray("atts"); +// for (int j = 0; j < jsonArr.size(); j++) { +// JSONObject jsonRet = jsonArr.getJSONObject(j); +// String name1 = jsonRet.get("filename").toString(); +// String id1 = jsonRet.get("fileUrl").toString(); +// filename += name1; +// fileid += id1; +// if (i != urlArray.length - 1) { +// filename += ","; +// fileid += ","; +// } +// } +// +// } +// +// long nId = remShare.getId(); +// remShare.setId(nId); +// remShare.setFilename(filename); +// remShare.setFileid(fileid); +// log.info("remShare鐨勬暟鎹负 : {}:", remShare.toString()); +// boolean bRet = sharedService.updateById(remShare); +// if (!bRet) return -1; +// +// return 0; +// } + } -- Gitblit v1.9.3