提交 1297991f authored 作者: 潘鹏's avatar 潘鹏

Merge remote-tracking branch 'origin/master'

......@@ -150,4 +150,30 @@ public class AdvertisementItemController {
}
return R.error("操作失败");
}
/**
* 修改广告页商品
*/
@RequestMapping("/updateAdvertisementItem")
@ResponseBody
public R updateAdvertisementItem(@RequestParam Map<String, Object> map) {
int res = advertisementItemService.updateAdvertisementItem(map);
if (res > 0) {
return R.ok();
} else if (res == -1) {
return R.error("参数不能为空");
} else if (res == -2) {
return R.error("序号不能跟原来相同");
} else if (res == -3) {
return R.error("序号必须是正整数");
}
return R.error("操作失败");
}
@RequestMapping("/getAdSort")
@ResponseBody
public R getAdSort(@RequestParam Map<String, Object> map) {
Integer sort = advertisementItemService.getAdSort(map);
return R.ok().put("sort", sort);
}
}
......@@ -12,6 +12,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import com.platform.utils.OssUtil;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
......@@ -30,37 +31,40 @@ import com.platform.utils.util.UuidUtil;
@Controller
@RequestMapping(value="/api/osstest",produces="application/json;charset=UTF-8")
@RequestMapping(value = "/api/osstest", produces = "application/json;charset=UTF-8")
public class OssTestApi {
@IgnoreAuth
@RequestMapping("/createfolder")
@ResponseBody
public String createFolder() {
try {
OSSClient client= OssUtil.getOSSClient();
String fileDir=OssUtil.createFolder(client, "diaosaas-prod", "xinlizixun/");
OSSClient client = OssUtil.getOSSClient();
String fileDir = OssUtil.createFolder(client, "diaosaas-prod", "xinlizixun/");
return fileDir;
} catch (Exception e) {
e.printStackTrace();
return "error";
}
}
@IgnoreAuth
@RequestMapping(value="/uploadtest",produces="application/json;charset=UTF-8")
@RequestMapping(value = "/uploadtest", produces = "application/json;charset=UTF-8")
@ResponseBody
public String upload(MultipartFile file,String secondaryFolderName) {
public String upload(MultipartFile file, String secondaryFolderName) {
try {
// 获取文件名
String fileName = file.getOriginalFilename();
// 获取文件后缀
String prefix=fileName.substring(fileName.lastIndexOf("."));
String prefix = fileName.substring(fileName.lastIndexOf("."));
// 用uuid作为文件名,防止生成的文件重复
final File mfile = File.createTempFile(UuidUtil.get32UUID(), prefix);
// MultipartFile to File
file.transferTo(mfile);
String url=OssUtil.uploadObject2OSS(mfile,secondaryFolderName);
if (StringUtils.isBlank(secondaryFolderName)) {
secondaryFolderName = "afrishop";
}
String url = OssUtil.uploadObject2OSS(mfile, secondaryFolderName);
System.out.println(mfile.getName());
System.out.println(url);
return url;
......@@ -71,24 +75,24 @@ public class OssTestApi {
}
@IgnoreAuth
@RequestMapping(value="/uploadfile",produces="application/json;charset=UTF-8")
@RequestMapping(value = "/uploadfile", produces = "application/json;charset=UTF-8")
@ResponseBody
public String uploadfile(MultipartFile file,String secondaryFolderName) {
public String uploadfile(MultipartFile file, String secondaryFolderName) {
try {
// 获取文件名
String fileName = file.getOriginalFilename();
// 获取文件后缀
String prefix=fileName.substring(fileName.lastIndexOf("."));
String prefix = fileName.substring(fileName.lastIndexOf("."));
// 用uuid作为文件名,防止生成的文件重复
final File mfile = File.createTempFile(UuidUtil.get32UUID(), prefix);
// MultipartFile to File
file.transferTo(mfile);
String url=OssUtil.uploadObject2OSS(mfile,secondaryFolderName);
String url = OssUtil.uploadObject2OSS(mfile, secondaryFolderName);
System.out.println(mfile.getName());
System.out.println(url);
return url +" "+fileName;
return url + " " + fileName;
//return "";
} catch (Exception e) {
e.printStackTrace();
......@@ -98,43 +102,41 @@ public class OssTestApi {
/**
*
* @Function: uploadfileVideo
* @Description: (此方法只用于[课程管理模块]上传课程宣传视频和课程视频)
* @param:
* @return:
* @IgnoreAuth
* @RequestMapping(value="/uploadfileVideo",produces="application/json;charset=UTF-8")
* @ResponseBody public Map<String, Object> uploadfileVideo(HttpServletRequest request,MultipartFile[] files) {
* <p>
* Map<String, Object> map = new HashMap<>();
* List<String> urlList = new ArrayList<>();
* try {
* for (int i = 0; i < files.length; i++) {
* // 获取文件名
* String fileName = files[i].getOriginalFilename();
* // 获取文件后缀
* String prefix=fileName.substring(fileName.lastIndexOf("."));
* System.out.println(UuidUtil.get32UUID()+"-"+fileName.substring(0,fileName.lastIndexOf(".")));
* final File mfile = File.createTempFile(UuidUtil.get32UUID(), prefix);
* // MultipartFile to File
* files[i].transferTo(mfile);
* String url=OssUtil.uploadObject3OSS(mfile,fileName);
* // String fileUpload = OssUtil.fileUpload(mfile, fileName, request);
* System.out.println(mfile.getName());
* urlList.add(url);
* // urlList.add(fileUpload);
* }
* map.put("urlList", urlList);
* return map;
* } catch (Exception e) {
* e.printStackTrace();
* return map;
* }
* }
* @since JDK 1.8
@IgnoreAuth
@RequestMapping(value="/uploadfileVideo",produces="application/json;charset=UTF-8")
@ResponseBody
public Map<String, Object> uploadfileVideo(HttpServletRequest request,MultipartFile[] files) {
Map<String, Object> map = new HashMap<>();
List<String> urlList = new ArrayList<>();
try {
for (int i = 0; i < files.length; i++) {
// 获取文件名
String fileName = files[i].getOriginalFilename();
// 获取文件后缀
String prefix=fileName.substring(fileName.lastIndexOf("."));
System.out.println(UuidUtil.get32UUID()+"-"+fileName.substring(0,fileName.lastIndexOf(".")));
final File mfile = File.createTempFile(UuidUtil.get32UUID(), prefix);
// MultipartFile to File
files[i].transferTo(mfile);
String url=OssUtil.uploadObject3OSS(mfile,fileName);
// String fileUpload = OssUtil.fileUpload(mfile, fileName, request);
System.out.println(mfile.getName());
urlList.add(url);
// urlList.add(fileUpload);
}
map.put("urlList", urlList);
return map;
} catch (Exception e) {
e.printStackTrace();
return map;
}
} */
*/
@IgnoreAuth
......@@ -143,7 +145,7 @@ public class OssTestApi {
public R delete(String url) {
try {
// http://diaosaas-prod.oss-cn-shenzhen.aliyuncs.com/education/155771122620710111.jpg
url = url.substring(url.lastIndexOf("/")+1);
url = url.substring(url.lastIndexOf("/") + 1);
OssUtil.deleteFile("diaosaas-prod", "education/", url);
return R.ok().put("success", "删除成功");
} catch (Exception e) {
......@@ -153,12 +155,11 @@ public class OssTestApi {
}
/**
* 富文本图片自定义上传
*/
@IgnoreAuth
@RequestMapping(value="/uploaditemimage",produces="application/json;charset=UTF-8")
@RequestMapping(value = "/uploaditemimage", produces = "application/json;charset=UTF-8")
@ResponseBody
public Object uploadItemImage(HttpServletRequest request) throws Exception {
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
......@@ -166,7 +167,7 @@ public class OssTestApi {
String url = "";
if (photo.getSize() > 0) {
String result =OssUtil.upload(photo);
String result = OssUtil.upload(photo);
if (result.equals("fail")) {
} else {
......@@ -184,11 +185,12 @@ public class OssTestApi {
return result;
}
// 删除富文本的图片
//content 需要更新的内容
//pd 没更新的数据
public void deleteUeditorImg( String content,PageData pd) {
if(pd.get("describes")!=null&&pd.get("describes").toString().trim().length()>0 ){
public void deleteUeditorImg(String content, PageData pd) {
if (pd.get("describes") != null && pd.get("describes").toString().trim().length() > 0) {
String dbContent = pd.getString("describes");
List<String> list = StringUtil.getImgStr(dbContent);
String[] a = new String[list.size()];
......@@ -206,7 +208,7 @@ public class OssTestApi {
for (int i = 0; i < list2.size(); i++) {
String path = list2.get(i);
path.substring(path.lastIndexOf("/")+1, path.length());
path.substring(path.lastIndexOf("/") + 1, path.length());
OssUtil.deleteFile("diaosaas-prod", "education/", path);
}
}
......@@ -215,57 +217,60 @@ public class OssTestApi {
/**
* 获取实时长传进度
*
* @param request
* @return
*/
@RequestMapping ("/item/percent")
@RequestMapping("/item/percent")
@ResponseBody
public int getUploadPercent(HttpServletRequest request){
public int getUploadPercent(HttpServletRequest request) {
HttpSession session = request.getSession();
int percent = session.getAttribute("upload_percent") == null ? 0: (Integer)session.getAttribute("upload_percent");
int percent = session.getAttribute("upload_percent") == null ? 0 : (Integer) session.getAttribute("upload_percent");
return percent;
}
/**
* 重置上传进度
*
* @param request
* @return
*/
@RequestMapping ("/percent/reset")
public void resetPercent(HttpServletRequest request){
@RequestMapping("/percent/reset")
public void resetPercent(HttpServletRequest request) {
HttpSession session = request.getSession();
session.setAttribute("upload_percent",0);
session.setAttribute("upload_percent", 0);
}
/**多线程分片文件上传**/
/**
* 多线程分片文件上传
**/
@RequestMapping("uploadFile")
public String uploadBlog(@RequestParam("file")MultipartFile file,HttpServletRequest request){//MultipartFile是spring类型,代表HTML中form data方式上传的文件,包含二进制数据+文件名称。 logger.info("文件上传");
HttpSession session=request.getSession();
String filename=file.getOriginalFilename();
session.setAttribute("fileName",filename);
public String uploadBlog(@RequestParam("file") MultipartFile file, HttpServletRequest request) {//MultipartFile是spring类型,代表HTML中form data方式上传的文件,包含二进制数据+文件名称。 logger.info("文件上传");
HttpSession session = request.getSession();
String filename = file.getOriginalFilename();
session.setAttribute("fileName", filename);
System.out.println(filename);
long fileLength=file.getSize();
DecimalFormat df=new DecimalFormat(".00");
if(fileLength<1024){
session.setAttribute("fileSize","1KB");
}else if(fileLength>=1024 && fileLength<1024*1024){
session.setAttribute("fileSize",df.format(fileLength/1024.0)+"KB");
}else {
session.setAttribute("fileSize",df.format(fileLength/(1024.0*1024.0))+"MB");
long fileLength = file.getSize();
DecimalFormat df = new DecimalFormat(".00");
if (fileLength < 1024) {
session.setAttribute("fileSize", "1KB");
} else if (fileLength >= 1024 && fileLength < 1024 * 1024) {
session.setAttribute("fileSize", df.format(fileLength / 1024.0) + "KB");
} else {
session.setAttribute("fileSize", df.format(fileLength / (1024.0 * 1024.0)) + "MB");
}
try {
if(file!=null){
if (!"".equals(filename.trim())){
if (file != null) {
if (!"".equals(filename.trim())) {
//MultipartFile转File
File newFile=new File(filename);
FileOutputStream os=new FileOutputStream(newFile);
File newFile = new File(filename);
FileOutputStream os = new FileOutputStream(newFile);
os.write(file.getBytes());
os.close();
file.transferTo(newFile);//将上传文件写入目标文件
//上传到OSS
String key="time1128";
String key = "time1128";
// String url=OssUtil.upLoad(newFile,session,key);
//删除临时文件
......
......@@ -29,7 +29,7 @@ public class uploadController {
@RequestMapping(value = "/uploadFile", produces = "application/json;charset=UTF-8")
public String upload(MultipartFile file) {
try {
String secondaryFolderName = "Afrishop";
String secondaryFolderName = "afrishop";
// 获取文件名
String fileName = file.getOriginalFilename();
// 获取文件后缀
......
......@@ -3,6 +3,7 @@ package com.platform.dao;
import com.platform.entity.AdvertisementItemEntity;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
......@@ -17,11 +18,18 @@ public interface AdvertisementItemDao extends BaseDao<AdvertisementItemEntity> {
int deleteByItem(@Param("itemId") String itemId, @Param("adId") String adId);
int getMaxSort();
int getMaxSort(@Param("adId") String adId);
int setItemTop(@Param("top") Integer top, @Param("itemId") String itemId, @Param("adId") String adId);
AdvertisementItemEntity getAdItemById(@Param("itemId") String itemId, @Param("adId") String adId);
int updateAdItem(AdvertisementItemEntity advertisementItemEntity);
int existItemSort(@Param("adId") String adId, @Param("sort") Integer sort);
List<AdvertisementItemEntity> changeSortBack(@Param("firstSort") Integer firstSort, @Param("endSort") Integer endSort, @Param("adId") String adId);
List<AdvertisementItemEntity> changeSortFront(@Param("firstSort") Integer firstSort, @Param("endSort") Integer endSort, @Param("adId") String adId);
}
......@@ -8,7 +8,7 @@ import java.util.Date;
* 表名 advertisement_item
*
* @author lipengjun
* @date 2020-10-07 15:50:04
* @date 2020-10-13 17:30:21
*/
public class AdvertisementItemEntity implements Serializable {
private static final long serialVersionUID = 1L;
......@@ -22,13 +22,17 @@ public class AdvertisementItemEntity implements Serializable {
*/
private String itemId;
/**
* 置顶
* 是否置顶 0: 不置顶 1:置顶
*/
private Integer isTop;
/**
* 排序
*/
private Integer sort;
/**
* 商品添加时间
*/
private Date createTime;
/**
* 设置:广告投放ID
......@@ -57,14 +61,14 @@ public class AdvertisementItemEntity implements Serializable {
return itemId;
}
/**
* 设置:置顶
* 设置:是否置顶 0: 不置顶 1:置顶
*/
public void setIsTop(Integer isTop) {
this.isTop = isTop;
}
/**
* 获取:置顶
* 获取:是否置顶 0: 不置顶 1:置顶
*/
public Integer getIsTop() {
return isTop;
......@@ -82,4 +86,17 @@ public class AdvertisementItemEntity implements Serializable {
public Integer getSort() {
return sort;
}
/**
* 设置:商品添加时间
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
/**
* 获取:商品添加时间
*/
public Date getCreateTime() {
return createTime;
}
}
......@@ -14,6 +14,15 @@ public class TbCfStationItemEntityExtends extends TbCfStationItemEntity implemen
private String uname;
private Integer isTop;
private Integer sort;
private Integer itemSort;
public Integer getItemSort() {
return itemSort;
}
public void setItemSort(Integer itemSort) {
this.itemSort = itemSort;
}
public String getUname() {
return uname;
......
package com.platform.service;
import com.platform.entity.AdvertisementItemEntity;
import io.swagger.models.auth.In;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
......@@ -75,4 +76,8 @@ public interface AdvertisementItemService {
int deleteByItem(String itemId, String adId);
int setItemTop(String itemId, String adId);
int updateAdvertisementItem(@RequestParam Map<String, Object> map);
Integer getAdSort(Map<String, Object> map);
}
......@@ -4,13 +4,18 @@ import com.platform.dao.AdvertisementItemDao;
import com.platform.entity.AdvertisementItemEntity;
import com.platform.service.AdvertisementItemService;
import com.platform.utils.IdUtil;
import io.swagger.models.auth.In;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.locks.ReentrantLock;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Service实现类
......@@ -23,6 +28,8 @@ public class AdvertisementItemServiceImpl implements AdvertisementItemService {
@Autowired
private AdvertisementItemDao advertisementItemDao;
final ReentrantLock lock = new ReentrantLock();
@Override
public AdvertisementItemEntity queryObject(String adId) {
return advertisementItemDao.queryObject(adId);
......@@ -40,9 +47,14 @@ public class AdvertisementItemServiceImpl implements AdvertisementItemService {
@Override
public int save(AdvertisementItemEntity advertisementItem) {
advertisementItem.setIsTop(0);
advertisementItem.setSort(0);
return advertisementItemDao.save(advertisementItem);
// advertisementItem.setIsTop(0);
lock.lock();
int maxSort = advertisementItemDao.getMaxSort(advertisementItem.getAdId());
advertisementItem.setSort(++maxSort);
advertisementItem.setCreateTime(new Date());
int res = advertisementItemDao.save(advertisementItem);
lock.unlock();
return res;
}
@Override
......@@ -90,7 +102,7 @@ public class AdvertisementItemServiceImpl implements AdvertisementItemService {
if (count >= 60) {
return -1;
}
int maxSort = advertisementItemDao.getMaxSort();
int maxSort = advertisementItemDao.getMaxSort(null);
byId.setSort(++maxSort);
byId.setIsTop(1);
} else {
......@@ -100,4 +112,96 @@ public class AdvertisementItemServiceImpl implements AdvertisementItemService {
}
return advertisementItemDao.updateAdItem(byId);
}
//商品排序需求
//1、要更改的序号与原序号相同,不做处理
//2、要更改的序号没被商品占有,直接修改序号
//3、将序号调至后面
//4、将序号调至前面
@Override
public int updateAdvertisementItem(Map<String, Object> map) {
int res = 0;
String itemId = map.get("itemId").toString();
String adId = map.get("adId").toString();
String sort = map.get("sort").toString();
if (!StringUtils.isNumeric(sort)) {
return -3;
}
Integer itemSort = Integer.parseInt(sort);
String regex = "^[1-9]+[0-9]*$";
Pattern p = Pattern.compile(regex);
Matcher matcher = p.matcher(sort);
if (!matcher.matches()) {
return -3;
}
if (itemId == null || itemId == "") {
return -1;
}
if (adId == null || adId == "") {
return -1;
}
if (sort == null || sort == "") {
return -1;
}
AdvertisementItemEntity byId = advertisementItemDao.getAdItemById(itemId, adId);
if (byId == null) {
return res;
}
//情况1
String firstSort = String.valueOf(byId.getSort());
if (sort.equals(firstSort)) {
return -2;
}
//情况2
int count = advertisementItemDao.existItemSort(adId, itemSort);
if (count == 0) {
byId.setSort(itemSort);
res = advertisementItemDao.updateAdItem(byId);
} else {
//要更换的序号被占有
//情况3 (2-->8)
Integer sort1 = byId.getSort();
if (sort1 < itemSort) {
List<AdvertisementItemEntity> list = advertisementItemDao.changeSortBack(sort1 + 1, itemSort, adId);
for (AdvertisementItemEntity ad : list) {
ad.setSort(ad.getSort() - 1);
advertisementItemDao.updateAdItem(ad);
}
} else {
//情况4 (8-->2)
List<AdvertisementItemEntity> list = advertisementItemDao.changeSortFront(itemSort, sort1 - 1, adId);
for (AdvertisementItemEntity ad : list) {
ad.setSort(ad.getSort() + 1);
advertisementItemDao.updateAdItem(ad);
}
}
byId.setSort(itemSort);
res = advertisementItemDao.updateAdItem(byId);
}
return res;
}
@Override
public Integer getAdSort(Map<String, Object> map) {
String itemId = map.get("itemId").toString();
String adId = map.get("adId").toString();
if (itemId == null || itemId == "") {
return null;
}
if (adId == null || adId == "") {
return null;
}
AdvertisementItemEntity byId = advertisementItemDao.getAdItemById(itemId, adId);
if (byId != null) {
Integer sort = byId.getSort();
if (sort != null) {
return byId.getSort();
}
}
return 0;
}
}
......@@ -8,6 +8,7 @@
<result property="itemId" column="item_id"/>
<result property="isTop" column="is_top"/>
<result property="sort" column="sort"/>
<result property="createTime" column="create_time"/>
</resultMap>
<select id="queryObject" resultType="com.platform.entity.AdvertisementItemEntity">
......@@ -15,7 +16,8 @@
`ad_id`,
`item_id`,
`is_top`,
`sort`
`sort`,
`create_time`
from advertisement_item
where ad_id = #{id}
</select>
......@@ -25,12 +27,18 @@
`ad_id`,
`item_id`,
`is_top`,
`sort`
`sort`,
`create_time`
from advertisement_item
where ad_id = #{adId}
and item_id=#{itemId}
</select>
<select id="existItemSort" resultType="int">
select count(1) from advertisement_item where ad_id = #{adId} and sort=#{sort}
</select>
<select id="getAdItemCount" resultType="int">
select count(1) from advertisement_item where ad_id = #{adId}
<if test="itemId != null and itemId.trim() != ''">
......@@ -43,7 +51,30 @@
</update>
<select id="getMaxSort" resultType="int">
select max(sort) from advertisement_item
select IFNULL(max(sort),0) from advertisement_item
<if test="adId != null and adId.trim() != ''">
where ad_id=#{adId}
</if>
</select>
<select id="changeSortBack" resultType="com.platform.entity.AdvertisementItemEntity">
select
`ad_id`,
`item_id`,
`is_top`,
`sort`,
`create_time`
from advertisement_item where sort BETWEEN #{firstSort} AND #{endSort} and ad_id=#{adId}
</select>
<select id="changeSortFront" resultType="com.platform.entity.AdvertisementItemEntity">
select
`ad_id`,
`item_id`,
`is_top`,
`sort`,
`create_time`
from advertisement_item where sort BETWEEN #{firstSort} AND #{endSort} and ad_id=#{adId}
</select>
<delete id="deleteByItem">
......@@ -55,7 +86,8 @@
`ad_id`,
`item_id`,
`is_top`,
`sort`
`sort`,
`create_time`
from advertisement_item
WHERE 1=1
<if test="name != null and name.trim() != ''">
......@@ -87,12 +119,14 @@
`ad_id`,
`item_id`,
`is_top`,
`sort`)
`sort`,
`create_time`)
values(
#{adId},
#{itemId},
#{isTop},
#{sort})
#{sort},
#{createTime})
</insert>
<update id="update" parameterType="com.platform.entity.AdvertisementItemEntity">
......@@ -100,7 +134,8 @@
<set>
<if test="itemId != null">`item_id` = #{itemId},</if>
<if test="isTop != null">`is_top` = #{isTop},</if>
<if test="sort != null">`sort` = #{sort}</if>
<if test="sort != null">`sort` = #{sort},</if>
<if test="createTime != null">`create_time` = #{createTime}</if>
</set>
where ad_id = #{adId}
</update>
......
......@@ -95,14 +95,14 @@
t.goodstwotype_title title,
o.goodstype_title goodtype,
a.is_top,
a.sort
a.sort itemSort
from advertisement_item a
left join tb_cf_station_item i on i.item_id=a.item_id
left JOIN tb_cf_goodstype o ON o.goodstype_id = i.item_category
left JOIN tb_cf_goodstwotype t ON i.item_categorytwo=t.goodstwotype_id
left JOIN tb_cf_descripiton d ON i.item_descrition_id=d.descripition_id
where a.ad_id=#{adId} and i.enable_flag!=0
order by a.is_top desc,a.sort desc,i.create_time desc
where a.ad_id=#{adId}
order by itemSort asc
<if test="offset != null and limit != null">
limit #{offset}, #{limit}
</if>
......
......@@ -2,13 +2,13 @@
#jdbc.username=root
#jdbc.password=root
jdbc.url=jdbc:mysql://47.106.242.175:3306/chinafrica?allowMultiQueries=true&useSSL=false&useUnicode=true&characterEncoding=UTF-8
jdbc.username=root
jdbc.password=diaoyun666
#jdbc.url=jdbc:mysql://47.106.242.175:3306/chinafrica?allowMultiQueries=true&useSSL=false&useUnicode=true&characterEncoding=UTF-8
#jdbc.username=root
#jdbc.password=diaoyun666
#jdbc.url: jdbc:mysql://159.138.48.71:3306/chinafrica?useUnicode=true&characterEncoding=UTF-8&rewriteBatchedStatements=true&autoReconnect=true&failOverReadOnly=false&zeroDateTimeBehavior=convertToNull&useSSL=false
#jdbc.username: root
#jdbc.password: Diaoyunnuli.8
jdbc.url: jdbc:mysql://159.138.48.71:3306/chinafrica?useUnicode=true&characterEncoding=UTF-8&rewriteBatchedStatements=true&autoReconnect=true&failOverReadOnly=false&zeroDateTimeBehavior=convertToNull&useSSL=false
jdbc.username: root
jdbc.password: Diaoyunnuli.8
jdbc.initialSize=5
jdbc.maxActive=30
......
......@@ -2,13 +2,13 @@
#jdbc.username=root
#jdbc.password=root
jdbc.url=jdbc:mysql://47.106.242.175:3306/chinafrica?allowMultiQueries=true&useSSL=false&useUnicode=true&characterEncoding=UTF-8
jdbc.username=root
jdbc.password=diaoyun666
#jdbc.url=jdbc:mysql://47.106.242.175:3306/chinafrica?allowMultiQueries=true&useSSL=false&useUnicode=true&characterEncoding=UTF-8
#jdbc.username=root
#jdbc.password=diaoyun666
#jdbc.url: jdbc:mysql://159.138.48.71:3306/chinafrica?useUnicode=true&characterEncoding=UTF-8&rewriteBatchedStatements=true&autoReconnect=true&failOverReadOnly=false&zeroDateTimeBehavior=convertToNull&useSSL=false
#jdbc.username: root
#jdbc.password: Diaoyunnuli.8
jdbc.url: jdbc:mysql://159.138.48.71:3306/chinafrica?useUnicode=true&characterEncoding=UTF-8&rewriteBatchedStatements=true&autoReconnect=true&failOverReadOnly=false&zeroDateTimeBehavior=convertToNull&useSSL=false
jdbc.username: root
jdbc.password: Diaoyunnuli.8
jdbc.initialSize=5
jdbc.maxActive=30
......
......@@ -24,6 +24,8 @@ import java.util.Date;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* 商品导入功能
......@@ -481,4 +483,6 @@ public class ImpartCode {
return output.toByteArray();
}
}
......@@ -288,6 +288,18 @@
</Form-item>
</i-form>
</Card>
<Modal
v-model="modal1"
title="商品排序"
@on-ok="deal"
width="600px"
@on-cancel="cancel">
<i-form ref="formValidate" :model="advertisement" :rules="ruleValidate" :label-width="80">
<Form-item label="序号" prop="sort">
<i-input v-model="sort" placeholder="序号" style="width: 160px"/>
</Form-item>
</i-form>
</Modal>
</div>
<script src="${rc.contextPath}/js/sys/advertisement.js?_${date.systemTime}"></script>
......
......@@ -52,9 +52,10 @@
<br/>
<Form-item label="答案" prop="answer" style="width: 800px">
<!-- 加载编辑器的容器 -->
<script id="container" name="content" type="text/plain">
</script>
<!-- <script id="container" name="content" type="text/plain">-->
<!-- </script>-->
<!--<i-input v-model="tbCfProblem.answer" placeholder="答案"/>-->
<textarea v-model="tbCfProblem.answer" style="width: 600px;height: 300px;"></textarea>
</Form-item>
<Form-item label="是否展示" prop="enableFlag" style="width: 800px">
<i-select placeholder="请选择" v-model="tbCfProblem.enableFlag">
......
......@@ -18,6 +18,9 @@ $(function () {
let vm = new Vue({
el: '#rrapp',
data: {
itemId: 0,
modal1: false,
sort: '',
versionList: [
{
value: 1,
......@@ -130,8 +133,97 @@ let vm = new Vue({
}
},
methods: {
add: function () {
vm.tempId = this.guid();
vm.showList = false;
vm.title = "新增";
vm.advertisement = {};
console.log('add-->tempId', vm.tempId)
$("#adItemjqGrid").jqGrid("clearGridData");
$("#searchjqGrid").jqGrid("clearGridData");
$("#adItemjqGrid").Grid({
url: '../advertisement/getAdvertisementItem?adId=' + vm.tempId,
colModel: [
{label: 'itemId', name: 'itemId', key: true, index: 'item_id', hidden: true},
{label: '序号', name: 'itemSort', index: 'itemSort', width: 100},
{label: '商品图片', name: 'itemImg', index: 'item_img', width: 100, formatter: imageFormat},
{label: '商品编号', name: 'itemCode', index: 'item_code', width: 160},
{label: '商品名称', name: 'itemName', index: 'item_name', width: 160},
/* {label: '商品标题', name: 'itemBrief', index: 'item_brief', width: 120},*/
/*{label: '商品链接', name: 'itemUrl', index: 'item_url', width: 80,formatter:linkFormat},*/
{label: '商品原价', name: 'itemPrice', index: 'item_price', width: 100},
{label: '商品现价', name: 'discountPrice', index: 'discount_price', width: 100},
/*{label: '所属平台', name: 'platformCode', index: 'platform_code', width: 80},
{label: '平台名', name: 'platformName', index: 'platform_name', width: 80},*/
{label: '供应商', name: 'supplier', index: 'supplier', width: 120},
{label: '商品一级分类', name: 'goodtype', index: 'goodtype', width: 120},
{label: '商品二级分类', name: 'title', index: 'title', width: 120},
{label: '商品品名', name: 'dname', index: 'itemDescritionId', width: 120},
{
label: '操作', index: 'operate', width: 160, formatter: function (value, grid, rows) {
return '<span class="label label-info pointer" onclick="vm.delItem(\'' + rows.itemId + '\')">移除</span>&nbsp;&nbsp;' +
'<span class="label label-info pointer" onclick="vm.sortItem(\'' + rows.itemId + '\')">排序</span>&nbsp;&nbsp;'
}
} // beforeSelectRow: beforeSelectRow,
],
multiboxonly: true
// beforeSelectRow: beforeSelectRow,
});
},
sortItem(e) {
let id = $("#jqGrid").getGridParam("selrow");
if (id == '' || id == null) {
id = vm.tempId;
}
vm.modal1 = true;
vm.itemId = e;
console.log('vm.tempId', vm.tempId)
console.log('sortItem-->adId', id)
console.log('sortItem-->itemId', e)
Ajax.request({
url: "../advertisementitem/getAdSort?itemId=" + e + '&adId=' + id,
type: "POST",
contentType: "application/json",
successCallback: function (res) {
vm.sort = res.sort
}
});
},
deal() {
let id = $("#jqGrid").getGridParam("selrow");
if (id == '' || id == null) {
id = vm.tempId;
}
console.log('deal-->adId', id)
console.log('deal-->itemId', vm.itemId)
let itemSort;
itemSort = parseInt(vm.sort);
Ajax.request({
url: "../advertisementitem/updateAdvertisementItem?itemId=" + vm.itemId + '&adId=' + id + '&sort=' + vm.sort,
type: "POST",
contentType: "application/json",
successCallback: function () {
alert('操作成功', function (index) {
vm.btn_Search(id);
vm.modal1 = false;
});
}
});
},
cancel() {
vm.modal1 = false;
},
delItem(itemId) {
let id = getSelectedRow("#jqGrid");
let id = $("#jqGrid").getGridParam("selrow");
if (id == '' || id == null) {
id = vm.tempId;
}
confirm('确定要删除选中的记录?', function () {
Ajax.request({
url: "../advertisementitem/deleteByItem?itemId=" + itemId + '&adId=' + id,
......@@ -155,8 +247,6 @@ let vm = new Vue({
if (id == null || id == '' || id == 'undefined') {
id = vm.tempId;
}
console.log('vm.advertisement.id', vm.advertisement.id)
console.log('vm.tempId', vm.tempId)
Ajax.request({
url: "../advertisementitem/saveBatch?aId=" + id + '&itemIds=' + ids,
type: "POST",
......@@ -207,40 +297,7 @@ let vm = new Vue({
return v.toString(32);
});
},
add: function () {
vm.tempId = this.guid();
vm.showList = false;
vm.title = "新增";
vm.advertisement = {};
$("#adItemjqGrid").jqGrid("clearGridData");
$("#searchjqGrid").jqGrid("clearGridData");
$("#adItemjqGrid").Grid({
url: '../advertisement/getAdvertisementItem?adId=' + vm.tempId,
colModel: [
{label: 'itemId', name: 'itemId', key: true, index: 'item_id', hidden: true},
{label: '商品图片', name: 'itemImg', index: 'item_img', width: 100, formatter: imageFormat},
{label: '商品编号', name: 'itemCode', index: 'item_code', width: 160},
{label: '商品名称', name: 'itemName', index: 'item_name', width: 160},
/* {label: '商品标题', name: 'itemBrief', index: 'item_brief', width: 120},*/
/*{label: '商品链接', name: 'itemUrl', index: 'item_url', width: 80,formatter:linkFormat},*/
{label: '商品原价', name: 'itemPrice', index: 'item_price', width: 100},
{label: '商品现价', name: 'discountPrice', index: 'discount_price', width: 100},
/*{label: '所属平台', name: 'platformCode', index: 'platform_code', width: 80},
{label: '平台名', name: 'platformName', index: 'platform_name', width: 80},*/
{label: '供应商', name: 'supplier', index: 'supplier', width: 120},
{label: '商品一级分类', name: 'goodtype', index: 'goodtype', width: 120},
{label: '商品二级分类', name: 'title', index: 'title', width: 120},
{label: '商品品名', name: 'dname', index: 'itemDescritionId', width: 120},
{
label: '操作', index: 'operate', width: 120, formatter: function (value, grid, rows) {
return '<span class="label label-info pointer" onclick="vm.delItem(\'' + rows.itemId + '\')">移除</span>&nbsp;&nbsp;'
}
}
],
// beforeSelectRow: beforeSelectRow,
});
},
update: function (event) {
$("#searchjqGrid").jqGrid("clearGridData");
$("#adItemjqGrid").jqGrid("clearGridData");
......@@ -255,6 +312,7 @@ let vm = new Vue({
url: '../advertisement/getAdvertisementItem?adId=' + id,
colModel: [
{label: 'itemId', name: 'itemId', key: true, index: 'item_id', hidden: true},
{label: '序号', name: 'itemSort', index: 'itemSort', width: 100},
{label: '商品图片', name: 'itemImg', index: 'item_img', width: 100, formatter: imageFormat},
{label: '商品编号', name: 'itemCode', index: 'item_code', width: 160},
{label: '商品名称', name: 'itemName', index: 'item_name', width: 160},
......@@ -269,18 +327,16 @@ let vm = new Vue({
{label: '商品二级分类', name: 'title', index: 'title', width: 120},
{label: '商品品名', name: 'dname', index: 'itemDescritionId', width: 120},
{
label: '操作', index: 'operate', width: 120, formatter: function (value, grid, rows) {
label: '操作', index: 'operate', width: 160, formatter: function (value, grid, rows) {
if (rows.isTop == 1) {
return '<span class="label label-danger pointer" onclick="vm.itemTop(\'' + rows.itemId + '\')">取消置顶</span>&nbsp;&nbsp;' +
'<span class="label label-info pointer" onclick="vm.delItem(\'' + rows.itemId + '\')">移除</span>&nbsp;&nbsp;'
}
return '<span class="label label-info pointer" onclick="vm.itemTop(\'' + rows.itemId + '\')">置顶</span>&nbsp;&nbsp;' +
'<span class="label label-info pointer" onclick="vm.delItem(\'' + rows.itemId + '\')">移除</span>&nbsp;&nbsp;'
}
return '<span class="label label-info pointer" onclick="vm.delItem(\'' + rows.itemId + '\')">移除</span>&nbsp;&nbsp;' +
'<span class="label label-info pointer" onclick="vm.sortItem(\'' + rows.itemId + '\')">排序</span>&nbsp;&nbsp;'
}
} // beforeSelectRow: beforeSelectRow,
],
// beforeSelectRow: beforeSelectRow,
multiboxonly: true
});
});
vm.btn_Search(id);
......
......@@ -5,7 +5,7 @@ $(function () {
{label: 'problemId', name: 'problemId', index: 'problem_id', key: true, hidden: true},
{label: '问题明细', name: 'question', index: 'question', width: 80},
{label: '类型 ', name: 'type', index: 'type', width: 80, formatter: typeFormat},
{label: '答案', name: 'answer', index: 'answer', width: 80, formatter: contentFormat},
// {label: '答案', name: 'answer', index: 'answer', width: 80, formatter: contentFormat},
{label: '是否展示', name: 'enableFlag', index: 'enable_flag', width: 80, formatter: validFormat},
{label: '排序', name: 'sort', index: 'sort', width: 80},
{label: '创建时间', name: 'createTime', index: 'create_time', width: 80}],
......@@ -17,25 +17,25 @@ $(function () {
* 增加修改的编辑器
* @type {UE.ui.Editor|*}
*/
var ue = UE.getEditor('container');
/**
* 获取文本框内容
* @returns {*|String|void}
*/
function getContent() {
var htmlContent = ue.getContent();
return htmlContent;
}
/**
* 显示内容
* @param content
*/
function showContent(problemId) {
$('#contentModal').modal('show');
vm.getInfo(problemId, true);
};
// var ue = UE.getEditor('container');
//
// /**
// * 获取文本框内容
// * @returns {*|String|void}
// */
// function getContent() {
// var htmlContent = ue.getContent();
// return htmlContent;
// }
//
// /**
// * 显示内容
// * @param content
// */
// function showContent(problemId) {
// $('#contentModal').modal('show');
// vm.getInfo(problemId, true);
// };
let vm = new Vue({
......@@ -93,8 +93,8 @@ let vm = new Vue({
vm.getInfo(problemId);
},
saveOrUpdate: function (event) {
var answer = getContent();
vm.tbCfProblem.answer = encodeURI(answer);
// var answer = getContent();
// vm.tbCfProblem.answer = encodeURI(answer);
let url = vm.tbCfProblem.problemId == null ? "../tbcfproblem/save" : "../tbcfproblem/update";
Ajax.request({
url: url,
......@@ -103,7 +103,7 @@ let vm = new Vue({
contentType: "application/json",
successCallback: function (r) {
alert('操作成功', function (index) {
ue.setContent("");
// ue.setContent("");
vm.reload();
});
}
......@@ -135,9 +135,9 @@ let vm = new Vue({
async: true,
successCallback: function (r) {
console.log(r)
r.tbCfProblem.answer = decodeURI(r.tbCfProblem.answer);
// r.tbCfProblem.answer = decodeURI(r.tbCfProblem.answer);
vm.tbCfProblem = r.tbCfProblem;
ue.setContent(vm.tbCfProblem.answer);
// ue.setContent(vm.tbCfProblem.answer);
if (!!isShowDetail) {
var answer = "无内容,请点击修改,添加内容";
if (!!vm.tbCfProblem.answer) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论