Commit 67d3e86a by manxiaoqiang

new

parent f78a24ce
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="web" name="Web">
<configuration>
<descriptors>
<deploymentDescriptor name="web.xml" url="file://$MODULE_DIR$/src/main/webapp/WEB-INF/web.xml" />
</descriptors>
<webroots>
<root url="file://$MODULE_DIR$/lib" relative="WEB-INF/lib" />
<root url="file://$MODULE_DIR$/src/main/webapp" relative="/" />
</webroots>
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
sonar.projectKey=io
sonar.projectName=userio
sonar.projectVersion=1.0
# Comma-separated paths to directories with sources (required)
sonar.sources=src
# Language
sonar.language=java
# Encoding of the source files
sonar.sourceEncoding=UTF-8
\ No newline at end of file
package com.reyun.controller;
import com.reyun.dic.LogEnumType;
import com.reyun.dic.OperateObjectEnumType;
import com.reyun.model.Account;
import com.reyun.model.VirtualEvent;
import com.reyun.repository.AppRepository;
import com.reyun.security.annotation.CurrentAccount;
import com.reyun.service.RetentionService;
import com.reyun.service.UserLogService;
import com.reyun.service.VirtualEventService;
import com.reyun.util.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Controller
@RequestMapping("/retention")
public class RetentionController {
protected Logger logger = LoggerFactory.getLogger(RetentionController.class);
@Autowired
AppRepository appRepository;
@Autowired
RetentionService retentionService;
@Autowired
UserLogService userLogService;
@Autowired
VirtualEventService virtualEventService;
@RequestMapping(value = "reportdetail/{app}", method = RequestMethod.GET)
@ResponseBody
public ResultModel reportDetail(HttpServletRequest request, @PathVariable Long app, @CurrentAccount Account loginAccount) {
String start = request.getParameter("startdate");
String end = request.getParameter("enddate");
String reportView = request.getParameter("reportview");
String userGroupStr = request.getParameter("usergroupid");
String eventInfo = request.getParameter("eventinfo");
String dimensionStr = request.getParameter("dimention");
String isDeviceStr = request.getParameter("isdevice");
String retentiontype = request.getParameter("retentiontype");
String eventType = request.getParameter("eventType");
boolean isProfile=false;
if(!StringUtils.isEmpty(eventType) && "profile".equals(eventType)){
isProfile=true;
}
boolean isDevice = !StringUtil.isEmpty(isDeviceStr) && "true".equals(isDeviceStr);
boolean isList = request.getParameter("datatype") != null && "list".equals(request.getParameter("datatype"));
if (StringUtil.isEmpty(reportView)) {
reportView = "day";
}
//日期间隔
int interval = this.getIntervalByReportView(start, end, reportView);
//开始结束日期
String startDate = this.getStartDateByReportView(start, reportView);
String endDate = this.getEndDateByReportView(end, reportView);
Map<String, List> result = retentionService.retentionDetailReport(loginAccount, startDate, endDate, isList, eventInfo, app,
userGroupStr, dimensionStr, reportView, interval, isDevice, retentiontype,isProfile);
userLogService.insertLog(loginAccount, LogEnumType.FIND.getCode(), LogEnumType.FIND.getName() + "留存明细报表",
"{\"eventinfo\":" + eventInfo + "}", app, OperateObjectEnumType.REPORT.getCode());
if (result.isEmpty()) {
return ResultModel.ERROR(ResultStatus.NETWORK_ERROR);
} else {
return ResultModel.OK(result);
}
}
@RequestMapping(value = "report/{app}", method = RequestMethod.GET)
@ResponseBody
public ResultModel report(HttpServletRequest request, @PathVariable Long app, @CurrentAccount Account loginAccount) {
String start = request.getParameter("startdate");
String end = request.getParameter("enddate");
String isDeviceStr = request.getParameter("isdevice");
boolean isDevice = !StringUtil.isEmpty(isDeviceStr) && "true".equals(isDeviceStr);
String reportView = request.getParameter("reportview");
String retentiontype = request.getParameter("retentiontype");
if (StringUtil.isEmpty(reportView)) {
reportView = "day";
}
//日期间隔
int interval = this.getIntervalByReportView(start, end, reportView);
//开始结束日期
String startDate = this.getStartDateByReportView(start, reportView);
String endDate = this.getEndDateByReportView(end, reportView);
String eventInfo = request.getParameter("eventinfo");
String userGroupStr = request.getParameter("usergroupid");
String dimensionStr = request.getParameter("dimention");
boolean isList = request.getParameter("datatype") != null && "list".equals(request.getParameter("datatype"));
String eventType = request.getParameter("eventType");
boolean isProfile=false;
if(!StringUtils.isEmpty(eventType) && "profile".equals(eventType)){
isProfile=true;
}
Map<String, List> result = retentionService.retentionReport(startDate, endDate, isList, eventInfo, app, userGroupStr,
dimensionStr, reportView, interval, isDevice, loginAccount.getId(), retentiontype,isProfile);
userLogService.insertLog(loginAccount, LogEnumType.FIND.getCode(), LogEnumType.FIND.getName() + "留存报表",
"{\"eventinfo\":" + eventInfo + "}", app, OperateObjectEnumType.REPORT.getCode());
if (result.isEmpty()) {
return ResultModel.ERROR(ResultStatus.NETWORK_ERROR);
} else {
return ResultModel.OK(result);
}
}
/**
* 获取开始时间
*/
private String getStartDateByReportView(String startDate, String reportView) {
String resultDate = startDate;
switch (reportView) {
case "day":
resultDate = startDate;
break;
case "week":
resultDate = DateUtil.getFirstDayStrOfWeek(DateUtil.parseDate(startDate));
break;
case "month":
resultDate = DateUtil.getFirstDayOfMonth(DateUtil.parseDate(startDate));
break;
}
return resultDate;
}
/**
* 获取结束时间
*/
private String getEndDateByReportView(String endDate, String reportView) {
String resultDate = endDate;
switch (reportView) {
case "day":
resultDate = endDate;
break;
case "week":
resultDate = DateUtil.getLastDayStrOfWeek(DateUtil.parseDate(endDate));
break;
case "month":
resultDate = DateUtil.getLastDayOfMonth(DateUtil.parseDate(endDate));
break;
}
return resultDate;
}
/**
* 根据报表显示类型获取日期间隔
*/
private int getIntervalByReportView(String startDate, String endDate, String reportView) {
int interval = 0;
switch (reportView) {
case "day":
interval = DateUtil.getDateInterval(startDate, endDate).size();
break;
case "week":
interval = DateUtil.getEveryWeek(startDate, endDate).size();
break;
case "month":
interval = DateUtil.getEveryMonth(startDate, endDate).size();
break;
}
return interval;
}
}
package com.reyun.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.reyun.service.TipService;
import com.reyun.util.ResultModel;
/**
* Created by nolan on 22/12/2016.
* description:
*/
@Controller
@RequestMapping("tip")
public class TipController {
@Autowired
private TipService tipService;
@RequestMapping(value = "{menu}", method = RequestMethod.GET)
@ResponseBody
public ResultModel findByMenu(@PathVariable String menu) {
return ResultModel.OK(tipService.findAllByMenu(menu));
}
}
package com.reyun.dic;
/**
* Created by sunhao on 17/6/6.
* desc:角色类型
*/
public enum RoleEnumType {
SUPER_USER(0L,"母账号"),
MANAGER(1L,"管理员"),
SUB_APP_MANAGER(2L,"子应用管理员"),
CUSTOM_AUTH(3L,"自定义权限"),
CUSTOM_ROLE(4L,"自定义角色"),
CHANNEL_PERSON(5L,"渠道账号");
private Long key;
private String value;
RoleEnumType(Long key, String value){
this.key = key;
this.value = value;
}
public Long getKey() {
return key;
}
public void setKey(Long key) {
this.key = key;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
}
package com.reyun.dic;
/**
* Created by sunhao on 17/3/23.
*/
public enum ThirdAccountChannelType {
SM_SEARCH("smsearch","神马搜索");
private String key;
private String value;
ThirdAccountChannelType(String key, String value) {
this.key = key;
this.value = value;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
}
package com.reyun.dic;
/**
* Created by sunhao on 17/6/1.
* desc:上传错误类型
*/
public enum UploadErrorEnumType {
READ_ERROR("READ_ERROR","数据读取错误"),
TABLE_EMPTY("EMPTY","表为空"),
HEAD_ERROR("HEAD_ERROR","表头错误"),
CONTENT_ERROR("CONTENT_ERROR","内容错误"),
REPEAT_ALL("REPEAT_ALL","内容全部重复");
private String key;
private String value;
UploadErrorEnumType(String key, String value) {
this.key = key;
this.value = value;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
}
package com.reyun.dic;
/**
* Created by nolan on 28/12/2016.
* description:
*/
public enum ViewColumnEnumType {
BASE("base", "基础指标"),
RETETION("retetion", "留存指标"),
PAYMENT("payment", "付费指标"),
EXCEPTION("exception", "异常数据");
private String code;
private String name;
ViewColumnEnumType(String code, String name) {
this.code = code;
this.name = name;
}
public String getCode() {
return code;
}
public String getName() {
return name;
}
}
package com.reyun.dic;
/**
* Created by song on 2017/9/5.
*/
public enum VirtualEventType {
ACTIVEEVENT("active","虚拟活跃事件"),
INSTALEVENT("install","新增虚拟活跃事件"),
USERDEFINEDEVENT("userdefine","自定义虚拟事件");
private String code;
private String name;
VirtualEventType(String code, String name) {
this.code = code;
this.name = name;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
package com.reyun.dic;
/**
* Created by nolan on 26/10/2016.
* description:
*/
public enum WhatEventEnumType {
INSTALL("install", "激活"),
REGED("reged", "注册"),
LOGGEDIN("loggedin", "登录"),
PAYMENT("payment", "付费"),
EVENT("event", "效果点");
private String id;
private String value;
WhatEventEnumType(String id, String value) {
this.id = id;
this.value = value;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public static WhatEventEnumType get(String key){
for (WhatEventEnumType dic : WhatEventEnumType.values()) {
if(dic.getId().equals(key)){
return dic;
}
}
return null;
}
}
package com.reyun.exception;
/**
* Created by nolan on 24/11/2016.
* description:
*/
public class TipException extends RuntimeException {
public TipException() {
}
public TipException(String message) {
super(message);
}
public TipException(String message, Throwable cause) {
super(message, cause);
}
public TipException(Throwable cause) {
super(cause);
}
public TipException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}
}
package com.reyun.exception;
/**
* Created by nolan on 18/11/2016.
* description:
*/
public class TransferCurrentAccountException extends RuntimeException {
}
package com.reyun.model;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
import java.util.List;
/**
* Created by nolan on 15/12/2016.
* description:
*/
public class ResultAuthModel {
private String retention;
private String pay;
private String isnatureopen;
@JsonIgnore
private List<ResultNode> nodes;
public String getRetention() {
return retention;
}
public void setRetention(String retention) {
this.retention = retention;
}
public String getPay() {
return pay;
}
public void setPay(String pay) {
this.pay = pay;
}
public String getIsnatureopen() {
return isnatureopen;
}
public void setIsnatureopen(String isnatureopen) {
this.isnatureopen = isnatureopen;
}
public List<ResultNode> getNodes() {
return nodes;
}
public void setNodes(List<ResultNode> nodes) {
this.nodes = nodes;
}
@Override
public String toString() {
return "ResultAuthModel{" +
"retention='" + retention + '\'' +
", pay='" + pay + '\'' +
", isnatureopen='" + isnatureopen + '\'' +
", nodes=" + nodes +
'}';
}
static class ResultNode {
private String name;
private String zh;
private String canselect;
private int parent;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getZh() {
return zh;
}
public void setZh(String zh) {
this.zh = zh;
}
public String getCanselect() {
return canselect;
}
public void setCanselect(String canselect) {
this.canselect = canselect;
}
public int getParent() {
return parent;
}
public void setParent(int parent) {
this.parent = parent;
}
@Override
public String toString() {
return "ResultNode{" +
"name='" + name + '\'' +
", zh='" + zh + '\'' +
", canselect='" + canselect + '\'' +
", parent=" + parent +
'}';
}
}
public static void main(String[] args) throws IOException {
String str = "{\n" +
" \"retention\": \"true\",\n" +
" \"pay\": \"false\",\n" +
" \"isnatureopen\": \"true\",\n" +
" \"nodes\": [\n" +
" {\n" +
" \"name\": \"transform\",\n" +
" \"zh\": \"转化分析\",\n" +
" \"canselect\": \"true\",\n" +
" \"parent\": 1\n" +
" },\n" +
" {\n" +
" \"name\": \"decisionsupport\",\n" +
" \"zh\": \"决策支持\",\n" +
" \"canselect\": \"true\",\n" +
" \"parent\": 1\n" +
" },\n" +
" {\n" +
" \"name\": \"campaignmanage\",\n" +
" \"zh\": \"活动管理\",\n" +
" \"canselect\": \"false\",\n" +
" \"parent\": 2\n" +
" },\n" +
" {\n" +
" \"name\": \"authmanage\",\n" +
" \"zh\": \"成员管理\",\n" +
" \"canselect\": \"false\",\n" +
" \"parent\": 3\n" +
" }\n" +
" ]\n" +
"}";
ResultAuthModel resultAuthModel = new ObjectMapper().readValue(str, ResultAuthModel.class);
}
}
package com.reyun.model;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Transient;
@Entity
public class Retention {
private Long id;
private Long account;
private Long app;
private String name;
private String eventInfo;
private String view;
private String startDate;
private String endDate;
private int relativeTime;
private String retentionType;
private Long createAccount;
private Date createTime = new Date();
private Date modifyTime = new Date();
private Long modifyAccount;
private Boolean delFlag;
private String cAccount;
private String mAcoucnt;
@Id
@GeneratedValue
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getAccount() {
return account;
}
public void setAccount(Long account) {
this.account = account;
}
public Long getApp() {
return app;
}
public void setApp(Long app) {
this.app = app;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getEventInfo() {
return eventInfo;
}
public void setEventInfo(String eventInfo) {
this.eventInfo = eventInfo;
}
public Long getCreateAccount() {
return createAccount;
}
public void setCreateAccount(Long createAccount) {
this.createAccount = createAccount;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getModifyTime() {
return modifyTime;
}
public void setModifyTime(Date modifyTime) {
this.modifyTime = modifyTime;
}
public Long getModifyAccount() {
return modifyAccount;
}
public void setModifyAccount(Long modifyAccount) {
this.modifyAccount = modifyAccount;
}
public Boolean getDelFlag() {
return delFlag;
}
public void setDelFlag(Boolean delFlag) {
this.delFlag = delFlag;
}
@Transient
@Column(name="cAccount" )
public String getcAccount() {
return cAccount;
}
public void setcAccount(String cAccount) {
this.cAccount = cAccount;
}
@Transient
public String getmAcoucnt() {
return mAcoucnt;
}
public void setmAcoucnt(String mAcoucnt) {
this.mAcoucnt = mAcoucnt;
}
public String getView() {
return view;
}
public void setView(String view) {
this.view = view;
}
public String getStartDate() {
return startDate;
}
public void setStartDate(String startDate) {
this.startDate = startDate;
}
public String getEndDate() {
return endDate;
}
public void setEndDate(String endDate) {
this.endDate = endDate;
}
public int getRelativeTime() {
return relativeTime;
}
public void setRelativeTime(int relativeTime) {
this.relativeTime = relativeTime;
}
public String getRetentionType() {
return retentionType;
}
public void setRetentionType(String retentionType) {
this.retentionType = retentionType;
}
}
package com.reyun.model;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Transient;
import java.util.Date;
import java.util.List;
@Entity
public class RoleAuth {
private Long id;
private Long roleCategory;
private String auth;
private Boolean payAuth;
private Boolean retentionAuth;
private Boolean isNatureOpen;
private Boolean topAuth;
private String roleName;
private Long createAccount;
private Date createTime;
private Long modifyAccount;
private Date modifyTime;
private Boolean delFlag;
//@Transient
private List<RoleAuthDetail> roleAuthDetails;
@Id
@GeneratedValue
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getRoleCategory() {
return roleCategory;
}
public void setRoleCategory(Long roleCategory) {
this.roleCategory = roleCategory;
}
public String getAuth() {
return auth;
}
public void setAuth(String auth) {
this.auth = auth;
}
public Boolean getPayAuth() {
return payAuth;
}
public void setPayAuth(Boolean payAuth) {
this.payAuth = payAuth;
}
public Boolean getRetentionAuth() {
return retentionAuth;
}
public void setRetentionAuth(Boolean retentionAuth) {
this.retentionAuth = retentionAuth;
}
public Boolean getIsNatureOpen() {
return isNatureOpen;
}
public void setIsNatureOpen(Boolean isNatureOpen) {
this.isNatureOpen = isNatureOpen;
}
public Boolean getTopAuth() {
return topAuth;
}
public void setTopAuth(Boolean topAuth) {
this.topAuth = topAuth;
}
public String getRoleName() {
return roleName;
}
public void setRoleName(String roleName) {
this.roleName = roleName;
}
public Long getCreateAccount() {
return createAccount;
}
public void setCreateAccount(Long createAccount) {
this.createAccount = createAccount;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Long getModifyAccount() {
return modifyAccount;
}
public void setModifyAccount(Long modifyAccount) {
this.modifyAccount = modifyAccount;
}
public Date getModifyTime() {
return modifyTime;
}
public void setModifyTime(Date modifyTime) {
this.modifyTime = modifyTime;
}
public Boolean getDelFlag() {
return delFlag;
}
public void setDelFlag(Boolean delFlag) {
this.delFlag = delFlag;
}
@Transient
public List<RoleAuthDetail> getRoleAuthDetails() {
return roleAuthDetails;
}
public void setRoleAuthDetails(List<RoleAuthDetail> roleAuthDetails) {
this.roleAuthDetails = roleAuthDetails;
}
@Override
public String toString() {
return "RoleAuth [id=" + id + ", roleCategory=" + roleCategory
+ ", auth=" + auth + "]";
}
}
package com.reyun.model;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
/**
* Created by sunhao on 17/6/6.
* description:角色权限的详情
*/
@Entity
public class RoleAuthDetail {
private Long id;
private String auth;
private String authName;
private String parentAuth;
private int sort;
private Boolean view;
private Boolean edit;
private Long roleId;
public RoleAuthDetail() {}
public RoleAuthDetail(RoleAuthDetail roleAuthDetail) {
this.auth = roleAuthDetail.getAuth();
this.authName = roleAuthDetail.getAuthName();
this.parentAuth = roleAuthDetail.getParentAuth();
this.sort = roleAuthDetail.getSort();
this.view = roleAuthDetail.getView();
this.edit = roleAuthDetail.getEdit();
this.roleId = roleAuthDetail.getRoleId();
}
@Id
@GeneratedValue
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getAuth() {
return auth;
}
public void setAuth(String auth) {
this.auth = auth;
}
public String getAuthName() {
return authName;
}
public void setAuthName(String authName) {
this.authName = authName;
}
public String getParentAuth() {
return parentAuth;
}
public void setParentAuth(String parentAuth) {
this.parentAuth = parentAuth;
}
public int getSort() {
return sort;
}
public void setSort(int sort) {
this.sort = sort;
}
public Boolean getView() {
return view;
}
public void setView(Boolean view) {
this.view = view;
}
public Boolean getEdit() {
return edit;
}
public void setEdit(Boolean edit) {
this.edit = edit;
}
public Long getRoleId() {
return roleId;
}
public void setRoleId(Long roleId) {
this.roleId = roleId;
}
}
package com.reyun.model;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
@Entity
public class RoleCategory {
private Long id;
private String name;
private String menu;
private boolean canselect;
private boolean pay;
private boolean isnatureopen;
private boolean retention;
private int parent;
private int role;
private String rolename;
private String descp;
public RoleCategory() {
super();
}
public RoleCategory(Long id, String name, String menu) {
super();
this.id = id;
this.name = name;
this.menu = menu;
}
@Id
@GeneratedValue
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getMenu() {
return menu;
}
public void setMenu(String menu) {
this.menu = menu;
}
public boolean isCanselect() {
return canselect;
}
public void setCanselect(boolean canselect) {
this.canselect = canselect;
}
public boolean isPay() {
return pay;
}
public void setPay(boolean pay) {
this.pay = pay;
}
public boolean isIsnatureopen() {
return isnatureopen;
}
public void setIsnatureopen(boolean isnatureopen) {
this.isnatureopen = isnatureopen;
}
public boolean isRetention() {
return retention;
}
public void setRetention(boolean retention) {
this.retention = retention;
}
public int getParent() {
return parent;
}
public void setParent(int parent) {
this.parent = parent;
}
public int getRole() {
return role;
}
public void setRole(int role) {
this.role = role;
}
public String getRolename() {
return rolename;
}
public void setRolename(String rolename) {
this.rolename = rolename;
}
public String getDescp() {
return descp;
}
public void setDescp(String descp) {
this.descp = descp;
}
}
package com.reyun.model;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
@Entity
public class SalesManLeader {
private int id;
private String area;
private String email;
private String name;
private int leader;
@Id
@GeneratedValue
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getArea() {
return area;
}
public void setArea(String area) {
this.area = area;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getLeader() {
return leader;
}
public void setLeader(int leader) {
this.leader = leader;
}
}
package com.reyun.model;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.validation.constraints.NotNull;
@Entity
public class SystemParam {
private Long id;
private Long account;
private int clickDay;
private int installDay;
private int ciDay;
private int cilag;
private int normalclick;
private int normalinstall;
//作弊参数设置状态
private Boolean cheatStatus;
//黑名单库状态
private Boolean blacklistStatus;
//防作弊等级
private Integer blacklistLevel;
//等级对应的渠道个数
private Integer channelNum;
private Date pubDate;
private Date modifyTime = new Date();
private Long modifyAccount;
@Id
@GeneratedValue
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getAccount() {
return account;
}
public void setAccount(Long account) {
this.account = account;
}
public int getClickDay() {
return clickDay;
}
public void setClickDay(int clickDay) {
this.clickDay = clickDay;
}
public int getInstallDay() {
return installDay;
}
public void setInstallDay(int installDay) {
this.installDay = installDay;
}
public int getCiDay() {
return ciDay;
}
public void setCiDay(int ciDay) {
this.ciDay = ciDay;
}
public int getCilag() {
return cilag;
}
public void setCilag(int cilag) {
this.cilag = cilag;
}
public int getNormalclick() {
return normalclick;
}
public void setNormalclick(int normalclick) {
this.normalclick = normalclick;
}
public int getNormalinstall() {
return normalinstall;
}
public void setNormalinstall(int normalinstall) {
this.normalinstall = normalinstall;
}
public Date getPubDate() {
return pubDate;
}
public void setPubDate(Date pubDate) {
this.pubDate = pubDate;
}
public Date getModifyTime() {
return modifyTime;
}
public void setModifyTime(Date modifyTime) {
this.modifyTime = modifyTime;
}
public Long getModifyAccount() {
return modifyAccount;
}
public void setModifyAccount(Long modifyAccount) {
this.modifyAccount = modifyAccount;
}
public Boolean getCheatStatus() {
return cheatStatus;
}
public void setCheatStatus(Boolean cheatStatus) {
this.cheatStatus = cheatStatus;
}
public Boolean getBlacklistStatus() {
return blacklistStatus;
}
public void setBlacklistStatus(Boolean blacklistStatus) {
this.blacklistStatus = blacklistStatus;
}
public Integer getBlacklistLevel() {
return blacklistLevel;
}
public void setBlacklistLevel(Integer blacklistLevel) {
this.blacklistLevel = blacklistLevel;
}
public Integer getChannelNum() {
return channelNum;
}
public void setChannelNum(Integer channelNum) {
this.channelNum = channelNum;
}
}
package com.reyun.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
@Entity
public class Tip {
private Long id;
private String menu;
private String key;
private String tip;
@Id
@GeneratedValue
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getMenu() {
return menu;
}
public void setMenu(String menu) {
this.menu = menu;
}
@Column(name="`key`")
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getTip() {
return tip;
}
public void setTip(String tip) {
this.tip = tip;
}
}
package com.reyun.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
@Entity
public class Translation {
private Long id;
private String codename;
private String chname;
private String twname;
private String esname;
@Id
@GeneratedValue
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
@Column(unique = true, nullable = false)
public String getCodename() {
return codename;
}
public void setCodename(String codename) {
this.codename = codename;
}
public String getChname() {
return chname;
}
public void setChname(String chname) {
this.chname = chname;
}
public String getTwname() {
return twname;
}
public void setTwname(String twname) {
this.twname = twname;
}
public String getEsname() {
return esname;
}
public void setEsname(String esname) {
this.esname = esname;
}
}
package com.reyun.model;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Transient;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* Created by sunhao on 17/5/22.
* desc:上传记录表
*/
@Entity
public class UploadHistory {
private Long id;
private String uploadData;
//格式错误数据行数
private List<Integer> uploadErrorList;
//与数据库重复行数
private List<Integer> uploadRepeatedList;
//表内重复行数
private List<List<Integer>> innerRepeatList;
//读取数据中间存储
private Map<String, Map<Integer, String>> keywordCreativeMap;
private Long accountId;
private Long campaignId;
private Date uploadTime;
private int rowNumber;
private String errorType;
@Id
@GeneratedValue
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getUploadData() {
return uploadData;
}
public void setUploadData(String uploadData) {
this.uploadData = uploadData;
}
@Transient
public List<Integer> getUploadErrorList() {
return uploadErrorList;
}
public void setUploadErrorList(List<Integer> uploadErrorList) {
this.uploadErrorList = uploadErrorList;
}
@Transient
public List<Integer> getUploadRepeatedList() {
return uploadRepeatedList;
}
public void setUploadRepeatedList(List<Integer> uploadRepeatedList) {
this.uploadRepeatedList = uploadRepeatedList;
}
@Transient
public List<List<Integer>> getInnerRepeatList() {
return innerRepeatList;
}
public void setInnerRepeatList(List<List<Integer>> innerRepeatList) {
this.innerRepeatList = innerRepeatList;
}
@Transient
public Map<String, Map<Integer, String>> getKeywordCreativeMap() {
return keywordCreativeMap;
}
public void setKeywordCreativeMap(Map<String, Map<Integer, String>> keywordCreativeMap) {
this.keywordCreativeMap = keywordCreativeMap;
}
public Long getAccountId() {
return accountId;
}
public void setAccountId(Long accountId) {
this.accountId = accountId;
}
public Long getCampaignId() {
return campaignId;
}
public void setCampaignId(Long campaignId) {
this.campaignId = campaignId;
}
public Date getUploadTime() {
return uploadTime;
}
public void setUploadTime(Date uploadTime) {
this.uploadTime = uploadTime;
}
public int getRowNumber() {
return rowNumber;
}
public void setRowNumber(int rowNumber) {
this.rowNumber = rowNumber;
}
@Transient
public String getErrorType() {
return errorType;
}
public void setErrorType(String errorType) {
this.errorType = errorType;
}
}
package com.reyun.model;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Transient;
import javax.validation.constraints.NotNull;
@Entity
public class UserGroup {
private Long id;
private Long account;
private Long app;
private String name;
private String mark;
// 1:新增; 2:所有
private int userType;
private String profileInfo;
private String eventInfo;
private String startDate;
private String endDate;
private Long number;
private Date dataUpdateTime;
private String querySql;
private int status;
private Long createAccount;
private Date createTime = new Date();
private Date modifyTime = new Date();
private Long modifyAccount;
private Boolean delFlag;
private String cAccount;
private String mAccount;
@Id
@GeneratedValue
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getAccount() {
return account;
}
public void setAccount(Long account) {
this.account = account;
}
public Long getApp() {
return app;
}
public void setApp(Long app) {
this.app = app;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getMark() {
return mark;
}
public void setMark(String mark) {
this.mark = mark;
}
public int getUserType() {
return userType;
}
public void setUserType(int userType) {
this.userType = userType;
}
public String getProfileInfo() {
return profileInfo;
}
public void setProfileInfo(String profileInfo) {
this.profileInfo = profileInfo;
}
public String getEventInfo() {
return eventInfo;
}
public void setEventInfo(String eventInfo) {
this.eventInfo = eventInfo;
}
public String getStartDate() {
return startDate;
}
public void setStartDate(String startDate) {
this.startDate = startDate;
}
public String getEndDate() {
return endDate;
}
public void setEndDate(String endDate) {
this.endDate = endDate;
}
public Long getCreateAccount() {
return createAccount;
}
public void setCreateAccount(Long createAccount) {
this.createAccount = createAccount;
}
public Long getNumber() {
return number;
}
public void setNumber(Long number) {
this.number = number;
}
public Date getDataUpdateTime() {
return dataUpdateTime;
}
public void setDataUpdateTime(Date dataUpdateTime) {
this.dataUpdateTime = dataUpdateTime;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getModifyTime() {
return modifyTime;
}
public void setModifyTime(Date modifyTime) {
this.modifyTime = modifyTime;
}
public Long getModifyAccount() {
return modifyAccount;
}
public void setModifyAccount(Long modifyAccount) {
this.modifyAccount = modifyAccount;
}
public Boolean getDelFlag() {
return delFlag;
}
public void setDelFlag(Boolean delFlag) {
this.delFlag = delFlag;
}
public String getQuerySql() {
return querySql;
}
public void setQuerySql(String querySql) {
this.querySql = querySql;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
@Transient
public String getcAccount() {
return cAccount;
}
public void setcAccount(String cAccount) {
this.cAccount = cAccount;
}
@Transient
public String getmAccount() {
return mAccount;
}
public void setmAccount(String mAccount) {
this.mAccount = mAccount;
}
}
package com.reyun.model;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
@Entity
public class UserLog {
private Long id;
private String type;
private String email;
private boolean isMasterLogin;
private String operaType;
@Column(length=2000)
private String operaContent;
private Date pubDate = new Date();
private String ds;
private Long app;
private String appName;
private String objectType;
private String ip;
private String location;
public UserLog() {
super();
}
public String getEmail() {
return email;
}
@Id
@GeneratedValue
public Long getId() {
return id;
}
public Date getPubDate() {
return pubDate;
}
public void setEmail(String email) {
this.email = email;
}
public void setId(Long id) {
this.id = id;
}
public void setPubDate(Date pubDate) {
this.pubDate = pubDate;
}
public String getOperaType() {
return operaType;
}
public void setOperaType(String operaType) {
this.operaType = operaType;
}
public String getOperaContent() {
return operaContent;
}
public void setOperaContent(String operaContent) {
this.operaContent = operaContent;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getDs() {
return ds;
}
public void setDs(String ds) {
this.ds = ds;
}
public Long getApp() {
return app;
}
public void setApp(Long app) {
this.app = app;
}
public String getAppName() {
return appName;
}
public void setAppName(String appName) {
this.appName = appName;
}
public String getObjectType() {
return objectType;
}
public void setObjectType(String objectType) {
this.objectType = objectType;
}
public String getIp() {
return ip;
}
public void setIp(String ip) {
this.ip = ip;
}
public String getLocation() {
return location;
}
public void setLocation(String location) {
this.location = location;
}
public boolean isMasterLogin() {
return isMasterLogin;
}
public void setMasterLogin(boolean isMasterLogin) {
this.isMasterLogin = isMasterLogin;
}
@Override
public String toString()
{
return "UserLog{" +
"id=" + id +
", type='" + type + '\'' +
", email='" + email + '\'' +
", isMasterLogin=" + isMasterLogin +
", operaType='" + operaType + '\'' +
", operaContent='" + operaContent + '\'' +
", pubDate=" + pubDate +
", ds='" + ds + '\'' +
", app=" + app +
", appName='" + appName + '\'' +
", objectType='" + objectType + '\'' +
", ip='" + ip + '\'' +
", location='" + location + '\'' +
'}';
}
}
package com.reyun.model;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.util.Date;
/**
* Created by sunhao on 17/3/1.
*/
@Table(uniqueConstraints = @UniqueConstraint(columnNames={"noticeid","accountid"}))
@Entity
public class UserNoticeLog {
private Long id;
@NotNull
private Long noticeid;
@NotNull
private Long accountid;
@NotNull
private Date readdate;
public UserNoticeLog(){super();}
public UserNoticeLog(Long noticeId, Long accountId,Date readDate)
{
this.noticeid = noticeId;
this.accountid = accountId;
this.readdate = readDate;
}
@Id
@GeneratedValue
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Date getReaddate() {
return readdate;
}
public void setReaddate(Date readdate) {
this.readdate = readdate;
}
public Long getNoticeid() {
return noticeid;
}
public void setNoticeid(Long noticeid) {
this.noticeid = noticeid;
}
public Long getAccountid() {
return accountid;
}
public void setAccountid(Long accountid) {
this.accountid = accountid;
}
}
package com.reyun.model;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
/**
* Created by nolan on 28/12/2016.
* description:
*/
@Entity
public class UserViewColumn {
private Long id;
private Long account;
private String viewcolumn;
@Id
@GeneratedValue
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getAccount() {
return account;
}
public void setAccount(Long account) {
this.account = account;
}
public String getViewcolumn() {
return viewcolumn;
}
public void setViewcolumn(String viewcolumn) {
this.viewcolumn = viewcolumn;
}
}
package com.reyun.model;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
/**
* Created by nolan on 28/12/2016.
* description:
*/
@Entity
public class ViewColumn {
private Long id; //主键
private String fieldcode; //字段编码
private String fieldname; //字段名称
private Boolean ischeck; //是否缺省选中
private Boolean isedit; //是否可编辑
private String type;
@Id
@GeneratedValue
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getFieldcode() {
return fieldcode;
}
public void setFieldcode(String fieldcode) {
this.fieldcode = fieldcode;
}
public String getFieldname() {
return fieldname;
}
public void setFieldname(String fieldname) {
this.fieldname = fieldname;
}
public Boolean getIscheck() {
return ischeck;
}
public void setIscheck(Boolean ischeck) {
this.ischeck = ischeck;
}
public Boolean getIsedit() {
return isedit;
}
public void setIsedit(Boolean isedit) {
this.isedit = isedit;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
}
package com.reyun.model;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Transient;
import java.util.Date;
/**
* C by song on 2017/9/4.
*/
@Entity
public class VirtualEvent {
private Long id;
private Long appId;
private String name;
private String eventList;
private String type;
private Long createAccount;
private Date createTime = new Date();
private Long modifyAccount;
private Date modifyTime = new Date();
private boolean isEnable;
private String ch_name;
private String eventListName;
@Id
@GeneratedValue
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getAppId() {
return appId;
}
public void setAppId(Long appId) {
this.appId = appId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getEventList() {
return eventList;
}
public void setEventList(String eventList) {
this.eventList = eventList;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public Long getCreateAccount() {
return createAccount;
}
public void setCreateAccount(Long createAccount) {
this.createAccount = createAccount;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Long getModifyAccount() {
return modifyAccount;
}
public void setModifyAccount(Long modifyAccount) {
this.modifyAccount = modifyAccount;
}
public Date getModifyTime() {
return modifyTime;
}
public void setModifyTime(Date modifyTime) {
this.modifyTime = modifyTime;
}
public boolean isEnable() {
return isEnable;
}
public void setEnable(boolean enable) {
isEnable = enable;
}
public String getCh_name() {
return ch_name;
}
public void setCh_name(String ch_name) {
this.ch_name = ch_name;
}
@Transient
public String getEventListName() {
return eventListName;
}
public void setEventListName(String eventListName) {
this.eventListName = eventListName;
}
@Override
public String toString() {
return "VirtualEvent{" +
"id=" + id +
", appId=" + appId +
", name='" + name + '\'' +
", eventList='" + eventList + '\'' +
", type='" + type + '\'' +
", createAccount=" + createAccount +
", createTime=" + createTime +
", modifyAccount='" + modifyAccount + '\'' +
", modifyTime=" + modifyTime +
", isEnable=" + isEnable +
'}';
}
}
/*
package com.reyun.ops;
import com.amazonaws.services.dynamodbv2.document.*;
import com.amazonaws.services.dynamodbv2.model.WriteRequest;
import com.google.common.base.Predicate;
import com.google.common.base.Strings;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.reyun.model.SurlModel;
import com.reyun.util.*;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.sql.*;
import java.util.*;
import java.util.Date;
import java.util.concurrent.*;
*/
/**
* Created by nolan on 13/02/2017.
* description:
*//*
public class SurlOpsMain {
private final static Logger logger = LoggerFactory.getLogger(SurlOpsMain.class);
public static void main(String[] args) {
if (Constant.awsneed) {
updateAWSRedis();
}
}
public static List<SurlModel> updateAWSDynamodb(Long appid, int threadsize, final int recordsize, boolean isTest) throws SQLException, InterruptedException {
logger.info("启动配置: 线程数/{}, 单线程处理记录数/{}", threadsize, recordsize);
final List<SurlModel> list;
if (appid != null) {
list = querySurlByAppId(appid);
} else {
list = queryAllSurls();
}
final Integer totalnum;
final Integer pagenum;
if(isTest){
pagenum = 1;
totalnum = recordsize;
}else {
totalnum = list != null ? list.size() : 0;
pagenum = totalnum % recordsize == 0 ? totalnum / recordsize : totalnum / recordsize + 1;
}
logger.info("总计记录数:{},总页数: {}......", totalnum, pagenum);
List<SurlModel> rtnList = Lists.newArrayList();
ExecutorService exec = Executors.newFixedThreadPool(threadsize);
final Semaphore semaphore = new Semaphore(threadsize);
List<Future<List<SurlModel>>> cblist = Lists.newArrayList();
for (int i = 0; i < pagenum; i++) {
try {
semaphore.acquire();
} catch (InterruptedException e) {
logger.error("InterruptedException pagenum:{}", i);
e.printStackTrace();
throw e;
}
logger.info("运行第{}页, 每页{}条......", i+1, recordsize);
final int index = i;
cblist.add(exec.submit(new Callable<List<SurlModel>>() {
@Override
public List<SurlModel> call() throws Exception {
List<SurlModel> subtasklist = list.subList(index * recordsize, (index + 1) == pagenum ? totalnum : ((index + 1) * recordsize));
if (subtasklist == null || subtasklist.size() == 0)
return Lists.newArrayList();
List<SurlModel> errorList = Lists.newArrayList();
List<Item> awsitemlist = Lists.newArrayList();
for (SurlModel item : subtasklist) {
Map<String, Object> attributes = BeanUtils.bean2Map(item);
attributes = Maps.filterValues(attributes, new Predicate<Object>() {
@Override
public boolean apply(Object s) {
return s != null && !Strings.isNullOrEmpty(String.valueOf(s));
}
});
if(!attributes.containsKey("surl")){
errorList.add(item);
}else{
awsitemlist.add(Item.fromMap(attributes));
}
}
BatchWriteItemOutcome batchWriteItemOutcome = null;
try {
batchWriteItemOutcome = DynamoDBUtil.getInstance().getDynamoDB().batchWriteItem(new TableWriteItems(SurlModel.TABLE).withItemsToPut(awsitemlist));
} catch (Exception e) {
logger.info("awsitemlist: {}", awsitemlist);
throw e;
}
do {
Map<String, List<WriteRequest>> unprocessedItems = batchWriteItemOutcome.getUnprocessedItems();
if (batchWriteItemOutcome.getUnprocessedItems().size() == 0) {
logger.info("No unprocessed items found");
} else {
batchWriteItemOutcome = DynamoDBUtil.getInstance().getDynamoDB().batchWriteItemUnprocessed(unprocessedItems);
}
} while (batchWriteItemOutcome.getUnprocessedItems().size() > 0);
semaphore.release();
return errorList;
}
}));
}
for(Future<List<SurlModel>> cb : cblist){
try {
final List<SurlModel> c = cb.get();
if (c != null && c.size() > 0) {
rtnList.addAll(c);
}
} catch (ExecutionException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
exec.shutdown();
logger.info("总计记录数:{},总页数: {}......//END", totalnum, pagenum);
return rtnList;
}
public static void updateAWSRedis() {
if (Constant.awsneed) {
List<Map<String, String>> dbList = new ArrayList<Map<String, String>>();
try {
dbList = queryAWSFalse();
} catch (SQLException e) {
String subject = "Fail to query data from DB, which need to update to AWS redis.";
try {
MailUtils.sendSimpleEmail(subject, subject, Constant.mlist);
} catch (Exception e1) {
logger.error("Fail to send email to inform fail of query data from DB" + e1.getMessage());
}
}
if (dbList.size() > 0) {
InetAddress addr = null;
try {
addr = InetAddress.getLocalHost();
} catch (UnknownHostException e) {
logger.error("Fail to get local ip.." + e.getMessage());
}
String ip = addr!=null?addr.getHostAddress():"";
String tokenStr = "zhangxiaoyan_" + DateUtil.format(new Date(), DateUtil.C_DATE_PATTON_DEFAULT);
String token = CipherUtil.generatePassword(tokenStr);
List<String> surlList = new ArrayList<String>();
List<String> campaignpackidList = new ArrayList<String>();
for (Map<String, String> m : dbList) {
Map attributes = Maps.filterValues(m, new Predicate<Object>() {
@Override
public boolean apply(Object s) {
return s != null && !Strings.isNullOrEmpty(String.valueOf(s));
}
});
Table tableModel = DynamoDBUtil.getInstance().getTable(SurlModel.TABLE);
final PutItemOutcome putItemOutcome = tableModel.putItem(Item.fromMap(attributes));
boolean isflag = putItemOutcome.getPutItemResult().getSdkHttpMetadata().getHttpStatusCode() == 200;
if(!isflag){
logger.error("Fail to update AWS dynamodb campaigninfo by surl: {}.", m.get("surl"));
}
m.put("method", "update");
m.put("token", token);
try {
boolean success = HttpClientUtil.httpAWS(m, ip, m.get("surl"), Constant.awsurl);
if (success) {
if (!StringUtil.isEmpty(m.get("category")) && m.get("category").equals("APPMARKET")) {
String sac = m.get("surl");
String[] sacs = sac.split(":");
campaignpackidList.add(sacs[1]);
} else {
surlList.add(m.get("surl"));
}
}
} catch (Exception e) {
logger.error("Fail to update AWS redis campaigninfo by surl:" + m.get("surl") + "from database..." + e.getMessage());
}
}
if (surlList.size() > 0) {
String surlstr = "'" + StringUtils.join(surlList, "','") + "'";
try {
updateStatusInMysql(surlstr);
} catch (SQLException e) {
logger.error("Fail to update db table campaign's awssuccess filed." + e.getMessage());
}
}
if (campaignpackidList.size() > 0) {
String idstr = "'" + StringUtils.join(campaignpackidList, "','") + "'";
try {
updateStatusInMysqlId(idstr);
} catch (SQLException e) {
logger.error("Fail to update db table campaign's awssuccess filed." + e.getMessage());
}
}
} else {
logger.info("There is no data need to update AWS redis...");
}
}
}
public static List<Map<String, String>> queryAWSFalse() throws SQLException {
DBUtil dbUtil = DBUtil.newInstance();
String sql = "select c.channel, c.channelid,c.name,c.url,c.special_keys,c.surl,c.campaignpackid,a.appkey,a.url as appurl,ch.name as channelname,ch.unique_name,ch.category from campaign c, app a, channel ch where c.awssuccess=false and a.id=c.app and ch.id=c.channel";
Connection conn = dbUtil.getConn();
Statement st = conn.createStatement();
ResultSet rs = st.executeQuery(sql);
List<Map<String, String>> list = new ArrayList<Map<String, String>>();
while (rs.next()) {
String channelcategory = rs.getString("category");
String surl = rs.getString("surl");
if (!StringUtil.isEmpty(channelcategory) && channelcategory.equals("APPMARKET")) {
surl = rs.getString("appkey")+":"+rs.getString("campaignpackid");
}
Map<String, String> inner = new HashMap<String, String>();
inner.put("surl", surl);
inner.put("name", rs.getString("name"));
inner.put("channelid", rs.getString("channelid"));
String uniq = rs.getString("unique_name");
inner.put("channelname", StringUtil.isEmpty(uniq) ? "" : uniq);
inner.put("channel", rs.getString("channelname"));
inner.put("cid", rs.getString("channel"));
inner.put("appid", rs.getString("appkey"));
String special = rs.getString("special_keys");
if (!StringUtil.isEmpty(special)) {
inner.put("specialkeys", special);
}
inner.put("category", channelcategory);
String appurl = rs.getString("appurl");
String url = rs.getString("url");
inner.put("url", StringUtil.isEmpty(url) ? appurl : url);
list.add(inner);
}
if (rs != null) {
rs.close();
}
if (st != null) {
rs.close();
}
if (conn != null) {
conn.close();
}
return list;
}
public static void updateStatusInMysql(String surlstr) throws SQLException {
DBUtil dbUtil = DBUtil.newInstance();
String sql = "update campaign set awssuccess=true where surl in ("+surlstr+")";
Connection conn = dbUtil.getConn();
PreparedStatement pdst = conn.prepareStatement(sql);
pdst.executeUpdate();
pdst.close();
conn.close();
}
public static void updateStatusInMysqlId(String idstr) throws SQLException {
DBUtil dbUtil = DBUtil.newInstance();
String sql = "update campaign set awssuccess=true where campaignpackid in ("+idstr+")";
Connection conn = dbUtil.getConn();
PreparedStatement pdst = conn.prepareStatement(sql);
pdst.executeUpdate();
pdst.close();
conn.close();
}
}
*/
package com.reyun.repository;
import java.math.BigInteger;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import com.reyun.model.Retention;
public interface RetentionRepository extends JpaRepository<Retention, Long> {
@Query(value="select f.*,a.email as cAccount from retention f, account a where f.app=?1 and a.id = ?2 and f.del_flag is not true and a.id=f.create_account order by modify_time desc",nativeQuery = true)
List<Retention> findAllByApp(Long app , Long account);
@Query(value="select r.* from retention r where r.app=?1 and r.del_flag is not true order by r.modify_time desc",nativeQuery = true)
List<Retention> findAllByApp(Long app);
@Query(value="select * from retention where app=?2 and del_flag is not true and name=?1",nativeQuery=true)
Retention findByNameAndApp(String name, Long app);
@Query(value = "select count(*) from retention where create_account = 1? and app=?2 and name like ?3% ", nativeQuery = true)
BigInteger findCountLikeName(Long accountId, Long appId, String name);
}
package com.reyun.repository;
import com.reyun.model.RoleAuthDetail;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import java.util.List;
/**
* Created by sunhao on 17/6/7.
* Desc:权限详情DAO
*/
public interface RoleAuthDetailRepository extends JpaRepository<RoleAuthDetail,Long>{
@Query(value = "select * from role_auth_detail where role_id = ?1", nativeQuery = true)
List<RoleAuthDetail> findDetailByRole(Long roleId);
@Query(value = "select * from role_auth_detail where role_id = ?1 and (view is true or edit is true)", nativeQuery = true)
List<RoleAuthDetail> findValidDetailByRole(Long roleId);
}
package com.reyun.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import com.reyun.model.RoleAuth;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigInteger;
import java.util.Date;
import java.util.List;
public interface RoleAuthRepository extends JpaRepository<RoleAuth, Long> {
RoleAuth findByRoleCategory(Long id);
@Query(value = "select * from role_auth where id in ?1 ", nativeQuery = true)
List<RoleAuth> findCustomRoleList(List<Long> createAccounts);
@Query(value = "select * from role_auth where create_account in ?1 and del_flag is not true order by create_time desc ", nativeQuery = true)
List<RoleAuth> findAllCustomRoleList(List<Long> createAccounts);
@Query(value = "select count(*) from role_auth where create_account in ?1 and role_name = ?2 and del_flag is not true", nativeQuery = true)
BigInteger findByAccountAndName(List<Long> accountList, String roleName);
@Query(value = "select count(*) from role_auth where create_account in ?1 and role_category = 4 and del_flag is not true", nativeQuery = true)
BigInteger findCustomNumByAccount(List<Long> accountList);
@Transactional
@Modifying
@Query(value = "update role_auth set del_flag = true , modify_account = ?2, modify_time = ?3 where id = ?1 ", nativeQuery = true)
int deleteCustomRole(Long roleId, Long modifyAccount, Date modifyDate);
}
package com.reyun.repository;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;
import com.reyun.model.RoleCategory;
@Transactional
public interface RoleCategoryRepository extends JpaRepository<RoleCategory, Long> {
@Query(value="select * from role_category",nativeQuery=true)
List<RoleCategory> listAllRoleCategory();
@Query(value="select * from role_category where role = ?1",nativeQuery=true)
List<RoleCategory> listMenuAuthByRole(int role);
}
package com.reyun.repository;
import com.reyun.model.CommonParam;
import com.reyun.model.SalesManLeader;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;
@Transactional
public interface SalesManLeaderRepository extends JpaRepository<SalesManLeader, Long> {
@Query(value = "select email from sales_man_leader where id=(select leader from sales_man_leader where id=?1)", nativeQuery = true)
String findLeaderByBussinessMan(Long bussinessMan);
}
package com.reyun.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;
import com.reyun.model.SystemParam;
@Transactional
public interface SystemParamRepository extends JpaRepository<SystemParam, Long> {
@Query(value="select * from system_param where account = ?1",nativeQuery=true)
SystemParam findByAccount(Long account);
}
package com.reyun.repository;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;
import com.reyun.model.Tip;
@Transactional
public interface TipRepository extends JpaRepository<Tip, Long> {
@Query(value="select * from tip where menu=?1",nativeQuery=true)
List<Tip> findAllByMenu(String menu);
}
package com.reyun.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import com.reyun.model.Translation;
public interface TranslationRepository extends JpaRepository<Translation, Long> {
Translation findByCodename(String name);
}
package com.reyun.repository;
import com.reyun.model.UploadHistory;
import org.springframework.data.jpa.repository.JpaRepository;
/**
* Created by sunhao on 17/5/22.
* desc:数据上传历史记录DAO
*/
public interface UploadHistoryRepository extends JpaRepository<UploadHistory, Long> {
}
package com.reyun.repository;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import com.reyun.model.UserGroup;
public interface UserGroupRepository extends JpaRepository<UserGroup, Long> {
@Query(value="select * from usergroup where account = ?1",nativeQuery=true)
List<UserGroup> listByAccount(Long createAccount);
@Query(value="select * from user_group where app = ?1 and account = ?2 and del_flag is not true",nativeQuery=true)
List<UserGroup> listByApp(Long app,Long account);
@Query(value="select * from user_group where app = ?1 and del_flag is not true",nativeQuery=true)
List<UserGroup> listByApp(Long app);
UserGroup findByName(String name);
@Query(value="select * from user_group where app = ?1 and account = ?2 and name = ?3 and del_flag is not true",nativeQuery=true)
UserGroup findByName(Long app,Long account,String name);
}
package com.reyun.repository;
import com.reyun.model.UserLog;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import java.math.BigInteger;
import java.util.List;
public interface UserLogRepository extends JpaRepository<UserLog, Long> {
@Query(value = "select * from audit a where a.master_login is not true and a.email like %?1% and a.type=?2 and a.ds>=?3 and a.ds<=?4 order by a.pub_date desc limit ?5, ?6", nativeQuery = true)
List<UserLog> findAllByEmailAndType(String email, String type,
String startDate, String endDate, int start, int end);
@Query(value = "select * from audit a where a.master_login is not true and a.email like %?1% and a.ds>=?2 and a.ds<=?3 order by a.pub_date desc limit ?4, ?5", nativeQuery = true)
List<UserLog> findAllByEmail(String email, String startDate, String endDate,
int start, int end);
@Query(value = "select * from audit a where a.master_login is not true and a.type=?1 and a.ds>=?2 and a.ds<=?3 order by a.pub_date desc limit ?4, ?5", nativeQuery = true)
List<UserLog> findAllByType(String type, String startDate, String endDate,
int start, int end);
@Query(value = "select * from audit a where a.master_login is not true and a.ds>=?1 and a.ds<=?2 order by a.pub_date desc limit ?3, ?4", nativeQuery = true)
List<UserLog> findAll(String startDate, String endDate, int start, int end);
@Query(value = "select count(*) from audit a where a.master_login is not true and a.email like %?1% and a.type=?2 and a.ds>=?3 and a.ds<=?4", nativeQuery = true)
BigInteger getCount(String email, String type, String startDate, String endDate);
@Query(value = "select count(*) from audit a where a.master_login is not true and a.email like %?1% and a.ds>=?2 and a.ds<=?3", nativeQuery = true)
BigInteger getCountByEmail(String email, String startDate, String endDate);
@Query(value = "select count(*) from audit a where a.master_login is not true and a.type=?1 and a.ds>=?2 and a.ds<=?3", nativeQuery = true)
BigInteger getCountByType(String type, String startDate, String endDate);
@Query(value = "select count(*) from audit a where a.master_login is not true and a.ds>=?1 and a.ds<=?2", nativeQuery = true)
BigInteger getCount(String startDate, String endDate);
@Query(value = "select * from user_log where master_login is not true and email = ?1 and type = 'login' order by pub_date desc limit 4", nativeQuery = true)
List<UserLog> findRecentUserLog(String email);
}
package com.reyun.repository;
import com.reyun.model.UserNoticeLog;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* Created by sunhao on 17/3/1.
*/
@Transactional
public interface UserNoticeLogRepository extends JpaRepository<UserNoticeLog, Long> {
@Query(value = "select * from user_notice_log u where u.accountid = ?1 and u.noticeid in ?2 ",nativeQuery = true)
List<UserNoticeLog> listUserNoticeLog(Long accountId , List<Long> noticeIdList);
@Query(value = "select * from user_notice_log u where u.accountid = ?1 and u.noticeid = ?2", nativeQuery = true)
UserNoticeLog findUserNoticeLog(Long accountId , Long noticeId);
}
package com.reyun.repository;
import com.reyun.model.UserViewColumn;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
/**
* Created by nolan on 28/12/2016.
* description:
*/
public interface UserViewColumnRepository extends JpaRepository<UserViewColumn, Long> {
@Query(value = "select a from UserViewColumn a where a.account = ?1")
UserViewColumn findByAccount(Long accountid);
}
package com.reyun.repository;
import com.reyun.model.ViewColumn;
import org.springframework.data.jpa.repository.JpaRepository;
/**
* Created by nolan on 28/12/2016.
* description:
*/
public interface ViewColumnRepository extends JpaRepository<ViewColumn, Long> {
}
package com.reyun.repository;
import com.reyun.model.ConfigParam;
import com.reyun.model.VirtualEvent;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import java.util.List;
/**
* Created by song on 2017/9/4.
*/
public interface VirtualEventRepository extends JpaRepository<VirtualEvent, Long> {
@Query(value = "select * from virtual_event where app_id=?1 and type=?2", nativeQuery = true)
List<VirtualEvent> findEventListByAppIdAndType(Long appId, String type);
@Query(value = "select * from virtual_event where app_id=?1", nativeQuery = true)
List<VirtualEvent> findEventListByAppId(Long appId);
@Query(value = "select * from virtual_event where id=?1", nativeQuery = true)
List<VirtualEvent> findEventListById(Long id);
@Query(value = "select * from virtual_event where id!=?1", nativeQuery = true)
List<VirtualEvent> findEventListByIdNot(Long id);
@Query(value = "select * from virtual_event where name = ?1 limit 1", nativeQuery = true)
VirtualEvent findVirtualEventByEventId(String eventId);
@Query(value = "select b.* from virtual_event b left join app a on a.id = b.app_id where a.appkey = ?1 and b.ch_name = ?2 limit 1", nativeQuery = true)
VirtualEvent findVirtualEventByChName(String appKey, String eventId);
}
package com.reyun.security;
/**
* Created by nolan on 11/11/2016.
* description:
*/
public interface TokenManager {
void delMultiRelationshipByKey(String key);
/**
* 通过key删除关联关系
*
* @param key
*/
void delRelationshipByKey(String key);
/**
* 通过token删除关联关系
*
* @param token
*/
void delRelationshipByToken(String token);
/**
* 通过token获得对应的key
*
* @param token
* @return
*/
String getKeyFromToken(String token);
/**
* 通过key获得对应token
* @param key
* @return
*/
String getTokenFromKey(String key);
/**
* 根据key生成对应token
* @param key
* @return
*/
String createToken(String key);
}
package com.reyun.service;
import java.util.List;
import java.util.Map;
import com.reyun.model.Account;
import com.reyun.model.Retention;
public interface RetentionService {
Retention create(Retention retention, Long account);
Retention update(Retention retention, Long account);
Retention delete(Long id, Long account);
Retention findById(Long id);
List<Retention> findByApp(Long app);
Retention validName(String name, Long app);
Map<String, List> retentionReport(String startDate, String endDate, boolean isList, String eventInfo, Long app, String usergroup, String dimention, String reportView, int interval, boolean isDevice, Long account,String retentiontype,boolean isProfile);
Map<String, List> retentionDetailReport(Account account, String startDate, String endDate, boolean isList, String eventInfo, Long app, String usergroup, String dimention, String reportView, int interval, boolean isDevice, String retentiontype, boolean isProfile);
}
package com.reyun.service;
import com.reyun.model.SystemParam;
public interface SystemParamService {
public SystemParam create(Long account);
public SystemParam update(SystemParam systemParam,Long account);
public SystemParam find(Long account);
}
package com.reyun.service;
import java.util.List;
import java.util.Map;
import com.reyun.model.Tip;
public interface TipService {
public Map<String, String> findAllByMenu(String menu);
}
package com.reyun.service;
import com.reyun.model.UserGroup;
import java.util.List;
import java.util.Map;
public interface UserGroupService {
UserGroup save(UserGroup userGroup, Long account);
UserGroup update(UserGroup userGroup, Long account);
List<UserGroup> list(Long app, Long account);
List<UserGroup> list(Long app);
UserGroup findById(Long id);
UserGroup delete(Long id, Long account);
Boolean valid(Long account, Long app, String name);
Map<String,String> getSql(UserGroup userGroup);
boolean refresh(Long id);
}
package com.reyun.service;
import java.math.BigInteger;
import java.util.Date;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.reyun.model.Account;
import com.reyun.model.UserLog;
import com.reyun.util.DateUtil;
import com.reyun.util.StringUtil;
public interface UserLogService {
/**
* 插入审计日志
* @param account
* @param type
* @param content
* @return
*/
public boolean insertLog(Account account, String type, String typeName, Object object);
public boolean insertLog(Account account, String type, String typeName, Object object, HttpServletRequest request);
public boolean insertLog(Account account, String type, String typeName, Object object, Long app, String ObjectType);
public boolean insertLog(HttpServletRequest request, String type, String typeName, Long app, String ObjectType);
public boolean insertLog(Account account, String type, String typeName, Object object, Long app, String ObjectType,HttpServletRequest request);
public boolean insertLog(Account account, String type, String typeName, List object, Long app, String ObjectType,HttpServletRequest request);
public boolean insertLog(Account account, String type, String typeName, String content, Long app, String ObjectType,HttpServletRequest request);
/**
* 查询审计日志列表
* @param email
* @param type
* @param startDate
* @param endDate
* @param pageIndex
* @param pageSize
* @return
*/
public List<UserLog> findUserLogList(String email, String type, String startDate, String endDate, int pageIndex, int pageSize);
/**
* 查询满足条件的日志数量
* @param email
* @param type
* @param startDate
* @param endDate
* @return
*/
public BigInteger findUserLogCount(String email, String type, String startDate, String endDate);
}
package com.reyun.service;
import com.reyun.model.Account;
import com.reyun.model.Event4Web;
import com.reyun.model.VirtualEvent;
import java.util.List;
/**
* Created by song on 2017/9/4.
*/
public interface VirtualEventService {
List<VirtualEvent> findEventList(Long appId, Account account);
VirtualEvent updateEvent(Long appId, Account account, VirtualEvent virtualEvent);
List<Event4Web> findActiveEventList(Long appId, Long activeEventId);
List<Event4Web> unselectedEvent(Long app);
VirtualEvent userDefineVirtual(Long appId,VirtualEvent virtualEvent,Account account);
List<VirtualEvent> findCustomEventList(Long appId, Account loginAccount);
List<VirtualEvent> enableEvent(Long id);
List<VirtualEvent> disableEvent(Long id);
String findVirtualEvents(String virtualEventId);
List<String> findVirtualEventList(String virtualEventId);
VirtualEvent getVirtualEvent(String appKey, String eventChName);
}
package com.reyun.service.impl;
import java.util.Date;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.reyun.model.SystemParam;
import com.reyun.repository.SystemParamRepository;
import com.reyun.service.SystemParamService;
@Service
@Transactional
public class SystemParamServiceImpl implements SystemParamService {
@Autowired
SystemParamRepository systemParamRepository;
@Override
public SystemParam update(
SystemParam resource,Long account) {
SystemParam set = systemParamRepository.findOne(resource.getId());
if(resource.getCiDay() != 0){
set.setCiDay(resource.getCiDay());
}
if(resource.getCilag() != 0){
set.setCilag(resource.getCilag());
}
if(resource.getClickDay() != 0){
set.setClickDay(resource.getClickDay());
}
if(resource.getInstallDay() != 0){
set.setInstallDay(resource.getInstallDay());
}
if(resource.getNormalclick()!= 0){
set.setNormalclick(resource.getNormalclick());
}
if(resource.getNormalinstall() != 0){
set.setNormalinstall(resource.getNormalinstall());
}
set.setModifyAccount(account);
set.setModifyTime(new Date());
return systemParamRepository.save(set);
}
@Override
public SystemParam find(Long account) {
return systemParamRepository.findByAccount(account);
}
@Override
public SystemParam create(Long account) {
SystemParam systemParam = new SystemParam();
systemParam.setAccount(account);
systemParam.setCiDay(7);
systemParam.setCilag(5);
systemParam.setClickDay(30);
systemParam.setInstallDay(30);
systemParam.setNormalclick(30);
systemParam.setNormalinstall(30);
systemParam.setPubDate(new Date());
return systemParamRepository.save(systemParam);
}
}
package com.reyun.service.impl;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.reyun.model.Tip;
import com.reyun.repository.TipRepository;
import com.reyun.service.TipService;
@Service
public class TipServiceImpl implements TipService {
@Autowired
TipRepository tipRepository;
@Override
public Map<String, String> findAllByMenu(String menu) {
List<Tip> tips = tipRepository.findAllByMenu(menu);
Map<String, String> result = new HashMap<>();
for (Tip tip : tips) {
result.put(tip.getKey(), tip.getTip());
}
return result;
}
}
package com.reyun.service.impl;
import com.reyun.model.Account;
import com.reyun.model.App;
import com.reyun.model.UserLog;
import com.reyun.repository.AccountRepository;
import com.reyun.repository.AppRepository;
import com.reyun.repository.UserLogRepository;
import com.reyun.service.UserLogService;
import com.reyun.taskexecute.UserLogThread;
import com.reyun.util.DateUtil;
import com.reyun.util.IPAddrUtil;
import com.reyun.util.StringUtil;
import com.reyun.util.ValidateUtil;
import net.sf.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import java.math.BigInteger;
import java.util.Date;
import java.util.List;
@Service
public class UserLogServiceImpl implements UserLogService {
protected Logger logger = LoggerFactory.getLogger(UserLogServiceImpl.class);
@Autowired
UserLogRepository userLogRepository;
@Autowired
AccountRepository accountRepository;
@Autowired
AppRepository appRepository;
@Override
public boolean insertLog(Account account, String type, String typeName,
Object content) {
UserLogThread userLogThread = new UserLogThread(account.getEmail(), account.getIsMasterLogin(), type, typeName, content, null, null, null);
userLogThread.start();
return true;
}
@Override
public boolean insertLog(Account account, String type, String typeName,
Object content, HttpServletRequest request) {
UserLogThread userLogThread = new UserLogThread(account.getEmail(), account.getIsMasterLogin(), type, typeName, content, request, null, null);
userLogThread.start();
return true;
}
@Override
public boolean insertLog(Account account, String type, String typeName,
Object content, Long app, String objectType) {
UserLogThread userLogThread = new UserLogThread(account.getEmail(), account.getIsMasterLogin(), type, typeName, content, null, app, objectType);
userLogThread.start();
return true;
}
@Override
public boolean insertLog(HttpServletRequest request, String type, String typeName, Long app, String objectType) {
UserLogThread userLogThread = new UserLogThread("", false, type, typeName, "", request, app, objectType);
userLogThread.start();
return true;
}
@Override
public boolean insertLog(Account account, String type, String typeName,
Object content, Long app, String objectType,HttpServletRequest request) {
UserLogThread userLogThread = new UserLogThread(account.getEmail(), account.getIsMasterLogin(), type, typeName, content, request, app, objectType);
userLogThread.start();
return true;
}
@Override
public boolean insertLog(Account account, String type, String typeName,
List content, Long app, String objectType,HttpServletRequest request) {
UserLogThread userLogThread = new UserLogThread(account.getEmail(), account.getIsMasterLogin(), type, typeName, content, request, app, objectType);
userLogThread.start();
return true;
}
@Override
public boolean insertLog(Account account, String type, String typeName,
String content, Long app, String objectType,HttpServletRequest request) {
UserLogThread userLogThread = new UserLogThread(account.getEmail(), account.getIsMasterLogin(), type, typeName, content, request, app, objectType);
userLogThread.start();
return true;
}
@Override
public List<UserLog> findUserLogList(String email, String type,
String startDate, String endDate, int pageIndex, int pageSize) {
int start = pageIndex * pageSize;
if (!StringUtil.isEmpty(email) && !StringUtil.isEmpty(type)) {
return userLogRepository.findAllByEmailAndType(email, type, startDate, endDate, start, pageSize);
} else if (!StringUtil.isEmpty(email)) {
return userLogRepository.findAllByEmail(email, startDate, endDate, start, pageSize);
} else if (!StringUtil.isEmpty(type)) {
return userLogRepository.findAllByType(type, startDate, endDate, start, pageSize);
} else {
return userLogRepository.findAll(startDate, endDate, start, pageSize);
}
}
@Override
public BigInteger findUserLogCount(String email, String type,
String startDate, String endDate) {
if (!StringUtil.isEmpty(email) && !StringUtil.isEmpty(type)) {
return userLogRepository.getCount(email, type, startDate, endDate);
} else if (!StringUtil.isEmpty(email)) {
return userLogRepository.getCountByEmail(email, startDate, endDate);
} else if (!StringUtil.isEmpty(type)) {
return userLogRepository.getCountByType(type, startDate, endDate);
} else {
return userLogRepository.getCount(startDate, endDate);
}
}
}
package com.reyun.service.impl;
import com.google.common.base.Splitter;
import com.google.common.base.Strings;
import com.google.common.collect.Lists;
import com.reyun.model.UserViewColumn;
import com.reyun.model.ViewColumn;
import com.reyun.repository.UserViewColumnRepository;
import com.reyun.repository.ViewColumnRepository;
import com.reyun.service.IViewColumnService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* Created by nolan on 28/12/2016.
* description:
*/
@Service
public class ViewColumnServiceImpl implements IViewColumnService {
@Autowired
private ViewColumnRepository viewColumnRepository;
@Autowired
private UserViewColumnRepository userViewColumnRepository;
public List<ViewColumn> findUserViewColumns(Long accountid) {
List<ViewColumn> itemlist = viewColumnRepository.findAll();
UserViewColumn userViewColumn = userViewColumnRepository.findByAccount(accountid);
if (userViewColumn != null && !Strings.isNullOrEmpty(userViewColumn.getViewcolumn())) {
Iterable<String> viewcolumnList = Splitter.on(",").omitEmptyStrings().trimResults().split(userViewColumn.getViewcolumn());
List<String> fieldCodeList = Lists.newArrayList(viewcolumnList);
for (int i = 0; i < itemlist.size(); i++) {
ViewColumn viewColumn = itemlist.get(i);
if (fieldCodeList.contains(viewColumn.getFieldcode())) {
viewColumn.setIscheck(true);
}
}
}
return itemlist;
}
public void saveUserViewColumn(Long accountid, String viewcolumn) {
UserViewColumn userViewColumn = this.userViewColumnRepository.findByAccount(accountid);
if (userViewColumn == null) {
userViewColumn = new UserViewColumn();
userViewColumn.setAccount(accountid);
userViewColumn.setViewcolumn(viewcolumn);
this.userViewColumnRepository.saveAndFlush(userViewColumn);
} else {
userViewColumn.setViewcolumn(viewcolumn);
this.userViewColumnRepository.saveAndFlush(userViewColumn);
}
}
}
package com.reyun.taskexecute;
import com.reyun.context.AppUtils;
import com.reyun.model.UserGroup;
import com.reyun.service.ReportService;
import com.reyun.util.Constant;
import com.reyun.util.DBUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class UserGroupThread extends Thread {
protected static Logger logger = LoggerFactory.getLogger(UserGroupThread.class);
private ReportService reportService = AppUtils.getApplicationContext().getBean(ReportService.class);
private UserGroup userGroup;
private Boolean isExist;
public UserGroupThread(UserGroup userGroup, Boolean isExist) {
super();
this.userGroup = userGroup;
this.isExist = isExist;
}
@Override
public void run() {
if (isExist) {
String deleteSql = "ALTER TABLE " + Constant.usergroupTable + " DROP IF EXISTS PARTITION(id = '"
+ userGroup.getId() + "')";
Map<String, String> deleteCondition = new HashMap<String, String>();
deleteCondition.put("sql", deleteSql);
deleteCondition.put("dbtype", "hive");
reportService.execute(deleteSql);
}
String querySql = userGroup.getQuerySql();
String insertSql = "INSERT into " + Constant.usergroupTable + " select DISTINCT(xwho),'xwho','"
+ userGroup.getId() + "' from (" + querySql + ") t;";
//String deviceSql = insertSql.replace("xwho", "_deviceid");
String sql = "SELECT count(objectid) as number from " + Constant.usergroupTable + " where id = '"
+ userGroup.getId() + "' and objecttype='xwho'";
//String query = insertSql + deviceSql + sql;
String query = insertSql + sql;
Map<String, String> conditions = new HashMap<String, String>();
conditions.put("sql", query);
conditions.put("dbtype", "presto");
conditions.put("datatype", "list");
Map<String, List> result = reportService.reportBySql(conditions);
Long number = 0L;
if (result.containsKey("val")) {
List<Map<String, Object>> valList = result.get("val");
for (int i = 0; i < valList.size(); i++) {
Map<String, Object> ob = valList.get(i);
number = Long.valueOf(ob.get("number").toString());
}
}
try {
updateNumber(number, userGroup.getId());
} catch (SQLException e1) {
try {
updateStaus(2, userGroup.getId());
} catch (SQLException e) {
logger.error(e.getMessage(), e);
}
logger.error(e1.getMessage(), e1);
}
try {
updateStaus(1, userGroup.getId());
} catch (SQLException e) {
logger.error(e.getMessage(), e);
}
}
private static void updateStaus(int status, Long id) throws SQLException {
String sql = "update user_group set status = " + status + " where id = " + id;
Connection conn = DBUtil.newInstance().getConn();
Statement statement = conn.createStatement();
statement.executeUpdate(sql);
if (statement != null) {
statement.close();
}
if (conn != null) {
conn.close();
}
}
private static void updateNumber(Long number, Long id) throws SQLException {
String sql = "update user_group set number = " + number + " where id = " + id;
Connection conn = DBUtil.newInstance().getConn();
Statement statement = conn.createStatement();
statement.executeUpdate(sql);
if (statement != null) {
statement.close();
}
if (conn != null) {
conn.close();
}
}
}
package com.reyun.taskexecute;
import com.reyun.context.AppUtils;
import com.reyun.model.App;
import com.reyun.model.UserLog;
import com.reyun.repository.AppRepository;
import com.reyun.repository.UserLogRepository;
import com.reyun.service.impl.UserLogServiceImpl;
import com.reyun.util.DateUtil;
import com.reyun.util.IPAddrUtil;
import com.reyun.util.ValidateUtil;
import net.sf.json.JSONObject;
import net.sf.json.JSONArray;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.List;
/**
* Created by zxy on 2017/12/15.
*/
public class UserLogThread extends Thread
{
protected Logger logger = LoggerFactory.getLogger(UserLogThread.class);
private AppRepository appRepository = AppUtils.getApplicationContext().getBean(AppRepository.class);
private UserLogRepository userLogRepository = AppUtils.getApplicationContext().getBean(UserLogRepository.class);
private String type;
private String email;
private boolean isMasterLogin;
private String operaType;
private String operaContent;
private Object content;
private List contentList;
private String contentStr;
private Long app;
private String appName;
private String objectType;
private HttpServletRequest request;
/**
* 传入内容为对象
* @param email
* @param isMasterLogin
* @param type
* @param operaType
* @param content
* @param request
* @param app
* @param objectType
*/
public UserLogThread(String email, boolean isMasterLogin, String type, String operaType, Object content, HttpServletRequest request, Long app, String objectType)
{
this.type = type;
this.email = email;
this.isMasterLogin = isMasterLogin;
this.operaType = operaType;
this.content = content;
this.app = app;
this.objectType = objectType;
this.request = request;
}
/**
* 传入内容为列表
* @param email
* @param isMasterLogin
* @param type
* @param operaType
* @param content
* @param request
* @param app
* @param objectType
*/
public UserLogThread(String email, boolean isMasterLogin, String type, String operaType, List content, HttpServletRequest request, Long app, String objectType)
{
this.type = type;
this.email = email;
this.isMasterLogin = isMasterLogin;
this.operaType = operaType;
this.contentList = content;
this.app = app;
this.objectType = objectType;
this.request = request;
}
/**
* 传入内容为字符串
* @param email
* @param isMasterLogin
* @param type
* @param operaType
* @param content
* @param request
* @param app
* @param objectType
*/
public UserLogThread(String email, boolean isMasterLogin, String type, String operaType, String content, HttpServletRequest request, Long app, String objectType)
{
this.type = type;
this.email = email;
this.isMasterLogin = isMasterLogin;
this.operaType = operaType;
this.contentStr = content;
this.app = app;
this.objectType = objectType;
this.request = request;
}
@Override
public void run()
{
try
{
if (this.content != null) {
System.out.println(this.content);
this.operaContent = JSONObject.fromObject(this.content).toString();
} else if (this.contentList != null) {
System.out.println(this.contentList);
this.operaContent = JSONArray.fromObject(this.contentList).toString();
} else if (this.contentStr != null) {
System.out.println(this.contentStr);
this.operaContent = this.contentStr;
}
UserLog audit = new UserLog();
audit.setEmail(this.email);
audit.setMasterLogin(this.isMasterLogin);
if (this.app != null) {
App appObject = appRepository.findOne(this.app);
audit.setApp(this.app);
audit.setAppName(appObject.getName());
}
audit.setObjectType(this.objectType);
audit.setPubDate(new Date());
audit.setDs(DateUtil.format(new Date()));
audit.setOperaContent(this.operaContent);
if (this.request != null) {
String ipAddr = IPAddrUtil.getIpAddrNew(request);
audit.setIp(ipAddr);
if(ValidateUtil.isValid(ipAddr)){
String locationFromIpAddr = IPAddrUtil.getLocationFromIpAddr(ipAddr);
audit.setLocation(locationFromIpAddr);
}
}
audit.setOperaType(this.operaType);
audit.setType(type);
userLogRepository.save(audit);
} catch (Exception e) {
e.printStackTrace();
}
}
}
package com.reyun.util;
/**
* Created by nolan on 15/11/2016.
* description:
*/
public class ResultModel {
/**
* 返回码
*/
private int code;
/**
* 返回结果描述
*/
private String message;
/**
* 返回内容
*/
private Object content;
public ResultModel(int code, String message) {
this.code = code;
this.message = message;
this.content = "";
}
public ResultModel(int code, String message, Object content) {
this.code = code;
this.message = message;
this.content = content;
}
public ResultModel(ResultStatus status) {
this.code = status.getCode();
this.message = status.getMessage();
this.content = "";
}
public ResultModel(ResultStatus status, Object content) {
this.code = status.getCode();
this.message = status.getMessage();
this.content = content;
}
public static ResultModel OK(Object content) {
return new ResultModel(ResultStatus.SUCCESS, content);
}
public static ResultModel OK() {
return new ResultModel(ResultStatus.SUCCESS);
}
public static ResultModel ERROR(ResultStatus error) {
return new ResultModel(error);
}
public int getCode() {
return code;
}
public String getMessage() {
return message;
}
public Object getContent() {
return content;
}
}
\ No newline at end of file
package com.reyun.util;
/**
* Created by nolan on 15/11/2016.
* description:
*/
public enum ResultStatus {
SUCCESS(200, "成功"),
FAILED(-200, "失败"),
NUMBER_LIMIT(-300, "超过限定值,无法添加"),
NETWORK_ERROR(404, "网络异常"),
PARAM_INVALID(-1000, "参数错误"),
USERNAME_OR_PASSWORD_ERROR(-1001, "用户名或密码错误"),
USERNAME_LOGIN_EXPIRE(-1002, "用户登陆失效"),
SUB_ACCOUNT_DISABLE(-1003, "子帐号已禁用"),
ORIGINAL_ACCOUNT_DISABLE(-1004, "主体帐号已禁用"),
ACCOUNT_BUSINESS_EXPIRE(-1005, "主帐号已过期"),
ACCOUNT_NOT_CONFIRM(-1006, "帐号待审核"),
APP_DEL(-1007, "应用已被删除"),
AUTH_ACCOUNT_BUSINESS_EXPIRE(-1008, "授权帐号已过期"),
ONELINK_OCCUPY(-1009, "onelink占用推广活动"),
ACCOUNT_NOT_ACTIVATE(-1010, "账号未激活"),
USER_NOT_AUTH(-2000, "功能未授权"),
CAMPAIGN_CREATEING(-3000, "推广活动正在创建中, 请勿重复提交"),
ID_NOT_EXIST(-4000, "对应ID的记录不存在"),
EXPORT_DATA_EXIST(-5000, "导出记录已存在"),
EXPORT_FILE_EXIST(-5001, "导出文件不存在"),
RECORD_EXIST(-6000, "记录已存在,请勿重复提交"),
NAME_EXIST(-6001, "名称已存在"),
EVENT_NULL(-6002, "事件为空"),
FILE_TYPE_ERROR(-6003, "文件格式错误"),
CAMPAIGN_OCCUPY(-1010, "推广活动占用渠道"),
NAME_NULL(-1101, "名称为空"),
NAME_INVAILD(-1102, "名称不合法"),
CAMPAIGN_NOT_MATCH_APP(-1103, "推广活动与应用不匹配"),
SURL_NULL(-1105, "短链为空"),
CAMPAIGN_NULL(-1106, "推广活动不存在"),
CAMPAIGN_EXISTS(-1107, "此分包渠道的活动已存在"),
CAMPAIGN_REPEAT(-1008,"批量创建推广活动时名称重复"),
MSG_SMS_OUTOFTIME(-4001, "验证码过时,重新获取"),
MSG_SMS_REQUESTTIMES(-4002, "今天请求验证码次数过多"),
MSG_SMS_IPREQUESTTIMES(-4003, "IP地址请求过多"),
MSG_SMS_IPERROR(-4004, "未知ip达到峰值"),
MSG_SMS_WRONG(-4005, "验证码不正确"),
CHANNELACCOUNT_NOEXIST(-5001, "渠道帐号不存在"),
CHANNEL_ALIASNAME_EXIST(-5002, "该名称系统已存在"),
CHANNELACCOUNT_EXIST(-5003, "该账号ID已创建投放账号,不可重复创建"),
CHANNEL_LINKID_NOEXIST(-5004, "link_id不存在"),
COMMON_IP_EXISTS(-7000, "公共ip已存在"),
EXP_INVALID(11000, "自定义表达式错误");
/**
* 返回码
*/
private int code;
/**
* 返回结果描述
*/
private String message;
ResultStatus(int code, String message) {
this.code = code;
this.message = message;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
}
\ No newline at end of file
package com.reyun.util;
import org.apache.commons.lang.StringUtils;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
public class ShortUrl {
public static String[] generateCode(String url) {
String key = "Binjoo"; // 网址的混合KEY
String[] chars = { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j",
"k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v",
"w", "x", "y", "z", "0", "1", "2", "3", "4", "5", "6", "7",
"8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J",
"K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V",
"W", "X", "Y", "Z" };
String hex = toMd5(key + url);// 对传入网址和混合KEY进行MD5加密
String[] resUrl = new String[4];
for (int i = 0; i < 4; i++) {
// 把加密字符按照8位一组16进制与0x3FFFFFFF进行位与运算
String sTempSubString = hex.substring(i * 8, i * 8 + 8);
long lHexLong = 0x3FFFFFFF & Long.parseLong(sTempSubString, 16);
String outChars = "";
for (int j = 0; j < 6; j++) {
// 把得到的值与 0x0000003D 进行位与运算,取得字符数组 chars 索引
long index = 0x0000003D & lHexLong;
// 把取得的字符相加
outChars += chars[(int) index];
// 每次循环按位右移 5 位
lHexLong = lHexLong >> 5;
}
resUrl[i] = outChars;
}
return resUrl;
}
public static String[] generateCodeN(String url, int length) {
String key = "REYUN!@#"; // 网址的混合KEY
String[] chars = { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j",
"k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v",
"w", "x", "y", "z", "0", "1", "2", "3", "4", "5", "6", "7",
"8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J",
"K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V",
"W", "X", "Y", "Z" };
String hex = toMd5(key + url);// 对传入网址和混合KEY进行MD5加密
System.out.println(hex);
hex = hex + CharacterUtils.getRandomString(length*8);
String[] resUrl = new String[length];
for (int i = 0; i < length; i++) {
// 把加密字符按照8位一组16进制与0x3FFFFFFF进行位与运算
String sTempSubString = hex.substring(i * 8, i * 8 + 8);
long lHexLong = 0x3FFFFFFF & Long.parseLong(sTempSubString, 16);
String outChars = "";
for (int j = 0; j < 7; j++) {
// 把得到的值与 0x0000003D 进行位与运算,取得字符数组 chars 索引
long index = 0x0000003D & lHexLong;
// 把取得的字符相加
outChars += chars[(int) index];
// 每次循环按位右移 5 位
lHexLong = lHexLong >> 5;
}
resUrl[i] = outChars;
}
return resUrl;
}
private static String toMd5(String arg) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(arg.getBytes());
byte b[] = md.digest();
int i;
StringBuffer buf = new StringBuffer("");
for (int offset = 0; offset < b.length; offset++) {
i = b[offset];
if (i < 0)
i += 256;
if (i < 16)
buf.append("0");
buf.append(Integer.toHexString(i));
}
return buf.toString();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
return "";
}
public static void main(String[] args) {
String[] result = generateCodeN("zhangxiaoyan@reyun.comAASJJHDMFHBbjdBDFHJDNFHDFF", 10);
System.out.println(result.length);
System.out.println(StringUtils.join(result,","));
}
}
package com.reyun.util;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
public class ShortUrlGenerator {
public static String[] beshort(String url, int len) {
String key = "reyun";
String[] chars = new String[] { "a", "b", "c", "d", "e", "f", "g", "h",
"i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t",
"u", "v", "w", "x", "y", "z", "0", "1", "2", "3", "4", "5",
"6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H",
"I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T",
"U", "V", "W", "X", "Y", "Z"
};
// �Դ�����ַ���� MD5 ����
String sMD5EncryptResult = HashAlgorithms.MD5(key + url);
String hex = sMD5EncryptResult;
String[] resUrl = new String[4];
for (int i = 0; i < 4; i++) {
String sTempSubString = hex.substring(i * 8, i * 8 + 8);
long lHexLong = 0x3FFFFFFF & Long.parseLong(sTempSubString, 16);
String outChars = "";
for (int j = 0; j < len; j++) {
long index = 0x0000003D & lHexLong;
outChars += chars[(int) index];
lHexLong = lHexLong >> 1;
}
resUrl[i] = outChars;
}
return resUrl;
}
/**
* @param args
*/
public static void main(String[] args) {
// String sLongUrl = "yybaby" ;
// String[] aResult;
// //
//
// for ( int i = 1; i <= 26 ; i++) {
// aResult = shortUrl (sLongUrl+i);
// System. out .println( "[" + i + "]-->" + aResult[1]);
// }
String dateStr = DateUtil
.getCurrentDateStr(DateUtil.C_TIME_PATTON_DEFAULT);
String username = "test@126.com";
String appname = "hulai";
// String plattype = "andriod";
String key = ShortUrlGenerator
.beshort(username + appname + dateStr, 6)[0];
// String key = Md5(username+appname+dateStr);
// System.out.println(key);
// System.out.println(key.length());
System.out.println(md5("f7riea"));
System.out.println(md5("jBqFuE"));
System.out.println(md5("vERUZY"));
System.out.println(md5("7rEQU3"));
System.out.println(md5("qje6NU"));
System.out.println(md5("eab6MU"));
System.out.println(md5("uERyne"));
System.out.println(md5("FQU3mf"));
}
public static String md5(String plainText) {
String key = "reyun";
plainText = plainText + key;
String result = null;
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(plainText.getBytes());
byte b[] = md.digest();
int i;
StringBuffer buf = new StringBuffer("");
for (int offset = 0; offset < b.length; offset++) {
i = b[offset];
if (i < 0)
i += 256;
if (i < 16)
buf.append("0");
buf.append(Integer.toHexString(i));
}
result = buf.toString(); // md5 32bit
// result = buf.toString().substring(8, 24))); //md5 16bit
// result = buf.toString().substring(8, 24);
// //System.out.println("mdt 16bit: " + buf.toString().substring(8,
// 24));
// //System.out.println("md5 32bit: " + buf.toString() );
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
return result;
}
}
package com.reyun.util;
import com.reyun.context.AppUtils;
import com.reyun.model.Event4Web;
import com.reyun.service.EventService;
import com.reyun.service.EventStatsService;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang.StringUtils;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Created by zxy on 2017/9/14.
*/
public class SizheTool {
public Map getMap() {
Map<String, String> map = new HashedMap();
map.put("注册", "reged");
map.put("app", "app");
map.put("campaign", "campaign");
return map;
}
public static void main(String[] args) {
SizheTool tool = new SizheTool();
try {
List<String> list = jisuanStr("(注册1.country.count+app.country.count)*3-campaign.count/campaign.countuser", tool.getMap());
String str = StringUtils.join(list.toArray());
System.out.println(str);
} catch (Exception e) {
System.out.println("请检查你的算式格式");
e.printStackTrace();
}
}
/**
* 计算<br>
* 步骤:1、如果有括号<br>
* 然后取上一个最近的(坐标 计算当前括号组合里的算式 ),在继续往下查找括号 以此类推,直至循环使用到所有坐标元素
* 计算完毕(运算顺序括号、乘除、加减)
*
* @param str
* @return
*/
public static List<String> jisuanStr(String str, Map<String, String> map) throws Exception {
double returnDouble = 0;
// List<String> listSplit = splitStr(str); // 拆分好的元素
List<String> listSplitResult = new ArrayList<String>();
List<String> listSplit = new ArrayList<String>();
Matcher matcher = Pattern.compile("\\-?[\\w\\u4e00-\\u9fa5()]+(\\.[\\w\\u4e00-\\u9fa5()]+){1,2}|[+*/()]|\\-|\\d")
.matcher(str);// 用正则拆分成每个元素
Pattern p1 = Pattern.compile("\\-?\\d+(\\.\\d+)?|[+*/()]|\\-");
while (matcher.find()) {
String mid = matcher.group(0);
System.out.println(mid + "------" + p1.matcher(mid).matches());
if (p1.matcher(mid).matches()) {
listSplitResult.add(mid);
listSplit.add(mid);
}
else {
String[] arrays = mid.split("\\.");
StringBuffer sb = new StringBuffer();
boolean isNegative = false;
if (arrays.length > 1) {
if (arrays[0].startsWith("-")) {
isNegative = true;
if (map.get(arrays[0].substring(1)) == null) {
throw new Exception();
}
sb.append("-" + map.get(arrays[0].substring(1)));
} else {
if (map.get(arrays[0]) == null) {
throw new Exception();
}
sb.append(map.get(arrays[0]));
}
}
for (int i=1; i<arrays.length; i++) {
sb.append(".").append(arrays[i]);
}
listSplitResult.add(sb.toString());
if (isNegative) {
listSplit.add("-1");
} else {
listSplit.add("1");
}
}
System.out.println(listSplit);
// listSplit.add(matcher.group(0));
}
System.out.println(listSplit);
List<Integer> zKuohaoIdxList = new ArrayList<Integer>();// 左括号,<所在坐标,>
if (Pattern.compile(".*\\(|\\).*").matcher(str).find()) {// 如果包含括号运算
String value = "";// 单个字符值
int zIdx = 0;// 上一个左括号在zKuoHaoIdxList的下标
// 此层循环计算完所有括号里的算式
List<String> tempList = new ArrayList<String>();// 前面没有计算的元素
int removeL = 0;
int tempListSize = 0;
for (int i = 0; i < listSplit.size(); i++) {
value = listSplit.get(i);
tempList.add(value);
tempListSize = tempList.size();
if ("(".equals(value)) {// 左括号
zKuohaoIdxList.add(tempListSize-1);
} else if (")".equals(value)) {// 遇到右括号就计算与上一左括号间的算式
zIdx = zKuohaoIdxList.size() - 1;// 离当前右括号最近的左括号配对
int start = zKuohaoIdxList.get(zIdx);
returnDouble = jisuan(tempList, start + 1, tempListSize-1); // 开始位置,就是上一个左括号
removeL = tempListSize - start;
tempList = removeUseList(tempList, removeL);// 移除已使用的元素
tempList.add(returnDouble + "");// 刚刚计算的值添加进来
zKuohaoIdxList.remove(zIdx);// 计算完毕清除括号
}
}
// 把所有计算完
returnDouble = jisuan(tempList, 0, tempList.size());
} else {// 没有括号运算
returnDouble = jisuan(listSplit, 0, listSplit.size());
}
System.out.println(returnDouble);
return listSplitResult;
}
/**
* 倒序删除已用过的元素
*
* @param list
* @param removeLength
* 数量
* @return
*/
public static List<String> removeUseList(List<String> list, int removeLength) {
int le = list.size() - removeLength;
for (int i = list.size() - 1; i >= le; i--) {
list.remove(i);
}
return list;
}
/**
* 计算算式
*
* @param listSplit
* @param start
* 括号算式开始符位置
* @param end
* 括号结束符位置
* @return
*/
public static double jisuan(List<String> listSplit, int start, int end)
throws Exception {
double returnValue = 0;
String strValue = null;// 临时变量
List<String> jjValueList = new ArrayList<String>();// 剩下的加减元素
// 遍历计算乘除法
for (int i = start; i < end; i++) {
strValue = listSplit.get(i);
if ("*".equals(strValue) || "/".equals(strValue)) {// 乘除
strValue = jisuanValue("*".equals(strValue) ? "*" : "/", Double
.parseDouble(jjValueList.get(jjValueList.size() - 1)),
Double.parseDouble(listSplit.get(i + 1)))
+ "";
jjValueList.remove(jjValueList.size() - 1);
i++;
}
jjValueList.add(strValue);
}
// 遍历计算加减
for (int j = 0; j < jjValueList.size(); j++) {
strValue = jjValueList.get(j);
if ("-".equals(strValue) || "+".equals(strValue)) {
returnValue = jisuanValue("-".equals(strValue) ? "-" : "+",
returnValue, Double.parseDouble(jjValueList.get(j + 1)));
j++;
} else {
returnValue += Double.parseDouble(jjValueList.get(j));
}
}
return returnValue;
}
/**
* 计算2个数间的加减乘除操作 如:2*5 ,2/5
*
* @param type
* 运算符
* @param start
* 数 相当于上面2
* @param end
* 被数 相当于上面5
* @return
*/
public static double jisuanValue(String type, double start, double end)
throws Exception {
double d = 0;
if ("-".equals(type)) {
d = start - end;
} else if ("+".equals(type)) {
d = start + end;
} else if ("*".equals(type)) {
d = start * end;
} else if ("/".equals(type)) {
if (0 == start || 0 == end)
d = 0;
else
d = start / end;
}
return d;
}
}
package com.reyun.util;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Random;
import javax.imageio.ImageIO;
/**
* 验证码生成器
*/
public class ValidateCodeUtil {
// 图片的宽度。
private int width = 160;
// 图片的高度。
private int height = 40;
// 验证码字符个数
private int codeCount = 5;
// 验证码干扰线数
private int lineCount = 150;
// 验证码
private static String code = null;
// 验证码图片Buffer
private BufferedImage buffImg = null;
private char[] codeSequence = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
'I', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'U', 'V',
'W', 'X', 'Y', 'Z', '1', '2', '3', '4', '5', '6', '7', '8', '9' };
public ValidateCodeUtil() {
this.createCode();
}
/**
*
* @param width
* 图片宽
* @param height
* 图片高
*/
public ValidateCodeUtil(int width, int height) {
this.width = width;
this.height = height;
this.createCode();
}
/**
*
* @param width
* 图片宽
* @param height
* 图片高
* @param codeCount
* 字符个数
* @param lineCount
* 干扰线条数
*/
public ValidateCodeUtil(int width, int height, int codeCount,
int lineCount, String code) {
this.width = width;
this.height = height;
this.codeCount = codeCount;
this.lineCount = lineCount;
this.code = code;
this.createCode();
}
public void createCode() {
int x = 0, fontHeight = 0, codeY = 0;
int red = 0, green = 0, blue = 0;
x = width / (codeCount + 5);// 每个字符的宽度
fontHeight = height - 2;// 字体的高度
codeY = height - 4;
// 图像buffer
buffImg = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
Graphics2D g = buffImg.createGraphics();
// 生成随机数
Random random = new Random();
// 将图像填充为白色
g.setColor(Color.WHITE);
g.fillRect(0, 0, width, height);
Font font = new Font("Arial", Font.PLAIN, fontHeight);
g.setFont(font);
for (int i = 0; i < lineCount; i++) {
int xs = random.nextInt(width);
int ys = random.nextInt(height);
int xe = xs + random.nextInt(width / 8);
int ye = ys + random.nextInt(height / 8);
red = random.nextInt(255);
green = random.nextInt(255);
blue = random.nextInt(255);
g.setColor(new Color(red, green, blue));
g.drawLine(xs, ys, xe, ye);
}
// randomCode记录随机产生的验证码
StringBuilder randomCode = new StringBuilder();
// 随机产生codeCount个字符的验证码。
for (int i = 0; i < codeCount; i++) {
String strRand = String.valueOf(code.charAt(i));
// 产生随机的颜色值,让输出的每个字符的颜色值都将不同。
red = random.nextInt(255);
green = random.nextInt(255);
blue = random.nextInt(255);
g.setColor(new Color(red, green, blue));
g.drawString(strRand, (i * 2) * x, codeY);
// 将产生的四个随机数组合在一起。
randomCode.append(strRand);
}
// 将四位数字的验证码保存到Session中。
code = randomCode.toString();
}
public void write(String path) throws IOException {
OutputStream sos = new FileOutputStream(path);
this.write(sos);
}
public void write(OutputStream sos) throws IOException {
ImageIO.write(buffImg, "png", sos);
sos.close();
}
public BufferedImage getBuffImg() {
return buffImg;
}
public String getCode() {
return code;
}
}
package com.reyun.util;
import org.json.JSONArray;
import org.json.JSONException;
import java.util.Collection;
import java.util.Map;
/**
* 校验工具类
* @author liruijie@reyun.com
* @date 2015年11月24日
*/
public class ValidateUtil {
/**
* 判断string是否有效
* @param str
* @return
*/
public static boolean isValid(String str) {
if (str == null || "".equals(str.trim())) {
return false;
}
return true;
}
/**
* 判断集合的有效性
* @param col
* @return
*/
@SuppressWarnings("rawtypes")
public static boolean isValid(Collection col) {
if (col == null || col.isEmpty()) {
return false;
}
return true;
}
/**
* 判断map的有效性
* @param map
* @return
*/
@SuppressWarnings("rawtypes")
public static boolean isValid(Map map) {
if (map == null || map.isEmpty()) {
return false;
}
return true;
}
/**
* 判断数组有效性
* @param arr
* @return
*/
public static boolean isValid(Object[] arr) {
if (arr == null || arr.length == 0) {
return false;
}
return true;
}
/**
* 判断对象有效性
* @param obj
* @return
*/
public static boolean isValid(Object obj) {
if (obj == null) {
return false;
}
return true;
}
public static boolean isValid(JSONArray obj) {
if (obj == null) {
return false;
}
if(obj.length()<1){
return false;
}
return true;
}
public static boolean validNotChinese(String str){
return str.matches("^[a-zA-Z0-9_][a-zA-Z0-9_-]*$");
}
public static void main(String[] args) throws JSONException {
String s = "[]";
JSONArray o = new JSONArray(s);
boolean valid = isValid(o);
System.out.println(valid);
}
}
package com.reyun.util;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Multimap;
import com.google.common.collect.Multiset;
import java.util.Collection;
/**
* Created by nolan on 19/01/2017.
* description:
*/
public class ViewColumnDependUtil {
private static Multimap<String, String> multimap = ArrayListMultimap.create();
static {
//激活率=激活设备数/排重点击
multimap.put("rate_install", "num_install");
multimap.put("rate_install", "dupnum_click_all");
//注册率=注册设备数/激活设备数
multimap.put("rate_reged", "dupnum_reged_day");
multimap.put("rate_reged", "num_install");
//异常点击率=异常点击设备数/点击总数
multimap.put("rate_click_fake", "num_click_fake");
multimap.put("rate_click_fake", "num_click_total");
//异常激活率=异常激活设备数/激活设备数
multimap.put("rate_install_fake", "num_install_fake");
multimap.put("rate_install_fake", "num_install");
//n日留存率=sum(激活设备数n日留存设备数)*100.0/sum(激活设备数)
multimap.put("rate_retentiond1", "rate_retentiond1");
multimap.put("rate_retentiond1", "num_install");
multimap.put("rate_retentiond3", "rate_retentiond3");
multimap.put("rate_retentiond3", "num_install");
multimap.put("rate_retentiond7", "rate_retentiond7");
multimap.put("rate_retentiond7", "num_install");
multimap.put("rate_retentiond30", "rate_retentiond30");
multimap.put("rate_retentiond30", "num_install");
//ltvn=sum(n日LTV值)/sum(激活设备数)
multimap.put("amt_ltv0", "amt_ltv0");
multimap.put("amt_ltv0", "num_install");
multimap.put("amt_ltv7", "amt_ltv7");
multimap.put("amt_ltv7", "num_install");
multimap.put("amt_ltv30", "amt_ltv30");
multimap.put("amt_ltv30", "num_install");
//arpu=注收比付费/排重激活设备数
multimap.put("arpu","amt_amount");
multimap.put("arpu","num_ins");
//arpu=注收比付费/付费设备数
multimap.put("arppu","amt_amount");
multimap.put("arppu","num_pay");
//付费率=付费设备数*100.0/排重激活设备数
multimap.put("rate_pay","num_pay");
multimap.put("rate_pay","num_ins");
//H5注册率=注册用户/排重点击
multimap.put("rate_reged_h5","num_register");
multimap.put("rate_reged_h5","num_click");
}
public static Multiset<String> getRateKeyFields() {
return multimap.keys();
}
public static Collection<String> getRateDependFields(String ratefield) {
return multimap.get(ratefield);
}
}
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 16 16" style="enable-background:new 0 0 16 16;" xml:space="preserve">
<style type="text/css">
.st0{fill:#4186EC;}
</style>
<path id="XMLID_2_" class="st0" d="M13,5V3h2v2H13z M9,7h2v2H9V7z M9,3h2v2H9V3z M5,11h2v2H5V11z M5,7h2v2H5V7z M5,3h2v2H5V3z M1,11
h2v2H1V11z M1,7h2v2H1V7z M1,3h2v2H1V3z"/>
</svg>
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 16 16" style="enable-background:new 0 0 16 16;" xml:space="preserve">
<style type="text/css">
.st0{fill:#4186EC;}
</style>
<path id="XMLID_2_" class="st0" d="M15.5,7.1c0,0.1,0,0.2,0,0.4h-0.9l0,0h-5h-1v-1V0.6c0.2,0,0.3-0.1,0.5-0.1s0.3,0,0.5,0.1
c1.3,0.1,2.4,0.5,3.4,1.2c0,0,0,0,0,0c0.3,0.2,0.6,0.5,0.8,0.7c0,0.1,0.1,0.1,0.1,0.2c0.2,0.2,0.4,0.5,0.6,0.8
c0.1,0.1,0.1,0.3,0.2,0.4c0.1,0.2,0.3,0.4,0.4,0.7c0.1,0.2,0.1,0.4,0.2,0.7c0.1,0.2,0.1,0.3,0.2,0.5c0.1,0.4,0.1,0.8,0.1,1.3l0,0
C15.5,7,15.5,7.1,15.5,7.1z M9.5,1.5v4.9h5C14.2,3.9,12.1,1.8,9.5,1.5z M13.4,9c0,0.2,0,0.3-0.1,0.5c-0.1,1.3-0.5,2.4-1.2,3.4
c0,0,0,0,0,0c-0.2,0.3-0.5,0.6-0.7,0.8c-0.1,0-0.1,0.1-0.2,0.1c-0.2,0.2-0.5,0.4-0.7,0.6c-0.1,0.1-0.3,0.1-0.4,0.2
c-0.2,0.1-0.4,0.3-0.7,0.4c-0.2,0.1-0.4,0.1-0.7,0.2c-0.2,0.1-0.3,0.1-0.5,0.2c-0.4,0.1-0.8,0.1-1.3,0.1c-3.6,0-6.5-2.9-6.5-6.5
c0-0.4,0-0.9,0.1-1.3c0-0.2,0.1-0.3,0.2-0.5C0.8,7,0.9,6.8,1,6.5c0.1-0.2,0.2-0.5,0.3-0.7c0.1-0.1,0.1-0.3,0.2-0.4
C1.7,5.2,1.9,5,2.1,4.7c0-0.1,0.1-0.1,0.1-0.2c0.3-0.3,0.5-0.5,0.8-0.7c0,0,0,0,0,0c0.9-0.7,2.1-1.2,3.3-1.2c0.2,0,0.3-0.1,0.5-0.1
c0.2,0,0.3,0,0.5,0.1v5.9h5.9C13.4,8.7,13.4,8.8,13.4,9z M7.5,9.5h-1v-1V3.6c-2.8,0.3-5,2.6-5,5.4c0,3,2.4,5.5,5.5,5.5
c2.9,0,5.2-2.2,5.4-5H7.5z"/>
</svg>
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 16 16" style="enable-background:new 0 0 16 16;" xml:space="preserve">
<style type="text/css">
.st0{fill:#4186EC;}
</style>
<path id="XMLID_2_" class="st0" d="M14.5,7.4v5.9c0,1.1-0.9,2-2,2h-9c-1.1,0-2-0.9-2-2V7.4c-0.6,0-1-0.4-1-1v-3c0-0.6,0.4-1,1-1h5.6
L5.7,1.1l0.7-0.7l1.8,1.7l1.8-1.7l0.7,0.7L9.3,2.5h5.2c0.6,0,1,0.4,1,1v3C15.5,7,15.1,7.4,14.5,7.4z M8.5,14.4h4c0.6,0,1-0.4,1-1
V7.4h-5V14.4z M7.5,3.5h-6v3h6V3.5z M7.5,7.4h-5v5.9c0,0.6,0.4,1,1,1h4V7.4z M14.5,3.5h-6v3h6V3.5z"/>
</svg>
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 16 16" style="enable-background:new 0 0 16 16;" xml:space="preserve">
<style type="text/css">
.st0{fill:#4186EC;}
</style>
<path id="XMLID_2_" class="st0" d="M14.5,10c0,0.7-0.4,1.2-1,1.4v3.1h-1v-3.1c-0.6-0.2-1-0.7-1-1.4s0.4-1.2,1-1.4V1.5h1v7.1
C14.1,8.8,14.5,9.3,14.5,10z M8.5,8.4v6.1h-1V8.4c-0.6-0.2-1-0.7-1-1.4s0.4-1.2,1-1.4V1.5h1v4.1c0.6,0.2,1,0.7,1,1.4
S9.1,8.2,8.5,8.4z M3.5,6.4v8.1h-1V6.4c-0.6-0.2-1-0.7-1-1.4s0.4-1.2,1-1.4V1.5h1v2.1c0.6,0.2,1,0.7,1,1.4S4.1,6.2,3.5,6.4z"/>
</svg>
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 16 16" style="enable-background:new 0 0 16 16;" xml:space="preserve">
<style type="text/css">
.st0{fill:#4186EC;}
</style>
<path id="XMLID_2_" class="st0" d="M15.3,11.1c0.4,0.5,0.7,1.2,0.7,1.9c0,1.7-1.3,3-3,3c-1,0-1.8-0.5-2.4-1.2C10.1,14.9,9.6,15,9,15
c-2.8,0-5.2-1.7-6.3-4C1.2,10.8,0,9.5,0,8s1.2-2.8,2.7-3C3.8,2.7,6.2,1,9,1c0.6,0,1.1,0.1,1.6,0.2C11.2,0.5,12,0,13,0
c1.7,0,3,1.3,3,3c0,0.7-0.3,1.4-0.7,1.9C15.7,5.9,16,6.9,16,8S15.7,10.1,15.3,11.1z M1,8c0,1.1,0.9,2,2,2s2-0.9,2-2S4.1,6,3,6
S1,6.9,1,8z M13,1c-1.1,0-2,0.9-2,2s0.9,2,2,2s2-0.9,2-2S14.1,1,13,1z M14.5,5.6C14,5.8,13.5,6,13,6c-1.7,0-3-1.3-3-3
c0-0.3,0.1-0.6,0.1-0.9C9.8,2,9.4,2,9,2C6.7,2,4.8,3.3,3.8,5.1C5.1,5.5,6,6.6,6,8s-0.9,2.5-2.2,2.9c1,1.8,3,3.1,5.2,3.1
c0.4,0,0.8,0,1.1-0.1C10.1,13.6,10,13.3,10,13c0-1.7,1.3-3,3-3c0.5,0,1,0.2,1.5,0.4C14.8,9.7,15,8.9,15,8S14.8,6.3,14.5,5.6z M13,11
c-1.1,0-2,0.9-2,2s0.9,2,2,2s2-0.9,2-2S14.1,11,13,11z"/>
</svg>
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="-41 43 16 16" style="enable-background:new -41 43 16 16;" xml:space="preserve">
<style type="text/css">
.st0{fill:#4186EC;}
</style>
<path id="XMLID_1_" class="st0" d="M-27.9,54.9h-10.4c-0.8,0-1.5-0.6-1.5-1.5l0.1-6.5c0-0.8,0.6-1.5,1.5-1.5h10.5
c0.8,0,1.5,0.6,1.5,1.5l-0.1,6.6C-26.4,54.3-27,54.9-27.9,54.9z M-34.6,54.2h3v-0.7h-3V54.2z M-27.1,46.8c0-0.4-0.4-0.7-0.7-0.7
h-10.5c-0.4,0-0.7,0.3-0.7,0.7l-0.1,5.1c0,0.4,0.4,0.7,0.7,0.7h10.5c0.4,0,0.7-0.4,0.7-0.7L-27.1,46.8z M-30.9,57.3h-4.5v-1.8h4.5
V57.3z"/>
</svg>
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 16 16" style="enable-background:new 0 0 16 16;" xml:space="preserve">
<style type="text/css">
.st0{fill:#4186EC;}
</style>
<path id="XMLID_2_" class="st0" d="M12.7,11.3v2.4c0,0.8-0.7,1.5-1.5,1.5H4.6c-0.8,0-1.5-0.7-1.5-1.5v-2.4H1.5V3.2h1.6V2.3
c0-0.8,0.7-1.5,1.5-1.5h6.7c0.8,0,1.5,0.7,1.5,1.5v0.9h1.6v8.1H12.7z M6.8,14.5H9v-0.7H6.8V14.5z M3.9,12.2c0,0.4,0.3,0.7,0.7,0.7
h6.7c0.4,0,0.7-0.3,0.7-0.7v-0.9H3.9V12.2z M3.9,4.4H3.1v6h0.8V7.5H7v2.9h0.8v-6H7v2.4H3.9V4.4z M12,2.3c0-0.4-0.4-0.7-0.8-0.7H4.6
c-0.4,0-0.7,0.4-0.7,0.7v0.9H12V2.3z M12.3,6.9c-0.4-0.4-0.9-0.5-1.4-0.5c-0.4,0-0.7,0.1-1.1,0.4l0.4-1.7h2.5V4.4h-3L9,7.5l0.7,0.1
c0.1-0.2,0.3-0.4,0.4-0.4c0.2-0.1,0.4-0.2,0.6-0.2c0.4,0,0.7,0.1,1,0.3c0.3,0.2,0.3,0.5,0.3,1c0,0.4-0.1,0.8-0.3,1.1
c-0.2,0.3-0.5,0.4-0.9,0.4c-0.4,0-0.6-0.1-0.8-0.3C9.8,9.4,9.7,9.1,9.6,8.7L8.8,8.8C8.9,9.3,9.1,9.7,9.5,10c0.3,0.3,0.8,0.4,1.3,0.4
c0.7,0,1.2-0.2,1.6-0.7c0.3-0.3,0.4-0.9,0.4-1.4S12.7,7.2,12.3,6.9z"/>
</svg>
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed. Click to expand it.
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