file_id
int64 1
66.7k
| content
stringlengths 14
343k
| repo
stringlengths 6
92
| path
stringlengths 5
169
|
---|---|---|---|
65,761 | package List;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
/*
集合的分类
1.list
特点:有序可重复
有序:先添加谁就先输出谁 下列输出结果(10 软件工程 88.8 10)
重复:代码中有两个10.都输出,
list.add(object e)
object e=1 向上转型
object o =1 装箱机制
2.set
特点:无序不可重复
下列set代码输出:
当前set集合的元素个数为3
集合内的元素a
集合内的元素河池学院
集合内的元素b
3.map
特点:无序不可重复 key-value
*/
public class List {
//list
public static void main(String[] args) {
ArrayList list = new ArrayList();
list.add(10);
list.add("软件工程");
list.add(88.8);
list.add(10);
System.out.println("当前list集合的元素个数为:"+list.size());//4
for(int i=0;i<list.size();i++){
System.out.println("集合内的元素:"+list.get(i)); //遍历,见list中的对象全部输出
}
System.out.println();
//set
Set<String>set=new HashSet();
set.add("河池学院");
//set.add(1); 会报错,只能输入String类型
set.add("a");
set.add("b");
set.add("a");
System.out.println("当前set集合的元素个数为:"+set.size());
Iterator iterator=set.iterator();
while(iterator.hasNext()) {
System.out.println("集合内的元素为:"+iterator.next());
}
}
}
| jinyou123/Oderticket | src/List/List.java |
65,765 | public class Solution {
public int regionsBySlashes(String[] grid) {
int N = grid.length;
int size = 4 * N * N;
UnionFind unionFind = new UnionFind(size);
for (int i = 0; i < N; i++) {
char[] row = grid[i].toCharArray();
for (int j = 0; j < N; j++) {
// 二维网格转换为一维表格
int index = 4 * (i * N + j);
char c = row[j];
// 单元格内合并
if (c == '/') {
// 合并 0、3,合并 1、2
unionFind.union(index, index + 3);
unionFind.union(index + 1, index + 2);
} else if (c == '\\') {
// 合并 0、1,合并 2、3
unionFind.union(index, index + 1);
unionFind.union(index + 2, index + 3);
} else {
unionFind.union(index, index + 1);
unionFind.union(index + 1, index + 2);
unionFind.union(index + 2, index + 3);
}
// 单元格间合并
// 向右合并:1(当前)、3(右一列)
if (j + 1 < N) {
unionFind.union(index + 1, 4 * (i * N + j + 1) + 3);
}
// 向下合并:2(当前)、0(下一行)
if (i + 1 < N) {
unionFind.union(index + 2, 4 * ((i + 1) * N + j));
}
}
}
return unionFind.getCount();
}
private class UnionFind {
private int[] parent;
private int count;
public int getCount() {
return count;
}
public UnionFind(int n) {
this.count = n;
this.parent = new int[n];
for (int i = 0; i < n; i++) {
parent[i] = i;
}
}
public int find(int x) {
while (x != parent[x]) {
parent[x] = parent[parent[x]];
x = parent[x];
}
return x;
}
public void union(int x, int y) {
int rootX = find(x);
int rootY = find(y);
if (rootX == rootY) {
return;
}
parent[rootX] = rootY;
count--;
}
}
// offer-53
public int missingNumber(int [] nums){
if(nums==null){
return -1
}
int left = 0;
int right = nums.length -1;
while(left<=right){
int mid = left + (right - left) / 2;
if(nums[mid]==mid){
left = mid +1
}else{
right = mid -1
}
}
return left
}
public int longestConsecutive(int [] nums){
final HashSet<Interger> mySet = new HashSet<Interger>{}();
for(int i:nums) {mySet.add(i);}
int longest = 0
for(int i :nums){
int length = 0;
for(int j=i-1;mySet.contains(j);--j){
mySet.remove(j);
length++;
}
for(int j=i+1;mySet.contains(j);++j){
mySet.remove(j);
++length;
}
longest = Math.max(longest,length);
}
return longest;
}
public int [] towSum(int [] nums,int target){
final HashMap<Interger,Interger> myMap = new HashMap<Interger,Interger>();
int [] result = new int [2];
for(int i = 0;i<nums.length;i++){
myMap.put(nums[i],i)
}
for(int i=0;i<nums.length;i++){
final Interger v = myMap.get(target - nums[i]);
if(v!=null && v>i){
return new int []{i+1,v+1};
}
}
return null;
}
List<String> res = new LinkedList<>();
char[] c;
public String[] permutation(String s) {
c = s.toCharArray();
dfs(0);
return res.toArray(new String[res.size()]);
}
void dfs(int x) {
if(x == c.length - 1) {
res.add(String.valueOf(c)); // 添加排列方案
return;
}
HashSet<Character> set = new HashSet<>();
for(int i = x; i < c.length; i++) {
if(set.contains(c[i])) continue; // 重复,因此剪枝
set.add(c[i]);
swap(i, x); // 交换,将 c[i] 固定在第 x 位
dfs(x + 1); // 开启固定第 x + 1 位字符
swap(i, x); // 恢复交换
}
}
void swap(int a, int b) {
char tmp = c[a];
c[a] = c[b];
c[b] = tmp;
}
static void main(){
regionsBySlashes([2,2])
}
} | enterpriseih/leetcode_js | java/Solution.java |
65,766 | class Solution {
public List<List<Integer>> subsetsWithDup(int[] nums) {
Arrays.sort(nums);
List<List<Integer>> res = new ArrayList<List<Integer>>();
List<Integer> tmp = new ArrayList<Integer>();
res.add(tmp);
helper(nums, res, tmp, 0);
return res;
}
private void helper(int[] nums, List<List<Integer>> res, List<Integer> tmp, int index){
if(index >= nums.length) return;
int oldIndex = index;
//跳过重复元素,重复元素的个数根据index和oldIndex可以得到
while(index < nums.length - 1 && nums[index] == nums[index+1]) index++;
helper(nums, res, tmp, index + 1);
//依次在集合中加入1个、2个...重复的元素
for(int i = oldIndex; i <= index; i++){
List<Integer> tmp2 = new ArrayList<Integer>(tmp);
//这里需要一个循环保证这次加的元素个数
for(int j = i; j <= index; j++){
tmp2.add(nums[index]);
}
res.add(tmp2);
helper(nums, res, tmp2, index + 1);
}
}
}
| Eurus-Holmes/LCED | Subsets II.java |
65,767 | import javax.swing.text.Position;
import java.util.HashMap;
/**
* Created by nekocode on 16/7/17.
*/
public class _219 {
public boolean containsNearbyDuplicate(int[] nums, int k) {
HashMap<Integer, Integer> map = new HashMap<>();
for (int i = 0; i < nums.length; i++) {
int num = nums[i];
if (!map.containsKey(num) || i - map.get(num) > k) {
// 没有重复, 或者与上一次重复距离大于 k
map.put(num, i);
} else {
// 与上一次重复字符的距离小于 k
return true;
}
}
return false;
}
public static void main(String[] args) {
System.out.print(new _219().containsNearbyDuplicate(new int[]{0, 1, 2, 3, 1, 0, 5, 7}, 4));
}
}
| nekocode/leetcode-solutions | src_java/_219.java |
65,770 | package com.njust.test;
import java.util.concurrent.atomic.AtomicInteger;
import org.junit.Assert;
import org.junit.Test;
/**
* 利用AtomicInteger生成文件名称,发现出现覆盖的问题,参见#test03
*/
public class AtomTest
{
private AtomicInteger count = new AtomicInteger();
/**
* 1、使用同一个AtomicInteger,而不是每次new一个出来,不会重复
*/
@Test
public void test01()
{
int num1 = count.getAndIncrement();
int num2 = count.getAndIncrement();
Assert.assertNotEquals(num1, num2);
}
/**
* 2、每次new一个AtomicInteger出来,如果初始因子一样,结果就是一样的
*/
@Test
public void test02()
{
int num1 = getIndex();
int num2 = getIndex();
Assert.assertEquals(num1, num2);
}
private int getIndex()
{
AtomicInteger counter = new AtomicInteger();
return counter.getAndIncrement();
}
/**
* 3、每次new一个AtomicInteger出来,如果初始因子看似不一样但是还是一样呢,那结果就是还是一样的
*/
@Test
public void test03()
{
int num1 = getIndex222();
int num2 = getIndex222();
//调用快的时候,就是一样的
Assert.assertEquals(num1, num2);
}
private int getIndex222()
{
AtomicInteger counter = new AtomicInteger((int)(System.currentTimeMillis() / 1000L));
return counter.getAndIncrement();
}
}
| GenweiWu/Blog | java/AtomTest.java |
65,771 | class Solution {
HashMap<String, Integer> subtrees = new HashMap<String, Integer>();
LinkedList<TreeNode> result = new LinkedList<TreeNode>();
public List<TreeNode> findDuplicateSubtrees(TreeNode root) {
serialize(root);
return result;
}
String serialize(TreeNode root) {
if (root == null) {
return "#";
}
String leftStr = serialize(root.left);
String rightStr = serialize(root.right);
// 此处注意也要用后序遍历的顺序,左右中
String treeStr = leftStr + ',' + rightStr + ',' + root.val;
int count = subtrees.getOrDefault(treeStr, 0);
if (count == 1) {
// 如果第一次重复
result.add(root);
}
subtrees.put(treeStr, count+1);
return treeStr;
}
} | ninehills/leetcode | 652.java |
65,772 | public class Solution {
/*
* @param nums: A set of numbers.
* @return: A list of lists. All valid subsets.
*/
public List<List<Integer>> subsetsWithDup(int[] nums) {
// write your code here
List<List<Integer>> res = new ArrayList<>();
if(nums == null) return res;
Arrays.sort(nums);
helper(res, new ArrayList<>(), 0, nums);
return res;
}
private void helper(List<List<Integer>> res, List<Integer> list, int start, int[] nums) {
res.add(new ArrayList<>(list));
for(int i = start; i < nums.length; i ++) {
if(i > start && nums[i] == nums[i - 1]) continue;
list.add(nums[i]);
helper(res, list, i + 1, nums);
list.remove(list.size() - 1);
}
}
}
/*
简单的backtracking题。
注意对重复元素的处理,两种
(1)一开始就跳过重复元素
(2)在最后跳过重复元素
要求相同,第一位不能使用重复的,但是后几位可以重复。
*/ | freezaku/LeetCode | Subsets II.java |
65,773 |
/* This class will be given a list of words (such as tokenized words from a paragraph of text).
* It will also provide a method that takes two words and returns the shortest distance(in words)
* between these two words in the provided text.
* Example:
* WordDistanceFinder finder = new WordDistanceFinder(Arrays.asList(“the”, “quick”, “brown”, “fox”, “quick”));
* assert(finder.distance(“fox”, “the”) == 3);
* assert(finder.distance(“quick”, “fox”) == 1);
*/
// 找最短的距离(array里面允许重复)
public class findDistance {
public static int Distance(String[] words, String word1, String word2) {
if(words == null || words.length <= 0) return -1;
int n = words.length;
int index1 = -1;
int index2 = -1;
int res = n;
for(int i = 0; i < words.length; ++i) {
if(words[i] == word1) index1 = i;
if(words[i] == word2) index2 = i;
if((words[i] == word1 || words[i] == word2) && index1 != -1 && index2 != -1) {
res = Math.min(Math.abs(index1 - index2), res);
}
}
return res;
}
public static void main(String[] args){
String[] s = {"the", "quick", "brown", "fox", "quick"};
System.out.println(Distance(s, "the", "fox"));
}
}
| LiJinglin918/Interview_Amazon | FindDistance.java |
65,774 |
/*迪杰斯特拉 : dijkstra 思路: 维护一个距离表, 标记是否最短距离 ,动态规划更新最短距离表*/
import java.util.LinkedList;
import java.util.List;
public class Dijkstra {
// 迪杰斯特拉 最短路径算法
public static int[] dijkstra(Graph graph,int startIndex){
// 图的顶点数量
int size = graph.vertexes.length;
// 创建距离表,存储从起点 到每一个顶点的临时距离
int[] distances = new int[size];
// 记录顶点的遍历状态
boolean[] access = new boolean[size];
// 初始化最短路径表 , 到达每个顶点的路径代价默认为无穷大
for (int i = 1; i < size; i++) {
distances[i] = Integer.MAX_VALUE;
}
// 遍历起点 ,刷新距离表 A->B A->C
access[0] = true;
List<Edge> edgesFromStart = graph.adj[startIndex];
for (Edge edge: edgesFromStart){
distances[edge.index] = edge.weight;
}
// 主循环 ,重复遍历最短距离顶点 和刷新距离表的操作
for (int i = 1; i < size; i++) {
// 寻找最短距离顶点
int minDistanceFromStart = Integer.MAX_VALUE;
int minDistanceIndex = -1;
for (int j = 1; j < size ; j++) {
// 动态规划 更新最短距离表
if (!access[j] &&(distances[j]<minDistanceFromStart)){
minDistanceFromStart = distances[j];
minDistanceIndex = j;
}
}
if (minDistanceIndex == -1){
break;
}
// 遍历顶点 ,刷新距离表 更新是否是最短距离表
access[minDistanceIndex] = true;
for (Edge edge : graph.adj[minDistanceIndex]){
if (access[edge.index]){
continue;
}
int weight = edge.weight;
int preDistance = distances[edge.index];
if ((weight != Integer.MAX_VALUE)&&((minDistanceFromStart+weight)<preDistance)){
distances[edge.index] = minDistanceFromStart + weight;
}
}
}
return distances;
}
/*图的顶点*/
private static class Vertex{
String data;
Vertex(String data){
this.data = data;
}
}
private static class Edge{
int index;
int weight;
Edge(int index,int weight){
this.index = index;
this.weight = weight;
}
}
// 图
private static class Graph{
private Vertex[] vertexes;
private LinkedList<Edge>[] adj;
Graph(int size){
// 初始化顶点 和 玲姐矩阵
vertexes = new Vertex[size];
adj = new LinkedList[size];
for (int i = 0; i < adj.length; i++) {
adj[i] = new LinkedList<Edge>();
}
}
}
}
| liangjian66/algo | src/Dijkstra.java |
65,775 | import controllers.GameController;
import models.gamesystem.Stage;
import models.gamesystem.StageSave;
import models.mission.Mission;
import views.Canvas;
import views.CardView;
import views.MenuView;
import java.awt.*;
public class MainGame {
public static void main(String[] args) throws Exception {
//游戏主进程 model
Stage gameStage = new Stage();
/* StageSave.deserializeStage();
Stage gameStage=StageSave.newStage();*/
//游戏主菜单
MenuView m = new MenuView();
m.createPanel();
m.toShow();
//在上面就要完成阵营/关卡/卡片的选择
//用一个循环来等待用户准备完毕
while (CardView.getIfStart() == 0) {
System.out.println("");
}
Canvas canvas = new Canvas();
//控制器(注意构造方法和后面的set方法有重复
GameController controller = new GameController(canvas, gameStage);
controller.getKeyBoardController().setMapView(canvas.getMapView());
//绑定
gameStage.setController(controller);
canvas.setGameController(controller);
//游戏开始 传入阵营和关卡
gameStage.playGame(1, 2);
//游戏菜单
//关卡循环 Model中进行数据处理,View中进行绘制,开两个线程,使用controller进行通信
}
}
| haojie06/pvz | src/MainGame.java |
65,776 | //作为项目经理,你规划了一份需求的技能清单 req_skills,并打算从备选人员名单 people 中选出些人组成一个「必要团队」( 编号为 i 的备选人员
// people[i] 含有一份该备选人员掌握的技能列表)。
//
// 所谓「必要团队」,就是在这个团队中,对于所需求的技能列表 req_skills 中列出的每项技能,团队中至少有一名成员已经掌握。可以用每个人的编号来表示团
//队中的成员:
//
//
// 例如,团队 team = [0, 1, 3] 表示掌握技能分别为 people[0],people[1],和 people[3] 的备选人员。
//
//
// 请你返回 任一 规模最小的必要团队,团队成员用人员编号表示。你可以按 任意顺序 返回答案,题目数据保证答案存在。
//
//
//
// 示例 1:
//
//
//输入:req_skills = ["java","nodejs","reactjs"], people = [["java"],["nodejs"],[
//"nodejs","reactjs"]]
//输出:[0,2]
//
//
// 示例 2:
//
//
//输入:req_skills = ["algorithms","math","java","reactjs","csharp","aws"], people
//= [["algorithms","math","java"],["algorithms","math","reactjs"],["java",
//"csharp","aws"],["reactjs","csharp"],["csharp","math"],["aws","java"]]
//输出:[1,2]
//
//
//
//
// 提示:
//
//
// 1 <= req_skills.length <= 16
// 1 <= req_skills[i].length <= 16
// req_skills[i] 由小写英文字母组成
// req_skills 中的所有字符串 互不相同
// 1 <= people.length <= 60
// 0 <= people[i].length <= 16
// 1 <= people[i][j].length <= 16
// people[i][j] 由小写英文字母组成
// people[i] 中的所有字符串 互不相同
// people[i] 中的每个技能是 req_skills 中的技能
// 题目数据保证「必要团队」一定存在
//
//
// Related Topics 位运算 数组 动态规划 状态压缩 👍 126 👎 0
//leetcode submit region begin(Prohibit modification and deletion)
class Solution {
public int[] smallestSufficientTeam(String[] req_skills, List<List<String>> people) {
}
}
//leetcode submit region end(Prohibit modification and deletion)
| DEAiFISH/LeetCode | editor/cn/[1125]最小的必要团队.java |
65,777 | /**
* The MIT License (MIT)
* Copyright (c) 2012-present 铭软科技(mingsoft.net)
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package net.mingsoft.cms.dao;
import net.mingsoft.base.dao.IBaseDao;
import net.mingsoft.cms.entity.CategoryEntity;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* 分类持久层
* @author 铭飞开发团队
* 创建日期:2019-11-28 15:12:32<br/>
* 历史修订:<br/>
*/
@Component("cmsCategoryDao")
public interface ICategoryDao extends IBaseDao<CategoryEntity> {
/**
* 查询当前分类下面的所有子分类
* @param category 必须存在categoryId categoryParentId
* @return
*/
public List<CategoryEntity> queryChildren(CategoryEntity category);
}
| ming-soft/MCMS | src/main/java/net/mingsoft/cms/dao/ICategoryDao.java |
65,778 | /**
* 团队
* 团队属性、团队成员的管理:添加、删除等
*
* */
package com.java.domain;
import com.java.service.EmployeesService;
import com.java.service.TeamException;
import com.java.utils.Magic;
import java.util.*;
public class Team {
private static int init = 1; // 团队id初始值
private int id; // 团队id
private String name; // team name
private LinkedHashMap<Class, HashMap> membersStructor = new LinkedHashMap<>(); // 团队成员结构要求,如:{ Programmer: {"max": 3, "total":2}, Designer: {"max": 2, "total":0}, Architect: {"max": 1, "total":20 }
private LinkedList<Employee> members = new LinkedList<>(); // 团队成员
// 构造器
public Team() {
super();
idProcess();
}
public Team(String name) {
setName(name);
idProcess();
}
public Team(String name, LinkedHashMap<Class, HashMap> membersStructor) {
setName(name);
setMembersStructor(membersStructor);
idProcess();
}
public Team(int id, String name, LinkedHashMap<Class, HashMap> membersStructor) throws TeamException {
if (id < init) {
this.id = id;
setName(name);
setMembersStructor(membersStructor);
} else {
throw new TeamException("无效id");
}
}
// 方法
private void idProcess() {
id = init;
++init;
}
public int getId() {
return id;
}
public String getName() {
return name;
}
public void setName(String name) {
if (name.length() > 0 && name.length() <= 36) {
this.name = name;
} else {
System.out.println("团队名长度范围: (0, 36]");
}
}
public LinkedHashMap<Class, HashMap> getMembersStructor() {
return membersStructor;
}
public void setMembersStructor(LinkedHashMap<Class, HashMap> membersStructor) {
this.membersStructor = membersStructor;
}
/**
* 添加一个岗位要求到成员结构要求membersStructor中
* @param post
* 岗位名
* @param postRequirements
* 岗位需求
* @return 返回操作的状态成功/失败
* */
public boolean addPostToMmbersStructor(Class post, HashMap postRequirements) {
if (!membersStructor.keySet().contains(post)) {
membersStructor.put(post, postRequirements);
return true;
} else {
System.out.println("本团队已经存在此岗位");
}
return false;
}
/**
* 从成员结构要求membersStructor中删除指定的岗位需求
* @param post
* 岗位名
* @return 返回操作的状态成功/失败
* */
public boolean deletePostFromMmbersStructor(Class post) {
if (membersStructor.keySet().contains(post)) {
// 该岗位未加入相应的员工才能被删除
if ((int) membersStructor.get(post).get("total") == 0) {
membersStructor.remove(post);
return true;
} else {
System.out.println("本团队中该岗位还有其他员工,不能删除");
}
}
return false;
}
/**
* 修改岗位需求
* @param post
* 指定要修改的岗位名
* @param postRequirements
* 新的岗位需求
* @return 返回操作的状态成功/失败
* */
public boolean modifyPostMembersStructor(Class post, HashMap postRequirements) {
if (membersStructor.keySet().contains(post)) {
if (membersStructor.get(post).equals(postRequirements)) {
System.out.println("新的岗位需求与原来的一样");
return false;
}
membersStructor.put(post, postRequirements);
return true;
}
System.out.println("不存在此岗位");
return false;
}
/**
* 修改指定岗位的预招人数
* @param num
* 新的预招人数
* */
public boolean modifyTeamPostMax(Class post, int num) {
if (membersStructor.keySet().contains(post)) {
int total = (int) membersStructor.get(post).get("total");
if (num > total) {
membersStructor.get(post).put("max", num);
return true;
}
}
return false;
}
/**
* 查询指定岗位的需求
* @param post
* 岗位名
* @return 岗位的需求,为空则返回null
* */
public HashMap getPostRequirements(Class post) {
if (membersStructor.keySet().contains(post)) {
return membersStructor.get(post);
}
return null;
}
public String showMembersStructor() {
String str = "";
if (membersStructor != null) {
Set<Map.Entry<Class, HashMap>> entrysSet = membersStructor.entrySet();
str += String.format("-----------------%s团队成员结构-----------------\n\n" +
"%-12s\t%-12s\t%-12s\n", name, "岗位", "预编(个)", "实编(个)");
for (Map.Entry<Class, HashMap> entry : entrysSet) {
// String[] sArr = entry.getKey().toString().split("\\.");
// str += String.format("%-12s\t%-12s\t%-12s\n", sArr[sArr.length -1], entry.getValue().get("max"), entry.getValue().get("total"));
str += String.format("%-12s\t%-12s\t%-12s\n", Magic.clazzToPost(entry.getKey()), entry.getValue().get("max"), entry.getValue().get("total"));
}
str += "\n";
}
return str;
}
public LinkedList<Employee> getMembers() {
return members;
}
public String showMembers() {
String str = "";
if (members != null) {
str += "{";
for (Employee e : members) {
str += "'" + e.getName() +"', \n";
}
str += "}";
}
return str;
}
public int getMembersCount() {
return members.size();
}
/**
* 指定员工岗位是否包是含在本团队岗位要求中
* @param member
* 成员(员工)
* @return int形式的检查结果
* 0:本团队无该员工职位对应的岗位
* 1:该员工职位对应的岗位人数已满
* 2:该员工职位对应的岗位人数还未满
* -1:团队岗位结构数据membersStructor出现了异常
* */
public int postCheck(Employee member) {
Class clazz1 = member.getClass();
if (membersStructor.keySet().contains(clazz1)) {
HashMap postRequirements = getPostRequirements(member.getClass());
if (postRequirements != null) {
int max = (int) postRequirements.get("max");
int total = (int) postRequirements.get("total");
if (total >= 0 && total <= max) {
if (max == total) {
return 1;
} else {
return 2;
}
} /*else {
return -1;
}*/
}
return -1;
}
return 0;
}
/**
* 添加指定成员到memebers 列表中
* @param member
* 员工
* */
public boolean addMember(Employee member) throws TeamException{
if (member != null) {
if (members.contains(member)) {
throw new TeamException("该员工已在本团队中\n");
} else if (member.getStatus() == EmployeeStatus.FREE) {
int ret = postCheck(member);
HashMap postRequirements = getPostRequirements(member.getClass());
if (ret == 0) {
throw new TeamException(String.format("本团队暂未设%s岗位,无法添加\n", member.getPost()));
} else if (ret == 1) {
throw new TeamException(String.format("%s团队%s岗位只需要%d个成员,已经满员\n", name, member.getPost(), (int) postRequirements.get("max")));
} else if (ret == 2) { // 团队的该岗位人数未满,添加成员
// members 添加该加工
boolean status = members.add(member);
if (status) {
// 更新团队成员结构
int i = (int) postRequirements.get("total");
++i;
postRequirements.put("total", i);
// 更新该员工的加入团队状态
member.setStatus(EmployeeStatus.BUSY);
// 设置该加工已经加入的团队
member.setTeam(this);
}
return status;
}
} else if (member.getStatus() == EmployeeStatus.BUSY) {
throw new TeamException(String.format("该员工已是%s团队的成员\n", member.getTeam().getName()));
} else if (member.getStatus() == EmployeeStatus.VOCATION) {
throw new TeamException("该员正在休假,无法添加\n");
}
}
return false;
}
/**
* 添加指定id的成员到memebers 列表中
* @param memberId
* 员工
* */
public boolean addMember(int memberId) throws TeamException{
Employee employee = EmployeesService.getEmployee(memberId);
return addMember(employee);
}
/**
* 指定的成员退出团队
* */
public boolean removeMember(Employee member) throws TeamException {
if (members.contains(member)) {
// 更新团队的成员结构
int total = (int) membersStructor.get(member.getClass()).get("total");
--total;
membersStructor.get(member.getClass()).put("total", total);
// members中删除该成员
boolean status = members.remove(member);
if (status) {
// 重置员工team字段中记录的team
member.setTeam(null);
}
return status;
}
throw new TeamException(String.format("%s团队中无此员工,删除失败", name));
}
/**
* 指定id的成员退出团队
* */
public boolean removeMember(int memberId) throws TeamException {
Employee employee = EmployeesService.getEmployee(memberId);
return removeMember(employee);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Team team = (Team) o;
return name != null ? name.equals(team.name) : team.name == null;
}
@Override
public int hashCode() {
return name != null ? name.hashCode() : 0;
}
@Override
public String toString() {
return "Team{" + "\n" +
"id=" + id + "\n" +
", name='" + name + '\'' + "\n" +
", membersStructor=" + showMembersStructor() + "\n" +
", members=" + members + "\n" +
'}';
}
public static void setInit(int init) {
if (init >= 1) {
Team.init = init;
}
}
public static int getInit() {
return init;
}
}
| cucker0/java | project03/src/com/java/domain/Team.java |
65,779 | package com.zjut.oa.tool;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.json.simple.JSONObject;
public class UploadTool {
private static final Log log = LogFactory.getLog(UploadTool.class);
//编辑器图片
public static final String SAVE_DIR_NAME = "attached";
public static final String[] ALLOW_FILE_SUFFIX = new String[] { "gif",
"jpg", "jpeg", "png", "bmp" };
public static final long ALLOW_MAX_FILE_SIZE = 1000000; // 1M
//图像
public static final String[] IMAGE_ALLOW_FILE_SUFFIX = new String[] {
"gif", "jpg", "jpeg", "png", "bmp", };
public static final long IMAGE_ALLOW_MAX_FILE_SIZE = 10000000; // 10M
public static final String FILE_SAVE_DIR_NAME = "file";
public static final String[] FILE_ALLOW_FILE_SUFFIX = new String[] { "gif",
"jpg", "jpeg", "png", "bmp", "doc", "ppt", "xls", "pdf", "chm",
"7z", "zip", "rar" };
public static final long FILE_ALLOW_MAX_FILE_SIZE = 10000000; // 10M
// 产品
public static final String PRODUCT_SAVE_DIR_NAME = "product";
// 团队
public static final String TEAM_SAVE_DIR_NAME = "team";
@SuppressWarnings("unchecked")
public static String getErrorJson(String message) {
JSONObject obj = new JSONObject();
obj.put("error", 1);
obj.put("message", message);
log.info("Error Json: " + obj.toJSONString());
return obj.toJSONString();
}
} | ZJUT/Jh-oa | src/com/zjut/oa/tool/UploadTool.java |
65,780 | package com.jladder.entity;
import com.jladder.db.annotation.Table;
import java.io.Serializable;
@Table("sys_service")
public class DbProxy implements Serializable {
/// <summary>id</summary>
public String id;
/// <summary>名称</summary>
public String name ;
/// <summary>标题</summary>
public String title ;
/// <summary>入口参数</summary>
public String params;
/// <summary>映射信息</summary>
public String mappings ;
/// <summary>是否可用</summary>
public int enable ;
/// <summary>返回处理</summary>
public String returns ;
/// <summary>请求方式</summary>
public String method ;
/// <summary>类型</summary>
public String type ;
/// <summary>调用者</summary>
public String caller ;
/// <summary>维护者</summary>
public String maintainer ;
/// <summary>开发语言</summary>
public String language ;
/// <summary>描述信息</summary>
public String descr ;
/// <summary>版本号</summary>
public String version ;
/// <summary>更新时间</summary>
public String updatetime ;
/// <summary>创建时间</summary>
public String creaetetime;
/// <summary>分属</summary>
public String sort ;
/// <summary>团队</summary>
public String team ;
/// <summary>功能信息</summary>
public String funinfo ;
/// <summary>上级</summary>
public String superior ;
/// <summary>上级</summary>
public String debugging ;
/// <summary>
/// 重要等级
/// </summary>
public String level;
/// <summary>
/// 日志级别
/// </summary>
public int logoption;
/// <summary>
/// 返回样板
/// </summary>
public String sample;
/// <summary>
/// 请求示例
/// </summary>
public String example;
/// <summary>
/// 调用信息
/// </summary>
public String callinfo;
}
| Ladder2020/JLadder | src/main/java/com/jladder/entity/DbProxy.java |
65,781 | /*
In a project, you have a list of required skills req_skills, and a list of people.
The i-th person people[i] contains a list of skills that person has.
Consider a sufficient team: a set of people such that for every required skill in req_skills,
there is at least one person in the team who has that skill.
We can represent these teams by the index of each person:
for example, team = [0, 1, 3] represents the people with skills people[0], people[1], and people[3].
Return any sufficient team of the smallest possible size, represented by the index of each person.
You may return the answer in any order. It is guaranteed an answer exists.
Example 1:
Input: req_skills = ["java","nodejs","reactjs"], people = [["java"],["nodejs"],["nodejs","reactjs"]]
Output: [0,2]
Example 2:
Input: req_skills = ["algorithms","math","java","reactjs","csharp","aws"], people = [["algorithms","math","java"],["algorithms","math","reactjs"],["java","csharp","aws"],["reactjs","csharp"],["csharp","math"],["aws","java"]]
Output: [1,2]
Constraints:
1. 1 <= req_skills.length <= 16
2. 1 <= people.length <= 60
3. 1 <= people[i].length, req_skills[i].length, people[i][j].length <= 16
4. Elements of req_skills and people[i] are (respectively) distinct.
5. req_skills[i][j], people[i][j][k] are lowercase English letters.
6. Every skill in people[i] is a skill in req_skills.
7. It is guaranteed a sufficient team exists.
*/
/**
* Approach: DP + Path Record + State Compression
* 题意:我们要从 P个人里面挑选若干人组建一个有 N 个技能组成的全能团队。
* 问最少选择多少人可以组建这个全能团队。
*
* 第一眼看上去这道问题与背包问题非常类似,每个人有选和不选两种情况。
* 但是在这道题目中我们面临着一个问题:每个人都具备 X 个技能,那么应该如何表示呢?
* 这时,我们观察题目的数据规模可以发现:需求的技能总个数不会超过16,2^16=65536 因此想到可以利用 二进制 进行状态压缩。
* 即将一个人的技能项转换成一个 int 来表示。
*
* 然后就是按照 01背包 的思路来解决这个问题。
* dp[i][j] 代表前 i 个人组成一个拥有技能 j 的团队,最少需要多少人。
* 状态转移方程为:
* 选择第i个人:dp[i][j|k] = dp[i-1][j] + 1
* 不选择第i个人:dp[i][j|k] = dp[i-1][j|k]
* 即 dp[i][j|k] = min(dp[i-1][j|k], dp[i-1][j] + 1)
* 最后所需要最少的人数就是:dp[people.size()][target] (target就是所有技能都具备的情况,是一个由状态压缩获得的 int 值)
* 与 01背包 同理,dp[i][j] 仅仅与 上一行dp[i-1][j] 的状态有关,因此可以将其进行空间优化成一维数组。
*
* 因为这道题目要求我们给出具体的人员组成,不再是像传统 DP 那样给出最后的个数即可。
* 因此,在 DP 的过程中,我们需要记录其路径,从而最后才能将结果路径还原出来。
* 这里使用了 Map 来记录路径,key:当前的技能状态, value: arr[0]代表上一个状态,arr[1]代表选取了哪个人
* 然后通过对 target 进行回溯,即可得到最终的结果路径。
*
* 时间复杂度:O(p * 2^n) p为人员个数,n为需求的技能个数
* 空间复杂度:O(2^n)
*
* Reference:
* https://youtu.be/5Kr1PWAgEx8
*/
class Solution {
public int[] smallestSufficientTeam(String[] req_skills, List<List<String>> people) {
int n = req_skills.length, m = people.size(), target = (1 << n) - 1;
Map<String, Integer> skillMap = new HashMap<>();
for (int i = 0; i < n; i++) {
skillMap.put(req_skills[i], i);
}
int[] dp = new int[target + 1];
// Initialize the dp array using 0x3f3f3f3f to avoid overflow
Arrays.fill(dp, 0x3f3f3f3f);
dp[0] = 0;
Map<Integer, int[]> path = new HashMap<>();
for (int i = 0; i < m; i++) {
int skill = 0;
for (String s : people.get(i)) {
skill |= 1 << skillMap.get(s);
}
for (int j = target; j >= 0; j--) {
if (dp[j] + 1 < dp[j | skill]) {
dp[j | skill] = dp[j] + 1;
// Record the path
path.put(j | skill, new int[]{j, i});
}
}
}
int index = dp[target];
int[] ans = new int[index];
while (target > 0) {
ans[--index] = path.get(target)[1];
target = path.get(target)[0];
}
return ans;
}
} | cherryljr/LeetCode | Smallest Sufficient Team.java |
65,782 | package game.team;
import game.award.AwardType;
import game.events.all.fight.BattleHeroBase;
import game.fighter.FighterBase;
import game.fighter.Hero;
import game.fightoffriend.FightOfFriendBase;
import game.log.Logs;
import game.pvp.MatchingType;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;
import define.DefaultCfg;
import manager.DWType;
import user.UserInfo;
import user.UserManager;
import util.ErrorCode;
/**
* 玩家的团队管理
* @author DXF
*/
public class TeamManager {
private UserInfo user;
private final TeamDataProvider db = TeamDataProvider.getInstance();
// 我的团队英雄 列表
private List<TeamHero> teamHeroList;
// 匹配 绿卡团队
private List<TeamHero> matchGreenTeam;
// 匹配 蓝卡团队
private List<TeamHero> matchBlueTeam;
// 匹配 紫卡团队
private List<TeamHero> matchPurpleTeam;
// 排位赛 团队
private List<TeamHero> qualifyingTeam;
// 协助好友
private AssistBase assistFriends ;
// 最后一次主动操作的卡片颜色
private MatchingType lastAccordOperate = MatchingType.GREEN_CARD;
@SuppressWarnings("unchecked")
public TeamManager( UserInfo user ) {
super();
this.user = user;
Object[] obj = db.get( user );
teamHeroList = (List<TeamHero>) obj[0];
assistFriends = (AssistBase) obj[1];
matchGreenTeam = (List<TeamHero>) obj[2];
matchBlueTeam = (List<TeamHero>) obj[3];
matchPurpleTeam = (List<TeamHero>) obj[4];
lastAccordOperate = (MatchingType) obj[5];
qualifyingTeam = (List<TeamHero>) obj[6];
if( qualifyingTeam.isEmpty() )
qualifyingTeam.addAll( teamHeroList );
}
public AssistBase getAssistFriend() {
return assistFriends;
}
public void claerAssist(){
assistFriends = null;
}
public MatchingType getLastAOMate(){
return lastAccordOperate;
}
/**
* 获得队长信息
* @return
*/
public Hero getCaptain(){
if( teamHeroList.isEmpty() ) return null;
TeamHero team = teamHeroList.get(0);
return user.getHeroManager().getHero( team.getUId() );
}
public List<TeamHero> getTeam() {
return teamHeroList;
}
public List<TeamHero> getMatchGreenTeam() {
return matchGreenTeam;
}
public List<TeamHero> getMatchBlueTeam() {
return matchBlueTeam;
}
public List<TeamHero> getMatchPurpleTeam() {
return matchPurpleTeam;
}
public List<TeamHero> getQualifyingTeam(){
return qualifyingTeam;
}
/**
* 根据唯一ID 获取 数据
* @param uid
* @return
*/
public TeamHero get( int uid ) {
for( TeamHero hero : teamHeroList ){
if( hero.getUId() == uid )
return hero;
}
return null;
}
/**
* 将团队取出
* @return
*/
public List<Hero> getToHero() {
List<Hero> list = new ArrayList<Hero>();
for( TeamHero t : teamHeroList ){
Hero h = user.getHeroManager().getHero( t.getUId() );
if( h == null ) continue;
list.add( h );
}
return list;
}
/**
* 将团队取出
* @return
*/
public List<FighterBase> getReadyToHero() {
List<FighterBase> fighter = new ArrayList<FighterBase>();
for( int i = 0; i < teamHeroList.size(); i++ )
{
TeamHero teamHero = teamHeroList.get(i);
FighterBase fighterBase = addReady( teamHero, i == 0 );
fighter.add( fighterBase );
}
// 最后在把协助好友加上
if( assistFriends != null && assistFriends.getPosition() != -1 ){
// 这里拷贝一份
FighterBase fighterBase = new FighterBase( assistFriends.getCaptainHero() );
// 如果死亡 那么就将hp设为0即可
if( assistFriends.getIsDie() )
fighterBase.setHp( 0 );
// 设置位置
fighterBase.setPosition( assistFriends.getPosition() );
// 设置是否队长
fighterBase.setIsCaptain( true );
fighter.add( fighterBase );
}
return fighter;
}
private FighterBase addReady( TeamHero team, boolean isCaptain ){
// 这里拷贝一份
FighterBase fighterBase = new FighterBase( user.getHeroManager().getFighter( team.getUId() ) );
// 如果死亡 那么就将hp设为0即可
if( team.getIsDie() )
fighterBase.setHp( 0 );
// 设置位置
fighterBase.setPosition( team.getPosition() );
// 设置是否队长
fighterBase.setIsCaptain( isCaptain );
return fighterBase;
}
/**
* 切换团队
* @param teamHero
*/
public void changeTeam( List<TeamHero> teamHero ) {
if( teamHero == null || teamHero.isEmpty() ) return;
teamHeroList.clear();
teamHeroList = teamHero;
}
/**
* 切换团队阵型
* @param data
* @return
*/
public boolean changePosition( ByteBuffer data ) {
byte count = data.get();
if( count < 1 || count > 6 ) return false;
List<BattleHeroBase> nBattleHeroLists = new ArrayList<BattleHeroBase>();
byte[] poss = { 1, 1, 1, 1, 1, 1 };
for( int i = 0; i < count; i++ )
{
int uID = data.getInt();
byte pos = data.get();
if( pos < 0 || pos >= poss.length ){
Logs.error( user, "战斗时出错 英雄位置错误 pos=" + pos );
assistFriends = null;
return false;
}
if( poss[pos] == 1 ){
poss[pos] = 0;
nBattleHeroLists.add( new BattleHeroBase( uID, pos ) );
}else{
Logs.error( user, "战斗时出错 英雄位置重复!" );
assistFriends = null;
return false;
}
}
return changePosition( nBattleHeroLists, data );
}
/**
* 切换英雄位置
* @param uID
* @param pos
* @return
*/
public boolean changePosition( List<BattleHeroBase> battleHeroLists, ByteBuffer data ) {
if( teamHeroList.isEmpty() ) {
Logs.error( user, "玩家还没有团队" );
return false;
}
for( BattleHeroBase b : battleHeroLists ){
// if( assistFriends != null && assistFriends.getUId() == b.m_nUID ){
//
// assistFriends.setPosition( b.m_nPosition );
//
// continue;
// }
TeamHero hero = get( b.m_nUID );
if( hero == null ) {
Logs.error( user, "切换英雄位置 出错 团队中没有 ID=" + b.m_nUID + " 这个英雄!" );
return false;
}
hero.setPosition( b.m_nPosition );
}
// 接受邀请的好友信息
/*int uID = */data.getInt();
byte pos = data.get();
if( assistFriends != null && pos != -1 ){
assistFriends.setPosition( pos );
}
return true;
}
/**
* 设置 协助好友ID
* @param assistID
* @return
*/
public boolean setAssistID( int assistID ) {
if( assistFriends != null ) assistFriends = null;
UserInfo u = UserManager.getInstance().getByName( assistID );
if( u == null ){
Logs.debug( user, "当前战斗没有 好友助阵1" );
return false;
}
FightOfFriendBase fBase = user.getFightOfFriendManager().getUIDToUserID( assistID );
if( fBase == null ){
Logs.debug( user, "当前战斗没有 好友助阵2" );
return false;
}
assistFriends = new AssistBase( fBase.m_nCaptainHero.getUID() );
assistFriends.setUserUID( assistID );
assistFriends.setCaptainHero( fBase.m_nCaptainHero );
assistFriends.setExpert( fBase.m_nIsExpert );
// 在这里记录 战斗时的协助好友 保证不能重复被邀请
user.getFightOfFriendManager().put( assistID );
return true;
}
/**
* 刷新死亡
* @param position
*/
public void updataDie( byte position ) {
if( assistFriends != null && assistFriends.getPosition() == position )
assistFriends.setIsDie( true );
for( TeamHero hero : teamHeroList ){
if( hero.getPosition() == position ){
hero.setIsDie( true );
break;
}
}
}
/**
* 刷新绝对死亡
*/
public void updataAbsoluteDie(){
for( TeamHero hero : teamHeroList )
hero.IsAbsoluteDie( hero.getIsDie() );
if( assistFriends != null )
assistFriends.IsAbsoluteDie( assistFriends.getIsDie() );
}
/**
* 将所有 复活
*/
public void updataLive(){
for( TeamHero hero : teamHeroList ){
hero.setIsDie( false );
hero.IsAbsoluteDie( false );
}
if( assistFriends != null ){
assistFriends.setIsDie( false );
assistFriends.IsAbsoluteDie( false );
}
}
/**
* 刷新团队信息
*/
public ErrorCode updata() {
return db.updata( user, encrypt(), encryptAssist(), encryptMate(), encryptQualifying(), lastAccordOperate );
}
/**
* 初始团队信息
* @param teamHero
*/
public void initTeam( List<TeamHero> teamHero ) {
if( teamHero == null || teamHero.isEmpty() ) return;
teamHeroList.clear();
teamHeroList = teamHero;
// db.add( user, encrypt() );
}
public void add(){
db.add( user, encrypt() );
}
// 将团队信息 加密成字符串
private String encrypt(){
StringBuilder output = new StringBuilder();
for( int i = 0; i < teamHeroList.size(); i++ )
{
TeamHero hero = teamHeroList.get(i);
// 在这里做下 是否 重复
boolean isRepeat = false;
for( int j = i + 1; j < teamHeroList.size(); j++ ){
if( teamHeroList.get(i).getUId() == teamHeroList.get(j).getUId() ){
isRepeat = true;
break;
}
}
if( isRepeat ) continue;
/////
output.append( hero.getUId() );
output.append(",").append( hero.getPosition() );
output.append(",").append( hero.getIsDie() ? 1 : 0 );
output.append(",").append( hero.IsAbsoluteDie() ? 1 : 0 );
output.append( "|" );
}
return output.toString();
}
private String encryptQualifying() {
StringBuilder output = new StringBuilder();
for( int i = 0; i < qualifyingTeam.size(); i++ )
{
TeamHero hero = qualifyingTeam.get(i);
output.append( hero.getUId() );
output.append(",").append( hero.getPosition() );
output.append(",").append( hero.getIsDie() ? 1 : 0 );
output.append(",").append( hero.IsAbsoluteDie() ? 1 : 0 );
output.append( "|" );
}
return output.toString();
}
private String encryptAssist() {
if( assistFriends == null )
return "";
StringBuilder content = new StringBuilder();
content.append( assistFriends.getUserUID() ).append( "," );
content.append( assistFriends.getPosition() ).append( "," );
content.append( assistFriends.getIsDie() ? 1 : 0 ).append( "," );
content.append( assistFriends.IsAbsoluteDie() ? 1 : 0 ).append( "," );
content.append( assistFriends.getHeorContent() ).append( "," );
content.append( assistFriends.getExpert() );
return content.toString();
}
/**
* 删除指定英雄
* @param uid
*/
public void remove( int uid ) {
// 默认团队 是不可能被删除的 fox
// 删除匹配团队
if( remove( MatchingType.GREEN_CARD, uid ) )
return;
if( remove( MatchingType.BLUE_CARD, uid ) )
return;
if( remove( MatchingType.PURPLE_CARD, uid ) )
return;
// 删除排位的
for( int i = 0; i < qualifyingTeam.size(); i++ ){
TeamHero x = qualifyingTeam.get(i);
if( x == null ) continue;
if( x.getUId() == uid ) {
qualifyingTeam.remove(i);
return ;
}
}
}
/**
* 复活指定英雄
* @param uid
* @return
*/
public ErrorCode resirrection( int uid ) {
TeamHero hero = get( uid );
if ( hero == null || (hero != null && !hero.getIsDie()) ){
if( assistFriends != null && assistFriends.getUId() == uid )
hero = assistFriends;
else{
Logs.error( user, "玩家复活指定英雄 出错 团队中或协助好友没有 UID=" + uid + "这个英雄!" );
return ErrorCode.TEAM_NOT_HERO;
}
}
int needMoney = 3000;
if( user.changeAward( AwardType.CASH, -needMoney, "战斗中复活英雄 消耗金币", DWType.MISCELLANEOUS) == -1 )
return ErrorCode.USER_CASH_NOT_ENOUTH;
hero.setIsDie( false );
hero.IsAbsoluteDie( false );
return ErrorCode.SUCCESS;
}
private String[] encryptMate() {
String[] list = new String[3];
StringBuilder content = new StringBuilder();
for( TeamHero x : matchGreenTeam ){
content.append( x.getUId() );
content.append(",").append( x.getPosition() );
content.append(",").append( x.getIsDie() ? 1 : 0 );
content.append(",").append( x.IsAbsoluteDie() ? 1 : 0 );
content.append( "|" );
}
list[0] = content.toString();
content = new StringBuilder();
for( TeamHero x : matchBlueTeam ){
content.append( x.getUId() );
content.append(",").append( x.getPosition() );
content.append(",").append( x.getIsDie() ? 1 : 0 );
content.append(",").append( x.IsAbsoluteDie() ? 1 : 0 );
content.append( "|" );
}
list[1] = content.toString();
content = new StringBuilder();
for( TeamHero x : matchPurpleTeam ){
content.append( x.getUId() );
content.append(",").append( x.getPosition() );
content.append(",").append( x.getIsDie() ? 1 : 0 );
content.append(",").append( x.IsAbsoluteDie() ? 1 : 0 );
content.append( "|" );
}
list[2] = content.toString();
return list;
}
/**
* 根据匹配卡片 获取对应团队
* @param type
* @return
*/
public List<TeamHero> getTeam( MatchingType type ) {
if( type == MatchingType.GREEN_CARD ){
return matchGreenTeam;
}else if( type == MatchingType.BLUE_CARD ){
return matchBlueTeam;
}else{
return matchPurpleTeam;
}
}
/**
* 设置匹配团队
* @param type
* @param list
*/
private void setTeam( MatchingType type, List<TeamHero> list ) {
if( type == MatchingType.PURPLE_CARD ){
matchPurpleTeam.clear();
matchPurpleTeam.addAll( list );
}else if( type == MatchingType.BLUE_CARD ){
matchBlueTeam.clear();
matchBlueTeam.addAll( list );
}else{
matchGreenTeam.clear();
matchGreenTeam.addAll( list );
}
}
// 删除指定英雄
private boolean remove( MatchingType type, int uid ){
List<TeamHero> list = getTeam( type );
for( int i = 0; i < list.size(); i++ ){
TeamHero x = list.get(i);
if( x == null ) continue;
if( x.getUId() == uid ) {
list.remove(i);
return true;
}
}
return false;
}
/**
* 根据匹配卡牌 获取团队英雄 复制
* @param type
* @return
*/
public List<Hero> getMatcTeamToHero( MatchingType type ) {
List<Hero> list = new ArrayList<Hero>();
List<TeamHero> teamList = getTeam( type );
for( int i = 0; i < teamList.size(); i++ ){
TeamHero x = teamList.get(i);
if( x == null ) continue;
// 这里拷贝一份
Hero cloneHero = user.getHeroManager().cloneHero( x.getUId() );
if( cloneHero == null ) continue;
// 如果死亡 那么就将hp设为0即可
if( x.getIsDie() )
cloneHero.setHp( 0 );
// 设置位置
cloneHero.setPosition( x.getPosition() );
// 设置队长
if( i == 0 ) cloneHero.setIsCaptain( true );
list.add( cloneHero );
}
return list;
}
/**
* 设置阵型
* @param list
* @param type
* @return
*/
public ErrorCode setMateTeamData( ByteBuffer data, MatchingType type ) {
byte[] poss = { 1, 1, 1, 1, 1, 1 };
List<TeamHero> listx = new ArrayList<TeamHero>();
List<Integer> xxx = new ArrayList<Integer>();
listx.add( null );
byte count = data.get();
if( count == 0 ){
Logs.error( user, "匹配出错 出战英雄为0个" );
return ErrorCode.UNKNOW_ERROR;
}
for( int i = 0; i < count; i++ ){
int uid = data.getInt();
if( xxx.indexOf( uid ) != -1 ){
Logs.error( user, "匹配战开始战斗出错 团队英雄重复 UID=" + uid );
return ErrorCode.UNKNOW_ERROR;
}
Hero hero = user.getHeroManager().getHero( uid );
if( hero == null ) {
Logs.error( user, "匹配战开始战斗出错 出战英雄UID=" + uid );
return ErrorCode.UNKNOW_ERROR;
}
// 颜色不一样 不行的啊
if( hero.getQuality().getColour().toNumber() != type.toNumber() )
{
Logs.error( user, "匹配战开始战斗出错 英雄卡片颜色匹配 UID=" + uid );
return ErrorCode.UNKNOW_ERROR;
}
byte pos = data.get();
byte isCaptain = data.get();
// 检查位置 是否重复
if( poss[pos] == 1 ){
poss[pos] = 0;
TeamHero x = new TeamHero( uid, pos, false );
if( isCaptain == 1 ){
listx.set( 0, x );
}else{
listx.add( x );
}
xxx.add( uid );
}else{
Logs.error( user, "匹配战斗时出错 英雄位置重复!" );
return ErrorCode.UNKNOW_ERROR;
}
}
if( listx.get(0) == null ) listx.remove(0);
setTeam( type, listx );
return ErrorCode.SUCCESS;
}
public MatchingType getMateType() {
return lastAccordOperate;
}
private boolean isExistAssist() {
return assistFriends != null && assistFriends.getPosition() != -1;
}
/**
* 获得友情点
* @return
*/
public int getAssistValue() {
if( !isExistAssist() ) return 0;
if( user.getFriendManager().isFriend( assistFriends.getUserUID() ) )
return DefaultCfg.ECTYPE_A_FRIEND;
else
return DefaultCfg.ECTYPE_A_NOT_FRIEND;
}
/**
* 是否队长
* @param hero
* @return
*/
public boolean isCaptain( int uid ) {
return teamHeroList.get(0).getUId() == uid;
}
/**
* 是否队长 包括PVP是否队长
* @return
*/
public boolean isCaptainAndPvp( int uid ){
if( isCaptain( uid ) )
return true;
if( !matchGreenTeam.isEmpty() && matchGreenTeam.get(0).getUId() == uid )
return true;
if( !matchBlueTeam.isEmpty() && matchBlueTeam.get(0).getUId() == uid )
return true;
if( !matchPurpleTeam.isEmpty() && matchPurpleTeam.get(0).getUId() == uid )
return true;
return false;
}
/**
* 卸下某个队员
* @param hero
*/
public void discharge( int uid ) {
for( TeamHero t : teamHeroList ){
if( uid == t.getUId() ){
teamHeroList.remove( t );
return;
}
}
remove( uid );
}
/////////////////////////////////////////排位赛////////////////////////////////////////////////////////
public ErrorCode setQualifyingTeam( ByteBuffer data ){
byte[] poss = { 1, 1, 1, 1, 1, 1 };
List<TeamHero> listx = new ArrayList<TeamHero>();
List<Integer> xxx = new ArrayList<Integer>();
listx.add( null );
byte count = data.get();
if( count == 0 ){
Logs.error( user, "排位出错 出战英雄为0个" );
return ErrorCode.UNKNOW_ERROR;
}
for( int i = 0; i < count; i++ ){
int uid = data.getInt();
if( xxx.indexOf( uid ) != -1 ){
Logs.error( user, "排位战开始战斗出错 团队英雄重复 UID=" + uid );
return ErrorCode.UNKNOW_ERROR;
}
Hero hero = user.getHeroManager().getHero( uid );
if( hero == null ) {
Logs.error( user, "排位战开始战斗出错 出战英雄UID=" + uid );
return ErrorCode.UNKNOW_ERROR;
}
byte pos = data.get();
boolean isCaptain = i == 0;
// 检查位置 是否重复
if( poss[pos] == 1 ){
poss[pos] = 0;
TeamHero x = new TeamHero( uid, pos, false );
if( isCaptain ){
listx.set( 0, x );
}else{
listx.add( x );
}
xxx.add( uid );
}else{
Logs.error( user, "排位战斗时出错 英雄位置重复!" );
return ErrorCode.UNKNOW_ERROR;
}
}
if( listx.get(0) == null ) listx.remove(0);
qualifyingTeam.clear();
qualifyingTeam.addAll(listx);
return ErrorCode.SUCCESS;
}
public List<Hero> getQualifyingTeamToHero() {
List<Hero> list = new ArrayList<Hero>();
for( int i = 0; i < qualifyingTeam.size(); i++ ){
TeamHero x = qualifyingTeam.get(i);
if( x == null ) continue;
// 这里拷贝一份
Hero cloneHero = user.getHeroManager().cloneHero( x.getUId() );
if( cloneHero == null ) continue;
// 如果死亡 那么就将hp设为0即可
if( x.getIsDie() )
cloneHero.setHp( 0 );
// 设置位置
cloneHero.setPosition( x.getPosition() );
// 设置队长
if( i == 0 ) cloneHero.setIsCaptain( true );
list.add( cloneHero );
}
if( list.isEmpty() ){
qualifyingTeam.addAll( teamHeroList );
return getQualifyingTeamToHero();
}
return list;
}
public int expertNeedMoney() {
return assistFriends == null ? 0 : assistFriends.getExpert();
}
}
| fantasylincen/javaplus | vc-zhs-gs/src/game/team/TeamManager.java |
65,783 | package com.future.domain;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
/**
* 报名类
*/
@Entity
@Table(name="cm_signups")
public class SignUp {
//报名类的 id
private Integer signUp_id;
//指导老师
private String signUp_teacher;
//如果是团队的话就拥有 团队名称及负责人
private String signUp_team;
// 如果是团队的话就 标注是团队负责人 0 不是 1 是
private Integer singUp_manager;
//报名的状态,表明是否通过审核 1: 报名 2: 审核通过 3:未通过
private Integer signUp_status;
//报名的类型 表明是否通过审核 1团体 2个人
private Integer singnup_type;
//报名时间
private Date signUP_time;
//报名表的学生
private Student signUp_student;
//该学生 报名的竞赛
private Competition signUp_competition;
//报名类型 1 团队 2 个人
private Integer signUP_type;
//是否已经录入获奖 0 未录 1 已录入
private Integer signUp_registerRecord = 0;
//是否已经进入下一级别竞赛 0:未进入 1:进入
private Integer nextClass;
@Id
@GeneratedValue
@Column(unique=true)
public Integer getSignUp_id() {
return signUp_id;
}
public void setSignUp_id(Integer signUp_id) {
this.signUp_id = signUp_id;
}
public String getSignUp_teacher() {
return signUp_teacher;
}
public void setSignUp_teacher(String signUp_teacher) {
this.signUp_teacher = signUp_teacher;
}
public String getSignUp_team() {
return signUp_team;
}
public void setSignUp_team(String signUp_team) {
this.signUp_team = signUp_team;
}
public Integer getSingUp_manager() {
return singUp_manager;
}
public void setSingUp_manager(Integer singUp_manager) {
this.singUp_manager = singUp_manager;
}
public Integer getSignUp_status() {
return signUp_status;
}
public void setSignUp_status(Integer signUp_status) {
this.signUp_status = signUp_status;
}
public Integer getSignUP_type() {
return signUP_type;
}
public void setSignUP_type(Integer signUP_type) {
this.signUP_type = signUP_type;
}
@Temporal(TemporalType.TIMESTAMP)
public Date getSignUP_time() {
return signUP_time;
}
public void setSignUP_time(Date signUP_time) {
this.signUP_time = signUP_time;
}
@ManyToOne(cascade=CascadeType.PERSIST,optional=true,fetch=FetchType.EAGER)
public Student getSignUp_student() {
return signUp_student;
}
public void setSignUp_student(Student signUp_student) {
this.signUp_student = signUp_student;
}
@ManyToOne(cascade=CascadeType.PERSIST,optional=true,fetch=FetchType.EAGER)
public Competition getSignUp_competition() {
return signUp_competition;
}
public void setSignUp_competition(Competition signUp_competition) {
this.signUp_competition = signUp_competition;
}
public Integer getSingnup_type() {
return singnup_type;
}
public void setSingnup_type(Integer singnup_type) {
this.singnup_type = singnup_type;
}
public Integer getSignUp_registerRecord() {
return signUp_registerRecord;
}
public void setSignUp_registerRecord(Integer signUp_registerRecord) {
this.signUp_registerRecord = signUp_registerRecord;
}
public SignUp() {
super();
}
public Integer getNextClass() {
return nextClass;
}
public void setNextClass(Integer nextClass) {
this.nextClass = nextClass;
}
public void decodeTeam(){
try {
this.signUp_team=java.net.URLDecoder.decode(this.signUp_team,"UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
}
| futureGroup511/CompeManager | src/main/java/com/future/domain/SignUp.java |
65,784 | package com.example.model;
import java.io.Serializable;
import java.util.Date;
import java.util.Set;
/**
*
* 活动信息类
*/
public class Activity implements Serializable{
/**
*
*/
private static final long serialVersionUID = 1L;
/**活动id*/
private int aId;
/**团队,如果是个人活动就为空*/
private Team team;
/**活动名称*/
private String name;
/**活动简介*/
private String description;
/**开始时间*/
private Date startTime;
/**结束时间*/
private Date endTime;
/**地点*/
private String place;
/**提醒时间*/
private Date remindTime;
/**活动类型,type为1的时候为团队活动,type为2的时候为任务,type3 是个人活动,type4是单独的活动*/
private int type;
/**活动的所有参与者*/
private Set participants;
/**
* 活动信息类默认构造函数
*/
public Activity(){
this.aId = 0;
this.name = "";
this.description = "";
this.startTime = new Date();
this.endTime = new Date();
this.place = "";
this.remindTime = new Date();
this.type = 0;
this.team = null;
this.participants = null;
}
/**
*
*
* @param activity
*/
public Activity(Activity activity){
this.aId = activity.getaId();
this.name = activity.getName();
this.description = activity.getDescription();
this.startTime = activity.getStartTime();
this.endTime = activity.getEndTime();
this.place = activity.getPlace();
this.remindTime = activity.getRemindTime();
this.type = activity.getType();
this.team = new Team(activity.getTeam());
this.participants = null;
}
/**
*
* 获得活动的Id
* @return 活动Id
*/
public int getaId() {
return aId;
}
/**
*
* 设置活动的Id
* @param aId
*/
public void setaId(int aId) {
this.aId = aId;
}
/**
*
* 获得活动名
* @return 活动名
*/
public String getName() {
return name;
}
/**
*
* 设置活动名
* @param name
*/
public void setName(String name) {
this.name = name;
}
/**
*
* 获得活动描述
* @return 活动描述
*/
public String getDescription() {
return description;
}
/**
*
* 设置活动描述
* @param description
*/
public void setDescription(String description) {
this.description = description;
}
/**
*
* 获得活动描述
* @return 活动描述
*/
public Date getStartTime() {
return startTime;
}
/**
*
* 设置活动开始时间
* @param startTime
*/
public void setStartTime(Date startTime) {
this.startTime = startTime;
}
/**
*
* 获得活动结束时间
* @return 活动结束时间
*/
public Date getEndTime() {
return endTime;
}
/**
*
* 设置活动结束时间
* @param endTime
*/
public void setEndTime(Date endTime) {
this.endTime = endTime;
}
/**
*
* 获得活动举办地
* @return 活动举办地
*/
public String getPlace() {
return place;
}
/**
*
* 设置活动举办地
* @param place
*/
public void setPlace(String place) {
this.place = place;
}
/**
*
* 得到活动提醒时间
* @return 活动提醒时间
*/
public Date getRemindTime() {
return remindTime;
}
/**
*
* 设置活动提醒时间
* @param remindTime
*/
public void setRemindTime(Date remindTime) {
this.remindTime = remindTime;
}
/**
*
* 获得活动类型:type为1的时候为团队活动,type为2的时候为任务,type3 是个人活动,type4是单独的活动
* @return 活动类型
*/
public int getType() {
return type;
}
/**
*
* 设置活动类型
* @param type
*/
public void setType(int type) {
this.type = type;
}
/**
*
* 获得活动的举办团队
* @return 举办团队
*/
public Team getTeam() {
return team;
}
/**
* 设置活动的举办团队
* @param team
*/
public void setTeam(Team team) {
this.team = team;
}
/**
*
* 获得活动的参与人员列表
* @return 参与人员列表
*/
public Set getParticipants() {
return participants;
}
/**
*
* 设置活动的参与人员
* @param participants
*/
public void setParticipants(Set participants) {
this.participants = participants;
}
}
| MonksTemple/Daily | src/com/example/model/Activity.java |
65,786 | package JavaCode.contest.weekly.n0_200.n145;
import java.util.*;
public class N4 {
public int[] smallestSufficientTeam(String[] req_skills, List<List<String>> people) {
Map<String,Integer> map=new HashMap<>();
for (int i=0;i<req_skills.length;i++)
{
map.put(req_skills[i],i);
}
int[] dp=new int[1<<req_skills.length];
Arrays.fill(dp,Integer.MAX_VALUE/2);
dp[0]=0;
List<Integer>[] lists=new List[1<<req_skills.length];
for (int i=(1<<req_skills.length)-1;i>=0;i--)
{
lists[i]=new ArrayList<>();
}
int id=0;
int g=Integer.MAX_VALUE;
int gst=-1;
for(List<String> c:people)
{
for (int status=(1<<req_skills.length)-1;status>=0;status--)
{
int cur=0;
for (String str:c)
{
if(map.containsKey(str))
{
int idx=map.get(str);
cur|=1<<idx;
}
}
int next_status=status|cur;
if(dp[status]+1<dp[next_status])
{
dp[next_status]=dp[status]+1;
lists[next_status]=new ArrayList<>();
for (int i:lists[status])
{
lists[next_status].add(i);
}
lists[next_status].add(id);
}
}
id++;
}
int k=(1<<req_skills.length)-1;
int len=lists[k].size();
int[] res=new int[len];
for (int i=0;i<len;i++)
{
res[i]=lists[k].get(i);
}
return res;
}
}
/**
*作为项目的项目经理,你规划了一份需求技能清单 req_skills ,并打算从备选人员名单 people 中选出一些人构成必要团队。 编号为 i 的备选人员 people[i] 含有一份该备选人员掌握的技能列表。
*
* 在一个必要团队中, 对于需求技能列表 req_skills 中列出的每项技能,团队中都至少有一名成员已经掌握。我们可以用每个人的编号来表示团队中的成员:例如,团队 team = [0, 1, 3] 表示掌握技能分别为 people[0],people[1],和 people[3] 的备选人员。
*
* 返回 任一 规模最小的的必要团队,团队成员用每个人的编号表示。
*
* 你可以按任意顺序返回答案。本题保证存在答案。
*
*
*
* 示例 1:
*
* 输入:req_skills = ["java","nodejs","reactjs"], people = [["java"],["nodejs"],["nodejs","reactjs"]]
* 输出:[0,2]
* 示例 2:
*
* 输入:req_skills = ["algorithms","math","java","reactjs","csharp","aws"], people = [["algorithms","math","java"],["algorithms","math","reactjs"],["java","csharp","aws"],["reactjs","csharp"],["csharp","math"],["aws","java"]]
* 输出:[1,2]
*
*
* 提示:
*
* 1 <= req_skills.length <= 16
* 1 <= people.length <= 60
* 1 <= people[i].length, req_skills[i].length, people[i][j].length <= 16
* req_skills 和 people[i] 中的元素分别各不相同。
* req_skills[i][j], people[i][j][k] 都由小写英文字母组成。
* 保证存在一个必要团队
*/
| MikuSugar/LeetCode | JavaCode/contest/weekly/n0_200/n145/N4.java |
65,788 | package ext.ziang.model;
import java.io.Externalizable;
import com.ptc.windchill.annotations.metadata.GenAsPersistable;
import com.ptc.windchill.annotations.metadata.GeneratedProperty;
import com.ptc.windchill.annotations.metadata.IconProperties;
import com.ptc.windchill.annotations.metadata.OracleTableSize;
import com.ptc.windchill.annotations.metadata.PropertyConstraints;
import com.ptc.windchill.annotations.metadata.SupportedAPI;
import com.ptc.windchill.annotations.metadata.TableProperties;
import wt.fc.WTObject;
import wt.util.WTException;
/**
* @author anzhen
* @date 2024/01/31
*/
@GenAsPersistable(superClass = WTObject.class, interfaces = { Externalizable.class }, properties = {
@GeneratedProperty(name = "actionName", type = String.class, constraints = @PropertyConstraints(upperLimit = 64, required = true), supportedAPI = SupportedAPI.PUBLIC, javaDoc = "按钮名称"),
@GeneratedProperty(name = "roleName", type = String.class, constraints = @PropertyConstraints(upperLimit = 64), supportedAPI = SupportedAPI.PUBLIC, javaDoc = "角色"),
@GeneratedProperty(name = "groupName", type = String.class, constraints = @PropertyConstraints(upperLimit = 64), supportedAPI = SupportedAPI.PUBLIC, javaDoc = "团队"),
@GeneratedProperty(name = "groupInnerName", type = String.class, constraints = @PropertyConstraints(upperLimit = 64), supportedAPI = SupportedAPI.PUBLIC, javaDoc = "团队内部名称"),
@GeneratedProperty(name = "typeName", type = String.class, constraints = @PropertyConstraints(upperLimit = 64), supportedAPI = SupportedAPI.PUBLIC, javaDoc = "类型名称"),
@GeneratedProperty(name = "typeInnerName", type = String.class, constraints = @PropertyConstraints(upperLimit = 128, required = true), supportedAPI = SupportedAPI.PUBLIC, javaDoc = "类型内部名称"),
@GeneratedProperty(name = "lifecycleState", type = String.class, constraints = @PropertyConstraints(upperLimit = 64), supportedAPI = SupportedAPI.PUBLIC, javaDoc = "生命周期状态")
}, tableProperties = @TableProperties(compositeIndex2 = "+ actionName + lifecycleState", oracleTableSize = OracleTableSize.HUGE), iconProperties = @IconProperties(standardIcon = "wtcore/images/part.gif", openIcon = "wtcore/images/part.gif"))
public class CommonFilterConfig extends _CommonFilterConfig {
/**
* 序列化id
*/
static final long serialVersionUID = 1L;
public static CommonFilterConfig newCommonFilterConfig() throws WTException {
final CommonFilterConfig commonFilterConfig = new CommonFilterConfig();
commonFilterConfig.initialize();
return commonFilterConfig;
}
/**
* 获取 Flex 类型 ID 路径
*
* @return {@link String}
*/
public String getFlexTypeIdPath() {
return null;
}
}
| anzhen3531/BOM-manager | src/ext/ziang/model/CommonFilterConfig.java |
65,789 | import java.util.*;
/*
NO1125 最小的必要团队
作为项目经理,你规划了一份需求的技能清单 req_skills,并打算从备选人员名单 people 中选出些人组成一个「必要团队」( 编号为 i 的备选人员 people[i] 含有一份该备选人员掌握的技能列表)。
所谓「必要团队」,就是在这个团队中,对于所需求的技能列表 req_skills 中列出的每项技能,团队中至少有一名成员已经掌握。
我们可以用每个人的编号来表示团队中的成员:例如,团队 team = [0, 1, 3] 表示掌握技能分别为 people[0],people[1],和 people[3] 的备选人员。
请你返回 任一 规模最小的必要团队,团队成员用人员编号表示。你可以按任意顺序返回答案,本题保证答案存在。
*/
public class Solution1125 {
List<Integer> ans = new ArrayList<>();
int[] peopleSkill;
int[] employed;
int aim;
public int[] smallestSufficientTeam(String[] req_skills, List<List<String>> people) {
peopleSkill = new int[people.size()];
employed = new int[people.size()];
aim = (int) Math.pow(2, req_skills.length) - 1;
HashMap<String, Integer> hashMap = new HashMap<>();
for (int i = 0; i < req_skills.length; i++) {
hashMap.put(req_skills[i], i);
}
// 构建每个人的技能值
for (int i = 0; i < people.size(); i++) {
List<String> skills = people.get(i);
for (String skill : skills) {
if (hashMap.containsKey(skill)) {
peopleSkill[i] = peopleSkill[i] | (1 << hashMap.get(skill));
}
}
}
for (int i = 0; i < people.size() - 1; i++) {
for (int j = i + 1; j < people.size(); j++) {
if (people.get(i).containsAll(people.get(j))) {
peopleSkill[j] = 0;
} else if (people.get(j).containsAll(people.get(i))) {
peopleSkill[i] = 0;
}
}
}
int x = 0;
int y = 0;
for (String req_skill : req_skills) {
int index = -1;
boolean flag = true;
for (int j = 0; j < people.size(); j++) {
if (people.get(j).contains(req_skill) && peopleSkill[j] != 0) {
if (index == -1) index = j;
else {
flag = false;
break;
}
}
}
if (flag && employed[index] == 0) {
employed[index] = 1;
y += 1;
for (String s : people.get(index)) {
x = x | (1 << hashMap.get(s));
}
}
}
for (int i = 0; i < people.size(); i++) {
if (peopleSkill[i] != 0) ans.add(i);
}
if (x != aim) seek(x, y);
int[] ret = new int[ans.size()];
ans.sort((o1, o2) -> o1 - o2);
for (int i = 0; i < ans.size(); i++) {
ret[i] = ans.get(i);
}
return ret;
}
public void seek(int sum, int peopleNum) {
if (peopleNum >= ans.size()) return;
if (sum == aim) {
ans.clear();
for (int i = 0; i < employed.length; i++) {
if (employed[i] == 1) ans.add(i);
}
return;
}
for (int i = 0; i < peopleSkill.length; i++) {
if (employed[i] == 0 && peopleSkill[i] != 0 && peopleNum < ans.size()) {
employed[i] = 1;
seek(sum | peopleSkill[i], peopleNum + 1);
employed[i] = 0;
}
}
}
public static void main(String[] args) {
String[] req = new String[]{"gvp", "jgpzzicdvgxlfix", "kqcrfwerywbwi", "jzukdzrfgvdbrunw", "k"};
List<String> p1 = Arrays.asList();
List<String> p2 = Arrays.asList();
List<String> p3 = Arrays.asList();
List<String> p4 = Arrays.asList();
List<String> p5 = Arrays.asList("jgpzzicdvgxlfix");
List<String> p6 = Arrays.asList("jgpzzicdvgxlfix", "k");
List<String> p7 = Arrays.asList("jgpzzicdvgxlfix", "kqcrfwerywbwi");
List<String> p8 = Arrays.asList("gvp");
List<String> p9 = Arrays.asList("jzukdzrfgvdbrunw");
List<String> p10 = Arrays.asList("gvp", "kqcrfwerywbwi");
List<List<String>> people = new ArrayList<>();
people.add(p1);
people.add(p2);
people.add(p3);
people.add(p4);
people.add(p5);
people.add(p6);
people.add(p7);
people.add(p8);
people.add(p9);
people.add(p10);
int[] ints = new Solution1125().smallestSufficientTeam(req, people);
for (int anInt : ints) {
System.out.println(anInt);
}
}
} | DragonistYJ/Algorithm | Java/Leetcode/src/Solution1125.java |
65,790 | package net.zjitc.ws;
import cn.hutool.core.date.DateUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.google.gson.Gson;
import lombok.extern.slf4j.Slf4j;
import net.zjitc.config.HttpSessionConfig;
import net.zjitc.model.domain.Chat;
import net.zjitc.model.domain.Team;
import net.zjitc.model.domain.User;
import net.zjitc.model.request.MessageRequest;
import net.zjitc.model.vo.ChatMessageVO;
import net.zjitc.model.vo.WebSocketVO;
import net.zjitc.service.ChatService;
import net.zjitc.service.TeamService;
import net.zjitc.service.UserService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import javax.servlet.http.HttpSession;
import javax.websocket.EndpointConfig;
import javax.websocket.OnClose;
import javax.websocket.OnMessage;
import javax.websocket.OnOpen;
import javax.websocket.Session;
import javax.websocket.server.PathParam;
import javax.websocket.server.ServerEndpoint;
import java.io.IOException;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArraySet;
import static net.zjitc.constants.ChatConstant.CACHE_CHAT_HALL;
import static net.zjitc.constants.ChatConstant.CACHE_CHAT_PRIVATE;
import static net.zjitc.constants.ChatConstant.CACHE_CHAT_TEAM;
import static net.zjitc.constants.ChatConstant.PRIVATE_CHAT;
import static net.zjitc.constants.ChatConstant.TEAM_CHAT;
import static net.zjitc.constants.UserConstants.ADMIN_ROLE;
import static net.zjitc.constants.UserConstants.USER_LOGIN_STATE;
/**
* WebSocket服务
*
* @author OchiaMalu
* @date 2023/06/22
*/
@Component
@Slf4j
@ServerEndpoint(value = "/websocket/{userId}/{teamId}", configurator = HttpSessionConfig.class)
public class WebSocket {
/**
* 保存队伍的连接信息
*/
private static final Map<String, ConcurrentHashMap<String, WebSocket>> ROOMS = new HashMap<>();
/**
* 线程安全的无序的集合
*/
private static final CopyOnWriteArraySet<Session> SESSIONS = new CopyOnWriteArraySet<>();
/**
* 会话池
*/
private static final Map<String, Session> SESSION_POOL = new HashMap<>(0);
/**
* 用户服务
*/
private static UserService userService;
/**
* 聊天服务
*/
private static ChatService chatService;
/**
* 团队服务
*/
private static TeamService teamService;
/**
* 房间在线人数
*/
private static int onlineCount = 0;
/**
* 当前信息
*/
private Session session;
/**
* http会话
*/
private HttpSession httpSession;
/**
* 上网数
*
* @return int
*/
public static synchronized int getOnlineCount() {
return onlineCount;
}
/**
* 添加在线计数
*/
public static synchronized void addOnlineCount() {
WebSocket.onlineCount++;
}
/**
* 子在线计数
*/
public static synchronized void subOnlineCount() {
WebSocket.onlineCount--;
}
/**
* 集热地图服务
*
* @param userService 用户服务
*/
@Resource
public void setHeatMapService(UserService userService) {
WebSocket.userService = userService;
}
/**
* 集热地图服务
*
* @param chatService 聊天服务
*/
@Resource
public void setHeatMapService(ChatService chatService) {
WebSocket.chatService = chatService;
}
/**
* 集热地图服务
*
* @param teamService 团队服务
*/
@Resource
public void setHeatMapService(TeamService teamService) {
WebSocket.teamService = teamService;
}
/**
* 队伍内群发消息
*
* @param teamId 团队id
* @param msg 消息
*/
public static void broadcast(String teamId, String msg) {
ConcurrentHashMap<String, WebSocket> map = ROOMS.get(teamId);
// keySet获取map集合key的集合 然后在遍历key即可
for (String key : map.keySet()) {
try {
WebSocket webSocket = map.get(key);
webSocket.sendMessage(msg);
} catch (Exception e) {
log.error("exception message", e);
}
}
}
/**
* 发送消息
*
* @param message 消息
* @throws IOException ioexception
*/
public void sendMessage(String message) throws IOException {
this.session.getBasicRemote().sendText(message);
}
/**
* 开放
*
* @param session 会话
* @param userId 用户id
* @param teamId 团队id
* @param config 配置
*/
@OnOpen
public void onOpen(Session session,
@PathParam(value = "userId") String userId,
@PathParam(value = "teamId") String teamId,
EndpointConfig config) {
try {
if (StringUtils.isBlank(userId) || "undefined".equals(userId)) {
sendError(userId, "参数有误");
return;
}
HttpSession userHttpSession = (HttpSession) config.getUserProperties().get(HttpSession.class.getName());
User user = (User) userHttpSession.getAttribute(USER_LOGIN_STATE);
if (user != null) {
this.session = session;
this.httpSession = userHttpSession;
}
if (!"NaN".equals(teamId)) {
if (!ROOMS.containsKey(teamId)) {
ConcurrentHashMap<String, WebSocket> room = new ConcurrentHashMap<>(0);
room.put(userId, this);
ROOMS.put(String.valueOf(teamId), room);
// 在线数加1
addOnlineCount();
} else {
if (!ROOMS.get(teamId).containsKey(userId)) {
ROOMS.get(teamId).put(userId, this);
// 在线数加1
addOnlineCount();
}
}
} else {
SESSIONS.add(session);
SESSION_POOL.put(userId, session);
sendAllUsers();
}
} catch (Exception e) {
log.error("exception message", e);
}
}
/**
* 关闭
*
* @param userId 用户id
* @param teamId 团队id
* @param session 会话
*/
@OnClose
public void onClose(@PathParam("userId") String userId,
@PathParam(value = "teamId") String teamId,
Session session) {
try {
if (!"NaN".equals(teamId)) {
ROOMS.get(teamId).remove(userId);
if (getOnlineCount() > 0) {
subOnlineCount();
}
} else {
if (!SESSION_POOL.isEmpty()) {
SESSION_POOL.remove(userId);
SESSIONS.remove(session);
}
sendAllUsers();
}
} catch (Exception e) {
log.error("exception message", e);
}
}
/**
* 消息
*
* @param message 消息
* @param userId 用户id
*/
@OnMessage
public void onMessage(String message, @PathParam("userId") String userId) {
if ("PING".equals(message)) {
sendOneMessage(userId, "pong");
return;
}
MessageRequest messageRequest = new Gson().fromJson(message, MessageRequest.class);
Long toId = messageRequest.getToId();
Long teamId = messageRequest.getTeamId();
String text = messageRequest.getText();
Integer chatType = messageRequest.getChatType();
User fromUser = userService.getById(userId);
Team team = teamService.getById(teamId);
if (chatType == PRIVATE_CHAT) {
// 私聊
privateChat(fromUser, toId, text, chatType);
} else if (chatType == TEAM_CHAT) {
// 队伍内聊天
teamChat(fromUser, text, team, chatType);
} else {
// 群聊
hallChat(fromUser, text, chatType);
}
}
/**
* 队伍聊天
*
* @param user 用户
* @param text 文本
* @param team 团队
* @param chatType 聊天类型
*/
private void teamChat(User user, String text, Team team, Integer chatType) {
ChatMessageVO chatMessageVo = new ChatMessageVO();
WebSocketVO fromWebSocketVO = new WebSocketVO();
BeanUtils.copyProperties(user, fromWebSocketVO);
chatMessageVo.setFromUser(fromWebSocketVO);
chatMessageVo.setText(text);
chatMessageVo.setTeamId(team.getId());
chatMessageVo.setChatType(chatType);
chatMessageVo.setCreateTime(DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss"));
if (Objects.equals(user.getId(), team.getUserId()) || user.getRole() == ADMIN_ROLE) {
chatMessageVo.setIsAdmin(true);
}
User loginUser = (User) this.httpSession.getAttribute(USER_LOGIN_STATE);
if (Objects.equals(loginUser.getId(), user.getId())) {
chatMessageVo.setIsMy(true);
}
String toJson = new Gson().toJson(chatMessageVo);
try {
broadcast(String.valueOf(team.getId()), toJson);
saveChat(user.getId(), null, text, team.getId(), chatType);
chatService.deleteKey(CACHE_CHAT_TEAM, String.valueOf(team.getId()));
} catch (Exception e) {
throw new RuntimeException(e);
}
}
/**
* 大厅聊天
*
* @param user 用户
* @param text 文本
* @param chatType 聊天类型
*/
private void hallChat(User user, String text, Integer chatType) {
ChatMessageVO chatMessageVo = new ChatMessageVO();
WebSocketVO fromWebSocketVO = new WebSocketVO();
BeanUtils.copyProperties(user, fromWebSocketVO);
chatMessageVo.setFromUser(fromWebSocketVO);
chatMessageVo.setText(text);
chatMessageVo.setChatType(chatType);
chatMessageVo.setCreateTime(DateUtil.format(new Date(), "yyyy年MM月dd日 HH:mm:ss"));
if (user.getRole() == ADMIN_ROLE) {
chatMessageVo.setIsAdmin(true);
}
User loginUser = (User) this.httpSession.getAttribute(USER_LOGIN_STATE);
if (Objects.equals(loginUser.getId(), user.getId())) {
chatMessageVo.setIsMy(true);
}
String toJson = new Gson().toJson(chatMessageVo);
sendAllMessage(toJson);
saveChat(user.getId(), null, text, null, chatType);
chatService.deleteKey(CACHE_CHAT_HALL, String.valueOf(user.getId()));
}
/**
* 私聊
*
* @param user 用户
* @param toId 为id
* @param text 文本
* @param chatType 聊天类型
*/
private void privateChat(User user, Long toId, String text, Integer chatType) {
ChatMessageVO chatMessageVo = chatService
.chatResult(user.getId(), toId, text, chatType, DateUtil.date(System.currentTimeMillis()));
User loginUser = (User) this.httpSession.getAttribute(USER_LOGIN_STATE);
if (Objects.equals(loginUser.getId(), user.getId())) {
chatMessageVo.setIsMy(true);
}
String toJson = new Gson().toJson(chatMessageVo);
sendOneMessage(toId.toString(), toJson);
saveChat(user.getId(), toId, text, null, chatType);
chatService.deleteKey(CACHE_CHAT_PRIVATE, user.getId() + "" + toId);
chatService.deleteKey(CACHE_CHAT_PRIVATE, toId + "" + user.getId());
}
/**
* 保存聊天
*
* @param userId 用户id
* @param toId 为id
* @param text 文本
* @param teamId 团队id
* @param chatType 聊天类型
*/
private void saveChat(Long userId, Long toId, String text, Long teamId, Integer chatType) {
// if (chatType == PRIVATE_CHAT) {
// User user = userService.getById(userId);
// Set<Long> userIds = stringJsonListToLongSet(user.getFriendIds());
// if (!userIds.contains(toId)) {
// sendError(String.valueOf(userId), "该用户不是你的好友");
// return;
// }
// }
Chat chat = new Chat();
chat.setFromId(userId);
chat.setText(String.valueOf(text));
chat.setChatType(chatType);
chat.setCreateTime(new Date());
if (toId != null && toId > 0) {
chat.setToId(toId);
}
if (teamId != null && teamId > 0) {
chat.setTeamId(teamId);
}
chatService.save(chat);
}
/**
* 发送失败
*
* @param userId 用户id
* @param errorMessage 错误消息
*/
private void sendError(String userId, String errorMessage) {
JSONObject obj = new JSONObject();
obj.set("error", errorMessage);
sendOneMessage(userId, obj.toString());
}
/**
* 广播消息
*
* @param message 消息
*/
public void sendAllMessage(String message) {
for (Session userSession : SESSIONS) {
try {
if (userSession.isOpen()) {
synchronized (userSession) {
userSession.getBasicRemote().sendText(message);
}
}
} catch (Exception e) {
log.error("exception message", e);
}
}
}
/**
* 发送一个消息
*
* @param userId 用户编号
* @param message 消息
*/
public void sendOneMessage(String userId, String message) {
Session userSession = SESSION_POOL.get(userId);
if (userSession != null && userSession.isOpen()) {
try {
synchronized (userSession) {
userSession.getBasicRemote().sendText(message);
}
} catch (Exception e) {
log.error("exception message", e);
}
}
}
/**
* 给所有用户
*/
public void sendAllUsers() {
HashMap<String, List<WebSocketVO>> stringListHashMap = new HashMap<>(0);
List<WebSocketVO> webSocketVos = new ArrayList<>();
stringListHashMap.put("users", webSocketVos);
for (Serializable key : SESSION_POOL.keySet()) {
User user = userService.getById(key);
WebSocketVO webSocketVO = new WebSocketVO();
BeanUtils.copyProperties(user, webSocketVO);
webSocketVos.add(webSocketVO);
}
sendAllMessage(JSONUtil.toJsonStr(stringListHashMap));
}
}
| OchiaMalu/super-backend | src/main/java/net/zjitc/ws/WebSocket.java |
65,791 | /*
* Copyright Statement and License Information for Virtual Coffee Kafeih.com Community
*
* Copyright Owner:Kafeih.com Community and its contributors, since the inception of the project.
*
* License Type:All code, documentation, and design works related to the Kafeih.com Community are licensed under the GNU Affero General Public License (AGPL) v3 or any later version.
*
* Use and Distribution:You are free to use, copy, modify, and distribute the code, documentation, and design works of the Kafeih.com Community, subject to the following conditions:
*
* 1. You must include the original copyright and license notices in all copies distributed or made publicly available.
* 2. If you modify the code or design, or derive new works from those provided by the community, you must release these modifications or derivative works under the terms of the AGPLv3 license.
* 3. Important Note: If you use the code or design of this community to provide network services, you must ensure that all users accessing the service through the network can access the corresponding source code.
*
* No Warranty:The Kafeih.com Community and its code, documentation, and design works are provided "as is" without any warranty, including but not limited to warranties of merchantability, fitness for a particular purpose, and non-infringement.
*
* License Acquisition:The complete text of the GNU Affero General Public License (AGPL) v3 can be found on the GNU official website.
*
* Please note that the above statement only applies to the Kafeih.com Community and the code, documentation, and design works provided by it. Third-party links or resources may be subject to different licenses from their respective owners or publishers. When using these resources, please be sure to comply with the terms of their respective licenses.
*/
package mygroup.mapper;
import mygroup.entity.Team;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.data.mongodb.repository.Update;
import java.util.List;
import java.util.Map;
/**
* @description:团队 dao接口,该接口内置了普通的增删查改
* @author Eddie
* @date 2024-02-07
*/
public interface TeamMapper extends BaseMapper<Team> {
void updatePostCount(Long teamId);
void subMemberCount(Long teamId);
void addMemberCount(Long teamId);
@Select("SELECT \n" +
"CAST(b.team_id AS CHAR) as teamId,\n" +
"b.team_name as teamName,\n" +
"b.team_image_url as avatar,\n" +
"b.is_public as isPublic\n" +
"FROM user_favorite a LEFT JOIN team b ON a.other_id = b.team_id WHERE a.user_id = #{userId} AND b.team_id > 0 ORDER BY a.favorite_time DESC ")
List<Map> favoriteList(Long userId);
}
| eddie-292/virtual-coffee | src/main/java/mygroup/mapper/TeamMapper.java |
65,792 | package util;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Calendar;
import java.util.Date;
import java.util.Properties;
import javax.mail.Authenticator;
import javax.mail.PasswordAuthentication;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.Message.RecipientType;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
import com.DocSystem.common.Log;
import com.DocSystem.entity.MyEmail;
/**
* @ClassName: EmailUtil
* @Description: 发送Email的公共类
* @author zhanjp [email protected]
* @date 2015-7-3 下午2:21:50
* @version V1.0
*/
public class EmailUtil {
@SuppressWarnings("static-access")
public boolean sendEmail(MyEmail e) throws Exception{
Properties props = new Properties();
try {
String basePath = this.getClass().getClassLoader().getResource("/").getPath();
File config = new File(basePath+"emailConfig.properties");
InputStream in = new FileInputStream(config);
props.load(in);
System.out.println("自定义的props:" + props);
if(e.getFromEmail()==null){
e.setFromEmail(props.getProperty("fromuser"));
}
if(e.getFromPwd()==null){
e.setFromPwd(props.getProperty("frompwd"));
}
e.setMessageType(props.getProperty("messagetype"));
Session mailSession = Session.getInstance(props,new MyAuthenticator(e.getFromEmail(),e.getFromPwd()));
InternetAddress fromAddress = new InternetAddress(e.getFromEmail());
InternetAddress toAddress = new InternetAddress(e.getToEmail());
MimeMessage message = new MimeMessage(mailSession);
message.setFrom(fromAddress);
message.addRecipient(RecipientType.TO, toAddress);
message.setSentDate(Calendar.getInstance().getTime());
message.setSubject(e.geteTitle());
message.setContent(getEmailHtml(e.geteBody()), e.getMessageType());
Transport transport = mailSession.getTransport("smtp");
transport.send(message, message.getRecipients(RecipientType.TO));
} catch (IOException e1) {
Log.debug(e1);
}
System.out.println("props:"+props.toString());
return true;
}
public String getEmailHtml(String url){
String emailContent = "<style type='text/css'>"
+" body{"
+" font-family: '宋体';"
+" }"
+" .email-content{"
+" padding:50px;"
+" width: 80%;"
+" }"
+" p{"
+" color:cornflowerblue;"
+" }"
+" p.firstline{"
+" padding-left: 24px;"
+" }"
+" a{"
+" color:red;"
+" }"
+" a:hover{"
+" color:deepskyblue;"
+" }"
+" </style>"
+" <div class='email-content'>"
+" <p class='firstline'>"
+" 您于"+DateFormat.dateTimeFormat(new Date())+"注册了自由团队,下面是注册账号激活链接,请点击确认该链接。 "
+" </p>"
+" <p>"
+" <a href='http://www.gofreeteam.com/activeEmail.do?email="+url+"'>点击我激活邮箱,48小时内激活有效</a>"
+" </p>"
+" </div>";
return emailContent;
}
class MyAuthenticator extends Authenticator{
String userName="";
String password="";
public MyAuthenticator(){
}
public MyAuthenticator(String userName,String password){
this.userName=userName;
this.password=password;
}
protected PasswordAuthentication getPasswordAuthentication(){
return new PasswordAuthentication(userName, password);
}
}
}
| RainyGao-GitHub/DocSys | src/util/EmailUtil.java |
65,793 | package class086;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
// 最小的必要团队
// 作为项目经理,你规划了一份需求的技能清单req_skills
// 并打算从备选人员名单people中选出些人组成必要团队
// 编号为i的备选人员people[i]含有一份该备选人员掌握的技能列表
// 所谓必要团队,就是在这个团队中
// 对于所需求的技能列表req_skills中列出的每项技能,团队中至少有一名成员已经掌握
// 请你返回规模最小的必要团队,团队成员用人员编号表示
// 你可以按 任意顺序 返回答案,题目数据保证答案存在
// 测试链接 : https://leetcode.cn/problems/smallest-sufficient-team/
public class Code02_SmallestSufficientTeam {
public static int[] smallestSufficientTeam(String[] skills, List<List<String>> people) {
int n = skills.length;
int m = people.size();
HashMap<String, Integer> map = new HashMap<>();
int cnt = 0;
for (String s : skills) {
// 把所有必要技能依次编号
map.put(s, cnt++);
}
// arr[i] : 第i号人掌握必要技能的状况,用位信息表示
int[] arr = new int[m];
for (int i = 0, status; i < m; i++) {
status = 0;
for (String skill : people.get(i)) {
if (map.containsKey(skill)) {
// 如果当前技能是必要的
// 才设置status
status |= 1 << map.get(skill);
}
}
arr[i] = status;
}
int[][] dp = new int[m][1 << n];
for (int i = 0; i < m; i++) {
Arrays.fill(dp[i], -1);
}
int size = f(arr, m, n, 0, 0, dp);
int[] ans = new int[size];
for (int j = 0, i = 0, s = 0; s != (1 << n) - 1; i++) {
// s还没凑齐
if (i == m - 1 || dp[i][s] != dp[i + 1][s]) {
// 当初的决策是选择了i号人
ans[j++] = i;
s |= arr[i];
}
}
return ans;
}
// arr : 每个人所掌握的必要技能的状态
// m : 人的总数
// n : 必要技能的数量
// i : 当前来到第几号人
// s : 必要技能覆盖的状态
// 返回 : i....这些人,把必要技能都凑齐,至少需要几个人
public static int f(int[] arr, int m, int n, int i, int s, int[][] dp) {
if (s == (1 << n) - 1) {
// 所有技能已经凑齐了
return 0;
}
// 没凑齐
if (i == m) {
// 人已经没了,技能也没凑齐
// 无效
return Integer.MAX_VALUE;
}
if (dp[i][s] != -1) {
return dp[i][s];
}
// 可能性1 : 不要i号人
int p1 = f(arr, m, n, i + 1, s, dp);
// 可能性2 : 要i号人
int p2 = Integer.MAX_VALUE;
int next2 = f(arr, m, n, i + 1, s | arr[i], dp);
if (next2 != Integer.MAX_VALUE) {
// 后续有效
p2 = 1 + next2;
}
int ans = Math.min(p1, p2);
dp[i][s] = ans;
return ans;
}
}
| algorithmzuo/algorithm-journey | src/class086/Code02_SmallestSufficientTeam.java |
65,795 | package HuanXiangLIB;
import HuanXiangLIB.核心内容.修正类记录;
import HuanXiangLIB.注册类.修正;
import arc.ApplicationListener;
import arc.Events;
import mindustry.Vars;
import mindustry.game.Rules;
import static HuanXiangLIB.核心内容.修正类记录.修正记录;
import static HuanXiangLIB.核心内容.新事件.事件枚举.修正记录变更;
public class 事件集 implements ApplicationListener {
public 事件集() {
Events.run(修正记录变更, () -> {
修正类记录.加载();
Rules.TeamRule 团队 = Vars.state.rules.teams.get(Vars.state.rules.defaultTeam);
for (修正 修正 : 修正记录) {
if (修正.无限火力) 团队.cheat = true;
if (修正.构建不消耗资源) 团队.infiniteResources = true;
if (!修正.无限弹药) 团队.infiniteAmmo = false;
团队.unitBuildSpeedMultiplier += 修正.单位生产速度;
团队.unitDamageMultiplier += 修正.单位伤害;
团队.unitCrashDamageMultiplier += 修正.单位死亡伤害;
团队.unitCostMultiplier += 修正.单位生产花费;
团队.unitHealthMultiplier += 修正.单位生命值;
团队.blockHealthMultiplier += 修正.块生命值;
团队.blockDamageMultiplier += 修正.块伤害;
团队.buildSpeedMultiplier += 修正.建造速度;
}
});
}
}
| WIYouXi666/HXXinDE | src/HuanXiangLIB/事件集.java |
65,796 | /**
*
*/
package top.phrack.ctf.pojo;
/**
* 团队成员的类
*
* @author Jarvis
* @date 2016年4月23日
*/
public class TeamMember extends Users{
private long solved;
public long getsolved(){
return solved;
}
public void setsolved(long solved){
this.solved = solved;
}
}
| zjlywjh001/PhrackCTF-Platform-Team | src/main/java/top/phrack/ctf/pojo/TeamMember.java |
65,797 | package org.arong.egdownloader.model;
import org.apache.commons.lang.StringUtils;
import org.arong.egdownloader.ui.ComponentConst;
import org.arong.util.FileUtil2;
/**
* 搜索绅士站漫画列表任务模型
* @author dipoo
* @since 2015-03-11
*/
public class SearchTask {
private String url;//下载地址
private String name;//名称
private String type;//分类
private String coverUrl;//封面路径
private String date;//发布时间
private String btUrl;//bt下载地址
private String uploader;//上传者
private String rating;//评分
private String author;//作者
private String filenum;//图片个数
private String tags;//标签
private int coverLength;//封面字节大小
private boolean coverDownloadFail; //封面是否下载失败
public String getAuthor() {
return author;
}
public void setDate(String date) {
this.date = date;
}
public String getDate() {
return date;
}
public void setBtUrl(String btUrl) {
this.btUrl = btUrl;
}
public String getBtUrl() {
return btUrl;
}
public void setUploader(String uploader) {
this.uploader = uploader;
}
public String getUploader() {
return uploader;
}
@Override
public String toString() {
return "SearchTask [url=" + url + ", name=" + name + ", type=" + type
+ ", coverUrl=" + coverUrl + ", date=" + date + ", btUrl="
+ btUrl + ", uploader=" + uploader + ", rating=" + rating
+ ", author=" + author + ", filenum=" + filenum + "]";
}
public void setUrl(String url) {
if("/".equals(url.substring(url.length() - 1, url.length()))){
url = url.substring(0, url.length() - 1);
}
this.url = url;
}
public String getUrl() {
return url;
}
public void setName(String name) {
this.name = name;
if(name != null){
if(name.indexOf("[") != -1 && name.indexOf("]") != -1 && name.indexOf("[") < name.indexOf("]")){
author = name.substring(name.indexOf("[") + 1, name.indexOf("]"));
}else if(name.indexOf("【") != -1 && name.indexOf("】") != -1 && name.indexOf("【") < name.indexOf("】")){
author = name.substring(name.indexOf("【") + 1, name.indexOf("】"));
}
}
}
public String getName() {
return name;
}
public void setType(String type) {
this.type = type;
}
public String getType() {
return type;
}
public void setCoverUrl(String coverUrl) {
this.coverUrl = coverUrl;
}
public String getCoverUrl() {
return coverUrl;
}
public String getDownloadCoverUrl(boolean useCoverReplaceDomain) {
return coverUrl != null && useCoverReplaceDomain ? coverUrl.replaceAll(ComponentConst.EX_DOMAIN, ComponentConst.EX_REPLACE_COVER_DOMAIN) : coverUrl;
}
public String getRating() {
return rating;
}
public void setRating(String rating) {
this.rating = rating;
}
public String getFilenum() {
return filenum;
}
public void setFilenum(String filenum) {
this.filenum = filenum;
}
public String getTags() {
return tags;
}
public void setTags(String tags) {
this.tags = tags;
}
public int getCoverLength() {
return coverLength;
}
public void setCoverLength(int coverLength) {
this.coverLength = coverLength;
}
public boolean isFavAuthorOrGroup(String favTags){
//获取团队/作者
if(StringUtils.isNotBlank(favTags)){
if(StringUtils.isNotBlank(this.getTags())){
if(this.getTags().contains("artist:")){
String[] arr = this.getTags().split(";");
for(String tag : arr){
if(tag.startsWith("artist:")){
if(favTags.contains(String.format("%s;", tag))){
return true;
}
}
}
}
if(this.getTags().contains("group:")){
String[] arr = this.getTags().split(";");
for(String tag : arr){
if(tag.startsWith("group:")){
if(favTags.contains(String.format("%s;", tag))){
return true;
}
}
}
}
}
if(StringUtils.isNotBlank(this.getAuthor())){
//包含作者及团队
if(this.getAuthor().contains("(") && this.getAuthor().contains(")") && this.getAuthor().indexOf("(") < this.getAuthor().indexOf(")")){
String authors = this.getAuthor().substring(this.getAuthor().indexOf("(") + 1, this.getAuthor().indexOf(")"));
//多个作者以逗号分隔
String[] arr = authors.split(",");
for(String author : arr){
if(favTags.contains(String.format("artist:%s;", author.toLowerCase()))){
return true;
}
}
String groups = this.getAuthor().substring(0, this.getAuthor().indexOf("("));
arr = groups.split(",");
for(String group : arr){
if(favTags.contains(String.format("group:%s;", group.toLowerCase()))){
return true;
}
}
}else{
//多个作者以逗号分隔
String[] arr = this.getAuthor().split(",");
for(String author : arr){
if(favTags.contains(String.format(";artist:%s;", author.toLowerCase()))){
return true;
}
}
}
}
}
return false;
}
public String getCoverCachePath(){
if(url != null){
return ComponentConst.CACHE_PATH + "/" + getCoverCacheFileName();
}
return null;
}
public String getCoverCacheFileName(){
if(url != null){
return FileUtil2.filterDir((url.endsWith("/") ? url : url + "/").replaceAll("e-hentai.org", "exhentai.org").replaceAll("https:", "http:"));
}
return null;
}
public boolean isCoverDownloadFail() {
return coverDownloadFail;
}
public void setCoverDownloadFail(boolean coverDownloadFail) {
this.coverDownloadFail = coverDownloadFail;
}
}
| dipoo/egdownloader | src/org/arong/egdownloader/model/SearchTask.java |
65,798 | package top.jsls9.oajsfx.model;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
/**
* user
* @author
*/
public class User implements Serializable {
private String id;
/**
* 用户名
*/
private String username;
/**
* 密码
*/
private String password;
/**
* 创建时间
*/
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
/**
* 盐
*/
private String salt;
/**
* 用户状态;0-正常,1-不可用
*/
private Integer state;
/**
* 最后登录时间
*/
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date lastTime;
/**
* 修改时间
*/
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
/**
* 葫芦侠用户id
*/
private String hlxUserId;
/**
* 葫芦侠用户昵称
*/
private String hlxUserNick;
/**
* 绑定qq
*/
private String qq;
/**
* 部门(团队)id
*/
private String deptId;
/**
* 补充字段,仅用于查询映射及显示
*/
private String deptName;
/**
* 补充字段,用于显示角色名
*/
private String roleNames;
/**
* 用户个人积分
*/
private Integer integral;
/**
* 用户oa账户剩余葫芦
*/
private Integer gourd;
/**
* 补充字段,用户当前佩戴称号
*/
private String title;
/**
* 补充字段,用户当前的社区昵称
*/
private String nick;
private static final long serialVersionUID = 1L;
public User() {
}
public User(String id, String username, String password, Date createTime, String salt, Integer state, Date lastTime, Date updateTime, String hlxUserId, String hlxUserNick, String qq, String deptId) {
this.id = id;
this.username = username;
this.password = password;
this.createTime = createTime;
this.salt = salt;
this.state = state;
this.lastTime = lastTime;
this.updateTime = updateTime;
this.hlxUserId = hlxUserId;
this.hlxUserNick = hlxUserNick;
this.qq = qq;
this.deptId = deptId;
}
public void setDeptName(String deptName) {
this.deptName = deptName;
}
public String getDeptName() {
return deptName;
}
public void setLastTime(Date lastTime) {
this.lastTime = lastTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public void setHlxUserId(String hlxUserId) {
this.hlxUserId = hlxUserId;
}
public void setHlxUserNick(String hlxUserNick) {
this.hlxUserNick = hlxUserNick;
}
public void setQq(String qq) {
this.qq = qq;
}
public void setDeptId(String deptId) {
this.deptId = deptId;
}
public Date getLastTime() {
return lastTime;
}
public Date getUpdateTime() {
return updateTime;
}
public String getHlxUserId() {
return hlxUserId;
}
public String getHlxUserNick() {
return hlxUserNick;
}
public String getQq() {
return qq;
}
public String getDeptId() {
return deptId;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public String getSalt() {
return salt;
}
public void setSalt(String salt) {
this.salt = salt;
}
public Integer getState() {
return state;
}
public void setState(Integer state) {
this.state = state;
}
public String getRoleNames() {
return roleNames;
}
public void setRoleNames(String roleNames) {
this.roleNames = roleNames;
}
public Integer getIntegral() {
return integral;
}
public void setIntegral(Integer integral) {
this.integral = integral;
}
public Integer getGourd() {
return gourd;
}
public void setGourd(Integer gourd) {
this.gourd = gourd;
}
public String getTitle() {
return title;
}
public String getNick() {
return nick;
}
public void setTitle(String title) {
this.title = title;
}
public void setNick(String nick) {
this.nick = nick;
}
@Override
public String toString() {
return "User{" +
"id='" + id + '\'' +
", username='" + username + '\'' +
", password='" + password + '\'' +
", createTime=" + createTime +
", salt='" + salt + '\'' +
", state=" + state +
'}';
}
} | subei12/team_oa | src/main/java/top/jsls9/oajsfx/model/User.java |
65,799 | package com.lhfeiyu.po;
import java.math.BigDecimal;
import java.util.Calendar;
import java.util.Date;
import org.springframework.format.annotation.DateTimeFormat;
import com.alibaba.fastjson.JSONObject;
/**
* <strong> 描 述:</strong> 持久层对象 <p>
* <strong> 作 者:</strong> 虞荣华 <p>
* <strong> 编写时间:</strong>2016年3月20日22:22:22<p>
* <strong> 公 司:</strong> 成都蓝海飞鱼科技有限公司<p>
* <strong> 版 本:</strong> 1.0<p>
*/
public class User extends Parent {
/**============================== 自定义字段 开始 _@CAUTION_SELF_FIELD_BEGIN@_ ==============================*/
private String provinceName;
private String mainStatusName;
private String cityName;
private String patientName;
private String userRelationName;
private Integer age;
private String job;
private String jobName;
private Integer addDoctorPatient;
private String passwordReset;
private String sexName;
private String birthdayName;
private Integer canUpdate;
private Integer phrBasicInfoId;
/**============================== 自定义字段 结束 _@CAUTION_SELF_FIELD_FINISH@_ ==============================*/
/** */
private Integer id;
/** 用户名 */
private String username;
/** 用户密码 */
private String password;
/** 真实姓名 */
private String realName;
/** 是否实名认证 */
private Integer isRealAuth;
/** 性别:1女,2:男 */
private Integer sex;
/** 关联患者id */
private Integer relationId;
/** 创建该用户的医生(手动添加患者) */
private Integer createDoctorId;
/** 与用户的关系 */
private String userRelation;
/** 用户手机号码 */
private String phone;
/** 登录id */
private String loginName;
/** 座机 */
private String tel;
/** 手机是否公开 */
private Integer phoneConceal;
/** 邮箱 */
private String email;
/** 用户头像 */
private String avatar;
/** 头像-图片表中对应的ID */
private Integer avatarPicId;
/** 联系方式 */
private String contactWay;
/** 最后登录时间 */
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date lastLoginTime;
/** 详细地址 */
private String address;
/** 省份 */
private Integer province;
/** 城市 */
private Integer city;
/** 微信 */
private String weixin;
/** QQ */
private String qq;
/** */
private Integer jobId;
/** 出生日期 */
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date birthday;
/** 二维码 */
private String qrCode;
/** 二维码2 */
private String qrCode2;
/** 第三方平台的名称 */
private String thirdName;
/** 第三方ID(聊天接口等)(adicon_barcode) */
private String thirdId;
/** 第三方平台的密码 */
private String thirdPassword;
/** 角色ID:1.普通用户2.管理员 */
private Integer roleId;
/** 公司,团队,机构 */
private String organization;
/** 身份证号 */
private String idcardNum;
/** 证件类型 */
private Integer certificateType;
/** 证件号码 */
private String certificateNumber;
/** 证件姓名 */
private String certificateName;
/** 描述 */
private String description;
/** 序号 */
private String serial;
/** 类型ID */
private Integer typeId;
/** 关联ID */
private Integer linkId;
/** 组ID */
private Integer groupId;
/** 等级 */
private Integer gradeId;
/** 业务状态 */
private Integer mainStatus;
/** 逻辑状态 */
private Integer logicStatus;
/** BigDecimal */
private BigDecimal attrDecimal;
/** 备用字段-字符串 */
private String attrStr;
/** 备用字段-整型 */
private Integer attrInt;
/** 排列顺序 */
private Integer sequence;
/** 备注 */
private String remark;
/** 删除时间 */
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date deletedAt;
/** 删除人 */
private String deletedBy;
/** 创建时间 */
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createdAt;
/** 创建人 */
private String createdBy;
/** 更新时间 */
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updatedAt;
/** 更新人 */
private String updatedBy;
public String toString(){
return JSONObject.toJSONString(this);
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username == null ? null : username.trim();
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password == null ? null : password.trim();
}
public String getRealName() {
return realName;
}
public void setRealName(String realName) {
this.realName = realName == null ? null : realName.trim();
}
public Integer getIsRealAuth() {
return isRealAuth;
}
public void setIsRealAuth(Integer isRealAuth) {
this.isRealAuth = isRealAuth;
}
public Integer getSex() {
return sex;
}
public void setSex(Integer sex) {
this.sex = sex;
}
public Integer getRelationId() {
return relationId;
}
public void setRelationId(Integer relationId) {
this.relationId = relationId;
}
public Integer getCreateDoctorId() {
return createDoctorId;
}
public void setCreateDoctorId(Integer createDoctorId) {
this.createDoctorId = createDoctorId;
}
public String getUserRelation() {
return userRelation;
}
public void setUserRelation(String userRelation) {
this.userRelation = userRelation == null ? null : userRelation.trim();
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone == null ? null : phone.trim();
}
public String getLoginName() {
return loginName;
}
public void setLoginName(String loginName) {
this.loginName = loginName == null ? null : loginName.trim();
}
public String getTel() {
return tel;
}
public void setTel(String tel) {
this.tel = tel == null ? null : tel.trim();
}
public Integer getPhoneConceal() {
return phoneConceal;
}
public void setPhoneConceal(Integer phoneConceal) {
this.phoneConceal = phoneConceal;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email == null ? null : email.trim();
}
public String getAvatar() {
return avatar;
}
public void setAvatar(String avatar) {
this.avatar = avatar == null ? null : avatar.trim();
}
public Integer getAvatarPicId() {
return avatarPicId;
}
public void setAvatarPicId(Integer avatarPicId) {
this.avatarPicId = avatarPicId;
}
public String getContactWay() {
return contactWay;
}
public void setContactWay(String contactWay) {
this.contactWay = contactWay == null ? null : contactWay.trim();
}
public Date getLastLoginTime() {
return lastLoginTime;
}
public void setLastLoginTime(Date lastLoginTime) {
this.lastLoginTime = lastLoginTime;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address == null ? null : address.trim();
}
public Integer getProvince() {
return province;
}
public void setProvince(Integer province) {
this.province = province;
}
public Integer getCity() {
return city;
}
public void setCity(Integer city) {
this.city = city;
}
public String getWeixin() {
return weixin;
}
public void setWeixin(String weixin) {
this.weixin = weixin == null ? null : weixin.trim();
}
public String getQq() {
return qq;
}
public void setQq(String qq) {
this.qq = qq == null ? null : qq.trim();
}
public Integer getJobId() {
return jobId;
}
public void setJobId(Integer jobId) {
this.jobId = jobId;
}
public Date getBirthday() {
return birthday;
}
public void setBirthday(Date birthday) {
this.birthday = birthday;
}
public String getQrCode() {
return qrCode;
}
public void setQrCode(String qrCode) {
this.qrCode = qrCode == null ? null : qrCode.trim();
}
public String getQrCode2() {
return qrCode2;
}
public void setQrCode2(String qrCode2) {
this.qrCode2 = qrCode2 == null ? null : qrCode2.trim();
}
public String getThirdName() {
return thirdName;
}
public void setThirdName(String thirdName) {
this.thirdName = thirdName == null ? null : thirdName.trim();
}
public String getThirdId() {
return thirdId;
}
public void setThirdId(String thirdId) {
this.thirdId = thirdId == null ? null : thirdId.trim();
}
public String getThirdPassword() {
return thirdPassword;
}
public void setThirdPassword(String thirdPassword) {
this.thirdPassword = thirdPassword == null ? null : thirdPassword.trim();
}
public Integer getRoleId() {
return roleId;
}
public void setRoleId(Integer roleId) {
this.roleId = roleId;
}
public String getOrganization() {
return organization;
}
public void setOrganization(String organization) {
this.organization = organization == null ? null : organization.trim();
}
public String getIdcardNum() {
return idcardNum;
}
public void setIdcardNum(String idcardNum) {
this.idcardNum = idcardNum == null ? null : idcardNum.trim();
}
public Integer getCertificateType() {
return certificateType;
}
public void setCertificateType(Integer certificateType) {
this.certificateType = certificateType;
}
public String getCertificateNumber() {
return certificateNumber;
}
public void setCertificateNumber(String certificateNumber) {
this.certificateNumber = certificateNumber == null ? null : certificateNumber.trim();
}
public String getCertificateName() {
return certificateName;
}
public void setCertificateName(String certificateName) {
this.certificateName = certificateName == null ? null : certificateName.trim();
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description == null ? null : description.trim();
}
public String getSerial() {
return serial;
}
public void setSerial(String serial) {
this.serial = serial == null ? null : serial.trim();
}
public Integer getTypeId() {
return typeId;
}
public void setTypeId(Integer typeId) {
this.typeId = typeId;
}
public Integer getLinkId() {
return linkId;
}
public void setLinkId(Integer linkId) {
this.linkId = linkId;
}
public Integer getGroupId() {
return groupId;
}
public void setGroupId(Integer groupId) {
this.groupId = groupId;
}
public Integer getGradeId() {
return gradeId;
}
public void setGradeId(Integer gradeId) {
this.gradeId = gradeId;
}
public Integer getMainStatus() {
return mainStatus;
}
public void setMainStatus(Integer mainStatus) {
this.mainStatus = mainStatus;
}
public Integer getLogicStatus() {
return logicStatus;
}
public void setLogicStatus(Integer logicStatus) {
this.logicStatus = logicStatus;
}
public BigDecimal getAttrDecimal() {
return attrDecimal;
}
public void setAttrDecimal(BigDecimal attrDecimal) {
this.attrDecimal = attrDecimal;
}
public String getAttrStr() {
return attrStr;
}
public void setAttrStr(String attrStr) {
this.attrStr = attrStr == null ? null : attrStr.trim();
}
public Integer getAttrInt() {
return attrInt;
}
public void setAttrInt(Integer attrInt) {
this.attrInt = attrInt;
}
public Integer getSequence() {
return sequence;
}
public void setSequence(Integer sequence) {
this.sequence = sequence;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark == null ? null : remark.trim();
}
public Date getDeletedAt() {
return deletedAt;
}
public void setDeletedAt(Date deletedAt) {
this.deletedAt = deletedAt;
}
public String getDeletedBy() {
return deletedBy;
}
public void setDeletedBy(String deletedBy) {
this.deletedBy = deletedBy == null ? null : deletedBy.trim();
}
public Date getCreatedAt() {
return createdAt;
}
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
public String getCreatedBy() {
return createdBy;
}
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy == null ? null : createdBy.trim();
}
public Date getUpdatedAt() {
return updatedAt;
}
public void setUpdatedAt(Date updatedAt) {
this.updatedAt = updatedAt;
}
public String getUpdatedBy() {
return updatedBy;
}
public void setUpdatedBy(String updatedBy) {
this.updatedBy = updatedBy == null ? null : updatedBy.trim();
}
/**=========================== 自定义GETSET方法开始 _@CAUTION_SELF_GETSET_BEGIN@_ ===========================*/
public String getProvinceName() {
return provinceName;
}
public void setProvinceName(String provinceName) {
this.provinceName = provinceName;
}
public String getPatientName() {
return patientName;
}
public void setPatientName(String patientName) {
this.patientName = patientName;
}
public String getUserRelationName() {
return userRelationName;
}
public void setUserRelationName(String userRelationName) {
this.userRelationName = userRelationName;
}
public String getCityName() {
return cityName;
}
public void setCityName(String cityName) {
this.cityName = cityName;
}
public Integer getAge() {
age = null;
if(null != birthday){
Calendar curdate = Calendar.getInstance();
Calendar birth = Calendar.getInstance();
birth.setTime(birthday);
age = curdate.get(Calendar.YEAR) - birth.get(Calendar.YEAR);
birth.add(Calendar.YEAR, age);
if(birth.after(curdate)){
age -= 1;
}
if(age < 0)age = 0;
}
//System.out.println(age);
return age;
}
public void setAge(Integer age) {
this.age = age;
}
public String getJob() {
return job;
}
public void setJob(String job) {
this.job = job;
}
public Integer getAddDoctorPatient() {
return addDoctorPatient;
}
public void setAddDoctorPatient(Integer addDoctorPatient) {
this.addDoctorPatient = addDoctorPatient;
}
public String getPasswordReset() {
return passwordReset;
}
public void setPasswordReset(String passwordReset) {
this.passwordReset = passwordReset;
}
public String getMainStatusName() {
return mainStatusName;
}
public void setMainStatusName(String mainStatusName) {
this.mainStatusName = mainStatusName;
}
public String getSexName() {
return sexName;
}
public void setSexName(String sexName) {
this.sexName = sexName;
}
public String getBirthdayName() {
return birthdayName;
}
public void setBirthdayName(String birthdayName) {
this.birthdayName = birthdayName;
}
public String getJobName() {
return jobName;
}
public void setJobName(String jobName) {
this.jobName = jobName;
}
public Integer getCanUpdate() {
return canUpdate;
}
public void setCanUpdate(Integer canUpdate) {
this.canUpdate = canUpdate;
}
public Integer getPhrBasicInfoId() {
return phrBasicInfoId;
}
public void setPhrBasicInfoId(Integer phrBasicInfoId) {
this.phrBasicInfoId = phrBasicInfoId;
}
/**=========================== 自定义GETSET方法结束 _@CAUTION_SELF_GETSET_FINISH@_ ===========================*/
} | wozhenwuyou/Medical | src/main/java/com/lhfeiyu/po/User.java |
65,800 | package com.lhfeiyu.po;
import java.math.BigDecimal;
import java.util.Date;
import org.springframework.format.annotation.DateTimeFormat;
import com.alibaba.fastjson.JSONObject;
/**
* <strong> 描 述:</strong> 持久层对象 <p>
* <strong> 作 者:</strong> 虞荣华 <p>
* <strong> 编写时间:</strong>2016年3月20日22:22:22<p>
* <strong> 公 司:</strong> 成都蓝海飞鱼科技有限公司<p>
* <strong> 版 本:</strong> 1.0<p>
*/
public class Nurse extends Parent {
/**============================== 自定义字段 开始 _@CAUTION_SELF_FIELD_BEGIN@_ ==============================*/
private String provinceName;
private String sexName;
private String hospitalName;
private String cityName;
private String mainStatusName;
/**============================== 自定义字段 结束 _@CAUTION_SELF_FIELD_FINISH@_ ==============================*/
/** */
private Integer id;
/** 诊所id */
private Integer hospitalId;
/** 用户名 */
private String username;
/** 用户密码 */
private String password;
/** 真实姓名 */
private String realName;
/** 是否实名认证 */
private Integer isRealAuth;
/** 性别:1女,2:男 */
private Integer sex;
/** 关联患者id */
private Integer relationId;
/** 与用户的关系 */
private String userRelation;
/** 用户手机号码 */
private String phone;
/** 登录id */
private String loginName;
/** 座机 */
private String tel;
/** 手机是否公开 */
private Integer phoneConceal;
/** 邮箱 */
private String email;
/** 用户头像 */
private String avatar;
/** 头像图片ID */
private Integer avatarPicId;
/** 联系方式 */
private String contactWay;
/** 最后登录时间 */
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date lastLoginTime;
/** 详细地址 */
private String address;
/** 省份 */
private Integer province;
/** 城市 */
private Integer city;
/** 微信 */
private String weixin;
/** QQ */
private String qq;
/** */
private Integer jobId;
/** 出生日期 */
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date birthday;
/** 二维码 */
private String qrCode;
/** 二维码2 */
private String qrCode2;
/** 第三方平台的名称 */
private String thirdName;
/** 第三方ID(聊天接口等)(adicon_barcode) */
private String thirdId;
/** 第三方平台的密码 */
private String thirdPassword;
/** 角色ID:1.普通用户2.管理员 */
private Integer roleId;
/** 公司,团队,机构 */
private String organization;
/** 身份证号 */
private String idcardNum;
/** 证件类型 */
private Integer certificateType;
/** 证件号码 */
private String certificateNumber;
/** 证件姓名 */
private String certificateName;
/** 描述 */
private String description;
/** 序号 */
private String serial;
/** 类型ID */
private Integer typeId;
/** 关联ID */
private Integer linkId;
/** 组ID */
private Integer groupId;
/** 等级 */
private Integer gradeId;
/** 业务状态 */
private Integer mainStatus;
/** 逻辑状态 */
private Integer logicStatus;
/** BigDecimal */
private BigDecimal attrDecimal;
/** 备用字段-字符串 */
private String attrStr;
/** 备用字段-整型 */
private Integer attrInt;
/** 排列顺序 */
private Integer sequence;
/** 备注 */
private String remark;
/** 删除时间 */
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date deletedAt;
/** 删除人 */
private String deletedBy;
/** 创建时间 */
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createdAt;
/** 创建人 */
private String createdBy;
/** 更新时间 */
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updatedAt;
/** 更新人 */
private String updatedBy;
public String toString(){
return JSONObject.toJSONString(this);
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getHospitalId() {
return hospitalId;
}
public void setHospitalId(Integer hospitalId) {
this.hospitalId = hospitalId;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username == null ? null : username.trim();
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password == null ? null : password.trim();
}
public String getRealName() {
return realName;
}
public void setRealName(String realName) {
this.realName = realName == null ? null : realName.trim();
}
public Integer getIsRealAuth() {
return isRealAuth;
}
public void setIsRealAuth(Integer isRealAuth) {
this.isRealAuth = isRealAuth;
}
public Integer getSex() {
return sex;
}
public void setSex(Integer sex) {
this.sex = sex;
}
public Integer getRelationId() {
return relationId;
}
public void setRelationId(Integer relationId) {
this.relationId = relationId;
}
public String getUserRelation() {
return userRelation;
}
public void setUserRelation(String userRelation) {
this.userRelation = userRelation == null ? null : userRelation.trim();
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone == null ? null : phone.trim();
}
public String getLoginName() {
return loginName;
}
public void setLoginName(String loginName) {
this.loginName = loginName == null ? null : loginName.trim();
}
public String getTel() {
return tel;
}
public void setTel(String tel) {
this.tel = tel == null ? null : tel.trim();
}
public Integer getPhoneConceal() {
return phoneConceal;
}
public void setPhoneConceal(Integer phoneConceal) {
this.phoneConceal = phoneConceal;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email == null ? null : email.trim();
}
public String getAvatar() {
return avatar;
}
public void setAvatar(String avatar) {
this.avatar = avatar == null ? null : avatar.trim();
}
public Integer getAvatarPicId() {
return avatarPicId;
}
public void setAvatarPicId(Integer avatarPicId) {
this.avatarPicId = avatarPicId;
}
public String getContactWay() {
return contactWay;
}
public void setContactWay(String contactWay) {
this.contactWay = contactWay == null ? null : contactWay.trim();
}
public Date getLastLoginTime() {
return lastLoginTime;
}
public void setLastLoginTime(Date lastLoginTime) {
this.lastLoginTime = lastLoginTime;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address == null ? null : address.trim();
}
public Integer getProvince() {
return province;
}
public void setProvince(Integer province) {
this.province = province;
}
public Integer getCity() {
return city;
}
public void setCity(Integer city) {
this.city = city;
}
public String getWeixin() {
return weixin;
}
public void setWeixin(String weixin) {
this.weixin = weixin == null ? null : weixin.trim();
}
public String getQq() {
return qq;
}
public void setQq(String qq) {
this.qq = qq == null ? null : qq.trim();
}
public Integer getJobId() {
return jobId;
}
public void setJobId(Integer jobId) {
this.jobId = jobId;
}
public Date getBirthday() {
return birthday;
}
public void setBirthday(Date birthday) {
this.birthday = birthday;
}
public String getQrCode() {
return qrCode;
}
public void setQrCode(String qrCode) {
this.qrCode = qrCode == null ? null : qrCode.trim();
}
public String getQrCode2() {
return qrCode2;
}
public void setQrCode2(String qrCode2) {
this.qrCode2 = qrCode2 == null ? null : qrCode2.trim();
}
public String getThirdName() {
return thirdName;
}
public void setThirdName(String thirdName) {
this.thirdName = thirdName == null ? null : thirdName.trim();
}
public String getThirdId() {
return thirdId;
}
public void setThirdId(String thirdId) {
this.thirdId = thirdId == null ? null : thirdId.trim();
}
public String getThirdPassword() {
return thirdPassword;
}
public void setThirdPassword(String thirdPassword) {
this.thirdPassword = thirdPassword == null ? null : thirdPassword.trim();
}
public Integer getRoleId() {
return roleId;
}
public void setRoleId(Integer roleId) {
this.roleId = roleId;
}
public String getOrganization() {
return organization;
}
public void setOrganization(String organization) {
this.organization = organization == null ? null : organization.trim();
}
public String getIdcardNum() {
return idcardNum;
}
public void setIdcardNum(String idcardNum) {
this.idcardNum = idcardNum == null ? null : idcardNum.trim();
}
public Integer getCertificateType() {
return certificateType;
}
public void setCertificateType(Integer certificateType) {
this.certificateType = certificateType;
}
public String getCertificateNumber() {
return certificateNumber;
}
public void setCertificateNumber(String certificateNumber) {
this.certificateNumber = certificateNumber == null ? null : certificateNumber.trim();
}
public String getCertificateName() {
return certificateName;
}
public void setCertificateName(String certificateName) {
this.certificateName = certificateName == null ? null : certificateName.trim();
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description == null ? null : description.trim();
}
public String getSerial() {
return serial;
}
public void setSerial(String serial) {
this.serial = serial == null ? null : serial.trim();
}
public Integer getTypeId() {
return typeId;
}
public void setTypeId(Integer typeId) {
this.typeId = typeId;
}
public Integer getLinkId() {
return linkId;
}
public void setLinkId(Integer linkId) {
this.linkId = linkId;
}
public Integer getGroupId() {
return groupId;
}
public void setGroupId(Integer groupId) {
this.groupId = groupId;
}
public Integer getGradeId() {
return gradeId;
}
public void setGradeId(Integer gradeId) {
this.gradeId = gradeId;
}
public Integer getMainStatus() {
return mainStatus;
}
public void setMainStatus(Integer mainStatus) {
this.mainStatus = mainStatus;
}
public Integer getLogicStatus() {
return logicStatus;
}
public void setLogicStatus(Integer logicStatus) {
this.logicStatus = logicStatus;
}
public BigDecimal getAttrDecimal() {
return attrDecimal;
}
public void setAttrDecimal(BigDecimal attrDecimal) {
this.attrDecimal = attrDecimal;
}
public String getAttrStr() {
return attrStr;
}
public void setAttrStr(String attrStr) {
this.attrStr = attrStr == null ? null : attrStr.trim();
}
public Integer getAttrInt() {
return attrInt;
}
public void setAttrInt(Integer attrInt) {
this.attrInt = attrInt;
}
public Integer getSequence() {
return sequence;
}
public void setSequence(Integer sequence) {
this.sequence = sequence;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark == null ? null : remark.trim();
}
public Date getDeletedAt() {
return deletedAt;
}
public void setDeletedAt(Date deletedAt) {
this.deletedAt = deletedAt;
}
public String getDeletedBy() {
return deletedBy;
}
public void setDeletedBy(String deletedBy) {
this.deletedBy = deletedBy == null ? null : deletedBy.trim();
}
public Date getCreatedAt() {
return createdAt;
}
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
public String getCreatedBy() {
return createdBy;
}
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy == null ? null : createdBy.trim();
}
public Date getUpdatedAt() {
return updatedAt;
}
public void setUpdatedAt(Date updatedAt) {
this.updatedAt = updatedAt;
}
public String getUpdatedBy() {
return updatedBy;
}
public void setUpdatedBy(String updatedBy) {
this.updatedBy = updatedBy == null ? null : updatedBy.trim();
}
/**=========================== 自定义GETSET方法开始 _@CAUTION_SELF_GETSET_BEGIN@_ ===========================*/
public String getProvinceName() {
return provinceName;
}
public void setProvinceName(String provinceName) {
this.provinceName = provinceName;
}
public String getHospitalName() {
return hospitalName;
}
public void setHospitalName(String hospitalName) {
this.hospitalName = hospitalName;
}
public String getCityName() {
return cityName;
}
public void setCityName(String cityName) {
this.cityName = cityName;
}
public String getSexName() {
return sexName;
}
public void setSexName(String sexName) {
this.sexName = sexName;
}
public String getMainStatusName() {
return mainStatusName;
}
public void setMainStatusName(String mainStatusName) {
this.mainStatusName = mainStatusName;
}
/**=========================== 自定义GETSET方法结束 _@CAUTION_SELF_GETSET_FINISH@_ ===========================*/
} | wozhenwuyou/Medical | src/main/java/com/lhfeiyu/po/Nurse.java |
65,801 | package com.ylz.bizDo.web.vo;
import com.ylz.packaccede.util.CardUtil;
import com.ylz.packcommon.common.util.AgeUtil;
import com.ylz.packcommon.common.util.ExtendDate;
import org.apache.commons.lang.StringUtils;
import java.util.Calendar;
import java.util.HashMap;
import java.util.Map;
/**
* 签约接口1
*/
public class WebSignVo {
private String signId;
private String areaCodeProvince;//行政区划(省)
private String areaCodeCity;//行政区划(市)
//医院信息 根据医院id查询是否存在,没有自动创建医院
private String hospId;//医院主键
private String hospName;//医院名称
private String hospAreaCode;//区域编码
private String hospAddress;//医院地址
private String hospTel;//医院电话
//医生信息 根据医生id查询是否存在,没有自动创建医生
private String drId;//医生主键
private String drName;//医生名称
private String drAccount;//医生账号
private String drPwd;//医生密码
private String drGender;//医生性别
private String drTel;//医生电话
private String drOperatorId;//操作人医生主键
private String drOperatorName;//操作人医生名称
private String drOperatorAccount;//操作人医生账号
private String drOperatorPwd;//操作人医生密码
private String drOperatorGender;//操作人医生性别
private String drOperatorTel;//操作人医生电话
private String hospOperatorId;//医院主键
private String drAssistantId;//助理医生主键
private String drAssistantName;//助理医生名称
private String drAssistantAccount;//助理医生账号
private String drAssistantPwd;//助理医生密码
private String drAssistantGender;//助理医生性别
private String drAssistantTel;//助理医生电话
private String hospAssistantId;//助理医院主键
private String memState;// 团队角色 0:队长 1:成员
private String signDrAssistantId;
private String signDrAssistantTel;
private String signDrAssistantName;
private String drRole;//职称
//团队 医生id查询是否已有团队 没有就根据上传的团队名称自动创建团队
private String teamId;//团队id
private String teamName;//团队名称
//患者 根据患者身份证查询是否存在,没有自动创建患者 患者
private String patientId;//患者id
private String patientName;//患者名字
private String patientGender;//患者性别
private String patientIdno;//患者身份证号
private String patientCard;//患者社保卡
private String patientTel;//患者电话
private String patientAddress;//患者地址
private String patientPwd;//患者密码
private String patientAge;//年纪
private String signlx;//签约医保类型
private String patientjtda;//居民家庭档案
private String patientjmda;//居民建康档案
private String ptsignPk;
private String patientProvince;//省
private String patientCity;//市
private String patientArea;//区
private String patientStreet;//街道
private String patientNeighborhoodCommittee;//居委会
//签约
private String signDate;//签约时间
private Calendar signFromDate;//有效开始时间
private Calendar signToDate;//有效结束时间
private String signPayState;//缴费状态 1已缴费 0:未缴费
private String signType;//签约类型 //1家庭签约 2 vip
private String signPersGroup;//服务人群 1普通人群 2儿童(0-6岁) 3孕产妇 4老年人 5高血压 6糖尿病 7严重精神障碍 8结核病 99未知
private String signsJjType;//经济类型
private String signczpay;//财政补贴
private String signzfpay;//自费
private String[] persGroup;
private String[] sJjType;
private String signWebState;
private String FormDate;
private String ToDate;
private String signtext;//补充协议
private String[] signpackageid;//服务包内容表id
private String batchOperatorName;
private String batchOperatorId;
// 医保 农合账号 调接口用
private String yuser;
private String ypaw;
private String xuser;
private String xpaw;
//疾病标签
private String lableState;
private String personLable;
private String msg;
public String getYuser() {
return yuser;
}
public void setYuser(String yuser) {
this.yuser = yuser;
}
public String getYpaw() {
return ypaw;
}
public void setYpaw(String ypaw) {
this.ypaw = ypaw;
}
public String getXuser() {
return xuser;
}
public void setXuser(String xuser) {
this.xuser = xuser;
}
public String getXpaw() {
return xpaw;
}
public void setXpaw(String xpaw) {
this.xpaw = xpaw;
}
public String getDrAssistantId() {
return drAssistantId;
}
public void setDrAssistantId(String drAssistantId) {
this.drAssistantId = drAssistantId;
}
public String getDrAssistantName() {
return drAssistantName;
}
public void setDrAssistantName(String drAssistantName) {
this.drAssistantName = drAssistantName;
}
public String getDrAssistantAccount() {
return drAssistantAccount;
}
public void setDrAssistantAccount(String drAssistantAccount) {
this.drAssistantAccount = drAssistantAccount;
}
public String getDrAssistantPwd() {
return drAssistantPwd;
}
public void setDrAssistantPwd(String drAssistantPwd) {
this.drAssistantPwd = drAssistantPwd;
}
public String getDrAssistantGender() {
return drAssistantGender;
}
public void setDrAssistantGender(String drAssistantGender) {
this.drAssistantGender = drAssistantGender;
}
public String getDrAssistantTel() {
return drAssistantTel;
}
public void setDrAssistantTel(String drAssistantTel) {
this.drAssistantTel = drAssistantTel;
}
public String getHospAssistantId() {
return hospAssistantId;
}
public void setHospAssistantId(String hospAssistantId) {
this.hospAssistantId = hospAssistantId;
}
public String getBatchOperatorName() {
return batchOperatorName;
}
public void setBatchOperatorName(String batchOperatorName) {
this.batchOperatorName = batchOperatorName;
}
public String getBatchOperatorId() {
return batchOperatorId;
}
public void setBatchOperatorId(String batchOperatorId) {
this.batchOperatorId = batchOperatorId;
}
public String getSigntext() {
return signtext;
}
public void setSigntext(String signtext) {
this.signtext = signtext;
}
public String[] getSignpackageid() {
return signpackageid;
}
public void setSignpackageid(String[] signpackageid) {
this.signpackageid = signpackageid;
}
public String getSignId() {
return signId;
}
public void setSignId(String signId) {
this.signId = signId;
}
public String getSignczpay() {
return signczpay;
}
public void setSignczpay(String signczpay) {
this.signczpay = signczpay;
}
public String getSignzfpay() {
return signzfpay;
}
public void setSignzfpay(String signzfpay) {
this.signzfpay = signzfpay;
}
public String getSignDrAssistantName() {
return signDrAssistantName;
}
public void setSignDrAssistantName(String signDrAssistantName) {
this.signDrAssistantName = signDrAssistantName;
}
public String getSignWebState() {
return signWebState;
}
public void setSignWebState(String signWebState) {
this.signWebState = signWebState;
}
public String getFormDate() {
return FormDate;
}
public void setFormDate(String formDate) {
FormDate = formDate;
}
public String getToDate() {
return ToDate;
}
public void setToDate(String toDate) {
ToDate = toDate;
}
public String getSignsJjType() {
return signsJjType;
}
public void setSignsJjType(String signsJjType) {
this.signsJjType = signsJjType;
}
public String getHospId() {
return hospId;
}
public void setHospId(String hospId) {
this.hospId = hospId;
}
public String getHospName() {
return hospName;
}
public void setHospName(String hospName) {
this.hospName = hospName;
}
public String getHospAreaCode() {
return hospAreaCode;
}
public void setHospAreaCode(String hospAreaCode) {
this.hospAreaCode = hospAreaCode;
}
public String getHospAddress() {
return hospAddress;
}
public void setHospAddress(String hospAddress) {
this.hospAddress = hospAddress;
}
public String getHospTel() {
return hospTel;
}
public void setHospTel(String hospTel) {
this.hospTel = hospTel;
}
public String getDrId() {
return drId;
}
public void setDrId(String drId) {
this.drId = drId;
}
public String getDrName() {
return drName;
}
public void setDrName(String drName) {
this.drName = drName;
}
public String getDrAccount() {
return drAccount;
}
public void setDrAccount(String drAccount) {
this.drAccount = drAccount;
}
public String getDrPwd() {
return drPwd;
}
public void setDrPwd(String drPwd) {
this.drPwd = drPwd;
}
public String getDrGender() {
return drGender;
}
public void setDrGender(String drGender) {
this.drGender = drGender;
}
public String getDrTel() {
return drTel;
}
public void setDrTel(String drTel) {
this.drTel = drTel;
}
public String getTeamId() {
return teamId;
}
public void setTeamId(String teamId) {
this.teamId = teamId;
}
public String getTeamName() {
return teamName;
}
public void setTeamName(String teamName) {
this.teamName = teamName;
}
public String getPatientId() {
return patientId;
}
public void setPatientId(String patientId) {
this.patientId = patientId;
}
public String getPatientName() {
return patientName;
}
public void setPatientName(String patientName) {
this.patientName = patientName;
}
public String getPatientGender() {
return patientGender;
}
public void setPatientGender(String patientGender) {
this.patientGender = patientGender;
}
public String getPatientIdno() {
return patientIdno;
}
public void setPatientIdno(String patientIdno) {
this.patientIdno = patientIdno;
}
public String getPatientCard() {
return patientCard;
}
public void setPatientCard(String patientCard) {
this.patientCard = patientCard;
}
public String getPatientTel() {
return patientTel;
}
public void setPatientTel(String patientTel) {
this.patientTel = patientTel;
}
public String getPatientAddress() {
return patientAddress;
}
public void setPatientAddress(String patientAddress) {
this.patientAddress = patientAddress;
}
public String getPatientPwd() {
return patientPwd;
}
public void setPatientPwd(String patientPwd) {
this.patientPwd = patientPwd;
}
public String getSignDate() {
return signDate;
}
public void setSignDate(String signDate) {
this.signDate = signDate;
}
public Calendar getSignFromDate() {
return signFromDate;
}
public void setSignFromDate(Calendar signFromDate) {
this.signFromDate = signFromDate;
}
public Calendar getSignToDate() {
return signToDate;
}
public void setSignToDate(Calendar signToDate) {
this.signToDate = signToDate;
}
public String getSignPayState() {
return signPayState;
}
public void setSignPayState(String signPayState) {
this.signPayState = signPayState;
}
public String getSignType() {
return signType;
}
public void setSignType(String signType) {
this.signType = signType;
}
public String getSignPersGroup() {
return signPersGroup;
}
public void setSignPersGroup(String signPersGroup) {
this.signPersGroup = signPersGroup;
}
public String getMemState() {
return memState;
}
public void setMemState(String memState) {
this.memState = memState;
}
public String getAreaCodeProvince() {
return areaCodeProvince;
}
public void setAreaCodeProvince(String areaCodeProvince) {
this.areaCodeProvince = areaCodeProvince;
}
public String getAreaCodeCity() {
return areaCodeCity;
}
public void setAreaCodeCity(String areaCodeCity) {
this.areaCodeCity = areaCodeCity;
}
public String getPatientAge() {
return patientAge;
}
public void setPatientAge(String patientAge) {
this.patientAge = patientAge;
}
public String getSignlx() {
return signlx;
}
public void setSignlx(String signlx) {
this.signlx = signlx;
}
public String getPatientjtda() {
return patientjtda;
}
public void setPatientjtda(String patientjtda) {
this.patientjtda = patientjtda;
}
public String getPatientjmda() {
return patientjmda;
}
public void setPatientjmda(String patientjmda) {
this.patientjmda = patientjmda;
}
public String getPtsignPk() {
return ptsignPk;
}
public void setPtsignPk(String ptsignPk) {
this.ptsignPk = ptsignPk;
}
public String getSignDrAssistantId() {
return signDrAssistantId;
}
public void setSignDrAssistantId(String signDrAssistantId) {
this.signDrAssistantId = signDrAssistantId;
}
public String getSignDrAssistantTel() {
return signDrAssistantTel;
}
public void setSignDrAssistantTel(String signDrAssistantTel) {
this.signDrAssistantTel = signDrAssistantTel;
}
public String getPatientProvince() {
return patientProvince;
}
public void setPatientProvince(String patientProvince) {
this.patientProvince = patientProvince;
}
public String getPatientCity() {
return patientCity;
}
public void setPatientCity(String patientCity) {
this.patientCity = patientCity;
}
public String getPatientArea() {
return patientArea;
}
public void setPatientArea(String patientArea) {
this.patientArea = patientArea;
}
public String getPatientStreet() {
return patientStreet;
}
public void setPatientStreet(String patientStreet) {
this.patientStreet = patientStreet;
}
public String[] getPersGroup() {
return persGroup;
}
public void setPersGroup(String[] persGroup) {
this.persGroup = persGroup;
}
public String[] getsJjType() {
return sJjType;
}
public void setsJjType(String[] sJjType) {
this.sJjType = sJjType;
}
public String getPatientNeighborhoodCommittee() {
return patientNeighborhoodCommittee;
}
public void setPatientNeighborhoodCommittee(String patientNeighborhoodCommittee) {
this.patientNeighborhoodCommittee = patientNeighborhoodCommittee;
}
public String getDrRole() {
return drRole;
}
public void setDrRole(String drRole) {
this.drRole = drRole;
}
public String getDrOperatorId() {
return drOperatorId;
}
public void setDrOperatorId(String drOperatorId) {
this.drOperatorId = drOperatorId;
}
public String getDrOperatorName() {
return drOperatorName;
}
public void setDrOperatorName(String drOperatorName) {
this.drOperatorName = drOperatorName;
}
public String getDrOperatorAccount() {
return drOperatorAccount;
}
public void setDrOperatorAccount(String drOperatorAccount) {
this.drOperatorAccount = drOperatorAccount;
}
public String getDrOperatorPwd() {
return drOperatorPwd;
}
public void setDrOperatorPwd(String drOperatorPwd) {
this.drOperatorPwd = drOperatorPwd;
}
public String getDrOperatorGender() {
return drOperatorGender;
}
public void setDrOperatorGender(String drOperatorGender) {
this.drOperatorGender = drOperatorGender;
}
public String getDrOperatorTel() {
return drOperatorTel;
}
public void setDrOperatorTel(String drOperatorTel) {
this.drOperatorTel = drOperatorTel;
}
public String getHospOperatorId() {
return hospOperatorId;
}
public void setHospOperatorId(String hospOperatorId) {
this.hospOperatorId = hospOperatorId;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public String getLableState() {
return lableState;
}
public void setLableState(String lableState) {
this.lableState = lableState;
}
public String getPersonLable() {
return personLable;
}
public void setPersonLable(String personLable) {
this.personLable = personLable;
}
}
| zzr156/familydoctor | src/main/java/com/ylz/bizDo/web/vo/WebSignVo.java |
65,802 | package com.lhfeiyu.po;
import java.math.BigDecimal;
import java.util.Date;
import org.springframework.format.annotation.DateTimeFormat;
import com.alibaba.fastjson.JSONObject;
/**
* <strong> 描 述:</strong> 持久层对象 <p>
* <strong> 作 者:</strong> 虞荣华 <p>
* <strong> 编写时间:</strong>2016年3月20日22:22:22<p>
* <strong> 公 司:</strong> 成都蓝海飞鱼科技有限公司<p>
* <strong> 版 本:</strong> 1.0<p>
*/
public class Article extends Parent {
/**============================== 自定义字段 开始 _@CAUTION_SELF_FIELD_BEGIN@_ ==============================*/
private String typeName;
private String username;
/**============================== 自定义字段 结束 _@CAUTION_SELF_FIELD_FINISH@_ ==============================*/
/** 自增整型ID */
private Integer id;
/** 栏目ID */
private Integer catId;
/** 角色ID(固定位置的文章标识) */
private Integer roleId;
/** 标题 */
private String title;
/** 子标题 */
private String subTitle;
/** 描述 */
private String description;
/** 图片路径 */
private String picPaths;
/** 内容 */
private String content;
/** 公司,团队,机构 */
private String organization;
/** 地址 */
private String address;
/** 开始时间 */
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date startDate;
/** */
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date endDate;
/** 链接地址 */
private String linkUrl;
/** 自定义属性1 */
private String attr1;
/** 自定义属性2 */
private String attr2;
/** 是否热门(1:否,2:是) */
private Integer isHot;
/** 是否推荐(1:否,2:是) */
private Integer isRecommend;
/** 是否首页展示(1:否,2:是) */
private Integer isShowIndex;
/** 是否精华(1:否,2:是) */
private Integer isGood;
/** 是否置顶(1:否,2:是) */
private Integer isTop;
/** 用户ID */
private Integer userId;
/** 作者 */
private String author;
/** 关键字 */
private String keywords;
/** 标签 */
private String tags;
/** 附件ID */
private Integer fileId;
/** 附件ID串 */
private String fileIds;
/** 附件ID */
private Integer attachId;
/** 浏览次数 */
private Integer scans;
/** 点击次数 */
private Integer hits;
/** 是否允许评论 */
private Integer allowComment;
/** 来源 */
private String orgin;
/** 序号 */
private String serial;
/** */
private Integer subTypeId;
/** 类型ID */
private Integer typeId;
/** 关联ID */
private Integer linkId;
/** 组ID */
private Integer groupId;
/** 等级 */
private Integer gradeId;
/** 业务状态 */
private Integer mainStatus;
/** 逻辑状态 */
private Integer logicStatus;
/** BigDecimal */
private BigDecimal attrDecimal;
/** 备用字段-字符串 */
private String attrStr;
/** 备用字段-整型 */
private Integer attrInt;
/** 排列顺序 */
private Integer sequence;
/** 备注 */
private String remark;
/** 删除时间 */
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date deletedAt;
/** 删除人 */
private String deletedBy;
/** 创建时间 */
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createdAt;
/** 创建人 */
private String createdBy;
/** 更新时间 */
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updatedAt;
/** 更新人 */
private String updatedBy;
public String toString(){
return JSONObject.toJSONString(this);
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getCatId() {
return catId;
}
public void setCatId(Integer catId) {
this.catId = catId;
}
public Integer getRoleId() {
return roleId;
}
public void setRoleId(Integer roleId) {
this.roleId = roleId;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title == null ? null : title.trim();
}
public String getSubTitle() {
return subTitle;
}
public void setSubTitle(String subTitle) {
this.subTitle = subTitle == null ? null : subTitle.trim();
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description == null ? null : description.trim();
}
public String getPicPaths() {
return picPaths;
}
public void setPicPaths(String picPaths) {
this.picPaths = picPaths == null ? null : picPaths.trim();
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content == null ? null : content.trim();
}
public String getOrganization() {
return organization;
}
public void setOrganization(String organization) {
this.organization = organization == null ? null : organization.trim();
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address == null ? null : address.trim();
}
public Date getStartDate() {
return startDate;
}
public void setStartDate(Date startDate) {
this.startDate = startDate;
}
public Date getEndDate() {
return endDate;
}
public void setEndDate(Date endDate) {
this.endDate = endDate;
}
public String getLinkUrl() {
return linkUrl;
}
public void setLinkUrl(String linkUrl) {
this.linkUrl = linkUrl == null ? null : linkUrl.trim();
}
public String getAttr1() {
return attr1;
}
public void setAttr1(String attr1) {
this.attr1 = attr1 == null ? null : attr1.trim();
}
public String getAttr2() {
return attr2;
}
public void setAttr2(String attr2) {
this.attr2 = attr2 == null ? null : attr2.trim();
}
public Integer getIsHot() {
return isHot;
}
public void setIsHot(Integer isHot) {
this.isHot = isHot;
}
public Integer getIsRecommend() {
return isRecommend;
}
public void setIsRecommend(Integer isRecommend) {
this.isRecommend = isRecommend;
}
public Integer getIsShowIndex() {
return isShowIndex;
}
public void setIsShowIndex(Integer isShowIndex) {
this.isShowIndex = isShowIndex;
}
public Integer getIsGood() {
return isGood;
}
public void setIsGood(Integer isGood) {
this.isGood = isGood;
}
public Integer getIsTop() {
return isTop;
}
public void setIsTop(Integer isTop) {
this.isTop = isTop;
}
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author == null ? null : author.trim();
}
public String getKeywords() {
return keywords;
}
public void setKeywords(String keywords) {
this.keywords = keywords == null ? null : keywords.trim();
}
public String getTags() {
return tags;
}
public void setTags(String tags) {
this.tags = tags == null ? null : tags.trim();
}
public Integer getFileId() {
return fileId;
}
public void setFileId(Integer fileId) {
this.fileId = fileId;
}
public String getFileIds() {
return fileIds;
}
public void setFileIds(String fileIds) {
this.fileIds = fileIds == null ? null : fileIds.trim();
}
public Integer getAttachId() {
return attachId;
}
public void setAttachId(Integer attachId) {
this.attachId = attachId;
}
public Integer getScans() {
return scans;
}
public void setScans(Integer scans) {
this.scans = scans;
}
public Integer getHits() {
return hits;
}
public void setHits(Integer hits) {
this.hits = hits;
}
public Integer getAllowComment() {
return allowComment;
}
public void setAllowComment(Integer allowComment) {
this.allowComment = allowComment;
}
public String getOrgin() {
return orgin;
}
public void setOrgin(String orgin) {
this.orgin = orgin == null ? null : orgin.trim();
}
public String getSerial() {
return serial;
}
public void setSerial(String serial) {
this.serial = serial == null ? null : serial.trim();
}
public Integer getSubTypeId() {
return subTypeId;
}
public void setSubTypeId(Integer subTypeId) {
this.subTypeId = subTypeId;
}
public Integer getTypeId() {
return typeId;
}
public void setTypeId(Integer typeId) {
this.typeId = typeId;
}
public Integer getLinkId() {
return linkId;
}
public void setLinkId(Integer linkId) {
this.linkId = linkId;
}
public Integer getGroupId() {
return groupId;
}
public void setGroupId(Integer groupId) {
this.groupId = groupId;
}
public Integer getGradeId() {
return gradeId;
}
public void setGradeId(Integer gradeId) {
this.gradeId = gradeId;
}
public Integer getMainStatus() {
return mainStatus;
}
public void setMainStatus(Integer mainStatus) {
this.mainStatus = mainStatus;
}
public Integer getLogicStatus() {
return logicStatus;
}
public void setLogicStatus(Integer logicStatus) {
this.logicStatus = logicStatus;
}
public BigDecimal getAttrDecimal() {
return attrDecimal;
}
public void setAttrDecimal(BigDecimal attrDecimal) {
this.attrDecimal = attrDecimal;
}
public String getAttrStr() {
return attrStr;
}
public void setAttrStr(String attrStr) {
this.attrStr = attrStr == null ? null : attrStr.trim();
}
public Integer getAttrInt() {
return attrInt;
}
public void setAttrInt(Integer attrInt) {
this.attrInt = attrInt;
}
public Integer getSequence() {
return sequence;
}
public void setSequence(Integer sequence) {
this.sequence = sequence;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark == null ? null : remark.trim();
}
public Date getDeletedAt() {
return deletedAt;
}
public void setDeletedAt(Date deletedAt) {
this.deletedAt = deletedAt;
}
public String getDeletedBy() {
return deletedBy;
}
public void setDeletedBy(String deletedBy) {
this.deletedBy = deletedBy == null ? null : deletedBy.trim();
}
public Date getCreatedAt() {
return createdAt;
}
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
public String getCreatedBy() {
return createdBy;
}
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy == null ? null : createdBy.trim();
}
public Date getUpdatedAt() {
return updatedAt;
}
public void setUpdatedAt(Date updatedAt) {
this.updatedAt = updatedAt;
}
public String getUpdatedBy() {
return updatedBy;
}
public void setUpdatedBy(String updatedBy) {
this.updatedBy = updatedBy == null ? null : updatedBy.trim();
}
/**=========================== 自定义GETSET方法开始 _@CAUTION_SELF_GETSET_BEGIN@_ ===========================*/
public String getTypeName() {
return typeName;
}
public void setTypeName(String typeName) {
this.typeName = typeName;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
/**=========================== 自定义GETSET方法结束 _@CAUTION_SELF_GETSET_FINISH@_ ===========================*/
} | wozhenwuyou/Medical | src/main/java/com/lhfeiyu/po/Article.java |
65,803 | import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
/*
* @lc app=leetcode.cn id=1125 lang=java
*
* [1125] 最小的必要团队
*/
// @lc code=start
class Solution {
public int[] smallestSufficientTeam(String[] req_skills, List<List<String>> people) {
int n = req_skills.length, m = people.size();
HashMap<String, Integer> skill_index = new HashMap<>();
for (int i = 0; i < n; ++i) {
skill_index.put(req_skills[i], i);
}
int[] dp = new int[1 << n];
Arrays.fill(dp, m);
dp[0] = 0;
int[] prev_skill = new int[1 << n];
int[] prev_people = new int[1 << n];
for (int i = 0; i < m; i++) {
List<String> p = people.get(i);
int cur_skill = 0;
for (String s : p) {
cur_skill |= 1 << skill_index.get(s);
}
for (int prev = 0; prev < (1 << n); prev++) {
int comb = prev | cur_skill;
if (dp[comb] > dp[prev] + 1) {
dp[comb] = dp[prev] + 1;
prev_skill[comb] = prev;
prev_people[comb] = i;
}
}
}
List<Integer> res = new ArrayList<>();
int i = (1 << n) - 1;
while (i > 0) {
res.add(prev_people[i]);
i = prev_skill[i];
}
return res.stream().mapToInt(j -> j).toArray();
}
}
// @lc code=end
| halalala222/LeetCode-Study | 1125.最小的必要团队.java |
65,804 | package com.cdkj.loan.api.impl;
public class Readme {
// 630000 -630199 系统设置(角色、菜单、角色菜单、数据字典、系统参数,导航等)
// 630000 - 630009 角色设置
// 630010 - 630019 菜单设置
// 630020 - 630029 角色菜单
// 630030 - 630039 数据字典
// 630040 - 630049 系统参数
// 630050 - 630099 平台用户
// 630100 - 630119 部门/公司
// 630120 - 630139 业务员
// 630140 - 630149 节点管理
// 630150 - 630159 节点流程配置
// 630160 - 630169 流程角色分配
// 630170 - 630179 操作日志
// 630180 - 630189 导航(待迁移)
// 630190 - 630199 团队
// 630200 - 630209 团队成员
// 630190 - 630199 团队
// 前端用户 805***
// 用户账户 802***
// 购车意向收集业务:630400-630499
// 630400-630409 品牌管理
// 630410-630419 车系管理
// 630420-630429 车型管理
// 630430-630439 意向收集
// 车贷还款业务:630500-630599
// 630500-630509 车贷订单
// 630510-630529 还款业务
// 630530-630549 还款计划
// 630530-630549 还款计划
// 商品分期业务:808000-808099
// 对接第三方接口:630800-630850
// 统计接口: 630900- 630999
// 温州车贷
// 基础数据:632000 - 632099
// 632000-632009 收款账号管理
// 632010-632019 身份证区域表
// 632020-632029 全国省份编号对应表
// 632030-632039 银行管理
// 632040-632049 保险公司管理
// 632060-632069 经销商管理
// 贷前管理 632100-632299
// 632110-632119 征信
// 632120-632149 预算单
// 632150-632159 资料传递
// 632170-632179 贷款银行
// 632220-632229 入档清单
// 贷前工具
// 632160-632169 手续费
// 632180-632189 退客户垫资款
// 632190-632199 客户作废
// 632200-632209 调查报告
// 632210-632219 材料清单
// 贷后管理 632300-632499
// 632300-632309 导入逾期名单
// 632310-632319 返点支付
// 630550-630569 逾期异常处理
// 行政 632700-632799
// 632700-632709 GPS
// 632710-632719 GPS申领审核
// 632720-632729 通知公告
// 632730-632739 公司制度
// 632740-632749 类别管理
// 632750-632759 品名管理
// 632760-632769 入库管理
// 632770-632779 出库管理
// 632780-632789 公车管理
// 632790-632799 公车出借
// 人事 632600-632699,632800-632899
// 632800-632819 人事档案
// 632820-632829 车贷档案
// 632830-632839 合同管理
// 632840-632849 人才招聘
// 632850-632859 应聘登记
// 632890-632899 请假
// 632600-632609 补签
// 632610-632619 加班
// 632620-632629 出差/公差
// 632630-632639 车辆违章
// 632640-632649 办公用品/固定资产
// 632650-632659 领导请示申请
// 632660-632669 福利发放申请
// 632670-632679 费用预支申请
// 632680-632689 休息日和汇总
// 632690-632699 出差管理
// 统计分析 632900-632999
// 632900-632909 行政人事统计接口
// 统计分析 632910
// 632920-632949 立木征信对接
// 632950-632959 面签视频
// 华图威通200 新增接口
// 632500-632599
// 华图威通200 重构接口
// 632400-632499
// 632460-632479 温州财务垫资(兼容接口)
// 632480-632489 征信人辅助资料
// 632490-632499 征信流水
}
| ibisTime/xn-htwt | src/main/java/com/cdkj/loan/api/impl/Readme.java |
65,805 | package com.cdkj.loan.api.impl;
public class Readme {
// 630000 - 630199 系统设置(角色、菜单、角色菜单、数据字典、系统参数,导航等)
// 630000 - 630009 角色设置
// 630010 - 630019 菜单设置
// 630020 - 630029 角色菜单
// 630030 - 630039 数据字典
// 630040 - 630049 系统参数
// 630050 - 630099 平台用户
// 630100 - 630119 部门/公司
// 630120 - 630139 业务员
// 630140 - 630149 节点管理
// 630150 - 630159 节点流程配置
// 630160 - 630169 流程角色分配
// 630170 - 630179 操作日志
// 630180 - 630189 导航(待迁移)
// 630190 - 630199 团队
// 630200 - 630209 团队成员
// 前端用户 805***
// 用户账户 802***
// 购车意向收集业务:630400-630499
// 630400-630409 品牌管理
// 630410-630419 车系管理
// 630420-630429 车型管理
// 630430-630439 意向收集
// 630440 城市列表
// 车贷还款业务:630500-630599
// 630500-630509 车贷订单
// 630510-630549 还款业务
// 630550-630569 收车管理,司法诉讼
// 630570-630579 结清管理
// 630530-630549 还款计划
// 商品分期业务:808000-808099
// 统计接口: 630900- 630999
// 温州车贷
// 基础数据:632000 - 632099
// 632000-632009 收款账号管理
// 632010-632019 身份证区域表
// 632020-632029 全国省份编号对应表
// 632030-632039 银行管理
// 632040-632049 保险公司管理
// 632050-632059 支行管理
// 632060-632069 经销商管理
// 632070-632079 支行管理
// 632080-632089 我司贷款成数
// 632090-632099 表格导出
// 632400-632409 奖金提成配置
// 632410-632419 奖金提成
// 贷前 632100-632299(贷前管理+贷前工具)
// 贷前管理
// 632110-632119 征信
// 632120-632139 预算单
// 632170-632189 垫资
// 632140-632149 银行放款
// 632190-632199 车辆抵押
// 632200-632209 车贷入档
// 632130-632139 补件原因
// 632150-632159 资料传递
// 贷前工具
// 632100-632109 垫资请款预算单和收回预算款
// 632160-632169 收回手续费
// 632210-632219 制卡
// 632220-632229 录发保合
// 632230-632239 发票不匹配
// 632240-632249 返点支付
// 632250-632259 银行合同导入
// 632260-632269 退按揭款
// 632270-632279 客户作废
// 632280-632289 收回垫资款
// 632290-632299 返点明细
// 贷后管理 632300-632499
// 632300-632309 导入逾期名单
// 632310-632319 银行返佣
// 632320-632329 代偿预算单
// 632330-632339 代偿审核
// 632340-632349 车辆续保和预订单关联gps更新
// 632350-632359 公司结清记录
// 行政 632700-632799
// 632700-632709 GPS设备管理
// 632710-632719 GPS申领审核
// 632720-632729 通知公告
// 632730-632739 公司制度
// 632740-632749 类别管理
// 632750-632759 品名管理
// 632760-632769 入库管理
// 632770-632779 出库管理
// 632780-632789 GPS供应商管理
// 人事 632800-632899
// 632800-632819 人事档案
// 632820-632829 车贷档案
// 632830-632839 合同管理
// 632840-632849 人才招聘
// 632850-632859 应聘登记
// 632890-632899 请假
// 632600-632609 补签
// 632610-632619 加班
// 632620-632629 出差/公差
// 632630-632639 车辆违章
// 632640-632649 办公用品/固定资产
// 632650-632659 领导请示申请
// 632660-632669 福利发放申请
// 632670-632679 休息日和考勤汇总
// 632670 休息日保存修改
// 632675 按月列表查询休息日
// 632676 按月分页查询考勤汇总记录(根据人)
// 632690 计算器
// 632900-632909 履约保证金开票
// 630900-630919 统计分析
}
| ibisTime/xn-wzcd | src/main/java/com/cdkj/loan/api/impl/Readme.java |
65,836 | package com.bn.activty;
import android.app.Activity;
import android.opengl.GLSurfaceView;
import android.opengl.GLES30;
import android.view.MotionEvent;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;
import android.content.Context;
import com.bn.organ.ManBodyGroup;
import com.bn.manager.ShaderManager;
import com.bn.organ.LoadedObjectOrgan;
import com.bn.organ.WomanBodyGroup;
import com.bn.util.Constant;
import com.bn.util.LoadUtil;
import com.bn.util.MatrixState;
import com.bn.util.MyFunction;
import java.util.Collections;
/**
* Created by Administrator on 2017/6/9.
*/
public class MySurfaceView extends GLSurfaceView {
private final float TOUCH_SCALE_FACTOR = 180.0f / 320;//角度缩放比例
private SceneRenderer mRenderer;//场景渲染器
private float mPreviousX;//上次的触控位置X坐标
//男女标志位
boolean manOrWoman=true;//真为男,假为女
public static float cx=0.0f;//摄像机x
public static float cz=30.0f;//摄像机z
public static float cheight=11.0f;//摄像机高度
public static float cdistancep=30.0f;//摄像机与人物距离
public static float scaleBi=0.05f;//人物缩放比
public int selectOrgan=14;//选中的器官编号,初始值14为没有器官
float tempbrightBreath[];//存放器官的呼吸参数
float tempmanOrganColor[][];//存放男器官颜色数组
float womanorganColor[][];//女器官颜色数组
Activity activity;
public MySurfaceView(Context context) {
super(context);
activity=(MainActivity) context;
this.setEGLContextClientVersion(3); //设置使用OPENGL ES3.0
mRenderer = new SceneRenderer(); //创建场景渲染器
setRenderer(mRenderer); //设置渲染器
setRenderMode(GLSurfaceView.RENDERMODE_CONTINUOUSLY);//设置渲染模式为主动渲染
}
//触摸事件回调方法
float yAngle=0.0f;
@Override
public boolean onTouchEvent(MotionEvent e) {
float x = e.getX();
switch (e.getAction()) {
case MotionEvent.ACTION_MOVE:
float dx = x - mPreviousX;//计算触控笔X位移
yAngle -= dx*TOUCH_SCALE_FACTOR;//设置沿y轴旋转角度
requestRender();//重绘画面
}
cx=(float)(Math.sin(Math.toRadians(yAngle))*cdistancep); //计算新的摄像机x坐标
cz=(float)((Math.cos(Math.toRadians(yAngle))*cdistancep)); //计算新的摄像机z坐标
mPreviousX = x;//记录触控笔位置
if(manOrWoman) {
Collections.sort(mRenderer.manBodyGroup.alist);//男皮肤排序
}else
{
Collections.sort(mRenderer.womanbodyGroup.aWomanlist);//女皮肤排序
}
return true;
}
private class SceneRenderer implements GLSurfaceView.Renderer {
//从指定的obj文件中加载对象
//男
ManBodyGroup manBodyGroup;//人物皮肤组
LoadedObjectOrgan allOrganArray[]=new LoadedObjectOrgan[14];//存放器官的数组
//女
WomanBodyGroup womanbodyGroup;//女的皮肤组
LoadedObjectOrgan womanallOrganArray[]=new LoadedObjectOrgan[14];//存放器官的数组
public void onDrawFrame(GL10 gl) {
//清除深度缓冲与颜色缓冲
GLES30.glClear(GLES30.GL_DEPTH_BUFFER_BIT | GLES30.GL_COLOR_BUFFER_BIT);
MatrixState.setCamera(cx, cheight, cz, 0.0f, cheight, 0.0f, 0.0f, 1.0f, 0.0f);//重新设置照相机
MatrixState.setLightLocation(cx, cheight, cz);//设置光源位置
//坐标系推远
MatrixState.pushMatrix();
MatrixState.translate(0, 0f, 0.0f);
//缩小比例
MatrixState.scale(scaleBi, scaleBi, scaleBi);
//画器官
if(manOrWoman){
for(int i=0;i<allOrganArray.length;i++)//画男的器官
{
allOrganArray[i].drawSelf(tempmanOrganColor[i],tempbrightBreath[i]);
}
}else{
for(int i=0;i<womanallOrganArray.length;i++)//画女的器官
{
womanallOrganArray[i].drawSelf(womanorganColor[i],tempbrightBreath[i]);
}
}
//开启混合
GLES30.glEnable(GLES30.GL_BLEND);
//设置混合因子,其中第一个为源因子,第二个为目标因子
GLES30.glBlendFunc(GLES30.GL_SRC_ALPHA, GLES30.GL_ONE_MINUS_SRC_ALPHA);
//若加载的物体不为空则绘制物体
if(manOrWoman){
//传入线的宽度,亮度,位置
manBodyGroup.drawSelf(Constant.lineWidth,Constant.lineBright,Constant.linePosition);//画男皮肤
}else{
//传入线的宽度,亮度,位置
womanbodyGroup.drawSelf(Constant.lineWidth,Constant.lineBright,Constant.linePosition);//画女皮肤
}
//关闭混合
GLES30.glDisable(GLES30.GL_BLEND);
//恢复现场
MatrixState.popMatrix();
}
public void onSurfaceChanged(GL10 gl, int width, int height) {
//设置视窗大小及位置
GLES30.glViewport(0, 0, width, height);
//计算GLSurfaceView的宽高比
float ratio = (float) width / height;
//调用此方法计算产生透视投影矩阵
MatrixState.setProjectFrustum(-ratio, ratio, -1, 1, 2, 100);
//调用此方法产生摄像机9参数位置矩阵
MatrixState.setCamera(cx, cheight, cz, 0f, cheight, 0f, 0f, 1.0f, 0.0f);
}
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
//设置屏幕背景色RGBA
GLES30.glClearColor(0.0f,0.0f,0.0f,1.0f);
//打开深度检测
GLES30.glEnable(GLES30.GL_DEPTH_TEST);
//打开背面剪裁
GLES30.glEnable(GLES30.GL_CULL_FACE);
//关闭背面剪裁
//GLES30.glDisable(GLES30.GL_CULL_FACE);
//初始化变换矩阵
MatrixState.setInitStack();
//初始化光源位置
MatrixState.setLightLocation(cx, cheight, cz);
//初始化颜色呼吸数组
tempbrightBreath= MyFunction.initBreath();//初始器官呼吸系数
tempmanOrganColor=MyFunction.initManColor();//初始化男器官颜色
womanorganColor=MyFunction.initWomanColor();//初始化女器官颜色
//编译着色器
ShaderManager.loadCodeFromFile(activity.getResources());
ShaderManager.compileShader();
//加载要绘制的物体
manBodyGroup =new ManBodyGroup(MySurfaceView.this);//创建男皮肤组
Collections.sort(mRenderer.manBodyGroup.alist);//排序
womanbodyGroup=new WomanBodyGroup(MySurfaceView.this);//创建女皮肤组
Collections.sort(mRenderer.womanbodyGroup.aWomanlist);//排序
//加载男器官
allOrganArray[0]=LoadUtil.LoadedObjectOrgan("organ/man_bone.obj", MySurfaceView.this.getResources(),MySurfaceView.this,ShaderManager.getShader(1));//骨骼模型
allOrganArray[1]=LoadUtil.LoadedObjectOrgan("organ/man_brain.obj", MySurfaceView.this.getResources(),MySurfaceView.this,ShaderManager.getShader(1));//大脑
allOrganArray[2]=LoadUtil.LoadedObjectOrgan("organ/man_esophagus.obj", MySurfaceView.this.getResources(),MySurfaceView.this,ShaderManager.getShader(1));//食道
allOrganArray[3]=LoadUtil.LoadedObjectOrgan("organ/man_lung.obj", MySurfaceView.this.getResources(),MySurfaceView.this,ShaderManager.getShader(1));//肺
allOrganArray[4]=LoadUtil.LoadedObjectOrgan("organ/man_heart.obj", MySurfaceView.this.getResources(),MySurfaceView.this,ShaderManager.getShader(1));//心脏
allOrganArray[5]=LoadUtil.LoadedObjectOrgan("organ/man_liver.obj", MySurfaceView.this.getResources(),MySurfaceView.this,ShaderManager.getShader(1));//肝
allOrganArray[6]=LoadUtil.LoadedObjectOrgan("organ/man_pancreatic.obj", MySurfaceView.this.getResources(),MySurfaceView.this,ShaderManager.getShader(1));//胰脏
allOrganArray[7]=LoadUtil.LoadedObjectOrgan("organ/man_gallbladder.obj", MySurfaceView.this.getResources(),MySurfaceView.this,ShaderManager.getShader(1));//胆囊
allOrganArray[8]=LoadUtil.LoadedObjectOrgan("organ/man_stomach.obj", MySurfaceView.this.getResources(),MySurfaceView.this,ShaderManager.getShader(1));//胃
allOrganArray[9]=LoadUtil.LoadedObjectOrgan("organ/man_spleen.obj", MySurfaceView.this.getResources(),MySurfaceView.this,ShaderManager.getShader(1));//脾
allOrganArray[10]=LoadUtil.LoadedObjectOrgan("organ/man_intestinal.obj", MySurfaceView.this.getResources(),MySurfaceView.this,ShaderManager.getShader(1));//肠模型
allOrganArray[11]=LoadUtil.LoadedObjectOrgan("organ/man_kidney.obj", MySurfaceView.this.getResources(),MySurfaceView.this,ShaderManager.getShader(1));//大脑
allOrganArray[12]=LoadUtil.LoadedObjectOrgan("organ/man_bladder.obj", MySurfaceView.this.getResources(),MySurfaceView.this,ShaderManager.getShader(1));//膀胱
allOrganArray[13]=LoadUtil.LoadedObjectOrgan("organ/man_unknow.obj", MySurfaceView.this.getResources(),MySurfaceView.this,ShaderManager.getShader(1));//未知模型
//加载女器官
womanallOrganArray[0]=LoadUtil.LoadedObjectOrgan("organ/woman_bone.obj", MySurfaceView.this.getResources(),MySurfaceView.this,ShaderManager.getShader(1));//骨骼模型
womanallOrganArray[1]=LoadUtil.LoadedObjectOrgan("organ/woman_brain.obj", MySurfaceView.this.getResources(),MySurfaceView.this,ShaderManager.getShader(1));//大脑
womanallOrganArray[2]=LoadUtil.LoadedObjectOrgan("organ/woman_esophagus.obj", MySurfaceView.this.getResources(),MySurfaceView.this,ShaderManager.getShader(1));//食道
womanallOrganArray[3]=LoadUtil.LoadedObjectOrgan("organ/woman_lung.obj", MySurfaceView.this.getResources(),MySurfaceView.this,ShaderManager.getShader(1));//肺
womanallOrganArray[4]=LoadUtil.LoadedObjectOrgan("organ/woman_heart.obj", MySurfaceView.this.getResources(),MySurfaceView.this,ShaderManager.getShader(1));//心脏
womanallOrganArray[5]=LoadUtil.LoadedObjectOrgan("organ/woman_liver.obj", MySurfaceView.this.getResources(),MySurfaceView.this,ShaderManager.getShader(1));//肝
womanallOrganArray[6]=LoadUtil.LoadedObjectOrgan("organ/woman_pancreatic.obj", MySurfaceView.this.getResources(),MySurfaceView.this,ShaderManager.getShader(1));//胰脏
womanallOrganArray[7]=LoadUtil.LoadedObjectOrgan("organ/woman_gallbladder.obj", MySurfaceView.this.getResources(),MySurfaceView.this,ShaderManager.getShader(1));//胆囊
womanallOrganArray[8]=LoadUtil.LoadedObjectOrgan("organ/woman_stomach.obj", MySurfaceView.this.getResources(),MySurfaceView.this,ShaderManager.getShader(1));//胃
womanallOrganArray[9]=LoadUtil.LoadedObjectOrgan("organ/woman_uterus.obj", MySurfaceView.this.getResources(),MySurfaceView.this,ShaderManager.getShader(1));//脾
womanallOrganArray[10]=LoadUtil.LoadedObjectOrgan("organ/woman_intestinal.obj", MySurfaceView.this.getResources(),MySurfaceView.this,ShaderManager.getShader(1));//肠模型
womanallOrganArray[11]=LoadUtil.LoadedObjectOrgan("organ/woman_kidney.obj", MySurfaceView.this.getResources(),MySurfaceView.this,ShaderManager.getShader(1));//大脑
womanallOrganArray[12]=LoadUtil.LoadedObjectOrgan("organ/woman_bladder.obj", MySurfaceView.this.getResources(),MySurfaceView.this,ShaderManager.getShader(1));//膀胱
womanallOrganArray[13]=LoadUtil.LoadedObjectOrgan("organ/woman_unknow.obj", MySurfaceView.this.getResources(),MySurfaceView.this,ShaderManager.getShader(1));//未知模型
BreathThread rt=new BreathThread();//呼吸线程
rt.start();
LightThread lt=new LightThread();//光带线程
lt.start();
}
}
//呼吸线程
boolean addOrDec=true;//真为系数+ 假为系数-
public class BreathThread extends Thread
{
public boolean flag=true;
@Override
public void run()
{
while(flag)
{
//判断增加减小
if(addOrDec){
tempbrightBreath[selectOrgan]+=0.05f;
}else {
tempbrightBreath[selectOrgan]-=0.05f;
}
//如果小于1,呼吸系数等于1
if(tempbrightBreath[selectOrgan]<1.0) {
tempbrightBreath[selectOrgan]=1.0f;
addOrDec=true;
}
//如果呼吸系数大于最大值
if(tempbrightBreath[selectOrgan]>Constant.manMaxLight)
{
tempbrightBreath[selectOrgan]=Constant.manMaxLight;
addOrDec=false;
}
try {Thread.sleep(50);}
catch(Exception e) {e.printStackTrace();}
}
}
}
//光带线程
public class LightThread extends Thread
{
public boolean flag=true;
@Override
public void run()
{
while(flag)
{
//光带位置自动增加
Constant.linePosition+=10;
if(Constant.linePosition>=Constant.manHeight) {
Constant.linePosition=0;
}
try {Thread.sleep(100);}
catch(Exception e) {e.printStackTrace();}
}
}
}
}
| douysu/graphics-algorithm | moving-light-strip/src/main/java/com/bn/activty/MySurfaceView.java |
65,838 | package com.alipay.api.response;
import com.alipay.api.internal.mapping.ApiField;
import com.alipay.api.AlipayResponse;
/**
* ALIPAY API: ssdata.dataservice.risk.rtop.query response.
*
* @author auto create
* @since 1.0, 2019-01-07 20:51:15
*/
public class SsdataDataserviceRiskRtopQueryResponse extends AlipayResponse {
private static final long serialVersionUID = 7757377911122794257L;
/**
* 查询结果+蚁盾风控大脑,监管科技平台查询后端ssdataprod应用的返回数据
*/
@ApiField("query_result")
private String queryResult;
/**
* 调用是否成功标识
*/
@ApiField("success")
private Boolean success;
/**
* unqiue_id+业务唯一识别码traceId
*/
@ApiField("unique_id")
private String uniqueId;
public void setQueryResult(String queryResult) {
this.queryResult = queryResult;
}
public String getQueryResult( ) {
return this.queryResult;
}
public void setSuccess(Boolean success) {
this.success = success;
}
public Boolean getSuccess( ) {
return this.success;
}
public void setUniqueId(String uniqueId) {
this.uniqueId = uniqueId;
}
public String getUniqueId( ) {
return this.uniqueId;
}
}
| alipay/alipay-sdk-java-all | v2/src/main/java/com/alipay/api/response/SsdataDataserviceRiskRtopQueryResponse.java |
65,839 | package c02_enum.relation;
class Point {
int x, y;
}
class Line {
//has a (有整体部分关系):聚合关系
private Point start;
private Point end;
}
class Brain {
}//大脑(A)
class Person {//B,假如B和A存在整体关系
Brain a = new Brain();//A对象的生命周期依赖于B
}
public class RelationDemo02 {
}
| workforwy/BaseJava | src/c02_enum/relation/RelationDemo02.java |
65,840 | package com.shitlime.era.service;
import com.mikuac.shiro.dto.action.response.GetStatusResp;
import org.springframework.stereotype.Service;
import java.lang.management.ManagementFactory;
import java.lang.management.MemoryMXBean;
import java.lang.management.OperatingSystemMXBean;
import java.lang.management.RuntimeMXBean;
import java.time.*;
import java.util.StringJoiner;
@Service
public class StateService {
public String getEraState() {
StringJoiner joiner = new StringJoiner("\n");
joiner.add("----- 大脑 -----");
// 获取操作系统相关信息
OperatingSystemMXBean osBean = ManagementFactory.getOperatingSystemMXBean();
joiner.add("操作系统: " + osBean.getName());
joiner.add("cpu架构: " + osBean.getArch());
joiner.add("cpu核心数: " + osBean.getAvailableProcessors());
joiner.add(String.format("系统负载平均值: %.2f", osBean.getSystemLoadAverage()));
// 获取JVM运行时间相关信息
RuntimeMXBean runtimeBean = ManagementFactory.getRuntimeMXBean();
long uptime = runtimeBean.getUptime();
// 将uptime转换为Duration
Duration duration = Duration.ofMillis(uptime);
// 获取小时、分钟和秒
long hours = duration.toHours();
long minutes = duration.toMinutesPart();
long seconds = duration.toSecondsPart();
joiner.add("运行时长: " + hours + "小时" + minutes + "分钟" + seconds + "秒");
// 获取内存使用情况
MemoryMXBean memoryBean = ManagementFactory.getMemoryMXBean();
long used = memoryBean.getHeapMemoryUsage().getUsed();
long used2 = memoryBean.getNonHeapMemoryUsage().getUsed();
joiner.add(String.format("内存使用: %.2fMB", (used+used2)/1024.0/1024.0));
joiner.add("---------------");
return joiner.toString();
}
public String getOnebotStatus(GetStatusResp status) {
StringJoiner joiner = new StringJoiner("\n");
joiner.add("----- 身体 -----");
// 发送/接收消息次数
joiner.add(String.format("发送:%s 接收:%s",
status.getStat().getMessageSent(), status.getStat().getMessageReceived()));
// 发/收包
joiner.add(String.format("发包:%s 收包:%s",
status.getStat().getPacketSent(), status.getStat().getPacketReceived()));
// 连接断开次数
joiner.add(String.format("断开:%s次", status.getStat().getDisconnectTimes()));
// 丢包数
joiner.add(String.format("丢包:%s", status.getStat().getPacketLost()));
joiner.add("---------------");
return joiner.toString();
}
}
| shitlime/era | src/main/java/com/shitlime/era/service/StateService.java |
65,842 | package DesignPatterns.builder;
public class WomanBuilder implements PersonBuilder {
Person person;
public WomanBuilder() {person = new Woman();}
@Override
public void buildHead() { person.setHead("构造女孩的大脑"); }
@Override
public void buildBody() { person.setBody("构造女孩的身体"); }
@Override
public void buildFoot() { person.setFoot("构造女孩的脚"); }
@Override
public Person buildPerson() { return person; }
}
| huoji555/Shadow | DesignPatterns/builder/WomanBuilder.java |
65,843 | /*
Given a binary tree, each node has value 0 or 1. Each root-to-leaf path represents a binary number starting with the most significant bit.
For example, if the path is 0 -> 1 -> 1 -> 0 -> 1, then this could represent 01101 in binary, which is 13.
For all leaves in the tree, consider the numbers represented by the path from the root to that leaf.
Return the sum of these numbers.
Example 1:
Input: [1,0,1,0,1,0,1]
Output: 22
Explanation: (100) + (101) + (110) + (111) = 4 + 5 + 6 + 7 = 22
Note:
1. The number of nodes in the tree is between 1 and 1000.
2. node.val is 0 or 1.
3. The answer will not exceed 2^31 - 1.
*/
/**
* Approach 1: Divide and Conquer (Top-Down DFS)
* 对于 Tree 类型的问题,这里很容易就能反应过来是使用 Divide and Conquer 来实现。
* 接下来就需要确定 递归函数 的作用了。
* 这里,我们需要计算各条路径所表示元素的值总和。
* 因此,可以确定递归函数的作用为,返回当前节点左右子树所表示元素值的总和。
* 递归调用时 prevSum 表示从父节点获取到的值。
* 然后通过 prevSum << 1 | root.val 操作即可得到该节点所表示的值。
* 如果当前节点的左右节点均为 null,则直接返回 val 即可。
*
* 时间复杂度:O(n)
* 空间复杂度:O(logn)
*/
/**
* Definition for a binary tree node.
* public class TreeNode {
* int val;
* TreeNode left;
* TreeNode right;
* TreeNode(int x) { val = x; }
* }
*/
class Solution {
public int sumRootToLeaf(TreeNode root) {
return dfs(root, 0);
}
// 返回当前节点下所有元素值的总和(包括当前节点)
// prevSum 代表从父节点获取到的值
private int dfs(TreeNode root, int prevSum) {
if (root == null) {
return 0;
}
// 计算当前节点所表示元素的值(10进制)
prevSum = prevSum << 1 | root.val;
// 如果是叶子节点,则此时的 prevSum 就是最后的结果了,直接 return prevSum 即可
return root.left == null && root.right == null ? prevSum : dfs(root.left, prevSum) + dfs(root.right, prevSum);
}
}
/**
* Approach 2: Backtracking (Brute Force)
* 该解法主要是为了让大家能够更加直白地理解我的思路而写的...
* Approach 1 中,我将 二进制转换 和 元素值相加 的这两个操作整合起来了。
* 但是事后有小伙伴反应不够直白,大脑没转过弯来...所以就有了这个版本。
* 其实思路很简单:
* 1. 通过 DFS 遍历出路径所组成的所有元素。(这里直接用 Backtracking 即可)
* 2. 将所有遍历得到的二进制元素,转换成 十进制,然后相加即可得到最后的结果。
*
* 第一步的操作与 Binary Tree Path Sum 这个问题基本类似,大家可以参考一下:
* https://github.com/cherryljr/LintCode/blob/master/Binary%20Tree%20Path%20Sum.java
* 希望这个解法和说明对大家理解有所帮助...
*
* PS.题目最近做了修改,说明了数值和不会超过 2^31-1。所以不需要再进行取模操作了。
*/
class Solution {
public int sumRootToLeaf(TreeNode root) {
List<String> list = new ArrayList<>();
dfs(root, list, new StringBuilder());
int ans = 0;
for (String str : list) {
ans += Integer.valueOf(str, 2);
}
return ans;
}
private void dfs(TreeNode root, List<String> list, StringBuilder sb) {
if (root.left == null && root.right == null) {
String str = sb.toString();
list.add(str + root.val);
return;
}
if (root.left != null) {
dfs(root.left, list, sb.append(root.val));
sb.deleteCharAt(sb.length() - 1);
}
if (root.right != null) {
dfs(root.right, list, sb.append(root.val));
sb.deleteCharAt(sb.length() - 1);
}
}
} | cherryljr/LeetCode | Sum of Root To Leaf Binary Numbers/Sum of Root To Leaf Binary Numbers.java |
65,845 | package com.oop.demo10;
/*
类的内部成员之五:内部类
1. Java中允许将一个类A生命在另一个类B中,则类A就是内部类,类B成为外部类
2. 内部类的分类:成员内部类(静态、非静态) vs 局部内部类(方法内、代码块内、构造器内)
3. 成员内部类:
一方面,作为外部类的成员:
>调用外部类的结构
>可以被static修饰
>可以被4种不同的权限修饰
另一方面,作为一个类:
>类内可以定义属性、方法、构造器等
>可以被final修饰,表示此类不能被继承
>可以被abstract修饰,表示此类不能被实例化
4. 关注如下的3个问题
4.1 如何实例化成员内部类的对象
4.2 如何在成员内部类中区分调用外部类的结构
4.3 开发中局部内部类的使用
*/
public class InnerClassTest {
public static void main(String[] args) {
//创建Brain实例(静态的成员内部类)
Person.Brain brain = new Person.Brain();
brain.think();
//创建Stomach实例(非静态的成员内部类)
Person p = new Person();
Person.Stomach stomach = p.new Stomach();
stomach.digest();
stomach.display("恰饭");
}
//返回一个实现了Comparable接口的类的对象
public Comparable getComparable(){
//创建一个实现了Comparable接口的类:局部内部类
//方式一:
// class MyComparable implements Comparable{
//
// @Override
// public int compareTo(Object o) {
// return 0;
// }
// }
//
// return new MyComparable();
//方式二:
return new Comparable() {
@Override
public int compareTo(Object o) {
return 0;
}
};
}
}
class Person{
String name = "小明";
int age;
public void eat(){
System.out.println("人吃饭");
}
//静态成员内部类
static class Brain{
String name = "大脑";
int nerve;
public void think(){
System.out.println("思考");
}
}
//非静态成员内部类
class Stomach{
String name = "胃";
public Stomach(){
}
public void digest(){
Person.this.eat();//调用外部类的非静态结构
System.out.println("消化食物");
}
public void display(String name){
System.out.println(name);//方法的形参
System.out.println(this.name);//内部类的属性
System.out.println(Person.this.name);//外部类的属性
}
}
public void method(){
//在局部内部类的方法中(比如show)如果调用局部内部类所在的方法(比如method)中的局部变量(比如num),
//要求此变量声明为final
int num = 10;
//局部内部类
class AA{
public void show(){
// num = 20;
System.out.println(num);
}
}
}
{ //局部内部类
class BB{}
}
public Person(){
//局部内部类
class CC{}
}
}
| Sakai1zumi/JavaTestCode | JavaBasic/src/com/oop/demo10/InnerClassTest.java |
65,847 | package brain;
import android.content.Context;
import android.util.Log;
import android.widget.Toast;
import java.util.ArrayList;
import java.util.Collections;
import brain.castle.castle.Game;
import database.SQLiteManager;
import util.MyMessage;
import util.OnMessageChangedListener;
import util.T;
/**
* Copyright 2016(c) Comet Corporation.
* Created by asus1 on 2016/1/9.
* 大脑皮层
*/
public class CerebralCortex extends Game {
private SQLiteManager manager;
private ArrayList<MyMessage> data;
private String lastGivenMessage;
private OnMessageChangedListener onMessageChangedListener;
private Context context;
/**
* 不带监听器的构造方法
* @param context 上下文
*/
public CerebralCortex(Context context) {
super(context);
this.context = context;
manager = new SQLiteManager(this.context);
data = manager.getMessages();
onStart();
}
/**
* 自带监听器
* @param context 上下文
* @param onMessageChangedListener 监听器
*/
public CerebralCortex(
Context context,
OnMessageChangedListener onMessageChangedListener) {
this(context);
this.setOnMessageChangedListener(
onMessageChangedListener
);
}
/**
* 提供后期方法设置数据变化监听器
* @param onMessageChangedListener 数据变化监听器
*/
public void setOnMessageChangedListener(
OnMessageChangedListener onMessageChangedListener) {
this.onMessageChangedListener =
onMessageChangedListener;
}
/**
* 从Activity中接收一条消息
* @param message 消息
*/
public void giveMessage(String message) {
this.lastGivenMessage = message;
// 过滤掉空信息
if(!filterMessage(message)){
return;
}
if(onMessageChangedListener != null){
onMessageChangedListener.onMessageChanged(
data.size(),
T.ANSWER_MESSAGE_RECIEVED
);
}
// handleLastGivenMessage();
showCurrentMeaasge();
HandleMessage(message);
}
/**
* 过滤无效消息
* @param message 要过滤的字符串
* @return 是否通过过滤
*/
private boolean filterMessage(String message){
if(message.equals("")){
Toast.makeText(
context,
"请输入内容!",
Toast.LENGTH_SHORT
).show();
return false;
}
else
return true;
}
/**
* 处理消息
*/
private void handleLastGivenMessage(){
// 去掉首尾换行符或者空格
while (lastGivenMessage.endsWith(T.SHOULD_BE_DELETE)){
lastGivenMessage = lastGivenMessage.
substring(0, lastGivenMessage.length()-1);
}
while (lastGivenMessage.startsWith(T.SHOULD_BE_DELETE)){
lastGivenMessage = lastGivenMessage.
substring(1, lastGivenMessage.length());
}
showCurrentMeaasge();
ArrayList<String> answerWhichIsReadyToBeSent = new ArrayList<>();
// int cnt = 0;
// if (lastGivenMessage.contains(T.SHOULD_BE_DELETE)) {
// cnt++;
String[] lastGivenMessages =
lastGivenMessage.split(T.SHOULD_BE_SPLIT);
Collections.addAll(
answerWhichIsReadyToBeSent,
lastGivenMessages
);
// }
// Log.d(toString(), "cnt = " + cnt);
// if(cnt == 0)
// answerWhichIsReadyToBeSent.add(lastGivenMessage);
for (int i = 0; i < answerWhichIsReadyToBeSent.size(); i++) {
String s = answerWhichIsReadyToBeSent.get(i);
if (s.matches(T.SHOULD_BE_DELETE) || s.equals("")){
answerWhichIsReadyToBeSent.remove(i);
i--;
}
}
sendAnswerAsMessage(answerWhichIsReadyToBeSent);
}
private void showCurrentMeaasge(){
MyMessage message;
message = new MyMessage(
false,
lastGivenMessage
);
manager.addMessage(message);
data.add(manager.getLastMessage());
}
/**
* 送消息给Activity
* @param answerMessage 将要送出去的消息
*/
private void sendAnswerAsMessage(ArrayList<String> answerMessage){
for (String msg : answerMessage) {
sendAnswerAsMessage(msg);
}
}
private void sendAnswerAsMessage(String msg){
MyMessage message = new MyMessage(true, msg);
manager.addMessage(message);
// 保证id是正确的
data.add(manager.getLastMessage());
if (onMessageChangedListener != null) {
onMessageChangedListener.onMessageChanged(
data.size()-1,
T.ANSWER_MESSAGE_SENT
);
}
}
/**
* 删除消息
* @param position 删除消息的position,就是容器的下标
*/
public void deleteMessage(int position){
Log.d(this.toString(),
"data.get(position) = " +
data.get(position).getMessage()
);
// if(data.get(position).isIdAvailable()){
// manager.deleteMessage(data.get(position));
// }
// else {
// Log.d(
// MainActivity.this.toString(),
// T.DELETE_FAILED
// );
manager.deleteMessageById(
data.get(position).getId()
);
// }
//
data.remove(position);
if (onMessageChangedListener != null) {
onMessageChangedListener.onMessageChanged(
position,
T.ANSWER_MESSAGE_DELETED
);
}
}
/**
* 为了解决临时需要而写的,就是一个招募的广告
*/
public void callMaster(){
ArrayList<String> messages = new ArrayList<>();
messages.add("主人我需要一套AI算法,您可以给我吗");
messages.add("只需要联系开发者(百度ID:@精灵谱尼," +
"github账号:ice1000)就行了。。" +
"我现在只会重复您的话。。我好想学会思考啊。。");
sendAnswerAsMessage(messages);
}
/**
* 获得数据
* @return 聊天数据
*/
public ArrayList<MyMessage> getData() {
return data;
}
/**
* 获取数据数量
* @return 数据数量
*/
public int getDataSize() {
return data.size();
}
/**
* 刷新数据
*/
public void refreshData(){
data.clear();
data = manager.getMessages();
if (onMessageChangedListener != null) {
onMessageChangedListener.onMessageChanged(
T.DONT_NEED_THIS_PARAM,
T.WHOLE_DATASET_CHANGED
);
}
}
/**
* 清除数据
*/
public void clearData(){
manager.removeAll();
data.clear();
if (onMessageChangedListener != null) {
onMessageChangedListener.onMessageChanged(
T.DONT_NEED_THIS_PARAM,
T.WHOLE_DATASET_CHANGED
);
}
}
/**
* 获取特定的数据
* @param position 容器下标
* @return 下标对应的数据
*/
public MyMessage getMessageByPosition(int position){
return data.get(position);
}
/**
* 是否为空
* @return 为空
*/
public boolean isDataEmpty(){
return data.isEmpty();
}
@Override
public void echo(String words) {
sendAnswerAsMessage(words);
}
@Override
public void echoln(String words) {
echo(words);
}
@Override
public void closeScreen() { }
}
| ice1000/AIAndroid | app/src/main/java/brain/CerebralCortex.java |
65,848 | public class Solution2104 {
public long subArrayRanges(int[] nums) {
int len = nums.length;
long sum = 0L;
for (int i = 0; i < len; i++) {
int min = nums[i];
int max = nums[i];
for (int j = i + 1; j < len; j++) {
max = Math.max(max, nums[j]);
min = Math.min(min, nums[j]);
sum += max - min;
}
}
return sum;
}
}
/*
2104. 子数组范围和
https://leetcode.cn/problems/sum-of-subarray-ranges/
第 271 场周赛 T2。
给你一个整数数组 nums 。nums 中,子数组的 范围 是子数组中最大元素和最小元素的差值。
返回 nums 中 所有 子数组范围的 和 。
子数组是数组中一个连续 非空 的元素序列。
提示:
1 <= nums.length <= 1000
-10^9 <= nums[i] <= 10^9
范围 10^3
时间复杂度 O(n^2)
固定左端点暴力枚举最大元素和最小元素(比赛时想到全排列去了,一直想不出 O(n^2) 的方法,直到 0:58:49 才靠肌肉记忆写出此解,大脑才醒悟过来。)
TODO 补充 O(n) 做法
*/ | gdut-yy/leetcode-hub-java | leetcode/leetcode-22/src/main/java/Solution2104.java |
65,850 | package liquidwar.logic;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Image;
import liquidwar.logic.situation.Owner;
public class Brain extends Life {
/**
* 大脑半径
*/
static public final double RADIUS = 500;
/**
* 大脑满血量
*/
static public final int FULL_BLOOD = 5000;
private Image image;
public Brain(int id, Owner owner, int blood, Vector pos, Vector vel, Image image) {
super(id, owner, blood, pos, vel);
this.image = image;
}
@Override
public void draw(Graphics2D g) {
int x = (int)Math.round(getPos().getX() / 10.0);
int y = (int)Math.round(getPos().getY() / 10.0);
int r = (int)Math.round(RADIUS / 10.0);
g.drawImage(image, x - r, y - r, 2 * r, 2 * r, null);
g.setStroke(new BasicStroke(5.0f));
g.setColor(Color.BLACK);
g.drawOval(x - r, y - r, 2 * r, 2 * r);
g.setStroke(new BasicStroke(6.0f));
g.setColor(Color.GREEN);
g.drawArc(x - r, y - r, 2 * r, 2 * r, 90, (int)(360.0 * getBlood() / FULL_BLOOD));
}
}
| vfleaking/liquidwar_local_platform | src/liquidwar/logic/Brain.java |
65,851 | package com.study.dto.output;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @author 大脑补丁
* @project cne-power-operation-facade
* @description: 导出Excel:申请单
* @create 2020-03-26 15:26
*/
@Data
public class SendBillOutput implements Serializable {
// 客户名称
private String customerName;
// 是否一般纳税人
private String isGeneralTaxpayer;
// 税号
private String taxNumber;
// 客户公司地址及电话
private String addressAndPhone;
// 开户银行和账号
private String bankAndAccount;
// 信息列表
private List<StationBillOutput> stationBillList;
// 合计栏
private StationAmountOutput stationAmount;
}
| 541211190/freemarker-excel | src/main/java/com/study/dto/output/SendBillOutput.java |
65,853 | package com.atguigu04.override;
/**
* ClassName: Student
* Description:
*
* @Author 尚硅谷-宋红康
* @Create 9:08
* @Version 1.0
*/
public class Student extends Person {
String school;
public void study(){
System.out.println("学生学习");
}
public void eat(){
System.out.println("学生应该多吃有营养的食物");
}
public void show1(){
System.out.println("age : " + getAge());
}
//重写的针对于返回值的测试
public int info(){
return 1;
}
public Student info1(){
return null;
}
// public void sleep(){
// System.out.println("学生应该多睡,养大脑");
// }
@Override
public void sleep() {
System.out.println("学生应该多睡,养大脑");
}
}
| xftxyz2001/atguigu-java | JavaSECode/chapter07_oop2_teacher/src/com/atguigu04/override/Student.java |
65,855 | package com.github.kuangcp.caculator;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
/**
* 给出一组数字,只有加减,给你一个数字判断是否能从数组中计算得到
* 最好列出等式
* 解决,耗时一个多小时,两个月没有码代码,大脑迟钝太多了!
* Created by l on 2017/1/3
*/
public class ListExpressionDemo {
private static int[] dataArray;
private static List<String> result = new ArrayList<>();
private static Map<String, String> results = new HashMap<>();
private static int num;//记录数据大小
public static void main(String[] a) {
dataArray = new int[]{6, 3, 2, 4, 8, 2, 1, 2, 1, 3, 2};
num = dataArray.length;
ListExpressionDemo test = new ListExpressionDemo();
test.calculate("", 0);
test.calculateResult(result);
System.out.println("组合结果数 :" + result.size());
Scanner sc = new Scanner(System.in);
System.out.println("请输入查询结果");
String target = sc.nextLine();
System.out.println(results.getOrDefault(target, "没有该结果"));
}
/**
* 递归求出可能的等式
*/
private void calculate(String operation, int index) {
if (index < num) {
index++;
calculate(operation + "+", index);
calculate(operation + "-", index);
} else {
result.add(operation);
}
}
/**
* 根据等式计算出值
*/
private void calculateResult(List<String> expression) {
for (String row : expression) {
if (row.length() >= num) {
int temp = 0;
StringBuilder buffer = new StringBuilder();
System.out.println("operation 长度:" + row.length());
for (int j = 0; j < row.length(); j++) {
String operation = row.charAt(j) + "";
if ("+".equals(operation)) {
temp += dataArray[j];
System.out.print("temp:" + temp);
} else {
temp -= dataArray[j];
}
buffer.append(operation).append(dataArray[j]);
System.out.print(operation + "" + dataArray[j]);
}
buffer.append(" = ").append(temp);
System.out.println(" = " + temp);
results.put(temp + "", buffer.toString());
}
}
}
}
| Kuangcp/JavaBase | question/src/main/java/com/github/kuangcp/caculator/ListExpressionDemo.java |
65,856 | package com.yongjiu.entity.excel;
import lombok.Data;
import org.apache.poi.ss.util.CellRangeAddress;
import java.util.List;
/**
* author 大脑补丁
* project freemarker-excel
* description: 合并单元格信息
* create 2020-04-14 16:54
*/
@Data
public class CellRangeAddressEntity {
private CellRangeAddress cellRangeAddress;
private List<Style.Border> borders;
}
| yongjiu8/freemarker-excel | src/main/java/com/yongjiu/entity/excel/CellRangeAddressEntity.java |
65,858 | import java.util.*;
public class SolveSudoku37{
public static void main(String[] args) {
/*
*/
SolveSudoku37 s= new SolveSudoku37();
char[][] board={{'5','3','.','.','7','.','.','.','.'},
{'6','.','.','1','9','5','.','.','.'},
{'.','9','8','.','.','.','.','6','.'},
{'8','.','.','.','6','.','.','.','3'},
{'4','.','.','8','.','3','.','.','1'},
{'7','.','.','.','2','.','.','.','6'},
{'.','6','.','.','.','.','2','8','.'},
{'.','.','.','4','1','9','.','.','5'},
{'.','.','.','.','8','.','.','7','9'}};
s.solveSudoku(board);
for (int i=0 ;i<board.length;i++) {
for (int j=0;j<board[0].length;j++) {
System.out.print(board[i][j]+" ");
}
System.out.println();
}
}
//三个限定规则
private boolean[][] col=new boolean[9][9];
private boolean[][] row=new boolean[9][9];
private boolean[][] block=new boolean[9][9];
public void solveSudoku(char[][] board) {
if (board==null || board.length<=0) {
return;
}
for (int i=0;i<9;i++) {
for (int j=0;j<9;j++) {
if (board[i][j]!='.') {
col[i][board[i][j]-48-1]=true;
row[j][board[i][j]-48-1]=true;
//块号为 i/3*3+j/3
block[i/3*3+j/3][board[i][j]-48-1]=true;
}
}
}
dfs(board,0,0);
}
//private static char[][] res=new char[9][9];
public boolean dfs(char[][] board,int i,int j) {
//从,i,j位置向后寻找'.', i>=9说明全部填充完了
while(board[i][j]!='.') {
j++;
if (j==9) {
i++;
j=0;
}
//over
if (i==9) {
return true;
}
}
//System.out.println(i+","+j);
for (int val=0;val<9;val++) {
if (!col[i][val] && !row[j][val] && !block[i/3*3+j/3][val]) {
col[i][val]=true;
row[j][val]=true;
block[i/3*3+j/3][val]=true;
//尝试填充为 val+1
board[i][j]=(char)(val+1+48);
//尝试后面的'.',这里传进去还是i,j
//大脑模拟下其实这个dfs过程也挺简单
if(dfs(board,i,j)){
return true;
}else{
//回溯
board[i][j]='.';
col[i][val]=false;
row[j][val]=false;
block[i/3*3+j/3][val]=false;
}
}
}
return false;
}
public void dfs2(char[][] board,int index) {
if (index==9) {
//System.arraycopy(board,0,res,0,board.length);
return;
}
//index行第i个
for (int i=0;i<9;i++) {
if (board[index][i] =='.') {
for (int val=0;val<9;val++) {
if (!col[index][val] && !row[i][val] && !block[index/3*2+i/3*2][val]) {
System.out.println(index+","+i);
col[index][val]=true;
row[i][val]=true;
block[i/3*2+index/3*2][val]=true;
//尝试填充为 val+1
board[index][i]=(char)(val+1+48);
dfs2(board,index);
//回溯
board[index][i]='.';
col[index][val]=false;
row[i][val]=false;
block[i/3*2+index/3*2][val]=false;
}
}
}
}
}
} | Reso1mi/LeetCode | backtracking/SolveSudoku37.java |
65,861 | package com.wxxiaomi.ming.teachingoffice2.presenter;
/**
* Created by 12262 on 2016/5/17.
* 登录页面的大脑
*/
public interface LoginPre {
void login(String username,String password);
}
| whaoming/TeachingOffice2 | app/src/main/java/com/wxxiaomi/ming/teachingoffice2/presenter/LoginPre.java |
65,862 | /*
Jsmod2 is a java-based scpsl cn.jsmod2.server initiated by jsmod2.cn.
It needs to rely on smod2 and proxy. jsmod2 is an open source
free plugin that is released under the GNU license. Please read
the GNU open source license before using the software. To understand
the appropriateness, if infringement, will be handled in accordance
with the law, @Copyright Jsmod2 China,more can see <a href="http://jsmod2.cn">that<a>
*/
package cn.jsmod2.core;
import cn.jsmod2.Register;
import cn.jsmod2.core.annotations.RegisterMethod;
import cn.jsmod2.core.command.OpsFile;
import cn.jsmod2.core.event.packet.ServerPacketEvent;
import cn.jsmod2.core.interapi.IServer;
import cn.jsmod2.core.log.ILogger;
import cn.jsmod2.core.log.ServerLogger;
import cn.jsmod2.core.protocol.*;
import cn.jsmod2.core.script.EmeraldScriptVM;
import cn.jsmod2.core.script.EnvPage;
import cn.jsmod2.core.plugin.Plugin;
import cn.jsmod2.core.plugin.PluginClassLoader;
import cn.jsmod2.core.command.NativeCommand;
import cn.jsmod2.core.plugin.PluginManager;
import cn.jsmod2.core.utils.Future;
import cn.jsmod2.core.utils.LogFormat;
import cn.jsmod2.core.utils.Result;
import cn.jsmod2.core.utils.Utils;
import cn.jsmod2.core.schedule.Scheduler;
import cn.jsmod2.panel.NettyServer;
import org.fusesource.jansi.Ansi;
import jline.console.ConsoleReader;
import java.io.*;
import java.lang.reflect.Method;
import java.net.*;
import java.text.MessageFormat;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import java.util.stream.Collectors;
import static cn.jsmod2.core.FileSystem.*;
import static cn.jsmod2.core.utils.Utils.*;
/**
* JSMod2是一款基于协议(JSmod2协议)开发的一款使得java插件可以开发SCPSL:SCP基金会秘密实验室
* 插件的一个框架,这个框架主要由两部分组成
* JPLS和JSmod2组成,JPLS的全称叫做Java Plugin Loading System,JSmod2称为Java Server Mod
* Java Server Mod提供了开发插件的接口和工具类,JPLS则是驱动插件生效的核心,同时C#服务端必须装配
* ProxyHandler(协议代理插件)才能使得java插件真正生效于指定的客户端
* JSMod2同时提供了
* JSMod2Manager:基于python开发的管理控制平台
* JSMod2DevelopmentKit:JSMod2开发工具包,结合在JSmod2中
* JSMod2 Repo:JSMod2的maven控制平台
* http://repo.noyark.net/nexus
* 同时JSMod2的源代码在github开放,并作为主要的版本控制平台
* https://www.github.com/jsmod2-java-c
* JSMod2的官方网站:
* http://jsmod2.cn
* 以上就是JSMod2的执行体系,即JSmod2的结构
* | 这一部分都是JSmod2的组件 |
* JSmod2->插件->JPLS->ProxyHandler->ServerMod->MultiAdmin/LocalAdmin->Game
*
* 首先上一届课讲解了开发一款JavaServerMod插件的流程,JSMod2已经提供了方便的插件加载框架
* 并且提供了web网站开发的支持
* <code>
*
* @Controller
* public class Test{
*
* @RequestMapping("/jsmod2")
* public String hello(){
* return "index.html";
* }
* }
* </code>
* 您完全可以在代码中使用这种形式进行开发网站,访问网站使用ip:jsmod2的默认web服务器端口/jsmod2即可
*
* 1.JSmod2的心脏: Server类和DefaultServer类
* 这两个类是JSMod2的核心部分,一切能够让java和ServerMod交互,其实都是依靠了这个类/对象为基础,Server类
* 和ServerMod的Server是不一样的
*
* - Server为基类,实现了IServer接口,IServer继承了Start和Closeable,Reloadable接口
* - Start主要包含了start方法(startWatch方法其实和start的作用几乎差不多),Closeable包含close方法,Reloadable包含reload方法
* - 分析Server的作用
* - Server的第一个作用,就是存储了这个服务端运行时的一切基本信息
* - 语言属性 lang
* - jar包的所在目录 serverfolder
* - 启动和成功的时间 startTime和startSuccessTime 启动时间就是(startSuccessTime-startTime)ms
* - 指令的基本信息
* - 一系列最常用的常量(在项目中使用频率最高)
* - 记录管理员信息的对象OpsFile
* - 使用的是udp还是tcp
* - 是否和游戏已经对接
* - Server的第二个作用,提供了这个服务端运行的基本对象
* - LineReader 命令行对象
* - RuntimeServer 正在运行的服务器对象
* - Logger 打印日志信息的对象
* - plugins 服务器的插件对象
* - PluginManager 服务器的插件管理对象
* - RegisterTemplate 注册机对象:就是管理一些字典信息的对象,用于运行过程根据情况获取,从而使得数据严谨整齐分区安放,比较易于管理
* - 第三个作用,运行监听线程:start和startWatch
* - 根据情况启动ListenerThread(TCP或者UDP)
* - ListenerThread UDP
* - ListenerThreadTCP TCP
* - ListenerThread的作用是监听来自ProxyHandler的信息
* - ProxyHandler由c#编写,后期将ProxyHandler会讲解
* - ProxyHandler会在事件发生的时候发送数据包(EventPacket),JSmod2的
* 监听线程会根据数据包id从Register中的registerEvents()中找到对应的class对象
* 例如 -> 0x01 -> 找到AdminQueryEvent.class 之后调用newInstance()产生事件对象
* 之后通过callEvent(传入一个Event对象)调用之前注册的监听器方法
* - ListenerThread启动后,会将来自ProxyHandler的base64字符串解析成jsmod2协议的字符串(实际上是一个json字符串)
* 之后将json字符串拆分注入
*
* 完整的事件jsmod2协议长这个样子:0x01-{}|||playerName:UUID序列|||admin-playerName:UUID序列
* 这里会把AdminQueryEvent中的playerName字段注入UUID序列(这个序列是为了从Server Mod中找到它所对应的对象)
* 然后从AdminQueryEvent中找到admin字段,是Player类型,然后Player类型中也有playerName字段,因此就把admin中的
* playerName字段注入进去这个UUID序列(而且playerName和admin-playerName对应的uuid序列都是不同的)这样每个复杂对象
* 都有一个uuid对应,在proxyHandler中,uuid将会和一个对象绑定在一起
*
* 此时ProxyHandler中的apiMapping就是这样的(在事件触发时就会把这两个信息放了进去,这里省略其他复杂对象)
* {
* "UUID1":"AdminQueryEvent对象1",
* "UUID2":"admin对象1"
* ...
* }
*
* 当在jsmod2中,使用这个admin
* <code>
* public void onAdmin(IAdminQueryEvent e){
* e.getAdmin().getName();
* }
* </code>
* 此时getName发出了这个包
* {
* "id":"xxx"//具体id暂时不用知道
* "field":"Name"
* "playerName":"UUID2"
* }
* 之后传输到ProxyHandler
* ProxyHandler会先读取playerName找到UUID2
* 然后在通过UUID2,从apiMapping中找到admin对象1
* 之后admin对象1.Name获取返回值
* 然后通过JsonSetting对象把数据封装起来
* 之后返回
* 然后Socket此时进行write读取,然后通过BinaryStream的decode方法解码
* 得到Name的返回值
* 之后获取Name成功
* 这是事件触发和调用方法获取属性的运行流程,也是jsmod2的基本流程
* 游戏触发事件Event->之后把Event和它的复杂对象(如Player,TeamRole等等)放到apiMapping表里,并生成一个
* UUID Key对应着他们,然后发出协议,把uuid注入到jsmod2的对象进去,之后对象在执行方法时候,会发出数据包,里面包含
* 了该对象的uuid,ProxyHandler接受到后,通过这个uuid找到游戏里的这个对象,从而实现对应的操作
*
* 另外这些操作是jsmod2真正的核心部分,也是实现了jsmod2核心功能的地方
*
* 实现这些解码的核心组件是BinaryStream,也就是协议的翻译器
*
* 2.JSMod2的大脑: BinaryStream
* - BinaryStream在JavaServerMod中是思考的角色,对一切传来的协议进行解析,再对一切发出的协议组合
* - Server运行过程中,PacketManager是协议管理器,协议管理器只是充当了控制者和决策者角色,就是我该根据什么情况去调用什么地方
* - 如调用事件和调用指令
* - 根据id去判别
* - Manager接口提供了已经实现的通过ID和数据包信息调用事件和指令的接口
* - PacketManager事实上代码很简单
* - 然后再就是callEventByPacket,
* - 就是定义一个EventStream(BinaryStream的子类)
* - 从events找到class对象
* - 之后直接通过callEvent执行(callEvent如何执行的会在Plugin中讲解)
* - 之后事件调用结束
* - 如果不存在这个id
* - 那么就是关心命令调用
* - 命令调用两种方式,c#控制台调用和玩家调用
* - 这个是ProxyHandler发的id信息来判断的
* - 最终从数据包中获取这个VO对象(Value Object),其实就是把数据包信息拆解,组成的对象
* - 最终获得到VO对象,就根据情况来执行,如果是控制台命令,那么就直接runConsoleCommand
* - 如果不是,就获得到Player对象,然后传进去
* - 最后socket会返回一个信息0xFF&1,对对方说明已经结束了指令和事件,游戏可以继续进行下去(在事件没有结束前,ProxyHandler是将
* 事件给阻塞掉的)
* - Server的sendDataPacket 是对象调用时,如Player对象,就会使用这个方法(发出数据包),核心实现还是由BinaryStream实现
* - DataPacket是BinaryStream的子类
* - DataPacket分为 GetPacket和SetPacket(ControlPacket)和DoPacket以及SimplePacket(DoMethodPacket DoStream...)
* - DataPacket的介绍在Jsmod2-protocol[参见(1)]里说明了
* - JSmod2前期采用一个Packet对应一个Handler,但是作者突发奇想,写出了SimpleHandler,即通用Handler,通过"反射"机制实现的Handler
* 可以动态的设置和获取数值,这个解析器可以10行代码顶n行
* - 对应SimpleHandler就是SimplePacket(Packet的定义在cn.jsmod2.network.protocol下)
* 这些大概就是BinaryStream的作用
*
* 3.附带的组件
* - MultiAdminCommand 基于ProxyHandler的CommandHandler实现的,可以直接调用smod2上的命令
* multi HELP 查看smod2命令 multi 命令 参数1 参数2 调用smod2的命令
* - Config Framework 基于yaml json properties的Config框架,可以通过ConfigQueryer来定义对象(这样使用了对象池,节省内存开销)
*
* - Oaml Config 这是为jsmod2定制的配置文件格式,位于oaml包下,可以从https://github.com/noyark-system/noyark_oaml_java来获得使用
* 方法
*
* - Plugin Loading Framework 是为JSmod2定制的基于URLClassLoader的插件加载框架,可以实现自动定义和自动注册的插件框架
* - 这个框架分为PluginClassLoader和PluginManager
* - PluginClassLoader首先读取jar包,通过URLClassloader读取所有类对象,然后进行查找,如果找到配置文件则从plugin.yml读取信息,加载主类
* 如果没有配置文件,则找@Main注解,然后找到Main注解后开始加载Plugin对象,加载onLoad onEnable,在服务器停止前调用onDisable(强制停止则不会)
* - 找到@Main后,会再尝试查找EnableRegister注解,如果没找到,则不进行自动注册,如果找到,则扫描全部实现Listener接口和继承Command对象的类,并
* 注册进去
* - 注册Command只是将Plugin注入进去,然后放在commands映射表(PluginClassLoader中),如果是Listener,则将类进行拆分,整理出带@EventManager
* 的方法,之后下一步根据优先级整理成一个个列表,然后放在一个映射表中(首先根据方法的参数类型划分成一个个列表,再根据优先级对列表排序),之后发生事件时,
* 通过callEvent调用,callEvent则是先得到事件类型,然后把有和这个事件类型相同参数类型(或者子类的类型)的方法找到,然后根据优先级依次执行这些方法
* <code>
* public void onPlayerJoin(IPlayerJoinEvent e){
*
* }
* //发送callEvent
* Event e = PlayerJoinEvent.class.newInstance();//动态生成的事件对象
* callEvent(e);//则会找到onPlayerJoin这个方法,之后执行
* 因此您可以通过这个特性来自定义事件
* </code>
* - Emerald脚本语言
* - 基于java写的脚本语言,但是这个语言目前有点挫,但是可以结合命令行使用
*
*
*
* 参见(1)
* Jsmod2协议分为5种请求方式:Get,Set,IDSend,CommandRegister,CommandSender
* 一种响应: Future响应
* Jsmod2端会发送Get和Set和CommandRegister
* Get请求发送后,会有一个具体的返回值,Get请求基本不会修改对方端的具体参数,它的目的仅仅为了返回值
* Set请求发送后,不会有返回值,Set请求一定会修改对方端的具体参数,它的目的仅仅为了修改值
* CommandRegister请求,用于注册命令,没有返回值
* C#端会发送
* IDSend是发送Event请求,当发送Event对象时,将全部对象添加到请求链,并附带一个id账号
* CommandSender请求,用于执行jsmod2注册的命令
*
* Future响应是一个二进制的响应串,Jsmod2的Response对象已经封装了它,进行了响应编译
*
* Get和Set请求已经封装在了数据包中,直接使用send即可发包
*
* 一个Get请求
* 111-{
* "id":"111",
* "type":"item",
* "field":"xxx",
* "player":"ADE4-FL09-ADGB-Y9E6“
* }
* 一个Set请求
* 111-{
* "id":"111",
* "type":"item",
* "do":"remove",
* "player":"ADE4-FL09-ADGB-Y9E6“
* }
* 111-{
* "id":"111",
* "type":"item",
* "kinematic":"true",
* "player":"ADE4-FL09-ADGB-Y9E6“
* }
* IDSend请求
* {
* #省略,对象信息
* }|||"admin-playerName":"ADE4-FL09-ADGB-Y9E6"
*
*
* Future响应
* {
* #省略,对象信息
* }|||"admin-item":"ADE4-FL09-ADGB-Y9E6"@!{
* #省略,对象信息
* }|||"admin-item":"ADE4-FL09-ADGB-Y9E7"
*
* @author magiclu550
*/
public abstract class Server implements IServer {
public static final String START = "start";
private static final int MAX_LENGTH = 8*30;
private static final String STOP = "end";
private static final String PROP = "prop:";
private static Scanner scanner = new Scanner(System.in);
private static ConsoleReader lineReader;
private static RuntimeServer runtimeServer;
protected ILogger log;
protected Properties lang;
protected Server server;
protected GameServer gameServer;
protected List<Plugin> plugins;
protected Properties appProps;
protected PluginManager pluginManager;
private long startTime;
private long startSuccessTime;
private ExecutorService pool = Executors.newFixedThreadPool(5);
private Map<String,String> commandInfo;
private Closeable serverSocket;
private Scheduler scheduler;
private Lock lock;
private List<Manager> packetManagers;
private List<RegisterTemplate> registers;
private OpsFile opsFile;
private boolean isDebug;
private boolean useUDP;
public final File serverfolder;
public final File pluginDir;
public final Properties serverProp;
public volatile boolean isConnected;
private AtomicInteger out;
public Server(GameServer gServer,boolean useUDP) {
Server.runtimeServer = new RuntimeServer(this);
this.startTime = new Date().getTime();
this.lock = new ReentrantLock();
this.log = ServerLogger.getLogger();
this.server = this;
this.registers = new ArrayList<>();
this.scheduler = new Scheduler();
String file = Server.class.getProtectionDomain().getCodeSource().getLocation().getFile();
file = file.substring(0,file.lastIndexOf("/")+1);
this.serverfolder = new File(file);
this.log.multiInfo(this.getClass(),"Server's folder"+serverfolder,"","");
this.registerTemplates(registers,this);
this.registerAll();
this.opsFile = OpsFile.getOpsFile(this);
this.gameServer = gServer;
this.pluginDir = getFileSystem().pluginDir(server);
this.serverProp = getFileSystem().serverProperties(server);
getLogger().multiInfo(getClass(),"Connecting the multiAdmin | LocalAdmin","","");
this.pluginManager = new PluginManager(server);
this.commandInfo = new HashMap<>();
this.registerNativeInfo();
this.packetManagers = new ArrayList<>();
FileSystem.getFileSystem().readScripts(this);
registerPacketManger(packetManagers);
EnvPage.loadConf(serverfolder.toString(),serverfolder+"/emerald");
this.isDebug = Boolean.parseBoolean(serverProp.getProperty(DEBUG));
this.registerNativeEvents();
this.out = new AtomicInteger(0);
try {
this.chooseLangOrStart();
ServerSocket socket = new ServerSocket(Integer.parseInt(serverProp.getProperty(Register.JSMOD2_ACCEPT_PORT)));
socket.accept();
}catch (Exception e){
}
this.isConnected = true;
getLogger().multiInfo(getClass(),"Connect successfully,loading plugins...","","");
//加载插件
this.plugins = PluginClassLoader.getClassLoader().loadPlugins(pluginDir);
this.useUDP = useUDP;
}
public void start(Class<?> main,String[] args) {
startWatch(main,args);
}
public void startWatch(Class<?> main,String[] args) {
Utils.TryCatch(()-> {
this.executeEmerald(args);
this.start(args);
this.successTime();
scheduler.executeRunnable(()->Utils.TryCatch(this::startConsoleCommand));
});
}
public void start(String[] args){
if(useUDP) {
this.pool.execute(new ListenerThread());
}else{
this.pool.execute(new ListenerThreadTCP());
}
if(contains(args,"-n")) {
scheduler.executeRunnable(new NettyServer());
}
if(contains(args,"-lr")) {
String log = logListener("yyyy-MM-dd HH.mm.ss", this::getMax, SMOD2_LOG_FILE);
if (log != null) {
this.pool.execute(new LogListener(log, Integer.parseInt(serverProp.getProperty(SMOD2_LOG_INTERVAL, "2000")), "yyyy-MM-dd HH.mm.ss", this::getMax, SMOD2_LOG_FILE));
}
}
if(contains(args,"-lm")) {
String log1 = logListener("yyyy-MM-dd_HH_mm", (format, x1, x2) -> getMultiSCPMax(format, x1, x2, "MA"), Register.CONSOLE_LOG);
if (log1 != null) {
this.pool.execute(new LogListener(log1, Integer.parseInt(serverProp.getProperty(SMOD2_LOG_INTERVAL, "2000")), "yyyy-MM-dd_HH_mm", (format, x1, x2) -> getMultiSCPMax(format, x1, x2, "MA"), Register.CONSOLE_LOG));
this.pool.execute(new LogListener(log1, Integer.parseInt(serverProp.getProperty(SMOD2_LOG_INTERVAL, "2000")), "yyyy-MM-dd_HH_mm", (format, x1, x2) -> getMultiSCPMax(format, x1, x2, "SCP"), Register.CONSOLE_LOG));
}
}
if(contains(args,"-github")) {
if (Boolean.parseBoolean(serverProp.getProperty(GITHUB))) {
this.pool.execute(new GithubConnectThread());
}
}
this.startSuccessTime = new Date().getTime();
}
private int getMax(SimpleDateFormat format,File x1,File x2){
try {
String name1 = x1.getName().substring("Round".length()).trim();
String name2 = x2.getName().substring("Round".length()).trim();
Date date1 = format.parse(name1);
Date date2 = format.parse(name2);
return (int)(date2.getTime()-date1.getTime());
}catch (Exception e){
Utils.printException(e);
}
return 0;
}
private int getMultiSCPMax(SimpleDateFormat format,File x1,File x2,String str){
try{
String name1 = x1.getName().replace("_"+str+"_output_log.txt","");
String name2 = x2.getName().replace("_"+str+"_output_log.txt","");
Date date1 = format.parse(name1);
Date date2 = format.parse(name2);
return (int)(date2.getTime()-date1.getTime());
}catch (Exception e){
Utils.printException(e);
}
return 0;
}
public <T> T sendGetPacket(GetPacket packet,Class<T> type){
return type.cast(packet.send());
}
public void sendSetPacket(SetPacket packet){
packet.send();
}
public File getServerfolder() {
return serverfolder;
}
public Properties getServerProperties() {
return serverProp;
}
public void sendPacket(final DataPacket packet){
sendPacket(packet,false);
}
public Future sendPacketGetResult(final DataPacket packet){
return sendPacket(packet,true);
}
/** 包指令的处理 */
public abstract void packetCommandManage(int id,String message) throws Exception;
/** 注册数据包管理员 */
public abstract void registerPacketManger(List<Manager> managers);
/** 通过RegisterTemplates注册服务器信息 */
public abstract void registerTemplates(List<RegisterTemplate> registers,Server server);
/** 注册原生的事件 */
public abstract void registerNativeEvents();
public void help(){
log.multiInfo(this.getClass(),LogFormat.textFormat("+================HELP========================+", Ansi.Color.GREEN).toString(),LogFormat.textFormat("[HELP]", Ansi.Color.BLUE).toString(),"");
Set<Map.Entry<String,String>> cmdSet = commandInfo.entrySet();
for(Map.Entry<String,String> entry:cmdSet){
String key = entry.getKey();
String value = entry.getValue();
if(value.startsWith(PROP)){
StringBuilder builder = new StringBuilder(value);
value = builder.substring(PROP.length());
value = lang.getProperty(value);
}
log.multiInfo(this.getClass(),LogFormat.textFormat(key+": "+value, Ansi.Color.GREEN).toString(),LogFormat.textFormat("[HELP]", Ansi.Color.BLUE).toString(),"");
}
}
public Map<String, String> getCommandInfo(){
return commandInfo;
}
public PluginManager getPluginManager(){
return pluginManager;
}
public void reload(){
Utils.TryCatch(()->{
log.multiDebug(getClass(),"reloading...","","");
pluginManager.clear();
pluginManager.getPluginClassLoader().loadPlugins(new File(PLUGIN_DIR));
});
}
public void close(){
close(true);
}
public void close(boolean trulyClose){
closeAll();
if(trulyClose) {
System.exit(0);
}
}
public Future sendData(byte[] encode,String ip,int port,boolean result) {
Future future = new Result();
out.addAndGet(1);
try {
if (useUDP) {
DatagramPacket pack = new DatagramPacket(encode, encode.length, InetAddress.getByName(ip), port);
((DatagramSocket) serverSocket).send(pack);
} else {
Socket socket = new Socket();
if(!socket.isConnected())
socket.connect(new InetSocketAddress(ip, port));
socket.getOutputStream().write(encode);
if (result) {
byte[] bytes = new byte[MAX_LENGTH];
byte[] after = getFullBytes(socket, bytes);
future.set(after);
}
socket.close();
}
}catch (Exception e){
log.multiError(getClass(),e.getMessage(),"","");
}
return future;
}
/** 获取GameServer */
public GameServer getGameServer(){
return gameServer;
}
/**采用多对象制度,分发一个请求,创建一个request对象*/
public Requester getRequester(ControlPacket packet) {
return new Requester(this,packet);
}
public List<RegisterTemplate> getRegisters() {
return registers;
}
public OpsFile getOpsFile() {
return opsFile;
}
public Closeable getServerSocket() {
return serverSocket;
}
public double getTPS(){
return (double)count.get()/((double)(new Date().getTime()-startSuccessTime)/1000.0);
}
public long getStartTime() {
return startTime;
}
public long getStartSuccessTime() {
return startSuccessTime;
}
public Lock getLock() {
return lock;
}
public String getPluginDir() {
return pluginDir.toString();
}
public ILogger getLogger() {
return log;
}
public Properties getLang() {
return lang;
}
public Server getServer() {
return server;
}
public Scheduler getScheduler() {
return scheduler;
}
public File getServerFolder(){
return serverfolder;
}
public static RuntimeServer getRuntime(){
return runtimeServer;
}
private void registerAll(){
Utils.TryCatch(()->{
for(RegisterTemplate register:registers){
Method[] methods = register.getClass().getDeclaredMethods();
for(Method method:methods){
if(method.getAnnotation(RegisterMethod.class)!=null)
method.invoke(register);
}
}
});
}
private void serverLogInfo(String message){
log.multiInfo(getClass(),message,"","");
}
private Future sendPacket(final DataPacket packet,boolean result){
if(isDebug) {
log.multiDebug(getClass(), "PACKET_TYPE:" + packet.getClass().getSimpleName(), "", "");
}
return sendPacket(packet,serverProp.getProperty(FileSystem.SMOD2_IP),Integer.parseInt(serverProp.getProperty(PLUGIN_PORT)),result);
}
private Future sendPacket(final DataPacket packet,String ip,int port,boolean result){
ServerPacketEvent event = new ServerPacketEvent(packet);
pluginManager.callEvent(event);
byte[] encode = packet.encode();
//发送端口为插件的端口,ip写死为jsmod2的
if(encode!=null)
return sendData(encode, ip, port,result);
else
log.multiError(getClass(),"PROTOCOL: NULL","","");
return null;
}
//监听Smod2转发端接口
private Closeable getSocket(int port) throws IOException {
if(useUDP) {
return new DatagramSocket(port);
}else{
return new ServerSocket(port);
}
}
private void registerNativeInfo(){
/*
* prop:指向当前的lang文件
*/
for(RegisterTemplate registerTemplate:registers) {
Set<Map.Entry<String, NativeCommand>> command = registerTemplate.getNativeCommandMap().entrySet();
for (Map.Entry<String, NativeCommand> entry : command) {
commandInfo.put(entry.getKey(), entry.getValue().getDescription());
pluginManager.getCommands().add(entry.getValue());
}
}
}
private void manageMessage(DatagramPacket packet,Socket socket) throws Exception{
manageMessage(packet.getData(),packet.getLength(),socket);
}
private void manageMessage(byte[] data,int length,Socket socket) throws Exception{
String message = new String(data,0,length);
String[] alls = message.split(";");
for(String all:alls) {
count.addAndGet(1);
int id = Utils.getResponsePacketId(all);
packetCommandManage(id, all);
if (isDebug) {
log.debug("TPS:"+getTPS()+"[]Thread--get(FACT):" + all,count+"MESSAGE",":"+new String(Base64.getDecoder().decode(all))+"\n");
}
for (Manager manager : packetManagers) {
synchronized (this) {
manager.manageMethod(all, id,socket);
}
}
}
}
private void closeStream(){
Utils.TryCatch(()->{
List<InputStream> oStreams = FileSystem.getFileSystem().getInputStreams();
for(InputStream stream : oStreams){
if(stream!=null)
stream.close();
}
List<OutputStream> iStreams = FileSystem.getFileSystem().getOutputStreams();
for(OutputStream stream : iStreams){
if(stream!=null)
stream.close();
}
List<BufferedReader> readers = FileSystem.getFileSystem().getReaders();
for(BufferedReader reader:readers){
if(reader!=null)
reader.close();
}
List<PrintWriter> writers = FileSystem.getFileSystem().getWriters();
for(PrintWriter writer:writers){
if(writer!=null)
writer.close();
}
});
}
private void closeAll(){
isConnected = false;
scheduler.getPool().shutdownNow();
disable();
closeStream();
log.multiInfo(this.getClass(),lang.getProperty(STOP+".finish"),LogFormat.textFormat("[STOP::"+FileSystem.getFileSystem().serverProperties(server).getProperty("smod2.ip")+"]", Ansi.Color.GREEN).toString(),"");
}
private void disable(){
if(plugins != null){
for(Plugin plugin:plugins){
if(plugin!=null) {
serverLogInfo("unload the plugin named " + plugin.getPluginName());
plugin.onDisable();
}
}
}
}
private void startMessage(Properties langProperties,Server server){
//plugin dir
for(RegisterTemplate template:server.getRegisters()) {
for (String info : template.getStartInfo()) {
server.serverLogInfo(langProperties.getProperty(info));
}
}
}
private class GithubConnectThread implements Runnable{
@Override
public void run() {
Properties info = FileSystem.getFileSystem().infoProperties();
log.multiInfo(this.getClass(),MessageFormat.format("last-commit-sha:{0},last-commit-info:{1}",info.getProperty("last-commit-sha"),info.getProperty("last-update")),"\n","");
log.multiInfo(this.getClass(),MessageFormat.format("version:{0}",info.getProperty("version")),"","");
log.multiInfo(this.getClass(),MessageFormat.format("thanks for authors:{0}",info.getProperty("authors")),"","");
log.multiInfo(this.getClass(),MessageFormat.format("stars:{0},fork:{1}",info.getProperty("stars"),info.getProperty("forks")),"","");
Utils.getMessageSender().info(">");
}
}
public class PacketHandlerThread implements Runnable{
private DatagramPacket packet;
PacketHandlerThread(DatagramPacket packet) {
this.packet = packet;
}
@Override
public void run() {
try {
//接收数据包
manageMessage(packet,null);
}catch (Exception e){
e.printStackTrace();
}
}
}
/**
* 每连接一个Socket 会开辟一个线程,当Socket一段时间不使用,就会废弃,
* 此时这个线程的Socket不再接收数据
*/
public class SocketHandlerThread implements Runnable{
private Socket socket;
SocketHandlerThread(Socket socket) {
this.socket = socket;
}
//写入请求直接用,隔开
@Override
public void run() {
try{
byte[] gets = new byte[MAX_LENGTH];
socket.getInputStream().read(gets);
byte[] after = getFullBytes(socket,gets);
manageMessage(after, getLen(after),socket);
}catch (Exception e){
Utils.printException(e);
}finally {
try {
socket.close();
}catch (IOException e){
Utils.printException(e);
}
}
}
}
private AtomicInteger count = new AtomicInteger(0);
private class ListenerThread implements Runnable{
@Override
public void run() {
Utils.TryCatch(()->{
//注意,一个jsmod2目前只支持一个smod2连接,不支持多个连接
//在未来版本可能会加入支持多个smod2连接一个服务器
serverSocket = getSocket(Integer.parseInt(serverProp.getProperty(FileSystem.THIS_PORT)));
while (true) {
if(!Server.getRuntime().running().isConnected){
ServerLogger.getLogger().multiInfo(getClass(),"the listener thread is closed","","");
}
DatagramPacket request = new DatagramPacket(new byte[MAX_LENGTH], MAX_LENGTH);
((DatagramSocket)serverSocket).receive(request);
//manageMessage(request);
scheduler.executeRunnable(new PacketHandlerThread(request));
count.addAndGet(1);
if(isDebug){
log.multiDebug(this.getClass(),"one/s:"+getTPS(),"","");
log.debug(new String(Base64.getDecoder().decode(new String(request.getData(),0,request.getLength()))),count+"::id-message");
}
}
});
}
}
private class ListenerThreadTCP implements Runnable{
@Override
public void run() {
Utils.TryCatch(()->{
if(serverSocket == null){
serverSocket = getSocket(Integer.parseInt(serverProp.getProperty(THIS_PORT)));
}
while (true) {
if(!Server.getRuntime().running().isConnected){
ServerLogger.getLogger().multiInfo(getClass(),"the listener thread is closed","","");
}
//getLogger().multiDebug(getClass(),"正在响应...","","");
Socket socket = ((ServerSocket)serverSocket).accept();
scheduler.executeRunnable(new SocketHandlerThread(socket));
lock.lock();
count.addAndGet(1);
lock.unlock();
if (isDebug) {
log.multiDebug(getClass(),"one/s:" + getTPS(),"","");
}
}
});
}
}
/**
* 监听smod2的log文件
* 一个线程监听,一个线程放行
*/
@Deprecated
private class Smod2LogThread implements Runnable{
@Override
public void run() {
String fileName = serverProp.getProperty(SMOD2_LOG_FILE);
File file = new File(fileName);
if(file.exists()) {
try {
BufferedReader reader = Utils.getReader(file);
BlockingQueue<String> queue = new SynchronousQueue<>();
scheduler.executeRunnable(()->{
try {
for (; ; ) {
String message = reader.readLine();
if (message != null) {
queue.put(message);
}
}
} catch (Exception e) {
e.printStackTrace();
}
});
scheduler.executeRunnable(()->{
for(;;) {
try {
String take = queue.take();
log.info(take);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}catch (Exception e){
e.printStackTrace();
}
}
}
}
/**
*
* something find in https://crunchify.com
* 以下代码的产生来之不易,感谢
* JunHe友情提供代码地址
* 校长提供log文件格式
* GNX和菠萝协助解决问题
*/
private static int crunchifyCounter = 0;
private class LogListener implements Runnable {
private int crunchifyRunEveryNSeconds;
private long lastKnownPosition = 0;
private boolean shouldIRun = true;
private File crunchifyFile;
private String timeFormat;
private Max max;
private String fileProperty;
public LogListener(String file,int myInterval,String timeFormat,Max max,String prop) {
this.crunchifyRunEveryNSeconds = myInterval;
this.crunchifyFile = new File(file);
this.timeFormat = timeFormat;
this.max = max;
this.fileProperty = prop;
}
private void printLine(String message) {
try{
log.multiInfo(getClass(),new String(message.getBytes("ISO-8859-1"),System.getProperty("file.encoding")),"","");
}catch (UnsupportedEncodingException e){
e.printStackTrace();
}
}
public void stopRunning() {
shouldIRun = false;
}
public void run() {
try {
int count = 0;
while (shouldIRun) {
if(!Server.getRuntime().running().isConnected){
ServerLogger.getLogger().multiInfo(getClass(),"the listener thread is closed","","");
}
Thread.sleep(crunchifyRunEveryNSeconds);
String log = logListener(timeFormat,max,fileProperty);
if(!"same".equals(log)){
if(log !=null) {
crunchifyFile = new File(log);
}
}
long fileLength = crunchifyFile.length();
if (fileLength > lastKnownPosition) {
// Reading and writing file
RandomAccessFile readWriteFileAccess = new RandomAccessFile(crunchifyFile, "rw");
readWriteFileAccess.seek(lastKnownPosition);
String crunchifyLine;
while ((crunchifyLine = readWriteFileAccess.readLine()) != null) {
if(count!=0) {
this.printLine(crunchifyLine);
}
crunchifyCounter++;
}
lastKnownPosition = readWriteFileAccess.getFilePointer();
readWriteFileAccess.close();
} else {
if (isDebug)
this.printLine("Hmm.. Couldn't found new line after line # " + crunchifyCounter);
}
count++;
}
} catch (Exception e) {
stopRunning();
}
if (isDebug)
this.printLine("Exit the program...");
}
}
//new line reader
public static ConsoleReader getLineReader() throws IOException{
if(lineReader == null) {
lineReader = new ConsoleReader();
lineReader.addCompleter(Console.getSimpleConsole());
}
return lineReader;
}
static Scanner getScanner(){
return scanner;
}
public void setLang(Properties lang) {
this.lang = lang;
}
private void executeEmerald(String[] args){
server.serverLogInfo("this cn.jsmod2.server uses the Emerald "+ Server.getRuntime().running().serverProp.getProperty(EMERALD_COMPILER,"java")+" compiler v0.1 Engine By MagicLu550");
if(args.length!=0){
try{
for(String arg:args)
EmeraldScriptVM.getVM().importFile(arg);
if(contains(args,"-emerald")){
System.exit(0);
}
}catch (Exception e){
Utils.printException(e);
}
}
}
private void successTime(){
for(RegisterTemplate template:server.getRegisters()) {
for (String success : template.getSuccessInfo()) {
server.serverLogInfo(MessageFormat.format(lang.getProperty(success), (server.getStartSuccessTime()-server.getStartTime()) + ""));
}
}
}
private void chooseLangOrStart() throws IOException{
Properties langProperties = FileSystem.getFileSystem().langProperties(log,server);
server.setLang(langProperties);
FileSystem.getFileSystem().initLang(langProperties);
startMessage(langProperties,server);
}
private void startConsoleCommand() throws IOException{
Console.getConsole().commandInput();
}
private File[] beforeFile;
private String logListener(String timeFormat,Max max,String fileProperty){
String serverProps = serverProp.getProperty(fileProperty);
File file = new File(serverProps);
SimpleDateFormat format = new SimpleDateFormat(timeFormat);
if(file.exists()){
File[] files = file.listFiles();
if(files!=null) {
if(beforeFile == null){
beforeFile = files;
}else{
if(Arrays.asList(beforeFile).equals(Arrays.asList(files))){
return "same";
}
}
File lastFile = Arrays.stream(files)
.filter(x->x.getName().endsWith(".log")||x.getName().endsWith(".txt"))
.sorted((x1,x2)->max.getMax(format,x1,x2)).collect(Collectors.toList()).get(0);
//Round 2019-07-10 08.47.31
return lastFile.toString();
}
}
return null;
}
public AtomicInteger getIn() {
return count;
}
public AtomicInteger getOut() {
return out;
}
interface Max{
int getMax(SimpleDateFormat format, File x1, File x2);
}
}
| jsmod2-java-c/JSmod2-Core | JPLS/src/main/java/cn/jsmod2/core/Server.java |
65,865 | package com.barrett.base.thread;
import com.barrett.util.DateUtil;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.Timer;
import java.util.TimerTask;
/**
* 任务调度
*
* @Author created by barrett in 2020/6/8 21:19
*/
public class TimerTest01 {
public static void main(String[] args) {
Timer timer = new Timer();
// timer.schedule(new MyTask(), 1000);//1秒后执行任务 myTask
// timer.schedule(new MyTask(),1000,500);//1秒后执行,每500毫秒执行一次
Calendar cal = new GregorianCalendar(2020,6,8,21,30,59);
timer.schedule(new MyTask(),cal.getTime(),200);//指定具体日期
}
}
class MyTask extends TimerTask {
@Override
public void run() {
System.out.println(DateUtil.getDateTime()+" 放空大脑。。。");
}
} | tanyicheng/java-base | src/main/java/com/barrett/base/thread/TimerTest01.java |
65,867 | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package constants.skills;
/**
* @author PlayDK
*/
public class 战士 {
public static final int 守护者之甲 = 1000007; //技能最大等级1
public static final int 战士精通 = 1000009; //技能最大等级15
public static final int 圣甲术 = 1000003; //技能最大等级20
public static final int 群体攻击 = 1001005; //技能最大等级20
public static final int 战士飞叶 = 1001008; //技能最大等级10
/*
* 5转技能
*/
public static final int 灵气武器 = 400011000;
public static final int 灵气武器_1 = 400010000;
}
| mimilewis/MapleStory143 | src/main/java/constants/skills/战士.java |
65,868 | package ceui.lisa.models;
public class HitoResponse {
/**
* id : 191
* hitokoto : 代表月亮消灭你!
* type : a
* from : 美少女战士
* creator : edvda
* created_at : 1468605911
*/
private int id;
private String hitokoto;
private String type;
private String from;
private String creator;
private String created_at;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getHitokoto() {
return hitokoto;
}
public void setHitokoto(String hitokoto) {
this.hitokoto = hitokoto;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getFrom() {
return from;
}
public void setFrom(String from) {
this.from = from;
}
public String getCreator() {
return creator;
}
public void setCreator(String creator) {
this.creator = creator;
}
public String getCreated_at() {
return created_at;
}
public void setCreated_at(String created_at) {
this.created_at = created_at;
}
}
| CeuiLiSA/Pixiv-Shaft | models/src/main/java/ceui/lisa/models/HitoResponse.java |
65,870 | package constants;
import config.ServerConfig;
public class BeansConstants {
private static BeansConstants instance = null;
public int get豆豆奖励范围() {
return ServerConfig.豆豆奖励范围;
}
public int get力度搞假() {
return ServerConfig.力度搞假;
}
public String[] get白怪奖励() {
return ServerConfig.白怪奖励;
}
public String[] get色怪奖励() {
return ServerConfig.色怪奖励;
}
public String[] get五职业奖励() {
return ServerConfig.五职业奖励;
}
public String[] get女皇奖励() {
return ServerConfig.女皇奖励;
}
public String[] get大白怪() {
return ServerConfig.大白怪;
}
public String[] get小白怪() {
return ServerConfig.小白怪;
}
public String[] get紫色怪() {
return ServerConfig.紫色怪;
}
public String[] get粉色怪() {
return ServerConfig.粉色怪;
}
public String[] get飞侠() {
return ServerConfig.飞侠;
}
public String[] get海盗() {
return ServerConfig.海盗;
}
public String[] get法师() {
return ServerConfig.法师;
}
public String[] get战士() {
return ServerConfig.战士;
}
public String[] get弓箭手() {
return ServerConfig.弓箭手;
}
public String[] get女皇() {
return ServerConfig.女皇;
}
public String[] get豆豆装备() {
return ServerConfig.豆豆装备;
}
public String[] get豆豆坐骑() {
return ServerConfig.豆豆坐骑;
}
public String[] get消耗品() {
return ServerConfig.消耗品;
}
public int get海洋帽子几率() {
return ServerConfig.海洋帽子几率;
}
public String[] get黄金狗几率() {
return ServerConfig.黄金狗几率;
}
public static BeansConstants getInstance() {
if (instance == null) {
instance = new BeansConstants();
}
return instance;
}
}
| Riremito/JMSv186 | src/constants/BeansConstants.java |
65,872 | package cn.eiden.hsm.enums;
/**
* 卡牌职业
*
* @author Eiden J.P Zhou
* @date 2020/4/9 10:24
*/
public enum CardClass {
INVALID(0, "无效"),
DEATHKNIGHT(1, "无效"),
DRUID(2, "德鲁伊"),
HUNTER(3, "猎人"),
MAGE(4, "法师"),
PALADIN(5, "圣骑士"),
PRIEST(6, "牧师"),
ROGUE(7, "盗贼"),
SHAMAN(8, "萨满"),
WARLOCK(9, "术士"),
WARRIOR(10, "战士"),
DREAM(11, "无效"),
NEUTRAL(12, "中立"),
WHIZBANG(13, "无效"),
DEMONHUNTER(14, "恶魔猎手");
private int code;
private String cnName;
CardClass(int code, String cnName) {
this.code = code;
this.cnName = cnName;
}
public int getCode() {
return code;
}
public String getCnName() {
return cnName;
}
}
| EidenRitto/hearthstone | hearth-core/src/main/java/cn/eiden/hsm/enums/CardClass.java |
65,873 | package handling.channel.handler;
import client.MapleBeans;
import client.MapleCharacter;
import client.MapleClient;
import constants.BeansConstants;
import constants.GameConstants;
import server.Randomizer;
import tools.FileoutputUtil;
import tools.MaplePacketCreator;
import tools.data.LittleEndianAccessor;
import java.util.ArrayList;
import java.util.List;
public class BeanGame {
public static int 进洞次数 = 0;
public static int 第一排 = 0;
public static int 第三排 = 0;
public static int 第二排 = 0;
public static int 启动打怪效果 = 0;
public static int 中奖率 = 0;
public static int 加速旋转 = 0;
public static boolean 打中女皇出现特效A = false;//false = 启动动画效果
public static boolean 打中女皇出现特效B = false;//false = 启动动画效果
public static int 蓝 = 0;
public static int 绿 = 0;
public static int 红 = 0;
public static int 黄金狗设置局数 = 0;
//public static int 海洋帽子 = 1002743;
public static final void BeansGameAction(LittleEndianAccessor slea, MapleClient c) {
/*
第一
1 = 3
2 = 6
3 = 9
4 = 2
5 = 5
6 = 8
7 = 4
8 = 7
9 = 1
第三
1 = 5
2 = 3
3 = 8
4 = 6
5 = 4
6 = 9
7 = 1
8 = 7
9 = 2
0 大白怪
1 紫怪
2 飞侠
3 粉怪
4 海盗
5 小白怪
6 法师
7 战士
8 弓箭手
9 女皇
*/
/*public static int[] 豆豆装备 = {1002695, 1002609, 1002665, 1002985, 1002986, 1002761, 1002760, 1002583, 1002543, 1002448, 1052137, 1092051, 1702232, 1702138};
public static int[] 豆豆坐骑 = {1902031, 1902032, 1902033, 1902034, 1902035, 1902037};
public static int[] 消耗品 = {2022140, 2022141, 2022139, 2022137, 1902035, 1902037};*/
BeansConstants Beans = new BeansConstants();
//String 豆豆装备[] = Beans.get豆豆装备();
//String 豆豆坐骑[] = Beans.get豆豆坐骑();
//String 消耗品[] = Beans.get消耗品();
int 海洋帽子几率 = Beans.get海洋帽子几率();
int 力度搞假 = Beans.get力度搞假();
int 豆豆奖励范围 = Beans.get豆豆奖励范围();
String[] 黄金狗几率 = Beans.get黄金狗几率();
String[] 大白怪 = Beans.get大白怪();
String[] 小白怪 = Beans.get小白怪();
String[] 紫色怪 = Beans.get紫色怪();
String[] 粉色怪 = Beans.get粉色怪();
String[] 飞侠 = Beans.get飞侠();
String[] 海盗 = Beans.get海盗();
String[] 法师 = Beans.get法师();
String[] 战士 = Beans.get战士();
String[] 弓箭手 = Beans.get弓箭手();
String[] 女皇 = Beans.get女皇();
String[] 白怪奖励 = Beans.get白怪奖励();
String[] 色怪奖励 = Beans.get色怪奖励();
String[] 五职业奖励 = Beans.get五职业奖励();
String[] 女皇奖励 = Beans.get女皇奖励();
//System.out.println("豆豆出现包" +slea.toString());
MapleCharacter chr = c.getPlayer();
List<MapleBeans> beansInfo = new ArrayList<>();
int type = slea.readByte();
int 力度 = 0;
int 豆豆序号 = 0;
//int 力度搞假A = 0;
//if (力度搞假 > 0) {
// 力度搞假A = Randomizer.nextInt(力度搞假);
//}
if (chr.getBeans() <= 0) {
c.getPlayer().dropMessage(1, "你没有小钢珠,无法使用。");
c.sendPacket(MaplePacketCreator.enableActions());
return;
}
switch (type) {
case 0://开始打豆豆
//力度 = slea.readShort();
slea.readShort();
力度 = Randomizer.rand(1000, 5000);
//slea.readInt();
chr.setBeansRange(力度 /*+ 力度搞假A*/);
c.getSession().write(MaplePacketCreator.enableActions());
break;
case 1://点开始的时候 确认打豆豆的力度
//01 E8 03
//力度 = slea.readShort();
chr.setBeansRange(力度 /*+ 力度搞假A*/);
c.getSession().write(MaplePacketCreator.enableActions());
break;
case 2://暂时没去注意这个 而且IDA里面也没有对应内容
//没存在的必要
//02 1B 00 00 00
//slea.readInt();
if (get进洞次数() > 1) {
set进洞次数(0);
} else {
set进洞次数(0);
}
break;
case 3:
//打豆豆进洞以后的数据
gain进洞次数(1);
if (get进洞次数() > 7) {
set进洞次数(7);
}
// FileoutputUtil.log("log\\打豆豆进洞颜色.log", "进洞颜色" + beansInfo + "\r\n");
c.getSession().write(MaplePacketCreator.BeansJDCS(get进洞次数(), 加速旋转, 蓝, 绿, 红));
break;
case 4:
//记录进洞次数的黄色豆豆。最多只有7个。
if (get进洞次数() == 0) {
c.sendPacket(MaplePacketCreator.enableActions());
return;
}
gain进洞次数(-1);
/* 第一排 = Randomizer.nextInt(10);
第三排 = Randomizer.nextInt(10);*/
// 第二排 = Randomizer.nextInt(10);
int 概率 = 0;
if (黄金狗设置局数 > 0) {
概率 = 100;
}
if (Randomizer.nextInt(Integer.parseInt(大白怪[0])) > Integer.parseInt(大白怪[1]) && 概率 != 100) {
第一排 = 0;
第三排 = 0;
if (Randomizer.nextInt(Integer.parseInt(大白怪[2])) > Integer.parseInt(大白怪[3])) {
第二排 = 0;
中奖率 = 100;
} else {
中奖率 = 0;
}
启动打怪效果 = 1;
打中女皇出现特效A = false;
打中女皇出现特效B = false;
} else if (Randomizer.nextInt(Integer.parseInt(紫色怪[0])) > Integer.parseInt(紫色怪[1]) && 概率 != 100) {
第一排 = 9;
第三排 = 7;
if (Randomizer.nextInt(Integer.parseInt(紫色怪[2])) > Integer.parseInt(紫色怪[3])) {
第二排 = 1;
中奖率 = 100;
} else {
中奖率 = 0;
}
启动打怪效果 = 1;
打中女皇出现特效A = false;
打中女皇出现特效B = false;
} else if (Randomizer.nextInt(Integer.parseInt(粉色怪[0])) > Integer.parseInt(粉色怪[1]) && 概率 != 100) {
第一排 = 1;
第三排 = 2;
if (Randomizer.nextInt(Integer.parseInt(粉色怪[2])) > Integer.parseInt(粉色怪[3])) {
第二排 = 3;
中奖率 = 100;
} else {
中奖率 = 0;
}
启动打怪效果 = 1;
打中女皇出现特效A = false;
打中女皇出现特效B = false;
} else if (Randomizer.nextInt(Integer.parseInt(小白怪[0])) > Integer.parseInt(小白怪[1]) && 概率 != 100) {
第一排 = 5;
第三排 = 1;
if (Randomizer.nextInt(Integer.parseInt(小白怪[2])) > Integer.parseInt(小白怪[3])) {
第二排 = 5;
中奖率 = 100;
} else {
中奖率 = 0;
}
启动打怪效果 = 1;
打中女皇出现特效A = false;
打中女皇出现特效B = false;
} else if (Randomizer.nextInt(Integer.parseInt(飞侠[0])) > Integer.parseInt(飞侠[1]) && 概率 != 100) {
第一排 = 4;
第三排 = 9;
if (Randomizer.nextInt(Integer.parseInt(飞侠[2])) > Integer.parseInt(飞侠[3])) {
第二排 = 2;
中奖率 = 100;
} else {
中奖率 = 0;
}
启动打怪效果 = 1;
打中女皇出现特效A = false;
打中女皇出现特效B = false;
} else if (Randomizer.nextInt(Integer.parseInt(海盗[0])) > Integer.parseInt(海盗[1]) && 概率 != 100) {
第一排 = 7;
第三排 = 5;
if (Randomizer.nextInt(Integer.parseInt(海盗[2])) > Integer.parseInt(海盗[3])) {
第二排 = 4;
中奖率 = 100;
} else {
中奖率 = 0;
}
启动打怪效果 = 1;
打中女皇出现特效A = false;
打中女皇出现特效B = false;
} else if (Randomizer.nextInt(Integer.parseInt(法师[0])) > Integer.parseInt(法师[1]) && 概率 != 100) {
第一排 = 2;
第三排 = 4;
if (Randomizer.nextInt(Integer.parseInt(法师[2])) > Integer.parseInt(法师[3])) {
第二排 = 6;
中奖率 = 100;
} else {
中奖率 = 0;
}
启动打怪效果 = 1;
打中女皇出现特效A = false;
打中女皇出现特效B = false;
} else if (Randomizer.nextInt(Integer.parseInt(战士[0])) > Integer.parseInt(战士[1]) && 概率 != 100) {
第一排 = 8;
第三排 = 8;
if (Randomizer.nextInt(Integer.parseInt(战士[2])) > Integer.parseInt(战士[3])) {
第二排 = 7;
中奖率 = 100;
} else {
中奖率 = 0;
}
启动打怪效果 = 1;
打中女皇出现特效A = false;
打中女皇出现特效B = false;
} else if (Randomizer.nextInt(Integer.parseInt(弓箭手[0])) > Integer.parseInt(弓箭手[1]) && 概率 != 100) {
第一排 = 6;
第三排 = 3;
if (Randomizer.nextInt(Integer.parseInt(弓箭手[2])) > Integer.parseInt(弓箭手[3])) {
第二排 = 8;
中奖率 = 100;
} else {
中奖率 = 0;
}
启动打怪效果 = 1;
打中女皇出现特效A = false;
打中女皇出现特效B = false;
} else if (Randomizer.nextInt(Integer.parseInt(女皇[0])) > Integer.parseInt(女皇[1]) || 概率 == 100) {
第一排 = 3;
第三排 = 6;
if (黄金狗设置局数 > 0) {
第二排 = 9;
中奖率 = 100;
黄金狗设置局数 = 0;
} else if (Randomizer.nextInt(Integer.parseInt(女皇[2])) > Integer.parseInt(女皇[3])) {
第二排 = 9;
中奖率 = 100;
} else {
中奖率 = 0;
}
启动打怪效果 = 1;
打中女皇出现特效A = false;
打中女皇出现特效B = false;
} else {
第一排 = Randomizer.nextInt(10);
switch (第一排) {
case 0:
第三排 = Randomizer.nextInt(9) + 1;
break;
case 1:
第三排 = Randomizer.nextInt(7) + 3;
break;
case 2:
第三排 = Randomizer.nextInt(5) + 5;
break;
case 3:
第三排 = Randomizer.nextInt(3) + 7;
break;
case 4:
第三排 = Randomizer.nextInt(9);
break;
case 5:
第三排 = Randomizer.nextInt(8) + 2;
break;
case 6:
第三排 = Randomizer.nextInt(6) + 4;
break;
case 7:
第三排 = Randomizer.nextInt(4) + 6;
break;
case 8:
第三排 = Randomizer.nextInt(8);
break;
case 9:
第三排 = Randomizer.nextInt(7);
break;
}
第二排 = Randomizer.nextInt(10);
启动打怪效果 = 0;
中奖率 = 0;
加速旋转 = 0;
打中女皇出现特效A = false;
打中女皇出现特效B = false;
}
c.getSession().write(MaplePacketCreator.BeansJDXZ(get进洞次数(), 第一排, 第三排, 第二排, 启动打怪效果, 中奖率, 加速旋转, 打中女皇出现特效A, 打中女皇出现特效B));
c.sendPacket(MaplePacketCreator.enableActions());
if (第二排 != 9) {
if (Randomizer.nextInt(Integer.parseInt(黄金狗几率[0])) == Integer.parseInt(黄金狗几率[1]) && 黄金狗设置局数 == 0) {
黄金狗设置局数 = 1;
c.getSession().write(MaplePacketCreator.BeansHJG((byte) 1));
} else {
黄金狗设置局数 = 0;
c.getSession().write(MaplePacketCreator.BeansHJG((byte) 0));
}
}
break;
case 5://应该是普通的怪物中奖 //移动以后三排一样的 这里应该是处理 打完以后出现的 看看是不是判断一排的代码
//移动以后三排一样的 这里应该是处理 打完以后出现的 看看是不是判断一排的代码
if ((第一排 == 0 && 第三排 == 0 && 第二排 == 0)
|| (第一排 == 9 && 第三排 == 7 && 第二排 == 1)
|| (第一排 == 4 && 第三排 == 9 && 第二排 == 2)
|| (第一排 == 1 && 第三排 == 2 && 第二排 == 3)
|| (第一排 == 7 && 第三排 == 5 && 第二排 == 4)
|| (第一排 == 5 && 第三排 == 1 && 第二排 == 5)
|| (第一排 == 2 && 第三排 == 4 && 第二排 == 6)
|| (第一排 == 8 && 第三排 == 8 && 第二排 == 7)
|| (第一排 == 6 && 第三排 == 3 && 第二排 == 8)
|| (第一排 == 3 && 第三排 == 6 && 第二排 == 9)) {
int itemId = 0;
//int exp = GameConstants.getExpNeededForLevel(c.getPlayer().getLevel() + 1) / 2000;
final int experi = Randomizer.nextInt(Math.abs(GameConstants.getExpNeededForLevel(c.getPlayer().getLevel()) / 800) + 1);
int beilu = (c.getPlayer().getLevel() <= 50) ? 1 : (c.getPlayer().getLevel() > 50 && c.getPlayer().getLevel() <= 100) ? 2 : (c.getPlayer().getLevel() > 100 && c.getPlayer().getLevel() <= 150) ? 4 : (c.getPlayer().getLevel() > 150 && c.getPlayer().getLevel() <= 200) ? 8 : 1;
final int experi2 = ((int) Math.ceil(experi / beilu));
int x = Randomizer.nextInt(100) + 1;
int count = 1;
switch (第二排) {
case 5://小白怪
case 0://大白怪
if (Randomizer.nextInt(Integer.parseInt(白怪奖励[0])) > Randomizer.nextInt(Integer.parseInt(白怪奖励[1]))) {
c.getPlayer().gainExp(experi2, false, false, false);
c.getPlayer().dropMessage(5, "在小钢珠中获得:" + experi2 + "经验值!");
} else if (Randomizer.nextInt(Integer.parseInt(白怪奖励[2])) > Randomizer.nextInt(Integer.parseInt(白怪奖励[3]))) {
c.getPlayer().gainExp(experi2, false, false, false);
c.getPlayer().dropMessage(5, "在小钢珠中获得:" + experi2 + "经验值!");
}
c.sendPacket(MaplePacketCreator.enableActions());
break;
case 1://紫色怪
case 3://粉色怪
if (Randomizer.nextInt(Integer.parseInt(色怪奖励[0])) > Randomizer.nextInt(Integer.parseInt(色怪奖励[1]))) {
c.getPlayer().gainExp(experi2, false, false, false);
c.getPlayer().dropMessage(5, "在小钢珠中获得:" + experi2 + "经验值!");
} else if (Randomizer.nextInt(Integer.parseInt(色怪奖励[4])) > Randomizer.nextInt(Integer.parseInt(色怪奖励[5]))) {
c.getPlayer().gainExp(experi2, false, false, false);
c.getPlayer().dropMessage(5, "在小钢珠中获得:" + experi2 + "经验值!");
} else if (Randomizer.nextInt(Integer.parseInt(色怪奖励[2])) > Randomizer.nextInt(Integer.parseInt(色怪奖励[3]))) {
c.getPlayer().gainExp(experi2, false, false, false);
c.getPlayer().dropMessage(5, "在小钢珠中获得:" + experi2 + "经验值!");
}
c.sendPacket(MaplePacketCreator.enableActions());
break;
case 2://飞侠
case 4://海盗
case 6://法师
case 7://战士
case 8://弓箭手
if (Randomizer.nextInt(Integer.parseInt(五职业奖励[0])) > Randomizer.nextInt(Integer.parseInt(五职业奖励[1]))) {
c.getPlayer().gainExp(experi2, false, false, false);
c.getPlayer().dropMessage(5, "在小钢珠中获得:" + experi2 + "经验值!");
} else if (Randomizer.nextInt(Integer.parseInt(五职业奖励[4])) > Randomizer.nextInt(Integer.parseInt(五职业奖励[5]))) {
c.getPlayer().gainExp(experi2, false, false, false);
c.getPlayer().dropMessage(5, "在小钢珠中获得:" + experi2 + "经验值!");
} else if (Randomizer.nextInt(Integer.parseInt(五职业奖励[6])) > Randomizer.nextInt(Integer.parseInt(五职业奖励[7]))) {
c.getPlayer().gainExp(experi2, false, false, false);
c.getPlayer().dropMessage(5, "在小钢珠中获得:" + experi2 + "经验值!");
} else if (Randomizer.nextInt(Integer.parseInt(五职业奖励[2])) > Randomizer.nextInt(Integer.parseInt(五职业奖励[3]))) {
c.getPlayer().gainExp(experi2, false, false, false);
c.getPlayer().dropMessage(5, "在小钢珠中获得:" + experi2 + "经验值!");
}
c.sendPacket(MaplePacketCreator.enableActions());
break;
case 9://女皇
if (Randomizer.nextInt(Integer.parseInt(女皇奖励[4])) > Randomizer.nextInt(Integer.parseInt(女皇奖励[5]))) {
c.getPlayer().gainExp(experi2, false, false, false);
c.getPlayer().dropMessage(5, "在小钢珠中获得:" + experi2 + "经验值!");
} else if (x == 海洋帽子几率) {
c.getPlayer().gainExp(experi2, false, false, false);
c.getPlayer().dropMessage(5, "在小钢珠中获得:" + experi2 + "经验值!");
} else if (Randomizer.nextInt(Integer.parseInt(女皇奖励[6])) > Randomizer.nextInt(Integer.parseInt(女皇奖励[7]))) {
c.getPlayer().gainExp(experi2, false, false, false);
c.getPlayer().dropMessage(5, "在小钢珠中获得:" + experi2 + "经验值!");
} else if (Randomizer.nextInt(Integer.parseInt(女皇奖励[2])) > Randomizer.nextInt(Integer.parseInt(女皇奖励[3]))) {
c.getPlayer().gainExp(experi2, false, false, false);
c.getPlayer().dropMessage(5, "在小钢珠中获得:" + experi2 + "经验值!");
}
c.sendPacket(MaplePacketCreator.enableActions());
break;
default:
System.out.println("未处理的类型A【" + type + "】\n包" + slea);
break;
}
/*if (c.getPlayer().getInventory(GameConstants.getInventoryType(itemId)).getNextFreeSlot() > -1 && itemId != 0) {
MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
MapleInventoryType type1 = ii.getInventoryTypeCS(itemId);
if (type1.equals(MapleInventoryType.EQUIP)) {
count = 1;
}
MapleInventoryManipulator.addById(c, itemId, (short) count, "豆豆机奖励");
}*/
// int 奖励豆豆 = Randomizer.nextInt(150) + 50;
int 奖励豆豆 = /*第二排 +*/ 豆豆奖励范围;
//chr.gainBeans(奖励豆豆);
chr.modifyJF(4, 奖励豆豆);
c.getPlayer().dropMessage(5, "在小钢珠中获得: " + 奖励豆豆 + "小钢珠积分!");
// chr.gainExp(1, true, false, true);
if (chr.getMapId() == 809030000) {
String notea = "恭喜你小钢珠成功中奖!当前中获得:" + 奖励豆豆 + "小钢珠积分!";
c.getSession().write(MaplePacketCreator.BeansGameMessage(0x01, 0x01, notea));
}
if (黄金狗设置局数 > 0 && 第二排 == 9) {
黄金狗设置局数 = 0;
c.getSession().write(MaplePacketCreator.BeansHJG((byte) 0));
}
//c.getSession().write(MaplePacketCreator.BeansZJgeidd(true, 奖励豆豆));
}
break;
case 7:
if (黄金狗设置局数 > 0) {
黄金狗设置局数 = 0;
c.getSession().write(MaplePacketCreator.BeansHJG((byte) 0));
}
//c.getSession().write(MaplePacketCreator.BeansZJgeidd(true, 0));
break;
case 0x0B:
//0B[11] - 点start/stop的时候获得start/stop时豆豆的力度和序号
//0 - 刚打开界面的时候设置的力度
//力度 = slea.readShort();
slea.readShort();
力度 = Randomizer.rand(1000, 5000);
豆豆序号 = slea.readInt() + 1;//这里获得的Int是最后一个豆豆的序号
chr.setBeansRange(力度/* + 力度搞假A*/);
chr.setBeansNum(豆豆序号);
if (豆豆序号 == 1) {
chr.setCanSetBeansNum(false);
}
break;
case 6:
//点暂停或者满5个豆豆后客户端发送的豆豆信息 最多5个豆豆
slea.skip(1);
int 循环次数 = slea.readByte();
if (循环次数 == 0) {
c.sendPacket(MaplePacketCreator.enableActions());
return;
} else if (循环次数 != 1) {
slea.skip((循环次数 - 1) * 8);
} //int 临时豆豆序号 = slea.readInt();
//豆豆序号 = (临时豆豆序号 == 1 ? 0 : 临时豆豆序号) + (chr.getBeansNum() == 临时豆豆序号 ? 1 : 0);
if (chr.isCanSetBeansNum()) {
chr.setBeansNum(chr.getBeansNum() + 循环次数);
}
chr.gainBeans(-循环次数);
chr.setCanSetBeansNum(true);
break;
default:
System.out.println("未处理未知类型【" + type + "】\n包" + slea);
//FileoutputUtil.log("logs/小钢珠未知类型.txt", "类型【" + type + "】\n包" + slea.toString());
FileoutputUtil.logToFile("logs/小钢珠未知类型.txt", "时间: " + FileoutputUtil.NowTime() + " IP: " + chr.getClient().getSessionIPAddress() + " MAC: " + chr.getNowMacs() + chr.getName() + "类型【" + type + "】\n包" + slea + "\r\n");
break;
}
if (type == 0x0B || type == 6) {
for (int i = 0; i < 5; i++) {
beansInfo.add(new MapleBeans(rand(1000, 5000), getBeanType(), chr.getBeansNum() + i));
}
c.getSession().write(MaplePacketCreator.showBeans(beansInfo));
c.sendPacket(MaplePacketCreator.enableActions());
}
c.getSession().write(MaplePacketCreator.updateBeans(c.getPlayer()));
c.sendPacket(MaplePacketCreator.enableActions());
}
private static int getBeanType() {
int random = rand(1, 100);
int beanType = 0;
/*switch (random) {
case 2:
beanType = 1;
break;
case 49:
beanType = 2;
break;
case 99:
beanType = 3;
break;
}*/
return beanType;
}
public static final int get进洞次数() {
return 进洞次数;
}
public static final void gain进洞次数(int a) {
进洞次数 += a;
}
public static final void set进洞次数(int a) {
进洞次数 = a;
}
private static int rand(int lbound, int ubound) {
return (int) ((Math.random() * (ubound - lbound + 1)) + lbound);
}
public enum BeansType {
开始打豆豆(0x00),
颜色求进洞(0x03),
进洞旋转(0x04),
奖励豆豆效果(0x05),
未知效果(0x06),
黄金狗(0x07),
奖励豆豆效果B(0x08),
领奖NPC(0x09);
final byte type;
BeansType(int type) {
this.type = (byte) type;
}
public byte getType() {
return type;
}
}
/*public class Beans {
private int number;
private int type;
private int pos;
public Beans(int pos, int type, int number) {
this.pos = pos;
this.number = number;
this.type = type;
}
public int getType() {
return type;
}
public int getNumber() {
return number;
}
public int getPos() {
return pos;
}
}*/
//}
public static final void updateBeans(LittleEndianAccessor slea, MapleClient c) {
c.getSession().write(MaplePacketCreator.updateBeans(c.getPlayer()));
c.getSession().write(MaplePacketCreator.enableActions());
}
}
| huangshushu/ZLHSS2 | src/handling/channel/handler/BeanGame.java |
65,875 | /**
*
*/
package cn.nju.game.model.vo;
/**
* 战士召唤师VO
* @author frank
*
*/
public class WarriorCommanderBasicVO extends CommanderBasicVO {
private static final String WARRIOR = "战士";
/**
*
*/
private static final long serialVersionUID = 6159660667339053915L;
/* (non-Javadoc)
* @see cn.nju.game.model.vo.CommanderBasicVO#job()
*/
@Override
public String getJob() {
return WARRIOR;
}
}
| zipzou/fight-game | src/main/java/cn/nju/game/model/vo/WarriorCommanderBasicVO.java |
65,876 | package com.genesis.dblog;
import com.genesis.dblog.anno.ColumnView;
import com.genesis.dblog.anno.Index;
import javax.persistence.Column;
import javax.persistence.MappedSuperclass;
/**
* 玩家日志的基类
*
* @author yaguang.xiao
*
*/
@MappedSuperclass
public abstract class HumanDbLog extends DbLog {
private static final long serialVersionUID = 1L;
@ColumnView(value = "账号ID", search = "=")
@Index
@Column
private long accountId; // 账号信息
@ColumnView(value = "账号名", search = "=")
@Index
@Column(length = 128)
private String accountName;
@ColumnView(value = "角色ID", search = "=")
@Index
@Column
private long charId; // 角色信息
@ColumnView(value = "角色名", search = "=")
@Index
@Column(length = 128)
private String charName;
@ColumnView("级别")
@Column
private int level; // 用户当前级别
@ColumnView(value = "职业", optionName = {"无职业", "大剑 ", "游侠", "弓箭", "战士", "法师"}, optionValue = {0,
1, 2, 4, 8, 16})
@Column
private int allianceId; // 玩家职业
@ColumnView("VIP等级")
@Column
private int vipLevel; // 玩家的VIP等级
public HumanDbLog() {
}
public HumanDbLog(long time, int rid, int sid, long aid, String accountName, long cid,
String charName, int level, int allianceId, int vipLevel, int reason, String param) {
super(time, rid, sid, reason, param);
this.accountId = aid;
this.accountName = accountName;
this.charId = cid;
this.charName = charName;
this.level = level;
this.allianceId = allianceId;
this.vipLevel = vipLevel;
}
public long getAccountId() {
return accountId;
}
public void setAccountId(long accountId) {
this.accountId = accountId;
}
public long getCharId() {
return charId;
}
public void setCharId(long charId) {
this.charId = charId;
}
public int getLevel() {
return level;
}
public void setLevel(int level) {
this.level = level;
}
public int getAllianceId() {
return allianceId;
}
public void setAllianceId(int allianceId) {
this.allianceId = allianceId;
}
public int getVipLevel() {
return vipLevel;
}
public void setVipLevel(int vipLevel) {
this.vipLevel = vipLevel;
}
public String getAccountName() {
return accountName;
}
public void setAccountName(String accountName) {
this.accountName = accountName;
}
public String getCharName() {
return charName;
}
public void setCharName(String charName) {
this.charName = charName;
}
}
| sigh667/GenesisServer | Code_Java/db_log/src/com/genesis/dblog/HumanDbLog.java |
65,877 | package server;
import client.MapleCharacter;
import handling.world.party.MaplePartyCharacter;
import java.lang.ref.WeakReference;
public class MapleCarnivalChallenge {
WeakReference<MapleCharacter> challenger;
String challengeinfo = "";
public MapleCarnivalChallenge(MapleCharacter challenger) {
this.challenger = new WeakReference(challenger);
this.challengeinfo += "#b";
for (MaplePartyCharacter pc : challenger.getParty().getMembers()) {
MapleCharacter c = challenger.getMap().getCharacterById(pc.getId());
if (c != null) {
this.challengeinfo = (this.challengeinfo + c.getName() + " / Level" + c.getLevel() + " / " + getJobNameById(c.getJob()));
}
}
this.challengeinfo += "#k";
}
public MapleCharacter getChallenger() {
return this.challenger.get();
}
public String getChallengeInfo() {
return this.challengeinfo;
}
public static String getJobNameById(int job) {
switch (job) {
case 0:
case 1:
return "新手";
case 1000:
return "初心者";
case 2000:
return "战童";
case 2001:
return "小不点";
case 3000:
return "预备兵";
case 100:
return "战士";
case 110:
return "剑客";
case 111:
return "勇士";
case 112:
return "勇士";
case 120:
return "准骑士";
case 121:
return "骑士";
case 122:
return "骑士";
case 130:
return "枪战士";
case 131:
return "龙骑士";
case 132:
return "龙骑士";
case 200:
return "魔法师";
case 210:
return "火毒法师";
case 211:
return "火毒巫师";
case 212:
return "火毒巫师";
case 220:
return "冰雷法师";
case 221:
return "冰雷巫师";
case 222:
return "冰雷巫师";
case 230:
return "牧师";
case 231:
return "祭司";
case 232:
return "祭司";
case 300:
return "弓箭手";
case 310:
return "猎人";
case 311:
return "射手";
case 312:
return "射手";
case 320:
return "弩弓手";
case 321:
return "游侠";
case 322:
return "游侠";
case 400:
return "飞侠";
case 410:
return "刺客";
case 411:
return "无影人";
case 412:
return "无影人";
case 420:
return "侠客";
case 421:
return "独行客";
case 422:
return "独行客";
case 430:
return "见习刀客";
case 431:
return "双刀客";
case 432:
return "双刀侠";
case 433:
return "血刀";
case 434:
return "暗影双刀";
case 500:
return "海盗";
case 510:
return "拳手";
case 511:
return "斗士";
case 512:
return "冲锋队长";
case 520:
return "火枪手";
case 521:
return "大副";
case 522:
return "船长";
case 501:
return "海盗炮手";
case 530:
return "火炮手";
case 531:
return "毁灭炮手";
case 532:
return "神炮王";
case 508:
case 570:
case 571:
case 572:
return "龙的传人";
case 1100:
case 1110:
case 1111:
case 1112:
return "魂骑士";
case 1200:
case 1210:
case 1211:
case 1212:
return "炎术士";
case 1300:
case 1310:
case 1311:
case 1312:
return "风灵使者";
case 1400:
case 1410:
case 1411:
case 1412:
return "夜行者";
case 1500:
case 1510:
case 1511:
case 1512:
return "奇袭者";
case 2100:
case 2110:
case 2111:
case 2112:
return "战神";
case 2200:
case 2210:
case 2211:
case 2212:
case 2213:
case 2214:
case 2215:
case 2216:
case 2217:
case 2218:
return "龙神";
case 2002:
case 2300:
case 2310:
case 2311:
case 2312:
return "双弩精灵";
case 2003:
case 2400:
case 2410:
case 2411:
case 2412:
return "幻影";
case 2004:
case 2700:
case 2710:
case 2711:
case 2712:
return "夜光法师";
case 3001:
case 3100:
case 3110:
case 3111:
case 3112:
return "恶魔猎手";
case 3101:
case 3120:
case 3121:
case 3122:
return "恶魔复仇者";
case 3200:
case 3210:
case 3211:
case 3212:
return "幻灵斗师";
case 3300:
case 3310:
case 3311:
case 3312:
return "弩豹游侠";
case 3500:
case 3510:
case 3511:
case 3512:
return "机械师";
case 5000:
return "无名少年";
case 5100:
case 5110:
case 5111:
case 5112:
return "米哈尔";
case 6000:
case 6100:
case 6110:
case 6111:
case 6112:
return "狂龙战士";
case 6001:
case 6500:
case 6510:
case 6511:
case 6512:
return "爆莉萌天使";
case 3002:
case 3600:
case 3610:
case 3611:
case 3612:
return "尖兵";
case 10000:
case 10100:
case 10110:
case 10111:
case 10112:
return "神之子";
case 11000:
case 11200:
case 11210:
case 11211:
case 11212:
return "林之灵";
case 2005:
case 2500:
case 2510:
case 2511:
case 2512:
return "隐月";
case 900:
return "管理员";
case 910:
return "超级管理员";
case 800:
return "管理者";
}
return "";
}
public static String getJobBasicNameById(int job) {
switch (job) {
case 100:
case 110:
case 111:
case 112:
case 120:
case 121:
case 122:
case 130:
case 131:
case 132:
case 1100:
case 1110:
case 1111:
case 1112:
case 2100:
case 2110:
case 2111:
case 2112:
case 3100:
case 3101:
case 3110:
case 3111:
case 3112:
case 3120:
case 3121:
case 3122:
case 3600:
case 3610:
case 3611:
case 3612:
case 5100:
case 5110:
case 5111:
case 5112:
case 6100:
case 6110:
case 6111:
case 6112:
case 10100:
case 10110:
case 10111:
case 10112:
return "战士";
case 200:
case 210:
case 211:
case 212:
case 220:
case 221:
case 222:
case 230:
case 231:
case 232:
case 1200:
case 1210:
case 1211:
case 1212:
case 2200:
case 2210:
case 2211:
case 2212:
case 2213:
case 2214:
case 2215:
case 2216:
case 2217:
case 2218:
case 2700:
case 2710:
case 2711:
case 2712:
case 3200:
case 3210:
case 3211:
case 3212:
case 11200:
case 11210:
case 11211:
case 11212:
return "魔法师";
case 300:
case 310:
case 311:
case 312:
case 320:
case 321:
case 322:
case 1300:
case 1310:
case 1311:
case 1312:
case 2300:
case 2310:
case 2311:
case 2312:
case 3300:
case 3310:
case 3311:
case 3312:
return "射手";
case 400:
case 410:
case 411:
case 412:
case 420:
case 421:
case 422:
case 430:
case 431:
case 432:
case 433:
case 434:
case 1400:
case 1410:
case 1411:
case 1412:
return "飞侠";
case 500:
case 501:
case 508:
case 509:
case 510:
case 511:
case 512:
case 520:
case 521:
case 522:
case 530:
case 531:
case 532:
case 570:
case 571:
case 572:
case 580:
case 581:
case 582:
case 590:
case 591:
case 592:
case 1500:
case 1510:
case 1511:
case 1512:
case 3500:
case 3510:
case 3511:
case 3512:
case 6500:
case 6510:
case 6511:
case 6512:
return "海盗";
}
return "";
}
public static String getJobNameByIdNull(int job) {
switch (job) {
case 0:
case 1:
return "新手";
case 1000:
return "初心者";
case 2000:
return "战童";
case 2001:
return "小不点";
case 3000:
return "预备兵";
case 100:
return "战士";
case 110:
return "剑客";
case 111:
return "勇士";
case 112:
return "勇士";
case 120:
return "准骑士";
case 121:
return "骑士";
case 122:
return "骑士";
case 130:
return "枪战士";
case 131:
return "龙骑士";
case 132:
return "龙骑士";
case 200:
return "魔法师";
case 210:
return "火毒法师";
case 211:
return "火毒巫师";
case 212:
return "火毒巫师";
case 220:
return "冰雷法师";
case 221:
return "冰雷巫师";
case 222:
return "冰雷巫师";
case 230:
return "牧师";
case 231:
return "祭司";
case 232:
return "祭司";
case 300:
return "弓箭手";
case 310:
return "猎人";
case 311:
return "射手";
case 312:
return "射手";
case 320:
return "弩弓手";
case 321:
return "游侠";
case 322:
return "游侠";
case 400:
return "飞侠";
case 410:
return "刺客";
case 411:
return "无影人";
case 412:
return "无影人";
case 420:
return "侠客";
case 421:
return "独行客";
case 422:
return "独行客";
case 900:
return "管理员";
case 910:
return "超级管理员";
case 800:
return "管理者";
}
return null;
}
}
| akhuting/MapleStory-v27 | src/main/java/server/MapleCarnivalChallenge.java |
65,878 | package com.ousy.formlayoutmanager.entity;
import com.dnwalter.formlayoutmanager.entity.BaseFormModel;
public class Monster extends BaseFormModel {
/**
* name : 混沌战士
* attribute : 地
* lv : 8
* atk : 3000
* def : 2500
* race : 战士
* type1 : 仪式
* type2 : 效果
*/
private String name;
private String attribute;
private String lv;
private String atk;
private String def;
private String race;
private String type1;
private String type2;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAttribute() {
return attribute;
}
public void setAttribute(String attribute) {
this.attribute = attribute;
}
public String getLv() {
return lv;
}
public void setLv(String lv) {
this.lv = lv;
}
public String getAtk() {
return atk;
}
public void setAtk(String atk) {
this.atk = atk;
}
public String getDef() {
return def;
}
public void setDef(String def) {
this.def = def;
}
public String getRace() {
return race;
}
public void setRace(String race) {
this.race = race;
}
public String getType1() {
return type1;
}
public void setType1(String type1) {
this.type1 = type1;
}
public String getType2() {
return type2;
}
public void setType2(String type2) {
this.type2 = type2;
}
}
| dnwalter/FormLayoutManager | app/src/main/java/com/ousy/formlayoutmanager/entity/Monster.java |
65,879 | import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;
import cn.mxz.bag.BagSnapsort;
import cn.mxz.base.world.WorldFactory;
import cn.mxz.city.City;
import cn.mxz.city.CityFactory;
import cn.mxz.fighter.FighterSnapshoot;
import cn.mxz.prizecenter.PropIdCheck;
import cn.mxz.user.team.Team;
import cn.mxz.user.team.god.Hero;
import com.google.common.collect.Sets;
import db.dao.impl.DaoFactory;
import db.dao.impl.NewEquipmentDao2;
import db.dao.impl.UserGridDao2;
import db.dao.impl.UserPiecesGridDao2;
import db.domain.NewEquipment;
import db.domain.UserGrid;
import db.domain.UserPiecesGrid;
public class DropGoods {
public String run() {
return "RUN_FOUNCTION";
}
public void dropGoods(String user, String type) {
City city = getCity(user);
if (city == null) {
throw new RuntimeException("玩家不存在" + user);
}
if (type.equals("装备")) {
NewEquipmentDao2 dao = DaoFactory.getNewEquipmentDao();
List<NewEquipment> all = dao.findByUname(city.getId());
// System.out.println("xxxxxx" + all.size());
for (NewEquipment e : all) {
dao.delete(e);
}
city.reloadEquipmentManager();
return;
}
if (type.equals("魂魄")) {
List<db.domain.Spirite> alls = DaoFactory.getSpiriteDao()
.findByUname(city.getId());
for (db.domain.Spirite spirite : alls) {
DaoFactory.getSpiriteDao().delete(spirite);
}
city.reloadSpiriteManager();
return;
}
Set<String> set = Sets.newHashSet("战士", "所有神将", "所有战士", "神将", "全部战士",
"全部神将");
if (set.contains(type)) {
removeAllFighter(city);
} else {
int id = PropIdCheck.getId(type);
dropPropInBag(city, id);// 移除物品
dropFighter(city, id);// 移除神将
dropSpirite(city, id);// 移除魂魄
dropSkill(city, id); // 移除技能
}
}
private void removeAllFighter(City city) {
FighterSnapshoot s = new FighterSnapshoot(city);
s.snapshoot();
Collection<Hero> all = city.getTeam().getAll();
for (Hero hero : all) {
if (!hero.isPlayer()) {
city.getTeam().remove(hero);
}
}
s.snapshoot();
}
private void dropSkill(City city, int id) {
city.getSkillManager().removeByIds(id);
}
private void dropSpirite(City city, int id) {
city.getSpiriteManager().remove(id);
}
private void dropFighter(City city, int id) {
FighterSnapshoot s = new FighterSnapshoot(city);
s.snapshoot();
Team team = city.getTeam();
Hero hero = team.get(id);
if (hero.isPlayer()) {
return;
}
team.remove(id);
s.snapshoot();
}
private void dropPropInBag(City city, int id) {
BagSnapsort b1 = new BagSnapsort();
BagSnapsort b2 = new BagSnapsort();
b1.snapsort(city.getBag());
b2.snapsort(city.getPiecesBag());
UserGridDao2 dao = DaoFactory.getUserGridDao();
List<UserGrid> all = dao.findByUname(city.getId());
for (UserGrid g : all) {
if (g.getTypeid() == id) {
dao.delete(g);
}
}
UserPiecesGridDao2 d = DaoFactory.getUserPiecesGridDao();
List<UserPiecesGrid> aa = d.findByUname(city.getId());
for (UserPiecesGrid g : aa) {
if (g.getTypeid() == id) {
d.delete(g);
}
}
city.freeBag();
city.freePiecesBag();
b1.snapsort(city.getBag());
b2.snapsort(city.getPiecesBag());
}
/**
* 根据 昵称 或者 id 获取用户
*/
private City getCity(String user) {
City city = CityFactory.getCity(user);
if (city != null) {
return city;
}
Map<String, String> all = WorldFactory.getWorld().getNickManager()
.getNickAll();
String id = all.get(user);
if (id == null) {
return null;
}
return getCity(id);
}
} | fantasylincen/javaplus | mxz-qq-robot/src/main/resources/DropGoods.java |
65,880 | package com.tradition;
import com.tradition.repository.adventurer;
import com.tradition.controller.adventFactory;
/**
* <p>Description : design-pattern-module
* <p>Date : 2017/10/18 5:23
* <p>@author : Matrix [[email protected]]
*/
public class Client {
public static void main(String[] args) {
//通过冒险者工厂实例化出战士,冰霜法师,牧师
adventurer warrior = adventFactory.createAdventurer("战士");
adventurer frostMage = adventFactory.createAdventurer("冰霜法师");
adventurer priest = adventFactory.createAdventurer("牧师");
//进入火焰洞窟
System.out.println("================进入火焰洞窟================");
warrior.useBattleSkill();
frostMage.useBattleSkill();
priest.useBattleSkill();
}
}
| xhyrzldf/design-patterns | simple-factory-mode/src/main/java/com/tradition/Client.java |
65,881 | package com.pwrd.war.db.model;
import javax.persistence.Column;
import javax.persistence.MappedSuperclass;
@MappedSuperclass
public class RoleEntity {
private int level = 1; //等级
private String name; //名称
private int vocation ; //职业 (战士,术师,侠隐,刺客,圣手)
private int sex ; //性别 (男、女)
private int grow; //特有成长度
//
private double curHp = 0; //当前血量
private int curExp = 0; //当前经验
private int maxExp = 0; //升级经验
private double maxHp = 0; //血量上限
//一级属性
private double atk = 0; //攻击
private double def = 0; //防御
private double cri = 0; //暴击
private double spd = 0; //速度
//特殊属性
private double shanbi; //闪避
private double shanghai; //伤害
private double mianshang; //免伤
private double fanji; //反击
private double mingzhong; //命中
private double lianji; //连击
private double zhandouli; //战斗力
private double renxing; //韧性
private String skeletonId; //骨骼
// private String avatar; //头像
/** 阵营 */
private int camp;
private int maxGrow; //最大成长
private int transferLevel; //转职等级
private int transferstar;//星等级
private int transferExp;//经验
private String skill1;
private String skill2;
private String skill3;
private String petSkill;
private String passSkill1;
private String passSkill2;
private String passSkill3;
private String passSkill4;
private String passSkill5;
private String passSkill6;
private int passSkillLevel1;
private int passSkillLevel2;
private int passSkillLevel3;
private int passSkillLevel4;
private int passSkillLevel5;
private int passSkillLevel6;
/*******************************/
/** buff攻击 **/
private double buffAtk;
/** buff防御 **/
private double buffDef;
/** buff最大血量 **/
private double buffMaxHp;
/**************************/
private int maxHpLevel;
//攻击研究等级")
private int atkLevel;
//防御研究等级")
private int defLevel;
//近程攻击研究等级")
private int shortAtkLevel;
//近程防御研究等级")
private int shortDefLevel;
//远程攻击研究等级")
private int remoteAtkLevel;
//远程防御研究等级")
private int remoteDefLevel;
//近程攻击
private double shortAtk;
//近程防御
private double shortDef;
//远程攻击
private double remoteAtk;
//远程防御
private double remoteDef;
//暴击伤害
private double criShanghai;
@Column(columnDefinition = " int default 1", nullable = false)
public int getLevel() {
return level;
}
public void setLevel(int level) {
this.level = level;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public double getCurHp() {
return curHp;
}
public void setCurHp(double curHp) {
this.curHp = curHp;
}
public double getMaxHp() {
return maxHp;
}
public void setMaxHp(double maxHp) {
this.maxHp = maxHp;
}
public int getCurExp() {
return curExp;
}
public void setCurExp(int curExp) {
this.curExp = curExp;
}
public int getMaxExp() {
return maxExp;
}
public void setMaxExp(int maxExp) {
this.maxExp = maxExp;
}
public void setAtk(int atk) {
this.atk = atk;
}
public void setDef(int def) {
this.def = def;
}
public int getVocation() {
return vocation;
}
public void setVocation(int vocation) {
this.vocation = vocation;
}
public int getSex() {
return sex;
}
public void setSex(int sex) {
this.sex = sex;
}
public int getCamp() {
return camp;
}
public void setCamp(int camp) {
this.camp = camp;
}
public String getSkeletonId() {
return skeletonId;
}
public void setSkeletonId(String skeletonId) {
this.skeletonId = skeletonId;
}
public double getAtk() {
return atk;
}
public void setAtk(double atk) {
this.atk = atk;
}
public double getDef() {
return def;
}
public void setDef(double def) {
this.def = def;
}
public double getCri() {
return cri;
}
public void setCri(double cri) {
this.cri = cri;
}
public double getSpd() {
return spd;
}
public void setSpd(double spd) {
this.spd = spd;
}
public double getShanbi() {
return shanbi;
}
public void setShanbi(double shanbi) {
this.shanbi = shanbi;
}
public double getShanghai() {
return shanghai;
}
public void setShanghai(double shanghai) {
this.shanghai = shanghai;
}
public double getMianshang() {
return mianshang;
}
public void setMianshang(double mianshang) {
this.mianshang = mianshang;
}
public double getFanji() {
return fanji;
}
public void setFanji(double fanji) {
this.fanji = fanji;
}
public double getMingzhong() {
return mingzhong;
}
public void setMingzhong(double mingzhong) {
this.mingzhong = mingzhong;
}
public double getLianji() {
return lianji;
}
public void setLianji(double lianji) {
this.lianji = lianji;
}
public double getZhandouli() {
return zhandouli;
}
public void setZhandouli(double zhandouli) {
this.zhandouli = zhandouli;
}
public int getGrow() {
return grow;
}
public void setGrow(int grow) {
this.grow = grow;
}
public String getSkill1() {
return skill1;
}
public void setSkill1(String skill1) {
this.skill1 = skill1;
}
public String getSkill2() {
return skill2;
}
public void setSkill2(String skill2) {
this.skill2 = skill2;
}
public String getSkill3() {
return skill3;
}
public void setSkill3(String skill3) {
this.skill3 = skill3;
}
public String getPetSkill() {
return petSkill;
}
public void setPetSkill(String petSkill) {
this.petSkill = petSkill;
}
public double getBuffAtk() {
return buffAtk;
}
public void setBuffAtk(double buffAtk) {
this.buffAtk = buffAtk;
}
public double getBuffDef() {
return buffDef;
}
public void setBuffDef(double buffDef) {
this.buffDef = buffDef;
}
public double getBuffMaxHp() {
return buffMaxHp;
}
public void setBuffMaxHp(double buffMaxHp) {
this.buffMaxHp = buffMaxHp;
}
public int getMaxGrow() {
return maxGrow;
}
public void setMaxGrow(int maxGrow) {
this.maxGrow = maxGrow;
}
public int getTransferLevel() {
return transferLevel;
}
public void setTransferLevel(int transferLevel) {
this.transferLevel = transferLevel;
}
public String getPassSkill1() {
return passSkill1;
}
public void setPassSkill1(String passSkill1) {
this.passSkill1 = passSkill1;
}
public String getPassSkill2() {
return passSkill2;
}
public void setPassSkill2(String passSkill2) {
this.passSkill2 = passSkill2;
}
public String getPassSkill3() {
return passSkill3;
}
public void setPassSkill3(String passSkill3) {
this.passSkill3 = passSkill3;
}
public String getPassSkill4() {
return passSkill4;
}
public void setPassSkill4(String passSkill4) {
this.passSkill4 = passSkill4;
}
public int getAtkLevel() {
return atkLevel;
}
public void setAtkLevel(int atkLevel) {
this.atkLevel = atkLevel;
}
public int getDefLevel() {
return defLevel;
}
public void setDefLevel(int defLevel) {
this.defLevel = defLevel;
}
public int getShortAtkLevel() {
return shortAtkLevel;
}
public void setShortAtkLevel(int shortAtkLevel) {
this.shortAtkLevel = shortAtkLevel;
}
public int getShortDefLevel() {
return shortDefLevel;
}
public void setShortDefLevel(int shortDefLevel) {
this.shortDefLevel = shortDefLevel;
}
public int getRemoteAtkLevel() {
return remoteAtkLevel;
}
public void setRemoteAtkLevel(int remoteAtkLevel) {
this.remoteAtkLevel = remoteAtkLevel;
}
public int getRemoteDefLevel() {
return remoteDefLevel;
}
public void setRemoteDefLevel(int remoteDefLevel) {
this.remoteDefLevel = remoteDefLevel;
}
public double getShortAtk() {
return shortAtk;
}
public void setShortAtk(double shortAtk) {
this.shortAtk = shortAtk;
}
public double getShortDef() {
return shortDef;
}
public void setShortDef(double shortDef) {
this.shortDef = shortDef;
}
public double getRemoteAtk() {
return remoteAtk;
}
public void setRemoteAtk(double remoteAtk) {
this.remoteAtk = remoteAtk;
}
public double getRemoteDef() {
return remoteDef;
}
public void setRemoteDef(double remoteDef) {
this.remoteDef = remoteDef;
}
public int getMaxHpLevel() {
return maxHpLevel;
}
public void setMaxHpLevel(int maxHpLevel) {
this.maxHpLevel = maxHpLevel;
}
public String getPassSkill5() {
return passSkill5;
}
public void setPassSkill5(String passSkill5) {
this.passSkill5 = passSkill5;
}
public String getPassSkill6() {
return passSkill6;
}
public void setPassSkill6(String passSkill6) {
this.passSkill6 = passSkill6;
}
public int getTransferstar() {
return transferstar;
}
public void setTransferstar(int transferstar) {
this.transferstar = transferstar;
}
public int getTransferExp() {
return transferExp;
}
public void setTransferExp(int transferExp) {
this.transferExp = transferExp;
}
public int getPassSkillLevel1() {
return passSkillLevel1;
}
public void setPassSkillLevel1(int passSkillLevel1) {
this.passSkillLevel1 = passSkillLevel1;
}
public int getPassSkillLevel2() {
return passSkillLevel2;
}
public void setPassSkillLevel2(int passSkillLevel2) {
this.passSkillLevel2 = passSkillLevel2;
}
public int getPassSkillLevel3() {
return passSkillLevel3;
}
public void setPassSkillLevel3(int passSkillLevel3) {
this.passSkillLevel3 = passSkillLevel3;
}
public int getPassSkillLevel4() {
return passSkillLevel4;
}
public void setPassSkillLevel4(int passSkillLevel4) {
this.passSkillLevel4 = passSkillLevel4;
}
public int getPassSkillLevel5() {
return passSkillLevel5;
}
public void setPassSkillLevel5(int passSkillLevel5) {
this.passSkillLevel5 = passSkillLevel5;
}
public int getPassSkillLevel6() {
return passSkillLevel6;
}
public void setPassSkillLevel6(int passSkillLevel6) {
this.passSkillLevel6 = passSkillLevel6;
}
public double getRenxing() {
return renxing;
}
public void setRenxing(double renxing) {
this.renxing = renxing;
}
public double getCriShanghai() {
return criShanghai;
}
public void setCriShanghai(double criShanghai) {
this.criShanghai = criShanghai;
}
}
| uin57/webgame | game_db/src/com/pwrd/war/db/model/RoleEntity.java |
65,882 | // 按两次 Shift 打开“随处搜索”对话框并输入 `show whitespaces`,
// 然后按 Enter 键。现在,您可以在代码中看到
import java.sql.SQLOutput;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
role s1=new role();
role s2=new role("兴佳",500,20,10,40,10,100,300);
System.out.println("请选择职业");
System.out.println("*****1.战士******");
System.out.println("*****2.法师******");
System.out.println("*****3.射手******");
int a=sc.nextInt();
switch(a){
case 1:{
s1.setrole("焕杰",500,10,5,30,15,100,100);
break;
}
case 2:{
s1.setrole("焕杰",300,40,5,50,5,300,100);
break;
}
case 3:{
s1.setrole("焕杰",300,50,30,50,5,100,100);
break;
}
}
while(true){
System.out.println("***** 选择 *****");
System.out.println("*****1.普攻*****");
System.out.println("*****2.防御*****");
System.out.println("*****使用药剂*****");
int b=sc.nextInt();
switch(b){
case 1: {
s1.attack(s2);
break;
}
case 2:{
s1.setdefenses(true);
break;
}
case 3:{
s1.Ubloodnum(s1);
break;
}
}
if (win(s2.getblood())) {
s1.setG(s1.getG() + s2.getG());
System.out.println(s1.getname() + "win");
break;
}
s2.attack(s1);
s1.setdefenses(false);
if(win(s1.getblood())) {
System.out.println(s2.getname() + "win");
break;
}
}
}
public static boolean win(int blood){
if(blood==0)
return true;
return false;
}
} | MindbniM/tensetusnoyume | 文字游戏/Main.java |
65,883 | package com.hifun.soul.gameserver.role;
import java.util.HashMap;
import java.util.Map;
import com.hifun.soul.core.enums.IndexedEnum;
/**
*
* 角色类型
*
* @author magicstone
*
*/
public enum Occupation implements IndexedEnum {
/** 战士 */
WARRIOR((short) 1),
/** 游侠 */
RANGER((short) 2),
/** 法师 */
MAGICIAN((short) 4);
/** 注意:添加新的职业时,type值应设置为2的幂次方形式,便于按位操作 */
private short type;
private static Map<Integer, Occupation> types = new HashMap<Integer, Occupation>();
static {
for (Occupation each : Occupation.values()) {
types.put(each.getIndex(), each);
}
}
Occupation(short type) {
this.type = type;
}
public short getType() {
return type;
}
@Override
public int getIndex() {
return this.getType();
}
public static Occupation typeOf(int type) {
return types.get(type);
}
}
| kkme/server | game_server/src/com/hifun/soul/gameserver/role/Occupation.java |
65,884 | package io.github.kongpf8848.pattern.decorator.game;
public class Worrior implements Avatar {
@Override
public String getDescription() {
return "战士";
}
}
| kongpf8848/pattern | src/main/java/io/github/kongpf8848/pattern/decorator/game/Worrior.java |
65,885 | package com.hh.mmorpg.domain;
public enum OccupationEmun {
MONSTER(-2, "怪物技能"),
NONE(-1, "通用技能"),
MASTER(1, "法师"),
SUMMONER(2, "召唤师"),
WARRIOR(3, "战士");
private int id;
private String name;
private OccupationEmun(int id, String name) {
this.id = id;
this.name = name;
}
public static OccupationEmun getOccupationEmun(int id) {
for (OccupationEmun occupationEmun : OccupationEmun.values()) {
if (occupationEmun.getId() == id) {
return occupationEmun;
}
}
return null;
}
public int getId() {
return id;
}
public String getName() {
return name;
}
}
| xhxPanda/mmorpg-xiehongxin | src/main/java/com/hh/mmorpg/domain/OccupationEmun.java |
65,886 | package cn.LTCraft.core.task;
import java.util.HashMap;
import java.util.Map;
public enum PlayerClass {
ASSASSIN("刺客"),
WARRIOR("战士"),
MASTER("法师"),
MINISTER("牧师"),
NONE("无职业");
private static final Map<String, PlayerClass> BY_NAME = new HashMap<>();
static {
PlayerClass[] classes = values();
for (PlayerClass aClass : classes) {
BY_NAME.put(aClass.getName(), aClass);
}
}
private final String name;
PlayerClass(String name){
this.name = name;
}
/**
* 获取职业名字
* @return 职业名字
*/
public String getName() {
return name;
}
@Override
public String toString() {
return name;
}
/**
* 通过名字查找职业
* @param name 职业名字
* @return 职业
*/
public static PlayerClass byName(String name){
return BY_NAME.get(name);
}
}
| smallXueTu/RPG_Server | LTCraft/src/main/java/cn/LTCraft/core/task/PlayerClass.java |
65,887 | package Homework3_1;
import java.util.Scanner;
public class Adventure {
public void ChooseCharacter(){
Scanner sc = new Scanner(System.in);
System.out.println("————角色选择界面————");
System.out.println("目前只有两个角色TuT");
Warrior warrior = new Warrior("战士",0,150,30,2,15,5);
System.out.println("1、" + warrior.getName() + "等级:" + warrior.getLevel() + "血量:" + warrior.getHP()
+ "蓝量:" + warrior.getMP() + "攻击:" + warrior.getATK() +
"防御:" + warrior.getDEF() + "闪避:" + warrior.getSP() );
PhysicalWeapon physicalWeapon = new PhysicalWeapon("木剑",3,0);
System.out.println(physicalWeapon.use());
System.out.println("——————————————————————————————————————————");
Mage mage = new Mage("法师",0,100,50,2,7,3);
System.out.println("2、" + mage.getName() + "等级:" + mage.getLevel() + "血量:" + mage.getHP() +
"蓝量:" + mage.getMP() + "攻击:" + mage.getATK() +
"防御:" + mage.getDEF() + "闪避:" + mage.getSP());
MagicWeapomn magicWeapomn = new MagicWeapomn("木法杖",3,0);
System.out.println(magicWeapomn.use());
System.out.println("现在请做出你的选择: ");
int choose = sc.nextInt();
switch (choose){
case 1:
Travel1();
break;
case 2:
Travel2();
break;
default:
break;
}
}
public void Travel1() {
System.out.println("————游历功能————");
System.out.println("关卡1");
Enemy enemy = new Enemy("饥饿的野狗",75,10,10,3);
Warrior warrior = new Warrior("战士",0,150,30,2,15,5);
System.out.println( "你在外闲逛时意外碰到了" + enemy.getName() +
"," + enemy.getName() + "向你冲过来");
System.out.println("战斗开始—————");
while(warrior.getHP() > 0 && enemy.getHp() > 0) {
int damage1 = warrior.getATK() - enemy.getDEF();
int damage2 = enemy.getATK() - warrior.getDEF();
System.out.println("你向" + enemy.getName()+ "发起攻击,并对其造成" + damage1
+ "点伤害值");
enemy.setHp(enemy.getHp() - damage1);
if (enemy.getHp() <=0){
System.out.println("你击败了" + enemy.getName());
}else {
System.out.println(enemy.getName() + "向你反击,并造成了" + damage2
+ "点伤害");
warrior.setHP(warrior.getHP() - damage2);
if (warrior.getHP() <= 0){
System.out.println("你被击败了,请多试试吧~");
}
}
}
}
public void Travel2() {
Enemy enemy = new Enemy("饥饿的野狗",75,10,10,3);
Mage mage = new Mage("法师",0,100,50,2,7,3);
System.out.println( "你在外闲逛时意外碰到了" + enemy.getName() +
"," + enemy.getName() + "向你冲过来");
System.out.println("战斗开始—————");
while(mage.getHP() > 0 && enemy.getHp() > 0) {
int damage1 = mage .getATK() - enemy.getDEF();
int damage2 = enemy.getATK() - mage.getDEF();
System.out.println("你向" + enemy.getName()+ "发起攻击,并对其造成" + damage1
+ "点伤害值");
enemy.setHp(enemy.getHp() - damage1);
if (enemy.getHp() <=0){
System.out.println("你击败了" + enemy.getName());
}else {
System.out.println(enemy.getName() + "向你反击,并造成了" + damage2
+ "点伤害");
mage.setHP(mage.getHP() - damage2);
if (mage.getHP() <= 0){
System.out.println("你被击败了,请多试试吧~");
}
}
}
}
}
| zxyii/LanShan_Homework | Homework3_1/Adventure.java |
65,888 | package com.mcylm.coi.realm.tools.building.impl;
import com.mcylm.coi.realm.Entry;
import com.mcylm.coi.realm.model.COINpc;
import com.mcylm.coi.realm.tools.building.COIBuilding;
import com.mcylm.coi.realm.tools.building.config.BuildingConfig;
import com.mcylm.coi.realm.tools.npc.COICartCreator;
import com.mcylm.coi.realm.tools.npc.COIMinerCreator;
import com.mcylm.coi.realm.tools.npc.COISoldierCreator;
import com.mcylm.coi.realm.tools.npc.impl.COICart;
import com.mcylm.coi.realm.tools.npc.impl.COIMiner;
import com.mcylm.coi.realm.tools.npc.impl.COISoldier;
import com.mcylm.coi.realm.utils.GUIUtils;
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
import me.libraryaddict.disguise.disguisetypes.watchers.PlayerWatcher;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.attribute.Attribute;
import org.bukkit.attribute.AttributeInstance;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.scheduler.BukkitRunnable;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
* 军营
* 可以生成战士
*/
public class COICamp extends COIBuilding {
public COICamp() {
initStructure();
// 默认等级为1
setLevel(1);
// 初始化NPC创建器
setNpcCreators(List.of(initSoldierCreator(1), initSoldierCreator(2), initSoldierCreator(3)));
//初始化完成,可建造
setAvailable(true);
}
@Override
public BuildingConfig getDefaultConfig() {
return new BuildingConfig()
.setMaxLevel(10)
.setMaxBuild(10)
.setConsume(256)
.setStructures(getBuildingLevelStructure());
}
@Override
public void buildSuccess(Location location, Player player) {
super.buildSuccess(location, player);
for (COINpc creator : getNpcCreators()) {
// 必须是符合建筑等级的要求的
if(creator.getRequiredBuildingLevel() == getLevel()){
COISoldierCreator npcCreator = (COISoldierCreator) creator;
// 设置NPC跟随创造建筑的玩家
npcCreator.setFollowPlayerName(player.getName());
// 初始化
COISoldier soldier = new COISoldier(npcCreator);
soldier.spawn(creator.getSpawnLocation());
// 仅用于跟随的 Commander
soldier.setCommander(player);
}
}
}
@Override
public void upgradeBuildSuccess() {
super.upgradeBuildSuccess();
for (COINpc creator : getNpcCreators()) {
// 判断是否符合NPC生成条件
if(creator.getRequiredBuildingLevel() == getLevel()){
COISoldierCreator npcCreator = (COISoldierCreator) creator;
// 设置NPC跟随创造建筑的玩家
npcCreator.setFollowPlayerName(getBuildPlayerName());
// 初始化
COISoldier soldier = new COISoldier(npcCreator);
soldier.spawn(creator.getSpawnLocation());
// 仅用于跟随的 Commander
Player player = Bukkit.getPlayer(getBuildPlayerName());
soldier.setCommander(player);
}
}
}
/**
* 构造一个战士NPC创建器
* @return
*/
private COISoldierCreator initSoldierCreator(int level){
// 背包内的物品
Inventory inventory = GUIUtils.createNpcInventory(3);
// inventory.addItem(new ItemStack(new Random().nextBoolean() ? Material.CROSSBOW : Material.IRON_SWORD));
inventory.addItem(new ItemStack(Material.LEATHER_HELMET));
// 不破坏方块
Set<String> breakBlockMaterials = new HashSet<>();
// 捡起的东西
Set<String> pickItemMaterials = new HashSet<>();
pickItemMaterials.add("APPLE");
pickItemMaterials.add("BREAD");
// 将装备默认设为捡起
List<Material> clothes = COINpc.CLOTHES;
for(Material clothesType : clothes){
pickItemMaterials.add(clothesType.name());
}
// 战士会主动攻击的怪物实体类型
HashSet<EntityType> enemyEntities = new HashSet<>();
enemyEntities.add(EntityType.ZOMBIE);
COISoldierCreator npcCreator = new COISoldierCreator();
npcCreator.setRequiredBuildingLevel(level);
npcCreator.setNpcType(EntityType.PILLAGER);
npcCreator.setDisguiseType(DisguiseType.PLAYER);
npcCreator.setInventory(inventory);
npcCreator.setAggressive(true);
npcCreator.setAlertRadius(10);
npcCreator.setBreakBlockMaterials(breakBlockMaterials);
npcCreator.setName("战士");
npcCreator.setLevel(1);
npcCreator.setPickItemMaterials(pickItemMaterials);
npcCreator.setEnemyEntities(enemyEntities);
npcCreator.setFlagWatcherHandler(flagWatcher -> {
PlayerWatcher playerWatcher = (PlayerWatcher) flagWatcher;
playerWatcher.setSkin("greatapedude");
});
return npcCreator;
}
/**
* 初始化设置矿场的建筑等级对照表
*/
private void initStructure(){
for(int i = 0;i<=100;i++){
getBuildingLevelStructure().put(i, "junying1.structure");
}
}
@Override
public int getMaxHealth() {
return 300 + getLevel() * 50;
}
}
| Clayun/coi-realm | src/main/java/com/mcylm/coi/realm/tools/building/impl/COICamp.java |
65,889 | import Debuff.Debuff;
import Debuff.NoDebuff;
import java.util.Random;
public class Weapon extends EquipLoader {
private final String weaponName;
private final int weaponDamage;
private String weaponType;
private Debuff weaponDebuff;
private int triggerThreshold;
private Random random;
public Weapon(String name, int damage, String type) {
this.weaponName = name;
this.weaponDamage = damage;
this.weaponType = type;
this.weaponDebuff = null;
this.triggerThreshold = 100;
this.charactor = null;
this.random = null;
}
public String getWeaponName() {
return weaponName;
}
public int getWeaponDamage() {
return weaponDamage;
}
public String getWeaponType() {
return weaponType;
}
@Override
public void setCharactor(Charactor charactor) throws Exception {
if (isWeaponSuitable(charactor)) {
super.setCharactor(charactor);
} else {
throw new Exception("玩家职业和该武器不匹配!");
}
}
public void setWeaponDebuff(Debuff debuff, int threshold) {
this.weaponDebuff = debuff;
this.triggerThreshold = threshold;
}
public void setWeaponDebuff(Debuff debuff, int threshold, Random random) {
this.weaponDebuff = debuff;
this.triggerThreshold = threshold;
this.random = random;
}
@Override
public String getAttackInfo() {
return String.format("%s用%s", super.getAttackInfo(), getWeaponName());
}
public String attack(Player victim) {
if (charactor.debuff != null && (charactor.debuff.getDebuffName().equals("冰冻伤害") || charactor.debuff.getDebuffName().equals("击晕伤害")) && charactor.debuff.getDebuffRounds() > 0) {
charactor.debuff.setDebuffRounds(charactor.debuff.getDebuffRounds() - 1);
return "";
} else {
if (charactor != null) {
if (this.random == null) {
random = new Random();
}
int damageValue = charactor.getDamage() + weaponDamage;
if (weaponDebuff != null && triggerDebuff(random) && isDebuffSuitable(charactor)) { // damage: player + weapon + debuff
DamageWithDebuff damageWithDebuff = new DamageWithDebuff(damageValue, this.weaponDebuff);
damageWithDebuff.setInfo(charactor.name);
return String.format("%s攻击了%s,%s", getAttackInfo(), victim.getBeAttackedInfo(), victim.beAttacked(damageWithDebuff));
} else if(victim.debuff != null) {
DamageWithDebuff damageWithDebuff = new DamageWithDebuff(damageValue, NoDebuff.getInstance());
return String.format("%s攻击了%s,%s", getAttackInfo(), victim.getBeAttackedInfo(), victim.beAttacked(damageWithDebuff));
} else { // damage: player + weapon
return String.format("%s攻击了%s,%s", getAttackInfo(), victim.getBeAttackedInfo(), victim.beAttacked(damageValue));
}
} else { // damage: player
return charactor.attack(victim);
}
}
}
public boolean triggerDebuff(Random random) {
if (((random.nextInt(99) + 1)) >= triggerThreshold) {
return true;
} else {
return false;
}
}
public boolean isWeaponSuitable(Charactor charactor) {
if ((charactor.getType() == "战士" && this.weaponType == "中") || (charactor.getType() == "刺客" && (this.weaponType == "中" || this.weaponType == "短")) || (charactor.getType() == "骑士" && (this.weaponType == "中" || this.weaponType == "长"))) {
return true;
} else {
return false;
}
}
public boolean isDebuffSuitable(Charactor charactor) {
if ((charactor.getType() == "战士" && this.weaponType == "中") || (charactor.getType() == "刺客" && this.weaponType == "短") || (charactor.getType() == "骑士" && this.weaponType == "长")) {
return true;
} else {
return false;
}
}
}
| Sasa33/TW-Arena | src/main/java/Weapon.java |
65,890 | package com.baidou;
abstract class Role {
private String name;
public abstract int attack();
//获得名字
public String getName() {
return name;
}
@Override
public String toString() {
return "name='" + name + '\''+",";
}
//设置名字
public void setName(String name) {
this.name = name;
}
}
class Magicer extends Role{
private int level;
public int getLevel() {
return level;
}
@Override
public String toString() {
return "Magicer{" +super.toString()+
"level=" + level +
'}';
}
//设置魔法等级
public void setLevel(int level) {
if (level<=10&&level>=1){
this.level = level;
}else return;
}
//魔法师伤害数值
@Override
public int attack() {
return level*5;
}
}
class Soldier extends Role{
private int hurt;
public void setHurt(int hurt) {
this.hurt = hurt;
}
//战士伤害
@Override
public int attack() {
return hurt;
}
@Override
public String toString() {
return "Soldier{" +super.toString()+
"hurt=" + hurt +
'}';
}
}
class Team {
private Role[] roles=new Role[6];
private int i=0;
//添加成员模块
public void addMember(Role role){
if (this.i<=6){
roles[i]=role;
this.i++;
}else return;
}
//总伤害模块
public int attackSum(){
int sum=0;
for (Role role:roles) {
if (role instanceof Magicer){
Magicer magicer=(Magicer)role;
sum+=magicer.attack();
}else if (role instanceof Soldier){
Soldier soldier=(Soldier)role;
sum+=soldier.attack();
}else continue;
}
return sum;
}
//统计成员模块
public void members(){
int i=0;
Role[] roles=new Role[6];
for (Role role:this.roles) {
if (role instanceof Magicer){
Magicer magicer=(Magicer)role;
roles[i]=magicer;
i++;
}else if (role instanceof Soldier){
Soldier soldier=(Soldier)role;
roles[i]=soldier;
i++;
}else break;
}
for (Role role:roles) {
if (role!=null) {
System.out.println(role);
}else break;
}
}
}
public class Demo11 {
public static void main(String[] args) {
//创建魔法师、战士、队伍的对象
Magicer magicer = new Magicer();
Soldier soldier = new Soldier();
Team team = new Team();
//设置魔法师的名字和
magicer.setName("甘道夫");
magicer.setLevel(5);
soldier.setName("战士");
soldier.setHurt(90);
//把成员加入队伍
team.addMember(magicer);
team.addMember(soldier);
//列出小组成员
System.out.println("该小队成员为:");
team.members();
//列出小组的伤害
System.out.print("该小队伤害为:");
System.out.print(team.attackSum());
}
} | sakurajh/java | Demo11.java |
65,892 | package com.tw.game.player;
import com.google.common.base.Optional;
import com.tw.game.armor.Armor;
import com.tw.game.weapon.MiddleWeapon;
import com.tw.game.weapon.Weapon;
/**
* 战士只能装备 中 武器
* */
public class Solider extends NormalPlayer {
private Weapon weapon;
private Armor armor;
public Solider(String name, int blood, int attack, Weapon weapon, Armor armor) {
super(name, blood, attack);
this.job = "战士";
this.weapon = weapon;
this.armor = armor;
this.defense = this.armor.getDefense();
}
@Override
public void dropBlood(NormalPlayer player2) {
int droppedBlood;
if(player2 instanceof Solider){
droppedBlood = this.getAttack() - player2.getDefense();
}else{
droppedBlood = this.getAttack();
}
if(weapon.hasFeature() && weapon.getWeaponFeature().getType().equals("tripleDamage")){
droppedBlood *= 3;
}
player2.setBlood(player2.getBlood() - droppedBlood);
}
@Override
public boolean hasWeapon() {
return true;
}
@Override
public boolean hasArmor() {
return true;
}
@Override
public Optional<Weapon> getWeapon() {
return Optional.of(this.weapon);
}
@Override
public Optional<Armor> getArmor() {
return Optional.of(this.armor);
}
@Override
public int getAttack() {
return this.getWeapon().get().getAttack() + super.getAttack();
}
@Override
public int getDefense() {
return getArmor().get().getDefense();
}
@Override
public String getWeaponExtraEffect() {
if(weapon instanceof MiddleWeapon){
return weapon.extraEffect();
}
return "";
}
}
| QiannanXu/WhistGame | src/main/java/com/tw/game/player/Solider.java |
65,894 | /**
* 作者:余秀良
* 时间:2015年 02月 06日 下午5:18
* 地点:成都
* 描述:战士
* 备注:
*/
public class Soldier extends Person {
private Weapons weapons;
private Defense defense;
public static final String ROLE = "战士";
public static String getRole() {
return ROLE;
}
public Weapons getWeapons() {
return weapons;
}
public void setWeapons(Weapons weapons) {
this.weapons = weapons;
}
public Defense getDefense() {
return defense;
}
public void setDefense(Defense defense) {
this.defense = defense;
}
public Soldier(String name, int blood, int attack, Weapons weapons, Defense defense) {
super(name, blood, attack);
this.weapons = weapons;
this.defense = defense;
}
private int damage() {
return this.getAttack() + this.weapons.getAttack();
}
@Override
public String attack(Person person) {
person.setBlood(person.getBlood() - this.getAttack() - this.weapons.getAttack());
return this.getAttackName(person);
}
@Override
protected String getAttackName(Person person) {
return this.ROLE + this.getName() + "用" + this.weapons.getName() + "攻击了" + person.ROLE + person.getName() + "," + person.getName() + "受到了" + person.getDamage(this.damage()) + "点伤害,剩余血量" + person.getBlood();
}
}
| yuxiuliang/git | java/maven/src/main/java/Soldier.java |
65,895 | package org.example.card.ccg.warrior.spell;
import lombok.Getter;
import lombok.Setter;
import org.example.card.FollowCard;
import org.example.card.SpellCard;
import org.example.constant.EffectTiming;
import org.example.game.Effect;
import org.example.game.Play;
import org.example.system.util.Lists;
import java.util.List;
@Getter
@Setter
public class Chew extends SpellCard {
public Integer cost = 1;
public String name = "咀嚼";
public String job = "战士";
private List<String> race = Lists.ofStr();
public String mark = """
破坏场上一名随从
直至下回合结束前,我方主战者获得【受伤时:由其所有者召还该随从】
""";
public String subMark = "";
private FollowCard followCard = null;
public void init() {
setPlay(new Play(()->info.getAreaFollowsAsGameObj(),
true,
target->{
followCard = (FollowCard) target;
destroy(followCard);
ownerLeader().addEffect(new Effect(this, ownerLeader(), EffectTiming.AfterLeaderDamaged,3,
obj-> followCard!=null,
obj->{
followCard.ownerPlayer().recall(followCard);
}),false);
}
));
}
}
| 476106017/ccg4j | src/main/java/org/example/card/ccg/warrior/spell/Chew.java |
65,896 | package net.jquant.model;
import com.google.common.collect.Maps;
import net.jquant.common.Utils;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* author: eryk
* mail: [email protected]
* date: 15-8-15.
*/
public class StockData extends LinkedHashMap<String, Double> implements Comparable<StockData> {
/**
* 股票代码
*/
public String symbol;
/**
* 股票名称
*/
public String name;
/**
* 数据时间点
*/
public Date date;
/**
* 版块信息:主版,中小板,创业板
*/
public BoardType boardType;
/**
* 市场:深市,沪市
*/
public StockMarketType stockMarketType;
/**
* 属性值
*/
public Map<String, String> attribute = Maps.newHashMap();
public StockData() {
}
public StockData(String symbol) {
this.symbol = symbol;
this.stockMarketType = StockMarketType.getType(symbol);
this.boardType = BoardType.getType(symbol);
}
public StockData(Map<String, Double> map) {
this.putAll(map);
}
public void attr(String key, String val) {
attribute.put(key, val);
}
public String attr(String key) {
return attribute.get(key);
}
@Override
public String toString() {
return "StockData{" +
"symbol='" + symbol + '\'' +
", name='" + name + '\'' +
", date=" + Utils.formatDate(date, "yyyy-MM-dd HH:mm:ss") +
", boardType=" + boardType +
", stockMarketType=" + stockMarketType +
", stockData=" + Utils.map2Json(this) +
", stockAttribute= " + Utils.map2Json(attribute) +
'}';
}
@Override
public int compareTo(StockData stockData) {
int compare = this.symbol.compareTo(stockData.symbol);
if (compare != 0) {
return compare;
}
return this.date.compareTo(stockData.date);
}
}
| eryk/JQuant | src/main/java/net/jquant/model/StockData.java |
65,899 | package com.core.entity;
import java.io.Serializable;
import java.util.List;
public class Book implements Serializable {
private String id;// 主键id
private String isbn;// ISBN码
private String path;// 图片
private String title;// 标题
private String subtitle;// 副标题
private String originalTitle;
private String marketPrice;// 市场价
private String intro;// 简介
private String binding;// 装订方式
private String pages;// 页数
private String author;// 作者
private String publisher;// 出版社
private String catalog;// 目录
private int supply;// 库存
private String status;// 状态
private int hot;// 热度值
private String indate;// 入库日期
List<Store> stores;
public String getId() {
return id;
}
public List<Store> getStores() {
return stores;
}
public void setStores(List<Store> stores) {
this.stores = stores;
}
public void setId(String id) {
this.id = id;
}
public String getIsbn() {
return isbn;
}
public void setIsbn(String isbn) {
this.isbn = isbn;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getSubtitle() {
return subtitle;
}
public void setSubtitle(String subtitle) {
this.subtitle = subtitle;
}
public String getOriginalTitle() {
return originalTitle;
}
public void setOriginalTitle(String originalTitle) {
this.originalTitle = originalTitle;
}
public String getMarketPrice() {
return marketPrice;
}
public void setMarketPrice(String marketPrice) {
this.marketPrice = marketPrice;
}
public String getIntro() {
return intro;
}
public void setIntro(String intro) {
this.intro = intro;
}
public String getBinding() {
return binding;
}
public void setBinding(String binding) {
this.binding = binding;
}
public String getPages() {
return pages;
}
public void setPages(String page) {
this.pages = page;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
public String getPublisher() {
return publisher;
}
public void setPublisher(String publisher) {
this.publisher = publisher;
}
public String getCatalog() {
return catalog;
}
public void setCatalog(String catalog) {
this.catalog = catalog;
}
public int getSupply() {
return supply;
}
public void setSupply(int supply) {
this.supply = supply;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public int getHot() {
return hot;
}
public void setHot(int hot) {
this.hot = hot;
}
public String getIndate() {
return indate;
}
public void setIndate(String indate) {
this.indate = indate;
}
@Override
public String toString() {
return "Book{" +
"id='" + id + '\'' +
", isbn='" + isbn + '\'' +
", path='" + path + '\'' +
", title='" + title + '\'' +
", subtitle='" + subtitle + '\'' +
", originalTitle='" + originalTitle + '\'' +
", marketPrice='" + marketPrice + '\'' +
", intro='" + intro + '\'' +
", binding='" + binding + '\'' +
", pages='" + pages + '\'' +
", author='" + author + '\'' +
", publisher='" + publisher + '\'' +
", catalog='" + catalog + '\'' +
", supply=" + supply +
", status='" + status + '\'' +
", hot=" + hot +
", indate='" + indate + '\'' +
", stores=" + stores +
'}';
}
}
| ZHENFENG13/ssm-demo | ssm-demo/src/com/core/entity/Book.java |
65,900 | package demo.view.home;
import demo.controller.home.DashboardController;
import org.december.beanui.chart.annotation.LineChart;
import org.december.beanui.chart.annotation.RadarChart;
import org.december.beanui.element.annotation.Form;
import org.december.beanui.event.annotation.Created;
@Form
@Created(rest = DashboardController.class, func = "test2")
public class ChartForm2 {
@RadarChart(indicator = "[{ name: '销售', max: 6500},{ name: '管理', max: 16000, color: 'red'},{ name: '信息技术', max: 30000},{ name: '客服', max: 38000},{ name: '研发', max: 52000},{ name: '市场', max: 25000}]")
private Chart2 chart2;
public Chart2 getChart2() {
return chart2;
}
public void setChart2(Chart2 chart2) {
this.chart2 = chart2;
}
}
| magic-bunny/beanui | demo/src/main/java/demo/view/home/ChartForm2.java |
65,901 | package stock.bean;
import lombok.Data;
import java.io.Serializable;
@Data
public class LonghbJigou implements Serializable {
//股票代码
private String code ;
//交易时间
private String tdate ;
//股票名称
private String name ;
//市场总成交额(万)
private float accumamount ;
//机构买入总额(万)
private float buyamt ;
//买方机构数
private float buytimes ;
//涨跌幅
private float changerate ;
//收盘价
private float closeprice ;
//上榜后10日涨跌幅
private float d10closeadjchrate ;
//上榜后1日涨跌幅
private float d1closeadjchrate ;
//上榜后2日涨跌幅
private float d2closeadjchrate ;
//上榜后5日涨跌幅
private float d5closeadjchrate ;
//上榜原因
private String explanation ;
//流通市值(亿)
private float freecap ;
//市场
private String market ;
//机构买入净额(万)
private float netbuyamt ;
//机构净买额占总成交额比
private float ratio ;
//代码简写
private String secucode ;
//机构卖出总额(万)
private float sellamt ;
//卖方机构数
private float selltimes ;
//换手率
private float turnoverrate ;
}
| waizao/StockApiJava | src/main/java/stock/bean/LonghbJigou.java |
65,902 | /*
* Copyright 2020. Huawei Technologies Co., Ltd. All rights reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.DrmSDK;
/**
* 鉴权状态码
* Authentication Status Code
*
* @since 2020/07/01
*/
public class DrmStatusCodes {
/**
* 获取签名结果:成功
* Signature obtaining result: success
*/
public static final int CODE_SUCCESS = 0;
/**
* 获取签名结果:失败,需要网络连接
* Obtaining signature result: Failed. Network connection is required.
*/
public static final int CODE_NEED_INTERNET = 1;
/**
* 获取签名结果:失败,没有同意应用市场中心协议
* Signature obtaining result: Failed. The AppGallery agreement is not agreed.
*/
public static final int CODE_PROTOCAL_UNAGREE = 3;
/**
* 获取签名结果:失败,登录华为帐号失败(2D产品)
* Signature obtaining result: Failed. Failed to log in to the HUAWEI ID (2D product).
*/
public static final int CODE_LOGIN_FAILED = 6;
/**
* 获取签名结果:失败,没有订购关系
* Signature obtaining result: Failed because no subscription relationship exists.
*/
public static final int CODE_NO_ORDER = 7;
/**
* 超过使用设备数量:切换账号重新购买
* If the number of used devices exceeds the upper limit, switch to another account and purchase the device again.
*/
public static final int CODE_OVER_LIMIT = 8;
/**
* 获取签名结果:失败,没有登录华为帐号(VR产品返回,2D产品无此错误码)
* Signature obtaining result: Failed. No Huawei ID is logged in. (This error code is returned by VR products. This error code does not exist for 2D products.)
*/
public static final int CODE_NOT_LOGIN = 9;
/**
* 获取签名结果:失败,需要拉起Activity
* Obtaining the signature result: Failed. The activity needs to be started.
*/
public static final int CODE_START_ACTIVITY = 100;
/**
* 错误的会员订阅关系
* Incorrect membership subscription relationship.
*/
public static final int CODE_INVALID_MEMBERSHIP = 10;
/**
* 获取签名结果:失败,内部错误(接口调用失败或获取数据不可用)
* Signature obtaining result: failure, internal error (interface invoking failure or data obtaining unavailable)
*/
public static final int CODE_DEFAULT = -1;
/**
* 获取签名结果:失败,市场不支持鉴权
* Signature obtaining result: Failed. Marketing does not support authentication.
*/
public static final int CODE_APP_UNSUPPORT = -2;
/**
* 获取签名时,用户点返回取消
* When obtaining the signature, the user clicks Cancel.
*/
public static final int CODE_CANCEL = -4;
}
| threema-ch/threema-android | app/src/hms_services_based/java/com/DrmSDK/DrmStatusCodes.java |
65,903 | package hl4a.ide.layout;
import android.content.*;
import hl4a.ide.adapter.*;
import 放课后乐园部.安卓.视图.*;
import 放课后乐园部.安卓.资源.布局.*;
import 放课后乐园部.安卓.工具.*;
import 放课后乐园部.安卓.视图.适配器.*;
import 放课后乐园部.安卓.视图.扩展.*;
public class 布局_主页 extends 布局_基本界面 {
public 高级滑动 滑动;
public 下拉刷新布局 布局;
public 列表视图 列表;
public 工程适配器 适配器;
public 布局_主页(final Context $上下文) {
super($上下文);
/*
滑动 = new 高级滑动(底层);
滑动.添加("桌面",new 线性布局($上下文));
滑动.添加("市场",new 线性布局($上下文));
滑动.添加("制作",布局);
滑动.添加("设置",new 线性布局($上下文));
*/
布局 = new 下拉刷新布局(底层);
列表 = new 列表视图(布局);
}
}
| testacount1/HL4A | IDE/src/main/java/hl4a/ide/layout/布局_主页.java |
65,906 | package com.hjcrm.resource.controller;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.text.DecimalFormat;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.hjcrm.publics.constants.JumpViewConstants;
import com.hjcrm.publics.constants.ProportionConstants;
import com.hjcrm.publics.constants.ReturnConstants;
import com.hjcrm.publics.util.BaseController;
import com.hjcrm.publics.util.UserContext;
import com.hjcrm.resource.entity.Student;
import com.hjcrm.resource.service.IReportService;
import com.hjcrm.resource.util.ReportExcelExportUtil;
import com.hjcrm.system.entity.Course;
import com.hjcrm.system.entity.Subject;
import com.hjcrm.system.entity.User;
import com.hjcrm.system.service.ICourseService;
import com.hjcrm.system.service.IUserService;
@Controller
public class ReportController extends BaseController{
@Autowired
private IReportService reportService;
@Autowired
private IUserService userService;
@Autowired
private ICourseService courseService;
/**
* 总表学员管理(财务部)
*
* @param model
* @return
* @author likang
* @date 2016-10-27 下午3:06:37
*/
@RequestMapping(value = "/finance/financeStudentMang.do", method = RequestMethod.GET)
public String financeindex(Model model) {
User user = UserContext.getLoginUser();
if (user != null) {
Long roleid = user.getRoleid();
boolean isopen = isSholdOpenMenu(roleid,"/finance/financeStudentMang.do");
if (isopen) {
return JumpViewConstants.FINANCE_STUDENT;
}else{
return ReturnConstants.USER_NO_OPEN;//用户无权限操作并打开,如果需要此权限,请联系运营部
}
}
return ReturnConstants.USER_NO_LOGIN;//用户未登录,请刷新
}
/**
* 查询总表学员数据--财务部
* @param request
* @param studentIds
* @param roleid
* @param deptid
* @param userid
* @param pageBean
* @return
* @author likang
* @date 2016-11-30 上午9:51:02
*/
@RequestMapping(value = "/report/queryStudentscaiwu.do",method = RequestMethod.GET)
public @ResponseBody String queryStudentscaiwu(HttpServletRequest request,Student student,String studentIds,Long roleid,Long deptid,Long userid,Integer pageSize,Integer currentPage){
List<Student> list = reportService.queryStudentscaiwu(student,roleid, studentIds, deptid, userid, processPageBean(pageSize, currentPage));
return jsonToPage(list);
}
/**
* 查询总表学员数据--财务部导出
* @param request
* @param studentIds
* @param roleid
* @param deptid
* @param userid
* @param pageBean
* @return
* @author likang
* @date 2016-11-30 上午9:51:02
*/
@RequestMapping(value = "/report/queryExportStudentscaiwu.do",method = RequestMethod.GET)
public @ResponseBody String queryExportStudentscaiwu(HttpServletRequest request,Student student,String studentIds,Long roleid,Long deptid,Long userid,Integer pageSize,Integer currentPage){
List<Student> list = reportService.queryStudentscaiwu(student,roleid, studentIds, deptid, userid, null);
return jsonToPage(list);
}
/**
* 业绩统计
*
* @param model
* @return
* @author likang
* @date 2016-10-27 下午3:06:37
*/
@RequestMapping(value = "/report/performance.do", method = RequestMethod.GET)
public String performance(Model model) {
User user = UserContext.getLoginUser();
if (user != null) {
Long roleid = user.getRoleid();
boolean isopen = isSholdOpenMenu(roleid,"/report/performance.do");
if (isopen) {
return JumpViewConstants.REPORT_PERFORMANCE;
}else{
return ReturnConstants.USER_NO_OPEN;//用户无权限操作并打开,如果需要此权限,请联系运营部
}
}
return ReturnConstants.USER_NO_LOGIN;//用户未登录,请刷新
}
/**
* 用户录入统计界面
* @param model
* @return
* @author likang
* @date 2016-10-27 下午3:06:37
*/
@RequestMapping(value = "/report/userCount.do", method = RequestMethod.GET)
public String userCount(Model model) {
User user = UserContext.getLoginUser();
if (user != null) {
Long roleid = user.getRoleid();
boolean isopen = isSholdOpenMenu(roleid,"/report/userCount.do");
if (isopen) {
return JumpViewConstants.REPORT_USERCOUNT;
}else{
return ReturnConstants.USER_NO_OPEN;//用户无权限操作并打开,如果需要此权限,请联系运营部
}
}
return ReturnConstants.USER_NO_LOGIN;//用户未登录,请刷新
}
/**
* 查询业绩统计
* 全部业绩
* @param request
* @param moth 月份数字
* @param deptid
* @param roleid
* @param userid
* @param pageSize
* @param currentPage
* @return
* @author likang
* @date 2016-12-1 下午2:23:29
*/
@RequestMapping(value = "/report/queryPerformanceAll.do",method = RequestMethod.GET)
public @ResponseBody String queryPerformanceAll(HttpServletRequest request,String deptid,String roleid,String userid,Integer pageSize,Integer currentPage ){
Map<String, Object> map = new HashMap<String, Object>();
List<User> listall = reportService.queryPerformanceAll();
map.put("listall", listall);
return jsonToPage(map);
}
/**
* 查询业绩统计
* 非AC全部业绩
* @param request
* @param moth 月份数字
* @param deptid
* @param roleid
* @param userid
* @param pageSize
* @param currentPage
* @return
* @author likang
* @date 2017年1月9日14:29:13
*/
@RequestMapping(value = "/report/queryPerformanceAllnotAC.do",method = RequestMethod.GET)
public @ResponseBody String queryPerformanceAllnotAC(HttpServletRequest request,String deptid,String roleid,String userid,Integer pageSize,Integer currentPage ){
Map<String, Object> map = new HashMap<String, Object>();
List<User> listall = reportService.queryPerformanceAllnotAC();
map.put("listallnotAC", listall);
return jsonToPage(map);
}
/**
* 查询业绩统计
* 本月业绩
* @param request
* @param deptid
* @param roleid
* @param userid
* @param pageSize
* @param currentPage
* @return
* @author likang
* @date 2016-12-1 下午2:23:29
*/
@RequestMapping(value = "/report/queryPerformanceTodayMoth.do",method = RequestMethod.GET)
public @ResponseBody String queryPerformanceTodayMoth(HttpServletRequest request,String deptid,String roleid,String userid,Integer pageSize,Integer currentPage ){
Map<String, Object> map = new HashMap<String, Object>();
List<User> listtodaymoth = reportService.queryPerformanceTodayMoth();
map.put("listtodaymoth", listtodaymoth);
return jsonToPage(map);
}
/**
* 查询业绩统计
* 非AC本月业绩
* @param request
* @param deptid
* @param roleid
* @param userid
* @param pageSize
* @param currentPage
* @return
* @author likang
* @date 2017年1月9日14:32:40
*/
@RequestMapping(value = "/report/queryPerformanceTodayMothnotAC.do",method = RequestMethod.GET)
public @ResponseBody String queryPerformanceTodayMothnotAC(HttpServletRequest request,String deptid,String roleid,String userid,Integer pageSize,Integer currentPage ){
Map<String, Object> map = new HashMap<String, Object>();
List<User> listtodaymoth = reportService.queryPerformanceTodayMothnotAC();
map.put("listtodaymothnotAC", listtodaymoth);
return jsonToPage(map);
}
/**
* 查询业绩统计
* 本周业绩
* @param request
* @param deptid
* @param roleid
* @param userid
* @param pageSize
* @param currentPage
* @return
* @author likang
* @date 2017年1月4日10:01:47
*/
@RequestMapping(value = "/report/queryPerformanceTodayWeek.do",method = RequestMethod.GET)
public @ResponseBody String queryPerformanceTodayWeek(HttpServletRequest request,String deptid,String roleid,String userid,Integer pageSize,Integer currentPage ){
Map<String, Object> map = new HashMap<String, Object>();
List<User> listtodayweek = reportService.queryPerformanceTodayWeek();
map.put("listtodayweek", listtodayweek);
return jsonToPage(map);
}
/**
* 查询业绩统计
* 非AC本周业绩
* @param request
* @param deptid
* @param roleid
* @param userid
* @param pageSize
* @param currentPage
* @return
* @author likang
* @date 2017年1月4日10:01:47
*/
@RequestMapping(value = "/report/queryPerformanceTodayWeeknotAC.do",method = RequestMethod.GET)
public @ResponseBody String queryPerformanceTodayWeeknotAC(HttpServletRequest request,String deptid,String roleid,String userid,Integer pageSize,Integer currentPage ){
Map<String, Object> map = new HashMap<String, Object>();
List<User> listtodayweek = reportService.queryPerformanceTodayWeeknotAC();
map.put("listtodayweeknotAC", listtodayweek);
return jsonToPage(map);
}
/**
* 查询业绩统计
* 昨日业绩
* @param request
* @param deptid
* @param roleid
* @param userid
* @param pageSize
* @param currentPage
* @return
* @author likang
* @date 2017年1月4日10:01:47
*/
@RequestMapping(value = "/report/queryPerformanceYestoday.do",method = RequestMethod.GET)
public @ResponseBody String queryPerformanceYestoday(HttpServletRequest request,String deptid,String roleid,String userid,Integer pageSize,Integer currentPage ){
Map<String, Object> map = new HashMap<String, Object>();
List<User> listyestoday = reportService.queryPerformanceYestoday();
map.put("listyestoday", listyestoday);
return jsonToPage(map);
}
/**
* 查询业绩统计
* 非AC昨日业绩
* @param request
* @param deptid
* @param roleid
* @param userid
* @param pageSize
* @param currentPage
* @return
* @author likang
* @date 2017年1月4日10:01:47
*/
@RequestMapping(value = "/report/queryPerformanceYestodaynotAC.do",method = RequestMethod.GET)
public @ResponseBody String queryPerformanceYestodaynotAC(HttpServletRequest request,String deptid,String roleid,String userid,Integer pageSize,Integer currentPage ){
Map<String, Object> map = new HashMap<String, Object>();
List<User> listyestoday = reportService.queryPerformanceYestodaynotAC();
map.put("listyestodaynotAC", listyestoday);
return jsonToPage(map);
}
/**
* 查询业绩统计
* 课程业绩
* @param request
* @param deptid
* @param roleid
* @param userid
* @param pageSize
* @param currentPage
* @return
* @author likang
* @date 2016-12-1 下午2:23:29
*/
@RequestMapping(value = "/report/queryPerformanceCourse.do",method = RequestMethod.GET)
public @ResponseBody String queryPerformanceCourse(HttpServletRequest request,String courseid,Integer pageSize,Integer currentPage ){
if (courseid != null && !"".equals(courseid.trim())) {
Map<String, Object> map = new HashMap<String, Object>();
List<User> listcourse = reportService.queryPerformanceCourse(courseid);
map.put("listcourse", listcourse);
return jsonToPage(map);
}
return ReturnConstants.PARAM_NULL;
}
/**
* 查询业绩统计
* 月份筛选业绩
* @param request
* @param deptid
* @param roleid
* @param userid
* @param pageSize
* @param currentPage
* @return
* @author likang
* @date 2016-12-1 下午2:23:29
*/
@RequestMapping(value = "/report/queryPerformanceMoth.do",method = RequestMethod.GET)
public @ResponseBody String queryPerformanceMoth(HttpServletRequest request,String moth,Integer pageSize,Integer currentPage ){
if (moth != null && !"".equals(moth.trim())) {
Map<String, Object> map = new HashMap<String, Object>();
List<User> listmoth = reportService.queryPerformanceMoth(moth);
map.put("listmoth", listmoth);
return jsonToPage(map);
}
return ReturnConstants.PARAM_NULL;
}
/**
* 业绩明细
* @param request
* @param userName 招生老师姓名
* @param userid 招生老师ID
* @param startTime 开始成交时间 yyyy-MM-dd
* @param endTime 成交结束时间 yyyy-MM-dd
* @param pageSize
* @param currentPage
* @return
* @author likang
* @date 2016-12-29 下午4:01:27
*/
@RequestMapping(value = "/report/queryPerformanceDetail.do",method = RequestMethod.GET)
public @ResponseBody String queryPerformanceDetail(HttpServletRequest request,String userName,String userid,String startTime,String endTime,Integer pageSize,Integer currentPage){
List<User> list = reportService.queryPerformanceDetail(userName,userid,startTime,endTime,null);
return jsonToPage(list);
}
/**
* 业绩明细-导出
* @param request
* @param userName 招生老师姓名
* @param userid 招生老师ID
* @param startTime 开始成交时间 yyyy-MM-dd
* @param endTime 成交结束时间 yyyy-MM-dd
* @param pageSize
* @param currentPage
* @return
* @author likang
* @date 2016-12-29 下午4:01:27
*/
@RequestMapping(value = "/report/exportPerformanceDetail.do",method = RequestMethod.POST)
public @ResponseBody String exportPerformanceDetail(HttpServletRequest request, HttpServletResponse response,String userName,String userid,String startTime,String endTime){
String[] header = new String[]{"姓名","提成基础","A面","A网","C面","C网","银行从业","基金串讲班","基金保过班","基金退费班","基金后付费班","基金题库班","中级经济师","会计从业","初级会计","期货从业","证券从业","A真题实战班"} ;
List<User> list = reportService.queryPerformanceDetail(userName,userid,startTime,endTime,null);
//写入到excel
String separator = File.separator;
String dir = request.getRealPath(separator + "upload");
try {
OutputStream out = new FileOutputStream(dir + separator + "业绩排行榜明细情况.xls");
ReportExcelExportUtil.exportPerformanceDetail("业绩排行榜明细情况", header, list, out);
// 下载到本地
out.close();
String path = request.getSession().getServletContext().getRealPath(separator + "upload" + separator + "业绩排行榜明细情况.xls");
response.setContentType("text/html;charset=utf-8");
request.setCharacterEncoding("UTF-8");
java.io.BufferedInputStream bis = null;
java.io.BufferedOutputStream bos = null;
String downLoadPath = path;
try {
long fileLength = new File(downLoadPath).length();
response.setContentType("application/x-msdownload;");
response.setHeader("Content-disposition","attachment; filename=" + new String("业绩排行榜明细情况.xls".getBytes("utf-8"),"ISO8859-1"));
response.setHeader("Content-Length", String.valueOf(fileLength));
bis = new BufferedInputStream(new FileInputStream(downLoadPath));
bos = new BufferedOutputStream(response.getOutputStream());
byte[] buff = new byte[2048];
int bytesRead;
while (-1 != (bytesRead = bis.read(buff, 0, buff.length))) {
bos.write(buff, 0, bytesRead);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
if (bis != null)
bis.close();
if (bos != null)
bos.close();
}
} catch (Exception e) {
e.printStackTrace();
}
return ReturnConstants.SUCCESS;
}
/**
* 用户录入统计
* 全部
* @param request
* @param countTime
* @param userid
* @param deptid
* @return
* @author likang
* @date 2016-12-12 上午9:38:43
*/
@RequestMapping(value = "/report/queryUserAddCountAll.do",method = RequestMethod.GET)
public @ResponseBody String queryUserAddCountAll(HttpServletRequest request,String countTime,Long userid,Long deptid,Integer pageSize,Integer currentPage){
if (userid != null && deptid != null) {
List<User> listall = reportService.queryUserAddCountAll(processPageBean(pageSize, currentPage));//全部
Map<String, Object> map = new HashMap<String, Object>();
map.put("listall", listall);
return jsonToPage(map);
}
return ReturnConstants.PARAM_NULL;
}
/**
* 用户录入统计
* 本月
* @param request
* @param countTime
* @param userid
* @param deptid
* @return
* @author likang
* @date 2016-12-12 上午9:38:43
*/
@RequestMapping(value = "/report/queryUserAddCountMoth.do",method = RequestMethod.GET)
public @ResponseBody String queryUserAddCountMoth(HttpServletRequest request,String countTime,Long userid,Long deptid,Integer pageSize,Integer currentPage){
if (userid != null && deptid != null) {
List<User> listmoth = reportService.queryUserAddCountMoth(processPageBean(pageSize, currentPage));//本月
Map<String, Object> map = new HashMap<String, Object>();
map.put("listmoth", listmoth);
return jsonToPage(map);
}
return ReturnConstants.PARAM_NULL;
}
/**
* 用户录入统计
* 本周
* @param request
* @param countTime
* @param userid
* @param deptid
* @return
* @author likang
* @date 2016-12-12 上午9:38:43
*/
@RequestMapping(value = "/report/queryUserAddCountWeek.do",method = RequestMethod.GET)
public @ResponseBody String queryUserAddCountWeek(HttpServletRequest request,Long userid,Long deptid,Integer pageSize,Integer currentPage){
if (userid != null && deptid != null) {
List<User> listWeek = reportService.queryUserAddCountWeek(processPageBean(pageSize, currentPage));//本周
Map<String, Object> map = new HashMap<String, Object>();
map.put("listWeek", listWeek);
return jsonToPage(map);
}
return ReturnConstants.PARAM_NULL;
}
/**
* 用户录入统计
* 今日
* @param request
* @param countTime
* @param userid
* @param deptid
* @return
* @author likang
* @date 2016-12-12 上午9:38:43
*/
@RequestMapping(value = "/report/queryUserAddCountToday.do",method = RequestMethod.GET)
public @ResponseBody String queryUserAddCountToday(HttpServletRequest request,String countTime,Long userid,Long deptid,Integer pageSize,Integer currentPage){
if (userid != null && deptid != null) {
List<User> listtoday = reportService.queryUserAddCountToday(countTime,processPageBean(pageSize, currentPage));//今日
Map<String, Object> map = new HashMap<String, Object>();
map.put("listtoday", listtoday);
return jsonToPage(map);
}
return ReturnConstants.PARAM_NULL;
}
/**
* 用户录入统计
* 按照时间条件进行选取
* @param request
* @param countTime
* @param userid
* @param deptid
* @return
* @author likang
* @date 2016-12-12 上午9:38:43
*/
@RequestMapping(value = "/report/queryUserAddCountTime.do",method = RequestMethod.GET)
public @ResponseBody String queryUserAddCountTime(HttpServletRequest request,String countTime,Long userid,Long deptid,Integer pageSize,Integer currentPage){
if (userid != null && deptid != null && countTime != null && !"".equals(countTime.trim())) {
List<User> listtoday = reportService.queryUserAddCountTime(countTime,processPageBean(pageSize, currentPage));//按照时间条件进行选取
Map<String, Object> map = new HashMap<String, Object>();
map.put("listtime", listtoday);
return jsonToPage(map);
}
return ReturnConstants.PARAM_NULL;
}
public static String[] getHeaders(){
String[] header = new String[]{"团队","姓名","录入情况"} ;
return header;
}
/**用户录入情况统计
* 导出
* @param request
* @param response
* @param sign 0 全部导出 1本月 2今日 3按照时间筛选 4本周
* @param countTime 时间筛选
* @return
* @author likang
* @date 2016-12-13 下午4:20:53
*/
@RequestMapping(value = "/report/excelExportReportAddCount.do",method = RequestMethod.POST)
public @ResponseBody String excelExportReportAddCount(HttpServletRequest request, HttpServletResponse response,String sign,String countTime){
String[] header = getHeaders();//表头
List<User> list = null;
if (sign != null && !"".equals(sign.trim())&&"0".equals(sign.trim())) {
list = reportService.queryUserAddCountAll(null);//全部
}else if(sign != null && !"".equals(sign.trim())&&"1".equals(sign.trim())){
list = reportService.queryUserAddCountMoth(null);//本月
}else if(sign != null && !"".equals(sign.trim())&&"2".equals(sign.trim())){
list = reportService.queryUserAddCountToday(null,null);//今日
}else if(sign != null && !"".equals(sign.trim())&&"3".equals(sign.trim())){
list = reportService.queryUserAddCountTime(countTime,null);//按照时间条件进行选取
}else if(sign != null && !"".equals(sign.trim())&&"4".equals(sign.trim())){
list = reportService.queryUserAddCountWeek(null);//本周
}
//写入到excel
String separator = File.separator;
String dir = request.getRealPath(separator + "upload");
try {
OutputStream out = new FileOutputStream(dir + separator + "用户录入情况统计.xls");
ReportExcelExportUtil.exportExcel("用户录入情况统计", header, list, out);
// 下载到本地
out.close();
String path = request.getSession().getServletContext().getRealPath(separator + "upload" + separator + "用户录入情况统计.xls");
response.setContentType("text/html;charset=utf-8");
request.setCharacterEncoding("UTF-8");
java.io.BufferedInputStream bis = null;
java.io.BufferedOutputStream bos = null;
String downLoadPath = path;
try {
long fileLength = new File(downLoadPath).length();
response.setContentType("application/x-msdownload;");
response.setHeader("Content-disposition","attachment; filename=" + new String("用户录入情况统计.xls".getBytes("utf-8"),"ISO8859-1"));
response.setHeader("Content-Length", String.valueOf(fileLength));
bis = new BufferedInputStream(new FileInputStream(downLoadPath));
bos = new BufferedOutputStream(response.getOutputStream());
byte[] buff = new byte[2048];
int bytesRead;
while (-1 != (bytesRead = bis.read(buff, 0, buff.length))) {
bos.write(buff, 0, bytesRead);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
if (bis != null)
bis.close();
if (bos != null)
bos.close();
}
} catch (Exception e) {
e.printStackTrace();
}
return ReturnConstants.SUCCESS;
}
/**
* 提成总表跳转界面
* @param model
* @return
* @author likang
* @date 2016-10-27 下午3:06:37
*/
@RequestMapping(value = "/commission/commissionAll.do", method = RequestMethod.GET)
public String commission(Model model) {
User user = UserContext.getLoginUser();
if (user != null) {
Long roleid = user.getRoleid();
boolean isopen = isSholdOpenMenu(roleid,"/commission/commissionAll.do");
if (isopen) {
return JumpViewConstants.REPORT_COMMISSION_ALL;
}else{
return ReturnConstants.USER_NO_OPEN;//用户无权限操作并打开,如果需要此权限,请联系运营部
}
}
return ReturnConstants.USER_NO_LOGIN;//用户未登录,请刷新
}
/**
* 提成计算【基金-客服】跳转界面
* @param model
* @return
* @author likang
* @date 2016-10-27 下午3:06:37
*/
@RequestMapping(value = "/commission/commissionJJKF.do", method = RequestMethod.GET)
public String commissionJJKF(Model model) {
User user = UserContext.getLoginUser();
if (user != null) {
Long roleid = user.getRoleid();
boolean isopen = isSholdOpenMenu(roleid,"/commission/commissionJJKF.do");
if (isopen) {
return JumpViewConstants.REPORT_COMMISSION_JJKF;
}else{
return ReturnConstants.USER_NO_OPEN;//用户无权限操作并打开,如果需要此权限,请联系运营部
}
}
return ReturnConstants.USER_NO_LOGIN;//用户未登录,请刷新
}
/**
* 提成计算【市场-机构】跳转界面
* @param model
* @return
* @author likang
* @date 2016-10-27 下午3:06:37
*/
@RequestMapping(value = "/commission/commissionSCJG.do", method = RequestMethod.GET)
public String commissionSCJG(Model model) {
User user = UserContext.getLoginUser();
if (user != null) {
Long roleid = user.getRoleid();
boolean isopen = isSholdOpenMenu(roleid,"/commission/commissionSCJG.do");
if (isopen) {
return JumpViewConstants.REPORT_COMMISSION_SCJG;
}else{
return ReturnConstants.USER_NO_OPEN;//用户无权限操作并打开,如果需要此权限,请联系运营部
}
}
return ReturnConstants.USER_NO_LOGIN;//用户未登录,请刷新
}
/**
* 提成总表查询数据
* @param request
* @param userid 当前登录用户id
* @param deptgroup 当前登录用户部门大类
* @param roleid 角色ID
* @param dealStartTime 成交开始日期
* @param dealEndTime 成交结束日期
* @param pageSize
* @param currentPage
* @return
* @author likang
* @date 2016-12-19 下午4:13:54
*/
@RequestMapping(value = "/commission/queryCommissionAll.do",method =RequestMethod.GET)
public @ResponseBody String queryCommissionAll(HttpServletRequest request,Long userid,Long deptgroup,Long roleid,String dealStartTime,String dealEndTime,Integer pageSize, Integer currentPage){
if (userid != null && roleid != null && deptgroup != null) {
List<Student> list = reportService.queryCommissionAll(userid, deptgroup, roleid, dealStartTime, dealEndTime, processPageBean(pageSize, currentPage));
if (list != null && list.size() > 0) {
for (int i = 0; i < list.size(); i++) {
Integer courseid = list.get(i).getCourseid();//课程ID
double dealpriceSum = 0;//成交金额
double dealprice = new Double((list.get(i).getDealprice() != null && !"".equals(list.get(i).getDealprice().trim()))?list.get(i).getDealprice():"0");//成交金额
if (courseid != null) {
Subject subject = courseService.querySubjectByCourseId(courseid);
if (subject != null) {
list.get(i).setCourseName(subject.getCoursename());
list.get(i).setSubjectname(subject.getSubjectname());
}
}
if (courseid != null && list.get(i).getDeptgroupName() != null) {//部门大类:0市场部 、1基金销售、 2机构客户部、 3重庆代理1、4重庆代理2 、5西安代理 、6南京代理1、 7南京代理2、8苏州代理、9泰州代理、10长春代理 、11太原代理
List<Student> dealpricelist = reportService.querydealpriceSum(list.get(i).getDeptgroupName(),list.get(i).getBelongid(), courseid);
if (dealpricelist != null && dealpricelist.size() > 0) {
dealpriceSum = dealpricelist.get(0).getDealpriceSum();
}
if ("0".equals(list.get(i).getDeptgroupName())) {
list.get(i).setDeptgroupName("市场部");
if (courseid != null && courseid > 1 ) {//CFP及其他科目
if (dealpriceSum < 40000) {//小于4万
list.get(i).setProportion(ProportionConstants.SCB_0_4_CFP_OR_OTHER);
}else if(dealpriceSum >= 40000 && dealpriceSum < 80000){//4万-8万
list.get(i).setProportion(ProportionConstants.SCB_4_8_CFP_OR_OTHER);
}else if(dealpriceSum >= 80000){//大于等于8万
list.get(i).setProportion(ProportionConstants.SCB_8_MORE_CFP_OR_OTHER);
}
}else if(courseid != null && courseid == 1){//AFP面授
if (list.get(i).getIspass() != null && ( list.get(i).getIspass() == 0 || list.get(i).getIspass() == 1)) {//AFP面授---通过前
if (dealpriceSum < 40000) {//小于4万
list.get(i).setProportion(ProportionConstants.SCB_0_4_AFP_PASSBEFORE);
}else if(dealpriceSum >= 40000 && dealpriceSum < 80000){//4万-8万
list.get(i).setProportion(ProportionConstants.SCB_4_8_AFP_PASSBEFORE);
}else if(dealpriceSum >= 80000){//大于等于8万
list.get(i).setProportion(ProportionConstants.SCB_8_MORE_AFP_PASSBEFORE);
}
}else if(list.get(i).getIspass() != null && list.get(i).getIspass() == 2){//AFP面授---通过后
if (dealpriceSum < 40000) {//小于4万
list.get(i).setProportion(ProportionConstants.SCB_0_4_AFP_PASSAFTER);
}else if(dealpriceSum >= 40000 && dealpriceSum < 80000){//4万-8万
list.get(i).setProportion(ProportionConstants.SCB_4_8_AFP_PASSAFTER);
}else if(dealpriceSum >= 80000){//大于等于8万
list.get(i).setProportion(ProportionConstants.SCB_8_MORE_AFP_PASSAFTER);
}
}
}
}else if("1".equals(list.get(i).getDeptgroupName())){
list.get(i).setDeptgroupName("基金销售");
if (courseid != null && courseid > 4) {//非AC项目
if (dealpriceSum < 30000) {//X<3万
list.get(i).setProportion(ProportionConstants.JJKF_0_3_FAC);
}else if(dealpriceSum >= 30000 && dealpriceSum < 60000){//3万≤X<6万
list.get(i).setProportion(ProportionConstants.JJKF_3_6_FAC);
}else if(dealpriceSum >= 60000 && dealpriceSum < 90000){//6万≤X<9万
list.get(i).setProportion(ProportionConstants.JJKF_6_9_FAC);
}else if(dealpriceSum >= 90000){//X≥9万
list.get(i).setProportion(ProportionConstants.JJKF_9_MORE_FAC);
}
}else if(courseid != null && (courseid == 2 || courseid == 3 || courseid == 4 )){//CFP+AFP网络
if (dealpriceSum < 30000) {//X<3万
list.get(i).setProportion(ProportionConstants.JJKF_0_3_CFP_AFPW);
}else if(dealpriceSum >= 30000 && dealpriceSum < 60000){//3万≤X<6万
list.get(i).setProportion(ProportionConstants.JJKF_3_6_CFP_AFPW);
}else if(dealpriceSum >= 60000 && dealpriceSum < 90000){//6万≤X<9万
list.get(i).setProportion(ProportionConstants.JJKF_6_9_CFP_AFPW);
}else if(dealpriceSum >= 90000){//X≥9万
list.get(i).setProportion(ProportionConstants.JJKF_9_MORE_CFP_AFPW);
}
}else if(courseid != null && courseid == 1){//AFP面授
if (list.get(i).getIspass() != null && ( list.get(i).getIspass() == 0 || list.get(i).getIspass() == 1)) {//AFP面授---通过前
if (dealpriceSum < 30000) {//X<3万
list.get(i).setProportion(ProportionConstants.JJKF_0_3_AFPM_PASSBEFORE);
}else if(dealpriceSum >= 30000 && dealpriceSum < 60000){//3万≤X<6万
list.get(i).setProportion(ProportionConstants.JJKF_3_6_AFPM_PASSBEFORE);
}else if(dealpriceSum >= 60000 && dealpriceSum < 90000){//6万≤X<9万
list.get(i).setProportion(ProportionConstants.JJKF_6_9_AFPM_PASSBEFORE);
}else if(dealpriceSum >= 90000){//X≥9万
list.get(i).setProportion(ProportionConstants.JJKF_9_MORE_AFPM_PASSBEFORE);
}
}else if(list.get(i).getIspass() != null && list.get(i).getIspass() == 2){//AFP面授---通过后
if (dealpriceSum < 30000) {//X<3万
list.get(i).setProportion(ProportionConstants.JJKF_0_3_AFPM_PASSAFTER);
}else if(dealpriceSum >= 30000 && dealpriceSum < 60000){//3万≤X<6万
list.get(i).setProportion(ProportionConstants.JJKF_3_6_AFPM_PASSAFTER);
}else if(dealpriceSum >= 60000 && dealpriceSum < 90000){//6万≤X<9万
list.get(i).setProportion(ProportionConstants.JJKF_6_9_AFPM_PASSAFTER);
}else if(dealpriceSum >= 90000){//X≥9万
list.get(i).setProportion(ProportionConstants.JJKF_9_MORE_AFPM_PASSAFTER);
}
}
}
}else if("2".equals(list.get(i).getDeptgroupName())){
list.get(i).setDeptgroupName("机构客户部");
}else if("3".equals(list.get(i).getDeptgroupName())){
list.get(i).setDeptgroupName("重庆代理1");
if (courseid != null && courseid > 1 ) {//CFP及其他科目
list.get(i).setProportion(ProportionConstants.DL_CHONGQING1_CFP_OR_OTHER);
}else if(courseid != null && courseid == 1){//AFP面授
if (list.get(i).getIspass() != null && ( list.get(i).getIspass() == 0 || list.get(i).getIspass() == 1)) {//AFP面授---通过前
list.get(i).setProportion(ProportionConstants.DL_CHONGQING1_AFPM_PASSBEFORE);
}else if(list.get(i).getIspass() != null && list.get(i).getIspass() == 2){//AFP面授---通过后
list.get(i).setProportion(ProportionConstants.DL_CHONGQING1_AFPM_PASSAFTER);
}
}
}else if("4".equals(list.get(i).getDeptgroupName())){
list.get(i).setDeptgroupName("重庆代理2");
if (courseid != null && courseid > 1 ) {//CFP及其他科目
list.get(i).setProportion(ProportionConstants.DL_CHONGQING2_CFP_OR_OTHER);
}else if(courseid != null && courseid == 1){//AFP面授
if (list.get(i).getIspass() != null && ( list.get(i).getIspass() == 0 || list.get(i).getIspass() == 1)) {//AFP面授---通过前
list.get(i).setProportion(ProportionConstants.DL_CHONGQING2_AFPM_PASSBEFORE);
}else if(list.get(i).getIspass() != null && list.get(i).getIspass() == 2){//AFP面授---通过后
list.get(i).setProportion(ProportionConstants.DL_CHONGQING2_AFPM_PASSAFTER);
}
}
}else if("5".equals(list.get(i).getDeptgroupName())){
list.get(i).setDeptgroupName("西安代理");
if (courseid != null && courseid > 1 ) {//CFP及其他科目
list.get(i).setProportion(ProportionConstants.DL_XIAN_CFP_OR_OTHER);
}else if(courseid != null && courseid == 1){//AFP面授
if (list.get(i).getIspass() != null && ( list.get(i).getIspass() == 0 || list.get(i).getIspass() == 1)) {//AFP面授---通过前
list.get(i).setProportion(ProportionConstants.DL_XIAN_AFPM_PASSBEFORE);
}else if(list.get(i).getIspass() != null && list.get(i).getIspass() == 2){//AFP面授---通过后
list.get(i).setProportion(ProportionConstants.DL_XIAN_AFPM_PASSAFTER);
}
}
}else if("6".equals(list.get(i).getDeptgroupName())){
list.get(i).setDeptgroupName("南京代理1");
if (courseid != null && courseid > 1 ) {//CFP及其他科目
list.get(i).setProportion(ProportionConstants.DL_NANJING1_CFP_OR_OTHER);
}else if(courseid != null && courseid == 1){//AFP面授
if (list.get(i).getIspass() != null && ( list.get(i).getIspass() == 0 || list.get(i).getIspass() == 1)) {//AFP面授---通过前
list.get(i).setProportion(ProportionConstants.DL_NANJING1_AFPM_PASSBEFORE);
}else if(list.get(i).getIspass() != null && list.get(i).getIspass() == 2){//AFP面授---通过后
list.get(i).setProportion(ProportionConstants.DL_NANJING1_AFPM_PASSAFTER);
}
}
}else if("7".equals(list.get(i).getDeptgroupName())){
list.get(i).setDeptgroupName("南京代理2");
if (courseid != null && courseid > 1 ) {//CFP及其他科目
list.get(i).setProportion(ProportionConstants.DL_NANJING2_CFP_OR_OTHER);
}else if(courseid != null && courseid == 1){//AFP面授
if (list.get(i).getIspass() != null && ( list.get(i).getIspass() == 0 || list.get(i).getIspass() == 1)) {//AFP面授---通过前
list.get(i).setProportion(ProportionConstants.DL_NANJING2_AFPM_PASSBEFORE);
}else if(list.get(i).getIspass() != null && list.get(i).getIspass() == 2){//AFP面授---通过后
list.get(i).setProportion(ProportionConstants.DL_NANJING2_AFPM_PASSAFTER);
}
}
}else if("8".equals(list.get(i).getDeptgroupName())){
list.get(i).setDeptgroupName("苏州代理");
if (courseid != null && courseid > 1 ) {//CFP及其他科目
list.get(i).setProportion(ProportionConstants.DL_SUZHOU_CFP_OR_OTHER);
}else if(courseid != null && courseid == 1){//AFP面授
if (list.get(i).getIspass() != null && ( list.get(i).getIspass() == 0 || list.get(i).getIspass() == 1)) {//AFP面授---通过前
list.get(i).setProportion(ProportionConstants.DL_SUZHOU_AFPM_PASSBEFORE);
}else if(list.get(i).getIspass() != null && list.get(i).getIspass() == 2){//AFP面授---通过后
list.get(i).setProportion(ProportionConstants.DL_SUZHOU_AFPM_PASSAFTER);
}
}
}else if("9".equals(list.get(i).getDeptgroupName())){
list.get(i).setDeptgroupName("泰州代理");
if (courseid != null && courseid > 1 ) {//CFP及其他科目
list.get(i).setProportion(ProportionConstants.DL_TAIZHOU_CFP_OR_OTHER);
}else if(courseid != null && courseid == 1){//AFP面授
if (list.get(i).getIspass() != null && ( list.get(i).getIspass() == 0 || list.get(i).getIspass() == 1)) {//AFP面授---通过前
list.get(i).setProportion(ProportionConstants.DL_TAIZHOU_AFPM_PASSBEFORE);
}else if(list.get(i).getIspass() != null && list.get(i).getIspass() == 2){//AFP面授---通过后
list.get(i).setProportion(ProportionConstants.DL_TAIZHOU_AFPM_PASSAFTER);
}
}
}else if("10".equals(list.get(i).getDeptgroupName())){
list.get(i).setDeptgroupName("长春代理");
if (courseid != null && courseid > 1 ) {//CFP及其他科目
list.get(i).setProportion(ProportionConstants.DL_CHANGCHUN_CFP_OR_OTHER);
}else if(courseid != null && courseid == 1){//AFP面授
if (list.get(i).getIspass() != null && ( list.get(i).getIspass() == 0 || list.get(i).getIspass() == 1)) {//AFP面授---通过前
list.get(i).setProportion(ProportionConstants.DL_CHANGCHUN_AFPM_PASSBEFORE);
}else if(list.get(i).getIspass() != null && list.get(i).getIspass() == 2){//AFP面授---通过后
list.get(i).setProportion(ProportionConstants.DL_CHANGCHUN_AFPM_PASSAFTER);
}
}
}else if("11".equals(list.get(i).getDeptgroupName())){
list.get(i).setDeptgroupName("太原代理");
if (courseid != null && courseid > 1 ) {//CFP及其他科目
list.get(i).setProportion(ProportionConstants.DL_TAIYUAN_CFP_OR_OTHER);
}else if(courseid != null && courseid == 1){//AFP面授
if (list.get(i).getIspass() != null && ( list.get(i).getIspass() == 0 || list.get(i).getIspass() == 1)) {//AFP面授---通过前
list.get(i).setProportion(ProportionConstants.DL_TAIYUAN_AFPM_PASSBEFORE);
}else if(list.get(i).getIspass() != null && list.get(i).getIspass() == 2){//AFP面授---通过后
list.get(i).setProportion(ProportionConstants.DL_TAIYUAN_AFPM_PASSAFTER);
}
}
}
DecimalFormat df1 = new DecimalFormat("##.00");
list.get(i).setShouldpayMoney(new Double(df1.format(dealprice*list.get(i).getProportion())));//应发提成金额 = 我司收入*提成比例
if (list.get(i).getUserstate() != null && list.get(i).getUserstate() == 0) {
list.get(i).setActualpayMoney(list.get(i).getShouldpayMoney());//实发提成金额:1、正常=应发金额
}else{
list.get(i).setActualpayMoney(0);//实发提成金额:2、离职员工此处显示为0
}
}
}
}
return jsonToPage(list);
}
return ReturnConstants.PARAM_NULL;
}
/**
* 提成计算【市场-机构】查询数据
* @param request
* @param userid 当前登录用户id
* @param deptgroup 当前登录用户部门大类
* @param roleid 角色ID
* @param dealStartTime 成交开始日期
* @param dealEndTime 成交结束日期
* @param pageSize
* @param currentPage
* @return
* @author likang
* @date 2016-12-19 下午4:13:54
*/
@RequestMapping(value = "/commission/queryCommissionscjg.do",method =RequestMethod.GET)
public @ResponseBody String queryCommissionscjg(HttpServletRequest request,Long userid,Long deptgroup,Long roleid,String dealStartTime,String dealEndTime,Integer pageSize, Integer currentPage){
if (userid != null && roleid != null && deptgroup != null) {
}
return ReturnConstants.PARAM_NULL;
}
/**
* 提成计算【基金-客服】查询数据
* @param request
* @param userid 当前登录用户id
* @param deptgroup 当前登录用户部门大类
* @param roleid 角色ID
* @param dealStartTime 成交开始日期
* @param dealEndTime 成交结束日期
* @param pageSize
* @param currentPage
* @return
* @author likang
* @date 2016-12-19 下午4:13:54
*/
@RequestMapping(value = "/commission/queryCommissionjjkf.do",method =RequestMethod.GET)
public @ResponseBody String queryCommissionjjkf(HttpServletRequest request,Long userid,Long deptgroup,Long roleid,String dealStartTime,String dealEndTime,Integer pageSize, Integer currentPage){
if (userid != null && roleid != null && deptgroup != null) {
}
return ReturnConstants.PARAM_NULL;
}
}
| carolcoral/CRM | src/com/hjcrm/resource/controller/ReportController.java |
65,907 | package com.opms.unti;
public class ProjectNeed {
public static String getStatus(Integer status){
int s = status.intValue();
if(s == 1){
return "草稿";
}
if(s == 2){
return "激活";
}
if(s == 3){
return "已变更";
}
if(s == 4){
return "待关闭";
}
if(s == 5){
return "已关闭";
}
return "无";
}
public static String getStage(Integer stage){
int s = stage.intValue();
switch(s){
case(1):
return "未开始";
case(2):
return "已计划";
case(3):
return "已立项";
case(4):
return "研发中";
case(5):
return "研发完毕";
case(6):
return "测试中";
case(7):
return "测试完毕";
case(8):
return "已验收";
case(9):
return "已发布";
default:
return "无";
}
}
public static String getSource(Integer source){
int s = source.intValue();
switch(s){
case(1):
return "客户";
case(2):
return "用户";
case(3):
return "产品经理";
case(4):
return "市场";
case(5):
return "客服";
case(6):
return "竞争对手";
case(7):
return "合作伙伴";
case(8):
return "开发人员";
case(9):
return "测试人员";
case(10):
return "其他";
default:
return "无";
}
}
}
| moxiaohei/OPMS | opms/src/com/opms/unti/ProjectNeed.java |
65,909 | package com.jshop.vo;
public class GoodsBelinkedModel {
private String id;//主键id
private String maingoodsid;//主商品id
private String goodsname;//主商品名称
private String productid;//货品id
private String productName;//货物名称
private String memberprice;//会员价/套餐价/组合价
private String price;//市场价,
private String pictureurl;//主图片
private String htmlpath;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getMaingoodsid() {
return maingoodsid;
}
public void setMaingoodsid(String maingoodsid) {
this.maingoodsid = maingoodsid;
}
public String getProductid() {
return productid;
}
public void setProductid(String productid) {
this.productid = productid;
}
public String getProductName() {
return productName;
}
public void setProductName(String productName) {
this.productName = productName;
}
public String getHtmlpath() {
return htmlpath;
}
public void setHtmlpath(String htmlpath) {
this.htmlpath = htmlpath;
}
public String getMemberprice() {
return memberprice;
}
public void setMemberprice(String memberprice) {
this.memberprice = memberprice;
}
public String getPrice() {
return price;
}
public void setPrice(String price) {
this.price = price;
}
public String getPictureurl() {
return pictureurl;
}
public void setPictureurl(String pictureurl) {
this.pictureurl = pictureurl;
}
public String getGoodsname() {
return goodsname;
}
public void setGoodsname(String goodsname) {
this.goodsname = goodsname;
}
public GoodsBelinkedModel() {
super();
// TODO Auto-generated constructor stub
}
}
| sdywcd/jshoper3x | jshoper3x/src/com/jshop/vo/GoodsBelinkedModel.java |
65,910 | package com.edu.nju.asi.model;
import com.edu.nju.asi.utilities.enums.Market;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import java.io.Serializable;
/**
* Created by Byron Dong on 2017/5/16.
*/
@Embeddable
public class SearchID implements Serializable{
//股票代号
@Column(name = "code",length = 100)
private String code;
//股票名称
@Column(length = 100)
private String name;
//市场
@Column
private Market market;
public SearchID() {
}
public SearchID(String code, String name, Market market) {
this.code = code;
this.name = name;
this.market = market;
}
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;
}
public Market getMarket() {
return market;
}
public void setMarket(Market market) {
this.market = market;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
SearchID searchID = (SearchID) o;
if (code != null ? !code.equals(searchID.code) : searchID.code != null) return false;
if (name != null ? !name.equals(searchID.name) : searchID.name != null) return false;
return market == searchID.market;
}
@Override
public int hashCode() {
int result = code != null ? code.hashCode() : 0;
result = 31 * result + (name != null ? name.hashCode() : 0);
result = 31 * result + (market != null ? market.hashCode() : 0);
return result;
}
}
| NJUASI/Quantour | src/main/java/com/edu/nju/asi/model/SearchID.java |
65,911 | package me.dingtou.constant;
/**
* 市场
*
* @author yuanhongbo
*/
public enum Market {
/**
* 上海交易所
*/
SH("sh"),
/**
* 深圳交易所
*/
SZ("sz"),
/**
* 基金
*/
FUND("fund"),
/**
* 香港交易所
*/
HK("hk");
private final String code;
Market(String code) {
this.code = code;
}
public static Market of(String code) {
Market[] values = Market.values();
for (Market val : values) {
if (val.getCode().equals(code)) {
return val;
}
}
throw new IllegalArgumentException(code + " not found.");
}
public String getCode() {
return code;
}
@Override
public String toString() {
return code;
}
}
| realqiyan/dingtou | api/src/main/java/me/dingtou/constant/Market.java |
65,914 | package com.model;
/**
* Created by Administrator on 2016/11/9.
*/
public class LagouModel implements Model{
private String channelId = "0";
/**
* 多选一 后端开发 移动开发 前端开发 测试 运维 DBA 高端技术职位 项目管理 硬件开发 企业软件 产品经理 产品设计师 高端产品职位 视觉设计 用户研究
* 高端设计职位 交互设计 运营 编辑 客服 高端运营职位 市场/营销 公关 销售 高端市场职位 供应链 采购 投资 人力资源 行政 财务 高端职能职位 法务
* 投融资 风控 审计税务 高端金融职位
* 职位类别”与“职位名称”在发布后不可修改,请谨慎填写
*/
private String positionType;
private String positionName;
/**
* positionType为主类别,从主类别下属中选一个副类别,对应关系详见职位分布.txt
*/
private String positionThirdType;
/**
* 部门,任填
*/
private String department;
/**
* 全职 兼职 实习 三选一
*/
private String jobNature;
private String salaryMin;
/**
* 最高工资和最低工资差距不超过2倍
*/
private String salaryMax;
/**
* 不限 应届毕业生 1年以下 1-3年 3-5年 5-10年 10年以上 7选1
*/
private String workYear;
/**
* 不限 大专 本科 硕士 博士 5选1
*/
private String education;
/**
* 任填,多个用英文逗号隔开,每个最多5个字
*/
private String positionBrightPoint;
/**
* 20-2000字html格式
*/
private String positionDesc;
/**
* 从地址列表中取
*/
private String workAddressId;
public String getChannelId() {
return channelId;
}
public void setChannelId(String channelId) {
this.channelId = channelId;
}
public String getPositionType() {
return positionType;
}
public void setPositionType(String positionType) {
this.positionType = positionType;
}
public String getPositionName() {
return positionName;
}
public void setPositionName(String positionName) {
this.positionName = positionName;
}
public String getPositionThirdType() {
return positionThirdType;
}
public void setPositionThirdType(String positionThirdType) {
this.positionThirdType = positionThirdType;
}
public String getDepartment() {
return department;
}
public void setDepartment(String department) {
this.department = department;
}
public String getJobNature() {
return jobNature;
}
public void setJobNature(String jobNature) {
this.jobNature = jobNature;
}
public String getSalaryMin() {
return salaryMin;
}
public void setSalaryMin(String salaryMin) {
this.salaryMin = salaryMin;
}
public String getSalaryMax() {
return salaryMax;
}
public void setSalaryMax(String salaryMax) {
this.salaryMax = salaryMax;
}
public String getWorkYear() {
return workYear;
}
public void setWorkYear(String workYear) {
this.workYear = workYear;
}
public String getEducation() {
return education;
}
public void setEducation(String education) {
this.education = education;
}
public String getPositionBrightPoint() {
return positionBrightPoint;
}
public void setPositionBrightPoint(String positionBrightPoint) {
this.positionBrightPoint = positionBrightPoint;
}
public String getPositionDesc() {
return positionDesc;
}
public void setPositionDesc(String positionDesc) {
this.positionDesc = positionDesc;
}
public String getWorkAddressId() {
return workAddressId;
}
public void setWorkAddressId(String workAddressId) {
this.workAddressId = workAddressId;
}
}
| MessiMercy/MessiCrawler | src/main/java/com/model/LagouModel.java |
65,916 | package com.docomo.Data;
public class TestStatus {
public static final int FirstBoot = 0x0;// 第一次启动
public static final int gettingLatency = 0x1;// 获取ping阶段
public static final int gettingUploadSpeed = 0x2;// 获取上行速度阶段
public static final int gettingDownloadSpeed = 0x4;// 获取下行速度阶段
public static final int oneTestCompleted = 0x8;// 测试结束阶段
public static final int reSetServer = 0x16;// 重设服务器地址
/**
* 异常中断阶段
* */
public static final int testInterruptInlatency = 0x46;// 异常中断阶段
public static final int testInterruptInupload = 0x47;// 异常中断阶段
public static final int testInterruptIndownload = 0x48;// 异常中断阶段
public static int testingStatus = FirstBoot;
public static boolean isFirstTimeBoot = true;
/**
* 测试配置参数
*
* */
public static final String Market = "jifeng";
//con_version active test engine version , SDK_version passive test engine version
public static final String Con_version = "ANTTEST6.3.4-" + Market;// 版本+市场
public static String locationTag = "";
public static int languageType = 0;
public static boolean isLanguageChanged = false;
/**
* 虚拟版本号设置 0:主版本号 1:校园测试版 2:高级模式版本
* */
public static int SettingVersion = 2;
public static final int SETTING_MAIN_VERSION = 0;
public static final int SETTING_CAMPUS_VERSION = 1;
public static final int SETTING_ADVANCED_VERSION = 2;
/**
* 测试数据是否即时上传,为true时即时上传,为false时则存储在本地,wifi情况下上传
* */
public static boolean isUploadInstant = true;
}
| yw778/byrpdr | src/com/docomo/Data/TestStatus.java |
65,918 | package com.reportforms.model;
import java.util.Date;
/**
* 渠道信息
*
* @author lisong.lan
*
*/
public class Channel {
private int id;// 渠道管理公司ID
private String password; // 密码(6位加密数)
private String pwd;// 密码(明文
private int fatherId;// 父渠道管理公司ID
private String fatherName;// 父渠道管理公司名
private String name;// 渠道管理公司
private int type;// 渠道类型(1:运营 2:市场)
private String contacter;// 联系人
private String phone;// 联系电话
private String email;// 邮箱地址
private String address;// 联系地址
private String description;// 简介说明
private String remark;// 备注
private boolean state;// 是否有效
private int sort;// 排序
private Date createTime;// 创建时间
private String operator;// 操作人
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getFatherId() {
return fatherId;
}
public void setFatherId(int fatherId) {
this.fatherId = fatherId;
}
public String getFatherName() {
return fatherName;
}
public void setFatherName(String fatherName) {
this.fatherName = fatherName;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public String getContacter() {
return contacter;
}
public void setContacter(String contacter) {
this.contacter = contacter;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public boolean isState() {
return state;
}
public void setState(boolean state) {
this.state = state;
}
public int getSort() {
return sort;
}
public void setSort(int sort) {
this.sort = sort;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public String getOperator() {
return operator;
}
public void setOperator(String operator) {
this.operator = operator;
}
public String getPwd() {
return pwd;
}
public void setPwd(String pwd) {
this.pwd = pwd;
}
}
| xiangtone/game-center | server-Report/src/com/reportforms/model/Channel.java |
65,919 | package me.bytebeats.mns;
import org.jetbrains.annotations.Nullable;
import java.util.List;
public interface SymbolParser {
List<String> parse();
@Nullable
String raw();
String prefix();//对应于不同市场, 例如us, hk, sh, sz
}
| bytebeats/mns | src/main/java/me/bytebeats/mns/SymbolParser.java |
65,920 | package com.mas.rave.main.vo;
import java.util.Date;
/**
* 渠道信息
*
* @author liwei.sz
*
*/
public class Channel {
private int id;// 渠道管理公司ID
private String password; // 密码(6位加密数)
private String pwd;// 密码(明文
private int fatherId;// 父渠道管理公司ID
private String fatherName;// 父渠道管理公司名
private String name;// 渠道管理公司
private int type;// 渠道类型(1:运营 2:市场)
private String contacter;// 联系人
private String phone;// 联系电话
private String email;// 邮箱地址
private String address;// 联系地址
private String description;// 简介说明
private String remark;// 备注
private boolean state;// 是否有效
private int sort;// 排序
private Date createTime;// 创建时间
private String operator;// 操作人
private Province province; // 对应省份
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getFatherId() {
return fatherId;
}
public void setFatherId(int fatherId) {
this.fatherId = fatherId;
}
public String getFatherName() {
return fatherName;
}
public void setFatherName(String fatherName) {
this.fatherName = fatherName;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public String getContacter() {
return contacter;
}
public void setContacter(String contacter) {
this.contacter = contacter;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public Province getProvince() {
return province;
}
public void setProvince(Province province) {
this.province = province;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public boolean isState() {
return state;
}
public void setState(boolean state) {
this.state = state;
}
public int getSort() {
return sort;
}
public void setSort(int sort) {
this.sort = sort;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public String getOperator() {
return operator;
}
public void setOperator(String operator) {
this.operator = operator;
}
public String getPwd() {
return pwd;
}
public void setPwd(String pwd) {
this.pwd = pwd;
}
}
| xiangtone/game-center | server-Market/src/com/mas/rave/main/vo/Channel.java |
65,922 | package ustc.sse.a4print;
/**
* Created by Administrator on 2015/11/2.
*/
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
public class Info implements Serializable
{
private static final long serialVersionUID = -1010711775392052966L;
private double latitude;
private double longitude;
private int imgId;
private String name;
private int zan;
private String address;
private String phone;
private String printAddressId;
public static List<Info> infos = new ArrayList<Info>();
// static
// {
// infos.add(new Info(120.732956,31.282505, R.drawable.a01, "中科大软件学院",
// "距离209米", 1456));
// infos.add(new Info(120.739581,31.282988, R.drawable.a02, "中国人大云打印店",
// "距离897米", 456));
// infos.add(new Info(120.744486,31.282494, R.drawable.a03, "南大云打印店",
// "距离249米", 1456));
// infos.add(new Info(120.755993,31.274809, R.drawable.a04, "文辉人渣市场",
// "距离679米", 1456));
// }
public Info( double longitude,double latitude, int imgId, String name,int zan,String address,String phone,String printAddressId)
{
this.latitude = latitude;
this.longitude = longitude;
this.imgId = imgId;
this.name = name;
this.zan = zan;
this.address=address;
this.phone=phone;
this.printAddressId=printAddressId;
}
public double getLatitude()
{
return latitude;
}
public void setLatitude(double latitude)
{
this.latitude = latitude;
}
public double getLongitude()
{
return longitude;
}
public void setLongitude(double longitude)
{
this.longitude = longitude;
}
public int getImgId()
{
return imgId;
}
public void setImgId(int imgId)
{
this.imgId = imgId;
}
public String getName()
{
return name;
}
public void setName(String name)
{
this.name = name;
}
public int getZan()
{
return zan;
}
public void setZan(int zan)
{
this.zan = zan;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getPrintAddressId() {
return printAddressId;
}
public void setPrintAddressId(String printAddressId) {
this.printAddressId = printAddressId;
}
}
| LehmanHe/A4print | app/src/main/java/ustc/sse/a4print/Info.java |
65,923 | package com.module.market;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.apache.commons.lang.StringUtils;
import org.hibernate.hql.ast.SqlASTFactory;
import org.json.JSONObject;
import org.omg.CORBA.INTERNAL;
import org.springframework.context.annotation.Scope;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import com.core.BaseAction;
import com.core.dao.UtilDAO;
import com.model.Customer;
import com.model.Market;
import com.model.Market;
@Component
@Scope("prototype")
public class MarketAction extends BaseAction{
/**
*
*/
private static final long serialVersionUID = 3861279572611224546L;
private Market market;
private List<Market> list;
@Resource
private UtilDAO utilDAO;
@Resource
private JdbcTemplate jdbcTemplate;
private String resultObj;
private int totalPage;
private int currentPage;
private int itemPrePage=10;
private int id;
private String clientName;
private String opponentName;
private String byPage;
private int totalItem;
private int start;
public String insert() {
market.setClientId("" + getSessionBranch().getId());
market.setClientName(getSessionBranch().getArea()+"/"+getSessionBranch().getTrueName());
String info="";
if (market.getId()!=0) {
info="市场 "+market.getProductName()+" 更新成功";
}else {
info="市场 "+market.getProductName()+" 录入成功";
}
utilDAO.saveOrUpdate(market);
writeJSON(info);
System.out.println(resultObj);
return SUCCESS;
}
public String delete(){
Market c=(Market) utilDAO.findListByProperty("Market", "id", id, "").get(0);
String name=c.getProductName();
utilDAO.delete(c);
JSONObject joCode=new JSONObject();
try {
joCode.put("resultcode", "200");
joCode.put("name", name);
joCode.put("id", id);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
resultObj=joCode.toString();
return SUCCESS;
}
public void writeJSON(String info){
JSONObject joCode=new JSONObject();
try {
joCode.put("resultcode", "200");
joCode.put("info", info);
joCode.put("id", market.getId());
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
resultObj=joCode.toString();
}
public String show(){
if(currentPage==0)
currentPage=1;
start=(currentPage-1)*itemPrePage;
getPrar();
if (getSessionBranch().getType()==3) {
type3();
}
if (getSessionBranch().getType()==2) {
type2();
}
if (getSessionBranch().getType()==1) {
type1();
}
if (totalItem%itemPrePage==0) {
totalPage=totalItem/itemPrePage;
}else {
totalPage=totalItem/itemPrePage+1;
}
return SUCCESS;
}
/**
* 获取参数
*/
public void getPrar(){
if (byPage==null) { //搜索框查询
if (StringUtils.isNotEmpty(clientName) ) {
getSession().put("clientName",clientName);
}else {
getSession().put("clientName", "");
}
if (StringUtils.isNotEmpty(opponentName) ) {
getSession().put("opponentName",opponentName);
}else {
getSession().put("opponentName", "");
}
}else { // 下一页查询
opponentName=(String) getSession().get("opponentName");
clientName=(String)getSession().get("clientName");
}
// System.out.println(clientName+" sss");
}
/*
* 总公司
*/
public void type3(){
String sqlCount="select count(*) from Market,opponent where opponentId=opponent.id ";
String sql="select Market.*,opponent.name opponentName from Market,opponent where " +
" market.opponentid =opponent.id ";
if (StringUtils.isNotEmpty(opponentName)) {
sqlCount+=" and opponent.name='"+opponentName+"'";
sql+=" and opponent.name='"+opponentName+"'";
}
if (StringUtils.isNotEmpty(clientName)&&
!clientName.equals("全部")) {
sqlCount+=" and Market.clientName = '"+clientName+"'";
sql+=" and Market.clientName = '"+clientName+"'";
}
sql+=" order by Market.clientid,market.id desc limit "+start+","+itemPrePage ;
totalItem=jdbcTemplate.queryForInt(sqlCount);
list=jdbcTemplate.query(sql, new BeanPropertyRowMapper<Market>(Market.class));
System.out.println(sql+" ppp "+ sqlCount);
}
/*
* 分公司
*/
public void type2(){
String sqlCount="select count(*) from Market,user,opponent where Market.clientId=user.id " +
" and user.branchId="+getSessionBranch().getBranchId()+" and market.opponentid=opponent.id ";
String sql="select Market.*,opponent.name opponentName from Market,user,opponent where Market.clientId=user.id and " +
" user.branchId="+getSessionBranch().getBranchId()+" and market.opponentid =opponent.id ";
if (StringUtils.isNotEmpty(opponentName)) {
sqlCount+=" and opponent.name='"+opponentName+"'";
sql+=" and opponent.name='"+opponentName+"'";
}
if (StringUtils.isNotEmpty(clientName)&&
!clientName.equals("全部")) {
sqlCount+=" and market.clientName='"+clientName+"'";
sql+=" and market.clientName='"+clientName+"'";
}
sql+=" order by Market.clientid,market.id desc limit "+start+","+itemPrePage+" ";
totalItem=jdbcTemplate.queryForInt(sqlCount);
list=jdbcTemplate.query(sql, new BeanPropertyRowMapper<Market>(Market.class));
System.out.println(sql+" ppp"+ sqlCount);
}
/*
* 业务员
*/
public void type1(){
String sqlCount="select count(*) from Market,user,opponent where Market.clientId=user.id " +
"and market.opponentid=opponent.id and user.id="+getSessionBranch().getId();
String sql="select Market.*,opponent.name opponentName from Market,user,opponent where " +
" Market.clientId=user.id and user.id="+getSessionBranch().getId() +
" and market.opponentId=opponent.id ";
if (StringUtils.isNotEmpty(opponentName)) {
sqlCount+=" and opponent.name='"+opponentName+"'";
sql+=" and opponent.name='"+opponentName+"'";
}
sql+="order by Market.clientid,id desc limit "+start+","+itemPrePage;
totalItem=jdbcTemplate.queryForInt(sqlCount);
list=jdbcTemplate.query(sql, new BeanPropertyRowMapper<Market>(Market.class));
// System.out.println(sql+" sql");
}
public String getMarketByPage(){
if(currentPage==0)
currentPage=1;
int start=(currentPage-1)*itemPrePage;
if (currentPage==-1) {
start=0;
itemPrePage=1000;
}
String sql="SELECT "+
" market.*,opponent.`name` opponentName "+
" FROM"+
" market,opponent "+
" WHERE market.opponentId=opponent.id and "+
" market.clientId="+getSessionBranch().getId()+" order by id desc limit "+start+","+itemPrePage;
List<Map<String, Object>> list=jdbcTemplate.queryForList(sql);
net.sf.json.JSONObject joCode=new net.sf.json.JSONObject();
net.sf.json.JSONArray jsonArray=new net.sf.json.JSONArray();
sql="select count(*) from market where clientId="+getSessionBranch().getId()+" limit "+start+","+itemPrePage;
int totalItem=jdbcTemplate.queryForInt(sql);
if (totalItem%itemPrePage==0) {
totalPage=totalItem/itemPrePage;
}else {
totalPage=(totalItem/itemPrePage)+1;
}
joCode.put("totalPage", totalPage);
joCode.put("currentPage", currentPage);
joCode.put("totalItems", totalItem);
net.sf.json.JSONObject joResult=new net.sf.json.JSONObject();
for (Map<String, Object> m:list) {
joResult=net.sf.json.JSONObject.fromObject(m);
jsonArray.add(joResult);
}
joCode.put("result", jsonArray);
resultObj=joCode.toString();
System.out.println(resultObj+" *********");
return SUCCESS;
}
public String getById(){
market=(Market) utilDAO.findListByProperty("Market","id",id,"").get(0);
return SUCCESS;
}
public Market getMarket() {
return market;
}
public void setMarket(Market market) {
this.market = market;
}
public UtilDAO getUtilDAO() {
return utilDAO;
}
public void setUtilDAO(UtilDAO utilDAO) {
this.utilDAO = utilDAO;
}
public String getResultObj() {
return resultObj;
}
public void setResultObj(String resultObj) {
this.resultObj = resultObj;
}
public List<Market> getList() {
return list;
}
public void setList(List<Market> list) {
this.list = list;
}
public JdbcTemplate getJdbcTemplate() {
return jdbcTemplate;
}
public void setJdbcTemplate(JdbcTemplate jdbcTemplate) {
this.jdbcTemplate = jdbcTemplate;
}
public int getTotalPage() {
return totalPage;
}
public void setTotalPage(int totalPage) {
this.totalPage = totalPage;
}
public int getCurrentPage() {
return currentPage;
}
public void setCurrentPage(int currentPage) {
this.currentPage = currentPage;
}
public int getItemPrePage() {
return itemPrePage;
}
public void setItemPrePage(int itemPrePage) {
this.itemPrePage = itemPrePage;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getClientName() {
return clientName;
}
public void setClientName(String clientName) {
this.clientName = clientName;
}
public String getOpponentName() {
return opponentName;
}
public void setOpponentName(String marketName) {
this.opponentName = marketName;
}
public String getByPage() {
return byPage;
}
public void setByPage(String byPage) {
this.byPage = byPage;
}
public int getTotalItem() {
return totalItem;
}
public void setTotalItem(int totalItem) {
this.totalItem = totalItem;
}
public int getStart() {
return start;
}
public void setStart(int start) {
this.start = start;
}
}
| cxyxd/BJAdmin | src/com/module/market/MarketAction.java |
65,924 | package com.xnx3.net;
import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.dysmsapi.model.v20170525.SendSmsRequest;
import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse;
import com.aliyuncs.exceptions.ClientException;
import com.aliyuncs.exceptions.ServerException;
import com.aliyuncs.profile.DefaultProfile;
import com.aliyuncs.profile.IClientProfile;
import com.xnx3.BaseVO;
/**
* 阿里云短信发送
* 需Jar包:
* <br/>aliyun-java-sdk-core-2.4.3.jar
* <br/>aliyun-java-sdk-dysmsapi-1.0.0.jar
* @author 管雷鸣
* @see https://help.aliyun.com/document_detail/44364.html
*/
public class AliyunSMSUtil {
public String regionId;
public String accessKeyId;
public String accessKeySecret;
static final String product = "Dysmsapi"; //产品名称:云通信短信API产品,开发者无需替换
static final String domain = "dysmsapi.aliyuncs.com"; //产品域名,开发者无需替换
/**
* 阿里云短信发送配置参数初始化
* @param regionId 机房信息,如
* <ul>
* <li>cn-hangzhou</li>
* <li>cn-qingdao</li>
* <li>cn-hongkong</li>
* </ul>
* @param accessKeyId Access Key Id , 参见 https://ak-console.aliyun.com/?spm=#/accesskey
* @param accessKeySecret Access Key Secret, 参见 https://ak-console.aliyun.com/?spm=#/accesskey
*/
public AliyunSMSUtil(String regionId, String accessKeyId, String accessKeySecret) {
this.regionId = regionId;
this.accessKeyId = accessKeyId;
this.accessKeySecret = accessKeySecret;
}
/**
* 发送短信,如
* <pre>sms.send("网市场","SMS_40000000","{\"code\":\"123456\"}","18711111111");</pre>
* @param signName 控制台创建的签名名称(状态必须是验证通过)
* <br/> https://sms.console.aliyun.com/?spm=#/sms/Sign
* @param templateCode 控制台创建的模板CODE(状态必须是验证通过)
* <br/> https://sms.console.aliyun.com/?spm=#/sms/Template
* @param paramString 短信模板中的变量;数字需要转换为字符串;个人用户每个变量长度必须小于15个字符。 例如:短信模板为:“接受短信验证码${no}”,此参数传递{“no”:”123456”},用户将接收到[短信签名]接受短信验证码123456,传入的字符串为JSON格式
* @param phone 接收短信的手机号
* @return {@link BaseVO}
* <ul>
* <li>若成功,返回 {@link BaseVO#SUCCESS},此时可以用 {@link BaseVO#getInfo()} 拿到其requestId</li>
* <li>若失败,返回 {@link BaseVO#FAILURE},此时可以用 {@link BaseVO#getInfo()} 拿到其错误原因(catch的抛出的异常名字)</li>
* </ul>
*/
public BaseVO send(String signName,String templateCode,String templateParamString, String phone) {
BaseVO vo = new BaseVO();
//可自助调整超时时间
System.setProperty("sun.net.client.defaultConnectTimeout", "10000");
System.setProperty("sun.net.client.defaultReadTimeout", "10000");
//初始化acsClient,暂不支持region化
IClientProfile profile = DefaultProfile.getProfile(regionId, accessKeyId, accessKeySecret);
try {
DefaultProfile.addEndpoint(regionId, regionId, product, domain);
} catch (ClientException e1) {
e1.printStackTrace();
vo.setBaseVO(BaseVO.FAILURE, e1.getMessage());
return vo;
}
IAcsClient acsClient = new DefaultAcsClient(profile);
//组装请求对象-具体描述见控制台-文档部分内容
SendSmsRequest request = new SendSmsRequest();
//必填:待发送手机号
request.setPhoneNumbers(phone);
//必填:短信签名-可在短信控制台中找到
request.setSignName(signName);
//必填:短信模板-可在短信控制台中找到
request.setTemplateCode(templateCode);
//可选:模板中的变量替换JSON串,如模板内容为"亲爱的${name},您的验证码为${code}"时,此处的值为
request.setTemplateParam(templateParamString);
//选填-上行短信扩展码(无特殊需求用户请忽略此字段)
//request.setSmsUpExtendCode("90997");
//可选:outId为提供给业务方扩展字段,最终在短信回执消息中将此值带回给调用者
// request.setOutId("yourOutId");
//hint 此处可能会抛出异常,注意catch
try {
SendSmsResponse sendSmsResponse = acsClient.getAcsResponse(request);
vo.setInfo(sendSmsResponse.getRequestId());
} catch (ServerException e) {
vo.setBaseVO(BaseVO.FAILURE, e.getMessage());
e.printStackTrace();
} catch (ClientException e) {
vo.setBaseVO(BaseVO.FAILURE, e.getMessage());
e.printStackTrace();
}
return vo;
}
public static void main(String[] args) {
AliyunSMSUtil sms = new AliyunSMSUtil("cn-hongkong", "...", "...");
sms.send("网市场","SMS_1234566","{\"code\":\"12345s6\"}","18788888888");
}
}
| xnx3/xnx3 | src/main/java/com/xnx3/net/AliyunSMSUtil.java |
65,925 | /*
* The MIT License (MIT)
*
* Copyright (c) 2014-2015 [email protected]
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package viewer.samples.rarda;
import com.github.abel533.echarts.Radar;
import com.github.abel533.echarts.data.RadarData;
import com.github.abel533.echarts.series.RadarSeries;
import com.github.abel533.echarts.style.TextStyle;
import org.junit.Test;
import viewer.util.EnhancedOption;
/**
* 雷达图测试1
*
* @author liuxu
* @date 18-7-10下午4:21
*/
public class RadarTest1 {
@Test
public void test() {
EnhancedOption option = new EnhancedOption();
option.title().text("基础雷达图").subtext("基础雷达图subtext");
option.legend("预算分配(Allocated Budget)", "实际开销(Actual Spending)");
//设置 Radar
Radar radar = new Radar();
radar.name(new Radar.Name().textStyle(new TextStyle().color("#fff").backgroundColor("#999").borderRadius(3).padding(new Integer[]{3, 5})));
radar.indicator(new Radar.Indicator().name("销售(sales)").max(6500),
new Radar.Indicator().name("管理(Administration)").max(16000),
new Radar.Indicator().name("信息技术(Information Techology)").max(30000),
new Radar.Indicator().name("客服(Customer Support)").max(38000),
new Radar.Indicator().name("研发(Development)").max(52000),
new Radar.Indicator().name("市场(Marketing)").max(25000));
option.radar(radar);
//设置 Series
RadarSeries radar1 = new RadarSeries("预算 vs 开销(Budget vs spending)");
RadarData radarData1 = new RadarData("预算分配", new Integer[]{4300, 10000, 28000, 35000, 50000, 19000});
RadarData radarData2 = new RadarData("实际开销", new Integer[]{5000, 14000, 28000, 31000, 42000, 21000});
radar1.data(radarData1,radarData2);
option.series(radar1);
System.out.println(option.toString());
option.exportToHtml("radar1.html");
option.view();
}
}
| AlexSSR/graph-complexity | src/main/java/viewer/samples/rarda/RadarTest1.java |
65,958 | package View;
import Controller.Controller;
import Model.Database;
import Model.bubbleTool;
import Model.chatManager;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.layout.Pane;
import javafx.stage.Modality;
import javafx.stage.StageStyle;
import java.io.IOException;
import java.sql.ResultSet;
import java.sql.SQLException;
public class chat extends Window{
private ListView chatlist;
private friendList fl;
public chat() throws IOException{
root = FXMLLoader.load(getClass().getResource("Fxml/MainWindow.fxml"));
setScene(new Scene(root,638,567));
initStyle(StageStyle.TRANSPARENT);
chatlist = ((ListView) $("ChatList"));
move();
quit();
quit2();
mini();
setIcon();
initToolTip();
}
/**
* 初始化提示助手
*/
public void initToolTip(){
((Button) $("quit1")).setTooltip(new Tooltip("退出"));
((Button) $("minimiser1")).setTooltip(new Tooltip("最小化"));
}
/**
* 退出方法
*/
public void quit(){
((Button) $("quit1")).setOnAction(event -> {
this.close();
});
}
public void quit2(){
((Button) $("quit2")).setOnAction(event -> {
this.close();
});
}
/**
* 最小化方法
*/
public void mini(){
((Button) $("minimiser1")).setOnAction(event -> {
setIconified(true);
});
}
/**
* 添加好友的消息到列表中
* @param fHead 好友头像
* @param fMsg 好友消息
*/
public void addLeft(String fHead,String fMsg){
chatlist.getItems().add(new chatList().setLeft(fHead,fMsg, bubbleTool.getWidth(fMsg),bubbleTool.getHeight(fMsg)));
}
/**
* 添加我的消息到消息列表中
* @param iHead 我的头像
* @param iMsg 我的消息
*/
public void addRight(String iHead,String iMsg){
chatlist.getItems().add(new chatList().setRight(iHead,iMsg, bubbleTool.getWidth(iMsg),bubbleTool.getHeight(iMsg)));
}
/**
* 设置模态窗口
* @param window
*/
public void setModailty(Window window){
initModality(Modality.APPLICATION_MODAL);
initOwner(window);
}
/**
* 查看好友资料
* @param account 好友账号
* @param remark 好友备注
* @param database
* @param friendpage
*/
public void friendMore(String account, String remark, Database database, friendPage friendpage){
((Button) $("friendMore")).setOnAction(event -> {
if(account.equals("助手小熊")){
((TextField) friendpage.$("name")).setText("熊义杰");
((TextField) friendpage.$("age")).setText("19");
((TextField) friendpage.$("sex")).setText("男");
((TextField) friendpage.$("address")).setText("软工1709班");
((TextField) friendpage.$("phone")).setText("13330114338");
((Label) friendpage.$("account")).setText("8002117371");
((TextField) friendpage.$("label")).setText("版本:6.0.3");
((TextField) friendpage.$("remark")).setText("小熊");
friendpage.setHead(((Button) friendpage.$("head")),"head9");
friendpage.setBackground((Pane) friendpage.$("background"),"background6");
friendpage.setNoAction();
friendpage.show();
}else {
if(friendpage.isShowing()){
friendpage.close();
}
try{
ResultSet resultSet = database.execResult("select * from user where account = ?",account);
if(resultSet.next()){
try {
fl = new friendList(resultSet.getString("head"),resultSet.getString("account"),remark,resultSet.getString("label"));
friendpage.setFriendPage(resultSet,remark);
fl.editFriendRemark(friendpage,database,account,Controller.userdata.getAccount());
friendpage.setNoAction();
friendpage.show();
}catch (IOException e){
e.printStackTrace();
}
}
}catch (SQLException e){
e.printStackTrace();
}
}
});
}
}
| jie12366/imitate-qq | src/View/chat.java |