Compare commits
4 Commits
e3407cfe3c
...
28acec92ee
| Author | SHA1 | Date |
|---|---|---|
|
|
28acec92ee | |
|
|
065496ee69 | |
|
|
bed1d87881 | |
|
|
e1b8b00748 |
|
|
@ -17,6 +17,7 @@ import javax.servlet.ServletOutputStream;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 下载指定路径下的文件
|
* 下载指定路径下的文件
|
||||||
|
|
@ -71,7 +72,7 @@ public class DownloadController {
|
||||||
response.setHeader("Content-type", "text/html;charset=UTF-8");
|
response.setHeader("Content-type", "text/html;charset=UTF-8");
|
||||||
String data = "文件下载失败";
|
String data = "文件下载失败";
|
||||||
OutputStream ps = response.getOutputStream();
|
OutputStream ps = response.getOutputStream();
|
||||||
ps.write(data.getBytes("UTF-8"));
|
ps.write(data.getBytes(StandardCharsets.UTF_8));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
outputStream = response.getOutputStream();
|
outputStream = response.getOutputStream();
|
||||||
|
|
@ -95,12 +96,13 @@ public class DownloadController {
|
||||||
String data = "文件下载失败";
|
String data = "文件下载失败";
|
||||||
try {
|
try {
|
||||||
OutputStream ps = response.getOutputStream();
|
OutputStream ps = response.getOutputStream();
|
||||||
ps.write(data.getBytes("UTF-8"));
|
ps.write(data.getBytes(StandardCharsets.UTF_8));
|
||||||
}catch (IOException e){
|
}catch (IOException e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
try {
|
||||||
|
assert outputStream != null;
|
||||||
outputStream.close();
|
outputStream.close();
|
||||||
if (inputStream != null) {
|
if (inputStream != null) {
|
||||||
inputStream.close();
|
inputStream.close();
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ import org.springframework.web.multipart.MultipartFile;
|
||||||
* @date 2025-09-10
|
* @date 2025-09-10
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/system/material")
|
@RequestMapping("/material")
|
||||||
public class MaterialController extends BaseController {
|
public class MaterialController extends BaseController {
|
||||||
@Resource
|
@Resource
|
||||||
private ITbPromotionMaterialService service;
|
private ITbPromotionMaterialService service;
|
||||||
|
|
|
||||||
|
|
@ -1,21 +1,24 @@
|
||||||
package com.bonus.business.controller;
|
package com.bonus.business.controller;
|
||||||
|
|
||||||
import com.bonus.business.domain.TbProduct;
|
|
||||||
import com.bonus.business.domain.TbPromotionMaterial;
|
import com.bonus.business.domain.TbPromotionMaterial;
|
||||||
import com.bonus.business.service.MaterialScreenService;
|
import com.bonus.business.service.MaterialScreenService;
|
||||||
import com.bonus.business.service.ProductScreenService;
|
import com.bonus.common.core.controller.BaseController;
|
||||||
import com.bonus.common.core.domain.AjaxResult;
|
import com.bonus.common.core.domain.AjaxResult;
|
||||||
|
import com.bonus.common.core.page.TableDataInfo;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 产品大屏
|
* 物料大屏
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/screen/material/")
|
@RequestMapping("/screen/material/")
|
||||||
public class MaterialScreenController {
|
public class MaterialScreenController extends BaseController {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private MaterialScreenService service;
|
private MaterialScreenService service;
|
||||||
|
|
@ -26,8 +29,15 @@ public class MaterialScreenController {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@PostMapping("/getMaterialList")
|
@PostMapping("/getMaterialList")
|
||||||
public AjaxResult getMaterialList(TbPromotionMaterial o ){
|
public TableDataInfo getMaterialList(TbPromotionMaterial o){
|
||||||
return service.getMaterialList(o) ;
|
try {
|
||||||
|
startPage();
|
||||||
|
List<TbPromotionMaterial> list = service.getMaterialList(o);
|
||||||
|
return getDataTable(list);
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error(e.getMessage(), e);
|
||||||
|
return getDataTable(new ArrayList<>());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -96,6 +96,7 @@ public class ProductController extends BaseController {
|
||||||
transactionManager.commit(status);
|
transactionManager.commit(status);
|
||||||
return ajaxResult;
|
return ajaxResult;
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
|
|
||||||
transactionManager.rollback(status);
|
transactionManager.rollback(status);
|
||||||
}
|
}
|
||||||
return ajaxResult;
|
return ajaxResult;
|
||||||
|
|
|
||||||
|
|
@ -50,13 +50,17 @@ public class TbPromotionMaterial extends BaseEntity
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
/** 创建人 */
|
/** 创建人 */
|
||||||
@Excel(name = "创建人")
|
|
||||||
private Long createUser;
|
private Long createUser;
|
||||||
|
|
||||||
|
@Excel(name = "创建人")
|
||||||
|
private Long createUserName;
|
||||||
|
|
||||||
/** 修改人 */
|
/** 修改人 */
|
||||||
@Excel(name = "修改人")
|
|
||||||
private Long updateUser;
|
private Long updateUser;
|
||||||
|
|
||||||
|
@Excel(name = "创建人")
|
||||||
|
private Long updateUserName;
|
||||||
|
|
||||||
/** 产品名称(通过,拼接) */
|
/** 产品名称(通过,拼接) */
|
||||||
@Excel(name = "产品名称(通过,拼接)")
|
@Excel(name = "产品名称(通过,拼接)")
|
||||||
private String productName;
|
private String productName;
|
||||||
|
|
@ -75,6 +79,8 @@ public class TbPromotionMaterial extends BaseEntity
|
||||||
/** 文件 */
|
/** 文件 */
|
||||||
private List<TbPromotionMaterialFiles> files;
|
private List<TbPromotionMaterialFiles> files;
|
||||||
|
|
||||||
|
private String delIds;
|
||||||
|
|
||||||
|
|
||||||
// 构造函数
|
// 构造函数
|
||||||
public TbPromotionMaterial() {}
|
public TbPromotionMaterial() {}
|
||||||
|
|
|
||||||
|
|
@ -90,4 +90,11 @@ public interface TbPromotionMaterialMapper {
|
||||||
* @param bean 宣传物料信息
|
* @param bean 宣传物料信息
|
||||||
*/
|
*/
|
||||||
void updateCover(TbPromotionMaterial bean);
|
void updateCover(TbPromotionMaterial bean);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除物料文件
|
||||||
|
*
|
||||||
|
* @param bean 宣传物料信息
|
||||||
|
*/
|
||||||
|
void deleteTbPromotionMaterialFilesById(TbPromotionMaterialFiles bean);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,12 +4,14 @@ import com.bonus.business.domain.TbProduct;
|
||||||
import com.bonus.business.domain.TbPromotionMaterial;
|
import com.bonus.business.domain.TbPromotionMaterial;
|
||||||
import com.bonus.common.core.domain.AjaxResult;
|
import com.bonus.common.core.domain.AjaxResult;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public interface MaterialScreenService {
|
public interface MaterialScreenService {
|
||||||
/**
|
/**
|
||||||
* 查询展示中心
|
* 查询展示中心
|
||||||
* @param o
|
* @param o
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
AjaxResult getMaterialList(TbPromotionMaterial o);
|
List<TbPromotionMaterial> getMaterialList(TbPromotionMaterial o);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,21 +32,17 @@ public class MaterialScreenServiceImpl implements MaterialScreenService {
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AjaxResult getMaterialList(TbPromotionMaterial o) {
|
public List<TbPromotionMaterial> getMaterialList(TbPromotionMaterial o) {
|
||||||
try{
|
|
||||||
List<TbPromotionMaterial> list = mapper.getMaterialList(o);
|
List<TbPromotionMaterial> list = mapper.getMaterialList(o);
|
||||||
if(StringUtils.isNotEmpty(list)){
|
if (StringUtils.isNotEmpty(list)) {
|
||||||
list.forEach(vo->{
|
list.forEach(vo -> {
|
||||||
vo.setImage(minioConfig.getUrl()+"/"+minioConfig.getBucketName()+vo.getImage());
|
vo.setImage(minioConfig.getUrl() + "/" + minioConfig.getBucketName() + vo.getImage());
|
||||||
vo.setFilePath(minioConfig.getUrl()+"/"+minioConfig.getBucketName()+vo.getFilePath());
|
vo.setFilePath(minioConfig.getUrl() + "/" + minioConfig.getBucketName() + vo.getFilePath());
|
||||||
});
|
});
|
||||||
}
|
|
||||||
return AjaxResult.success(list);
|
|
||||||
}catch (Exception e){
|
|
||||||
log.error(e.toString());
|
|
||||||
}
|
}
|
||||||
return AjaxResult.success(new ArrayList<TbPromotionMaterial>());
|
return list;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,7 @@ public class TbPromotionMaterialServiceImpl implements ITbPromotionMaterialServi
|
||||||
for (TbPromotionMaterial bean : tbPromotionMaterials) {
|
for (TbPromotionMaterial bean : tbPromotionMaterials) {
|
||||||
//查询附件
|
//查询附件
|
||||||
bean.setTypeId(2L);
|
bean.setTypeId(2L);
|
||||||
|
bean.setImage(minioConfig.getUrl()+"/"+minioConfig.getBucketName() + bean.getImage());
|
||||||
List<TbPromotionMaterialFiles> files = mapper.getFileMaterialId(bean);
|
List<TbPromotionMaterialFiles> files = mapper.getFileMaterialId(bean);
|
||||||
//拼接个访问前缀
|
//拼接个访问前缀
|
||||||
for (TbPromotionMaterialFiles o: files) {
|
for (TbPromotionMaterialFiles o: files) {
|
||||||
|
|
@ -130,8 +131,19 @@ public class TbPromotionMaterialServiceImpl implements ITbPromotionMaterialServi
|
||||||
//将产品与物料关系存到另一张表
|
//将产品与物料关系存到另一张表
|
||||||
List<TbPromotionMaterial> split = tbPromotionMaterial.split(tbPromotionMaterial);
|
List<TbPromotionMaterial> split = tbPromotionMaterial.split(tbPromotionMaterial);
|
||||||
int n = mapper.insertMaterialProductRelevance(split);
|
int n = mapper.insertMaterialProductRelevance(split);
|
||||||
//将物料文件上传
|
if(!listFiles.isEmpty()){
|
||||||
int m = uploadFile(listFiles, "tb_promotion_material_files", tbPromotionMaterial.getId());
|
//删除以前的附件
|
||||||
|
if(tbPromotionMaterial.getDelIds() != null && !tbPromotionMaterial.getDelIds().isEmpty()){
|
||||||
|
String[] splitId = tbPromotionMaterial.getDelIds().split(",");
|
||||||
|
for (String id : splitId) {
|
||||||
|
TbPromotionMaterialFiles bean = new TbPromotionMaterialFiles();
|
||||||
|
bean.setId(Long.valueOf(id));
|
||||||
|
mapper.deleteTbPromotionMaterialFilesById(bean);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//将物料文件上传
|
||||||
|
int m = uploadFile(listFiles, "tb_promotion_material_files", tbPromotionMaterial.getId());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<result property="image" column="image" />
|
<result property="image" column="image" />
|
||||||
<result property="version" column="version" />
|
<result property="version" column="version" />
|
||||||
<result property="description" column="description" />
|
<result property="description" column="description" />
|
||||||
<result property="createUser" column="create_user" />
|
<result property="createUserName" column="create_user" />
|
||||||
<result property="createTime" column="create_time" />
|
<result property="createTime" column="create_time" />
|
||||||
<result property="updateUser" column="update_user" />
|
<result property="updateUser" column="update_user" />
|
||||||
<result property="updateTime" column="update_time" />
|
<result property="updateTime" column="update_time" />
|
||||||
|
|
@ -25,11 +25,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectTbPromotionMaterialList" parameterType="TbPromotionMaterial" resultMap="TbPromotionMaterialResult">
|
<select id="selectTbPromotionMaterialList" parameterType="TbPromotionMaterial" resultMap="TbPromotionMaterialResult">
|
||||||
<include refid="selectTbPromotionMaterialVo"/>
|
select aaa.id, aaa.name, aaa.type_id, aaa.type_name, aaa.image, aaa.version, aaa.description, su.user_name as create_user, aaa.create_time, aaa.update_user, aaa.update_time, aaa.product_name
|
||||||
|
from tb_promotion_material aaa
|
||||||
|
left join sys_user su on su.user_id = aaa.create_user
|
||||||
|
where aaa.del_flag = 0
|
||||||
<where>
|
<where>
|
||||||
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
<if test="name != null and name != ''"> and aaa.name like concat('%', #{name}, '%')</if>
|
||||||
<if test="typeId != null "> and type_id = #{typeId}</if>
|
<if test="typeId != null "> and aaa.type_id = #{typeId}</if>
|
||||||
<if test="typeName != null and typeName != ''"> and type_name like concat('%', #{typeName}, '%')</if>
|
<if test="typeName != null and typeName != ''"> and aaa.type_name like concat('%', #{typeName}, '%')</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
@ -122,4 +125,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<update id="updateCover">
|
<update id="updateCover">
|
||||||
update tb_promotion_material set image = #{image} where id = #{id}
|
update tb_promotion_material set image = #{image} where id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteTbPromotionMaterialFilesById">
|
||||||
|
delete from tb_promotion_material_files where id = #{id}
|
||||||
|
</delete>
|
||||||
</mapper>
|
</mapper>
|
||||||
Loading…
Reference in New Issue