Commit 5801591b authored by yaobaizheng's avatar yaobaizheng

合伙招商后台

parent 0d6d1842
......@@ -95,6 +95,13 @@
<artifactId>javax.servlet-api</artifactId>
</dependency>
<!--华为obs依赖 -->
<dependency>
<groupId>com.huaweicloud</groupId>
<artifactId>esdk-obs-java</artifactId>
<version>3.21.8</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
package com.ruoyi.common.utils.file;
import org.apache.commons.codec.binary.Base64;
public final class Base64Utils {
public Base64Utils() {
}
public static byte[] decode(String base64) throws Exception {
return Base64.decodeBase64(base64);
}
public static String encode(byte[] bytes) throws Exception {
return new String(Base64.encodeBase64(bytes));
}
}
package com.ruoyi.common.utils.file;
import com.obs.services.ObsClient;
import com.obs.services.model.ObsObject;
import org.apache.commons.io.IOUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
@Component
public class ObsUtils {
@Value("${huaweiObs.endPoint}")
private String endPoint;
@Value("${huaweiObs.ak}")
private String ak;
@Value("${huaweiObs.sk}")
private String sk;
@Value("${huaweiObs.bucketName}")
private String bucketName;
//文件上传
public void ObsUpload(String bucketName, String key, InputStream inputStream) throws IOException {
// 创建ObsClient实例
ObsClient obsClient = new ObsClient(ak, sk, endPoint);
obsClient.putObject(bucketName, key, inputStream);
obsClient.close();
}
//文件下载
public void downloadFile(HttpServletResponse response, String fileName) {
ObsClient obsClient = new ObsClient(ak, sk, endPoint);
ObsObject obsObject = obsClient.getObject(bucketName, fileName);
InputStream content = obsObject.getObjectContent();
response.setHeader("content-type", "application/octet-stream");
response.setContentType("application/octet-stream");
try {
response.setHeader("Content-Disposition", "attachment;filename=" + java.net.URLEncoder.encode(fileName, "UTF-8"));
} catch (Exception e) {
e.printStackTrace();
}
byte[] items = new byte[1024 * 10];
int i = 0;
try {
BufferedInputStream bufferedInputStream = new BufferedInputStream(content);
OutputStream outputStream = response.getOutputStream();
BufferedOutputStream outputStream1 = new BufferedOutputStream(outputStream);
while ((i = bufferedInputStream.read(items)) != -1) {
outputStream1.write(items, 0, i);
outputStream1.flush();
}
outputStream1.close();
outputStream.close();
bufferedInputStream.close();
content.close();
} catch (Exception e1) {
e1.printStackTrace();
}
}
/**
* @Description: 删除对象
*/
public void deleteFile(String bucketName, String fileName) {
ObsClient obsClient = new ObsClient(ak, sk, endPoint);
obsClient.deleteObject(bucketName, fileName);
}
/**
* @Description: 文件转base64
*/
public String fileToBase64(String fileName){
ObsClient obsClient = new ObsClient(ak, sk, endPoint);
ObsObject obsObject = obsClient.getObject(bucketName, fileName);
InputStream content = obsObject.getObjectContent();
try {
byte[] bytes = IOUtils.toByteArray(content);
content.close();
return Base64Utils.encode(bytes);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
}
......@@ -15,14 +15,29 @@
system系统模块
</description>
<properties>
<hutool.version>5.8.20</hutool.version>
</properties>
<dependencies>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>${hutool.version}</version>
</dependency>
<!-- 通用工具-->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.24</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
package com.ruoyi.system.config;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
/**
* 全局配置类
* @author yaobaizheng
*/
@Component
@ConfigurationProperties(prefix = "partner")
public class PartnerConfig
{
private String profile;
private String obsPath;
private Integer tokenExpireTimeDays;
private Boolean enableUrlFilter;
public String getProfile() {
return profile;
}
public void setProfile(String profile) {
this.profile = profile;
}
public String getObsPath() {
return obsPath;
}
public void setObsPath(String obsPath) {
this.obsPath = obsPath;
}
public Integer getTokenExpireTimeDays() {
return tokenExpireTimeDays;
}
public void setTokenExpireTimeDays(Integer tokenExpireTimeDays) {
this.tokenExpireTimeDays = tokenExpireTimeDays;
}
public Boolean getEnableUrlFilter() {
return enableUrlFilter;
}
public void setEnableUrlFilter(Boolean enableUrlFilter) {
this.enableUrlFilter = enableUrlFilter;
}
}
\ No newline at end of file
package com.ruoyi.system.controller;
import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.PartnerFileSource;
import com.ruoyi.system.service.IPartnerFileSourceService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 项目文件信息Controller
*
* @author ruoyi
* @date 2023-11-01
*/
@Controller
@RequestMapping("/fileSource/fileSource")
public class PartnerFileSourceController extends BaseController
{
private String prefix = "fileSource/fileSource";
@Autowired
private IPartnerFileSourceService partnerFileSourceService;
@RequiresPermissions("fileSource:fileSource:view")
@GetMapping()
public String fileSource()
{
return prefix + "/fileSource";
}
/**
* 查询项目文件信息列表
*/
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(PartnerFileSource partnerFileSource)
{
startPage();
List<PartnerFileSource> list = partnerFileSourceService.selectPartnerFileSourceList(partnerFileSource);
return getDataTable(list);
}
/**
* 导出项目文件信息列表
*/
@Log(title = "项目文件信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(PartnerFileSource partnerFileSource)
{
List<PartnerFileSource> list = partnerFileSourceService.selectPartnerFileSourceList(partnerFileSource);
ExcelUtil<PartnerFileSource> util = new ExcelUtil<PartnerFileSource>(PartnerFileSource.class);
return util.exportExcel(list, "项目文件信息数据");
}
/**
* 新增项目文件信息
*/
@GetMapping("/add")
public String add()
{
return prefix + "/add";
}
/**
* 新增保存项目文件信息
*/
@Log(title = "项目文件信息", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(PartnerFileSource partnerFileSource)
{
return toAjax(partnerFileSourceService.insertPartnerFileSource(partnerFileSource));
}
/**
* 修改项目文件信息
*/
@GetMapping("/edit/{id}")
public String edit(@PathVariable("id") Long id, ModelMap mmap)
{
PartnerFileSource partnerFileSource = partnerFileSourceService.selectPartnerFileSourceById(id);
mmap.put("partnerFileSource", partnerFileSource);
return prefix + "/edit";
}
/**
* 修改保存项目文件信息
*/
@Log(title = "项目文件信息", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(PartnerFileSource partnerFileSource)
{
return toAjax(partnerFileSourceService.updatePartnerFileSource(partnerFileSource));
}
/**
* 删除项目文件信息
*/
@Log(title = "项目文件信息", businessType = BusinessType.DELETE)
@PostMapping( "/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
return toAjax(partnerFileSourceService.deletePartnerFileSourceByIds(ids));
}
}
package com.ruoyi.system.controller;
import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.PartnerImageSource;
import com.ruoyi.system.service.IPartnerImageSourceService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 项目图片信息Controller
*
* @author ruoyi
* @date 2023-11-01
*/
@Controller
@RequestMapping("/imageSource/imageSource")
public class PartnerImageSourceController extends BaseController
{
private String prefix = "imageSource/imageSource";
@Autowired
private IPartnerImageSourceService partnerImageSourceService;
@GetMapping()
public String imageSource()
{
return prefix + "/imageSource";
}
/**
* 查询项目图片信息列表
*/
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(PartnerImageSource partnerImageSource)
{
startPage();
List<PartnerImageSource> list = partnerImageSourceService.selectPartnerImageSourceList(partnerImageSource);
return getDataTable(list);
}
/**
* 导出项目图片信息列表
*/
@Log(title = "项目图片信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(PartnerImageSource partnerImageSource)
{
List<PartnerImageSource> list = partnerImageSourceService.selectPartnerImageSourceList(partnerImageSource);
ExcelUtil<PartnerImageSource> util = new ExcelUtil<PartnerImageSource>(PartnerImageSource.class);
return util.exportExcel(list, "项目图片信息数据");
}
/**
* 新增项目图片信息
*/
@GetMapping("/add")
public String add()
{
return prefix + "/add";
}
/**
* 新增保存项目图片信息
*/
@Log(title = "项目图片信息", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(PartnerImageSource partnerImageSource)
{
return toAjax(partnerImageSourceService.insertPartnerImageSource(partnerImageSource));
}
/**
* 修改项目图片信息
*/
@GetMapping("/edit/{id}")
public String edit(@PathVariable("id") Long id, ModelMap mmap)
{
PartnerImageSource partnerImageSource = partnerImageSourceService.selectPartnerImageSourceById(id);
mmap.put("partnerImageSource", partnerImageSource);
return prefix + "/edit";
}
/**
* 修改保存项目图片信息
*/
@Log(title = "项目图片信息", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(PartnerImageSource partnerImageSource)
{
return toAjax(partnerImageSourceService.updatePartnerImageSource(partnerImageSource));
}
/**
* 删除项目图片信息
*/
@Log(title = "项目图片信息", businessType = BusinessType.DELETE)
@PostMapping( "/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
return toAjax(partnerImageSourceService.deletePartnerImageSourceByIds(ids));
}
}
......@@ -9,8 +9,8 @@ import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.system.VO.ChangeStatusVO;
import com.ruoyi.system.VO.PartnerProjectStatusChangeLogVO;
import com.ruoyi.system.VO.ProjectInfoVO;
import com.ruoyi.system.domain.PartnerProjectStatusChangeLog;
import com.ruoyi.system.domain.ProjectInfo;
import com.ruoyi.system.domain.*;
import com.ruoyi.system.enumerate.ImageSourceTypeEnum;
import com.ruoyi.system.enumerate.PartnerProjectExamineEnum;
import com.ruoyi.system.enumerate.PartnerProjectPushEnum;
import com.ruoyi.system.service.*;
......@@ -27,7 +27,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.PartnerProjectInfo;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
......@@ -51,7 +50,11 @@ public class PartnerProjectInfoController extends BaseController
@Autowired
private IPartnerProjectStatusChangeLogService projectStatusChangeService;
@Autowired
private IPartnerFileSourceService partnerFileSourceService;
@Autowired
private IPartnerImageSourceService partnerImageSourceService;
@GetMapping()
public String info()
......@@ -136,6 +139,7 @@ public class PartnerProjectInfoController extends BaseController
public String editProjectInfo(@PathVariable("id") Long id, ModelMap mmap)
{
PartnerProjectInfo partnerProjectInfo = partnerProjectInfoService.selectPartnerProjectInfoById(id);
mmap.put("partnerProjectInfo", partnerProjectInfo);
PartnerProjectStatusChangeLogVO statusChangeLog = new PartnerProjectStatusChangeLogVO();
statusChangeLog.setProjectId(id);
List<Integer> array = new ArrayList<>();
......@@ -144,7 +148,19 @@ public class PartnerProjectInfoController extends BaseController
}
statusChangeLog.setProjectStatus(array);
List<PartnerProjectStatusChangeLog> partnerProjectStatusChangeLogs = projectStatusChangeService.selectStatusChangeLogList(statusChangeLog);
mmap.put("partnerProjectInfo", partnerProjectInfo);
PartnerFileSource partnerFileSource = new PartnerFileSource();
partnerFileSource.setObjectId(id);
partnerFileSource.setObjectType(1);
List<PartnerFileSource> partnerFileSources = partnerFileSourceService.selectPartnerFileSourceList(partnerFileSource);
mmap.put("partnerFileSources", partnerFileSources);
PartnerImageSource partnerImageSource = new PartnerImageSource();
partnerImageSource.setObjectId(id);
partnerImageSource.setObjectType(ImageSourceTypeEnum.PROJECT.getCode());
List<PartnerImageSource> partnerImageSources = partnerImageSourceService.selectPartnerImageSourceList(partnerImageSource);
mmap.put("partnerImageSources", partnerImageSources);
// mmap.put("partnerProjectStatusChangeLogs", partnerProjectStatusChangeLogs);
if(partnerProjectStatusChangeLogs != null && partnerProjectStatusChangeLogs.size()==7){
mmap.put("status1", partnerProjectStatusChangeLogs.get(0));
......@@ -176,6 +192,10 @@ public class PartnerProjectInfoController extends BaseController
statusChangeLog.setProjectStatus(array);
List<PartnerProjectStatusChangeLog> partnerProjectStatusChangeLogs = projectStatusChangeService.selectStatusChangeLogList(statusChangeLog);
mmap.put("partnerProjectInfo", partnerProjectInfo);
// mmap.put("partnerProjectInfo", partnerProjectInfo);
// mmap.put("partnerProjectInfo", partnerProjectInfo);
// mmap.put("partnerProjectStatusChangeLogs", partnerProjectStatusChangeLogs);
if(partnerProjectStatusChangeLogs != null && partnerProjectStatusChangeLogs.size()==6){
mmap.put("status9", partnerProjectStatusChangeLogs.get(0));
......
package com.ruoyi.system.controller;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.config.PartnerConfig;
import com.ruoyi.system.service.UploadService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
/**
* 文件上传下载处理
* @author yaobaizheng
*/
@Controller
@RequestMapping("/sysFile")
public class SysFileController {
@Autowired
private PartnerConfig partnerConfig;
@Autowired
UploadService uploadService;
@PostMapping("/uploadFile")
@ResponseBody
// @ApiOperation(value = "华为OBS文件上传",notes = "")
public String uploadFile(MultipartFile file) throws Exception {
return partnerConfig.getObsPath() + "/" + uploadService.uploadFile(file,"lyy/file");
}
@PostMapping("/uploadImg")
@ResponseBody
// @ApiOperation(value = "华为OBS图片上传",notes = "")
public String uploadImg(MultipartFile file) throws Exception {
return partnerConfig.getObsPath() + "/" + uploadService.uploadFile(file,"lyy/img");
}
@PostMapping("/uploadImgHuawei")
@ResponseBody
// @ApiOperation(value = "华为OBS图片上传",notes = "")
public AjaxResult uploadImgHuawei(MultipartFile file) throws Exception {
String url = partnerConfig.getObsPath() + "/" + uploadService.uploadFile(file,"lyy/img");
AjaxResult ajax = AjaxResult.success();
ajax.put("url", url);
return ajax;
}
@PostMapping("/uploadFileHuawei")
@ResponseBody
// @ApiOperation(value = "华为OBS文件上传",notes = "")
public AjaxResult uploadFileHuawei(MultipartFile file) throws Exception {
String url = partnerConfig.getObsPath() + "/" + uploadService.uploadFile(file,"lyy/img");
AjaxResult ajax = AjaxResult.success();
ajax.put("url", url);
return ajax;
}
@PostMapping("/uploadFileLocal")
@ResponseBody
// @ApiOperation(value = "本地文件上传",notes = "")
public String uploadFileLocal(MultipartFile file) throws Exception {
return uploadService.uploadFileLocal( file,partnerConfig.getProfile() + "/file/");
}
@PostMapping("/uploadImgLocal")
@ResponseBody
// @ApiOperation(value = "本地图片上传",notes = "")
public String uploadImgLocal(MultipartFile file) throws Exception {
return uploadService.uploadFileLocal(file, partnerConfig.getProfile() + "/img/");
}
}
package com.ruoyi.system.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 项目文件信息对象 partner_file_source
*
* @author ruoyi
* @date 2023-11-01
*/
public class PartnerFileSource extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** */
private Long id;
/** 项目文件名称 */
@Excel(name = "项目文件名称")
private String name;
/** */
@Excel(name = "")
private String url;
/** 0-禁用 1-正常 */
@Excel(name = "0-禁用 1-正常")
private Integer status;
/** 项目 (1-项目信息文件 ) */
@Excel(name = "项目 (1-项目信息文件 )")
private Integer objectType;
/** 1-没有id 2-project_Info_id 3-coporate_account_info_id */
@Excel(name = "1-没有id 2-project_Info_id 3-coporate_account_info_id")
private Long objectId;
/** 排序 */
@Excel(name = "排序")
private Long sort;
/** */
@Excel(name = "")
private Long tenantId;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setName(String name)
{
this.name = name;
}
public String getName()
{
return name;
}
public void setUrl(String url)
{
this.url = url;
}
public String getUrl()
{
return url;
}
public void setStatus(Integer status)
{
this.status = status;
}
public Integer getStatus()
{
return status;
}
public void setObjectType(Integer objectType)
{
this.objectType = objectType;
}
public Integer getObjectType()
{
return objectType;
}
public void setObjectId(Long objectId)
{
this.objectId = objectId;
}
public Long getObjectId()
{
return objectId;
}
public void setSort(Long sort)
{
this.sort = sort;
}
public Long getSort()
{
return sort;
}
public void setTenantId(Long tenantId)
{
this.tenantId = tenantId;
}
public Long getTenantId()
{
return tenantId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("createTime", getCreateTime())
.append("updateTime", getUpdateTime())
.append("name", getName())
.append("url", getUrl())
.append("status", getStatus())
.append("objectType", getObjectType())
.append("objectId", getObjectId())
.append("sort", getSort())
.append("tenantId", getTenantId())
.toString();
}
}
package com.ruoyi.system.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 项目图片信息对象 partner_image_source
*
* @author ruoyi
* @date 2023-11-01
*/
public class PartnerImageSource extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** */
private Long id;
/** */
@Excel(name = "")
private String imageUrl;
/** 0-禁用 1-正常 */
@Excel(name = "0-禁用 1-正常")
private Integer status;
/** 项目 (1-合伙人管理/区域大纲 2-项目信息图片 3-对公账户营业执照 4-首页轮播图) */
@Excel(name = "项目 (1-合伙人管理/区域大纲 2-项目信息图片 3-对公账户营业执照 4-首页轮播图)")
private Integer objectType;
/** 1-没有id 2-project_Info_id 3-coporate_account_info_id */
@Excel(name = "1-没有id 2-project_Info_id 3-coporate_account_info_id")
private Long objectId;
/** 排序 */
@Excel(name = "排序")
private Long imageSort;
/** */
@Excel(name = "")
private Long tenantId;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setImageUrl(String imageUrl)
{
this.imageUrl = imageUrl;
}
public String getImageUrl()
{
return imageUrl;
}
public void setStatus(Integer status)
{
this.status = status;
}
public Integer getStatus()
{
return status;
}
public void setObjectType(Integer objectType)
{
this.objectType = objectType;
}
public Integer getObjectType()
{
return objectType;
}
public void setObjectId(Long objectId)
{
this.objectId = objectId;
}
public Long getObjectId()
{
return objectId;
}
public void setImageSort(Long imageSort)
{
this.imageSort = imageSort;
}
public Long getImageSort()
{
return imageSort;
}
public void setTenantId(Long tenantId)
{
this.tenantId = tenantId;
}
public Long getTenantId()
{
return tenantId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("createTime", getCreateTime())
.append("updateTime", getUpdateTime())
.append("imageUrl", getImageUrl())
.append("status", getStatus())
.append("objectType", getObjectType())
.append("objectId", getObjectId())
.append("imageSort", getImageSort())
.append("tenantId", getTenantId())
.toString();
}
}
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.PartnerFileSource;
/**
* 项目文件信息Mapper接口
*
* @author ruoyi
* @date 2023-11-01
*/
public interface PartnerFileSourceMapper
{
/**
* 查询项目文件信息
*
* @param id 项目文件信息主键
* @return 项目文件信息
*/
public PartnerFileSource selectPartnerFileSourceById(Long id);
/**
* 查询项目文件信息列表
*
* @param partnerFileSource 项目文件信息
* @return 项目文件信息集合
*/
public List<PartnerFileSource> selectPartnerFileSourceList(PartnerFileSource partnerFileSource);
/**
* 新增项目文件信息
*
* @param partnerFileSource 项目文件信息
* @return 结果
*/
public int insertPartnerFileSource(PartnerFileSource partnerFileSource);
/**
* 修改项目文件信息
*
* @param partnerFileSource 项目文件信息
* @return 结果
*/
public int updatePartnerFileSource(PartnerFileSource partnerFileSource);
/**
* 删除项目文件信息
*
* @param id 项目文件信息主键
* @return 结果
*/
public int deletePartnerFileSourceById(Long id);
/**
* 批量删除项目文件信息
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deletePartnerFileSourceByIds(String[] ids);
}
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.PartnerImageSource;
/**
* 项目图片信息Mapper接口
*
* @author ruoyi
* @date 2023-11-01
*/
public interface PartnerImageSourceMapper
{
/**
* 查询项目图片信息
*
* @param id 项目图片信息主键
* @return 项目图片信息
*/
public PartnerImageSource selectPartnerImageSourceById(Long id);
/**
* 查询项目图片信息列表
*
* @param partnerImageSource 项目图片信息
* @return 项目图片信息集合
*/
public List<PartnerImageSource> selectPartnerImageSourceList(PartnerImageSource partnerImageSource);
/**
* 新增项目图片信息
*
* @param partnerImageSource 项目图片信息
* @return 结果
*/
public int insertPartnerImageSource(PartnerImageSource partnerImageSource);
/**
* 修改项目图片信息
*
* @param partnerImageSource 项目图片信息
* @return 结果
*/
public int updatePartnerImageSource(PartnerImageSource partnerImageSource);
/**
* 删除项目图片信息
*
* @param id 项目图片信息主键
* @return 结果
*/
public int deletePartnerImageSourceById(Long id);
/**
* 批量删除项目图片信息
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deletePartnerImageSourceByIds(String[] ids);
}
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.system.domain.PartnerFileSource;
/**
* 项目文件信息Service接口
*
* @author ruoyi
* @date 2023-11-01
*/
public interface IPartnerFileSourceService
{
/**
* 查询项目文件信息
*
* @param id 项目文件信息主键
* @return 项目文件信息
*/
public PartnerFileSource selectPartnerFileSourceById(Long id);
/**
* 查询项目文件信息列表
*
* @param partnerFileSource 项目文件信息
* @return 项目文件信息集合
*/
public List<PartnerFileSource> selectPartnerFileSourceList(PartnerFileSource partnerFileSource);
/**
* 新增项目文件信息
*
* @param partnerFileSource 项目文件信息
* @return 结果
*/
public int insertPartnerFileSource(PartnerFileSource partnerFileSource);
/**
* 修改项目文件信息
*
* @param partnerFileSource 项目文件信息
* @return 结果
*/
public int updatePartnerFileSource(PartnerFileSource partnerFileSource);
/**
* 批量删除项目文件信息
*
* @param ids 需要删除的项目文件信息主键集合
* @return 结果
*/
public int deletePartnerFileSourceByIds(String ids);
/**
* 删除项目文件信息信息
*
* @param id 项目文件信息主键
* @return 结果
*/
public int deletePartnerFileSourceById(Long id);
}
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.system.domain.PartnerImageSource;
/**
* 项目图片信息Service接口
*
* @author ruoyi
* @date 2023-11-01
*/
public interface IPartnerImageSourceService
{
/**
* 查询项目图片信息
*
* @param id 项目图片信息主键
* @return 项目图片信息
*/
public PartnerImageSource selectPartnerImageSourceById(Long id);
/**
* 查询项目图片信息列表
*
* @param partnerImageSource 项目图片信息
* @return 项目图片信息集合
*/
public List<PartnerImageSource> selectPartnerImageSourceList(PartnerImageSource partnerImageSource);
/**
* 新增项目图片信息
*
* @param partnerImageSource 项目图片信息
* @return 结果
*/
public int insertPartnerImageSource(PartnerImageSource partnerImageSource);
/**
* 修改项目图片信息
*
* @param partnerImageSource 项目图片信息
* @return 结果
*/
public int updatePartnerImageSource(PartnerImageSource partnerImageSource);
/**
* 批量删除项目图片信息
*
* @param ids 需要删除的项目图片信息主键集合
* @return 结果
*/
public int deletePartnerImageSourceByIds(String ids);
/**
* 删除项目图片信息信息
*
* @param id 项目图片信息主键
* @return 结果
*/
public int deletePartnerImageSourceById(Long id);
}
package com.ruoyi.system.service;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;
public interface UploadService {
/**
* @Description: 文件上传
*/
String uploadFile(MultipartFile files,String rootPath) throws Exception;
/**
* @Description: 本地文件上传
*/
String uploadFileLocal(MultipartFile files, String rootPath) throws Exception;
/**
* @Description: 文件上传 返回值带原名
*/
Map<String, String> uploadFileReturnOriginalName(MultipartFile files);
/**
* @Description: 删除文件
*/
void deleteFile(String fileName);
/**
* @Description: 文件下载
*/
void downloadFile(String fileName, HttpServletResponse response);
/**
* @Description: 文件转base64
*/
String fileToBase64(String fileName);
}
package com.ruoyi.system.service.impl;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.PartnerFileSourceMapper;
import com.ruoyi.system.domain.PartnerFileSource;
import com.ruoyi.system.service.IPartnerFileSourceService;
import com.ruoyi.common.core.text.Convert;
/**
* 项目文件信息Service业务层处理
*
* @author ruoyi
* @date 2023-11-01
*/
@Service
public class PartnerFileSourceServiceImpl implements IPartnerFileSourceService
{
@Autowired
private PartnerFileSourceMapper partnerFileSourceMapper;
/**
* 查询项目文件信息
*
* @param id 项目文件信息主键
* @return 项目文件信息
*/
@Override
public PartnerFileSource selectPartnerFileSourceById(Long id)
{
return partnerFileSourceMapper.selectPartnerFileSourceById(id);
}
/**
* 查询项目文件信息列表
*
* @param partnerFileSource 项目文件信息
* @return 项目文件信息
*/
@Override
public List<PartnerFileSource> selectPartnerFileSourceList(PartnerFileSource partnerFileSource)
{
return partnerFileSourceMapper.selectPartnerFileSourceList(partnerFileSource);
}
/**
* 新增项目文件信息
*
* @param partnerFileSource 项目文件信息
* @return 结果
*/
@Override
public int insertPartnerFileSource(PartnerFileSource partnerFileSource)
{
partnerFileSource.setCreateTime(DateUtils.getNowDate());
return partnerFileSourceMapper.insertPartnerFileSource(partnerFileSource);
}
/**
* 修改项目文件信息
*
* @param partnerFileSource 项目文件信息
* @return 结果
*/
@Override
public int updatePartnerFileSource(PartnerFileSource partnerFileSource)
{
partnerFileSource.setUpdateTime(DateUtils.getNowDate());
return partnerFileSourceMapper.updatePartnerFileSource(partnerFileSource);
}
/**
* 批量删除项目文件信息
*
* @param ids 需要删除的项目文件信息主键
* @return 结果
*/
@Override
public int deletePartnerFileSourceByIds(String ids)
{
return partnerFileSourceMapper.deletePartnerFileSourceByIds(Convert.toStrArray(ids));
}
/**
* 删除项目文件信息信息
*
* @param id 项目文件信息主键
* @return 结果
*/
@Override
public int deletePartnerFileSourceById(Long id)
{
return partnerFileSourceMapper.deletePartnerFileSourceById(id);
}
}
package com.ruoyi.system.service.impl;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.PartnerImageSourceMapper;
import com.ruoyi.system.domain.PartnerImageSource;
import com.ruoyi.system.service.IPartnerImageSourceService;
import com.ruoyi.common.core.text.Convert;
/**
* 项目图片信息Service业务层处理
*
* @author ruoyi
* @date 2023-11-01
*/
@Service
public class PartnerImageSourceServiceImpl implements IPartnerImageSourceService
{
@Autowired
private PartnerImageSourceMapper partnerImageSourceMapper;
/**
* 查询项目图片信息
*
* @param id 项目图片信息主键
* @return 项目图片信息
*/
@Override
public PartnerImageSource selectPartnerImageSourceById(Long id)
{
return partnerImageSourceMapper.selectPartnerImageSourceById(id);
}
/**
* 查询项目图片信息列表
*
* @param partnerImageSource 项目图片信息
* @return 项目图片信息
*/
@Override
public List<PartnerImageSource> selectPartnerImageSourceList(PartnerImageSource partnerImageSource)
{
return partnerImageSourceMapper.selectPartnerImageSourceList(partnerImageSource);
}
/**
* 新增项目图片信息
*
* @param partnerImageSource 项目图片信息
* @return 结果
*/
@Override
public int insertPartnerImageSource(PartnerImageSource partnerImageSource)
{
partnerImageSource.setCreateTime(DateUtils.getNowDate());
return partnerImageSourceMapper.insertPartnerImageSource(partnerImageSource);
}
/**
* 修改项目图片信息
*
* @param partnerImageSource 项目图片信息
* @return 结果
*/
@Override
public int updatePartnerImageSource(PartnerImageSource partnerImageSource)
{
partnerImageSource.setUpdateTime(DateUtils.getNowDate());
return partnerImageSourceMapper.updatePartnerImageSource(partnerImageSource);
}
/**
* 批量删除项目图片信息
*
* @param ids 需要删除的项目图片信息主键
* @return 结果
*/
@Override
public int deletePartnerImageSourceByIds(String ids)
{
return partnerImageSourceMapper.deletePartnerImageSourceByIds(Convert.toStrArray(ids));
}
/**
* 删除项目图片信息信息
*
* @param id 项目图片信息主键
* @return 结果
*/
@Override
public int deletePartnerImageSourceById(Long id)
{
return partnerImageSourceMapper.deletePartnerImageSourceById(id);
}
}
package com.ruoyi.system.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import com.ruoyi.common.utils.file.ObsUtils;
import com.ruoyi.system.service.UploadService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.util.FileCopyUtils;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;
@Service
public class UploadServiceImpl implements UploadService {
@Value("${huaweiObs.bucketName}")
String bucketName;
@Resource
private ObsUtils obsUtils;
/**
* @param files
* @Description: 文件上传
* @return 文件存储路径
*/
@Override
public String uploadFile(MultipartFile files, String rootPath) throws Exception {
//华为obs
if(files == null || files.getSize() == 0){
throw new Exception("请上传文件,文件为空");
}
String fileOriginalName = files.getOriginalFilename();
String fileLastType = fileOriginalName.substring(files.getOriginalFilename().lastIndexOf("."));
String date = DateUtil.format(LocalDateTime.now(), "yyyy-MM-dd");
String newFilename = IdUtil.simpleUUID() + fileLastType;
String filePath = "/" + date + "/" + newFilename;
InputStream inputStream = files.getInputStream();
obsUtils.ObsUpload(bucketName, rootPath + filePath, inputStream);
return rootPath + filePath;
}
@Override
public String uploadFileLocal(MultipartFile files, String rootPath) throws Exception {
//华为obs
if(files == null || files.getSize() == 0){
throw new Exception("请上传文件,文件为空");
}
String fileOriginalName = files.getOriginalFilename();
String fileLastType = fileOriginalName.substring(files.getOriginalFilename().lastIndexOf("."));
String date = DateUtil.format(LocalDateTime.now(), "yyyy-MM-dd");
String newFilename = IdUtil.simpleUUID() + fileLastType;
String filePath = rootPath + "/" + date +"/" ;
File file = new File(filePath);
if (!file.exists() && !file.isDirectory()) {
file.mkdirs();
}
filePath = filePath + newFilename;
InputStream inputStream = files.getInputStream();
FileCopyUtils.copy(inputStream, new FileOutputStream((new File(filePath))));
return filePath;
}
/**
* @param files
* @Description: 文件上传
* @return 文件原名,文件存储路径,文件类型
*/
@Override
public Map<String, String> uploadFileReturnOriginalName(MultipartFile files) {
String fileOriginalName = files.getOriginalFilename();
String fileLastType = fileOriginalName.substring(files.getOriginalFilename().lastIndexOf("."));
String newFilename = IdUtil.simpleUUID() + fileLastType;
// String date = LocalDateTimeUtils.formatNow("yyyy-MM-dd");
String date = DateUtil.format(LocalDateTime.now(), "yyyy-MM-dd");
String filePath = "file/" + date + "/" + newFilename;
try {
InputStream inputStream = files.getInputStream();
obsUtils.ObsUpload(bucketName, filePath, inputStream);
}catch (IOException e){
e.getStackTrace();
}
Map<String, String> result = new HashMap<>();
result.put("filePath", filePath);
result.put("fileOriginalName", fileOriginalName);
result.put("fileLastType", fileLastType);
return result;
}
/**
* @param fileName
* @Description: 删除文件
*/
@Override
public void deleteFile(String fileName) {
obsUtils.deleteFile(bucketName, fileName);
}
/**
* @param fileName
* @param response
* @Description: 文件下载
*/
@Override
public void downloadFile(String fileName, HttpServletResponse response) {
obsUtils.downloadFile(response, fileName);
}
/**
* @param fileName
* @Description: 文件转base64
*/
@Override
public String fileToBase64(String fileName) {
return obsUtils.fileToBase64(fileName);
}
}
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.PartnerFileSourceMapper">
<resultMap type="PartnerFileSource" id="PartnerFileSourceResult">
<result property="id" column="id" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="name" column="name" />
<result property="url" column="url" />
<result property="status" column="status" />
<result property="objectType" column="object_type" />
<result property="objectId" column="object_id" />
<result property="sort" column="sort" />
<result property="tenantId" column="tenant_id" />
</resultMap>
<sql id="selectPartnerFileSourceVo">
select id, create_time, update_time, name, url, status, object_type, object_id, sort, tenant_id from partner_file_source
</sql>
<select id="selectPartnerFileSourceList" parameterType="PartnerFileSource" resultMap="PartnerFileSourceResult">
<include refid="selectPartnerFileSourceVo"/>
<where>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="url != null and url != ''"> and url = #{url}</if>
<if test="status != null "> and status = #{status}</if>
<if test="objectType != null "> and object_type = #{objectType}</if>
<if test="objectId != null "> and object_id = #{objectId}</if>
<if test="sort != null "> and sort = #{sort}</if>
<if test="tenantId != null "> and tenant_id = #{tenantId}</if>
</where>
</select>
<select id="selectPartnerFileSourceById" parameterType="Long" resultMap="PartnerFileSourceResult">
<include refid="selectPartnerFileSourceVo"/>
where id = #{id}
</select>
<insert id="insertPartnerFileSource" parameterType="PartnerFileSource" useGeneratedKeys="true" keyProperty="id">
insert into partner_file_source
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="name != null">name,</if>
<if test="url != null">url,</if>
<if test="status != null">status,</if>
<if test="objectType != null">object_type,</if>
<if test="objectId != null">object_id,</if>
<if test="sort != null">sort,</if>
<if test="tenantId != null">tenant_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="name != null">#{name},</if>
<if test="url != null">#{url},</if>
<if test="status != null">#{status},</if>
<if test="objectType != null">#{objectType},</if>
<if test="objectId != null">#{objectId},</if>
<if test="sort != null">#{sort},</if>
<if test="tenantId != null">#{tenantId},</if>
</trim>
</insert>
<update id="updatePartnerFileSource" parameterType="PartnerFileSource">
update partner_file_source
<trim prefix="SET" suffixOverrides=",">
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="name != null">name = #{name},</if>
<if test="url != null">url = #{url},</if>
<if test="status != null">status = #{status},</if>
<if test="objectType != null">object_type = #{objectType},</if>
<if test="objectId != null">object_id = #{objectId},</if>
<if test="sort != null">sort = #{sort},</if>
<if test="tenantId != null">tenant_id = #{tenantId},</if>
</trim>
where id = #{id}
</update>
<delete id="deletePartnerFileSourceById" parameterType="Long">
delete from partner_file_source where id = #{id}
</delete>
<delete id="deletePartnerFileSourceByIds" parameterType="String">
delete from partner_file_source where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.PartnerImageSourceMapper">
<resultMap type="PartnerImageSource" id="PartnerImageSourceResult">
<result property="id" column="id" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="imageUrl" column="image_url" />
<result property="status" column="status" />
<result property="objectType" column="object_type" />
<result property="objectId" column="object_id" />
<result property="imageSort" column="image_sort" />
<result property="tenantId" column="tenant_id" />
</resultMap>
<sql id="selectPartnerImageSourceVo">
select id, create_time, update_time, image_url, status, object_type, object_id, image_sort, tenant_id from partner_image_source
</sql>
<select id="selectPartnerImageSourceList" parameterType="PartnerImageSource" resultMap="PartnerImageSourceResult">
<include refid="selectPartnerImageSourceVo"/>
<where>
<if test="imageUrl != null and imageUrl != ''"> and image_url = #{imageUrl}</if>
<if test="status != null "> and status = #{status}</if>
<if test="objectType != null "> and object_type = #{objectType}</if>
<if test="objectId != null "> and object_id = #{objectId}</if>
<if test="imageSort != null "> and image_sort = #{imageSort}</if>
<if test="tenantId != null "> and tenant_id = #{tenantId}</if>
</where>
</select>
<select id="selectPartnerImageSourceById" parameterType="Long" resultMap="PartnerImageSourceResult">
<include refid="selectPartnerImageSourceVo"/>
where id = #{id}
</select>
<insert id="insertPartnerImageSource" parameterType="PartnerImageSource" useGeneratedKeys="true" keyProperty="id">
insert into partner_image_source
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="imageUrl != null">image_url,</if>
<if test="status != null">status,</if>
<if test="objectType != null">object_type,</if>
<if test="objectId != null">object_id,</if>
<if test="imageSort != null">image_sort,</if>
<if test="tenantId != null">tenant_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="imageUrl != null">#{imageUrl},</if>
<if test="status != null">#{status},</if>
<if test="objectType != null">#{objectType},</if>
<if test="objectId != null">#{objectId},</if>
<if test="imageSort != null">#{imageSort},</if>
<if test="tenantId != null">#{tenantId},</if>
</trim>
</insert>
<update id="updatePartnerImageSource" parameterType="PartnerImageSource">
update partner_image_source
<trim prefix="SET" suffixOverrides=",">
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="imageUrl != null">image_url = #{imageUrl},</if>
<if test="status != null">status = #{status},</if>
<if test="objectType != null">object_type = #{objectType},</if>
<if test="objectId != null">object_id = #{objectId},</if>
<if test="imageSort != null">image_sort = #{imageSort},</if>
<if test="tenantId != null">tenant_id = #{tenantId},</if>
</trim>
where id = #{id}
</update>
<delete id="deletePartnerImageSourceById" parameterType="Long">
delete from partner_image_source where id = #{id}
</delete>
<delete id="deletePartnerImageSourceByIds" parameterType="String">
delete from partner_image_source where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
\ No newline at end of file
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('新增项目文件信息')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-fileSource-add">
<div class="form-group">
<label class="col-sm-3 control-label">项目文件名称:</label>
<div class="col-sm-8">
<input name="name" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label"></label>
<div class="col-sm-8">
<input name="url" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">1-没有id 2-project_Info_id 3-coporate_account_info_id:</label>
<div class="col-sm-8">
<input name="objectId" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">排序:</label>
<div class="col-sm-8">
<input name="sort" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label"></label>
<div class="col-sm-8">
<input name="tenantId" class="form-control" type="text">
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var prefix = ctx + "fileSource/fileSource"
$("#form-fileSource-add").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/add", $('#form-fileSource-add').serialize());
}
}
</script>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('修改项目文件信息')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-fileSource-edit" th:object="${partnerFileSource}">
<input name="id" th:field="*{id}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label">项目文件名称:</label>
<div class="col-sm-8">
<input name="name" th:field="*{name}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label"></label>
<div class="col-sm-8">
<input name="url" th:field="*{url}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">1-没有id 2-project_Info_id 3-coporate_account_info_id:</label>
<div class="col-sm-8">
<input name="objectId" th:field="*{objectId}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">排序:</label>
<div class="col-sm-8">
<input name="sort" th:field="*{sort}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label"></label>
<div class="col-sm-8">
<input name="tenantId" th:field="*{tenantId}" class="form-control" type="text">
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var prefix = ctx + "fileSource/fileSource";
$("#form-fileSource-edit").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/edit", $('#form-fileSource-edit').serialize());
}
}
</script>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<th:block th:include="include :: header('项目文件信息列表')" />
</head>
<body class="gray-bg">
<div class="container-div">
<div class="row">
<div class="col-sm-12 search-collapse">
<form id="formId">
<div class="select-list">
<ul>
<li>
<label>项目文件名称:</label>
<input type="text" name="name"/>
</li>
<li>
<label></label>
<input type="text" name="url"/>
</li>
<li>
<label>1-没有id 2-project_Info_id 3-coporate_account_info_id:</label>
<input type="text" name="objectId"/>
</li>
<li>
<label>排序:</label>
<input type="text" name="sort"/>
</li>
<li>
<label></label>
<input type="text" name="tenantId"/>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
</li>
</ul>
</div>
</form>
</div>
<div class="btn-group-sm" id="toolbar" role="group">
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="fileSource:fileSource:add">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="fileSource:fileSource:edit">
<i class="fa fa-edit"></i> 修改
</a>
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="fileSource:fileSource:remove">
<i class="fa fa-remove"></i> 删除
</a>
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="fileSource:fileSource:export">
<i class="fa fa-download"></i> 导出
</a>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
</div>
</div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var editFlag = [[${@permission.hasPermi('fileSource:fileSource:edit')}]];
var removeFlag = [[${@permission.hasPermi('fileSource:fileSource:remove')}]];
var prefix = ctx + "fileSource/fileSource";
$(function() {
var options = {
url: prefix + "/list",
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
modalName: "项目文件信息",
columns: [{
checkbox: true
},
{
field: 'id',
title: '',
visible: false
},
{
field: 'name',
title: '项目文件名称'
},
{
field: 'url',
title: ''
},
{
field: 'status',
title: '0-禁用 1-正常'
},
{
field: 'objectType',
title: '项目 (1-项目信息文件 )'
},
{
field: 'objectId',
title: '1-没有id 2-project_Info_id 3-coporate_account_info_id'
},
{
field: 'sort',
title: '排序'
},
{
field: 'tenantId',
title: ''
},
{
title: '操作',
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
return actions.join('');
}
}]
};
$.table.init(options);
});
</script>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('新增项目图片信息')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-imageSource-add">
<div class="form-group">
<label class="col-sm-3 control-label"></label>
<div class="col-sm-8">
<input name="imageUrl" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">1-没有id 2-project_Info_id 3-coporate_account_info_id:</label>
<div class="col-sm-8">
<input name="objectId" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">排序:</label>
<div class="col-sm-8">
<input name="imageSort" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label"></label>
<div class="col-sm-8">
<input name="tenantId" class="form-control" type="text">
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var prefix = ctx + "imageSource/imageSource"
$("#form-imageSource-add").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/add", $('#form-imageSource-add').serialize());
}
}
</script>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('修改项目图片信息')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-imageSource-edit" th:object="${partnerImageSource}">
<input name="id" th:field="*{id}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label"></label>
<div class="col-sm-8">
<input name="imageUrl" th:field="*{imageUrl}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">1-没有id 2-project_Info_id 3-coporate_account_info_id:</label>
<div class="col-sm-8">
<input name="objectId" th:field="*{objectId}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">排序:</label>
<div class="col-sm-8">
<input name="imageSort" th:field="*{imageSort}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label"></label>
<div class="col-sm-8">
<input name="tenantId" th:field="*{tenantId}" class="form-control" type="text">
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var prefix = ctx + "imageSource/imageSource";
$("#form-imageSource-edit").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/edit", $('#form-imageSource-edit').serialize());
}
}
</script>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<th:block th:include="include :: header('项目图片信息列表')" />
</head>
<body class="gray-bg">
<div class="container-div">
<div class="row">
<div class="col-sm-12 search-collapse">
<form id="formId">
<div class="select-list">
<ul>
<li>
<label></label>
<input type="text" name="imageUrl"/>
</li>
<li>
<label>1-没有id 2-project_Info_id 3-coporate_account_info_id:</label>
<input type="text" name="objectId"/>
</li>
<li>
<label>排序:</label>
<input type="text" name="imageSort"/>
</li>
<li>
<label></label>
<input type="text" name="tenantId"/>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
</li>
</ul>
</div>
</form>
</div>
<div class="btn-group-sm" id="toolbar" role="group">
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="imageSource:imageSource:add">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="imageSource:imageSource:edit">
<i class="fa fa-edit"></i> 修改
</a>
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="imageSource:imageSource:remove">
<i class="fa fa-remove"></i> 删除
</a>
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="imageSource:imageSource:export">
<i class="fa fa-download"></i> 导出
</a>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
</div>
</div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var editFlag = [[${@permission.hasPermi('imageSource:imageSource:edit')}]];
var removeFlag = [[${@permission.hasPermi('imageSource:imageSource:remove')}]];
var prefix = ctx + "imageSource/imageSource";
$(function() {
var options = {
url: prefix + "/list",
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
modalName: "项目图片信息",
columns: [{
checkbox: true
},
{
field: 'id',
title: '',
visible: false
},
{
field: 'imageUrl',
title: ''
},
{
field: 'status',
title: '0-禁用 1-正常'
},
{
field: 'objectType',
title: '项目 (1-合伙人管理/区域大纲 2-项目信息图片 3-对公账户营业执照 4-首页轮播图)'
},
{
field: 'objectId',
title: '1-没有id 2-project_Info_id 3-coporate_account_info_id'
},
{
field: 'imageSort',
title: '排序'
},
{
field: 'tenantId',
title: ''
},
{
title: '操作',
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
return actions.join('');
}
}]
};
$.table.init(options);
});
</script>
</body>
</html>
\ No newline at end of file
......@@ -2,6 +2,7 @@
<html lang="zh">
<head>
<th:block th:include="include :: header('基本表单')" />
<th:block th:include="include :: bootstrap-fileinput-css"/>
<style>
.myselfClass{
float: left;
......@@ -416,6 +417,26 @@
<!-- <input name="todoStatusDescription" th:field="*{todoStatusDescription}" class="form-control" type="text">-->
<!-- </div>-->
<!-- </div>-->
<div class="form-group" th:each="partnerImageSource,stat:${partnerImageSources}">
<label class="col-sm-3 control-label">图片:</label>
<span th:text="${stat.current}" hidden="hidden"/>
<div class="col-sm-8">
<input type="hidden" name="imageUrl" th:value="${partnerImageSource.imageUrl}" >
<div class="file-loading">
<input class="form-control img-upload" id="imageUrl" name="file" type="file">
</div>
</div>
</div>
<div class="form-group" th:each="partnerFileSource,stat:${partnerFileSources}">
<label class="col-sm-3 control-label">文件:</label>
<span th:text="${stat.current}" hidden="hidden"/>
<div class="col-sm-8">
<input type="hidden" name="url" th:value="${partnerFileSource.url}">
<div class="file-loading">
<input class="form-control file-upload" id="url" name="file" type="file">
</div>
</div>
</div>
</form>
</div>
</div>
......@@ -424,6 +445,8 @@
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: bootstrap-fileinput-js"/>
<script th:src="@{/js/jquery.tmpl.js}"></script>
<script th:inline="javascript">
$(function () {
......@@ -638,6 +661,39 @@
location.reload();
}
$(".img-upload").each(function (i) {
var val = $("input[name='" + this.id + "']").val()
$(this).fileinput({
// 'uploadUrl': ctx + 'common/upload',
'uploadUrl': ctx + 'sysFile/uploadImgHuawei',
initialPreviewAsData: true,
initialPreview: [val],
maxFileCount: 1,
autoReplace: true
}).on('fileuploaded', function (event, data, previewId, index) {
$("input[name='" + event.currentTarget.id + "']").val(data.response.url)
}).on('fileremoved', function (event, id, index) {
$("input[name='" + event.currentTarget.id + "']").val('')
})
$(this).fileinput('_initFileActions');
});
$(".file-upload").each(function (i) {
var val = $("input[name='" + this.id + "']").val()
$(this).fileinput({
// 'uploadUrl': ctx + 'common/upload',
'uploadUrl': ctx + 'sysFile/uploadFileHuawei',
initialPreviewAsData: true,
initialPreview: [val],
maxFileCount: 1,
autoReplace: true
}).on('fileuploaded', function (event, data, previewId, index) {
$("input[name='" + event.currentTarget.id + "']").val(data.response.url)
}).on('fileremoved', function (event, id, index) {
$("input[name='" + event.currentTarget.id + "']").val('')
})
$(this).fileinput('_initFileActions');
});
</script>
</body>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment