记得上下班打卡 | git大法好,push需谨慎

Commit 6f4c6b13 authored by 张国柄's avatar 张国柄

Merge remote-tracking branch 'origin/dev' into dev

parents d87d000c a3ec1a87
package com.liquidnet.client.admin.web.controller.zhengzai.kylin; package com.liquidnet.client.admin.web.controller.zhengzai.kylin;
import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import com.aliyun.oss.model.PutObjectRequest;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.liquidnet.client.admin.common.config.RuoYiConfig;
import com.liquidnet.client.admin.common.core.controller.BaseController; import com.liquidnet.client.admin.common.core.controller.BaseController;
import com.liquidnet.client.admin.common.core.domain.AjaxResult; import com.liquidnet.client.admin.common.core.domain.AjaxResult;
import com.liquidnet.client.admin.common.core.page.TableDataInfo; import com.liquidnet.client.admin.common.core.page.TableDataInfo;
import com.liquidnet.client.admin.common.enums.BannersDisplayLocation; import com.liquidnet.client.admin.common.enums.BannersDisplayLocation;
import com.liquidnet.client.admin.common.enums.BannersTargetType; import com.liquidnet.client.admin.common.enums.BannersTargetType;
import com.liquidnet.client.admin.common.utils.file.FileUploadUtils;
import com.liquidnet.client.admin.zhengzai.kylin.service.impl.KylinBannersServiceImpl; import com.liquidnet.client.admin.zhengzai.kylin.service.impl.KylinBannersServiceImpl;
import com.liquidnet.commons.lang.util.FilesUtils;
import com.liquidnet.service.kylin.dao.BannerDetailsListDao; import com.liquidnet.service.kylin.dao.BannerDetailsListDao;
import com.liquidnet.service.kylin.dto.param.BannersParam; import com.liquidnet.service.kylin.dto.param.BannersParam;
import com.liquidnet.service.kylin.dto.param.BannersSearchParam; import com.liquidnet.service.kylin.dto.param.BannersSearchParam;
...@@ -17,8 +23,14 @@ import org.springframework.beans.factory.annotation.Value; ...@@ -17,8 +23,14 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap; import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.UUID;
/** /**
* <p> * <p>
...@@ -66,6 +78,13 @@ public class KylinBannersAdminController extends BaseController { ...@@ -66,6 +78,13 @@ public class KylinBannersAdminController extends BaseController {
@Value("${liquidnet.url-banner.url26}") @Value("${liquidnet.url-banner.url26}")
private String url26; private String url26;
@Value("${liquidnet.al-oss.endpoint}")
private String endpoint;
@Value("${liquidnet.al-oss.accessKeyId}")
private String accessKeyId;
@Value("${liquidnet.al-oss.accessKeySecret}")
private String accessKeySecret;
@Autowired @Autowired
private KylinBannersServiceImpl kylinBannersServiceImpl; private KylinBannersServiceImpl kylinBannersServiceImpl;
...@@ -148,7 +167,7 @@ public class KylinBannersAdminController extends BaseController { ...@@ -148,7 +167,7 @@ public class KylinBannersAdminController extends BaseController {
@RequiresPermissions("kylin:banners:update") @RequiresPermissions("kylin:banners:update")
@PostMapping("update") @PostMapping("update")
@ResponseBody @ResponseBody
public AjaxResult updateSave(@RequestBody BannersParam bannersParam) { public AjaxResult updateSave(BannersParam bannersParam) {
boolean res = kylinBannersServiceImpl.update(bannersParam); boolean res = kylinBannersServiceImpl.update(bannersParam);
if (res) { if (res) {
return success(); return success();
...@@ -187,4 +206,66 @@ public class KylinBannersAdminController extends BaseController { ...@@ -187,4 +206,66 @@ public class KylinBannersAdminController extends BaseController {
} }
} }
/**
* 文件上传
*/
@PostMapping("/upload1")
@ResponseBody
public String upload1(@RequestParam MultipartFile coverImg) {
try {
if (!coverImg.isEmpty()) {
String avatar = FileUploadUtils.upload(RuoYiConfig.getAvatarPath(), coverImg);
return avatar;
}
return "error";
} catch (Exception e) {
return "success";
}
}
@PostMapping("/upload2")
@ResponseBody
public String upload2(@RequestParam MultipartFile coverImg) {
if (coverImg.isEmpty()) {
return "上传失败,请选择文件";
}
String fileName = coverImg.getOriginalFilename();
String filePath = RuoYiConfig.getAvatarPath();
File dest = new File(filePath + fileName);
try {
coverImg.transferTo(dest);
return dest.getName();
} catch (IOException e) {
return "上传失败!";
}
}
@PostMapping("/upload3")
@ResponseBody
public HashMap upload3(@RequestParam MultipartFile coverImgFile) {
OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
File file = null;
try {
file = FilesUtils.multipartFileToFile(coverImgFile);
} catch (Exception e) {
return new HashMap<>();
}
String filename = coverImgFile.getResource().getFilename();// time.jpeg
//这里文件名用了uuid 防止重复,可以根据自己的需要来写
String uploadName = UUID.randomUUID() + filename.substring(filename.lastIndexOf("."));// 078a77e0-cf80-481b-824c-5935247cff15.jpeg
uploadName = uploadName.replace("-", "");// 078a77e0cf80481b824c5935247cff15.jpeg
String uploadpath = "banner/" + uploadName;
PutObjectRequest putObjectRequest = new PutObjectRequest("img-zhengzai-tv", uploadpath, file);
ossClient.putObject(putObjectRequest);
ossClient.shutdown();
HashMap<Object, Object> objectObjectHashMap = new HashMap<>();
objectObjectHashMap.put("uploadpath", uploadpath);
return objectObjectHashMap;
}
} }
...@@ -9,7 +9,7 @@ ruoyi: ...@@ -9,7 +9,7 @@ ruoyi:
# 实例演示开关 # 实例演示开关
demoEnabled: true demoEnabled: true
# 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath) # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
profile: /users/anjiabin/ruoyi/uploadPath profile: /usr/local/var/www/uploadPath
# 获取ip地址开关 # 获取ip地址开关
addressEnabled: false addressEnabled: false
......
...@@ -43,6 +43,11 @@ liquidnet: ...@@ -43,6 +43,11 @@ liquidnet:
url23: "https://devmediaapi.zhengzai.tv/api/play/list?page=1&per_page=50" #视频播单 url23: "https://devmediaapi.zhengzai.tv/api/play/list?page=1&per_page=50" #视频播单
url24: "https://devmerchantapi.zhengzai.tv/admin/mis/musician/collect?page=1&per_page=50" #音乐人合集 url24: "https://devmerchantapi.zhengzai.tv/admin/mis/musician/collect?page=1&per_page=50" #音乐人合集
url26: "https://devpassport.zhengzai.tv/admin/vip/card/list?page=1&per_page=50&status=1" #摩登会员 url26: "https://devpassport.zhengzai.tv/admin/vip/card/list?page=1&per_page=50&status=1" #摩登会员
al-oss:
imgUrl: "https://img.zhengzai.tv/"
endpoint: http://oss-cn-hangzhou.aliyuncs.com
accessKeyId: LTAI4FxrURzMvvu9reFgwY5o
accessKeySecret: Ym5tfAxOf2zX20MgjikLI3Wz3tlwVV
# end-dev-这里是配置信息基本值 # end-dev-这里是配置信息基本值
......
...@@ -43,6 +43,11 @@ liquidnet: ...@@ -43,6 +43,11 @@ liquidnet:
url23: "https://mediaapi.zhengzai.tv/api/play/list?page=1&per_page=50" #视频播单 url23: "https://mediaapi.zhengzai.tv/api/play/list?page=1&per_page=50" #视频播单
url24: "https://merchantapi.zhengzai.tv/admin/mis/musician/collect?page=1&per_page=50" #音乐人合集 url24: "https://merchantapi.zhengzai.tv/admin/mis/musician/collect?page=1&per_page=50" #音乐人合集
url26: "https://passport.zhengzai.tv/admin/vip/card/list?page=1&per_page=50&status=1" #摩登会员 url26: "https://passport.zhengzai.tv/admin/vip/card/list?page=1&per_page=50&status=1" #摩登会员
al-oss:
imgUrl: "https://img.zhengzai.tv/"
endpoint: http://oss-cn-hangzhou.aliyuncs.com
accessKeyId: LTAI4FxrURzMvvu9reFgwY5o
accessKeySecret: Ym5tfAxOf2zX20MgjikLI3Wz3tlwVV
# end-dev-这里是配置信息基本值 # end-dev-这里是配置信息基本值
spring: spring:
......
...@@ -43,6 +43,11 @@ liquidnet: ...@@ -43,6 +43,11 @@ liquidnet:
url23: "https://testmediaapi.zhengzai.tv/api/play/list?page=1&per_page=50" #视频播单 url23: "https://testmediaapi.zhengzai.tv/api/play/list?page=1&per_page=50" #视频播单
url24: "https://testmerchantapi.zhengzai.tv/admin/mis/musician/collect?page=1&per_page=50" #音乐人合集 url24: "https://testmerchantapi.zhengzai.tv/admin/mis/musician/collect?page=1&per_page=50" #音乐人合集
url26: "https://testpassport.zhengzai.tv/admin/vip/card/list?page=1&per_page=50&status=1" #摩登会员 url26: "https://testpassport.zhengzai.tv/admin/vip/card/list?page=1&per_page=50&status=1" #摩登会员
al-oss:
imgUrl: "https://img.zhengzai.tv/"
endpoint: http://oss-cn-hangzhou.aliyuncs.com
accessKeyId: LTAI4FxrURzMvvu9reFgwY5o
accessKeySecret: Ym5tfAxOf2zX20MgjikLI3Wz3tlwVV
# end-dev-这里是配置信息基本值 # end-dev-这里是配置信息基本值
spring: spring:
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
<th:block th:include="include :: header('添加banner')"/> <th:block th:include="include :: header('添加banner')"/>
<th:block th:include="include :: select2-css"/> <th:block th:include="include :: select2-css"/>
<th:block th:include="include :: datetimepicker-css"/> <th:block th:include="include :: datetimepicker-css"/>
<th:block th:include="include :: bootstrap-fileinput-css" />
</head> </head>
<body class="white-bg"> <body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content"> <div class="wrapper wrapper-content animated fadeInRight ibox-content">
...@@ -56,14 +57,15 @@ ...@@ -56,14 +57,15 @@
</div> </div>
<div class="form-group" id="provincesListSelect"> <div class="form-group" id="provincesListSelect">
<label class="col-sm-2 control-label">请选择省份</label> <label class="col-sm-2 control-label">请选择省份</label>
<div class="col-sm-5"> <div class="col-sm-12 provincesAll">
<select id="provincesList" class="form-control" name="provincesList"> <label class="col-sm-2 control-label"></label>
<div class="col-sm-5">
</select> <select class="form-control provincesList" name="provincesList"></select>
</div> </div>
<div class="col-sm-5"> <div class="col-sm-5">
<button type="button" class="btn btn-danger btn-sm">删除</button> <button type="button" class="btn btn-danger btn-sm provincesDel">删除</button>
<button type="button" class="btn btn-success btn-sm">添加</button> <button type="button" class="btn btn-success btn-sm provincesAdd">添加</button>
</div>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
...@@ -93,11 +95,19 @@ ...@@ -93,11 +95,19 @@
</div> </div>
</div> </div>
</div> </div>
<div class="form-group">
<label class="font-noraml">请上传封面图</label>
<div class="file-loading">
<input id="fileinput-demo-1" type="file" name="coverImgFile">
</div>
</div>
<input hidden id="coverImg" name="coverImg">
</form> </form>
</div> </div>
<th:block th:include="include :: footer"/> <th:block th:include="include :: footer"/>
<th:block th:include="include :: select2-js"/> <th:block th:include="include :: select2-js"/>
<th:block th:include="include :: datetimepicker-js"/> <th:block th:include="include :: datetimepicker-js"/>
<th:block th:include="include :: bootstrap-fileinput-js" />
<script type="text/javascript"> <script type="text/javascript">
var prefix = ctx + "kylin/banners"; var prefix = ctx + "kylin/banners";
var provinces = "[[${provinces}]]"; var provinces = "[[${provinces}]]";
...@@ -151,6 +161,11 @@ ...@@ -151,6 +161,11 @@
return false; return false;
} }
} }
var coverImg = $('#coverImg').val();
if (!coverImg) {
layer.msg("请上传图片,请勿忘记点击上传按钮先上传图片哦~");
return false;
}
data.push({"name": "targetObj", "value": targetObj}); data.push({"name": "targetObj", "value": targetObj});
/*data.push({"name": "positionList", "value": positionList}); /*data.push({"name": "positionList", "value": positionList});
var provincesList = $.form.selectSelects("provincesList"); var provincesList = $.form.selectSelects("provincesList");
...@@ -218,6 +233,27 @@ ...@@ -218,6 +233,27 @@
form.render();*/ form.render();*/
}); });
$('body').on('click', '.provincesDel', function (){
$(this).parents('.provincesAll').remove();
})
$('body').on('click', '.provincesAdd', function (){
var selecthtml = $('.provincesList').eq(0).select2("destroy").html();
var html = '<div class="col-sm-12 provincesAll">' +
' <label class="col-sm-2 control-label"></label>' +
' <div class="col-sm-5"><select class="form-control provincesList" name="provincesList">';
html += selecthtml;
html += '</select></div>' +
' <div class="col-sm-5">' +
' <button type="button" class="btn btn-danger btn-sm provincesDel">删除</button>' +
' <button type="button" class="btn btn-success btn-sm provincesAdd">添加</button>' +
' </div>' +
' </div>';
$(this).parents('.provincesAll').after(html)
$("select").select2();
})
// 获取省份数据 // 获取省份数据
var configProvinces = { var configProvinces = {
url: provinces, url: provinces,
...@@ -233,7 +269,7 @@ ...@@ -233,7 +269,7 @@
html += '<option value="' + result[i].adcode + '">' + result[i].name + '</option>'; html += '<option value="' + result[i].adcode + '">' + result[i].name + '</option>';
} }
; ;
$("#provincesList").html(html); $(".provincesList").html(html);
} }
}; };
$.ajax(configProvinces) $.ajax(configProvinces)
...@@ -259,7 +295,6 @@ ...@@ -259,7 +295,6 @@
} else { } else {
var urlVarName = 'url' + targetType; var urlVarName = 'url' + targetType;
var url = eval(urlVarName); var url = eval(urlVarName);
console.log(url)
// 获取相关数据 // 获取相关数据
var configUrl = { var configUrl = {
url: url, url: url,
...@@ -284,6 +319,15 @@ ...@@ -284,6 +319,15 @@
$.ajax(configUrl) $.ajax(configUrl)
} }
}); });
$("#fileinput-demo-1").fileinput({
'theme': 'explorer-fas',
'uploadUrl': "/kylin/banners/upload3",
overwriteInitial: false,
initialPreviewAsData: true,
});
$("#fileinput-demo-1").on("fileuploaded", function(event, data, previewId, index) {
$("#coverImg").val(data.response.uploadpath)
});
}) })
</script> </script>
</body> </body>
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
<th:block th:include="include :: header('修改banner')"/> <th:block th:include="include :: header('修改banner')"/>
<th:block th:include="include :: select2-css"/> <th:block th:include="include :: select2-css"/>
<th:block th:include="include :: datetimepicker-css"/> <th:block th:include="include :: datetimepicker-css"/>
<th:block th:include="include :: bootstrap-fileinput-css" />
</head> </head>
<body class="white-bg"> <body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content"> <div class="wrapper wrapper-content animated fadeInRight ibox-content">
...@@ -63,12 +64,15 @@ ...@@ -63,12 +64,15 @@
</div> </div>
<div class="form-group" id="provincesListSelect"> <div class="form-group" id="provincesListSelect">
<label class="col-sm-2 control-label">请选择省份</label> <label class="col-sm-2 control-label">请选择省份</label>
<div class="col-sm-5"> <div class="col-sm-12 provincesAll" th:each="provinces : ${KylinBannersVo.provincesList}">
<select th:each="provinces : ${KylinBannersVo.provincesList}" class="form-control provincesList" name="provincesList"></select> <label class="col-sm-2 control-label"></label>
</div> <div class="col-sm-5">
<div class="col-sm-5"> <select class="form-control provincesList" name="provincesList"></select>
<button type="button" class="btn btn-danger btn-sm">删除</button> </div>
<button type="button" class="btn btn-success btn-sm">添加</button> <div class="col-sm-5">
<button type="button" class="btn btn-danger btn-sm provincesDel">删除</button>
<button type="button" class="btn btn-success btn-sm provincesAdd">添加</button>
</div>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
...@@ -102,11 +106,19 @@ ...@@ -102,11 +106,19 @@
</div> </div>
</div> </div>
</div> </div>
<div class="form-group">
<label class="font-noraml">请上传封面图</label>
<div class="file-loading">
<input id="fileinput-demo-1" type="file" name="coverImgFile" th:value="${KylinBannersVo.coverImg}">
</div>
</div>
<input hidden id="coverImg" name="coverImg" th:value="${KylinBannersVo.coverImg}">
</form> </form>
</div> </div>
<th:block th:include="include :: footer"/> <th:block th:include="include :: footer"/>
<th:block th:include="include :: select2-js"/> <th:block th:include="include :: select2-js"/>
<th:block th:include="include :: datetimepicker-js"/> <th:block th:include="include :: datetimepicker-js"/>
<th:block th:include="include :: bootstrap-fileinput-js" />
<script type="text/javascript"> <script type="text/javascript">
var prefix = ctx + "kylin/banners"; var prefix = ctx + "kylin/banners";
var provinces = "[[${provinces}]]"; var provinces = "[[${provinces}]]";
...@@ -127,6 +139,8 @@ ...@@ -127,6 +139,8 @@
var targetObj = "[[${KylinBannersVo.targetObj}]]"; var targetObj = "[[${KylinBannersVo.targetObj}]]";
var targetObjType = "[[${KylinBannersVo.targetType}]]"; var targetObjType = "[[${KylinBannersVo.targetType}]]";
var provincesListOld = "[[${KylinBannersVo.provincesList}]]"; var provincesListOld = "[[${KylinBannersVo.provincesList}]]";
var coverImg = "[[${KylinBannersVo.coverImg}]]";
var bannersId = "[[${KylinBannersVo.bannersId}]]";
function submitHandler() { function submitHandler() {
var bannersName = $('#bannersName').val(); var bannersName = $('#bannersName').val();
...@@ -163,12 +177,18 @@ ...@@ -163,12 +177,18 @@
return false; return false;
} }
} }
var coverImg = $('#coverImg').val();
if (!coverImg) {
layer.msg("请上传图片,请勿忘记点击上传按钮先上传图片哦~");
return false;
}
data.push({"name": "targetObj", "value": targetObj}); data.push({"name": "targetObj", "value": targetObj});
data.push({"name": "bannersId", "value": bannersId});
/*data.push({"name": "positionList", "value": positionList}); /*data.push({"name": "positionList", "value": positionList});
var provincesList = $.form.selectSelects("provincesList"); var provincesList = $.form.selectSelects("provincesList");
data.push({"name": "provincesList", "value": provincesList});*/ data.push({"name": "provincesList", "value": provincesList});*/
$.operate.save(prefix + "/create", data); $.operate.save(prefix + "/update", data);
} }
} }
...@@ -230,6 +250,27 @@ ...@@ -230,6 +250,27 @@
form.render();*/ form.render();*/
}); });
$('body').on('click', '.provincesDel', function (){
$(this).parents('.provincesAll').remove();
})
$('body').on('click', '.provincesAdd', function (){
var selecthtml = $('.provincesList').eq(0).select2("destroy").html();
var html = '<div class="col-sm-12 provincesAll">' +
' <label class="col-sm-2 control-label"></label>' +
' <div class="col-sm-5"><select class="form-control provincesList" name="provincesList">';
html += selecthtml;
html += '</select></div>' +
' <div class="col-sm-5">' +
' <button type="button" class="btn btn-danger btn-sm provincesDel">删除</button>' +
' <button type="button" class="btn btn-success btn-sm provincesAdd">添加</button>' +
' </div>' +
' </div>';
$(this).parents('.provincesAll').after(html)
$("select").select2();
})
// 获取省份数据 // 获取省份数据
var configProvinces = { var configProvinces = {
url: provinces, url: provinces,
...@@ -259,7 +300,6 @@ ...@@ -259,7 +300,6 @@
alert(sex); alert(sex);
});*/ });*/
// 跳转类型选择事件 // 跳转类型选择事件
function targetType() { function targetType() {
var targetType = $('#targetType').select2('val'); var targetType = $('#targetType').select2('val');
...@@ -307,6 +347,21 @@ ...@@ -307,6 +347,21 @@
// var targetType = $("#targetType option:checked").val(); // var targetType = $("#targetType option:checked").val();
targetType(); targetType();
}); });
$("#fileinput-demo-1").fileinput({
'theme': 'explorer-fas',
'uploadUrl': "/kylin/banners/upload3",
// 'uploadUrl': ctx + "system/user/profile/updateAvatar",
overwriteInitial: false,
initialPreviewAsData: true,
autoReplace: true,
initialPreview: [
"https://img.zhengzai.tv/" + coverImg
]
});
$("#fileinput-demo-1").on("fileuploaded", function(event, data, previewId, index) {
$("#coverImg").val(data.response.uploadpath)
});
}) })
</script> </script>
</body> </body>
......
...@@ -27,6 +27,7 @@ import com.mongodb.client.model.ReturnDocument; ...@@ -27,6 +27,7 @@ import com.mongodb.client.model.ReturnDocument;
import org.bson.Document; import org.bson.Document;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.mongodb.core.MongoTemplate; import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.convert.MongoConverter; import org.springframework.data.mongodb.core.convert.MongoConverter;
import org.springframework.data.mongodb.core.query.Criteria; import org.springframework.data.mongodb.core.query.Criteria;
...@@ -51,6 +52,9 @@ import java.util.List; ...@@ -51,6 +52,9 @@ import java.util.List;
@Service @Service
public class KylinBannersServiceImpl extends ServiceImpl<KylinBannersMapper, KylinBanners> implements IKylinBannersService { public class KylinBannersServiceImpl extends ServiceImpl<KylinBannersMapper, KylinBanners> implements IKylinBannersService {
@Value("${liquidnet.al-oss.imgUrl}")
private String imgUrl;
@Autowired @Autowired
private KylinBannersMapper bannersMapper; private KylinBannersMapper bannersMapper;
...@@ -219,7 +223,6 @@ public class KylinBannersServiceImpl extends ServiceImpl<KylinBannersMapper, Kyl ...@@ -219,7 +223,6 @@ public class KylinBannersServiceImpl extends ServiceImpl<KylinBannersMapper, Kyl
data.setPositionList(positionList); data.setPositionList(positionList);
data.setProvincesList(provincesList); data.setProvincesList(provincesList);
kylinBannersVo = new KylinBannersVo();
BeanUtils.copyProperties(data, kylinBannersVo); BeanUtils.copyProperties(data, kylinBannersVo);
}else { }else {
return null; return null;
...@@ -239,6 +242,8 @@ public class KylinBannersServiceImpl extends ServiceImpl<KylinBannersMapper, Kyl ...@@ -239,6 +242,8 @@ public class KylinBannersServiceImpl extends ServiceImpl<KylinBannersMapper, Kyl
String typeName = BannersTargetType.getTypeName(item.getTargetType()); String typeName = BannersTargetType.getTypeName(item.getTargetType());
item.setTargetTypeName(typeName); item.setTargetTypeName(typeName);
item.setCoverImg(imgUrl + item.getCoverImg());
} }
pageInfoTmp = new PageInfo(voList); pageInfoTmp = new PageInfo(voList);
} catch (Exception e) { } catch (Exception e) {
......
...@@ -256,7 +256,10 @@ ...@@ -256,7 +256,10 @@
<dependencies> <dependencies>
<dependency>
<groupId>com.aliyun.oss</groupId>
<artifactId>aliyun-sdk-oss</artifactId>
</dependency>
</dependencies> </dependencies>
<repositories> <repositories>
<repository> <repository>
......
...@@ -48,6 +48,11 @@ ...@@ -48,6 +48,11 @@
<type>pom</type> <type>pom</type>
<scope>import</scope> <scope>import</scope>
</dependency> </dependency>
<dependency>
<groupId>com.aliyun.oss</groupId>
<artifactId>aliyun-sdk-oss</artifactId>
<version>3.10.2</version>
</dependency>
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>
</project> </project>
\ No newline at end of file
package com.liquidnet.commons.lang.util;
import org.springframework.web.multipart.MultipartFile;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.File;
public class FilesUtils {
/**
* MultipartFile 转 File
*
* @param file
* @throws Exception
*/
public static File multipartFileToFile(MultipartFile file) throws Exception {
File toFile = null;
if (file.equals("") || file.getSize() <= 0) {
file = null;
} else {
InputStream ins = null;
ins = file.getInputStream();
toFile = new File(file.getOriginalFilename());
inputStreamToFile(ins, toFile);
ins.close();
}
return toFile;
}
//获取流文件
private static void inputStreamToFile(InputStream ins, File file) {
try {
OutputStream os = new FileOutputStream(file);
int bytesRead = 0;
byte[] buffer = new byte[8192];
while ((bytesRead = ins.read(buffer, 0, 8192)) != -1) {
os.write(buffer, 0, bytesRead);
}
os.close();
ins.close();
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 删除本地临时文件
* @param file
*/
public static void delteTempFile(File file) {
if (file != null) {
File del = new File(file.toURI());
del.delete();
}
}
}
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
<where> <where>
is_deleted = 1 is_deleted = 1
<if test="bannersName != ''"> <if test="bannersName != ''">
AND banners_name LIKE concat('%', ${bannersName}, '%') AND banners_name LIKE concat('%', #{bannersName}, '%')
</if> </if>
<if test="targetType != ''"> <if test="targetType != ''">
AND target_type=${targetType} AND target_type=${targetType}
......
...@@ -306,13 +306,11 @@ public class KylinPerformancesServiceImpl extends ServiceImpl<KylinPerformancesM ...@@ -306,13 +306,11 @@ public class KylinPerformancesServiceImpl extends ServiceImpl<KylinPerformancesM
if (1 == DateUtil.compareStrDay(timeStart, nowTime)) {// 未开始 if (1 == DateUtil.compareStrDay(timeStart, nowTime)) {// 未开始
ticket.setStatus(9); ticket.setStatus(9);
} else { // 购买 } else { // 已开始
ticket.setStatus(6);
}
if (-1 == DateUtil.compareStrDay(timeEnd, nowTime)) { // 已结束
ticket.setStatus(10);
} else { // 购买
ticket.setStatus(6); ticket.setStatus(6);
if (1 == DateUtil.compareStrDay(nowTime, timeEnd)) { // 已结束
ticket.setStatus(10);
}
} }
} }
// 会员状态 // 会员状态
......
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