Browse Source

上传附件

master
wangpengfei 2 years ago
parent
commit
f4e29c8cc9
  1. 1
      yxt_supervise/supervise-crm/supervise-crm-api/src/main/java/com/yxt/supervise/crm/api/projectinformation/ProjectInformationDto.java
  2. 1
      yxt_supervise/supervise-crm/supervise-crm-api/src/main/java/com/yxt/supervise/crm/api/projectinformation/ProjectInformationVo.java
  3. 1
      yxt_supervise/supervise-crm/supervise-crm-api/src/main/java/com/yxt/supervise/crm/api/warehouselocation/WarehouseLocationVo.java
  4. 5
      yxt_supervise/supervise-crm/supervise-crm-biz/src/main/java/com/yxt/supervise/crm/biz/projectinformation/ProjectInformationMapper.java
  5. 14
      yxt_supervise/supervise-crm/supervise-crm-biz/src/main/java/com/yxt/supervise/crm/biz/projectinformation/ProjectInformationMapper.xml
  6. 16
      yxt_supervise/supervise-crm/supervise-crm-biz/src/main/java/com/yxt/supervise/crm/biz/projectinformation/ProjectInformationService.java
  7. 3
      yxt_supervise/supervise-crm/supervise-crm-biz/src/main/java/com/yxt/supervise/crm/biz/warehouselocation/WarehouseLocationMapper.java
  8. 15
      yxt_supervise/supervise-crm/supervise-crm-biz/src/main/java/com/yxt/supervise/crm/biz/warehouselocation/WarehouseLocationMapper.xml
  9. 16
      yxt_supervise/supervise-crm/supervise-crm-biz/src/main/java/com/yxt/supervise/crm/biz/warehouselocation/WarehouseLocationService.java
  10. 43
      yxt_supervise/supervise-report/supervise-report-biz/src/main/java/com/yxt/supervise/report/biz/csmcashreport/CsmCashReportRest.java

1
yxt_supervise/supervise-crm/supervise-crm-api/src/main/java/com/yxt/supervise/crm/api/projectinformation/ProjectInformationDto.java

@ -41,4 +41,5 @@ public class ProjectInformationDto implements Dto {
private String typeSid;
//项目说明
private String remarks;
private String [] imageFiles;
}

1
yxt_supervise/supervise-crm/supervise-crm-api/src/main/java/com/yxt/supervise/crm/api/projectinformation/ProjectInformationVo.java

@ -45,4 +45,5 @@ public class ProjectInformationVo implements Vo {
private String typeSid;
private String remarks;
private String engaDate;
private String url;
}

1
yxt_supervise/supervise-crm/supervise-crm-api/src/main/java/com/yxt/supervise/crm/api/warehouselocation/WarehouseLocationVo.java

@ -38,4 +38,5 @@ public class WarehouseLocationVo implements Vo {
private String housingResources;
@ApiModelProperty("备注")
private String remarks;
private String url;
}

5
yxt_supervise/supervise-crm/supervise-crm-biz/src/main/java/com/yxt/supervise/crm/biz/projectinformation/ProjectInformationMapper.java

@ -9,6 +9,9 @@ import com.yxt.supervise.crm.api.projectinformation.ProjectInformationVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* @author wangpengfei
* @date 2023/4/12 17:09
@ -17,5 +20,5 @@ import org.apache.ibatis.annotations.Param;
public interface ProjectInformationMapper extends BaseMapper<ProjectInformation> {
IPage<ProjectInformationVo> selectPageVo(IPage<ProjectInformation> page, @Param(Constants.WRAPPER) Wrapper<ProjectInformation> qw);
ProjectInformationVo getProjectBySid( @Param("sid") String sid);
void insertFiles(List<Map<String, String>> maps);
}

14
yxt_supervise/supervise-crm/supervise-crm-biz/src/main/java/com/yxt/supervise/crm/biz/projectinformation/ProjectInformationMapper.xml

@ -39,7 +39,8 @@
info.endDate,
ei.enterpriseName,
ei.contacts as eContacts,
info.regulatoryLeader,info.*
info.regulatoryLeader,info.*,
p.url
FROM
project_information info
LEFT JOIN project_type_dictionary td on td.sid=info.typeSid
@ -47,6 +48,17 @@
left join loan_bank_information bank on bank.sid=info.bankSid
left join bank_manager bm on bm.sid =info.managerSid
LEFT JOIN enterprise_information ei on ei.sid=info.enterpriseSid
left join project_files p on p.mainSid=info.sid
WHERE info.sid=#{sid}
</select>
<insert id="insertFiles">
insert into project_files (sid, url, mainSid) values
<foreach collection="list" item="item" index="index" separator=",">
(
#{item.sid,jdbcType=VARCHAR},
#{item.url,jdbcType=VARCHAR},
#{item.mainSid,jdbcType=VARCHAR}
)
</foreach>
</insert>
</mapper>

16
yxt_supervise/supervise-crm/supervise-crm-biz/src/main/java/com/yxt/supervise/crm/biz/projectinformation/ProjectInformationService.java

@ -15,6 +15,8 @@ import com.yxt.supervise.crm.api.projectinformation.ProjectInformationQuery;
import com.yxt.supervise.crm.api.projectinformation.ProjectInformationVo;
import org.springframework.stereotype.Service;
import java.util.*;
/**
* @author wangpengfei
* @date 2023/4/12 17:10
@ -36,6 +38,20 @@ public class ProjectInformationService extends MybatisBaseService<ProjectInforma
ResultBean rb=new ResultBean();
ProjectInformation entity=new ProjectInformation();
BeanUtil.copyProperties(dto, entity, "id", "sid");
String [] file=dto.getImageFiles();
if(file!=null){
List<Map<String,String>> maps=new ArrayList<>();
for(String s:file){
Map<String,String>m=new HashMap<>();
m.put("mainSid",entity.getSid());
m.put("url",s);
m.put("sid", UUID.randomUUID().toString());
maps.add(m);
}
if(maps.size()>0){
baseMapper.insertFiles(maps);
}
}
baseMapper.insert(entity);
return rb.success().setMsg("保存项目信息成功");
}

3
yxt_supervise/supervise-crm/supervise-crm-biz/src/main/java/com/yxt/supervise/crm/biz/warehouselocation/WarehouseLocationMapper.java

@ -12,6 +12,7 @@ import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* @author wangpengfei
@ -21,5 +22,5 @@ import java.util.List;
public interface WarehouseLocationMapper extends BaseMapper<WarehouseLocation> {
IPage<WarehouseLocationVo> selectPageVo(IPage<WarehouseLocation> page, @Param(Constants.WRAPPER) Wrapper<WarehouseLocation> qw);
WarehouseLocationVo getWarehouseBySid( @Param("sid") String sid);
void insertFiles(List<Map<String, String>> maps);
}

15
yxt_supervise/supervise-crm/supervise-crm-biz/src/main/java/com/yxt/supervise/crm/biz/warehouselocation/WarehouseLocationMapper.xml

@ -11,8 +11,19 @@
</where>
</select>
<select id="getWarehouseBySid" resultType="com.yxt.supervise.crm.api.warehouselocation.WarehouseLocationVo">
SELECT *
FROM warehouse_location
SELECT a.*,w.url
FROM warehouse_location a
left join warehouse_files w on w.mainSid=a.sid
WHERE sid=#{sid}
</select>
<insert id="insertFiles">
insert into warehouse_files (sid, url, mainSid) values
<foreach collection="list" item="item" index="index" separator=",">
(
#{item.sid,jdbcType=VARCHAR},
#{item.url,jdbcType=VARCHAR},
#{item.mainSid,jdbcType=VARCHAR}
)
</foreach>
</insert>
</mapper>

16
yxt_supervise/supervise-crm/supervise-crm-biz/src/main/java/com/yxt/supervise/crm/biz/warehouselocation/WarehouseLocationService.java

@ -16,6 +16,8 @@ import com.yxt.supervise.crm.api.warehouselocation.WarehouseLocation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.util.*;
/**
* @author wangpengfei
* @date 2023/4/12 17:10
@ -41,6 +43,20 @@ public class WarehouseLocationService extends MybatisBaseService<WarehouseLocati
ResultBean rb=new ResultBean();
WarehouseLocation entity=new WarehouseLocation();
BeanUtil.copyProperties(dto, entity, "id", "sid");
String [] file=dto.getImageFiles();
if(file!=null){
List<Map<String,String>> maps=new ArrayList<>();
for(String s:file){
Map<String,String>m=new HashMap<>();
m.put("mainSid",entity.getSid());
m.put("url",s);
m.put("sid", UUID.randomUUID().toString());
maps.add(m);
}
if(maps.size()>0){
baseMapper.insertFiles(maps);
}
}
baseMapper.insert(entity);
return rb.success().setMsg("保存仓库信息成功");
}

43
yxt_supervise/supervise-report/supervise-report-biz/src/main/java/com/yxt/supervise/report/biz/csmcashreport/CsmCashReportRest.java

@ -46,8 +46,12 @@ public class CsmCashReportRest {
CsmCashLogService csmCashLogService;
private static final String TEMPLATE_FILE_NAME="C:\\Users\\www19\\Desktop\\每日回款审核报告模版.docx";
@Value("${image.upload.path:static/upload/}")
private String uploadPath;
@Value("${image.url.prefix:http://127.0.0.1:8080/upload/}")
private String urlPrefix;
@Value("${image.xlsxtmpl:static/upload/}")
private String xlsxtmplPath;
@PostMapping("/save")
@ -66,8 +70,12 @@ public class CsmCashReportRest {
return csmCashReportService.getCsmReportByComSid(query);
}
/**
* 生成word
* @throws Exception
*/
@GetMapping(value = "/download")
public void test() throws Exception{
public void download() throws Exception{
//获取模板文档
//InputStream ins = this.getClass().getResourceAsStream("C:\\Users\\www19\\Desktop\\每日回款审核报告.docx");
//填充数据
@ -81,16 +89,35 @@ public class CsmCashReportRest {
params.put("yesterday",yesterdayList);
XWPFDocument word = WordExportUtil.exportWord07(TEMPLATE_FILE_NAME,params);
String newFileName = "每日回款审核报告" + dataDate + ".docx";
String url ="C:\\Users\\www19\\Desktop\\"+newFileName;
//String url = urlPrefix + newFileName;
//log.setFileFullPath(url);
// csmCashLogService.update(log,new QueryWrapper<CsmCashLog>().eq("dataDate",dataDate));
FileOutputStream out = new FileOutputStream(new File(url));
// String url ="C:\\Users\\www19\\Desktop\\"+newFileName;
String url = urlPrefix + newFileName;
if(null==log){
CsmCashLog log1=new CsmCashLog();
log1.setSid(UUID.randomUUID().toString());
log1.setFileFullPath(url);
log1.setFileUrl(uploadPath + newFileName);
csmCashLogService.insert(log1);
}else{
log.setFileFullPath(url);
log.setFileFullPath(url);
log.setFileUrl(uploadPath + newFileName);
csmCashLogService.update(log,new QueryWrapper<CsmCashLog>().eq("dataDate",dataDate));
}
FileOutputStream out = new FileOutputStream(new File(uploadPath +"/"+newFileName));
word.write(out);
out.close();
}
/**
* 获取下载地址
* @param date
* @return
*/
@GetMapping(value = "/getDownloadUrl/{date}")
public ResultBean getDownloadUrl(@PathVariable String date){
ResultBean rb =new ResultBean();
String url=csmCashLogService.getOne(new QueryWrapper<CsmCashLog>().eq("dataDate",date)).getFileFullPath();
return rb.success().setData(url);
}
}

Loading…
Cancel
Save