Commit a6dfa8bb by jinfeng.wang

update 入库逻辑

parent 14d29c6e
......@@ -6,9 +6,11 @@ import com.mobvista.apptag.config.WebSecurityConfig;
import com.mobvista.apptag.entity.Feat;
import com.mobvista.apptag.entity.Tag;
import com.mobvista.apptag.entity.TagResult;
import com.mobvista.apptag.entity.User;
import com.mobvista.apptag.mapper.FeatDao;
import com.mobvista.apptag.mapper.ResultDao;
import com.mobvista.apptag.mapper.TagDao;
import com.mobvista.apptag.mapper.UserDao;
import com.mobvista.apptag.service.FeatService;
import com.mobvista.apptag.service.ResultService;
import com.mobvista.apptag.utils.PageUtil;
......@@ -39,8 +41,8 @@ public class ResultController {
private ResultService resultService;
@Autowired
private ResultDao resultDao;
// @Autowired
// private UserDao userDao;
@Autowired
private UserDao userDao;
@Autowired
private TagDao tagDao;
@Autowired
......@@ -51,7 +53,9 @@ public class ResultController {
public static final Logger logger = LoggerFactory.getLogger(ResultController.class);
@GetMapping("/edit")
String edit(@RequestParam(name = "packageName") String packageName, Model model) {
String edit(@SessionAttribute(WebSecurityConfig.SESSION_KEY) String userName,
@RequestParam(name = "packageName") String packageName, Model model) {
User user = userDao.find(userName);
Tag tag = tagDao.find(packageName);
if (StringUtils.isNotBlank(tag.getUrl()) && tag.getUrl().length() > 2 && tag.getUrl().startsWith("[") && tag.getUrl().endsWith("]")) {
String url = tag.getUrl().substring(2, tag.getUrl().length() - 2).replace("\"", "").split(",")[0];
......@@ -60,7 +64,8 @@ public class ResultController {
tag.setUrl("");
}
model.addAttribute("tag", tag);
TagResult result = resultDao.find(packageName);
TagResult result = resultDao.find(packageName, user.getUserId());
model.addAttribute("resultCategory", JSONObject.fromObject(result.getFeatId()));
List<Feat> categoryFeat = featDao.firstList("01");
JSONArray jsonArray = JSONArray.fromObject(categoryFeat);
......
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.Feat;
import com.mobvista.apptag.entity.Storage;
import com.mobvista.apptag.entity.Tag;
import com.mobvista.apptag.entity.User;
import com.mobvista.apptag.mapper.FeatDao;
import com.mobvista.apptag.mapper.ResultDao;
import com.mobvista.apptag.mapper.TagDao;
import com.mobvista.apptag.mapper.UserDao;
import com.mobvista.apptag.service.FeatService;
import com.mobvista.apptag.service.StorageService;
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("/storage")
public class StorageController {
@Autowired
private ResultDao resultDao;
@Autowired
private UserDao userDao;
@Autowired
private TagDao tagDao;
@Autowired
private FeatDao featDao;
@Autowired
private FeatService featService;
@Autowired
private StorageService storageService;
public static final Logger logger = LoggerFactory.getLogger(StorageController.class);
@GetMapping("/edit")
String edit(@RequestParam(name = "packageName") String packageName, Model model) {
Tag tag = tagDao.find(packageName);
if (StringUtils.isNotBlank(tag.getUrl()) && tag.getUrl().length() > 2 && tag.getUrl().startsWith("[") && tag.getUrl().endsWith("]")) {
String url = tag.getUrl().substring(2, tag.getUrl().length() - 2).replace("\"", "").split(",")[0];
tag.setUrl(url);
} else {
tag.setUrl("");
}
model.addAttribute("tag", tag);
Storage result = storageService.find(packageName);
model.addAttribute("resultCategory", JSONObject.fromObject(result.getTag()));
List<Feat> categoryFeat = featDao.firstList("01");
JSONArray jsonArray = JSONArray.fromObject(categoryFeat);
model.addAttribute("firstCategory", jsonArray);
List<Feat> secondCategoryFeat = featDao.list("01");
JSONArray secondJsonArray = JSONArray.fromObject(secondCategoryFeat);
model.addAttribute("secondCategory", secondJsonArray);
List<Feat> ruleFeat = featDao.firstList("02");
model.addAttribute("ruleCategory", JSONArray.fromObject(ruleFeat));
List<Feat> styleFeat = featDao.firstList("03");
model.addAttribute("styleCategory", JSONArray.fromObject(styleFeat));
List<Feat> themeFeat = featDao.firstList("04");
model.addAttribute("themeCategory", JSONArray.fromObject(themeFeat));
return "result/edit";
}
@PostMapping("/save")
@ResponseBody
R save(@SessionAttribute(WebSecurityConfig.SESSION_KEY) String userName,
@RequestParam(name = "packageName") String packageName,
@RequestParam(name = "categoryCode", required = false) String categoryCode,
@RequestParam(name = "ruleCode", required = false) String ruleCode,
@RequestParam(name = "styleCode", required = false) String styleCode,
@RequestParam(name = "themeCode", required = false) String themeCode) {
Map<String, String> codeMap = new HashMap<String, String>();
Map<String, String> featMap = featService.getMap();
// 类型标签
if (StringUtils.isNotBlank(categoryCode)) {
String[] codes = categoryCode.split(",");
for (String code : codes) {
codeMap.put(code, featMap.get(code));
}
}
// 规则标签
if (StringUtils.isNotBlank(ruleCode)) {
String[] codes = ruleCode.split(",");
for (String code : codes) {
codeMap.put(code, featMap.get(code));
}
}
// 风格标签
if (StringUtils.isNotBlank(styleCode)) {
String[] codes = styleCode.split(",");
for (String code : codes) {
codeMap.put(code, featMap.get(code));
}
}
// 主题标签
if (StringUtils.isNotBlank(themeCode)) {
String[] codes = themeCode.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 (storageService.update(packageName, 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<Storage> results = storageService.list(query);
String search = query.getSearch();
int total = storageService.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 "storage/list";
}
}
\ No newline at end of file
......@@ -8,6 +8,7 @@ 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.FeatService;
import com.mobvista.apptag.service.ResultService;
import com.mobvista.apptag.service.TagService;
......@@ -49,6 +50,9 @@ public class TagController {
@Autowired
private FeatDao featDao;
@Autowired
private UserDao userDao;
public static final Logger logger = LoggerFactory.getLogger(TagController.class);
@GetMapping("/edit")
......@@ -136,8 +140,8 @@ public class TagController {
@PostMapping("/list")
@ResponseBody
public PageUtil list(@RequestBody Query query,
@RequestParam(name = "tag", required = false, defaultValue = "0") int tag) {
public PageUtil list(@SessionAttribute(WebSecurityConfig.SESSION_KEY) String userName,
@RequestBody Query query, @RequestParam(name = "tag", required = false, defaultValue = "0") int tag) {
PageHelper.startPage(query.getOffset() / query.getLimit() + 1, query.getLimit());
String search = query.getSearch();
List<Tag> tags = tagDao.list(search, tag);
......
......@@ -15,12 +15,15 @@ public class Feat implements Serializable {
private static final long serialVersionUID = 1L;
// 标签类型
@Column(name = "tag_type",type = MySqlTypeConstant.VARCHAR,length = 100)
private String tagType;
// 一级标签
@Column(name = "first_tag", type = MySqlTypeConstant.VARCHAR, length = 255)
@Column(name = "first_tag", type = MySqlTypeConstant.VARCHAR, length = 100)
private String firstTag;
// 二级标签
@Column(name = "second_tag", type = MySqlTypeConstant.VARCHAR, length = 255)
@Column(name = "second_tag", type = MySqlTypeConstant.VARCHAR, length = 100)
private String secondTag;
// 一级标签ID
......@@ -35,6 +38,14 @@ public class Feat implements Serializable {
@Column(name = "feat_id", type = MySqlTypeConstant.VARCHAR, length = 2)
private String featId;
public String getTagType() {
return tagType;
}
public void setTagType(String tagType) {
this.tagType = tagType;
}
/**
* @return the firstTag
*/
......
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 = "storage")
public class Storage implements Serializable {
private static final long serialVersionUID = 1L;
// APP 包名
@Column(name = "package_name", type = MySqlTypeConstant.VARCHAR, isKey = true, isNull = false)
private String packageName;
// APP 名称
@Column(name = "app_name", type = MySqlTypeConstant.VARCHAR)
private String appName;
// 平台:ios,android
@Column(name = "platform", type = MySqlTypeConstant.VARCHAR, length = 10)
private String platform;
// 标签
@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 getPackageName() {
return packageName;
}
public void setPackageName(String packageName) {
this.packageName = packageName;
}
public String getAppName() {
return appName;
}
public void setAppName(String appName) {
this.appName = appName;
}
public String getPlatform() {
return platform;
}
public void setPlatform(String platform) {
this.platform = platform;
}
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 = "storage_result")
public class StorageEntity implements Serializable {
private static final long serialVersionUID = 1L;
// APP 包名
@Column(name = "package_name", type = MySqlTypeConstant.VARCHAR, isNull = false)
private String packageName;
// APP 名称
@Column(name = "app_name", type = MySqlTypeConstant.VARCHAR)
private String appName;
// 平台:ios,android
@Column(name = "platform", type = MySqlTypeConstant.VARCHAR, length = 10)
private String platform;
// 标签ID
@Column(name = "feat_id", type = MySqlTypeConstant.VARCHAR, length = 10)
private String featId;
// 入库时间
@Column(name = "update_time", type = MySqlTypeConstant.DATETIME, isNull = false)
private Date updateTime;
// 总人数,标注该 package 的总人数
@Column(name = "user_count", type = MySqlTypeConstant.INT)
private int userCount;
// 标签人数,标注该 标签的 人数
@Column(name = "tag_count", type = MySqlTypeConstant.INT)
private int tagCount;
// 标注比例
@Column(name = "tag_rate", type = MySqlTypeConstant.DOUBLE)
private double tagRate;
public String getPackageName() {
return packageName;
}
public void setPackageName(String packageName) {
this.packageName = packageName;
}
public String getAppName() {
return appName;
}
public void setAppName(String appName) {
this.appName = appName;
}
public String getPlatform() {
return platform;
}
public void setPlatform(String platform) {
this.platform = platform;
}
public String getFeatId() {
return featId;
}
public void setFeatId(String featId) {
this.featId = featId;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public int getUserCount() {
return userCount;
}
public void setUserCount(int userCount) {
this.userCount = userCount;
}
public int getTagCount() {
return tagCount;
}
public void setTagCount(int tagCount) {
this.tagCount = tagCount;
}
public double getTagRate() {
return tagRate;
}
public void setTagRate(double tagRate) {
this.tagRate = tagRate;
}
}
\ 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.constants.MySqlTypeConstant;
import java.util.Date;
/**
* @package: com.mobvista.apptag.entity
* @author: wangjf
* @date: 2019-08-12
* @time: 14:55
* @email: jinfeng.wang@mobvista.com
* @phone: 152-1062-7698
*/
public class TagEntity {
// 标签类型
private String tagType;
// 一级标签
private String firstTag;
// 二级标签
private String secondTag;
// 标签中文全名
private String comment;
// 标签ID
private String featId;
// 入库时间
private Date updateTime;
// 总人数,标注该 package 的总人数
private int userCount;
// 标签人数,标注该 标签的 人数
private int tagCount;
// 标注比例
private double tagRate;
public String getTagType() {
return tagType;
}
public void setTagType(String tagType) {
this.tagType = tagType;
}
public String getFirstTag() {
return firstTag;
}
public void setFirstTag(String firstTag) {
this.firstTag = firstTag;
}
public String getSecondTag() {
return secondTag;
}
public void setSecondTag(String secondTag) {
this.secondTag = secondTag;
}
public String getComment() {
return comment;
}
public void setComment(String comment) {
this.comment = comment;
}
public String getFeatId() {
return featId;
}
public void setFeatId(String featId) {
this.featId = featId;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public int getUserCount() {
return userCount;
}
public void setUserCount(int userCount) {
this.userCount = userCount;
}
public int getTagCount() {
return tagCount;
}
public void setTagCount(int tagCount) {
this.tagCount = tagCount;
}
public double getTagRate() {
return tagRate;
}
public void setTagRate(double tagRate) {
this.tagRate = tagRate;
}
}
package com.mobvista.apptag.entity;
import java.io.Serializable;
import java.util.Date;
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 javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import java.io.Serializable;
import java.util.Date;
/**
* @author wangjf
*/
// @Entity
@Table(name = "tag_result")
// @IdClass(PrimaryKey.class)
public class TagResult implements Serializable {
private static final long serialVersionUID = 1L;
// APP 包名
@Column(name = "package_name", type = MySqlTypeConstant.VARCHAR, length = 255, isKey = true, isNull = false)
@Column(name = "package_name", type = MySqlTypeConstant.VARCHAR, length = 255, isNull = false)
private String packageName;
// APP 名称
@Column(name = "app_name", type = MySqlTypeConstant.VARCHAR, length = 255, isNull = true)
......@@ -39,6 +44,7 @@ public class TagResult implements Serializable {
/**
* @return the package_name
*/
// @Id
public String getPackageName() {
return packageName;
}
......@@ -109,6 +115,7 @@ public class TagResult implements Serializable {
/**
* @return the userId
*/
// @Id
public String getUserId() {
return userId;
}
......
......@@ -14,27 +14,27 @@ import org.apache.ibatis.annotations.Select;
public interface FeatDao {
@Select("SELECT DISTINCT * FROM tag_feat WHERE feat_id = #{featId}")
@Results({ @Result(property = "firstTag", column = "first_tag"),
@Result(property = "secondTag", column = "second_tag"),
@Result(property = "firstId", column = "first_id"),
@Result(property = "secondId", column = "second_id"),
@Result(property = "featId", column = "feat_id") })
List<Feat> list(String featId);
@Select("SELECT feat_id, first_tag, first_id FROM tag_feat WHERE feat_id = #{featId} GROUP BY feat_id, first_tag, first_id")
@Results({ @Result(property = "firstTag", column = "first_tag"),
@Result(property = "secondTag", column = "second_tag"),
@Result(property = "firstId", column = "first_id"),
@Result(property = "secondId", column = "second_id"),
@Result(property = "featId", column = "feat_id") })
List<Feat> firstList(String featId);
@Select("SELECT * FROM tag_feat")
@Results({ @Result(property = "firstTag", column = "first_tag"),
@Result(property = "secondTag", column = "second_tag"),
@Result(property = "firstId", column = "first_id"),
@Result(property = "secondId", column = "second_id"),
@Result(property = "featId", column = "feat_id") })
List<Feat> listAll();
@Select("SELECT DISTINCT * FROM tag_feat WHERE feat_id = #{featId}")
@Results({@Result(property = "tagType", column = "tag_type"),
@Result(property = "firstTag", column = "first_tag"),
@Result(property = "secondTag", column = "second_tag"),
@Result(property = "firstId", column = "first_id"),
@Result(property = "secondId", column = "second_id"),
@Result(property = "featId", column = "feat_id")})
List<Feat> list(String featId);
@Select("SELECT feat_id, first_tag, first_id FROM tag_feat WHERE feat_id = #{featId} GROUP BY feat_id, first_tag, first_id")
@Results({@Result(property = "firstTag", column = "first_tag"),
@Result(property = "firstId", column = "first_id"),
@Result(property = "featId", column = "feat_id")})
List<Feat> firstList(String featId);
@Select("SELECT * FROM tag_feat")
@Results({@Result(property = "tagType", column = "tag_type"),
@Result(property = "firstTag", column = "first_tag"),
@Result(property = "secondTag", column = "second_tag"),
@Result(property = "firstId", column = "first_id"),
@Result(property = "secondId", column = "second_id"),
@Result(property = "featId", column = "feat_id")})
List<Feat> listAll();
}
\ No newline at end of file
......@@ -15,7 +15,7 @@ public interface ResultDao {
@Insert("REPLACE INTO tag_result(package_name,app_name,platform,feat_id,comment,user_id,update_time) VALUES(#{packageName}, #{appName}, #{platform}, #{featId}, #{comment}, #{userId}, #{updateTime})")
boolean save(TagResult tagResult);
@Select("SELECT * FROM tag_result WHERE package_name = #{packageName}")
@Select("SELECT * FROM tag_result WHERE package_name = #{packageName} AND user_id = #{userId}")
@Results({@Result(property = "packageName", column = "package_name"),
@Result(property = "appName", column = "app_name"),
@Result(property = "platform", column = "platform"),
......@@ -23,7 +23,7 @@ public interface ResultDao {
@Result(property = "comments", column = "comments"),
@Result(property = "userId", column = "user_id"),
@Result(property = "updateTime", column = "update_time")})
TagResult find(String packageName);
TagResult find(String packageName, String userId);
/*
@Select("SELECT * FROM tag_result WHERE user_id = #{userId}")
......
package com.mobvista.apptag.mapper;
import com.mobvista.apptag.entity.Storage;
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 StorageDao {
@Insert("REPLACE INTO storage(package_name,app_name,platform,tag,update_time,user_id) VALUES(#{packageName}, #{appName}, #{platform}, #{tag}, #{updateTime}, #{userId})")
boolean save(Storage storage);
@Select("SELECT * FROM storage WHERE package_name = #{packageName}")
@Results({@Result(property = "packageName", column = "package_name"),
@Result(property = "appName", column = "app_name"),
@Result(property = "platform", column = "platform"),
@Result(property = "tag", column = "tag"),
@Result(property = "updateTime", column = "update_time")})
Storage find(String packageName);
@SelectProvider(type = ListMapperProvider.class, method = "list")
@Results({@Result(property = "packageName", column = "package_name"),
@Result(property = "appName", column = "app_name"),
@Result(property = "platform", column = "platform"),
@Result(property = "tag", column = "tag"),
@Result(property = "updateTime", column = "update_time")})
List<Storage> list(String search);
class ListMapperProvider {
public String list(String search) {
String sql = "SELECT * FROM storage";
if (StringUtils.isNotBlank(search)) {
sql += " WHERE LOWER(package_name) LIKE '%" + search + "%'";
}
return sql;
}
}
@SelectProvider(type = CountMapperProvider.class, method = "count")
int count(String search);
class CountMapperProvider {
public String count(String search) {
String sql = "SELECT COUNT(1) FROM storage";
if (StringUtils.isNotBlank(search)) {
sql += " WHERE LOWER(package_name) LIKE '%" + search + "%'";
}
return sql;
}
}
}
\ No newline at end of file
......@@ -38,7 +38,7 @@ public interface TagDao {
class ListMapperProvider {
public String list(String search, int tag) {
String sql = "SELECT * FROM tag_list WHERE tag = #{tag}";
String sql = "SELECT * FROM tag_list WHERE tag < 3";
if (StringUtils.isNotBlank(search)) {
sql += " AND LOWER(package_name) LIKE '%" + search + "%'";
}
......@@ -86,7 +86,7 @@ public interface TagDao {
class CountMapperProvider {
public String count(String search, int tag) {
String sql = "SELECT COUNT(1) FROM tag_list WHERE tag = #{tag}";
String sql = "SELECT COUNT(1) FROM tag_list WHERE tag < 3";
if (StringUtils.isNotBlank(search)) {
sql += " AND LOWER(package_name) LIKE '%" + search + "%'";
}
......
......@@ -14,7 +14,7 @@ public interface ResultService {
boolean save(String packageName, String userName, String json);
TagResult find(String packageName);
TagResult find(String packageName, String userId);
List<TagResult> list(String userId, Query query);
......
package com.mobvista.apptag.service;
import com.mobvista.apptag.entity.Storage;
import com.mobvista.apptag.utils.Query;
import java.util.List;
/**
* @author wangjf
*/
public interface StorageService {
boolean update(String packageName, String userName, String json);
Storage find(String packageName);
List<Storage> list(Query query);
int count(String search);
}
\ No newline at end of file
......@@ -58,8 +58,8 @@ public class ResultServiceImpl implements ResultService {
}
@Override
public TagResult find(String packageName) {
return resultDao.find(packageName);
public TagResult find(String packageName, String userId) {
return resultDao.find(packageName, userId);
}
@Override
......@@ -67,11 +67,14 @@ public class ResultServiceImpl implements ResultService {
User user = userDao.find(userId);
List<TagResult> results;
PageHelper.startPage(query.getOffset() / query.getLimit() + 1, query.getLimit());
results = resultDao.list(userId, query.getSearch().toLowerCase());
/*
if (user.getRole() == 0) {
results = resultDao.list(userId, query.getSearch().toLowerCase());
} else {
results = resultDao.listAll(query.getSearch().toLowerCase());
}
*/
List<TagResult> results2 = new ArrayList<>();
for (TagResult result : results) {
......@@ -84,11 +87,14 @@ public class ResultServiceImpl implements ResultService {
@Override
public int count(String userId, String search) {
User user = userDao.find(userId);
// User user = userDao.find(userId);
return resultDao.count(userId, search);
/*
if (user.getRole() == 0) {
return resultDao.count(userId, search);
} else {
return resultDao.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.Storage;
import com.mobvista.apptag.entity.Tag;
import com.mobvista.apptag.entity.User;
import com.mobvista.apptag.mapper.StorageDao;
import com.mobvista.apptag.mapper.TagDao;
import com.mobvista.apptag.mapper.UserDao;
import com.mobvista.apptag.service.StorageService;
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("storageService")
public class StorageServiceImpl implements StorageService {
@Autowired
private UserDao userDao;
@Autowired
private TagDao tagDao;
@Autowired
private StorageDao storageDao;
@Override
public boolean update(String packageName, String userName, String json) {
Tag tag = tagDao.find(packageName);
User user = userDao.find(userName);
Storage storage = new Storage();
storage.setPackageName(packageName);
storage.setAppName(tag.getAppName());
storage.setPlatform(tag.getPlatform());
storage.setTag(json);
storage.setUpdateTime(new Date());
storage.setUserId(user.getUserId());
return this.storageDao.save(storage);
}
@Override
public Storage find(String packageName) {
return storageDao.find(packageName);
}
@Override
public List<Storage> list(Query query) {
List<Storage> results;
PageHelper.startPage(query.getOffset() / query.getLimit() + 1, query.getLimit());
results = storageDao.list(query.getSearch().toLowerCase());
List<Storage> results2 = new ArrayList<>();
for (Storage 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 storageDao.count(search);
}
}
package com.mobvista.apptag.service.impl;
import java.util.Date;
import java.util.List;
import com.github.pagehelper.PageHelper;
import com.mobvista.apptag.entity.Tag;
import com.mobvista.apptag.entity.User;
import com.mobvista.apptag.mapper.TagDao;
import com.mobvista.apptag.mapper.UserDao;
import com.mobvista.apptag.service.TagService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Arrays;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
@Service("tagService")
public class TagServiceImpl implements TagService {
......@@ -26,13 +27,32 @@ public class TagServiceImpl implements TagService {
public boolean update(String packageName, String userName) {
Tag tag = tagDao.find(packageName);
tag.setUpdateTime(new Date());
tag.setTag(1);
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);
// this.userDao.update(user);
}
} else {
tag.setTag(1);
tag.setUserId(user.getUserId());
user.setCount(user.getCount() + 1);
}
/*
if (!user.getUserId().equals(tag.getUserId())) {
user.setCount(user.getCount() + 1);
this.userDao.update(user);
}
tag.setUserId(user.getUserId());
*/
// tag.setUserId(user.getUserId());
this.userDao.update(user);
return this.tagDao.update(tag);
}
......
......@@ -2,6 +2,7 @@ package com.mobvista.apptag.utils;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.Iterator;
import java.util.Set;
......
package com.mobvista.apptag.utils;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.gson.JsonArray;
import java.sql.*;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.*;
/**
* @package: com.mobvista.apptag.utils
* @author: wangjf
* @date: 2019-08-12
* @time: 15:18
* @email: jinfeng.wang@mobvista.com
* @phone: 152-1062-7698
*/
public class StorageTag {
static final String CONNECTION_URL = "jdbc:mysql://localhost:3306/app_tag?useUnicode=true&characterEncoding=utf8&useSSL=false";
// static final String CONNECTION_URL = "jdbc:mysql://dataplatform-app-tag.c5yzcdreb1xr.us-east-1.rds.amazonaws.com:3306/app_tag?useUnicode=true&characterEncoding=utf8&useSSL=false";
static final String DRIVER = "com.mysql.jdbc.Driver";
static final String USER = "root";
// static final String USER = "apptag_rw";
static final String PASSWORD = "19920627";
// static final String PASSWORD = "7gyLEVtkER3u8c9";
static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
static ObjectMapper mapper = new ObjectMapper();
static Connection connection = null;
static PreparedStatement preparedStatement = null;
public static void main(String[] args) {
String sql = String.format("SELECT a.package_name,a.app_name,a.platform,JSON_KEYS(feat_id) tag_arr,t.tag FROM app_tag.tag_result a LEFT JOIN (SELECT package_name,tag FROM app_tag.tag_list WHERE tag > 1) t ON a.package_name = t.package_name WHERE t.package_name IS NOT NULL");
try {
Class.forName(DRIVER);
connection = DriverManager.getConnection(CONNECTION_URL, USER, PASSWORD);
preparedStatement = connection.prepareStatement(sql);
ResultSet resultSet = preparedStatement.executeQuery();
Map<String, Integer> map = new HashMap<>();
while (resultSet.next()) {
String packageName = resultSet.getString("package_name");
String appName = resultSet.getString("app_name");
String platform = resultSet.getString("platform");
String userCount = resultSet.getString("tag");
String tag_arr = resultSet.getString("tag_arr");
JsonArray jsonArray = GsonUtil.String2JsonArray(tag_arr);
for (int i = 0; i < jsonArray.size(); i++) {
// jsonArray.get(i).getAsString() tagId
String key = packageName + "," + appName + "," + platform + "," + jsonArray.get(i).getAsString() + "," + userCount;
if (map.containsKey(key)) {
map.put(key, map.get(key) + 1);
} else {
map.put(key, 1);
}
}
}
insert(map);
resultSet.close();
preparedStatement.close();
connection.close();
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (preparedStatement != null) {
preparedStatement.close();
}
} catch (SQLException se) {
}
try {
if (connection != null) {
connection.close();
}
} catch (SQLException se) {
se.printStackTrace();
}
}
}
private static void delete(Set<String> set) {
try {
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection(CONNECTION_URL, USER, PASSWORD);
Statement stmt = con.createStatement();
String deleteSql = "DELETE FROM storage_result WHERE package_name IN ";
Iterator<String> iterator = set.iterator();
StringBuffer sql = new StringBuffer();
while (iterator.hasNext()) {
String packageName = iterator.next();
sql.append("'").append(packageName).append("',");
}
// System.out.println(deleteSql + "(" + sql.substring(0, sql.length() - 1) + ")");
stmt.execute(deleteSql + "(" + sql.substring(0, sql.length() - 1) + ")");
con.close();
} catch (Exception e) {
System.out.println(e);
}
}
private static void insert(Map<String, Integer> map) throws JsonProcessingException {
Iterator<String> iterator = map.keySet().iterator();
Map<String, Map<String, String>> tagMap = new HashMap<>();
StringBuffer insertSql_1 = new StringBuffer();
StringBuffer insertSql_2 = new StringBuffer();
Set<String> packageSet = new HashSet<>();
Map<String, String> featMap = getMap();
while (iterator.hasNext()) {
String key = iterator.next();
String[] strs = key.split(",");
String packageName = strs[0];
String appName = strs[1];
String platform = strs[2];
String tagId = strs[3];
Double userCount = Double.valueOf(strs[4]);
Integer tagCount = map.get(key);
String key1 = packageName + "," + appName + "," + platform;
DecimalFormat df = new DecimalFormat("#.##");
Double tagRate = Double.parseDouble(df.format(tagCount / userCount));
if (tagRate > 0.5) {
packageSet.add(packageName);
insertSql_1.append("('").append(packageName).append("','").append(appName).append("','").append(platform).append("','").append(tagId)
.append("',").append(userCount).append(",").append(tagCount).append(",").append(tagRate).append(",'").append(sdf.format(new Date())).append("'),");
Map<String, String> tmap = new HashMap<>();
if (tagMap.containsKey(key1)) {
tmap = tagMap.get(key1);
tmap.put(tagId, featMap.getOrDefault(tagId, ""));
} else {
tmap.put(tagId, featMap.getOrDefault(tagId, ""));
}
tagMap.put(key1, tmap);
}
}
delete(packageSet);
Iterator<String> iters = tagMap.keySet().iterator();
while (iters.hasNext()) {
String key = iters.next();
String[] arr = key.split(",");
insertSql_2.append("('").append(arr[0]).append("','").append(arr[1]).append("','").append(arr[2]).append("','").append(mapper.writeValueAsString(tagMap.get(key))).append("','")
.append(sdf.format(new Date())).append("'),");
}
try {
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection(CONNECTION_URL, USER, PASSWORD);
Statement stmt = con.createStatement();
Statement stmt1 = con.createStatement();
String insert_sql1 = "REPLACE INTO storage_result(package_name, app_name, platform, feat_id, user_count, tag_count, tag_rate, update_time) " +
"VALUES";
String insert_sql2 = "REPLACE INTO storage(package_name, app_name, platform, tag, update_time) " +
"VALUES";
stmt.executeQuery(insert_sql1 + insertSql_1.substring(0, insertSql_1.length() - 1));
stmt1.executeQuery(insert_sql2 + insertSql_2.substring(0, insertSql_2.length() - 1));
con.close();
} catch (Exception e) {
System.out.println(e);
}
}
private static Map<String, String> getMap() {
Map<String, String> map = new HashMap<>();
try {
Class.forName(DRIVER);
connection = DriverManager.getConnection(CONNECTION_URL, USER, PASSWORD);
String sql = "SELECT DISTINCT second_id,second_tag FROM tag_feat";
preparedStatement = connection.prepareStatement(sql);
ResultSet resultSet = preparedStatement.executeQuery();
while (resultSet.next()) {
String secondId = resultSet.getString("second_id");
String secondTag = resultSet.getString("second_tag");
map.put(secondId, secondTag);
}
resultSet.close();
preparedStatement.close();
connection.close();
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (preparedStatement != null) {
preparedStatement.close();
}
} catch (SQLException se) {
}
try {
if (connection != null) {
connection.close();
}
} catch (SQLException se) {
se.printStackTrace();
}
}
return map;
}
}
......@@ -3,7 +3,7 @@ logging.level.root=INFO
logging.path=applog
mybatis.table.auto=update
mybatis.table.auto=none
mybatis.model.pack=com.mobvista.apptag.entity
......
server:
session-timeout: 1800
port: 8888
port: 8088
spring:
datasource:
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://dataplatform-app-tag.c5yzcdreb1xr.us-east-1.rds.amazonaws.com:3306/app_tag?useUnicode=true&characterEncoding=utf8
username: apptag_rw
password: 7gyLEVtkER3u8c9
# url: jdbc:mysql://dataplatform-app-tag.c5yzcdreb1xr.us-east-1.rds.amazonaws.com:3306/app_tag?useUnicode=true&characterEncoding=utf8
# username: apptag_rw
# password: 7gyLEVtkER3u8c9
# url: jdbc:mysql://localhost:3306/app_tag?useUnicode=true&characterEncoding=utf8
# username: root
# password: 19920627
url: jdbc:mysql://localhost:3306/app_tag?useUnicode=true&characterEncoding=utf8
username: root
password: 19920627
# initialSize: 1
# minIdle: 3
# maxActive: 20
......
......@@ -2,7 +2,7 @@
// 以下为官方示例
$().ready(function () {
var data = document.getElementById("role").value;
var data = $('#role').val();
console.log(data)
if (data == 0) {
refreshAdmin();
......
// 以下为官方示例
// 以下为官方示例
$().ready(function () {
validateRule();
var data = document.getElementById("firstCategory").value;
var secondData = document.getElementById("secondCategory").value;
var resultData = document.getElementById("resultCategory").value;
refreshMultiSelect(JSON.parse(data), JSON.parse(secondData), JSON.parse(resultData));
// console.log(JSON.parse(data));
// $("#signupForm").validate()
var ruleData = document.getElementById("ruleCategory").value;
refreshSelect("rule", JSON.parse(ruleData), JSON.parse(resultData));
var styleData = document.getElementById("styleCategory").value;
refreshSelect("style", JSON.parse(styleData), JSON.parse(resultData));
var themeData = document.getElementById("themeCategory").value;
refreshSelect("theme", JSON.parse(themeData), JSON.parse(resultData));
});
$.validator.setDefaults({
submitHandler: function () {
update();
}
});
function update() {
$.ajax({
cache: true,
type: "POST",
url: "/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: {
packageName: {
required: true
}
},
messages: {
packageName: {
required: "必须输入"
}
}
})
}
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);
$('#categoryCode').append(data);
$('#categoryCode').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 = "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: "packageName", // 列字段名
title: "包名", // 列标题
align: "center"
},
{
field: "appName",
title: "应用名称",
align: "center"
},
{
field: "platform",
title: "平台",
align: "center"
},
{
field: "tag",
title: "已标标签",
align: "center"
},
{
title: "操作",
field: "operate",
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.packageName +
'\')"><i class="fa fa-edit"></i></a>';
if (role === '0') {
e = ""
}
return e;
}
}
]
});
}
function reLoad(type) {
if (type == 1) {
var opt = {
query: {
offset: 0
}
};
$("#exampleTable").bootstrapTable("refresh", opt);
} else {
$("#exampleTable").bootstrapTable("refresh");
}
}
function edit(package_name) {
layer.open({
type: 2,
title: "标签标注",
maxmin: true,
shadeClose: true, // 点击遮罩关闭层
area: ["800px", "580px"],
content: prefix + "/edit?packageName=" + package_name // iframe的url
});
}
\ No newline at end of file
......@@ -22,6 +22,8 @@
</head>
<body class="fixed-sidebar full-height-layout gray-bg"
style="overflow: hidden">
<input id="role" name="role" type="hidden"
th:value="${user.role}"/>
<div id="wrapper">
<!--左侧导航开始-->
<nav class="navbar-default navbar-static-side" role="navigation">
......@@ -59,19 +61,23 @@
</a>
<ul class="nav nav-second-level">
<li><a class="J_menuItem" href="index.html"
data-index="1" th:href="@{/result}">已标注 App 列表</a></li>
data-index="1" th:href="@{/storage}">已入库 App 列表</a></li>
</ul>
<ul class="nav nav-second-level">
<li><a class="J_menuItem" href="index.html"
data-index="2" th:href="@{/tag}">未标注 App 列表</a></li>
data-index="2" th:href="@{/result}">未入库 App 列表</a></li>
</ul>
<ul class="nav nav-second-level">
<li><a class="J_menuItem" href="index.html"
data-index="3" th:href="@{/tag}">未标注 App 列表</a></li>
</ul>
</li>
<li id="admin"><a href="#"> <i class="fa fa-home"></i> <span
class="nav-label">用户管理</span> <span class="fa arrow"></span>
</a>
</a>
<ul class="nav nav-second-level">
<li><a class="J_menuItem" href="index.html"
data-index="3" th:href="@{/user}">用户列表</a></li>
data-index="4" th:href="@{/user}">用户列表</a></li>
</ul>
</li>
<!--
......@@ -94,20 +100,18 @@
<!--左侧导航结束-->
<!--右侧部分开始-->
<div id="page-wrapper" class="gray-bg dashbard-1">
<div class="row border-bottom">
<nav class="navbar navbar-static-top" role="navigation"
style="margin-bottom: 0">
<ul class="nav navbar-top-links navbar-right">
<li class="hidden-xs"><a @click="personal" href="#" ><i class="fa fa-id-card"></i> <span th:text="${user.userName}"></span></a></li>
<li class="hidden-xs"><a @click="personal" href="#"><i class="fa fa-id-card"></i> <span
th:text="${user.userName}"></span></a></li>
<li class="dropdown hidden-xs"><a
class="right-sidebar-toggle" aria-expanded="false"> <i
class="fa fa-tasks"></i> 已标注:<span th:text="${user.count}"></span>
</a></li>
</ul>
<input id="role" name="role" type="hidden"
th:value="${user.role}"/>
</nav>
</div>
<div class="row content-tabs">
......
......@@ -15,8 +15,6 @@
<body style="background-color: #f2f2f2;">
<div class="layui-fluid">
欢迎!
<input id="role" name="role" type="hidden"
th:value="${user.role}"/>
</div>
<div th:include="include :: footer"></div>
<!-- ECharts -->
......
<!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">
<form class="form-horizontal m-t" id="signupForm">
<input id="firstCategory" name="firstCategory" type="hidden"
th:value="${firstCategory}"/>
<input id="secondCategory" name="secondCategory" type="hidden"
th:value="${secondCategory}"/>
<input id="resultCategory" name="resultCategory" type="hidden"
th:value="${resultCategory}"/>
<input id="ruleCategory" name="ruleCategory" type="hidden"
th:value="${ruleCategory}"/>
<input id="styleCategory" name="styleCategory" type="hidden"
th:value="${styleCategory}"/>
<input id="themeCategory" name="themeCategory" type="hidden"
th:value="${themeCategory}"/>
<div class="form-group">
<label class="col-sm-3 control-label">包名:</label>
<div class="col-sm-8">
<input id="packageName" name="packageName" class="form-control"
type="text" th:value="${tag.packageName}" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">应用名称:</label>
<div class="col-sm-8">
<input id="appName" name="appName" class="form-control"
type="text" th:value="${tag.appName}" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">App 商店链接:</label>
<div class="col-sm-8">
<a id="url" name="url" th:href="${tag.url}" target="_blank">
<span th:text="${tag.url}"></span>
</a>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">商店类别:</label>
<div class="col-sm-8">
<input id="category" name="category" class="form-control"
type="text" th:value="${tag.category}" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">类别标签:</label>
<div class="col-sm-8">
<select id="categoryCode" name="categoryCode" multiple="multiple">
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">规则标签:</label>
<div class="col-sm-8">
<select id="ruleCode" name="ruleCode" multiple="multiple">
<!--
<option th:each="iter:${rule}" th:value="${iter.firstId}" th:text="${iter.firstTag}"></option>
-->
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">风格标签:</label>
<div class="col-sm-8">
<select id="styleCode" name="styleCode" multiple="multiple">
<!--
<option th:each="iter:${rule}" th:value="${iter.firstId}" th:text="${iter.firstTag}"></option>
-->
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">主题标签:</label>
<div class="col-sm-8">
<select id="themeCode" name="themeCode" multiple="multiple">
<!--
<option th:each="iter:${rule}" th:value="${iter.firstId}" th:text="${iter.firstTag}"></option>
-->
</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">
$('#categoryCode').multiselect({
nonSelectedText: '请选择标签!'
});
$('#ruleCode').multiselect({
nonSelectedText: '请选择标签!'
});
$('#styleCode').multiselect({
nonSelectedText: '请选择标签!'
});
$('#themeCode').multiselect({
nonSelectedText: '请选择标签!'
});
</script>
<script type="text/javascript" src="/js/appjs/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="packageName">
</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/storage/list.js"></script>
</body>
</html>
\ No newline at end of file
......@@ -4,8 +4,28 @@ import com.mobvista.apptag.utils.MD5Util;
public class MD5Test {
public static void main(String[] args) throws Exception {
String password = "19920627";
String password = "123456";
System.out.println(MD5Util.getMD5Str(password));
/*
Date date = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
Date dt = sdf.parse(sdf.format(date));
Calendar rightNow = Calendar.getInstance();
rightNow.setTime(dt);
rightNow.add(Calendar.MONTH, 1);
// rightNow.add(Calendar.DAY_OF_YEAR, 10);//日期加10天
System.out.println(rightNow.getTime().getTime() / 1000);
*/
/*
Pattern iosPkgPtn = Pattern.compile("^\\d+$");
Pattern adrPkgPtn = Pattern.compile("^[0-9a-zA-Z\\.]+$");
System.out.println(iosPkgPtn.matcher("wxb740286dc4f9504e").matches());
System.out.println("wxb740286dc4f9504e".matches("^id\\d+$"));
*/
}
}
\ No newline at end of file
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