Commit d33e4cf1 by wqc

更新上传图片和活动规则

parent 78e851a4
...@@ -112,6 +112,7 @@ public class SpringSecurityConfig extends WebSecurityConfigurerAdapter { ...@@ -112,6 +112,7 @@ public class SpringSecurityConfig extends WebSecurityConfigurerAdapter {
// 文件 // 文件
.antMatchers("/admin/avatar/**").permitAll() .antMatchers("/admin/avatar/**").permitAll()
.antMatchers("/admin/file/**").permitAll() .antMatchers("/admin/file/**").permitAll()
.antMatchers("/images/mzcj/**").permitAll()
// 阿里巴巴 druid // 阿里巴巴 druid
.antMatchers("/admin/druid/**").permitAll() .antMatchers("/admin/druid/**").permitAll()
// 放行OPTIONS请求 // 放行OPTIONS请求
......
...@@ -22,6 +22,7 @@ import java.util.Objects; ...@@ -22,6 +22,7 @@ import java.util.Objects;
public class UploadUtils { public class UploadUtils {
private final static String DATE_FORMAT = "/yyyyMM/dd/"; private final static String DATE_FORMAT = "/yyyyMM/dd/";
private final static String FILE_PATH = "https://mzxt.mzt.gxzf.gov.cn:11110";
/** /**
* 保存图片 * 保存图片
...@@ -39,7 +40,7 @@ public class UploadUtils { ...@@ -39,7 +40,7 @@ public class UploadUtils {
String yyyyMMdd = new SimpleDateFormat(DATE_FORMAT).format(new Date()); String yyyyMMdd = new SimpleDateFormat(DATE_FORMAT).format(new Date());
File dest = new File("/images/" + systemName + yyyyMMdd + name); File dest = new File("/images/" + systemName + yyyyMMdd + name);
FileUtils.writeByteArrayToFile(dest, file.getBytes()); FileUtils.writeByteArrayToFile(dest, file.getBytes());
return "/images/" + systemName + yyyyMMdd + name; return FILE_PATH+"/images/" + systemName + yyyyMMdd + name;
} catch (IOException e) { } catch (IOException e) {
log.error("图保存失败:{}", e.getMessage()); log.error("图保存失败:{}", e.getMessage());
throw new BusinessException("图保存失败"); throw new BusinessException("图保存失败");
...@@ -61,7 +62,7 @@ public class UploadUtils { ...@@ -61,7 +62,7 @@ public class UploadUtils {
String yyyyMMdd = new SimpleDateFormat(DATE_FORMAT).format(new Date()); String yyyyMMdd = new SimpleDateFormat(DATE_FORMAT).format(new Date());
File dest = new File("/file/" + systemName + yyyyMMdd + name); File dest = new File("/file/" + systemName + yyyyMMdd + name);
FileUtils.writeByteArrayToFile(dest, file.getBytes()); FileUtils.writeByteArrayToFile(dest, file.getBytes());
return "/file/" + systemName + yyyyMMdd + name; return FILE_PATH+"/file/" + systemName + yyyyMMdd + name;
} catch (IOException e) { } catch (IOException e) {
log.error("文件保存失败:{}", e.getMessage()); log.error("文件保存失败:{}", e.getMessage());
throw new BusinessException("文件保存失败"); throw new BusinessException("文件保存失败");
......
package com.zq.file.controller; package com.zq.file.controller;
import com.zq.common.annotation.AnonymousAccess;
import com.zq.common.utils.AssertUtils; import com.zq.common.utils.AssertUtils;
import com.zq.common.utils.UploadUtils; import com.zq.common.utils.UploadUtils;
import com.zq.common.vo.ResultVo; import com.zq.common.vo.ResultVo;
......
...@@ -100,10 +100,9 @@ public class LotteryInfoController { ...@@ -100,10 +100,9 @@ public class LotteryInfoController {
*/ */
@ApiOperation("修改活动介绍") @ApiOperation("修改活动介绍")
@PutMapping(value = "/update") @PutMapping(value = "/update")
public ResultVo updateLotteryInfo(@RequestBody LotteryInfoVo vo) { public ResultVo updateLotteryInfo(@RequestBody LotteryInfo vo) {
AssertUtils.isTrue(vo.getId() != null, "传入id为空"); AssertUtils.isTrue(vo.getId() != null, "传入id为空");;
lotteryInfoService.updateLotteryInfo(vo); return ResultVo.success(lotteryInfoService.update(vo));
return ResultVo.success();
} }
/** /**
......
...@@ -45,6 +45,24 @@ class LotteryInfo implements Serializable { ...@@ -45,6 +45,24 @@ class LotteryInfo implements Serializable {
private String remark; private String remark;
/** /**
* 活动规则
*/
@ApiModelProperty(value = "活动规则 ")
private String rules;
/**
* 奖品照片
*/
@ApiModelProperty(value = "奖品照片 ")
private String prizeImage;
/**
* 奖品描述
*/
@ApiModelProperty(value = "奖品描述 ")
private String prizeContent;
/**
* 是否启用该抽奖 * 是否启用该抽奖
* *
*/ */
......
...@@ -234,5 +234,14 @@ public class LotteryInfoService { ...@@ -234,5 +234,14 @@ public class LotteryInfoService {
return page; return page;
} }
public Boolean update(LotteryInfo vo) {
int res;
if (vo.getId() == null) {
res = lotteryInfoDao.insert(vo);
} else {
res = lotteryInfoDao.updateById(vo);
}
return res > 0;
}
} }
...@@ -43,6 +43,23 @@ public class LotteryInfoVo extends PageReqVo { ...@@ -43,6 +43,23 @@ public class LotteryInfoVo extends PageReqVo {
private String remark; private String remark;
/** /**
* 活动规则
*/
@ApiModelProperty(value = "活动规则 ")
private String rules;
/**
* 奖品照片
*/
@ApiModelProperty(value = "奖品照片 ")
private String prizeImage;
/**
* 奖品描述
*/
@ApiModelProperty(value = "奖品描述 ")
private String prizeContent;
/**
* 是否启用该抽奖 * 是否启用该抽奖
* *
*/ */
......
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