Commit aa2c5c6c by jinfeng.wang

fix

parent 3d6c273b
type=command
retries=3
command=sh -x ec_tag_pull.sh
\ No newline at end of file
#!/usr/sh
java -jar -Dloader.main=com.mobvista.apptag.utils.GetPreviewUrl apptag.jar
\ No newline at end of file
package com.mobvista.apptag.controller;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.mobvista.apptag.config.WebSecurityConfig;
import com.mobvista.apptag.entity.ECTag;
import com.mobvista.apptag.entity.ECTagResult;
import com.mobvista.apptag.entity.Feat;
import com.mobvista.apptag.entity.User;
import com.mobvista.apptag.mapper.FeatDao;
import com.mobvista.apptag.mapper.UserDao;
import com.mobvista.apptag.service.ECResultService;
import com.mobvista.apptag.service.ECTagService;
import com.mobvista.apptag.service.FeatService;
import com.mobvista.apptag.utils.PageUtil;
import com.mobvista.apptag.utils.Query;
import com.mobvista.apptag.utils.R;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author wangjf
*/
@Controller
@RequestMapping("/ec_result")
public class ECResultController {
@Autowired
private ECResultService ecResultService;
@Autowired
private UserDao userDao;
@Autowired
private ECTagService ecTagService;
@Autowired
private FeatDao featDao;
@Autowired
private FeatService featService;
public static final Logger logger = LoggerFactory.getLogger(ECResultController.class);
@GetMapping("/edit")
String edit(@SessionAttribute(WebSecurityConfig.SESSION_KEY) String userName,
@RequestParam(name = "urlMd5") String urlMd5, Model model) {
User user = userDao.find(userName);
ECTag tag = ecTagService.find(urlMd5);
model.addAttribute("ecTag", tag);
ECTagResult result = ecResultService.find(urlMd5, user.getUserId());
model.addAttribute("resultECTag", JSONObject.fromObject(result.getFeatId()));
List<Feat> categoryFeat = featDao.firstList("05");
JSONArray jsonArray = JSONArray.fromObject(categoryFeat);
model.addAttribute("firstECTag", jsonArray);
List<Feat> secondCategoryFeat = featDao.list("05");
JSONArray secondJsonArray = JSONArray.fromObject(secondCategoryFeat);
model.addAttribute("secondECTag", secondJsonArray);
return "ec_result/edit";
}
@PostMapping("/save")
@ResponseBody
R save(@SessionAttribute(WebSecurityConfig.SESSION_KEY) String userName,
@RequestParam(name = "urlMd5") String urlMd5,
@RequestParam(name = "ecCode", required = false) String ecCode) {
Map<String, String> codeMap = new HashMap<String, String>();
Map<String, String> featMap = featService.getMap();
// 类型标签
if (StringUtils.isNotBlank(ecCode)) {
String[] codes = ecCode.split(",");
for (String code : codes) {
codeMap.put(code, featMap.get(code));
}
}
ObjectMapper mapper = new ObjectMapper();
String json = "";
try {
json = mapper.writeValueAsString(codeMap);
} catch (JsonProcessingException e) {
e.printStackTrace();
}
if (ecResultService.save(urlMd5, userName, json)) {
return R.ok();
} else {
return R.error(1, "保存失败!");
}
}
@PostMapping("/list")
@ResponseBody
public PageUtil list(@SessionAttribute(WebSecurityConfig.SESSION_KEY) String username, @RequestBody Query query) {
List<ECTagResult> results = ecResultService.list(username, query);
String search = query.getSearch();
int total = ecResultService.count(username, search);
PageUtil pageUtil = new PageUtil(results, total);
return pageUtil;
}
@GetMapping("")
String trueTag(Model model) {
return "ec_result/list";
}
}
\ No newline at end of file
package com.mobvista.apptag.controller;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.mobvista.apptag.config.WebSecurityConfig;
import com.mobvista.apptag.entity.ECStorage;
import com.mobvista.apptag.entity.ECTag;
import com.mobvista.apptag.entity.Feat;
import com.mobvista.apptag.entity.User;
import com.mobvista.apptag.mapper.FeatDao;
import com.mobvista.apptag.mapper.UserDao;
import com.mobvista.apptag.service.ECResultService;
import com.mobvista.apptag.service.ECStorageService;
import com.mobvista.apptag.service.ECTagService;
import com.mobvista.apptag.service.FeatService;
import com.mobvista.apptag.utils.PageUtil;
import com.mobvista.apptag.utils.Query;
import com.mobvista.apptag.utils.R;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author wangjf
*/
@Controller
@RequestMapping("/ec_storage")
public class ECStorageController {
@Autowired
private ECResultService ecResultService;
@Autowired
private UserDao userDao;
@Autowired
private ECTagService ecTagService;
@Autowired
private FeatDao featDao;
@Autowired
private FeatService featService;
@Autowired
private ECStorageService ecStorageService;
public static final Logger logger = LoggerFactory.getLogger(ECStorageController.class);
@GetMapping("/edit")
String edit(@RequestParam(name = "urlMd5") String urlMd5, Model model) {
ECTag tag = ecTagService.find(urlMd5);
model.addAttribute("ecTag", tag);
ECStorage result = ecStorageService.find(urlMd5);
model.addAttribute("resultECTag", JSONObject.fromObject(result.getTag()));
List<Feat> categoryFeat = featDao.firstList("05");
JSONArray jsonArray = JSONArray.fromObject(categoryFeat);
model.addAttribute("firstECTag", jsonArray);
List<Feat> secondCategoryFeat = featDao.list("05");
JSONArray secondJsonArray = JSONArray.fromObject(secondCategoryFeat);
model.addAttribute("secondECTag", secondJsonArray);
return "ec_storage/edit";
}
@PostMapping("/save")
@ResponseBody
R save(@SessionAttribute(WebSecurityConfig.SESSION_KEY) String userName,
@RequestParam(name = "urlMd5") String urlMd5,
@RequestParam(name = "ecCode", required = false) String ecCode) {
Map<String, String> codeMap = new HashMap<String, String>();
Map<String, String> featMap = featService.getMap();
if (StringUtils.isNotBlank(ecCode)) {
String[] codes = ecCode.split(",");
for (String code : codes) {
codeMap.put(code, featMap.get(code));
}
}
ObjectMapper mapper = new ObjectMapper();
String json = "";
try {
json = mapper.writeValueAsString(codeMap);
} catch (JsonProcessingException e) {
e.printStackTrace();
}
if (ecStorageService.update(urlMd5, userName, json)) {
return R.ok();
} else {
return R.error(1, "保存失败!");
}
}
@PostMapping("/list")
@ResponseBody
public PageUtil list(@RequestBody Query query, Model model) {
// PageHelper.startPage(query.getOffset() / query.getLimit() + 1, query.getLimit());
List<ECStorage> results = ecStorageService.list(query);
String search = query.getSearch();
int total = ecStorageService.count(search);
PageUtil pageUtil = new PageUtil(results, total);
return pageUtil;
}
@GetMapping("")
String storageTag(@SessionAttribute(WebSecurityConfig.SESSION_KEY) String username, Model model) {
User user = userDao.find(username);
model.addAttribute("userRole", user.getRole());
return "ec_storage/list";
}
}
\ No newline at end of file
package com.mobvista.apptag.controller;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.mobvista.apptag.config.WebSecurityConfig;
import com.mobvista.apptag.entity.ECTag;
import com.mobvista.apptag.entity.Feat;
import com.mobvista.apptag.entity.Tag;
import com.mobvista.apptag.mapper.FeatDao;
import com.mobvista.apptag.mapper.TagDao;
import com.mobvista.apptag.mapper.UserDao;
import com.mobvista.apptag.service.*;
import com.mobvista.apptag.utils.PageUtil;
import com.mobvista.apptag.utils.Query;
import com.mobvista.apptag.utils.R;
import net.sf.json.JSONArray;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author wangjf
*/
@Controller
@RequestMapping("/ec_tag")
public class ECTagController {
@Autowired
private ECTagService ecTagService;
@Autowired
private ECResultService ecResultService;
@Autowired
private FeatService featService;
@Autowired
private TagDao tagDao;
@Autowired
private FeatDao featDao;
@Autowired
private UserDao userDao;
public static final Logger logger = LoggerFactory.getLogger(ECTagController.class);
@GetMapping("/edit")
String edit(@RequestParam(name = "urlMd5") String urlMd5, Model model) {
ECTag ecTag = ecTagService.find(urlMd5);
model.addAttribute("ecTag", ecTag);
List<Feat> categoryFeat = featDao.firstList("05");
JSONArray jsonArray = JSONArray.fromObject(categoryFeat);
model.addAttribute("firstECTag", jsonArray);
List<Feat> secondCategoryFeat = featDao.list("05");
JSONArray secondJsonArray = JSONArray.fromObject(secondCategoryFeat);
model.addAttribute("secondECTag", secondJsonArray);
return "ec_tag/edit";
}
@PostMapping("/save")
@ResponseBody
R save(@SessionAttribute(WebSecurityConfig.SESSION_KEY) String userName,
@RequestParam(name = "urlMd5") String urlMd5,
@RequestParam(name = "ecCode", required = false) String ecCode) {
Map<String, String> codeMap = new HashMap<String, String>();
Map<String, String> featMap = featService.getMap();
// 类型标签
if (StringUtils.isNotBlank(ecCode)) {
String[] codes = ecCode.split(",");
for (String code : codes) {
codeMap.put(code, featMap.get(code));
}
}
ObjectMapper mapper = new ObjectMapper();
String json = "";
try {
json = mapper.writeValueAsString(codeMap);
} catch (JsonProcessingException e) {
e.printStackTrace();
}
if (ecTagService.update(urlMd5, userName) && ecResultService.save(urlMd5, userName, json)) {
return R.ok();
} else {
return R.error(1, "保存失败!");
}
}
@PostMapping("/list")
@ResponseBody
public PageUtil list(@SessionAttribute(WebSecurityConfig.SESSION_KEY) String userName,
@RequestBody Query query, @RequestParam(name = "tag", required = false, defaultValue = "0") int tag) {
List<ECTag> tags = ecTagService.list(userName, query);
int total = ecTagService.count(userName, query);
PageUtil pageUtil = new PageUtil(tags, total);
return pageUtil;
}
@GetMapping("")
String falseTag(Model model) {
return "ec_tag/list";
}
}
\ No newline at end of file
package com.mobvista.apptag.entity;
import com.gitee.sunchenbin.mybatis.actable.annotation.Column;
import com.gitee.sunchenbin.mybatis.actable.annotation.Table;
import com.gitee.sunchenbin.mybatis.actable.constants.MySqlTypeConstant;
import java.io.Serializable;
import java.util.Date;
/**
* @author wangjf
*/
@Table(name = "ec_storage")
public class ECStorage implements Serializable {
private static final long serialVersionUID = 1L;
@Column(name = "url_md5",type = MySqlTypeConstant.VARCHAR,isKey = true,isNull = false)
private String urlMd5;
@Column(name = "preview_url", type = MySqlTypeConstant.TEXT, isNull = false)
private String previewUrl;
// 标签
@Column(name = "tag", type = MySqlTypeConstant.TEXT)
private String tag;
// 入库时间
@Column(name = "update_time", type = MySqlTypeConstant.DATETIME, isNull = false)
private Date updateTime;
// 标注人员(仅超管用户可以修改已入库的标签)
@Column(name = "user_id", type = MySqlTypeConstant.VARCHAR, length = 100)
private String userId;
public String getUrlMd5() {
return urlMd5;
}
public void setUrlMd5(String urlMd5) {
this.urlMd5 = urlMd5;
}
public String getPreviewUrl() {
return previewUrl;
}
public void setPreviewUrl(String previewUrl) {
this.previewUrl = previewUrl;
}
public String getTag() {
return tag;
}
public void setTag(String tag) {
this.tag = tag;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
}
\ No newline at end of file
package com.mobvista.apptag.entity;
import com.gitee.sunchenbin.mybatis.actable.annotation.Column;
import com.gitee.sunchenbin.mybatis.actable.annotation.Table;
import com.gitee.sunchenbin.mybatis.actable.constants.MySqlTypeConstant;
import java.io.Serializable;
import java.util.Date;
/**
* @author wangjf
*/
@Table(name = "ec_tag_list")
public class ECTag implements Serializable {
private static final long serialVersionUID = -1507448849738387249L;
// 电商单子中的 URL
@Column(name = "url_md5", type = MySqlTypeConstant.VARCHAR, isKey = true, isNull = false)
private String urlMd5;
// 电商单子中的 URL
@Column(name = "preview_url", type = MySqlTypeConstant.TEXT, isNull = false)
private String previewUrl;
// 标注者
@Column(name = "user_id", type = MySqlTypeConstant.VARCHAR)
private String userId;
// 标注状态:0.未标注,1.已标注
@Column(name = "tag", type = MySqlTypeConstant.INT, length = 10, defaultValue = "0")
private Integer tag;
// 入库状态:0.未入库,1.已入库
@Column(name = "flag", type = MySqlTypeConstant.INT, length = 10, defaultValue = "0")
private Integer flag;
// 标注时间
@Column(name = "update_time", type = MySqlTypeConstant.DATETIME)
private Date updateTime;
public String getUrlMd5() {
return urlMd5;
}
public void setUrlMd5(String urlMd5) {
this.urlMd5 = urlMd5;
}
public String getPreviewUrl() {
return previewUrl;
}
public void setPreviewUrl(String previewUrl) {
this.previewUrl = previewUrl;
}
/**
* @return the user_id
*/
public String getUserId() {
return userId;
}
/**
* @param userId the userId to set
*/
public void setUserId(String userId) {
this.userId = userId;
}
/**
* @return the tag
*/
public Integer getTag() {
return tag;
}
/**
* @param tag the tag to set
*/
public void setTag(Integer tag) {
this.tag = tag;
}
/**
* @return the flag
*/
public Integer getFlag() {
return flag;
}
/**
* @param flag the flag to set
*/
public void setFlag(Integer flag) {
this.flag = flag;
}
/**
* @return the updateTime
*/
public Date getUpdateTime() {
return updateTime;
}
/**
* @param updateTime the updateTime to set
*/
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
}
\ No newline at end of file
package com.mobvista.apptag.entity;
import com.gitee.sunchenbin.mybatis.actable.annotation.Column;
import com.gitee.sunchenbin.mybatis.actable.annotation.Table;
import com.gitee.sunchenbin.mybatis.actable.constants.MySqlTypeConstant;
import java.io.Serializable;
import java.util.Date;
/**
* @author wangjf
*/
@Table(name = "ec_tag_result")
public class ECTagResult implements Serializable {
private static final long serialVersionUID = 1L;
// URL MD5
@Column(name = "url_md5", type = MySqlTypeConstant.VARCHAR, isNull = false)
private String urlMd5;
@Column(name = "preview_url", type = MySqlTypeConstant.VARCHAR)
private String previewUrl;
// 标注的标签ID
@Column(name = "feat_id", type = MySqlTypeConstant.VARCHAR)
private String featId;
// 标注的中文全名
@Column(name = "comment", type = MySqlTypeConstant.VARCHAR)
private String comment;
// 是否入库
@Column(name = "flag", type = MySqlTypeConstant.INT,defaultValue = "0")
private Integer flag;
// 用户ID
@Column(name = "user_id", type = MySqlTypeConstant.VARCHAR, isNull = false)
private String userId;
// 入库时间
@Column(name = "update_time", type = MySqlTypeConstant.DATETIME, isNull = false)
private Date updateTime;
public String getUrlMd5() {
return urlMd5;
}
public void setUrlMd5(String urlMd5) {
this.urlMd5 = urlMd5;
}
public String getPreviewUrl() {
return previewUrl;
}
public void setPreviewUrl(String previewUrl) {
this.previewUrl = previewUrl;
}
/**
* @param featId the featId to set
*/
public void setFeatId(String featId) {
this.featId = featId;
}
/**
* @return the featId
*/
public String getFeatId() {
return featId;
}
/**
* @return the comment
*/
public String getComment() {
return comment;
}
/**
* @param comment the comment to set
*/
public void setComment(String comment) {
this.comment = comment;
}
/**
*
* @return the flag
*/
public Integer getFlag() {
return flag;
}
/**
*
* @param flag the flag to set
*/
public void setFlag(Integer flag) {
this.flag = flag;
}
/**
* @return the userId
*/
// @Id
public String getUserId() {
return userId;
}
/**
* @param userId the userId to set
*/
public void setUserId(String userId) {
this.userId = userId;
}
/**
* @return the updateTime
*/
public Date getUpdateTime() {
return updateTime;
}
/**
* @param updateTime the updateTime to set
*/
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
}
\ No newline at end of file
package com.mobvista.apptag.mapper;
import com.mobvista.apptag.entity.ECTagResult;
import com.mobvista.apptag.entity.TagResult;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.annotations.*;
import java.util.List;
/**
* @author wangjf
*/
public interface ECResultDao {
@Insert("REPLACE INTO ec_tag_result(url_md5,preview_url,feat_id,comment,user_id,update_time) VALUES(#{urlMd5}, #{previewUrl}, #{featId}, #{comment}, #{userId}, #{updateTime})")
boolean save(ECTagResult ecTagResult);
@Delete("DELETE FROM ec_tag_result WHERE url_md5 = #{urlMd5}")
boolean delete(String urlMd5);
@Select("SELECT * FROM ec_tag_result WHERE url_md5 = #{urlMd5} AND user_id = #{userId}")
@Results({@Result(property = "urlMd5", column = "url_md5"),
@Result(property = "previewUrl", column = "preview_url"),
@Result(property = "featId", column = "feat_id"),
@Result(property = "comments", column = "comments"),
@Result(property = "userId", column = "user_id"),
@Result(property = "updateTime", column = "update_time")})
ECTagResult find(String urlMd5, String userId);
@SelectProvider(type = MapperProvider.class, method = "list")
@Results({@Result(property = "urlMd5", column = "url_md5"),
@Result(property = "previewUrl", column = "preview_url"),
@Result(property = "featId", column = "feat_id"),
@Result(property = "comments", column = "comments"),
@Result(property = "userId", column = "user_id"),
@Result(property = "updateTime", column = "update_time")})
List<ECTagResult> list(String userId, String search);
@SelectProvider(type = MapperProvider.class, method = "count")
int count(String userId, String search);
@SelectProvider(type = MapperProvider.class, method = "listAll")
@Results({@Result(property = "urlMd5", column = "url_md5"),
@Result(property = "previewUrl", column = "preview_url"),
@Result(property = "featId", column = "feat_id"),
@Result(property = "comments", column = "comments"),
@Result(property = "userId", column = "user_id"),
@Result(property = "updateTime", column = "update_time")})
List<ECTagResult> listAll(String search);
@SelectProvider(type = MapperProvider.class, method = "countAll")
int countAll(String search);
class MapperProvider {
public String list(String userId, String search) {
String sql = "SELECT * FROM ec_tag_result WHERE user_id = #{userId} AND flag != 1";
if (StringUtils.isNotBlank(search)) {
sql += " AND LOWER(preview_url) LIKE '%" + search + "%'";
}
return sql;
}
public String count(String userId, String search) {
String sql = "SELECT COUNT(1) FROM ec_tag_result WHERE user_id = #{userId} AND flag != 1";
if (StringUtils.isNotBlank(search)) {
sql += " AND LOWER(preview_url) LIKE '%" + search + "%'";
}
return sql;
}
public String listAll(String search) {
String sql = "SELECT * FROM ec_tag_result WHERE flag != 1";
if (StringUtils.isNotBlank(search)) {
sql += " AND LOWER(preview_url) LIKE '%" + search + "%'";
}
return sql;
}
public String countAll(String search) {
String sql = "SELECT COUNT(1) FROM ec_tag_result WHERE flag != 1";
if (StringUtils.isNotBlank(search)) {
sql += " AND LOWER(preview_url) LIKE '%" + search + "%'";
}
return sql;
}
}
}
\ No newline at end of file
package com.mobvista.apptag.mapper;
import com.mobvista.apptag.entity.ECStorage;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.annotations.*;
import java.util.List;
/**
* @author wangjf
*/
public interface ECStorageDao {
@Insert("REPLACE INTO ec_storage(url_md5,preview_url,tag,update_time,user_id) VALUES(#{urlMd5}, #{previewUrl}, #{tag}, #{updateTime}, #{userId})")
boolean save(ECStorage ecStorage);
@Select("SELECT * FROM ec_storage WHERE url_md5 = #{urlMd5}")
@Results({@Result(property = "urlMd5", column = "url_md5"),
@Result(property = "previewUrl", column = "preview_url"),
@Result(property = "tag", column = "tag"),
@Result(property = "updateTime", column = "update_time")})
ECStorage find(String urlMd5);
@SelectProvider(type = MapperProvider.class, method = "list")
@Results({@Result(property = "urlMd5", column = "url_md5"),
@Result(property = "previewUrl", column = "preview_url"),
@Result(property = "tag", column = "tag"),
@Result(property = "updateTime", column = "update_time")})
List<ECStorage> list(String search);
@SelectProvider(type = MapperProvider.class, method = "count")
int count(String search);
class MapperProvider {
public String list(String search) {
String sql = "SELECT * FROM ec_storage";
if (StringUtils.isNotBlank(search)) {
sql += " WHERE LOWER(preview_url) LIKE '%" + search + "%'";
}
return sql;
}
public String count(String search) {
String sql = "SELECT COUNT(1) FROM ec_storage";
if (StringUtils.isNotBlank(search)) {
sql += " WHERE LOWER(preview_url) LIKE '%" + search + "%'";
}
return sql;
}
}
}
\ No newline at end of file
package com.mobvista.apptag.mapper;
import com.mobvista.apptag.entity.ECTag;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.annotations.*;
import java.util.List;
/**
* @author wangjf
*/
public interface ECTagDao {
@Update("UPDATE ec_tag_list SET user_id = #{userId}, tag = #{tag}, update_time = #{updateTime} WHERE preview_url = #{previewUrl}")
boolean update(ECTag tag);
@SelectProvider(type = MapperProvider.class, method = "list")
@Results({@Result(property = "urlMd5", column = "url_md5"),
@Result(property = "previewUrl", column = "preview_url"),
@Result(property = "tag", column = "tag"),
@Result(property = "flag", column = "flag"),
@Result(property = "userId", column = "user_id"),
@Result(property = "updateTime", column = "update_time")})
List<ECTag> list(String search, int tag, String userId);
@SelectProvider(type = MapperProvider.class, method = "count")
int count(String search, int tag, String userId);
class MapperProvider {
public String list(String search, int tag, String userId) {
String sql = "SELECT * FROM ec_tag_list WHERE tag < " + tag;
if (StringUtils.isNotBlank(userId)) {
sql += " AND (user_id NOT LIKE '%" + userId + "%' OR user_id IS NULL) AND flag = 0";
}
if (StringUtils.isNotBlank(search)) {
sql += " AND LOWER(preview_url) LIKE '%" + search + "%'";
}
return sql;
}
public String count(String search, int tag, String userId) {
String sql = "SELECT COUNT(1) FROM ec_tag_list WHERE tag < " + tag;
if (StringUtils.isNotBlank(userId)) {
sql += " AND (user_id NOT LIKE '%" + userId + "%' OR user_id IS NULL) AND flag = 0";
}
if (StringUtils.isNotBlank(search)) {
sql += " AND LOWER(preview_url) LIKE '%" + search + "%'";
}
return sql;
}
}
@Select("SELECT * FROM ec_tag_list WHERE tag = #{tag} ORDER BY install DESC")
@Results({@Result(property = "urlMd5", column = "url_md5"),
@Result(property = "previewUrl", column = "preview_url"),
@Result(property = "tag", column = "tag"),
@Result(property = "flag", column = "flag"),
@Result(property = "userId", column = "user_id"),
@Result(property = "updateTime", column = "update_time")})
List<ECTag> listAll(int tag);
@Select("SELECT * FROM ec_tag_list LIMIT 1")
@Results({@Result(property = "urlMd5", column = "url_md5"),
@Result(property = "previewUrl", column = "preview_url"),
@Result(property = "tag", column = "tag"),
@Result(property = "flag", column = "flag"),
@Result(property = "userId", column = "user_id"),
@Result(property = "updateTime", column = "update_time")})
ECTag one();
@Select("SELECT * FROM ec_tag_list WHERE url_md5 = #{urlMd5}")
@Results({@Result(property = "urlMd5", column = "url_md5"),
@Result(property = "previewUrl", column = "preview_url"),
@Result(property = "tag", column = "tag"),
@Result(property = "flag", column = "flag"),
@Result(property = "userId", column = "user_id"),
@Result(property = "updateTime", column = "update_time")})
ECTag find(String urlMd5);
}
\ No newline at end of file
package com.mobvista.apptag.service;
import com.mobvista.apptag.entity.ECTagResult;
import com.mobvista.apptag.entity.TagResult;
import com.mobvista.apptag.utils.Query;
import java.util.List;
/**
* @author wangjf
*/
public interface ECResultService {
boolean save(String urlMd5, String userName, String json);
ECTagResult find(String urlMd5, String userId);
List<ECTagResult> list(String userId, Query query);
int count(String userId, String search);
}
\ No newline at end of file
package com.mobvista.apptag.service;
import com.mobvista.apptag.entity.ECStorage;
import com.mobvista.apptag.utils.Query;
import java.util.List;
/**
* @author wangjf
*/
public interface ECStorageService {
boolean update(String urlMd5, String userName, String json);
ECStorage find(String urlMd5);
List<ECStorage> list(Query query);
int count(String search);
}
\ No newline at end of file
package com.mobvista.apptag.service;
import com.mobvista.apptag.entity.ECTag;
import com.mobvista.apptag.entity.Tag;
import com.mobvista.apptag.utils.Query;
import java.util.List;
/**
* @author wangjf
*/
public interface ECTagService {
boolean update(String urlMd5, String userName);
ECTag find(String urlMd5);
List<ECTag> list(String userId, Query query);
int count(String userId, Query query);
}
\ No newline at end of file
package com.mobvista.apptag.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.mobvista.apptag.entity.ECTag;
import com.mobvista.apptag.entity.ECTagResult;
import com.mobvista.apptag.entity.User;
import com.mobvista.apptag.mapper.ECResultDao;
import com.mobvista.apptag.mapper.ECTagDao;
import com.mobvista.apptag.mapper.UserDao;
import com.mobvista.apptag.service.ECResultService;
import com.mobvista.apptag.utils.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* @author wangjf
*/
@Service("ecResultService")
public class ECResultServiceImpl implements ECResultService {
@Autowired
private UserDao userDao;
@Autowired
private ECTagDao ecTagDao;
@Autowired
private ECResultDao ecResultDao;
@Override
public boolean save(String urlMd5, String userName, String json) {
ECTag tag = ecTagDao.find(urlMd5);
User user = userDao.find(userName);
ECTagResult tagResult = new ECTagResult();
tagResult.setPreviewUrl(tag.getPreviewUrl());
tagResult.setUrlMd5(urlMd5);
tagResult.setFeatId(json);
tagResult.setComment("comment");
tagResult.setUserId(user.getUserId());
tagResult.setUpdateTime(new Date());
if (user.getRole() == 1) {
ecResultDao.delete(urlMd5);
}
return this.ecResultDao.save(tagResult);
}
@Override
public ECTagResult find(String urlMd5, String userId) {
return ecResultDao.find(urlMd5, userId);
}
@Override
public List<ECTagResult> list(String userId, Query query) {
User user = userDao.find(userId);
List<ECTagResult> results;
PageHelper.startPage(query.getOffset() / query.getLimit() + 1, query.getLimit());
if (user.getRole() == 0) {
results = ecResultDao.list(userId, query.getSearch().toLowerCase());
} else {
results = ecResultDao.listAll(query.getSearch().toLowerCase());
}
List<ECTagResult> results2 = new ArrayList<>();
for (ECTagResult result : results) {
JSONObject jsonObject = JSONObject.parseObject(result.getFeatId());
result.setFeatId(jsonObject.values().toString());
results2.add(result);
}
return results2;
}
@Override
public int count(String userId, String search) {
User user = userDao.find(userId);
if (user.getRole() == 0) {
return ecResultDao.count(userId, search);
} else {
return ecResultDao.countAll(search);
}
}
}
\ No newline at end of file
package com.mobvista.apptag.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.mobvista.apptag.entity.ECStorage;
import com.mobvista.apptag.entity.ECTag;
import com.mobvista.apptag.entity.User;
import com.mobvista.apptag.mapper.ECStorageDao;
import com.mobvista.apptag.mapper.ECTagDao;
import com.mobvista.apptag.mapper.UserDao;
import com.mobvista.apptag.service.ECStorageService;
import com.mobvista.apptag.utils.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* @package: com.mobvista.apptag.service.impl
* @author: wangjf
* @date: 2019-08-13
* @time: 11:05
* @email: jinfeng.wang@mobvista.com
* @phone: 152-1062-7698
*/
@Service("ecStorageService")
public class ECStorageServiceImpl implements ECStorageService {
@Autowired
private UserDao userDao;
@Autowired
private ECTagDao ecTagDao;
@Autowired
private ECStorageDao ecStorageDao;
@Override
public boolean update(String urlMd5, String userName, String json) {
ECTag tag = ecTagDao.find(urlMd5);
User user = userDao.find(userName);
ECStorage storage = new ECStorage();
storage.setUrlMd5(urlMd5);
storage.setPreviewUrl(tag.getPreviewUrl());
storage.setTag(json);
storage.setUpdateTime(new Date());
storage.setUserId(user.getUserId());
return this.ecStorageDao.save(storage);
}
@Override
public ECStorage find(String urlMd5) {
return ecStorageDao.find(urlMd5);
}
@Override
public List<ECStorage> list(Query query) {
List<ECStorage> results;
PageHelper.startPage(query.getOffset() / query.getLimit() + 1, query.getLimit());
results = ecStorageDao.list(query.getSearch().toLowerCase());
List<ECStorage> results2 = new ArrayList<>();
for (ECStorage result : results) {
JSONObject jsonObject = JSONObject.parseObject(result.getTag());
result.setTag(jsonObject.values().toString());
results2.add(result);
}
return results2;
}
@Override
public int count(String search) {
return ecStorageDao.count(search);
}
}
package com.mobvista.apptag.service.impl;
import com.github.pagehelper.PageHelper;
import com.mobvista.apptag.entity.ECTag;
import com.mobvista.apptag.entity.User;
import com.mobvista.apptag.mapper.ECTagDao;
import com.mobvista.apptag.mapper.UserDao;
import com.mobvista.apptag.service.ECTagService;
import com.mobvista.apptag.utils.Query;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
@Service("ecTagService")
public class ECTagServiceImpl implements ECTagService {
@Autowired
private ECTagDao ecTagDao;
@Autowired
private UserDao userDao;
@Override
public boolean update(String urlMd5, String userName) {
ECTag tag = ecTagDao.find(urlMd5);
tag.setUpdateTime(new Date());
User user = userDao.find(userName);
if (StringUtils.isNotBlank(tag.getUserId())) {
String[] userIds = tag.getUserId().split(",");
Set set = new HashSet<>(Arrays.asList(userIds));
if (!set.contains(user.getUserId())) {
tag.setTag(tag.getTag() + 1);
tag.setUserId(tag.getUserId() + "," + user.getUserId());
user.setCount(user.getCount() + 1);
}
} else {
tag.setTag(1);
tag.setUserId(user.getUserId());
user.setCount(user.getCount() + 1);
}
this.userDao.update(user);
return this.ecTagDao.update(tag);
}
@Override
public ECTag find(String urlMd5) {
return ecTagDao.find(urlMd5);
}
@Override
public List<ECTag> list(String userId, Query query) {
User user = userDao.find(userId);
List<ECTag> results;
PageHelper.startPage(query.getOffset() / query.getLimit() + 1, query.getLimit());
results = ecTagDao.list(query.getSearch().toLowerCase(), 3, user.getUserId());
return results;
}
@Override
public int count(String userId, Query query) {
User user = userDao.find(userId);
return ecTagDao.count(query.getSearch().toLowerCase(), 3, user.getUserId());
}
}
\ No newline at end of file
package com.mobvista.apptag.utils;
import java.sql.*;
/**
* @package: com.mobvista.apptag.utils
* @author: wangjf
* @date: 2019-09-04
* @time: 16:19
* @email: jinfeng.wang@mobvista.com
* @phone: 152-1062-7698
*/
public class GetPreviewUrl {
void get() throws SQLException {
Connection connection = DriverManager.getConnection(
"jdbc:mysql://adn-data-foronlinetest.c5yzcdreb1xr.us-east-1.rds.amazonaws.com:3306/mob_adn?useUnicode=true&characterEncoding=utf8&useSSL=false", "adnro", "YcM123glh");
String querySql = "select md5(preview_url) url_md5,b.preview_url preview_url from campaign_list_cpi a join campaign_list b on a.campaign_id = b.id where is_ec_adv = 1 group by b.preview_url";
PreparedStatement preparedStatement = null;
try {
preparedStatement = connection.prepareStatement(querySql);
ResultSet resultSet = preparedStatement.executeQuery();
insert(resultSet);
} catch (SQLException e) {
e.printStackTrace();
} finally {
if (connection != null) {
connection.close();
}
if (preparedStatement != null) {
preparedStatement.close();
}
}
}
void insert(ResultSet resultSet) throws SQLException {
Connection con = DriverManager.getConnection(
"jdbc:mysql://dataplatform-app-tag.c5yzcdreb1xr.us-east-1.rds.amazonaws.com:3306/app_tag?useUnicode=true&characterEncoding=utf8&useSSL=false", "apptag_rw", "7gyLEVtkER3u8c9");
String insertSql = "INSERT INTO ec_tag_list(url_md5, preview_url) VALUES @VALUES ON DUPLICATE KEY UPDATE tag = tag";
StringBuilder stringBuilder = new StringBuilder();
while (resultSet.next()) {
String urlMd5 = resultSet.getString("url_md5");
String previewUrl = resultSet.getString("preview_url");
stringBuilder.append("('").append(urlMd5).append("','").append(previewUrl).append("'),");
}
PreparedStatement stmt = con.prepareStatement(insertSql.replace("@VALUES", stringBuilder.substring(0, stringBuilder.length() - 1)));
stmt.execute();
con.close();
}
public static void main(String[] args) throws ClassNotFoundException, SQLException {
Class.forName("com.mysql.jdbc.Driver");
GetPreviewUrl getPreviewUrl = new GetPreviewUrl();
getPreviewUrl.get();
}
}
...@@ -3,7 +3,7 @@ logging.level.root=INFO ...@@ -3,7 +3,7 @@ logging.level.root=INFO
logging.path=applog logging.path=applog
mybatis.table.auto=none mybatis.table.auto=update
mybatis.model.pack=com.mobvista.apptag.entity mybatis.model.pack=com.mobvista.apptag.entity
......
// 以下为官方示例
// 以下为官方示例
$().ready(function () {
validateRule();
var data = document.getElementById("firstECTag").value;
var secondData = document.getElementById("secondECTag").value;
var resultData = document.getElementById("resultECTag").value;
refreshMultiSelect(JSON.parse(data), JSON.parse(secondData), JSON.parse(resultData));
});
$.validator.setDefaults({
submitHandler: function () {
update();
}
});
function update() {
$.ajax({
cache: true,
type: "POST",
url: "/ec_result/save",
data: $('#signupForm').serialize(), // 你的formid
async: false,
error: function (request) {
alert("Connection error");
},
success: function (data) {
if (data.code == 0) {
parent.layer.msg(data.msg);
parent.reLoad();
var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引
parent.layer.close(index);
} else {
parent.layer.msg(data.msg);
}
}
});
}
function validateRule() {
var icon = "<i class='fa fa-times-circle'></i> ";
$("#signupForm").validate({
rules: {
previewUrl: {
required: false
}
}
})
}
function refreshMultiSelect(json, secondJson, resultData) {
// $('#categoryCode').html("");
var data = ""
for (var i = 0; i < json.length; i++) {
data += "<optgroup label='" + json[i].firstTag + "'>";
for (var j = 0; j < secondJson.length; j++) {
if (json[i].firstId == secondJson[j].firstId) {
if (secondJson[j].secondId in resultData) {
data += "<option value=\"" + secondJson[j].secondId + "\" selected=\"true\">" + secondJson[j].secondTag + "</option>";
} else {
data += "<option value=\"" + secondJson[j].secondId + "\">" + secondJson[j].secondTag + "</option>";
}
}
}
data += "</optgroup>";
}
console.log(data);
$('#ecCode').append(data);
$('#ecCode').multiselect("destroy").multiselect({
nonSelectedText: '请选择标签!',
maxHeight: 350,
enableCollapsibleOptGroups: true,
enableFiltering: true,
numberDisplayed: 3
});
}
function refreshSelect(name, json, resultData) {
var data = ""
for (var j = 0; j < json.length; j++) {
if (json[j].firstId in resultData) {
data += "<option value=\"" + json[j].firstId + "\" selected=\"true\">" + json[j].firstTag + "</option>";
} else {
data += "<option value=\"" + json[j].firstId + "\">" + json[j].firstTag + "</option>";
}
}
console.log(data);
$('#' + name + 'Code').append(data);
$('#' + name + 'Code').multiselect("destroy").multiselect({
nonSelectedText: '请选择标签!',
maxHeight: 350,
enableCollapsibleOptGroups: true,
enableFiltering: true,
numberDisplayed: 3
});
}
/*
var openDept = function () {
layer.open({
type: 2,
title: "选择部门",
area: ['300px', '450px'],
content: "/system/sysDept/treeView"
})
}
function loadDept(deptId, deptName) {
$("#deptId").val(deptId);
$("#deptName").val(deptName);
}
*/
\ No newline at end of file
var prefix = "ec_result";
$(function () {
load();
});
function load() {
$("#exampleTable").bootstrapTable({
method: "post", // 服务器数据的请求方式 get or post
url: prefix + "/list", // 服务器数据的加载地址
striped: true, // 设置为true会有隔行变色效果
dataType: "json", // 服务器返回的数据类型
pagination: true, // 设置为true会在底部显示分页条
// queryParamsType : "limit",
// //设置为limit则会发送符合RESTFull格式的参数
singleSelect: false, // 设置为true将禁止多选
iconSize: "outline",
toolbar: "#exampleToolbar",
// contentType : "application/x-www-form-urlencoded",
// //发送到服务器的数据编码类型
pageSize: 10, // 如果设置了分页,每页数据条数
pageNumber: 1, // 如果设置了分布,首页页码
// search: true, // 是否显示搜索框
showColumns: true, // 是否显示内容下拉框(选择显示的列)
sidePagination: "server", // 设置在哪里进行分页,可选值为"client" 或者 "server"
// queryParams : queryParams,
queryParams: function (params) {
return {
// 说明:传入后台的参数包括offset开始索引,limit步长,sort排序列,order:desc或者,以及所有列的键值对
limit: params.limit,
offset: params.offset,
search: $('#searchName').val()
};
},
// //请求服务器数据时,你可以通过重写参数的方式添加一些额外的参数,例如 toolbar 中的参数 如果
// queryParamsType = 'limit' ,返回参数必须包含
// limit, offset, search, sort, order 否则, 需要包含:
// pageSize, pageNumber, searchText, sortName,
// sortOrder.
// 返回false将会终止请求
columns: [{
// 列配置项
// 数据类型,详细参数配置参见文档http://bootstrap-table.wenzhixin.net.cn/zh-cn/documentation/
checkbox: true
// 列表中显示复选框
},
{
field: "previewUrl", // 列字段名
title: "URL", // 列标题
align: "center"
},
{
field:"featId",
title:"已标标签",
align:"center"
},
{
title: "操作",
field: "previewUrl",
align: "center",
formatter: function (value, row, index) {
var e =
'<a class="btn btn-primary btn-sm ' +
s_edit_h +
'" href="#" mce_href="#" title="编辑" onclick="edit(\'' +
row.urlMd5 +
'\')"><i class="fa fa-edit"></i></a> ';
return e;
}
}
]
});
}
function reLoad(type) {
if (type == 1) {
var opt = {
query: {
offset: 0
}
};
$("#exampleTable").bootstrapTable("refresh", opt);
} else {
$("#exampleTable").bootstrapTable("refresh");
}
}
function edit(urlMd5, user_id) {
layer.open({
type: 2,
title: "电商标签标注",
maxmin: true,
shadeClose: true, // 点击遮罩关闭层
area: ["800px", "580px"],
content: prefix + "/edit?urlMd5=" + urlMd5 + "&userId=" + user_id // iframe的url
});
}
\ No newline at end of file
// 以下为官方示例
// 以下为官方示例
$().ready(function () {
validateRule();
var data = document.getElementById("firstECTag").value;
var secondData = document.getElementById("secondECTag").value;
var resultData = document.getElementById("resultECTag").value;
refreshMultiSelect(JSON.parse(data), JSON.parse(secondData), JSON.parse(resultData));
});
$.validator.setDefaults({
submitHandler: function () {
update();
}
});
function update() {
$.ajax({
cache: true,
type: "POST",
url: "/ec_storage/save",
data: $('#signupForm').serialize(), // 你的formid
async: false,
error: function (request) {
alert("Connection error");
},
success: function (data) {
if (data.code == 0) {
parent.layer.msg(data.msg);
parent.reLoad();
var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引
parent.layer.close(index);
} else {
parent.layer.msg(data.msg);
}
}
});
}
function validateRule() {
var icon = "<i class='fa fa-times-circle'></i> ";
$("#signupForm").validate({
rules: {
previewUrl: {
required: false
}
}
})
}
function refreshMultiSelect(json, secondJson, resultData) {
// $('#categoryCode').html("");
var data = ""
for (var i = 0; i < json.length; i++) {
data += "<optgroup label='" + json[i].firstTag + "'>";
for (var j = 0; j < secondJson.length; j++) {
if (json[i].firstId == secondJson[j].firstId) {
if (secondJson[j].secondId in resultData) {
data += "<option value=\"" + secondJson[j].secondId + "\" selected=\"true\">" + secondJson[j].secondTag + "</option>";
} else {
data += "<option value=\"" + secondJson[j].secondId + "\">" + secondJson[j].secondTag + "</option>";
}
}
}
data += "</optgroup>";
}
console.log(data);
$('#ecCode').append(data);
$('#ecCode').multiselect("destroy").multiselect({
nonSelectedText: '请选择标签!',
maxHeight: 350,
enableCollapsibleOptGroups: true,
enableFiltering: true,
numberDisplayed: 3
});
}
function refreshSelect(name, json, resultData) {
var data = ""
for (var j = 0; j < json.length; j++) {
if (json[j].firstId in resultData) {
data += "<option value=\"" + json[j].firstId + "\" selected=\"true\">" + json[j].firstTag + "</option>";
} else {
data += "<option value=\"" + json[j].firstId + "\">" + json[j].firstTag + "</option>";
}
}
console.log(data);
$('#' + name + 'Code').append(data);
$('#' + name + 'Code').multiselect("destroy").multiselect({
nonSelectedText: '请选择标签!',
maxHeight: 350,
enableCollapsibleOptGroups: true,
enableFiltering: true,
numberDisplayed: 3
});
}
/*
var openDept = function () {
layer.open({
type: 2,
title: "选择部门",
area: ['300px', '450px'],
content: "/system/sysDept/treeView"
})
}
function loadDept(deptId, deptName) {
$("#deptId").val(deptId);
$("#deptName").val(deptName);
}
*/
\ No newline at end of file
var prefix = "ec_storage";
$(function () {
load();
});
function load() {
var role = $("input[id='role']").attr("value");
console.log(role);
$("#exampleTable").bootstrapTable({
method: "post", // 服务器数据的请求方式 get or post
url: prefix + "/list", // 服务器数据的加载地址
striped: true, // 设置为true会有隔行变色效果
dataType: "json", // 服务器返回的数据类型
pagination: true, // 设置为true会在底部显示分页条
// queryParamsType : "limit",
// 设置为limit则会发送符合RESTFull格式的参数
singleSelect: false, // 设置为true将禁止多选
iconSize: "outline",
toolbar: "#exampleToolbar",
// contentType : "application/x-www-form-urlencoded",
// //发送到服务器的数据编码类型
pageSize: 10, // 如果设置了分页,每页数据条数
pageNumber: 1, // 如果设置了分布,首页页码
// search: true, // 是否显示搜索框
showColumns: true, // 是否显示内容下拉框(选择显示的列)
sidePagination: "server", // 设置在哪里进行分页,可选值为"client" 或者 "server"
// queryParams : queryParams,
queryParams: function (params) {
return {
// 说明:传入后台的参数包括offset开始索引,limit步长,sort排序列,order:desc或者,以及所有列的键值对
limit: params.limit,
offset: params.offset,
search: $('#searchName').val()
};
},
// role: document.getElementById('role').valueOf(),
// //请求服务器数据时,你可以通过重写参数的方式添加一些额外的参数,例如 toolbar 中的参数 如果
// queryParamsType = 'limit' ,返回参数必须包含
// limit, offset, search, sort, order 否则, 需要包含:
// pageSize, pageNumber, searchText, sortName,
// sortOrder.
// 返回false将会终止请求
columns: [{
// 列配置项
// 数据类型,详细参数配置参见文档http://bootstrap-table.wenzhixin.net.cn/zh-cn/documentation/
checkbox: true
// 列表中显示复选框
},
{
field: "previewUrl", // 列字段名
title: "URL", // 列标题
align: "center"
},
{
field:"tag",
title:"已标标签",
align:"center"
},
{
title: "操作",
field: "previewUrl",
align: "center",
formatter: function (value, row, index) {
var e =
'<a class="btn btn-primary btn-sm ' +
s_edit_h +
'" href="#" mce_href="#" title="编辑" onclick="edit(\'' +
row.urlMd5 +
'\')"><i class="fa fa-edit"></i></a> ';
return e;
}
}
]
});
}
function reLoad(type) {
if (type == 1) {
var opt = {
query: {
offset: 0
}
};
$("#exampleTable").bootstrapTable("refresh", opt);
} else {
$("#exampleTable").bootstrapTable("refresh");
}
}
function edit(urlMd5) {
layer.open({
type: 2,
title: "标签标注",
maxmin: true,
shadeClose: true, // 点击遮罩关闭层
area: ["800px", "580px"],
content: prefix + "/edit?urlMd5=" + urlMd5 // iframe的url
});
}
\ No newline at end of file
// 以下为官方示例
// 以下为官方示例
$().ready(function () {
validateRule();
var data = document.getElementById("firstECTag").value;
var secondData = document.getElementById("secondECTag").value;
// $("#signupForm").validate()
refreshMultiSelect(JSON.parse(data), JSON.parse(secondData));
});
$.validator.setDefaults({
submitHandler: function () {
update();
}
});
function update() {
$.ajax({
cache: true,
type: "POST",
url: "/ec_tag/save",
data: $('#signupForm').serialize(), // 你的formid
async: false,
error: function (request) {
alert("Connection error");
},
success: function (data) {
if (data.code == 0) {
parent.layer.msg(data.msg);
parent.reLoad();
var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引
parent.layer.close(index);
} else {
parent.layer.msg(data.msg);
}
}
});
}
function validateRule() {
var icon = "<i class='fa fa-times-circle'></i> ";
$("#signupForm").validate({
rules: {
previewUrl: {
required: false
}
}
})
}
function refreshMultiSelect(json, secondJson) {
var data = ""
for (var i = 0; i < json.length; i++) {
data += "<optgroup label='" + json[i].firstTag + "'>";
for (var j = 0; j < secondJson.length; j++) {
if (json[i].firstId == secondJson[j].firstId) {
data += "<option value=\"" + secondJson[j].secondId + "\">" + secondJson[j].secondTag + "</option>";
}
}
data += "</optgroup>";
}
console.log(data);
$('#ecCode').append(data);
$('#ecCode').multiselect("destroy").multiselect({
nonSelectedText: '请选择标签!',
maxHeight: 350,
enableCollapsibleOptGroups: true,
enableFiltering: true,
numberDisplayed: 3
});
}
/*
var openDept = function () {
layer.open({
type: 2,
title: "选择部门",
area: ['300px', '450px'],
content: "/system/sysDept/treeView"
})
}
function loadDept(deptId, deptName) {
$("#deptId").val(deptId);
$("#deptName").val(deptName);
}
*/
\ No newline at end of file
var prefix = "ec_tag";
$(function () {
load();
});
function load() {
$("#exampleTable").bootstrapTable({
method: "post", // 服务器数据的请求方式 get or post
url: prefix + "/list", // 服务器数据的加载地址
striped: true, // 设置为true会有隔行变色效果
dataType: "json", // 服务器返回的数据类型
pagination: true, // 设置为true会在底部显示分页条
// queryParamsType : "limit",
// //设置为limit则会发送符合RESTFull格式的参数
singleSelect: false, // 设置为true将禁止多选
iconSize: "outline",
toolbar: "#exampleToolbar",
// contentType : "application/x-www-form-urlencoded",
// //发送到服务器的数据编码类型
pageSize: 10, // 如果设置了分页,每页数据条数
pageNumber: 1, // 如果设置了分布,首页页码
// search: true, // 是否显示搜索框
showColumns: true, // 是否显示内容下拉框(选择显示的列)
sidePagination: "server", // 设置在哪里进行分页,可选值为"client" 或者 "server"
// queryParams : queryParams,
queryParams: function (params) {
return {
// 说明:传入后台的参数包括offset开始索引,limit步长,sort排序列,order:desc或者,以及所有列的键值对
limit: params.limit,
offset: params.offset,
search: $('#searchName').val()
};
},
// //请求服务器数据时,你可以通过重写参数的方式添加一些额外的参数,例如 toolbar 中的参数 如果
// queryParamsType = 'limit' ,返回参数必须包含
// limit, offset, search, sort, order 否则, 需要包含:
// pageSize, pageNumber, searchText, sortName,
// sortOrder.
// 返回false将会终止请求
columns: [{
// 列配置项
// 数据类型,详细参数配置参见文档http://bootstrap-table.wenzhixin.net.cn/zh-cn/documentation/
checkbox: true
// 列表中显示复选框
},
{
field: "previewUrl", // 列字段名
title: "URL", // 列标题
align: "center"
},
{
title: "操作",
field: "previewUrl",
align: "center",
formatter: function (value, row, index) {
var e =
'<a class="btn btn-primary btn-sm ' +
s_edit_h +
'" href="#" mce_href="#" title="编辑" onclick="edit(\'' +
row.urlMd5 +
'\')"><i class="fa fa-edit"></i></a> ';
return e;
}
}
]
});
}
function reLoad(type) {
if (type == 1) {
var opt = {
query: {
offset: 0
}
};
$("#exampleTable").bootstrapTable("refresh", opt);
} else {
$("#exampleTable").bootstrapTable("refresh");
}
}
function edit(urlMd5) {
layer.open({
type: 2,
title: "电商标签标注",
maxmin: true,
shadeClose: false, // 点击遮罩关闭层
area: ["800px", "580px"],
content: prefix + "/edit?urlMd5=" + urlMd5 // iframe的url
});
}
\ No newline at end of file
<!DOCTYPE html>
<html xmlns:th="http://www.w3.org/1999/xhtml">
<meta charset="utf-8">
<head th:include="include :: header">
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
<div class="row">
<div class="col-sm-12">
<div class="ibox-content">
<input id="firstECTag" name="firstECTag" type="hidden"
th:value="${firstECTag}"/>
<input id="secondECTag" name="secondECTag" type="hidden"
th:value="${secondECTag}"/>
<input id="resultECTag" name="resultECTag" type="hidden"
th:value="${resultECTag}"/>
<form class="form-horizontal m-t" id="signupForm">
<div class="form-group">
<label class="col-sm-3 control-label">previewUrl:</label>
<div class="col-sm-8">
<a id="previewUrl" name="previewUrl" th:href="${ecTag.previewUrl}" target="_blank">
<span th:text="${ecTag.previewUrl}"></span>
</a>
<input id="urlMd5" name="urlMd5" type="hidden"
th:value="${ecTag.urlMd5}"/>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">电商标签:</label>
<div class="col-sm-8">
<select id="ecCode" name="ecCode" multiple="multiple">
</select>
</div>
</div>
<div class="form-group">
<div class="col-sm-8 col-sm-offset-3">
<button type="submit" class="btn btn-primary">提交</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<div th:include="include::footer"></div>
<script type="text/javascript">
$('#ecCode').multiselect({
nonSelectedText: '请选择标签!'
});
</script>
<script type="text/javascript" src="/js/appjs/ec_result/edit.js">
</script>
</body>
</html>
<!DOCTYPE html>
<html lang="zh_CN" xmlns:th="http://www.thymeleaf.org"
xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
<div class="wrapper wrapper-content ">
<div class="col-sm-12">
<div class="ibox">
<div class="ibox-body">
<div class="fixed-table-toolbar">
<div class="columns pull-right">
<button class="btn btn-success" onclick="reLoad(1)">查询</button>
</div>
<div class="columns pull-right col-md-2 nopadding">
<input id="searchName" type="text" class="form-control"
placeholder="preview_url">
</div>
</div>
<table id="exampleTable" data-mobile-responsive="true">
</table>
</div>
</div>
</div>
<div>
<script type="text/javascript">
var s_edit_h = 'hidden';
</script>
</div>
<div shiro:hasPermission="sys:user:edit">
<script type="text/javascript">
s_edit_h = '';
</script>
</div>
</div>
<div th:include="include :: footer"></div>
<script type="text/javascript" src="/js/appjs/ec_result/list.js"></script>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html xmlns:th="http://www.w3.org/1999/xhtml">
<meta charset="utf-8">
<head th:include="include :: header">
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
<div class="row">
<div class="col-sm-12">
<div class="ibox-content">
<input id="firstECTag" name="firstECTag" type="hidden"
th:value="${firstECTag}"/>
<input id="secondECTag" name="secondECTag" type="hidden"
th:value="${secondECTag}"/>
<input id="resultECTag" name="resultECTag" type="hidden"
th:value="${resultECTag}"/>
<form class="form-horizontal m-t" id="signupForm">
<div class="form-group">
<label class="col-sm-3 control-label">previewUrl:</label>
<div class="col-sm-8">
<a id="previewUrl" name="previewUrl" th:href="${ecTag.previewUrl}" target="_blank">
<span th:text="${ecTag.previewUrl}"></span>
</a>
<input id="urlMd5" name="urlMd5" type="hidden"
th:value="${ecTag.urlMd5}"/>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">电商标签:</label>
<div class="col-sm-8">
<select id="ecCode" name="ecCode" multiple="multiple">
</select>
</div>
</div>
<div class="form-group">
<div class="col-sm-8 col-sm-offset-3">
<button type="submit" class="btn btn-primary">提交</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<div th:include="include::footer"></div>
<script type="text/javascript">
$('#ecCode').multiselect({
nonSelectedText: '请选择标签!'
});
</script>
<script type="text/javascript" src="/js/appjs/ec_storage/edit.js">
</script>
</body>
</html>
<!DOCTYPE html>
<html lang="zh_CN" xmlns:th="http://www.thymeleaf.org"
xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
<div class="wrapper wrapper-content ">
<!--/*@thymesVar id="userRole" type="userRole"*/-->
<input id="role" name="role" type="hidden"
th:value="${userRole}"/>
<div class="col-sm-12">
<div class="ibox">
<div class="ibox-body">
<div class="fixed-table-toolbar">
<div class="columns pull-right">
<button class="btn btn-success" onclick="reLoad(1)">查询</button>
</div>
<div class="columns pull-right col-md-2 nopadding">
<input id="searchName" type="text" class="form-control"
placeholder="previewUrl">
</div>
</div>
<table id="exampleTable" data-mobile-responsive="true">
</table>
</div>
</div>
</div>
<div>
<script type="text/javascript">
var s_edit_h = 'hidden';
</script>
</div>
<div shiro:hasPermission="user:role">
<script type="text/javascript">
s_edit_h = '';
</script>
</div>
</div>
<div th:include="include :: footer"></div>
<script type="text/javascript" src="/js/appjs/ec_storage/list.js"></script>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html xmlns:th="http://www.w3.org/1999/xhtml">
<meta charset="utf-8">
<head th:include="include :: header">
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
<div class="row">
<div class="col-sm-12">
<div class="ibox-content">
<input id="firstECTag" name="firstECTag" type="hidden"
th:value="${firstECTag}"/>
<input id="secondECTag" name="secondECTag" type="hidden"
th:value="${secondECTag}"/>
<form class="form-horizontal m-t" id="signupForm">
<div class="form-group">
<label class="col-sm-3 control-label">previewUrl:</label>
<div class="col-sm-8">
<a id="previewUrl" name="previewUrl" th:href="${ecTag.previewUrl}" target="_blank">
<span th:text="${ecTag.previewUrl}"></span>
</a>
<input id="urlMd5" name="urlMd5" type="hidden"
th:value="${ecTag.urlMd5}"/>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">电商标签:</label>
<div class="col-sm-8">
<select id="ecCode" name="ecCode" multiple="multiple">
</select>
</div>
</div>
<div class="form-group">
<div class="col-sm-8 col-sm-offset-3">
<button type="submit" class="btn btn-primary">提交</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<div th:include="include::footer"></div>
<script type="text/javascript">
$('#ecCode').multiselect({
nonSelectedText: '请选择标签!'
});
</script>
<script type="text/javascript" src="/js/appjs/ec_tag/edit.js">
</script>
</body>
</html>
<!DOCTYPE html>
<html lang="zh_CN" xmlns:th="http://www.thymeleaf.org"
xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
<div class="wrapper wrapper-content ">
<div class="col-sm-12">
<div class="ibox">
<div class="ibox-body">
<div class="fixed-table-toolbar">
<div class="columns pull-right">
<button class="btn btn-success" onclick="reLoad(1)">查询</button>
</div>
<div class="columns pull-right col-md-2 nopadding">
<input id="searchName" type="text" class="form-control"
placeholder="preview_url">
</div>
</div>
<table id="exampleTable" data-mobile-responsive="true">
</table>
</div>
</div>
</div>
<div>
<script type="text/javascript">
var s_edit_h = 'hidden';
</script>
</div>
<div shiro:hasPermission="sys:user:edit">
<script type="text/javascript">
s_edit_h = '';
</script>
</div>
</div>
<div th:include="include :: footer"></div>
<script type="text/javascript" src="/js/appjs/ec_tag/list.js"></script>
</body>
</html>
\ No newline at end of file
...@@ -72,12 +72,28 @@ ...@@ -72,12 +72,28 @@
data-index="3" th:href="@{/tag}">未标注 App 列表</a></li> data-index="3" th:href="@{/tag}">未标注 App 列表</a></li>
</ul> </ul>
</li> </li>
<li><a href="#"> <i class="fa fa-home"></i> <span
class="nav-label">电商标签管理</span> <span class="fa arrow"></span>
</a>
<ul class="nav nav-second-level">
<li><a class="J_menuItem" href="index.html"
data-index="4" th:href="@{/ec_storage}">已入库 URL 列表</a></li>
</ul>
<ul class="nav nav-second-level">
<li><a class="J_menuItem" href="index.html"
data-index="5" th:href="@{/ec_result}">未入库 URL 列表</a></li>
</ul>
<ul class="nav nav-second-level">
<li><a class="J_menuItem" href="index.html"
data-index="6" th:href="@{/ec_tag}">未标注 URL 列表</a></li>
</ul>
</li>
<li id="admin"><a href="#"> <i class="fa fa-home"></i> <span <li id="admin"><a href="#"> <i class="fa fa-home"></i> <span
class="nav-label">用户管理</span> <span class="fa arrow"></span> class="nav-label">用户管理</span> <span class="fa arrow"></span>
</a> </a>
<ul class="nav nav-second-level"> <ul class="nav nav-second-level">
<li><a class="J_menuItem" href="index.html" <li><a class="J_menuItem" href="index.html"
data-index="4" th:href="@{/user}">用户列表</a></li> data-index="7" th:href="@{/user}">用户列表</a></li>
</ul> </ul>
</li> </li>
<!-- <!--
......
...@@ -6,8 +6,12 @@ public class MD5Test { ...@@ -6,8 +6,12 @@ public class MD5Test {
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
String password = "123456"; String password = "123456";
String str = "PIXEL'S UNKNOWN BATTLE GROUND,언노운 픽셀 배틀건즈,未知的像素槍戰,未知的像素枪战";
System.out.println(MD5Util.getMD5Str(password)); String device = "'91c70541-1d09-4ee9-8b4d-59e24d626c33','e1ef6f8a-7ea6-4d64-9e55-1cb4ef3eed2b','8e21395e-600a-4e49-9211-b96a78c8f3bc'";
// System.out.println(str.replaceAll("\'","\\'"));
System.out.println(device.toUpperCase());
// System.out.println(MD5Util.getMD5Str(password));
/* /*
Date date = new Date(); Date date = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
......
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