file_id
int64 1
66.7k
| content
stringlengths 14
343k
| repo
stringlengths 6
92
| path
stringlengths 5
169
|
---|---|---|---|
64,705 | /**
*
* @author ChopinXBP 输入一个整数,输出该数二进制表示中1的个数。其中负数用补码表示。
* 思路:Integer.toBinaryString(n)转为字符串判断
*
*/
public class NumberOf1_11 {
public static void main(String[] args) {
// TODO Auto-generated method stub
int n = Solve(-5);
System.out.println(n);
}
// -------------投机取巧的解法:转换为字符串---------------------//
public static int Solve(int n) {
int result = 0;
String binstr = Integer.toBinaryString(n);
System.out.println(binstr);
for (int i = 0; i < binstr.length(); i++) {
if (binstr.charAt(i) == '1')
result++;
}
return result;
}
// -------------可能陷入死循环的解法:从右向左移---------------------//
// 从n的2进制形式的最右边开始判断是不是1,该解法如果输入时负数会陷入死循环,因为负数右移时,在最高位补得是1,最后会补成0xFFFFFFFF。
public static int NumberOf1_CanNotUse(int n) {
int count = 0;
while (n != 0) {
// 用1和n进行位与运算,结果要是为1则n的2进制形式.最右边那位肯定是1,否则为0
if ((n & 1) == 1) {
count++;
}
// 把n的2进制形式往右推一位
n = n >> 1;
}
return count;
}
// --------------------正解:从左向右移---------------------------//
// 思想:用1(1自身左移运算,其实后来就不是1了)和n的每位进行位与,来判断1的个数
private static int NumberOf1_low(int n) {
int count = 0;
int flag = 1;
while (flag != 0) {
if ((n & flag) != 0) {
count++;
}
flag = flag << 1;
}
return count;
}
// ---------------------------最优解----------------------------//
// 思想:把一个整数减去1,再和原整数做与运算,会把整数最右边的一个1变成0。
// 那么一个整数的二进制表示中有多少个1,就可以进行多少次这样的操作。
public static int NumberOf1(int n) {
int count = 0;
while (n != 0) {
++count;
n = (n - 1) & n;
}
return count;
}
}
| ChopinXBP/JZOffer_Babel | src/NumberOf1_11.java |
64,706 | package myjava;
/**
* 正则表达式
*/
public class JavaSort {
public static void main(String[] args) {
int [] nums ={-4,0,7,4,9,-5,-1,0,-7,-1};
// 快速排序, 思想:有点类似二分查找
// 确认一个基数,两个指针, low 指向最前, high指向最后
// 先比较high,如果high位置上的指针大于或等于基数, high -- ,继续比较直到high = low或者high位置上的数据大于基数
// 然后比较 low ,同理
// 一轮循环过后,基础前面的均比基数小,基数后面的均比基数大
// 递归分别处理基数前面的和基数后面的,基数不用再参与比较
quickSort(nums, 0, nums.length -1);
for (int i : nums) {
System.out.println(i);
}
}
private static void quickSort(int[] nums, int low, int high){
if(low < high){
// 获取基数的位置
int index = getIndex(nums, low, high);
// 处理基数前面的排序
quickSort(nums, low, index -1);
// 处理基数后面的排序
quickSort(nums, index + 1, high);
}
}
private static int getIndex(int[] nums, int low, int high){
// 取得基数的值,保存临时变量
int flag = nums[low];
while(low < high){
// 当队尾的元素大于等于基准数据时,向前挪动high指针
while(flag <= nums[high] && low < high){
high --;
}
// 如果队尾元素小于tmp了,需要将其赋值给low
nums[low] = nums[high];
// 当队首元素小于等于tmp时,向前挪动low指针
while(flag >= nums[low] && low < high){
low ++;
}
// 当队首元素大于tmp时,需要将其赋值给high
nums[high] = nums[low];
}
// 基础位置调整,重新赋值基数
nums[low] = flag;
return low;
}
}
| hack-feng/Java-Notes | src/myjava/JavaSort.java |
64,709 | package t1007;
import java.io.BufferedInputStream;
import java.util.*;
/**
* Created by xl on 15/10/6.
* 问题描述:http://acm.acmcoder.com/showproblem.php?pid=1007
* 问题简化:求N个点中相距最近的两个点,就是求最近点对,编程之美里面有一样的文章。2.11
* 思想:用分治。先将数据按照x坐标排序,取中点,分别求各组的最小距离。
*/
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(new BufferedInputStream(System.in));
int number = 0;
while (scanner.hasNext()){
number = scanner.nextInt();
if (number == 0)
System.exit(0);
double minDis = 0;
Point[] point = new Point[number];
for (int i = 0; i < number; i++){
double x = scanner.nextDouble();
double y = scanner.nextDouble();
point[i] = new Point(x, y);
}
minDis = new Main().getMinDis(point);
System.out.println(String.format("%.2f", minDis / 2));
}
scanner.close();
}
public double getMinDis(Point[] points){
//先对序列按x轴大小进行排序
Arrays.sort(points, new AscByX());
return cal(points, 0, points.length - 1);
}
public double cal(Point[] points, int left, int right){
double result = 0;
if (left == right)
return result;
else if (left == right - 1)
return distance(points[left], points[right]);
else if (left == right -2 ){
double temp1 = distance(points[left], points[left+1]);
double temp2 = distance(points[left], points[right]);
double temp3 = distance(points[left+1], points[right]);
return min(min(temp1, temp2), temp3);
}
int mid = (left + right) >> 1;
result = min(cal(points, left, mid), cal(points, mid, right));
//选出中线附近,x坐标值相距小于result的坐标点,并记录,后续从这些点中检查出跨线的点距离。
ArrayList<Point> nearPoints = new ArrayList<>();
for (Point point : points){
if (Math.abs(points[mid].x - point.x) < result){
nearPoints.add(point);
}
}
//对y坐标进行排序,并计算
Collections.sort(nearPoints, new AscByY());
for (int i = 0; i < nearPoints.size(); i++){
for (int j = i + 1; j < nearPoints.size() && nearPoints.get(j).y - nearPoints.get(i).y < result; j++){
double nearDis = distance(nearPoints.get(j), nearPoints.get(i));
if (nearDis < result){
result = nearDis;
}
}
}
return result;
}
public double distance(Point pointA, Point pointB){
return Math.hypot(pointA.x - pointB.x, pointA.y - pointB.y);
}
public double min(double a, double b){
return a < b ? a : b;
}
//以x为基准排序
private static class AscByX implements Comparator<Point>{
@Override
public int compare(Point pointA, Point pointB) {
if (pointA.x != pointB.x)
return (int)Math.ceil(pointA.x - pointB.x);
return (int)Math.ceil(pointA.y - pointB.y);
}
}
//以y为基准排序
private static class AscByY implements Comparator<Point>{
@Override
public int compare(Point pointA, Point pointB) {
if (pointA.y != pointB.y)
return (int)Math.ceil(pointA.y - pointB.y);
return (int)Math.ceil(pointA.x - pointB.x);
}
}
}
class Point {
double x;
double y;
public Point(double a, double b){
x = a;
y = b;
}
}
/*
* Java真是给跪了。。。同样的思想,用c++:
#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
int n;
struct node
{
double x;
double y;
}p[100005];
int a[100005];
double cmpx(node a,node b)
{
return a.x<b.x;
}
double cmpy(int a,int b)
{
return p[a].y<p[b].y;
}
double min(double a,double b)
{
return a<b?a:b;
}
double dis(node a,node b)
{
return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));
}
double find(int l,int r)
{
if(r==l+1)
return dis(p[l],p[r]);
if(l+2==r)
return min(dis(p[l],p[r]),min(dis(p[l],p[l+1]),dis(p[l+1],p[r])));
int mid=(l+r)>>1;
double ans=min(find(l,mid),find(mid+1,r));
int i,j,cnt=0;
for(i=l;i<=r;i++)
{
if(p[i].x>=p[mid].x-ans&&p[i].x<=p[mid].x+ans)
a[cnt++]=i;
}
sort(a,a+cnt,cmpy);
for(i=0;i<cnt;i++)
{
for(j=i+1;j<cnt;j++)
{
if(p[a[j]].y-p[a[i]].y>=ans) break;
ans=min(ans,dis(p[a[i]],p[a[j]]));
}
}
return ans;
}
int main()
{
int i;
while(scanf("%d",&n)!=EOF)
{
if(!n) break;
for(i=0;i<n;i++)
scanf("%lf %lf",&p[i].x,&p[i].y);
sort(p,p+n,cmpx);
printf("%.2lf%\n",find(0,n-1)/2);
}
return 0;
}
* */ | uestcxl/acmcoder | src/t1007/Main.java |
64,712 | package array;
/**
* 动态数组
* <p>
* 思想: 新建一个新的数组,容量需要进行扩大,
* 然后让成员变量数组指针指向新建的数组,原来的数组
* 没有指针指向,会被Java 垃圾回收器回收
* <p>
* 时间复杂度分析:
* 增: O(n)
* 删: O(n)
* 改: 已知索引O(1),未知索引:O(n)
* 查:已知索引O(1),未知索引:O(n)
* <p>
* 添加操作: 均摊时间复杂度
* <p>
* 复杂度震荡: capacity = n
* addLast 扩容 之后紧接着 removeLast 两次时间复杂度 O(n)
* removeLast
* 原因: removeLast 时resize() 过于着急
* 解决方案:Lazy 缩容时候 当size == capacity/4 才将capacity减半 空间换时间
*/
public class DynamicArray<E> {
private E[] data;
private int size;
/**
* @param capacity 传数组的容量
*/
public DynamicArray(int capacity) {
data = (E[]) new Object[capacity];
size = 0;
}
public DynamicArray() {
this(10);
}
public DynamicArray(E[] eArray) {
data = (E[]) new Object[eArray.length];
for (int i = 0; i < eArray.length; i++) {
data[i] = eArray[i];
}
size = eArray.length;
}
/**
* @return 数组长度
*/
public int getSize() {
return size;
}
/**
* @return 当前数组容量
*/
public int getCapacity() {
return data.length;
}
/**
* @return 是否为空
*/
public boolean isEmpty() {
return size == 0;
}
/**
* 均摊时间复杂度
* O(1)
*
* @param e 向所有元素后添加一个新元素
*/
public void addLast(E e) {
add(size, e);
}
/**
* @param e 向所有元素第一个添加一个新元素 O(n)
*/
public void addFirst(E e) {
add(0, e);
}
/**
* 指定位置添加元素
* <p>
* 时间复杂度,index取值的概率是一样的
* 每个元素期望是多少,平均时间度O(n/2) ~~ O(n),
* 时间复杂度 :
* 需要按照最坏的方案计算,
* 考虑最好的意义不大
*
* @param index 指定位置
* @param e 元素
*/
public void add(int index, E e) {
if (index < 0 || index > size) {
throw new IllegalArgumentException("Add Failed");
}
if (size == data.length) {
resize(2 * data.length);
}
//每一个元素向后一个位置
for (int i = size - 1; i >= index; i--) {
data[i + 1] = data[i];
}
data[index] = e;
size++;
}
/**
* 数组扩容 :
* 思想,数组当前长度或大或小,不理想,最好是倍数
* <p>
* ArrayList 扩容是原来Size的1.5倍数
* <p>
* 时间复杂度:O(n)
* <p>
* 均摊时间复杂度: 假设capacity = 8, 并且每一次添加操作都是用addLast,
* 9次addLast 操作,触发一次resize,总共进行了17次基本操作,平均每次addLast
* 就执行2次基本操作(扩容倍数),
* 假设capacity = n,n+1次addLast,触发resize,总共进行2n+1次基本操作
* 平均每次addLast就执行2次基本操作(扩容倍数),
*
* @param newCapacity 新数组长度
*/
private void resize(int newCapacity) {
E[] newData = (E[]) new Object[newCapacity];
for (int i = 0; i < size; i++) {
newData[i] = data[i];
}
data = newData;
}
/**
* 删除一个
*
* @param e 删除元素
*/
public void removeElement(E e) {
int index = find(e);
if (index != -1) {
remove(index);
}
}
/**
* 时间复杂度:O(n)
*
* @return
*/
public E removeFirst() {
return remove(0);
}
/**
* 均摊时间复杂度
* O(1)
*
* @return
*/
public E removeLast() {
return remove(size - 1);
}
/**
* 时间复杂度:O(n)
*
* @param index 删除索引元素
*/
public E remove(int index) {
if (index < 0 || index >= size) {
throw new IllegalArgumentException("Remove Failed");
}
E ret = data[index];
for (int i = index + 1; i < size; i++) {
data[i - 1] = data[i];
}
size--;
data[size] = null;
if (size == data.length / 4 && data.length / 2 != 0) {
resize(data.length / 2);
}
return ret;
}
/**
* 时间复杂度:O(1): 支持随机索引
*
* @param index 索引
* @param e 索引对应元素
*/
public void set(int index, E e) {
if (index < 0 || index >= size) {
throw new IllegalArgumentException("Set Failed");
}
data[index] = e;
}
/**
* @param index 索引
* @return 索引对应元素
*/
public E get(int index) {
if (index < 0 || index >= size) {
throw new IllegalArgumentException("Get Failed");
}
return data[index];
}
public E getLast() {
return get(size - 1);
}
public E getFirst() {
return get(0);
}
/**
* 时间复杂度:O(n)
*
* @return 是否包含
*/
public boolean contains(E e) {
for (int i = 0; i < size; i++) {
if (e.equals(data[i])) {
return true;
}
}
return false;
}
/**
* 时间复杂度:O(n)
*
* @return 元素的索引
*/
public int find(E e) {
for (int i = 0; i < size; i++) {
if (e.equals(data[i])) {
return i;
}
}
return -1;
}
/**
* 交换
*/
public void swap(int i, int j) {
if (i < 0 || i >= size || j < 0 || j >= size) {
throw new IllegalArgumentException("Index is illegal");
}
E temp = data[i];
data[i] = data[j];
data[j] = temp;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append(String.format("Array:Size = %d , capacity = %d \n", size, data.length));
builder.append("[");
for (int i = 0; i < size; i++) {
builder.append(data[i]);
if (i != size - 1) {
builder.append(", ");
}
}
builder.append("]");
return builder.toString();
}
}
| CaiPeng/JavaDataStructure | src/array/DynamicArray.java |
64,713 | /**
* Definition for ListNode.
* public class ListNode {
* int val;
* ListNode next;
* ListNode(int val) {
* this.val = val;
* this.next = null;
* }
* }
*/
public class Solution {
/**
* @param lists: a list of ListNode
* @return: The head of one sorted list.
*/
public ListNode mergeKLists(List<ListNode> lists) {
//利用归并的方法。思想,时间复杂度:O(Nlogk)
if (lists == null || lists.size() == 0) {
return null;
}
return mergeHelper(lists, 0, lists.size() - 1);
//merge two by two, 时间复杂度:O(Nlogk)
// if (lists == null || lists.size() == 0) {
// return null;
// }
// while (lists.size() > 1) {
// List<ListNode> new_list = new ArrayList<>();
// for (int i = 0; i + 1 < lists.size(); i += 2) {
// ListNode node = merge(lists.get(i), lists.get(i + 1));
// new_list.add(node);
// }
// if (lists.size() % 2 == 1) {
// new_list.add(lists.get(lists.size() - 1));
// }
// lists = new_list;
// }
// return lists.get(0);
//heap, 时间复杂度:O(Nlogk)
// if (lists == null || lists.size() == 0) {
// return null;
// }
// Queue<ListNode> heap = new PriorityQueue<>(lists.size(), new Comparator<ListNode>() {
// public int compare(ListNode n1, ListNode n2) {
// return n1.val - n2.val;
// }
// });
// for (int i = 0; i < lists.size(); i++) {
// if (lists.get(i) != null) {
// heap.add(lists.get(i));
// }
// }
// ListNode dummy = new ListNode(-1);
// ListNode tail = dummy;
// while (!heap.isEmpty()) {
// ListNode node = heap.poll();
// tail.next = node;
// tail = node;
// if (node.next != null) {
// node = node.next;
// heap.add(node);
// }
// }
// return dummy.next;
}
private ListNode mergeHelper(List<ListNode> lists, int start, int end) {
if (start == end) {
return lists.get(start);
}
int mid = start + (end - start) / 2;
ListNode left = mergeHelper(lists, start, mid);
ListNode right = mergeHelper(lists, mid + 1, end);
return merge1(left, right);
}
private ListNode merge1(ListNode a, ListNode b) {
ListNode dummy = new ListNode(-1);
ListNode tail = dummy;
while (a != null && b != null) {
if (a.val < b.val) {
tail.next = a;
a = a.next;
} else {
tail.next = b;
b = b.next;
}
tail = tail.next;
}
if (a != null) {
tail.next = a;
} else {
tail.next = b;
}
return dummy.next;
}
private ListNode merge(ListNode a, ListNode b) {
ListNode dummy = new ListNode(-1);
ListNode tail = dummy;
while (a != null && b != null) {
if (a.val < b.val) {
tail.next = a;
a = a.next;
} else {
tail.next = b;
b = b.next;
}
tail = tail.next;
}
if (a != null) {
tail.next = a;
} else {
tail.next = b;
}
return dummy.next;
}
}
| Mol1122/leetcode | 23.Merge k sorted lists.java |
64,714 | package 排序;
/*
* 思想:分治
*/
import java.util.Arrays;
public class 归并排序 {
public static void mergeSort(int[] arr) {
sort(arr, 0, arr.length - 1);
}
public static void sort(int[] arr, int L, int R) {
if (L == R) {
return;
}
int mid = (L + R) / 2;
sort(arr, L, mid);
sort(arr, mid + 1, R);
merge(arr, L, mid, R);
}
//两路归并算法,两个排好序的子序列合并为一个子序列
public static void merge(int[] arr, int L, int mid, int R) {
int[] tmp = new int[arr.length]; //辅助数组
int i = 0;
int p1 = L;
int p2 = mid + 1;
//比较左右两部分的元素,哪个小,把那个元素填入tmp中
while (p1 <= mid && p2 <= R) {
tmp[i++] = arr[p1] < arr[p2] ? arr[p1++] : arr[p2++];
}
//哪个没有遍历完,直接挂在tmp后边,两个while只执行一个
while (p1 <= mid) {
tmp[i++] = arr[p1++];
}
while (p2 <= R) {
tmp[i++] = arr[p2++];
}
//把最终的排序结果复制给原数组
i = 0;
while (L <= R) {
arr[L++] = tmp[i++];
}
}
public static void main(String[] args) {
int[] a = {8, 4, 5, 7, 1, 3, 6, 2};
System.out.println("原数组:" + Arrays.toString(a));
mergeSort(a);
System.out.println("排序后:" + Arrays.toString(a));
}
}
| TangDuoBuTiao/Algorithm_JAVA | src/排序/归并排序.java |
64,715 | /*
* @lc app=leetcode.cn id=38 lang=java
*
* [38] 外观数列
*/
// @lc code=start
import java.util.ArrayList;
class Solution {
public String countAndSay(int n) {
/*********************************以下为改进后版本************************** */
// 1. 使用** 双指针 ** 思想!!!
//2. 对 Integer 和 字符串之间的转换不熟练!! 学会使用StringBuilder
String ans = "1";
for (int i = 2; i <= n; i++){
StringBuilder sb = new StringBuilder();
int start = 0;
int pos = 0; //双指针!!!
while (pos < ans.length()) {
while (pos < ans.length() && ans.charAt(start) == ans.charAt(pos)) {
pos ++;
}
sb.append(Integer.toString(pos - start)).append(ans.charAt(start));
start = pos;
}
ans = sb.toString();
}
return ans;
/************************以上为原始答案,评价为 : 史 ****************************/
// String str = "1";
// for (int i = 2 ; i <= n; i++){
// ArrayList<Integer> countAndSay = new ArrayList<>();
// int count = 0;
// char[] str2ch = str.toCharArray();
// char flag = str2ch[0];
// for (int j = 0; j < str2ch.length; j++){
// if(str2ch[j] == flag && j < str2ch.length -1){
// count ++;
// }
// else if(str2ch[j] == flag && j == str2ch.length -1){
// count ++;
// countAndSay.add(count);
// countAndSay.add(str2ch[j] - '0');
// }
// else if(str2ch[j] != flag && j< str2ch.length -1){
// countAndSay.add(count);
// countAndSay.add(str2ch[j-1] - '0');
// flag = str2ch[j];
// count = 1;
// }
// else if(str2ch[j] != flag && j == str2ch.length -1){
// countAndSay.add(count);
// countAndSay.add(str2ch[j-1] - '0');
// countAndSay.add(1);
// countAndSay.add(str2ch[j] - '0');
// }
// }
// System.out.println(countAndSay.toString());
// if(!countAndSay.isEmpty())
// str = countAndSay.toString().replaceAll("\\s+", "")
// .replaceAll(",", "")
// .replaceAll("\\[", "")
// .replaceAll("]", "");
// else
// str = "11";
// }
// return str;
/************************以上为原始答案,评价为 : 史 ****************************/
// 1. 使用** 双指针 ** 思想!!!
//2. 对 Integer 和 字符串之间的转换不熟练!!
/*********************************以下为改进后版本************************** */
}
}
// @lc code=end
| jojocc1030/leetcode | 38.外观数列.java |
64,717 | /*
Problem Statement
There are numMales males and numFemales females arranged in a circle. Starting from a given point, you count clockwise and remove the K'th person from the circle (where K=1 is the person at the current point, K=2 is the next person in the clockwise direction, etc...). After removing that person, the next person in the clockwise direction becomes the new starting point. After repeating this procedure numFemales times, there are no females left in the circle.
Given numMales, numFemales and K, your task is to return what the initial arrangement of people in the circle must have been, starting from the starting point and in clockwise order.
For example, if there are 5 males and 3 females and you remove every second person, your return String will be "MFMFMFMM".
Definition
Class:
PeopleCircle
Method:
order
Parameters:
int, int, int
Returns:
String
Method signature:
String order(int numMales, int numFemales, int K)
(be sure your method is public)
*/
/**
* 思想: 用 链表来模拟环,用delete这个field 来表示当前这个node是否已经被删除,(但是实际不需要删除)因为我们最后需要恢复
* 出最后的答案(根据这个delete变量), 最后如果delete为false,那么给点为M, 否则为F。
**/
public class PeopleCircle {
public String order(int numMales, int numFeamles, int K) {
if (numFeamles == 0 && numMales == 0) {
return "";
}
ListNode headNode = createAllNode(numMales + numFeamles);
int curFeamles = numFeamles;
ListNode pNode = headNode;
while (curFeamles > 0) {
int curK = K;
while (true) {
if (pNode.delete == true) {
curK++;
}
if (curK == 1) {
break;
}
pNode = pNode.next;
curK--;
}
pNode.delete = true;
curFeamles--;
if(curFeamles > 0) {
while (pNode.delete == true) {
pNode = pNode.next;
}
}
}
StringBuilder sb = new StringBuilder();
pNode = headNode;
while (pNode.next != headNode) {
if (pNode.delete == false) {
sb.append("M");
}
else {
sb.append("F");
}
pNode = pNode.next;
}
if (pNode.delete == false) {
sb.append("M");
}
else {
sb.append("F");
}
return sb.toString();
}
private ListNode createAllNode(int num) {
ListNode head = new ListNode();
int tempNum = num;
ListNode pNode = head;
while (tempNum > 1) {
ListNode newNode = new ListNode();
pNode.next = newNode;
pNode = newNode;
tempNum--;
}
pNode.next = head;
return head;
}
}
class ListNode {
public boolean delete = false;
public ListNode next;
public ListNode() {
this.delete = false;
this.next = null;
}
}
| HuskyBin/TopCoder | SRM_147_DIV2_600.java |
64,718 | package learn.freq05;
//You are climbing a stair case. It takes n steps to reach to the top.
//
//Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?
//这题和 n分有135分组成有点相似 ,但是分币那题是组合,这题是排列 有先后顺序。
//显然是要递归来做
//DP dynamic Programming的思想 先确定小问题 在递推
//如果只有1个step, 那只有一种解法 1步, 如果有2步的话 , 二种解法 2步一次 和1步两次
//当有3个step的时候 如果 第一次走1步 接下去就是f(2) 如果 第一次走2步 接下去就是f(1)
// 当还剩n个阶梯的时候, 本次无非就2种可能 走1部 走2部 然后走一步就是f(n-1) 走两步就是f(n-2)
//f(n)=f(n-1)+f(n-2) 和费波那切数列很像
public class ClimbStairs {
//用iterator 做会避免递归产生的重复子结构
public int climbStairs(int n) {
if (n <= 0) {
return 0;
}
if (n == 1) {
return 1;
}
int n1 = 1;
int n2 = 2;
int n3 = n2; //=2 at the initial point
for (int i = 3; i <= n; i++) { //这里n1 n2 n3 都是步数。
n3 = n1 + n2; // 本质还是f(n)=f(n-1)+f(n-2) f(n)=f(n-1)+走一步 + f(n-2)+走两步 走一步 走两步 都是一种走法
n1 = n2; //每当i++时候
n2 = n3; //n1=上一次的n2 n2等于上一次的n3
//这样等于线性加一次 复杂度0(n)
}
return n3;
}
// 这么写的是对的 但是 会超时, 为什么呢?
//比如你现在F(3) = F(2) + F(1),在计算F(4) = F(3) + F(2)的时候计算了2次F(2),这个叫重复子结构
// 在recursion里面 会出现很多重复子结构 会超时。
// public int climbStairs(int n) {
// int ways=0;
// if (n <= 0) {
// return 0;
// } else {
// if (n == 1) {
// return 1;
// }
// if (n == 2) {
// return 2;
// }
// if (n >= 3) {
// ways= climbStairs(n - 1) + climbStairs(n - 2);
// }
//
// }
// return ways;
// }
public static void main(String[] args) {
System.out.println((new ClimbStairs()).climbStairs(5));
}
}
| duoan/leetcode-java | src/learn/freq05/ClimbStairs.java |
64,719 | package Sort;
/**
* @author wulling1024
* @idea
* @create 2019-03-16 10:34
* name: 直接插入排序
* 思想: 1、从后不断往前进行插入
* 2、不断将一个数插入到一个已序的序列中
*/
public class Insert {
public static int[] Direct(int[] nums) {
int i, j, n = nums.length;
int temp; // 作为过渡元素,即“哨兵”
for (i = 1; i < n; i++) {
temp = nums[i];
if (nums[i] < nums[i - 1]) {
for (j = i - 1; j >= 0; j--) {
if (nums[j] <= temp) { //碰到比自己 小或者等于 的元素
break;
}
nums[j + 1] = nums[j];
}
nums[j + 1] = temp;
}
}
return nums;
}
}
| wulling1024/LeetCode | Algorithmic/src/Sort/Insert.java |
64,720 | package Sort;
/**
* @Author wulling1024
* @Create 2020-03-04 20:27
* @Description 交换排序 -> 冒泡排序
* 思想:
*/
class BubbleSort {
public static void sort(int[] arr) {
for (int i = 0; i < arr.length; i++) {
for (int j = 0; j < arr.length - i - 1; j++) {
if (arr[j] > arr[j + 1]) {
int temp = arr[j];
arr[j] = arr[j + 1];
arr[j + 1] = temp;
}
}
}
}
}
public class Change2 {
public static void main(String[] args) {
int[] arr = {5, 7, 2, 4, 6, 8, 5};
BubbleSort.sort(arr);
for (int i : arr) {
System.out.print(i + ", ");
}
}
} | wulling1024/LeetCode | Algorithmic/src/Sort/Change2.java |
64,721 | /*
* 约瑟夫环问题,总共有n个人,编号为0到n-1,随机指定一个数m,让编号为0开始的人报数,每到第m-1的那个人要出来表演并不再回到环中。
* 下一轮从这个走掉的人下一个人开始重新计为0号,继续数到m-1。。。如此循环直到最后环中只剩下一个人。
* 求这个最后留下来的人在第一轮中的初始编号。
* */
public class JosephusLoop {
public int lastRemaining(int n, int m) {
if (n <= 0) return -1;
if (m <= 0) return n - 1;
if (n == 1) return 0;
/*
* 采用递归思想,与通过哈希值来编号分区一样,当有n个人时,在第一轮中报数为m-1的人编号为(m-1)%n。设最后留下的人编号结果为f[n];
* 同理已经求得n-1个人情况下最后剩下的人的编号为f[n-1],则f[n]=(f[n-1]+m)%n,
* 因为上一轮出列一个人后,下一个人重新从0开始编号,所以n人为第一轮,n-1人为第二轮的情况下,第二轮把每个人原来的编号都减了m,
* 因此重新加上m就能恢复到上一轮原来的编号,如此递归下去,只剩下一个人的情况即f[1]=0
* */
return (lastRemaining(n - 1, m) + m) % n;
}
//传统思路,占用内存与算法复杂度较大
/* public int lastRemaining(int n, int m) {
if(n<=0) return -1;
if(m<=0) return n-1;
Queue<Integer> queue=new LinkedList<Integer>(); //利用一个先进先出队列存放约瑟夫环
for(int i=0;i<n;i++){
queue.offer(i); //将所有人的编号加入队列
}
while(queue.size()>1){
for(int i=0;i<m-1;i++){
queue.offer(queue.poll()); //每次都从队列头上踢出m-1项(从0到m-2),再把踢出的项加回到队列尾部,这样第m项(m-1)就会出现在队列头上
}
queue.poll(); //踢掉队列头上的第一项,就是上一个步骤被排出来的第m项(m-1),然后在while大循环中继续这样的排列踢出流程,直到只剩下一个人
}
return queue.poll(); //返回队列中的最后一个人
}*/
}
| hackeryang/SwordToOffer | src/JosephusLoop.java |
64,722 | import java.util.LinkedList;
import java.util.Queue;
/*
* 汇编语言中有一种移位指令叫做循环左移(ROL),用字符串模拟这个指令的运算结果。对于一个给定的字符序列S,请把其循环左移K位后的序列输出。
* 例如,字符序列S=”abcXYZdef”,要求输出循环左移3位后的结果,即“XYZdefabc”。
* */
public class LeftRotateString {
public String leftRotateString(String str, int n) {
if (str == null || str.length() == 0) return "";
char[] charArray = str.toCharArray(); //将字符串拆成字符数组,用于下面队列的入列出列
Queue<Character> queue = new LinkedList<Character>();
for (int i = 0; i < charArray.length; i++) {
queue.offer(charArray[i]); //将队列中排入字符数组
}
for (int i = 0; i < n; i++) { //借鉴约瑟夫环的思想,每左移一次就把队列头部元素弹出再放回队列尾部,完成循环左移
queue.offer(queue.poll());
}
String result = "";
while (queue.size() != 0) {
result += queue.poll(); //将队列排列后的结果转为字符串
}
return result;
}
}
| hackeryang/SwordToOffer | src/LeftRotateString.java |
64,725 | package utilclass;
import java.util.BitSet;
/**
* @Author: spider_hgyi
* @Date: Created in 下午6:38 18-2-5.
* @Modified By:
* @Description: 布隆过滤器
*/
public class BloomFilter {
// 设置布隆过滤器的容量为2的25次方,也就是此布隆过滤器大概最少可以处理百万级别的数据
private static final int DEFAULT_SIZE = 2 << 24;
// 产生随机数的种子,可产生6个不同的随机数产生器
private static final int[] seeds = new int[]{7, 11, 13, 31, 37, 61};
// Java中的按位存储的思想,其算法的具体实现(布隆过滤器)
private static BitSet bits = new BitSet(DEFAULT_SIZE);
// 得到此 value 所产生的六个信息指纹
public int[] getFingerprint(String value) {
int result = 0;
int[] fingerprints = new int[6];
for (int i = 0; i < seeds.length; i++) {
for (int j = 0; j < value.length(); j++) {
result = seeds[i] * result + value.charAt(j);
}
result = (DEFAULT_SIZE - 1) & result;
fingerprints[i] = result;
}
return fingerprints;
}
// 判断url是否已经存在于布隆过滤器中
public boolean isExist(int[] fingerprints) {
boolean ret = true;
for (int fingerprint : fingerprints) {
// 只有六个标志位都为true,才能判断这个url<!可能!>在这个集合中(此处存在误判)
ret = ret && bits.get(fingerprint);
}
return ret;
}
// 将url存储进布隆过滤器中
public void saveFingerprints(int[] fingerprints) {
for (int fingerprint : fingerprints) {
bits.set(fingerprint);
}
}
} | dhengyi/multithreading-crawlers | src/main/java/utilclass/BloomFilter.java |
64,726 | // Code generated by lark suite oapi sdk gen
/*
* MIT License
*
* Copyright (c) 2022 Lark Technologies Pte. Ltd.
*
* 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 com.lark.oapi.service.okr.v1.model;
import com.lark.oapi.core.response.EmptyData;
import com.lark.oapi.service.okr.v1.enums.*;
import com.google.gson.annotations.SerializedName;
import com.google.gson.annotations.SerializedName;
import com.lark.oapi.core.annotation.Body;
import com.lark.oapi.core.annotation.Path;
import com.lark.oapi.core.annotation.Query;
import java.io.ByteArrayOutputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import com.lark.oapi.core.utils.Strings;
import com.lark.oapi.core.response.BaseResponse;
public class ProgressRecord {
/**
* OKR 进展ID
* <p> 示例值:7041469619902693396
*/
@SerializedName("progress_id")
private String progressId;
/**
* 进展更新时间 毫秒
* <p> 示例值:1618500278663
*/
@SerializedName("modify_time")
private String modifyTime;
/**
* 进展 对应的 Content 详细内容
* <p> 示例值:
*/
@SerializedName("content")
private ContentBlock content;
// builder 开始
public ProgressRecord() {
}
public ProgressRecord(Builder builder) {
/**
* OKR 进展ID
* <p> 示例值:7041469619902693396
*/
this.progressId = builder.progressId;
/**
* 进展更新时间 毫秒
* <p> 示例值:1618500278663
*/
this.modifyTime = builder.modifyTime;
/**
* 进展 对应的 Content 详细内容
* <p> 示例值:
*/
this.content = builder.content;
}
public static Builder newBuilder() {
return new Builder();
}
public String getProgressId() {
return this.progressId;
}
public void setProgressId(String progressId) {
this.progressId = progressId;
}
public String getModifyTime() {
return this.modifyTime;
}
public void setModifyTime(String modifyTime) {
this.modifyTime = modifyTime;
}
public ContentBlock getContent() {
return this.content;
}
public void setContent(ContentBlock content) {
this.content = content;
}
public static class Builder {
/**
* OKR 进展ID
* <p> 示例值:7041469619902693396
*/
private String progressId;
/**
* 进展更新时间 毫秒
* <p> 示例值:1618500278663
*/
private String modifyTime;
/**
* 进展 对应的 Content 详细内容
* <p> 示例值:
*/
private ContentBlock content;
/**
* OKR 进展ID
* <p> 示例值:7041469619902693396
*
* @param progressId
* @return
*/
public Builder progressId(String progressId) {
this.progressId = progressId;
return this;
}
/**
* 进展更新时间 毫秒
* <p> 示例值:1618500278663
*
* @param modifyTime
* @return
*/
public Builder modifyTime(String modifyTime) {
this.modifyTime = modifyTime;
return this;
}
/**
* 进展 对应的 Content 详细内容
* <p> 示例值:
*
* @param content
* @return
*/
public Builder content(ContentBlock content) {
this.content = content;
return this;
}
public ProgressRecord build() {
return new ProgressRecord(this);
}
}
}
| larksuite/oapi-sdk-java | larksuite-oapi/src/main/java/com/lark/oapi/service/okr/v1/model/ProgressRecord.java |
64,727 | package cn.hhchat.record.model.item;
import cn.hhchat.record.Config;
import cn.hhchat.record.model.Cool;
import cn.hhchat.record.util.FileUtil;
import cn.hhchat.record.util.ImgUtil;
import cn.hhchat.record.util.MarkdownUtil;
import com.xiaoleilu.hutool.collection.CollectionUtil;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import java.util.ArrayList;
import java.util.List;
/**
* Created this one by huminghao on 2018/3/18.
*/
@Data
@Slf4j
public class ProcessItem {
String id;
String username;
String uid;
List<String> text;
List<String> imageList;
List<String> imageLocalList = new ArrayList<>();
List<CommentItem> commentItemList;
List<Cool> coolList;
Integer coolCnt;
String createTime;
public Boolean saveImagesToLocal(String title) {
if (imageList.size() == 0) {
return true;
}
for (int i = 0; i < imageList.size(); i++) {
log.info(" => 尝试下载进展 {} 的图片 {}/{}", this.id, i + 1, imageList.size());
String pic = imageList.get(i);
String localFileName = FileUtil.generateProcessImgPath(title, this.id, ImgUtil.getImageFileName(pic));
int count = 10;
while (!ImgUtil.FetchImage(pic, localFileName) && count-- > 0) {
log.warn(" => 下载进展的图片失败,重试中");
}
if (count == -1) {
continue;
}
imageLocalList.add(localFileName);
}
return true;
}
public String toMD() {
List<String> imgList = this.imageList;
if (imgList == null) {
imgList = new ArrayList<>();
}
//if (Config.DOWNLOAD_IMAGES || CollectionUtil.isNotEmpty(this.imageLocalList)) {
// imgList = this.imageLocalList;
//}
StringBuilder sb = new StringBuilder();
String poster = Config.UID.equals(this.uid) ? "" : " from: " + this.username;
sb.append(MarkdownUtil.oneLine("进展 " + id + poster))
.append(MarkdownUtil.emptyLine());
for (int i = 0; i < imgList.size(); i++) {
sb.append(MarkdownUtil.image(String.valueOf(i), imgList.get(i), true));
}
for (String textLine : this.text) {
if (textLine.length() == 0) {
sb.append(MarkdownUtil.emptyLine());
} else {
sb.append(MarkdownUtil.oneLine(textLine));
}
}
sb.append(MarkdownUtil.emptyLine())
.append(MarkdownUtil.emptyLine())
.append(MarkdownUtil.quote(this.createTime + " 赞 " + this.coolCnt + " "));
// 添加评论
if(CollectionUtil.isNotEmpty(this.commentItemList)){
for (int i = this.commentItemList.size() - 1; i >= 0; i--) {
sb.append(this.commentItemList.get(i).toMD());
}
}
return sb.toString();
}
}
| hh23485/record-nian-forever | src/main/java/cn/hhchat/record/model/item/ProcessItem.java |
64,728 | package parser;
import model.SSDModel;
import java.util.ArrayList;
/**
* Created by raychen on 2016/12/7.
*/
public class SSDParser {
//具体对事实段内容的分析过程, ** 要写更多的划分方式, 主要需要写的地方
protected ArrayList<String> parseString(String str){
ArrayList<String> res = new ArrayList<String>();
//去掉空格
str = str.trim();
//标识当前句号是否可以分割
int splitable = 0;
String newString = "";
for (int i = 0; i < str.length(); i++) {
char c = str.charAt(i);
//去空格
if (c == ' ') continue;
//注意""中的。不要分割
if ((c != '。') || splitable != 0) newString+=c;
else {
res.add(newString);
newString = "";
}
if (c == '“') splitable --;
if (c == '”') splitable ++;
}
return res;
}
//拆解事实段
public ArrayList<SSDModel> parseSSD(ArrayList<SSDModel> ssds){
ArrayList<SSDModel> ssdModels = new ArrayList<SSDModel>();
for (SSDModel ssd: ssds) {
//拆解过程
if (ssd.getValue() == null) continue;
ssd.setDetails(parseString(ssd.getValue()));
ssdModels.add(ssd);
}
return ssdModels;
}
public static void main(String[] args) {
SSDParser parser = new SSDParser();
ArrayList<String> ans = parser.parseString("经审理查明:2013年5月26日,原告张亮向被告崇川公安分局申请公开“2009年5月22日被打报警后,1.打人者姓名及其工作单位;2.处理结果;3.打人者为什么在派出所还能限制张亮夫妇人身自由;4.当日在派出所进行调查的监控录像”的政府信息。同年6月4日,被告崇川公安分局作出《答复》,答复内容为:“关于‘处理结果’,我局在之前的回复中已向你说明,鉴于目前的调查情况,本案中认定违法事实的证据不够充分,现未有处理结果。关于其他申请事项,我局认为不属于信息公开的范围。”原告张亮不服,于7月2日向南通市人民政府申请行政复议。8月29日,南通市人民政府作出通政复决[2013]157号《行政复议决定书》,维持被告崇川公安分局作出的被诉答复。原告张亮仍不服,向本院提起行政诉讼。 本案审理过程中,经本院依职权向南通市人民政府法制办公室、南通市中级人民法院调查,认定以下事实:据不完全统计,2012年至2015年期间,原告张亮及其妻子曹胡萍以生活需要为由,分别向南通市人民政府、南通市城乡建设局、南通市发展和改革委员会、南通市环境保护局、南通市住房保障和房产管理局、南通市规划局、南通市国土资源局、南通市公安局及其崇川分局、南通市崇川区人民政府、南通市崇川区城东街道办事处等行政机关共提起至少224次政府信息公开申请,要求公开以下大量信息:1.“南通市的住宅设计标准、南通市城市房屋拆迁补偿安置工作流程”等政府主动公开的信息;2.“通房党组(2012)19号文件、北街小学及周边地块改造的可行性研究报告”等内部文件;3.“崇川区是哪位领导负责‘十公开’工作、‘十公开’监督的流程、进展、结果,上岗人员名单、照片、上岗证号、廉洁自律承诺、‘补空情况’,北街小学及周边地块拆迁过程中是怎样去做的,市年终考核情况如何,传唤证的经办人是谁、是谁审查的、部门领导是谁,在派出所接受询问时值班领导姓名、工号”等内部管理性信息;4.“报督查后是如何处置的,监督的流程、进展、结果。督查员是谁,案件的执法依据、流程、进展、结果”等检举性信息;5.“拆迁公司在(2003)年和(2009)年度的从业人员名单、合同证明以及缴纳养老保险证明、何时撤销南通百昌房屋征收服务有限公司的证书”等涉及他人的信息;6.“土地拍卖属于哪一项建设,北街小学及周边地块是属哪一种土地类型的储备、什么时间作为垃圾场的,建围墙是谁批的、建围墙的资金是谁出的,拆迁许可证的发放要具备哪些条件,应该由谁审批签字,申请办理房屋征收服务公司要具备哪些条件,有哪些文件规定,如违反了规定会怎样处理”等咨询性信息。此外,原告张亮及其妻子曹胡萍还针对政府信息公开答复书提出申请公开该答复书的“经办人是谁、是谁审查的、部门领导是谁”等信息,并循环申请公开答复书的“附件的事实和法律依据”等信息。 原告张亮及其妻子曹胡萍在收到行政机关作出的《政府信息公开申请答复》后,分别向江苏省人民政府、江苏省住房和城乡建设厅、江苏省国土资源厅、南通市人民政府、南通市崇川区人民政府等复议机关共提起至少37次行政复议。在经过行政复议程序之后,二人分别以政府信息公开申请答复“没有发文机关标志、标题不完整、发文字号形式错误,违反《党政机关公文处理工作条例》的规定,属形式违法;答复内容不符合申请的要求,未注明救济途径,属程序违法”等为由向南通市中级人民法院和本院提起政府信息公开之诉至少21次。 ");
System.out.println(ans.size());
for (String s: ans) {
System.out.println("*" + s);
}
}
}
| LittleFlyElephant/wbwj | ss_parser/src/main/java/parser/SSDParser.java |
64,730 | package net.wt.gate.dev.util.imageHandle;
import java.io.File;
import java.util.List;
public interface ListFileImageHandleListener {
boolean onReady(List<File> inpFiles, File outPath);//准备
void onProgress(String outFile, int position);//进展
void onAllSuccess();//成功
void onFailure(String text);//失败
void onError(Exception e);//异常
}
| z3880341/compressImage | imageHandle/ListFileImageHandleListener.java |
64,732 | /*
* 支付宝开放平台API
* 支付宝开放平台v3协议文档
*
* The version of the OpenAPI document: 2024-05-20
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package com.alipay.v3.api;
import com.alipay.v3.ApiCallback;
import com.alipay.v3.ApiClient;
import com.alipay.v3.ApiException;
import com.alipay.v3.ApiResponse;
import com.alipay.v3.Configuration;
import com.alipay.v3.Pair;
import com.alipay.v3.ProgressRequestBody;
import com.alipay.v3.ProgressResponseBody;
import com.alipay.v3.util.AlipayLogger;
import com.alipay.v3.util.model.CustomizedParams;
import com.google.common.base.Strings;
import com.google.gson.reflect.TypeToken;
import java.io.IOException;
import com.alipay.v3.model.AlipayOpenMiniIsvCreateDefaultResponse;
import com.alipay.v3.model.AlipayOpenMiniIsvCreateModel;
import com.alipay.v3.model.AlipayOpenMiniIsvCreateResponseModel;
import com.alipay.v3.model.AlipayOpenMiniIsvQueryDefaultResponse;
import com.alipay.v3.model.AlipayOpenMiniIsvQueryResponseModel;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.ws.rs.core.GenericType;
public class AlipayOpenMiniIsvApi {
private ApiClient localVarApiClient;
private int localHostIndex;
private String localCustomBaseUrl;
public AlipayOpenMiniIsvApi() {
this(Configuration.getDefaultApiClient());
}
public AlipayOpenMiniIsvApi(ApiClient apiClient) {
this.localVarApiClient = apiClient;
}
public ApiClient getApiClient() {
return localVarApiClient;
}
public void setApiClient(ApiClient apiClient) {
this.localVarApiClient = apiClient;
}
public int getHostIndex() {
return localHostIndex;
}
public void setHostIndex(int hostIndex) {
this.localHostIndex = hostIndex;
}
public String getCustomBaseUrl() {
return localCustomBaseUrl;
}
public void setCustomBaseUrl(String customBaseUrl) {
this.localCustomBaseUrl = customBaseUrl;
}
/**
* Build call for create
* @param alipayOpenMiniIsvCreateModel (optional)
* @param _callback Callback for upload/download progress
* @param customizedParams
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
* @http.response.details
<table summary="Response Details" border="1">
<tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
<tr><td> 200 </td><td> common response </td><td> - </td></tr>
<tr><td> 0 </td><td> 请求失败 </td><td> - </td></tr>
</table>
*/
public okhttp3.Call createCall(AlipayOpenMiniIsvCreateModel alipayOpenMiniIsvCreateModel, final ApiCallback _callback, CustomizedParams customizedParams) throws ApiException {
String basePath = null;
// Operation Servers
String[] localBasePaths = new String[] { };
// Determine Base Path to Use
if (localCustomBaseUrl != null){
basePath = localCustomBaseUrl;
} else if ( localBasePaths.length > 0 ) {
basePath = localBasePaths[localHostIndex];
} else {
basePath = null;
}
Object localVarPostBody = (customizedParams != null && !Strings.isNullOrEmpty(customizedParams.getBodyContent()))
? customizedParams.getBodyContent() : alipayOpenMiniIsvCreateModel;
// create path and map variables
String localVarPath = "/v3/alipay/open/mini/isv/create";
List<Pair> localVarQueryParams = new ArrayList<Pair>();
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, String> localVarCookieParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) {
localVarHeaderParams.put("Accept", localVarAccept);
}
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
if (localVarContentType != null) {
localVarHeaderParams.put("Content-Type", localVarContentType);
}
if (customizedParams != null) {
//额外query参数
if (customizedParams.getQueryParams() != null && customizedParams.getQueryParams().size() > 0) {
for (Map.Entry<String, String> entry : customizedParams.getQueryParams().entrySet()) {
localVarQueryParams.addAll(localVarApiClient.parameterToPair(entry.getKey(), entry.getValue()));
}
}
if (!Strings.isNullOrEmpty(customizedParams.getAppAuthToken())) {
localVarHeaderParams.put("alipay-app-auth-token", customizedParams.getAppAuthToken());
}
//额外非全局header参数
if (customizedParams.getHeaderParams() != null && customizedParams.getHeaderParams().size() > 0) {
localVarHeaderParams.putAll(customizedParams.getHeaderParams());
}
}
String[] localVarAuthNames = new String[] { };
return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call createValidateBeforeCall(AlipayOpenMiniIsvCreateModel alipayOpenMiniIsvCreateModel, final ApiCallback _callback, CustomizedParams customizedParams) throws ApiException {
okhttp3.Call localVarCall = createCall(alipayOpenMiniIsvCreateModel, _callback, customizedParams);
return localVarCall;
}
/**
* isv服务商代商户创建小程序
* 服务商代商家创建小程序,待商家确认后服务商代创建的小程序才会生效,若商家超过确认时间则服务商创建的小程序会自动作废释放占用的小程序名称。 将 is_individual 设置为 true,并且同时传入 license_pic。将同时对具备个体工商户营业执照的商家个人账号认证成为个体工商户账号(创建小程序+升级个体工商户账号一体化)。
* @param alipayOpenMiniIsvCreateModel (optional)
* @return AlipayOpenMiniIsvCreateResponseModel
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
* @http.response.details
<table summary="Response Details" border="1">
<tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
<tr><td> 200 </td><td> common response </td><td> - </td></tr>
<tr><td> 0 </td><td> 请求失败 </td><td> - </td></tr>
</table>
*/
public AlipayOpenMiniIsvCreateResponseModel create(AlipayOpenMiniIsvCreateModel alipayOpenMiniIsvCreateModel) throws ApiException {
ApiResponse<AlipayOpenMiniIsvCreateResponseModel> localVarResp = createWithHttpInfo(alipayOpenMiniIsvCreateModel, null);
return localVarResp.getData();
}
public AlipayOpenMiniIsvCreateResponseModel create(AlipayOpenMiniIsvCreateModel alipayOpenMiniIsvCreateModel, CustomizedParams customizedParams) throws ApiException {
ApiResponse<AlipayOpenMiniIsvCreateResponseModel> localVarResp = createWithHttpInfo(alipayOpenMiniIsvCreateModel, customizedParams);
return localVarResp.getData();
}
/**
* isv服务商代商户创建小程序
* 服务商代商家创建小程序,待商家确认后服务商代创建的小程序才会生效,若商家超过确认时间则服务商创建的小程序会自动作废释放占用的小程序名称。 将 is_individual 设置为 true,并且同时传入 license_pic。将同时对具备个体工商户营业执照的商家个人账号认证成为个体工商户账号(创建小程序+升级个体工商户账号一体化)。
* @param alipayOpenMiniIsvCreateModel (optional)
* @return ApiResponse<AlipayOpenMiniIsvCreateResponseModel>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
* @http.response.details
<table summary="Response Details" border="1">
<tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
<tr><td> 200 </td><td> common response </td><td> - </td></tr>
<tr><td> 0 </td><td> 请求失败 </td><td> - </td></tr>
</table>
*/
public ApiResponse<AlipayOpenMiniIsvCreateResponseModel> createWithHttpInfo(AlipayOpenMiniIsvCreateModel alipayOpenMiniIsvCreateModel, CustomizedParams customizedParams) throws ApiException {
okhttp3.Call localVarCall = createValidateBeforeCall(alipayOpenMiniIsvCreateModel, null, customizedParams);
try {
Type localVarReturnType = new TypeToken<AlipayOpenMiniIsvCreateResponseModel>(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
} catch (ApiException e) {
try {
e.setErrorObject(localVarApiClient.getJSON().getGson().fromJson(e.getResponseBody(), new TypeToken<AlipayOpenMiniIsvCreateDefaultResponse>(){}.getType()));
} catch (Exception ex) {
AlipayLogger.logBizWarn(ex);
}
throw e;
}
}
/**
* isv服务商代商户创建小程序 (asynchronously)
* 服务商代商家创建小程序,待商家确认后服务商代创建的小程序才会生效,若商家超过确认时间则服务商创建的小程序会自动作废释放占用的小程序名称。 将 is_individual 设置为 true,并且同时传入 license_pic。将同时对具备个体工商户营业执照的商家个人账号认证成为个体工商户账号(创建小程序+升级个体工商户账号一体化)。
* @param alipayOpenMiniIsvCreateModel (optional)
* @param _callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
* @http.response.details
<table summary="Response Details" border="1">
<tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
<tr><td> 200 </td><td> common response </td><td> - </td></tr>
<tr><td> 0 </td><td> 请求失败 </td><td> - </td></tr>
</table>
* @deprecated
*/
@Deprecated
public okhttp3.Call createAsync(AlipayOpenMiniIsvCreateModel alipayOpenMiniIsvCreateModel, final ApiCallback<AlipayOpenMiniIsvCreateResponseModel> _callback) throws ApiException {
okhttp3.Call localVarCall = createValidateBeforeCall(alipayOpenMiniIsvCreateModel, _callback, null);
Type localVarReturnType = new TypeToken<AlipayOpenMiniIsvCreateResponseModel>(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
}
@Deprecated
public okhttp3.Call createAsync(AlipayOpenMiniIsvCreateModel alipayOpenMiniIsvCreateModel, final ApiCallback<AlipayOpenMiniIsvCreateResponseModel> _callback, CustomizedParams customizedParams) throws ApiException {
okhttp3.Call localVarCall = createValidateBeforeCall(alipayOpenMiniIsvCreateModel, _callback, customizedParams);
Type localVarReturnType = new TypeToken<AlipayOpenMiniIsvCreateResponseModel>(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
}
/**
* Build call for query
* @param orderNo 服务商代商家创建小程序,由支付宝开放平台返回的订单号用于后续查询处理进展。 (optional)
* @param _callback Callback for upload/download progress
* @param customizedParams
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
* @http.response.details
<table summary="Response Details" border="1">
<tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
<tr><td> 200 </td><td> common response </td><td> - </td></tr>
<tr><td> 0 </td><td> 请求失败 </td><td> - </td></tr>
</table>
*/
public okhttp3.Call queryCall(String orderNo, final ApiCallback _callback, CustomizedParams customizedParams) throws ApiException {
String basePath = null;
// Operation Servers
String[] localBasePaths = new String[] { };
// Determine Base Path to Use
if (localCustomBaseUrl != null){
basePath = localCustomBaseUrl;
} else if ( localBasePaths.length > 0 ) {
basePath = localBasePaths[localHostIndex];
} else {
basePath = null;
}
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/v3/alipay/open/mini/isv/query";
List<Pair> localVarQueryParams = new ArrayList<Pair>();
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, String> localVarCookieParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
if (orderNo != null) {
localVarQueryParams.addAll(localVarApiClient.parameterToPair("order_no", orderNo));
}
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) {
localVarHeaderParams.put("Accept", localVarAccept);
}
final String[] localVarContentTypes = {
};
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
if (localVarContentType != null) {
localVarHeaderParams.put("Content-Type", localVarContentType);
}
if (customizedParams != null) {
//额外query参数
if (customizedParams.getQueryParams() != null && customizedParams.getQueryParams().size() > 0) {
for (Map.Entry<String, String> entry : customizedParams.getQueryParams().entrySet()) {
localVarQueryParams.addAll(localVarApiClient.parameterToPair(entry.getKey(), entry.getValue()));
}
}
if (!Strings.isNullOrEmpty(customizedParams.getAppAuthToken())) {
localVarHeaderParams.put("alipay-app-auth-token", customizedParams.getAppAuthToken());
}
//额外非全局header参数
if (customizedParams.getHeaderParams() != null && customizedParams.getHeaderParams().size() > 0) {
localVarHeaderParams.putAll(customizedParams.getHeaderParams());
}
}
String[] localVarAuthNames = new String[] { };
return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call queryValidateBeforeCall(String orderNo, final ApiCallback _callback, CustomizedParams customizedParams) throws ApiException {
okhttp3.Call localVarCall = queryCall(orderNo, _callback, customizedParams);
return localVarCall;
}
/**
* isv查询代商家创建小程序记录
* isv查询代商家创建小程序记录
* @param orderNo 服务商代商家创建小程序,由支付宝开放平台返回的订单号用于后续查询处理进展。 (optional)
* @return AlipayOpenMiniIsvQueryResponseModel
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
* @http.response.details
<table summary="Response Details" border="1">
<tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
<tr><td> 200 </td><td> common response </td><td> - </td></tr>
<tr><td> 0 </td><td> 请求失败 </td><td> - </td></tr>
</table>
*/
public AlipayOpenMiniIsvQueryResponseModel query(String orderNo) throws ApiException {
ApiResponse<AlipayOpenMiniIsvQueryResponseModel> localVarResp = queryWithHttpInfo(orderNo, null);
return localVarResp.getData();
}
public AlipayOpenMiniIsvQueryResponseModel query(String orderNo, CustomizedParams customizedParams) throws ApiException {
ApiResponse<AlipayOpenMiniIsvQueryResponseModel> localVarResp = queryWithHttpInfo(orderNo, customizedParams);
return localVarResp.getData();
}
/**
* isv查询代商家创建小程序记录
* isv查询代商家创建小程序记录
* @param orderNo 服务商代商家创建小程序,由支付宝开放平台返回的订单号用于后续查询处理进展。 (optional)
* @return ApiResponse<AlipayOpenMiniIsvQueryResponseModel>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
* @http.response.details
<table summary="Response Details" border="1">
<tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
<tr><td> 200 </td><td> common response </td><td> - </td></tr>
<tr><td> 0 </td><td> 请求失败 </td><td> - </td></tr>
</table>
*/
public ApiResponse<AlipayOpenMiniIsvQueryResponseModel> queryWithHttpInfo(String orderNo, CustomizedParams customizedParams) throws ApiException {
okhttp3.Call localVarCall = queryValidateBeforeCall(orderNo, null, customizedParams);
try {
Type localVarReturnType = new TypeToken<AlipayOpenMiniIsvQueryResponseModel>(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
} catch (ApiException e) {
try {
e.setErrorObject(localVarApiClient.getJSON().getGson().fromJson(e.getResponseBody(), new TypeToken<AlipayOpenMiniIsvQueryDefaultResponse>(){}.getType()));
} catch (Exception ex) {
AlipayLogger.logBizWarn(ex);
}
throw e;
}
}
/**
* isv查询代商家创建小程序记录 (asynchronously)
* isv查询代商家创建小程序记录
* @param orderNo 服务商代商家创建小程序,由支付宝开放平台返回的订单号用于后续查询处理进展。 (optional)
* @param _callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
* @http.response.details
<table summary="Response Details" border="1">
<tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
<tr><td> 200 </td><td> common response </td><td> - </td></tr>
<tr><td> 0 </td><td> 请求失败 </td><td> - </td></tr>
</table>
* @deprecated
*/
@Deprecated
public okhttp3.Call queryAsync(String orderNo, final ApiCallback<AlipayOpenMiniIsvQueryResponseModel> _callback) throws ApiException {
okhttp3.Call localVarCall = queryValidateBeforeCall(orderNo, _callback, null);
Type localVarReturnType = new TypeToken<AlipayOpenMiniIsvQueryResponseModel>(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
}
@Deprecated
public okhttp3.Call queryAsync(String orderNo, final ApiCallback<AlipayOpenMiniIsvQueryResponseModel> _callback, CustomizedParams customizedParams) throws ApiException {
okhttp3.Call localVarCall = queryValidateBeforeCall(orderNo, _callback, customizedParams);
Type localVarReturnType = new TypeToken<AlipayOpenMiniIsvQueryResponseModel>(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
}
}
| alipay/alipay-sdk-java-all | v3/src/main/java/com/alipay/v3/api/AlipayOpenMiniIsvApi.java |
64,733 | package com.exam.action;
import java.io.IOException;
import java.io.InputStream;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.jdom.Document;
import org.jdom.Element;
import org.jdom.JDOMException;
import org.jdom.input.SAXBuilder;
import org.jdom.output.XMLOutputter;
import com.exam.biz.UserBiz;
import com.exam.mapper.UserMapper;
import com.exam.po.User;
import com.exam.util.MyBatisUtil;
import com.exam.weixin.getter.WxInfoGetter;
import com.exam.weixin.getter.WxInfoPoster;
import com.exam.weixin.message.WxMenu;
import com.exam.weixin.message.WxMenuItem;
import com.exam.weixin.message.WxRequest;
import com.exam.weixin.message.WxRequestItf;
import com.exam.weixin.message.WxResponse;
import com.exam.weixin.util.WxError;
import com.exam.weixin.util.WxMsgConstants;
/**
* 微信所有接口入口
* @author slz
* 2013-7-26 上午11:01:08
*/
public class PushManage {
public String PushManageXml(InputStream is) throws JDOMException{
String returnStr = "";
String toName = "";
String FromName = "";
String type = "";
String content = "";
String con = "";
String event = "";//自定义按钮事件请求
WxRequestItf request = new WxRequest(is);
toName = request.getToName();
FromName = request.getFromName();
type = request.getMsgType();
if(type.equals(WxMsgConstants.MSGTYPE_EVENT))
{
event = request.getAttribute(WxMsgConstants.ATTR_EVENT_EVENT);
if(event.equals("subscribe")){//此为关注事件
content = "您好,欢迎关注我!";
}
<<<<<<< HEAD
else if(event.equals("CLICK"))
{
String eventKey = request.getAttribute(WxMsgConstants.ATTR_EVENT_EVENTKEY);
content = WxMenuItem.getClickAction(eventKey);
=======
}else if(type.equals("text")){
if(con.equals("help")||con.equals("帮助")||con.equals("?")||con.equals("?")){
content = "帮助中心\n\n";
}else if(con.equals("bind")||con.equals("绑定")){
content = "点击 <a target='_blank' href=\'\'>绑定账户</a>";
}else if(con.equals("deng")||con.equals("绑定")){
content = "好ok";
}else if(con.startsWith("age")||con.equals("绑定")){
String name = con.substring(3);
content = new UserBiz().getUserAge(name);
}else if(con.startsWith("ck")||con.startsWith("CK")){
String order_id = "0";
con.toLowerCase();
if(con.startsWith("ck")){
order_id = con.substring(con.indexOf("ck")+2);
}else if(con.startsWith("CK")){
order_id = con.substring(con.indexOf("CK")+2);
}
if(!"".equals(order_id)){
StringBuffer sb = new StringBuffer();
sb.append("订单详情...\n");
content = sb.toString();
}else{
content = "我不懂,你再解释一下吧!";
}
}else{
content = "我不懂,你再解释一下吧!";
>>>>>>> branch 'master' of https://github.com/zhouzhongjie/exam.git
}
}
else if(type.equals(WxMsgConstants.MSGTYPE_TEXT))
{
con = request.getAttribute(WxMsgConstants.ATTR_TEXT_CONTENT);
if(con.equals("help")||con.equals("帮助")||con.equals("?")||con.equals("?")){
content = "帮助中心:\n1:发送语音会回复同样的语音\n2:发送图片会回复同样的图片\n3:发送model或模板,会回复图文消息";
}else if(con.startsWith("age")||con.equals("绑定")){
String name = con.substring(3);
content = new UserBiz().getUserAge(name);
}else if (con.equals("model") || con.equals("模板"))
{
return createNews(toName, FromName);
} else if (con.equals("info"))
{
content = "openId:" + FromName;
} else if (con.equals("music") || con.equals("音乐"))
{
// returnStr = WxResponse.createMusicResponse(toName, FromName, "风之誓言", "听歌可以让人心情愉悦",
// "http://bcs.duapp.com/weixindandan11/ding.mp3?sign=MBO:8522d4c3c036a19ec3afc6d63af1c2fe:i5gMmiHi9lDpuTGhLDz3yLoYIfE%3D&response-content-disposition=filename*=utf8''ding.mp3&response-cache-control=private",
// "http://bcs.duapp.com/weixindandan11/ding.mp3?sign=MBO:8522d4c3c036a19ec3afc6d63af1c2fe:i5gMmiHi9lDpuTGhLDz3yLoYIfE%3D&response-content-disposition=filename*=utf8''ding.mp3&response-cache-control=private",
// "http://bcs.duapp.com/lcyfirstapp/2013-10-07_182020.jpg?sign=MBO:D85996a4f15fb09f8645e2014800b44d:htiFNlE9JgRSbKMqPWU71fNP8cU%3D&response-content-disposition=filename*=utf8''2013-10-07_182020.jpg&response-cache-control=private");
// return returnStr;
} else if (con.equals("token"))
{
content = (String)WxInfoGetter.updateAccessToken().getObject();
} else if (con.equals("menu") || con.equals("菜单"))
{
content = postMenu();
}
}
else if (type.equals(WxMsgConstants.MSGTYPE_VOICE))
{
String mediaId = request.getAttribute(WxMsgConstants.ATTR_VOICE_MEDIAID);
content = "收到一条语音消息,mediaId=" + mediaId;
return WxResponse.createVoiceResponse(toName, FromName, mediaId).toString();
}
else if (type.equals(WxMsgConstants.MSGTYPE_LOCATION))
{
String locationX = request.getAttribute(WxMsgConstants.ATTR_LOCATION_X);
String locationY = request.getAttribute(WxMsgConstants.ATTR_LOCATION_Y);
content = "已收到你的位置:x=" + locationX + ", y=" + locationY;
}
else if (type.equals(WxMsgConstants.MSGTYPE_VIDEO))
{
content = "收到视频";
String mediaId = request.getAttribute(WxMsgConstants.ATTR_VIDEO_MEDIAID);
return WxResponse.createVideoResponse(toName, FromName, mediaId, mediaId).toString();
}
else if (type.equals(WxMsgConstants.MSGTYPE_IMAGE))
{
content = "收到图片";
String mediaId = request.getAttribute(WxMsgConstants.ATTR_IMAGE_MEDIAID);
return WxResponse.createImageResponse(toName, FromName, mediaId).toString();
}
else if (type.equals(WxMsgConstants.MSGTYPE_LINK))
{
content = "收到链接";
}
returnStr = WxResponse.createTextResponse(toName, FromName, content).toString();
return returnStr;
}
private String createNews(String toName, String fromName)
{
String[] titles = {"模板展示", "模板2", "模板3", "模板4"};
String[] descriptions = {"九宫格", "四方格", "错落格", "文字"};
String[] picUrls = new String[4];
String[] subUrls = new String[4];
for (int i=0; i<4; i++)
{
picUrls[i] = "http://bcs.duapp.com/lcyfirstapp/2013-10-07_182020.jpg?sign=MBO:D85996a4f15fb09f8645e2014800b44d:htiFNlE9JgRSbKMqPWU71fNP8cU%3D&response-content-disposition=filename*=utf8''2013-10-07_182020.jpg&response-cache-control=private";
subUrls[i] = "http://www.weixinkaka.com/index.php/wap/site/424/";
}
return WxResponse.createNewsResponse(toName, fromName, titles,
descriptions, picUrls, subUrls).toString();
}
//
private String postMenu()
{
WxError error = WxInfoPoster.postMenu(createMenu());
return error.getCode() + ":" + error.getDesp();
}
private static final String[] MENU = {"menu1", "menu2"};
private static final String[] SUB_MENU = {"sub1", "sub2"};
private static int curMenuCount = 0;
protected WxMenu createMenu()
{
//创建一级菜单:显示进展
WxMenuItem menu1 = WxMenuItem.createMenuItem("进展", false);
menu1.setClick("MAIN_MENU_DEVELOPMENT", WxMenuItem.CONTENT_DEVELOP);
//创建一级菜单:显示计划
WxMenuItem menu2 = WxMenuItem.createMenuItem("计划", false);
menu2.setClick("MAIN_MENU_PLAN", WxMenuItem.CONTENT_PLAN);
//创建一级菜单:帮助
WxMenuItem menu3 = WxMenuItem.createMenuItem("帮助", false);
//创建帮助的二级菜单:使用说明
WxMenuItem subMenu1 = WxMenuItem.createMenuItem("使用说明", true);
subMenu1.setClick("MAIN_MENU_HELP_HELP", WxMenuItem.CONTENT_HELP);
WxMenuItem subMenu2 = WxMenuItem.createMenuItem("支持的命令", true);
subMenu2.setClick("MAIN_MENU_HELP_SUPPORTS", WxMenuItem.CONTENT_SUPPORT_CMD);
menu3.addChild(subMenu1);
menu3.addChild(subMenu2);
//将子菜单放入主菜单中
WxMenu menu = new WxMenu();
menu.addSubMenu(menu1);
menu.addSubMenu(menu2);
menu.addSubMenu(menu3);
return menu;
// //创建菜单 begin
// String menuName = MENU[curMenuCount%2];
// String subMenuName = SUB_MENU[curMenuCount % 2];
// curMenuCount++;
// WxMenuItem submenus[] = new WxMenuItem[9];
// for (int i=0; i<submenus.length; i++)
// {
// submenus[i] = WxMenuItem.createMenuItem(subMenuName + (i+1), true);
// if (null == submenus[i])
// {
// return null;
// }
// submenus[i].setKeyOrUrl(WxMenuItem.TYPE_CLICK, "submenu" + (i+1));
// }
//
// WxMenuItem menus[] = new WxMenuItem[3];
// WxMenu menu = new WxMenu();
// for (int i=0; i<menus.length; i++)
// {
// menus[i] = WxMenuItem.createMenuItem(menuName + (i+1), false);
// if (menus[i] == null)
// {
// return null;
// }
// menus[i].setKeyOrUrl(WxMenuItem.TYPE_CLICK, "menu" + (i+1));
// menus[i].addChild(submenus[3*i]);
// menus[i].addChild(submenus[3*i + 1]);
// menus[i].addChild(submenus[3*i + 2]);
// menu.addSubMenu(menus[i]);
// }
// //创建菜单 end
// return menu;
}
public static void main(String[] args)
{
// WxError error = new WxError("");
// System.out.println(error.getCode() + ", " + error.getDesp());
// WxResult result = new WxResult(error, "");
System.out.println(new PushManage().createMenu().getJsonObject());
System.out.println(WxMenuItem.getClickAction("MAIN_MENU_HELP_SUPPORTS"));
// System.out.println(WxClickMenuEvent.valueOf("PLAN"));
}
}
| zhouzhongjie/exam | bce_java_default/src/com/exam/action/PushManage.java |
64,734 | package com.potato.study.leetcodecn.p00316.t001;
import java.util.HashSet;
import java.util.Set;
import java.util.Stack;
import org.junit.Assert;
/**
* 316. 去除重复字母
*
* 给你一个字符串 s ,请你去除字符串中重复的字母,使得每个字母只出现一次。需保证 返回结果的字典序最小(要求不能打乱其他字符的相对位置)。
注意:该题与 1081 https://leetcode-cn.com/problems/smallest-subsequence-of-distinct-characters 相同
示例 1:
输入:s = "bcabc"
输出:"abc"
示例 2:
输入:s = "cbacdcbc"
输出:"acdb"
提示:
1 <= s.length <= 104
s 由小写英文字母组成
来源:力扣(LeetCode)
链接:https://leetcode-cn.com/problems/remove-duplicate-letters
著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。
*
*/
public class Solution {
/**
* https://leetcode-cn.com/problems/remove-duplicate-letters/solution/qu-chu-zhong-fu-zi-mu-by-leetcode-soluti-vuso/
*
* 用一个 arr 记录每个字母出现次数
* 单调栈 单调递增
* set 记录 目前 栈中字母有哪些
*
* init 栈空且set 空 直接入栈和set,arr 计数--
* 遍历 s 其他字母
* 如果 ch 在 stack 中 说明 已经安置好了位置 continue
* ch 为 stack 中没有出现过
*
* 如果 peek 元素 还有没有剩余 那就直接将 ch 进展 计数-- set增加
* 否则 peek 有剩余 且 peek 大于 ch 循环出栈 出栈结束之后 ch 可以进栈了
*
*
* @param s
* @return
*/
public String removeDuplicateLetters(String s) {
// 用一个 arr 记录每个字母出现次数
int[] count = new int[26];
for (char ch : s.toCharArray()) {
count[ch - 'a']++;
}
// 单调栈 单调递增
Stack<Character> stack = new Stack<>();
// set 记录 目前 栈中字母有哪些
Set<Character> set = new HashSet<>();
// init 栈空且set 空 直接入栈和set,arr 计数--
for (char ch : s.toCharArray()) {
// 如果 ch 在 stack 中 说明 已经安置好了位置 continue
if (set.contains(ch)) {
count[ch - 'a']--;
continue;
}
// 否则 peek 有剩余 且 peek 大于 ch 循环出栈 出栈结束之后 ch 可以进栈了
while (!stack.isEmpty() && stack.peek() > ch && count[stack.peek() - 'a'] > 0) {
Character pop = stack.pop();
set.remove(pop);
}
// 如果 peek 元素 还有没有剩余 那就直接将 ch 进展 计数-- set增加
count[ch - 'a']--;
set.add(ch);
stack.add(ch);
continue;
}
// stack 正常顺序输出
StringBuilder builder = new StringBuilder();
while (!stack.isEmpty()) {
builder.append(stack.pop());
}
return builder.reverse().toString();
}
public static void main(String[] args) {
Solution solution = new Solution();
String input = "bcabc";
String s = solution.removeDuplicateLetters(input);
System.out.println(s);
Assert.assertEquals("abc", s);
input = "cbacdcbc";
s = solution.removeDuplicateLetters(input);
System.out.println(s);
Assert.assertEquals("acdb", s);
}
}
| potatobeancox/leetcode-java | src/main/java/com/potato/study/leetcodecn/p00316/t001/Solution.java |
64,738 | /*
* Copyright (c) 2018. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
* Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan.
* Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna.
* Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus.
* Vestibulum commodo. Ut rhoncus gravida arcu.
*/
package com.example.god.androidmore.datastructure;
/**
* 后进先出
* 栈的经典应用:
* 波兰表达式 : 中缀表达式转后缀表达式(数字输出,运算符进展,括号匹配出战,栈顶优先级低出栈)。
* 后缀表达式的计算。
*
* 通过维护 Node 连接来实现
*/
public class MyStack<T> {
private Node<T> top;
private Node<T> bottom;
public boolean push(T t) {
Node<T> l = top;
Node<T> newNode = new Node<>(t, null, top);
l.pre = newNode;
top = newNode;
return true;
}
public T pop() {
Node<T> l = bottom.pre;
T v = bottom.element;
l.next = null;
return v;
}
public T peek(){
return top.element;
}
public void remove() {
Node<T> l = top.next;
l.pre = null;
}
private static class Node<E> {
E element;
Node<E> pre;
Node<E> next;
public Node(E element, Node<E> pre, Node<E> next) {
this.element = element;
this.pre = pre;
this.next = next;
}
}
}
| qizewei/AndroidMore | app/src/main/java/com/example/god/androidmore/datastructure/MyStack.java |
64,741 | package com.ljdc.utils;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.util.Log;
import android.widget.Toast;
import com.android.volley.Response;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken;
import com.j256.ormlite.dao.Dao;
import com.j256.ormlite.stmt.DeleteBuilder;
import com.j256.ormlite.stmt.Where;
import com.ljdc.app.App;
import com.ljdc.app.Config;
import com.ljdc.database.DBHelper;
import com.ljdc.model.Message;
import com.ljdc.model.RemovedLib;
import com.ljdc.pojo.*;
import java.io.UnsupportedEncodingException;
import java.sql.SQLException;
import java.util.*;
/**
* Created with IntelliJ IDEA
* User:邹旭
* Date:2017/3/4 0004
* Time:下午 5:02
* Desc: CS数据库同步操作类
*/
public class DataSyncUtil implements Response.Listener<String> {
private static Gson gson;
static {
gson = new GsonBuilder()
.setDateFormat("yyyy-MM-dd HH:mm:ss") //java.util.Date的时间格式
.create();
}
Dao dao;
Where whereQ;
Map<String, String> parms;
private Context ctx;
/**
* 同步用户数据
*/
public void syncUserData(Context ctx) {
String maxAnchor = "";
this.ctx = ctx;
try {
//被删除的词库
new VolleyPostRequest(ctx).postRequest(null, Config.SYNC_REMOVE_LIB_URL, this);
//单词学习库 : LearnLib
dao = DBHelper.getHelper(ctx).getDao(LearnLib.class);
whereQ = dao.queryBuilder().where().lt("statusModify", 9);
List<LearnLib> learnLibList = whereQ.query();
maxAnchor = selectMaxAnchor("learn_lib");
maxAnchor = maxAnchor == null ? "1970-01-01 08:00:00" : maxAnchor;
Log.d("DataSyncUtil maxAnchor:", maxAnchor);
Log.d("DataSyncUtil", "learnLib1Servers.size():" + learnLibList.size());
for (LearnLib data : learnLibList) {//处理GSON解析过程中的异常
data.userId = data.user.userId;
data.libId = data.lib.libId;
data.user = null;
data.lib = null;
}
Log.d("DataSyncUtil json:", gson.toJson(learnLibList));
parms = new HashMap<>();//参数
parms.put(Config.PARAM_MAXANCHOR, maxAnchor);
parms.put(Config.PARAM_SYNCJSONDATA, gson.toJson(learnLibList));
parms.put(Config.PARAM_USERID, Utils.getPreference(ctx, Config.PARAM_USERID));
new VolleyPostRequest(ctx).postRequest(parms, Config.SYNC_LEARN_LIB_URL, this);
//单词学习库1
dao = DBHelper.getHelper(ctx).getDao(LearnLib1Server.class);
whereQ = dao.queryBuilder().where().lt("statusModify", 9);
List<LearnLib1Server> learnLib1Servers = whereQ.query();
maxAnchor = selectMaxAnchor("learn_lib1");
maxAnchor = maxAnchor == null ? "" : maxAnchor;
Log.d("DataSyncUtil maxAnchor:", maxAnchor);
Log.d("DataSyncUtil", "learnLib1Servers.size():" + learnLib1Servers.size());
for (LearnLib1Server data : learnLib1Servers) {//处理GSON解析过程中的异常
data.userId = data.user.userId;
data.lib1Id = data.lib1.lib1Id;
data.user = null;
data.lib1 = null;
}
Log.d("DataSyncUtil json:", gson.toJson(learnLib1Servers));
parms = new HashMap<>();//参数
parms.put(Config.PARAM_MAXANCHOR, maxAnchor);
parms.put(Config.PARAM_SYNCJSONDATA, gson.toJson(learnLib1Servers));
parms.put(Config.PARAM_USERID, Utils.getPreference(ctx, Config.PARAM_USERID));
new VolleyPostRequest(ctx).postRequest(parms, Config.SYNC_LEARN_LIB1_URL, this);
//单词学习库2
dao = DBHelper.getHelper(ctx).getDao(LearnLib2Server.class);
whereQ = dao.queryBuilder().where().lt("statusModify", 9);
List<LearnLib2Server> learnLib2Servers = whereQ.query();
maxAnchor = selectMaxAnchor("learn_lib2");
maxAnchor = maxAnchor == null ? "" : maxAnchor;
Log.d("DataSyncUtil maxAnchor:", maxAnchor);
Log.d("DataSyncUtil", "learnLib2Servers.size():" + learnLib2Servers.size());
for (LearnLib2Server data : learnLib2Servers) {//处理GSON解析过程中的异常
data.userId = data.user.userId;
data.lib2Id = data.lib2.lib2Id;
data.user = null;
data.lib2 = null;
}
Log.d("DataSyncUtil json:", gson.toJson(learnLib2Servers));
parms = new HashMap<>();//参数
parms.clear();
parms.put(Config.PARAM_MAXANCHOR, maxAnchor);
parms.put(Config.PARAM_SYNCJSONDATA, gson.toJson(learnLib2Servers));
parms.put(Config.PARAM_USERID, Utils.getPreference(ctx, Config.PARAM_USERID));
new VolleyPostRequest(ctx).postRequest(parms, Config.SYNC_LEARN_LIB2_URL, this);
//单词进展情况表
dao = DBHelper.getHelper(ctx).getDao(WordDevelopmentServer.class);
whereQ = dao.queryBuilder().where().lt("statusModify", 9);
List<WordDevelopmentServer> wordDevelopmentServers = whereQ.query();
maxAnchor = selectMaxAnchor("word_development");
maxAnchor = maxAnchor == null ? "" : maxAnchor;
Log.d("DataSyncUtil maxAnchor:", maxAnchor);
Log.d("DataSyncUtil", "wordDevelopmentServers.size():" + wordDevelopmentServers.size());
for (WordDevelopmentServer data : wordDevelopmentServers) {
data.userId = data.user.userId;
data.user = null;
}
Log.d("DataSyncUtil json:", gson.toJson(wordDevelopmentServers));
parms = new HashMap<>();//参数
parms.clear();
parms.put(Config.PARAM_MAXANCHOR, maxAnchor);//参数为null,会导致请求不能成功
parms.put(Config.PARAM_SYNCJSONDATA, gson.toJson(wordDevelopmentServers));
parms.put(Config.PARAM_USERID, Utils.getPreference(ctx, Config.PARAM_USERID));
new VolleyPostRequest(ctx).postRequest(parms, Config.SYNC_WORD_DEVELOP_URL, this);
//单词学习计划
dao = DBHelper.getHelper(ctx).getDao(StudyPlan.class);
whereQ = dao.queryBuilder().where().lt("status", 9);
List<StudyPlan> studyPlen = whereQ.query();
maxAnchor = selectMaxAnchor("study_plan");
maxAnchor = maxAnchor == null ? "" : maxAnchor;
Log.d("DataSyncUtil maxAnchor:", maxAnchor);
Log.d("DataSyncUtil", "studyPlen.size():" + studyPlen.size());
for (StudyPlan data : studyPlen) {
data.userId = data.user.userId;
data.user = null;
}
Log.d("DataSyncUtil json:", gson.toJson(studyPlen));
parms = new HashMap<>();//参数
parms.clear();
parms.put(Config.PARAM_MAXANCHOR, maxAnchor);//参数为null,会导致请求不能成功
parms.put(Config.PARAM_SYNCJSONDATA, gson.toJson(studyPlen));
parms.put(Config.PARAM_USERID, Utils.getPreference(ctx, Config.PARAM_USERID));
new VolleyPostRequest(ctx).postRequest(parms, Config.SYNC_STUDY_PLAN_URL, this);
//词库信息
maxAnchor = selectMaxAnchor("libs");
maxAnchor = maxAnchor == null ? "" : maxAnchor;
Log.d("DataSyncUtil maxAnchor:", maxAnchor);
parms = new HashMap<>();//参数
parms.put(Config.PARAM_MAXANCHOR, maxAnchor);//参数为null,会导致请求不能成功
new VolleyPostRequest(ctx).postRequest(parms, Config.SYNC_LIBS_URL, this);
//用户个人信息
dao = DBHelper.getHelper(ctx).getDao(UserServer.class);
whereQ = dao.queryBuilder().where().lt("status", 9);
List<UserServer> users = whereQ.query();
for (UserServer data : users) {
data.learnLib1 = null;
data.learnLib2 = null;
data.studyPlen = null;
data.wordDevelopment = null;
}
Log.d("users:json -> ", gson.toJson(users));
maxAnchor = selectMaxAnchor("user");
maxAnchor = maxAnchor == null ? "" : maxAnchor;
Log.d("table:user maxAnchor:", maxAnchor);
parms = new HashMap<>();//参数
parms.put(Config.PARAM_MAXANCHOR, maxAnchor);//参数为null,会导致请求不能成功
parms.put(Config.PARAM_SYNCJSONDATA, gson.toJson(users));
parms.put(Config.PARAM_USERID, Utils.getPreference(ctx, Config.PARAM_USERID));
new VolleyPostRequest(ctx).postRequest(parms, Config.SYNC_USER_URL, this);
//词汇量预估数据表
maxAnchor = selectMaxAnchor("word_evalution");
maxAnchor = maxAnchor == null ? "" : maxAnchor;
parms = new HashMap<>();//参数
parms.put(Config.PARAM_MAXANCHOR, maxAnchor);//参数为null,会导致请求不能成功
new VolleyPostRequest(ctx).postRequest(parms, Config.SYNC_WORD_EVALUATION_URL, this);
//词库
maxAnchor = selectMaxAnchor("lib");
maxAnchor = maxAnchor == null ? "" : maxAnchor;
parms = new HashMap<>();//参数
parms.put(Config.PARAM_MAXANCHOR, maxAnchor);//参数为null,会导致请求不能成功
new VolleyPostRequest(ctx).postRequest(parms, Config.SYNC_LIB_URL, this);
//单词计划:生成每日计划学习的新单词
DbUtil.initNewWordToLearn(ctx);//生成新生词
} catch (SQLException e) {
e.printStackTrace();
}
}
@Override
public void onResponse(String response) {
try {
response = new String(response.getBytes(Config.DEFAULT_STRING_CHARSET), Config.UTF8_CHARSET);
//TODO 解析返回值
Message message = new Gson().fromJson(response, Message.class);
int code = message.getCode();
String msg = message.getMsg();
switch (code) {
case 201://同步学习-词库1
List<LearnLib1Server> learnLib1Servers = gson.fromJson(msg, new TypeToken<List<LearnLib1Server>>() {
}.getType());
updateLearnLib1FromServer(learnLib1Servers, ctx);
App.WORDDEV_CHANGED = true;
break;
case 202://同步学习-词库2
List<LearnLib2Server> learnLib2Servers = gson.fromJson(msg, new TypeToken<List<LearnLib2Server>>() {
}.getType());
updateLearnLib2FromServer(learnLib2Servers, ctx);
App.WORDDEV_CHANGED = true;
break;
case 203://同步学习-进展
List<WordDevelopmentServer> wordDevelopmentServers = gson.fromJson(msg, new TypeToken<List<WordDevelopmentServer>>() {
}.getType());
updateWordDevelopmentFromServer(wordDevelopmentServers, ctx);
App.WORDDEV_CHANGED = true;
break;
case 204://学习计划
List<StudyPlan> studyPlen = gson.fromJson(msg, new TypeToken<List<StudyPlan>>() {
}.getType());
updateStudyPlanFromServer(studyPlen, ctx);
break;
case 205://词库信息
List<Libs> libses = gson.fromJson(msg, new TypeToken<List<Libs>>() {
}.getType());
updateLibsFromServer(libses, ctx);
App.WORDDEV_CHANGED = true;
break;
case 206://个人信息
List<UserServer> users = gson.fromJson(msg, new TypeToken<List<UserServer>>() {
}.getType());
updateUserFromServer(users, ctx);
break;
case 207:
List<WordEvaluation> wordEvaluations = gson.fromJson(msg, new TypeToken<List<WordEvaluation>>() {
}.getType());
updateWordEvaluationFromServer(wordEvaluations, ctx);
break;
case 208:
List<Lib> libList = gson.fromJson(msg, new TypeToken<List<Lib>>() {
}.getType());
updateLibFromServer(libList, ctx);
break;
case 209:
List<RemovedLib> removedLibList = gson.fromJson(msg, new TypeToken<List<RemovedLib>>() {
}.getType());
removeLibFromServer(removedLibList, ctx);
break;
case 210:
List<LearnLib> learnLibList = gson.fromJson(msg, new TypeToken<List<LearnLib>>() {
}.getType());
updateLearnLibFromServer(learnLibList, ctx);
break;
}
Toast.makeText(ctx, "同步成功", Toast.LENGTH_SHORT).show();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
private void updateLearnLibFromServer(List<LearnLib> learnLibList, Context ctx) {
try {
if (learnLibList.size() <= 0)
return;
Dao dao = DBHelper.getHelper(ctx).getDao(learnLibList.get(0).getClass());
for (LearnLib data : learnLibList) {
if (data.oldId != null && !data.oldId.isEmpty()) {
dao.delete(new LearnLib(UUID.fromString(data.oldId)));
}
//关系
data.user = new UserServer(data.userId);
data.lib = new Lib(data.libId);
dao.createOrUpdate(data);
}
} catch (SQLException e) {
e.printStackTrace();
}
}
private void removeLibFromServer(List<RemovedLib> datas, Context ctx) {
try {
if (datas == null || datas.size() <= 0) {
return;
}
List<String> libNameList = new ArrayList<>();
for (RemovedLib data : datas) {
libNameList.add(data.getLibName());
}
Dao libDao = DBHelper.getHelper(ctx).getDao(Lib.class);
DeleteBuilder deleteBuilder = libDao.deleteBuilder();
deleteBuilder.where().in("libName", libNameList);
deleteBuilder.delete();
Dao<Libs, Integer> libsDao = DBHelper.getHelper(ctx).getDao(Libs.class);
DeleteBuilder delLibsB = libsDao.deleteBuilder();
delLibsB.where().in("libName", libNameList);
delLibsB.delete();
// TODO: 2017/4/10 继续删除对应的学习记录
} catch (SQLException e) {
e.printStackTrace();
}
}
/**
* LearnLib1
* 更新本地数据库
*
* @param learnLib1s
* @param ctx
*/
public void updateLearnLib1FromServer(List<LearnLib1Server> learnLib1s, Context ctx) {
try {
if (learnLib1s.size() <= 0)
return;
Dao dao = DBHelper.getHelper(ctx).getDao(learnLib1s.get(0).getClass());
for (LearnLib1Server data : learnLib1s) {
if (data.oldId != null && !data.oldId.isEmpty()) {
dao.delete(new LearnLib1Server(UUID.fromString(data.oldId)));
}
//关系
data.user = new UserServer(data.userId);
data.lib1 = new Lib1EnglishGrand4CoreServer(data.lib1Id);
dao.createOrUpdate(data);
}
} catch (SQLException e) {
e.printStackTrace();
}
}
/**
* LearnLib2
* 更新本地数据库
*
* @param learnLib2s
* @param ctx
*/
public void updateLearnLib2FromServer(List<LearnLib2Server> learnLib2s, Context ctx) {
try {
if (learnLib2s.size() <= 0) {
return;
}
Dao dao = DBHelper.getHelper(ctx).getDao(learnLib2s.get(0).getClass());
for (LearnLib2Server data : learnLib2s) {
if (data.oldId != null && !data.oldId.isEmpty()) {
dao.delete(new LearnLib2Server(UUID.fromString(data.oldId)));
}
//建立关系
data.user = new UserServer(data.userId);
data.lib2 = new Lib2MiddleSchoolServer(data.lib2Id);
dao.createOrUpdate(data);
}
} catch (SQLException e) {
e.printStackTrace();
}
}
/**
* WordDevelopment表
* 更新本地数据库
*
* @param datas
* @param ctx
*/
public void updateWordDevelopmentFromServer(List<WordDevelopmentServer> datas, Context ctx) {
try {
if (datas.size() <= 0) {
return;
}
Dao dao = DBHelper.getHelper(ctx).getDao(datas.get(0).getClass());
for (WordDevelopmentServer data : datas) {
if (data.oldId != null && !data.oldId.isEmpty()) {
dao.delete(new WordDevelopmentServer(UUID.fromString(data.oldId)));
}
//设置主键 ,建立关系
data.user = new UserServer(data.userId);
dao.createOrUpdate(data);
}
} catch (SQLException e) {
e.printStackTrace();
}
}
/**
* StudyPlan表
* 更新本地数据库
*
* @param datas
* @param ctx
*/
public void updateStudyPlanFromServer(List<StudyPlan> datas, Context ctx) {
try {
if (datas.size() <= 0) {
return;
}
Dao dao = DBHelper.getHelper(ctx).getDao(datas.get(0).getClass());
for (StudyPlan data : datas) {
if (data.oldId != null && !data.oldId.isEmpty()) {
dao.delete(new StudyPlan(UUID.fromString(data.oldId)));
}
//设置主键 ,建立关系
data.user = new UserServer(data.userId);
dao.createOrUpdate(data);
}
} catch (SQLException e) {
e.printStackTrace();
}
}
public void updateLibsFromServer(List<Libs> datas, Context ctx) {
try {
if (datas == null || datas.size() <= 0) {
return;
}
Dao dao = DBHelper.getHelper(ctx).getDao(datas.get(0).getClass());
for (Libs data : datas) {
dao.createOrUpdate(data);
}
} catch (SQLException e) {
e.printStackTrace();
}
}
private void updateUserFromServer(List<UserServer> datas, Context ctx) {
try {
if (datas == null || datas.size() <= 0) {
return;
}
Dao dao = DBHelper.getHelper(ctx).getDao(datas.get(0).getClass());
for (UserServer data : datas) {
dao.update(data);
}
} catch (SQLException e) {
e.printStackTrace();
}
}
private void updateWordEvaluationFromServer(List<WordEvaluation> datas, Context ctx) {
try {
if (datas == null || datas.size() <= 0) {
return;
}
Dao dao = DBHelper.getHelper(ctx).getDao(datas.get(0).getClass());
for (WordEvaluation data : datas) {
//TODO 设置外键ID
WordLibServer word = new WordLibServer();
word.wordId = data.wordId;
data.wordLib = word;
dao.createOrUpdate(data);
}
} catch (SQLException e) {
e.printStackTrace();
}
}
private void updateLibFromServer(List<Lib> datas, Context ctx) {
try {
if (datas == null || datas.size() <= 0) {
return;
}
Dao dao = DBHelper.getHelper(ctx).getDao(datas.get(0).getClass());
for (Lib data : datas) {
WordLibServer word = new WordLibServer();
word.wordId = data.wordId;
data.wordLib = word;
dao.createOrUpdate(data);
}
} catch (SQLException e) {
e.printStackTrace();
}
}
/**
* 调用android的SQLiteDatabase进行max(anchor)查询
*
* @param tbName
* @return 表为空返回NULL
*/
public String selectMaxAnchor(String tbName) {
SQLiteDatabase db = DBHelper.getHelper(ctx).getReadableDatabase();
Cursor cursor = db.rawQuery("select max(anchor) from " + tbName, null);
cursor.moveToNext();
String maxAnchor = cursor.getString(0);
cursor.close();
// db.close();
return maxAnchor;
}
}
| v587jasonzou/LJDC | app/src/main/java/com/ljdc/utils/DataSyncUtil.java |
64,743 | package com.example.chapter11.task;
import android.os.AsyncTask;
// 模拟异步处理的线程
public class BookLoadTask extends AsyncTask<String, Integer, String> {
private String mBook; // 书籍名称
public BookLoadTask(String title) {
super();
mBook = title;
}
// 线程正在后台处理
protected String doInBackground(String... params) {
int ratio = 0; // 下载比例
for (; ratio <= 100; ratio += 5) {
try {
Thread.sleep(200); // 睡眠200毫秒模拟网络文件下载耗时
} catch (InterruptedException e) {
e.printStackTrace();
}
publishProgress(ratio); // 通报处理进展。调用该方法会触发onProgressUpdate方法
}
return params[0]; // 返回参数是书籍的名称
}
// 准备启动线程
protected void onPreExecute() {
mListener.onBegin(mBook); // 触发监听器的开始事件
}
// 线程在通报处理进展
protected void onProgressUpdate(Integer... values) {
mListener.onUpdate(mBook, values[0]); // 触发监听器的进度更新事件
}
// 线程已经完成处理
protected void onPostExecute(String result) {
mListener.onFinish(result); // 触发监听器的结束事件
}
// 线程已经取消
protected void onCancelled(String result) {
mListener.onCancel(result); // 触发监听器的取消事件
}
private OnProgressListener mListener; // 声明一个进度更新的监听器对象
// 设置进度更新的监听器
public void setOnProgressListener(OnProgressListener listener) {
mListener = listener;
}
// 定义一个进度更新的监听器接口
public interface OnProgressListener {
void onBegin(String book); // 在线程处理开始时触发
void onUpdate(String book, int progress); // 在线程处理过程中更新进度时触发
void onFinish(String book); // 在线程处理结束时触发
void onCancel(String book); // 在线程处理取消时触发
}
}
| aqi00/myapp | chapter11/src/main/java/com/example/chapter11/task/BookLoadTask.java |
64,744 | package xjt.workflow.exe;
/**
* 令牌类,标志流程进展
* @since Aug 30, 2010
* @author xjt
* @version 1.00 Aug 30, 2010
* */
public class Token implements java.io.Serializable {
private static final long serialVersionUID = 1L;
/**
* 标识ID
* */
private Long id;
/**
* 当前所在的工作项实例
* */
private WorkItemInstance workItemInstance;
/**
* 是否处于等待状态,用于分支、汇合的判断
* */
private Byte isWaited;
/**
* 是否废弃,当子令牌继承父母令牌时,将父母令牌设为不可用
* */
private Byte isDisable;
/**
* 父母令牌
* */
private Token parentToken;
// Constructors
/** default constructor */
public Token() {
}
/** full constructor */
public Token(WorkItemInstance workItemInstance, Byte isWaited, Byte isDisable,Token parentToken) {
this.workItemInstance = workItemInstance;
this.isWaited = isWaited;
this.isDisable = isDisable;
this.parentToken = parentToken;
}
// Property accessors
public Long getId() {
return this.id;
}
public void setId(Long id) {
this.id = id;
}
public WorkItemInstance getWorkItemInstance() {
return workItemInstance;
}
public void setWorkItemInstance(WorkItemInstance workItemInstance) {
this.workItemInstance = workItemInstance;
}
public Byte getIsWaited() {
return this.isWaited;
}
public void setIsWaited(Byte isWaited) {
this.isWaited = isWaited;
}
public Byte getIsDisable() {
return this.isDisable;
}
public void setIsDisable(Byte isDisable) {
this.isDisable = isDisable;
}
public Token getParentToken() {
return parentToken;
}
public void setParentToken(Token parentToken) {
this.parentToken = parentToken;
}
} | xiejuntao/Xworkflow | src/xjt/workflow/exe/Token.java |
64,745 | package org.xumingmingv.markdownplanner.model.task;
import java.time.LocalDate;
import org.xumingmingv.markdownplanner.model.HalfDayDuration;
import org.xumingmingv.markdownplanner.model.Header;
import org.xumingmingv.markdownplanner.model.HalfDayPrecisionDate;
public interface Task {
/**
* 任务的ID
* @return
*/
Integer getId();
/**
* 设置ID
*/
void setId(Integer id);
/**
* 父任务的ID
* @return
*/
Integer getParentId();
/**
* 设置父任务ID
*/
void setParentId(Integer parentId);
/**
* 项目开始时间
* @return
*/
LocalDate getProjectStartDate();
/**
* 设置项目开始时间
*/
void setProjectStartDate(LocalDate projectStartDate);
/**
* 这个任务所属的组
* @return
*/
Header getHeader();
/**
* 任务的名字
* @return
*/
String getName();
/**
* 任务的Owner
* @return
*/
String getOwner();
/**
* 任务需要的Cost
* @return
*/
int getCost();
/**
* 获取时间使用掉的时间
* @return
*/
int getUsedCost();
/**
* 设置useCost
* @param usedCost
*/
void setUsedCost(int usedCost);
/**
* 任务目前的进度
* @return
*/
int getProgress();
/**
* 任务开始节点
*/
Integer getStartOffset();
/**
* 设置startOffset
*/
void setStartOffset(Integer startOffset);
/**
* 设置endOffset
*/
void setEndOffset(Integer endOffset);
/**
* 任务结束节点
*/
Integer getEndOffset();
/**
* 是否是复合任务
* @return
*/
boolean isComposite();
/**
* 期望中的任务进度
*/
default int getExpectedProgress() {
double ret = 1.0 * getUsedCost() * 100 / getCost();
int intRet = Double.valueOf(ret).intValue();
return intRet > 100 ? 100 : intRet;
}
/**
* 任务的属性是否已经完全设置好了
*/
default boolean isFullyPopulated() {
return getEndOffset() != null;
}
/**
* 任务是否已经开始
*/
default boolean isStarted() {
return getProgress() > 0;
}
/**
* 任务是否有所延迟
*/
default boolean isDelayed() {
return getProgress() < getExpectedProgress();
}
/**
* 任务是否已经完成
*/
default boolean isCompleted() {
return getProgress() == 100;
}
/**
* 任务已经完成的进展
*/
default double getFinishedCost() {
return 1.0 * getProgress() * getCost() / 100;
}
/**
* 任务的开始日期
*/
default HalfDayPrecisionDate getStartDate() {
return new HalfDayDuration(getStartOffset()).addToDate(getProjectStartDate());
}
/**
* 任务的结束日期
*/
default HalfDayPrecisionDate getEndDate() {
return new HalfDayDuration(getEndOffset()).addToDate(getProjectStartDate());
}
}
| xumingming/MarkdownPlanner | src/main/java/org/xumingmingv/markdownplanner/model/task/Task.java |
64,746 | package com.huaweicloud.sdk.dcs.v2.model;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Objects;
import java.util.function.Consumer;
/**
* 单个任务结构体
*/
public class SingleBackgroundTask {
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "id")
private String id;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "name")
private String name;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "details")
private DetailsBody details;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "user_name")
private String userName;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "user_id")
private String userId;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "params")
private String params;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "status")
private String status;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "created_at")
private String createdAt;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "updated_at")
private String updatedAt;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "enable_show")
private Boolean enableShow;
public SingleBackgroundTask withId(String id) {
this.id = id;
return this;
}
/**
* 后台任务ID
* @return id
*/
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public SingleBackgroundTask withName(String name) {
this.name = name;
return this;
}
/**
* 后台任务名,目前支持以下取值: ChangeInstanceSpec:变更规格 BindEip:开启公网访问 UnBindEip:关闭公网访问 AddReplica:添加副本 DelReplica:删除副本 AddWhitelist:设置IP白名单 UpdatePort:修改端口 RemoveIpFromDns:域名摘除IP
* @return name
*/
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public SingleBackgroundTask withDetails(DetailsBody details) {
this.details = details;
return this;
}
public SingleBackgroundTask withDetails(Consumer<DetailsBody> detailsSetter) {
if (this.details == null) {
this.details = new DetailsBody();
detailsSetter.accept(this.details);
}
return this;
}
/**
* Get details
* @return details
*/
public DetailsBody getDetails() {
return details;
}
public void setDetails(DetailsBody details) {
this.details = details;
}
public SingleBackgroundTask withUserName(String userName) {
this.userName = userName;
return this;
}
/**
* 用户名
* @return userName
*/
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public SingleBackgroundTask withUserId(String userId) {
this.userId = userId;
return this;
}
/**
* 用户ID
* @return userId
*/
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public SingleBackgroundTask withParams(String params) {
this.params = params;
return this;
}
/**
* 任务相关参数
* @return params
*/
public String getParams() {
return params;
}
public void setParams(String params) {
this.params = params;
}
public SingleBackgroundTask withStatus(String status) {
this.status = status;
return this;
}
/**
* 任务状态
* @return status
*/
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public SingleBackgroundTask withCreatedAt(String createdAt) {
this.createdAt = createdAt;
return this;
}
/**
* 任务启动时间,格式为2020-06-17T07:38:42.503Z
* @return createdAt
*/
public String getCreatedAt() {
return createdAt;
}
public void setCreatedAt(String createdAt) {
this.createdAt = createdAt;
}
public SingleBackgroundTask withUpdatedAt(String updatedAt) {
this.updatedAt = updatedAt;
return this;
}
/**
* 任务结束时间,格式为2020-06-17T07:38:42.503Z
* @return updatedAt
*/
public String getUpdatedAt() {
return updatedAt;
}
public void setUpdatedAt(String updatedAt) {
this.updatedAt = updatedAt;
}
public SingleBackgroundTask withEnableShow(Boolean enableShow) {
this.enableShow = enableShow;
return this;
}
/**
* 是否有详细任务进展,可以展开查看
* @return enableShow
*/
public Boolean getEnableShow() {
return enableShow;
}
public void setEnableShow(Boolean enableShow) {
this.enableShow = enableShow;
}
@Override
public boolean equals(java.lang.Object obj) {
if (this == obj) {
return true;
}
if (obj == null || getClass() != obj.getClass()) {
return false;
}
SingleBackgroundTask that = (SingleBackgroundTask) obj;
return Objects.equals(this.id, that.id) && Objects.equals(this.name, that.name)
&& Objects.equals(this.details, that.details) && Objects.equals(this.userName, that.userName)
&& Objects.equals(this.userId, that.userId) && Objects.equals(this.params, that.params)
&& Objects.equals(this.status, that.status) && Objects.equals(this.createdAt, that.createdAt)
&& Objects.equals(this.updatedAt, that.updatedAt) && Objects.equals(this.enableShow, that.enableShow);
}
@Override
public int hashCode() {
return Objects.hash(id, name, details, userName, userId, params, status, createdAt, updatedAt, enableShow);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class SingleBackgroundTask {\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append(" details: ").append(toIndentedString(details)).append("\n");
sb.append(" userName: ").append(toIndentedString(userName)).append("\n");
sb.append(" userId: ").append(toIndentedString(userId)).append("\n");
sb.append(" params: ").append(toIndentedString(params)).append("\n");
sb.append(" status: ").append(toIndentedString(status)).append("\n");
sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n");
sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n");
sb.append(" enableShow: ").append(toIndentedString(enableShow)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
| huaweicloud/huaweicloud-sdk-java-v3 | services/dcs/src/main/java/com/huaweicloud/sdk/dcs/v2/model/SingleBackgroundTask.java |
64,747 | package com.example.anan.AAChartCore.ChartsDemo.chartcomposer;
import static com.github.AAChartModel.AAChartCore.AATools.AAColor.AARgba;
import android.util.DisplayMetrics;
import com.github.AAChartModel.AAChartCore.AAChartCreator.AAChartModel;
import com.github.AAChartModel.AAChartCore.AAChartCreator.AASeriesElement;
import com.github.AAChartModel.AAChartCore.AAChartEnum.AAChartAnimationType;
import com.github.AAChartModel.AAChartCore.AAChartEnum.AAChartLineDashStyleType;
import com.github.AAChartModel.AAChartCore.AAChartEnum.AAChartStackingType;
import com.github.AAChartModel.AAChartCore.AAChartEnum.AAChartSymbolStyleType;
import com.github.AAChartModel.AAChartCore.AAChartEnum.AAChartSymbolType;
import com.github.AAChartModel.AAChartCore.AAChartEnum.AAChartType;
import com.github.AAChartModel.AAChartCore.AAOptionsModel.AAAnimation;
import com.github.AAChartModel.AAChartCore.AAOptionsModel.AAChart;
import com.github.AAChartModel.AAChartCore.AAOptionsModel.AACrosshair;
import com.github.AAChartModel.AAChartCore.AAOptionsModel.AAHover;
import com.github.AAChartModel.AAChartCore.AAOptionsModel.AAInactive;
import com.github.AAChartModel.AAChartCore.AAOptionsModel.AALabels;
import com.github.AAChartModel.AAChartCore.AAOptionsModel.AAOptions;
import com.github.AAChartModel.AAChartCore.AAOptionsModel.AAPlotOptions;
import com.github.AAChartModel.AAChartCore.AAOptionsModel.AAPoint;
import com.github.AAChartModel.AAChartCore.AAOptionsModel.AAPointEvents;
import com.github.AAChartModel.AAChartCore.AAOptionsModel.AAResetZoomButton;
import com.github.AAChartModel.AAChartCore.AAOptionsModel.AASelect;
import com.github.AAChartModel.AAChartCore.AAOptionsModel.AASeries;
import com.github.AAChartModel.AAChartCore.AAOptionsModel.AASeriesEvents;
import com.github.AAChartModel.AAChartCore.AAOptionsModel.AAStates;
import com.github.AAChartModel.AAChartCore.AAOptionsModel.AAStyle;
import com.github.AAChartModel.AAChartCore.AAOptionsModel.AATitle;
import com.github.AAChartModel.AAChartCore.AAOptionsModel.AATooltip;
import com.github.AAChartModel.AAChartCore.AAOptionsModel.AAXAxis;
import com.github.AAChartModel.AAChartCore.AAOptionsModel.AAYAxis;
import com.github.AAChartModel.AAChartCore.AATools.AAColor;
import com.github.AAChartModel.AAChartCore.AATools.AAGradientColor;
import com.github.AAChartModel.AAChartCore.AATools.AALinearGradientDirection;
import java.util.HashMap;
import java.util.Map;
public class JSFunctionForAATooltipComposer {
public static AAOptions customAreaChartTooltipStyleWithSimpleFormatString() {
AAChartModel aaChartModel = new AAChartModel()
.chartType(AAChartType.Area)//图形类型
.title("近三个月金价起伏周期图")//图表主标题
.subtitle("金价(元/克)")//图表副标题
.markerSymbolStyle(AAChartSymbolStyleType.BorderBlank)//折线连接点样式为外边缘空白
.dataLabelsEnabled(false)
.categories(new String[]{
"10-01","10-02","10-03","10-04","10-05","10-06","10-07","10-08","10-09","10-10","10-11",
"10-12","10-13","10-14","10-15","10-16","10-17","10-18","10-19","10-20","10-21","10-22",
"10-23","10-024","10-25","10-26","10-27","10-28","10-29","10-30","10-31","11-01","11-02",
"11-03","11-04","11-05","11-06","11-07","11-08","11-09","11-10","11-11","11-12","11-13",
"11-14","11-15","11-16","11-17","11-18","11-19","11-20","11-21","11-22","11-23","11-024",
"11-25","11-26","11-27","11-28","11-29","11-30","12-01","12-02","12-03","12-04","12-05",
"12-06","12-07","12-08","12-09","12-10","12-11","12-12","12-13","12-14","12-15","12-16",
"12-17","12-18","12-19","12-20","12-21","12-22","12-23","12-024","12-25","12-26","12-27",
"12-28","12-29","12-30"})
.series(new AASeriesElement[]{
new AASeriesElement()
.name("2020")
.lineWidth(3)
.color("#FFD700"/*纯金色*/)
.fillOpacity(0.5)
.data(new Object[]{
1.51, 6.7, 0.94, 1.44, 1.6, 1.63, 1.56, 1.91, 2.45, 3.87, 3.24, 4.90, 4.61, 4.10,
4.17, 3.85, 4.17, 3.46, 3.46, 3.55, 3.50, 4.13, 2.58, 2.28, 1.51, 12.7, 0.94, 1.44,
18.6, 1.63, 1.56, 1.91, 2.45, 3.87, 3.24, 4.90, 4.61, 4.10, 4.17, 3.85, 4.17, 3.46,
3.46, 3.55, 3.50, 4.13, 2.58, 2.28, 1.33, 4.68, 1.31, 1.10, 13.9, 1.10, 1.16, 1.67,
2.64, 2.86, 3.00, 3.21, 4.14, 4.07, 3.68, 3.11, 3.41, 3.25, 3.32, 3.07, 3.92, 3.05,
2.18, 3.24, 3.23, 3.15, 2.90, 1.81, 2.11, 2.43, 5.59, 3.09, 4.09, 6.14, 5.33, 6.05,
5.71, 6.22, 6.56, 4.75, 5.27, 6.02, 5.48})
});
AAOptions aaOptions = aaChartModel.aa_toAAOptions();
AATooltip aaTooltip = new AATooltip()
.useHTML(true)
.formatter(" function () {\n" +
" return ' 🌕 🌖 🌗 🌘 🌑 🌒 🌓 🌔 <br/> '\n" +
" + ' Support JavaScript Function Just Right Now !!! <br/> '\n" +
" + ' The Gold Price For <b>2020 '\n" +
" + this.x\n" +
" + ' </b> Is <b> '\n" +
" + this.y\n" +
" + ' </b> Dollars ';\n" +
" }")
.valueDecimals(2)//设置取值精确到小数点后几位//设置取值精确到小数点后几位
.backgroundColor("#000000")
.borderColor("#000000")
.style(new AAStyle()
.color("#FFD700")
.fontSize(12.)
);
aaOptions.tooltip(aaTooltip);
aaOptions.chart
.resetZoomButton(new AAResetZoomButton()
.theme((Map) new HashMap()
.put("display","none")) //隐藏图表缩放后的默认显示的缩放按钮
);
return aaOptions;
}
public static AAOptions customAreaChartTooltipStyleWithDifferentUnitSuffix() {
AASeriesElement element1 = new AASeriesElement()
.name("🐶狗子")
.lineWidth(5)
.fillOpacity(0.5)
.data(new Object[]{0.45, 0.43, 0.50, 0.55, 0.58, 0.62, 0.83, 0.39, 0.56, 0.67, 0.50, 0.34, 0.50, 0.67, 0.58, 0.29, 0.46, 0.23, 0.47, 0.46, 0.38, 0.56, 0.48, 0.36});
AASeriesElement element2 = new AASeriesElement()
.name("🌲树木")
.lineWidth(5)
.fillOpacity(0.5)
.data(new Object[]{0.38, 0.31, 0.32, 0.32, 0.64, 0.66, 0.86, 0.47, 0.52, 0.75, 0.52, 0.56, 0.54, 0.60, 0.46, 0.63, 0.54, 0.51, 0.58, 0.64, 0.60, 0.45, 0.36, 0.67});
AAChartModel aaChartModel = new AAChartModel()
.chartType(AAChartType.Area)//图形类型
.title("2014 ~ 2020 汪星人生存指数")//图表主标题
.subtitle("数据来源:www.无任何可靠依据.com")//图表副标题
.markerSymbolStyle(AAChartSymbolStyleType.BorderBlank)//折线连接点样式为外边缘空白
.dataLabelsEnabled(false)
.colorsTheme(new Object[]{"#ff0000","#0000ff"})
.stacking(AAChartStackingType.Normal)
.series(new AASeriesElement[]{element1, element2});
AATooltip aaTooltip = new AATooltip()
.useHTML(true)
.formatter("function () {\n" +
" var s = '第' + '<b>' + this.x + '</b>' + '年' + '<br/>';\n" +
" let colorDot1 = '<span style=\\\"' + 'color:#1e90ff; font-size:13px\\\"' + '>◉</span> ';\n" +
" let colorDot2 = '<span style=\\\"' + 'color:#ef476f; font-size:13px\\\"' + '>◉</span> ';\n" +
" let s1 = colorDot1 + this.points[0].series.name + ': ' + this.points[0].y + '只' + '<br/>';\n" +
" let s2 = colorDot2 + this.points[1].series.name + ': ' + this.points[1].y + '棵';\n" +
" s += s1 + s2;\n" +
" return s;\n" +
" }")
;
AAOptions aaOptions = aaChartModel.aa_toAAOptions();
aaOptions.tooltip(aaTooltip);
aaOptions.plotOptions.series.events = new AASeriesEvents()
.legendItemClick("function() {\n" +
" return false;\n" +
" }");
return aaOptions;
}
public static AAOptions customAreaChartTooltipStyleWithColorfulHtmlLabels() {
AASeriesElement element1 = new AASeriesElement()
.name("Predefined symbol")
.data(new Object[]{0.45, 0.43, 0.50, 0.55, 0.58, 0.62, 0.83, 0.39, 0.56, 0.67, 0.50, 0.34, 0.50, 0.67, 0.58, 0.29, 0.46, 0.23, 0.47, 0.46, 0.38, 0.56, 0.48, 0.36});
AASeriesElement element2 = new AASeriesElement()
.name("Image symbol")
.data(new Object[]{0.38, 0.31, 0.32, 0.32, 0.64, 0.66, 0.86, 0.47, 0.52, 0.75, 0.52, 0.56, 0.54, 0.60, 0.46, 0.63, 0.54, 0.51, 0.58, 0.64, 0.60, 0.45, 0.36, 0.67});
AASeriesElement element3 = new AASeriesElement()
.name("Base64 symbol (*)")
.data(new Object[]{0.46, 0.32, 0.53, 0.58, 0.86, 0.68, 0.85, 0.73, 0.69, 0.71, 0.91, 0.74, 0.60, 0.50, 0.39, 0.67, 0.55, 0.49, 0.65, 0.45, 0.64, 0.47, 0.63, 0.64});
AASeriesElement element4 = new AASeriesElement()
.name("Custom symbol")
.data(new Object[]{0.60, 0.51, 0.52, 0.53, 0.64, 0.84, 0.65, 0.68, 0.63, 0.47, 0.72, 0.60, 0.65, 0.74, 0.66, 0.65, 0.71, 0.59, 0.65, 0.77, 0.52, 0.53, 0.58, 0.53});
AAChartModel aaChartModel = new AAChartModel()
.chartType(AAChartType.Areaspline)//图形类型
.markerSymbolStyle(AAChartSymbolStyleType.BorderBlank)//折线连接点样式为外边缘空白
.dataLabelsEnabled(false)
.colorsTheme(new Object[]{"#04d69f","#1e90ff","#ef476f","#ffd066",})
.stacking(AAChartStackingType.Normal)
.markerRadius(0)
.series(new AASeriesElement[]{element1, element2, element3, element4});
AATooltip aaTooltip = new AATooltip()
.useHTML(true)
.formatter("function () {\n" +
" let wholeContentStr ='<span style=\\\"' + 'color:lightGray; font-size:13px\\\"' + '>◉ Time: ' + this.x + ' year</span><br/>';\n" +
" let length = this.points.length;\n" +
" for (let i = 0; i < length; i++) {\n" +
" let thisPoint = this.points[i];\n" +
" let yValue = thisPoint.y;\n" +
" if (yValue != 0) {\n" +
" let spanStyleStartStr = '<span style=\\\"' + 'color:'+ thisPoint.color + '; font-size:13px\\\"' + '>◉ ';\n" +
" let spanStyleEndStr = '</span> <br/>';\n" +
" wholeContentStr += spanStyleStartStr + thisPoint.series.name + ': ' + thisPoint.y + '℃' + spanStyleEndStr;\n" +
" }\n" +
" }\n" +
" return wholeContentStr;\n" +
" }")
.backgroundColor("#050505")
.borderColor("#050505")
;
AAOptions aaOptions = aaChartModel.aa_toAAOptions();
aaOptions.tooltip(aaTooltip);
return aaOptions;
}
public static AAOptions customLineChartTooltipStyleWhenValueBeZeroDoNotShow() {
AAChartModel aaChartModel = new AAChartModel()
.chartType(AAChartType.Area)//图形类型
.markerSymbolStyle(AAChartSymbolStyleType.BorderBlank)//折线连接点样式为外边缘空白
.dataLabelsEnabled(false)
.categories(new String[]{"临床一期","临床二期","临床三期"})
.series(new AASeriesElement[]{
new AASeriesElement()
.name("上市")
.data(new Object[]{0, 0, 7}),
new AASeriesElement()
.name("中止")
.data(new Object[]{4, 5, 1}),
new AASeriesElement()
.name("无进展")
.data(new Object[]{2, 0, 1}),
new AASeriesElement()
.name("进行中")
.data(new Object[]{3, 5, 2}),
});
AATooltip aaTooltip = new AATooltip()
.useHTML(true)
.formatter("function () {\n" +
" let wholeContentStr = this.points[0].x + '<br/>';\n" +
" let length = this.points.length;\n" +
" for (let i = 0; i < length; i++) {\n" +
" let thisPoint = this.points[i];\n" +
" let yValue = thisPoint.y;\n" +
" if (yValue != 0) {\n" +
" let prefixStr = '<span style=\\\"' + 'color:'+ thisPoint.color + '; font-size:13px\\\"' + '>◉ ';\n" +
" wholeContentStr += prefixStr + thisPoint.series.name + ': ' + yValue + '<br/>';\n" +
" }\n" +
" }\n" +
" return wholeContentStr;\n" +
" }")
;
AAOptions aaOptions = aaChartModel.aa_toAAOptions();
aaOptions.tooltip(aaTooltip);
return aaOptions;
}
public static AAOptions customBoxplotTooltipContent() {
AAChartModel aaChartModel = new AAChartModel()
.chartType(AAChartType.Boxplot)
.title("BOXPLOT CHART")
.subtitle("virtual data")
.yAxisTitle("℃")
.series(new AASeriesElement[]{
new AASeriesElement()
.name("Observed Data")
.color("#ef476f")
.fillColor(AAGradientColor.DeepSea)
.data( new Object[][] {
{760, 801, 848, 895, 965},
{733, 853, 939, 980, 1080},
{714, 762, 817, 870, 918},
{724, 802, 806, 871, 950},
{834, 836, 864, 882, 910}
})
,
});
String pointFormatStr =
"◉</span> <b> {series.name}</b><br/>"
+ "最大值: {point.high}<br/>"
+ "Q2: {point.q3}<br/>"
+ "中位数: {point.median}<br/>"
+ "Q1: {point.q1}<br/>"
+ "最小值: {point.low}<br/>";
AATooltip aaTooltip = new AATooltip()
.useHTML(true)
.headerFormat("<em>实验号码: {point.key}</em><br/>")
.pointFormat(pointFormatStr)
.valueDecimals(2)//设置取值精确到小数点后几位//设置取值精确到小数点后几位
.backgroundColor("#000000")
.borderColor("#000000")
.style(new AAStyle()
.color("#1e90ff")
.fontSize(12.)
);
AAOptions aaOptions = aaChartModel.aa_toAAOptions();
aaOptions.tooltip(aaTooltip);
return aaOptions;
}
public static AAOptions customStackedAndGroupedColumnChartTooltip() {
AAChartModel aaChartModel = new AAChartModel()
.title("Total fruit consumption, grouped by gender")
.subtitle("stacked and grouped")
.yAxisTitle("Number of fruits")
.chartType(AAChartType.Column)
.legendEnabled(false)//隐藏图例(底部可点按的小圆点)
.stacking(AAChartStackingType.Normal)
.categories(new String[]{"Apples", "Oranges", "Pears","Grapes","Bananas",})
.dataLabelsEnabled(true)
.series(new AASeriesElement[] {
new AASeriesElement()
.name("John")
.data(new Object[]{5,3,4,7,2,})
.stack("male")
,
new AASeriesElement()
.name("Joe")
.data(new Object[]{3,4,4,2,5,})
.stack("male")
,
new AASeriesElement()
.name("Jane")
.data(new Object[]{2,5,6,2,1,})
.stack("female")
,
new AASeriesElement()
.name("Janet")
.data(new Object[]{3,0,4, 4,3,})
.stack("female")
,
}
);
/*Custom Tooltip Style --- 自定义图表浮动提示框样式及内容*/
AAOptions aaOptions = aaChartModel.aa_toAAOptions();
aaOptions.plotOptions.series.states = new AAStates()
.inactive(new AAInactive()
.enabled(false));
aaOptions.tooltip
.shared(false)
.formatter("function () {\n" +
" return '<b>'\n" +
" + this.x\n" +
" + '</b><br/>'\n" +
" + this.series.name\n" +
" + ': '\n" +
" + this.y\n" +
" + '<br/>'\n" +
" + 'Total: '\n" +
" + this.point.stackTotal;\n" +
" }");
return aaOptions;
}
public static AAOptions customDoubleXAxesChart() {
Map<String, Object> gradientColorDic1 = AAGradientColor.linearGradient(
AALinearGradientDirection.ToTop,
"#7052f4",
"#00b0ff"//颜色字符串设置支持十六进制类型和 rgba 类型
);
Map<String, Object> gradientColorDic2 = AAGradientColor.linearGradient(
AALinearGradientDirection.ToTop,
"#EF71FF",
"#4740C8"//颜色字符串设置支持十六进制类型和 rgba 类型
);
AAChart aaChart = new AAChart()
.type(AAChartType.Bar);
AATitle aaTitle = new AATitle()
.text("2015 年德国人口金字塔")
.style(new AAStyle()
.color("#000000")
.fontSize(12.0));
String[] aaCategories = new String[]{"0-4", "5-9", "10-14", "15-19",
"20-24", "25-29", "30-34", "35-39", "40-44",
"45-49", "50-54", "55-59", "60-64", "65-69",
"70-74", "75-79", "80-84", "85-89", "90-94",
"95-99", "100 + "};
AAXAxis aaXAxis1 = new AAXAxis()
.reversed(true)
.categories(aaCategories)
.labels(new AALabels()
.step(1))
;
AAXAxis aaXAxis2 = new AAXAxis()
.reversed(true)
.opposite(true)
.categories(aaCategories)
.linkedTo(0)
.labels(new AALabels()
.step(1));
AAYAxis aaYAxis = new AAYAxis()
.gridLineWidth(0)// Y 轴网格线宽度
.title(new AATitle()
.text(""))//Y 轴标题
.labels(new AALabels()
.formatter("function () {\n" +
" return (Math.abs(this.value) / 1000000) + 'M';\n" +
"}"))
.min(-4000000)
.max(4000000);
AAPlotOptions aaPlotOptions = new AAPlotOptions()
.series(new AASeries()
.animation(new AAAnimation()
.duration(800)
.easing(AAChartAnimationType.Bounce)
)
.stacking(AAChartStackingType.Normal));
AATooltip aaTooltip = new AATooltip()
.enabled(true)
.shared(false)
.formatter("function () {\n" +
" return '<b>' + this.series.name + ', age ' + this.point.category + '</b><br/>' +\n" +
" '人口: ' + Highcharts.numberFormat(Math.abs(this.point.y), 0);\n" +
"}");
AASeriesElement aaSeriesElement1 = new AASeriesElement()
.name("Men")
.color(gradientColorDic1)
.data(new Object[]{-1746181, -1884428, -2089758, -2222362, -2537431, -2507081, -2443179,
-2664537, -3556505, -3680231, -3143062, -2721122, -2229181, -2227768,
-2176300, -1329968, -836804, -354784, -90569, -28367, -3878});
AASeriesElement aaSeriesElement2 = new AASeriesElement()
.name("Women")
.color(gradientColorDic2)
.data(new Object[]{1656154, 1787564, 1981671, 2108575, 2403438, 2366003, 2301402, 2519874,
3360596, 3493473, 3050775, 2759560, 2304444, 2426504, 2568938, 1785638,
1447162, 1005011, 330870, 130632, 21208});
return new AAOptions()
.chart(aaChart)
.title(aaTitle)
.xAxisArray(new AAXAxis[]{aaXAxis1,aaXAxis2})
.yAxis(aaYAxis)
.plotOptions(aaPlotOptions)
.tooltip(aaTooltip)
.series(new Object[]{aaSeriesElement1,aaSeriesElement2});
}
public static AAOptions customArearangeChartTooltip() {
AAChartModel aaChartModel = new AAChartModel()
.title("LANGUAGE MARKET SHARES JANUARY,2020 TO MAY")
.subtitle("virtual data")
.chartType(AAChartType.Arearange)
.markerSymbolStyle(AAChartSymbolStyleType.InnerBlank)
.series(new Object[]{
new AASeriesElement()
.name("Range")
.color("#1E90FF")
.type(AAChartType.Arearange)
.lineWidth(0.)
.fillOpacity(0.3)
.data(new Object[][] {
/* 2014-06-01 */
{140158080, 5.1, 20.6},
{140166720, 6.6, 24.6},
{140175360, 9.7, 22.2},
{140184000, 9.6, 21.6},
{140192640, 13.0,20.0},
{140201280, 12.9,18.2},
{140209920, 8.5, 23.2},
{140218560, 9.2, 21.4},
{140227200, 10.5,22.0},
{140235840, 7.3, 23.4},
{140244480, 12.1,18.2},
{140253120, 11.1,13.3},
{140261760, 10.0,20.7},
{140270400, 5.8, 23.4},
{140279040, 7.4, 20.1},
{140287680, 10.3,21.9},
{140296320, 7.8, 16.8},
{140304960, 11.6,19.7},
{140313600, 9.8, 16.0},
{140322240, 10.7,14.4},
{140330880, 9.0, 15.5},
{140339520, 5.1, 13.3},
{140348160, 10.0,19.3},
{140356800, 5.2, 22.1},
{140365440, 6.3, 21.3},
{140374080, 5.5, 21.1},
{140382720, 8.4, 19.7},
{140391360, 7.1, 23.3},
{140400000, 6.1, 20.8},
{140408640, 8.4, 22.6},
})
.zIndex(0)
,
});
AAOptions aaOptions = aaChartModel.aa_toAAOptions();
aaOptions.tooltip
.useHTML(true)
.formatter(" function () {\n" +
" let myPointOptions = this.points[0].point.options;\n" +
" let xValue = myPointOptions.x;\n" +
" let lowValue = myPointOptions.low;\n" +
" let highValue = myPointOptions.high;\n" +
" let titleStr = '🦁 this is my custom tooltip description text content <br>';\n" +
" let xValueStr = '🐯 this is x value : ' + xValue + '<br>';\n" +
" let lowValueStr = ' 🐶 this is low value : ' + lowValue + '<br>';\n" +
" let highValueStr = '🐱 this is high value : ' + highValue + '<br>';\n" +
" let tooltipDescStr = titleStr + xValueStr + lowValueStr + highValueStr;\n" +
" return tooltipDescStr;\n" +
" }")
.backgroundColor("#000000")
.borderColor("#000000")
.style(new AAStyle()
.color("#FFD700")
.fontSize(12)
);
return aaOptions;
}
public static AAOptions customLineChartOriginalPointPositionByConfiguringXAxisFormatterAndTooltipFormatter() {
String[] categories = new String[]{"Jan", "Feb", "Mar", "Apr", "May", "Jun","Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
String categoryJSArrStr = javaScriptArrayStringWithJavaArray(categories);
String tooltipFormatter =
"function () {\n" +
" return 'The value for <b>' + categoryJSArrStr[this.x] +\n" +
" '</b> is <b>' + this.y + '</b> ' + \"℃\";\n" +
" }";
String xAxisLabelsFormatter =
"function () {\n" +
" return categoryJSArrStr[this.value];\n" +
" }";
tooltipFormatter = tooltipFormatter.replace("categoryJSArrStr",categoryJSArrStr);
xAxisLabelsFormatter = xAxisLabelsFormatter.replace("categoryJSArrStr",categoryJSArrStr);
AASeriesElement element1 = new AASeriesElement()
.name("Tokyo")
.data(new Object[]{7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6});
AASeriesElement element2 = new AASeriesElement()
.name("NewYork")
.data(new Object[]{0.2, 0.8, 5.7, 11.3, 17.0, 22.0, 24.8, 24.1, 20.1, 14.1, 8.6, 2.5});
AASeriesElement element3 = new AASeriesElement()
.name("London")
.data(new Object[]{0.9, 0.6, 3.5, 8.4, 13.5, 17.0, 18.6, 17.9, 14.3, 9.0, 3.9, 1.0});
AASeriesElement element4 = new AASeriesElement()
.name("Berlin")
.data(new Object[]{3.9, 4.2, 5.7, 8.5, 11.9, 15.2, 17.0, 16.6, 14.2, 10.3, 6.6, 4.8});
AAChartModel aaChartModel = new AAChartModel()
.chartType(AAChartType.Area)
.title("THE HEAT OF PROGRAMMING LANGUAGE")
.subtitle("Virtual Data")
.dataLabelsEnabled(false)
.yAxisGridLineWidth(0)
.touchEventEnabled(true)
.series(new AASeriesElement[]{element1, element2, element3, element4});
AAOptions aaOptions = aaChartModel.aa_toAAOptions();
aaOptions.tooltip
.useHTML(true)
.formatter(tooltipFormatter);
aaOptions.xAxis.labels
.formatter(xAxisLabelsFormatter);
return aaOptions;
}
@SuppressWarnings("NonAsciiCharacters")
public static AAOptions customTooltipWhichDataSourceComeFromOutSideRatherThanSeries() {
AAChartModel aaChartModel = new AAChartModel()
.chartType(AAChartType.Column)//图表类型
.yAxisLineWidth(1)//Y轴轴线线宽为0即是隐藏Y轴轴线
.yAxisGridLineWidth(1)//y轴横向分割线宽度为1(为0即是隐藏分割线)
.xAxisGridLineWidth(1)//x轴横向分割线宽度为1(为0即是隐藏分割线)
.colorsTheme(new String[]{"#FFD700"/*纯金色*/})
.categories(new String[]{"一月", "二月", "三月", "四月", "五月", "六月",
"七月", "八月", "九月", "十月", "十一月", "十二月"})
.yAxisMax(110)
.series(new AASeriesElement[]{
new AASeriesElement()
.name("2017")
.data(new Object[]{55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, }),
});
Object[] 看近时长数组 = new Object[]{70, 69, 95, 14, 18, 21, 25, 26, 23, 18, 13, 96};
Object[] 看中时长数组 = new Object[]{20, 80, 57, 11, 17, 22, 24, 24, 20, 14, 86, 25};
Object[] 看远时长数组 = new Object[]{90, 60, 35, 84, 13, 17, 18, 17, 14, 90, 39, 10};
Object[] 总时长数组 = new Object[12];
for (int i = 0; i < 12; i++) {
float 单个总时长 = Float.valueOf((Integer)看近时长数组[i])
+ Float.valueOf((Integer)看中时长数组[i])
+ Float.valueOf((Integer)看远时长数组[i]);
总时长数组[i] = 单个总时长;
}
Object[] 有效时长数组 = new Object[]{39, 42, 57, 85, 19, 15, 17, 16, 14, 13, 66, 48};
Object[] 切换次数数组 = new Object[]{
randomNumber(), randomNumber(), randomNumber(),
randomNumber(), randomNumber(), randomNumber(),
randomNumber(), randomNumber(), randomNumber(),
randomNumber(), randomNumber(), randomNumber(),
};
Object[] 停止次数数组 = new Object[]{
randomNumber(), randomNumber(), randomNumber(),
randomNumber(), randomNumber(), randomNumber(),
randomNumber(), randomNumber(), randomNumber(),
randomNumber(), randomNumber(), randomNumber(),
};
Object[] 干预次数数组 = new Object[]{
randomNumber(), randomNumber(), randomNumber(),
randomNumber(), randomNumber(), randomNumber(),
randomNumber(), randomNumber(), randomNumber(),
randomNumber(), randomNumber(), randomNumber(),
};
String 总时长JS数组 = javaScriptArrayStringWithJavaArray(总时长数组);
String 有效时长JS数组 = javaScriptArrayStringWithJavaArray(有效时长数组);
String 看近时长JS数组 = javaScriptArrayStringWithJavaArray(看近时长数组);
String 看中时长JS数组 = javaScriptArrayStringWithJavaArray(看中时长数组);
String 看远时长JS数组 = javaScriptArrayStringWithJavaArray(看远时长数组);
String 切换次数JS数组 = javaScriptArrayStringWithJavaArray(切换次数数组);
String 停止次数JS数组 = javaScriptArrayStringWithJavaArray(停止次数数组);
String 干预次数JS数组 = javaScriptArrayStringWithJavaArray(干预次数数组);
String jsFormatterStr = String.format("function () {\n" +
" let 总时长数组 = %s;\n" +
" let 有效时长数组 = %s;\n" +
" let 看近时长数组 = %s;\n" +
" let 看中时长数组 = %s;\n" +
" let 看远时长数组 = %s;\n" +
" let 切换次数数组 = %s;\n" +
" let 停止次数数组 = %s;\n" +
" let 干预次数数组 = %s;\n" +
" let 时间单位后缀 = \"min<br/>\";\n" +
" let 频率单位后缀 = \"次<br/>\";\n" +
" \n" +
" let 单个总时长字符串 = \"总时长:    \" + 总时长数组[this.point.index] + 时间单位后缀;\n" +
" let 单个有效时长字符串 = \"有效时长:  \" + 有效时长数组[this.point.index] + 时间单位后缀;\n" +
" let 单个看近时长字符串 = \"看近时长:  \" + 看近时长数组[this.point.index] + 时间单位后缀;\n" +
" let 单个看中时长字符串 = \"看中时长:  \" + 看中时长数组[this.point.index] + 时间单位后缀;\n" +
" let 单个看远时长字符串 = \"看远时长:  \" + 看远时长数组[this.point.index] + 时间单位后缀;\n" +
" let 单个切换次数字符串 = \"切换次数:  \" + 切换次数数组[this.point.index] + 频率单位后缀;\n" +
" let 单个停止次数字符串 = \"停止次数:  \" + 停止次数数组[this.point.index] + 频率单位后缀;\n" +
" let 单个干预次数字符串 = \"干预次数:  \" + 干预次数数组[this.point.index] + 频率单位后缀;\n" +
" \n" +
" let wholeContentString = 单个总时长字符串 + 单个有效时长字符串 + 单个看近时长字符串 + 单个看中时长字符串 + 单个看远时长字符串 + 单个切换次数字符串 + 单个停止次数字符串 + 单个干预次数字符串;\n" +
" \n" +
" return wholeContentString;\n" +
" }",总时长JS数组,有效时长JS数组,看近时长JS数组,看中时长JS数组,看远时长JS数组,切换次数JS数组,停止次数JS数组,干预次数JS数组);
AAOptions aaOptions = aaChartModel.aa_toAAOptions();
aaOptions.tooltip
//‼️以 this.point.index 这种方式获取选中的点的索引必须设置 tooltip 的 shared 为 false
//‼️共享时是 this.points (由多个 point 组成的 points 数组)
//‼️非共享时是 this.point 单个 point 对象
.shared(false)
.useHTML(true)
.formatter(jsFormatterStr)
.backgroundColor("#000000")//黑色背景色
.borderColor("#FFD700")//边缘颜色纯金色
.style(new AAStyle()
.color("#FFD700")//文字颜色纯金色
.fontSize(12)
);
return aaOptions;
}
private static int randomNumber() {
int max = 38, min = 1;
return (int) (Math.random() * (max - min) + min);
}
private static String javaScriptArrayStringWithJavaArray(Object[] javaArray) {
StringBuilder originalJsArrStr = new StringBuilder();
for (Object element : javaArray) {
originalJsArrStr.append("'").append(element.toString()).append("',");
}
return "[" + originalJsArrStr + "]";
}
// Refer to GitHub issue: https://github.com/AAChartModel/AAChartKit/issues/938
// Refer to online chart sample: https://www.highcharts.com/demo/column-comparison
public static AAOptions customXAxisLabelsBeImages() {
String[] nameArr = {
"South Korea",
"Japan",
"Australia",
"Germany",
"Russia",
"China",
"Great Britain",
"United States"
};
String[] colorArr = {
AARgba(201, 36, 39, 1.f),
AARgba(201, 36, 39, 1.f),
AARgba(0, 82, 180, 1.f),
AARgba(0, 0, 0, 1.f),
AARgba(240, 240, 240, 1.f),
AARgba(255, 217, 68, 1.f),
AARgba(0, 82, 180, 1.f),
AARgba(215, 0, 38, 1.f)
};
String[] imageLinkFlagArr = {
"197582",
"197604",
"197507",
"197571",
"197408",
"197375",
"197374",
"197484"
};
AAChartModel aaChartModel = new AAChartModel()
.chartType(AAChartType.Column)
.title("Custom X Axis Labels Be Images")
.subtitle("use HTML")
.categories(nameArr)
.colorsTheme(colorArr)
.borderRadius(5)
.series(new AASeriesElement[]{
new AASeriesElement()
.name("AD 2020")
.data(new Object[]{9.0, 9.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5})
.colorByPoint(true)
.borderRadiusTopLeft("50%")
.borderRadiusTopRight("50%")
});
String imageLinkFlagJSArrStr = javaScriptArrayStringWithJavaArray(imageLinkFlagArr);
String xLabelsFormatter = String.format("function () {\n" +
" let imageFlag = %s[this.pos];\n" +
" let imageLink = \"\";\n" +
" return imageLink;\n" +
" }", imageLinkFlagJSArrStr);
// https://api.highcharts.com.cn/highcharts#xAxis.labels.formatter
AAOptions aaOptions = aaChartModel.aa_toAAOptions();
aaOptions.xAxis.labels
.useHTML(true)
.formatter(xLabelsFormatter);
aaOptions.plotOptions.column.groupPadding(0.005f);
// /Custom tooltip style/
// String tooltipFormatter ={String stringWithFormat:(AAJSFunc(function () {
// let imageFlag = %[this.point.index];
// let imageLink = "
// ";
// return imageLink
// + " 🌕 🌖 🌗 🌘 🌑 🌒 🌓 🌔
// "
// + " Support JavaScript Function Just Right Now !!!
// "
// + " The Gold Price For 2020 "
// + this.x
// + " Is "
// + this.y
// + " Dollars ";
// })),imageLinkFlagJSArrStr];
String tooltipFormatter = String.format("function () {\n" +
" let imageFlag = %s[this.point.index];\n" +
" let imageLink = \"<span><img src=\\\"https://image.flaticon.com/icons/svg/197/\" + imageFlag + \".svg\\\" style=\\\"width: 30px; height: 30px;\\\"/><br></span>\";\n" +
" return imageLink\n" +
" + \" \uD83C\uDF15 \uD83C\uDF16 \uD83C\uDF17 \uD83C\uDF18 \uD83C\uDF11 \uD83C\uDF12 \uD83C\uDF13 \uD83C\uDF14 <br/> \"\n" +
" + \" Support JavaScript Function Just Right Now !!! <br/> \"\n" +
" + \" The Gold Price For <b>2020 \"\n" +
" + this.x\n" +
" + \" </b> Is <b> \"\n" +
" + this.y\n" +
" + \" </b> Dollars \";\n" +
" }", imageLinkFlagJSArrStr);
aaOptions.tooltip
.shared(false)
.useHTML(true)
.formatter(tooltipFormatter);
return aaOptions;
}
//https://github.com/AAChartModel/AAChartKit/issues/966
public static AAOptions customTooltipPostionerFunction() {
String[] categoriesArr = {
"孤岛危机",
"使命召唤",
"荣誉勋章",
"狙击精英",
"神秘海域",
"最后生还者",
"巫师3狂猎",
"对马之魂",
"蝙蝠侠阿甘骑士",
"地狱边境",
"闪客",
"忍者之印"
};
AAChartModel aaChartModel = new AAChartModel()
.chartType(AAChartType.Column)
.categories(categoriesArr)
.series(new AASeriesElement[]{
new AASeriesElement()
.name("单机大作")
.color(AAColor.Red)
.data(new Object[]{7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6})
});
AAOptions aaOptions = aaChartModel.aa_toAAOptions();
aaOptions.tooltip
.positioner("function (labelWidth, labelHeight, point) {\n" +
" let position = {};\n" +
" position[\"x\"] = point.plotX;\n" +
" position[\"y\"] = 20;\n" +
" return position;\n" +
" }");
return aaOptions;
}
public static AAOptions fixedTooltipPositionByCustomPositionerFunction() {
AAOptions aaOptions = customTooltipPostionerFunction();
aaOptions.tooltip
.positioner("function () {\n" +
" let position = {};\n" +
" position[\"x\"] = 50;\n" +
" position[\"y\"] = 50;\n" +
" return position;\n" +
" }");
return aaOptions;
}
//https://github.com/AAChartModel/AAChartKit/issues/1033
public static AAOptions customPlotAreaOutsideComlicatedTooltipStyle() {
String[] categoriesArr = {
"11 月 01 日",
"11 月 02 日",
"11 月 03 日",
"11 月 04 日",
"11 月 05 日",
"11 月 06 日",
"11 月 07 日",
"11 月 08 日",
"11 月 09 日",
"11 月 10 日",
"11 月 11 日",
"11 月 12 日",
"11 月 13 日",
"11 月 14 日",
"11 月 15 日",
"11 月 16 日",
"11 月 17 日",
"11 月 18 日",
"11 月 19 日",
"11 月 20 日",
"11 月 21 日",
"11 月 22 日",
"11 月 23 日",
"11 月 24 日",
"11 月 25 日",
"11 月 26 日",
"11 月 27 日",
"11 月 28 日",
"11 月 29 日",
"11 月 30 日",
"12 月 01 日",
"12 月 02 日",
"12 月 03 日",
"12 月 04 日",
"12 月 05 日",
"12 月 06 日",
"12 月 07 日",
"12 月 08 日",
"12 月 09 日",
"12 月 10 日",
"12 月 11 日",
"12 月 12 日",
"12 月 13 日",
"12 月 14 日",
"12 月 15 日",
"12 月 16 日",
"12 月 17 日",
"12 月 18 日",
"12 月 19 日",
"12 月 20 日",
"12 月 21 日",
"12 月 22 日",
"12 月 23 日",
"12 月 24 日",
"12 月 25 日",
"12 月 26 日",
"12 月 27 日",
"12 月 28 日",
"12 月 29 日",
"12 月 30 日",
"12 月 31 日",
};
AAChartModel aaChartModel = new AAChartModel()
.chartType(AAChartType.Column)
.categories(categoriesArr)
.series(new AASeriesElement[]{
new AASeriesElement()
.name("个人徒步数据统计")
.color(AARgba(235, 88, 40, 1.0f))
.borderRadiusTopLeft("50%")
.borderRadiusTopRight("50%")
.data(new Object[]{
1300.988, 900.699,1000.089, 1100.965, 1000.534, 1400.523,
1800.254, 1900.377, 2100.523, 2500.256, 2600.555, 2800.366,
1300.988, 900.699,1000.089, 1100.965, 1000.534, 1400.523,
1800.254, 1900.377, 2100.523, 2500.256, 2600.555, 2800.366,
1300.988, 900.699,1000.089, 1100.965, 1000.534, 1400.523,
1800.254, 1900.377, 2100.523, 2500.256, 2600.555, 2800.366,
1300.988, 900.699,1000.089, 1100.965, 1000.534, 1400.523,
1800.254, 1900.377, 2100.523, 2500.256, 2600.555, 2800.366,
1300.988, 900.699,1000.089, 1100.965, 1000.534, 1400.523,
1800.254, 1900.377, 2100.523, 2500.256, 2600.555, 2800.366,
})
});
AAOptions aaOptions = aaChartModel.aa_toAAOptions();
aaOptions.xAxis
.crosshair(new AACrosshair()
.color(AARgba(209, 209, 209, 1.0f))
.dashStyle(AAChartLineDashStyleType.LongDash)
.width(3));
// aaOptions.yAxis
// .top("30%")//https://api.highcharts.com/highcharts/yAxis.top
// .height("70%")//https://api.highcharts.com/highcharts/yAxis.height
DisplayMetrics dm = new DisplayMetrics();
int screenWidth = dm.widthPixels;
String positionerStr = String.format("function (labelWidth, labelHeight, point) {\n" +
" let xPosition = point.plotX;\n" +
" let maxXPosition = %s - 268;\n" +
" if (xPosition >= maxXPosition) {\n" +
" xPosition = maxXPosition\n" +
" }\n" +
" let position = {};\n" +
" position[\"x\"] = xPosition;\n" +
" position[\"y\"] = 50;\n" +
" return position;\n" +
" }", screenWidth);
aaOptions.tooltip
.useHTML(true)
.headerFormat("总计 ")
.pointFormat("{point.y} 步")
.footerFormat("2020 年 {point.x} ")
.valueDecimals(2)//设置取值精确到小数点后几位
.backgroundColor(AARgba(242, 242, 242, 1.0f))
.borderWidth(0)
.shape("square")
.style(AAStyle.style(AARgba(132, 132, 132, 1.0f), 28))
.positioner(positionerStr);
return aaOptions;
}
//https://github.com/AAChartModel/AAChartKit/issues/967
public static AAOptions disableColumnChartUnselectEventEffectBySeriesPointEventClickFunction() {
AAChartModel aaChartModel = new AAChartModel()
.chartType(AAChartType.Bar)
.title("Custom Bar Chart select color")
.yAxisReversed(true)
.xAxisReversed(true)
.series(new AASeriesElement[]{
new AASeriesElement()
.name("ElementOne")
.data(new Object[]{211,183,157,133,111,91,73,57,43,31,21,13,7,3})
.allowPointSelect(true)
.states(new AAStates()
.hover(new AAHover()
.color(AAColor.Yellow))
.select(new AASelect()
.color(AAColor.Red))
)
});
AAOptions aaOptions = aaChartModel.aa_toAAOptions();
AAPoint aaPoint = new AAPoint()
.events(new AAPointEvents()
.click("function () {\n" +
" if (this.selected == true) {\n" +
" this.selected = false;\n" +
" }\n" +
" return;\n" +
" }"));
aaOptions.plotOptions.series
.point(aaPoint);
return aaOptions;
}
//https://github.com/AAChartModel/AAChartKit/issues/970
//通过自定义 div 的 css 样式来自定义复杂效果的 tooltip 浮动提示框
public static AAOptions customAreasplineChartTooltipStyleByDivWithCSS() {
AAChartModel aaChartModel = new AAChartModel()
.chartType(AAChartType.Areaspline)//图表类型
.colorsTheme(new String[]{"#FFD700"/*(纯金色)*/,"#ffc069",})//设置主体颜色数组
.markerSymbol(AAChartSymbolType.Circle)
.markerSymbolStyle(AAChartSymbolStyleType.BorderBlank)//折线连接点样式为外边缘空白
.xAxisTickInterval(3)//x轴刻度点间隔数(设置每隔几个点显示一个 X轴的内容)
// .yAxisGridLineStyle([AALineStyle styleWithWidth:0})//y轴横向分割线宽度(为0即是隐藏分割线)
.stacking(AAChartStackingType.Normal)
.categories(new String[]{
"10-01", "10-02", "10-03", "10-04", "10-05", "10-06", "10-07", "10-08", "10-09", "10-10", "10-11",
"10-12", "10-13", "10-14", "10-15", "10-16", "10-17", "10-18", "10-19", "10-20", "10-21", "10-22",
"10-23", "10-24", "10-25", "10-26", "10-27", "10-28", "10-29", "10-30", "10-31", "11-01", "11-02",
"11-03", "11-04", "11-05", "11-06", "11-07", "11-08", "11-09", "11-10", "11-11", "11-12", "11-13",
"11-14", "11-15", "11-16", "11-17", "11-18", "11-19", "11-20", "11-21", "11-22", "11-23", "11-24",
"11-25", "11-26", "11-27", "11-28", "11-29", "11-30", "12-01", "12-02", "12-03", "12-04", "12-05",
"12-06", "12-07", "12-08", "12-09", "12-10", "12-11", "12-12", "12-13", "12-14", "12-15", "12-16",
"12-17", "12-18", "12-19", "12-20", "12-21", "12-22", "12-23", "12-24", "12-25", "12-26", "12-27",
"12-28", "12-29", "12-30"
})
.series(new AASeriesElement[]{
new AASeriesElement()
.lineWidth(1.5)
.fillOpacity(0.4)
.name("黄金上涨")
.data(new Object[]{
1.51, 6.70, 0.94, 1.44, 1.60, 1.63, 1.56, 1.91, 2.45, 3.87, 3.24, 4.90, 4.61, 4.10,
4.17, 3.85, 4.17, 3.46, 3.46, 3.55, 3.50, 4.13, 2.58, 2.28, 1.51, 12.7, 0.94, 1.44,
18.6, 1.63, 1.56, 1.91, 2.45, 3.87, 3.24, 4.90, 4.61, 4.10, 4.17, 3.85, 4.17, 3.46,
3.46, 3.55, 3.50, 4.13, 2.58, 2.28, 1.33, 4.68, 1.31, 1.10, 13.9, 1.10, 1.16, 1.67,
2.64, 2.86, 3.00, 3.21, 4.14, 4.07, 3.68, 3.11, 3.41, 3.25, 3.32, 3.07, 3.92, 3.05,
2.18, 3.24, 3.23, 3.15, 2.90, 1.81, 2.11, 2.43, 5.59, 3.09, 4.09, 6.14, 5.33, 6.05,
5.71, 6.22, 6.56, 4.75, 5.27, 6.02, 5.48
}),
new AASeriesElement()
.lineWidth(1.5)
.fillOpacity(0.4)
.name("房价下跌")
.data(new Object[]{
1.51, 6.70, 0.94, 1.44, 1.60, 1.63, 1.56, 1.91, 2.45, 3.87, 3.24, 4.90, 4.61, 4.10,
4.17, 3.85, 4.17, 3.46, 3.46, 3.55, 3.50, 4.13, 2.58, 2.28, 1.51, 12.7, 0.94, 1.44,
18.6, 1.63, 1.56, 1.91, 2.45, 3.87, 3.24, 4.90, 4.61, 4.10, 4.17, 3.85, 4.17, 3.46,
3.46, 3.55, 3.50, 4.13, 2.58, 2.28, 1.33, 4.68, 1.31, 1.10, 13.9, 1.10, 1.16, 1.67,
2.64, 2.86, 3.00, 3.21, 4.14, 4.07, 3.68, 3.11, 3.41, 3.25, 3.32, 3.07, 3.92, 3.05,
2.18, 3.24, 3.23, 3.15, 2.90, 1.81, 2.11, 2.43, 5.59, 3.09, 4.09, 6.14, 5.33, 6.05,
5.71, 6.22, 6.56, 4.75, 5.27, 6.02, 5.48
}),
});
//https://zhidao.baidu.com/question/301691908.html
//https://jshare.com.cn/highcharts/hhhhGc
AAOptions aaOptions = aaChartModel.aa_toAAOptions();
aaOptions.tooltip
.shared(true)
.useHTML(true)
.padding(0)
.borderWidth(0)
.formatter("function () {\n" +
" var box1Text = \"  2021-\" + this.x + this.points[0].series.name + this.y;\n" +
" var box2Text = \"  2021-\" + this.x + this.points[1].series.name + this.y;\n" +
" \n" +
" return '<style>\\\n" +
" div{margin:0;padding:0}\\\n" +
" #container{width:300px;height:40px;border:80px;}\\\n" +
" #container .box1{width:150px;height:40px;float:left;background:red;line-height:40px;color:#fff}\\\n" +
" #container .box2{width:150px;height:40px;float:right;background:green;line-height:40px;color:#fff}\\\n" +
" </style>\\\n" +
" <div id=\\\"container\\\">'\n" +
" +\n" +
" '<div class=\\\"box1\\\">' + box1Text + '</div>'\n" +
" +\n" +
" '<div class=\\\"box2\\\">' + box2Text + '</div>'\n" +
" +\n" +
" '</div>';\n" +
" }")
;
//禁用图例点击事件
aaOptions.plotOptions.series.events = new AASeriesEvents()
.legendItemClick("function() {\n" +
" return false;\n" +
" }");
return aaOptions;
}
//https://github.com/AAChartModel/AAChartKit/issues/1042
public static AAOptions makePieChartShow0Data() {
Map<String, Object> data1 = new HashMap<>();
data1.put("y", 1);
data1.put("isZero", true);
data1.put("name", "One");
Map<String, Object> data2 = new HashMap<>();
data2.put("y", 1);
data2.put("isZero", true);
data2.put("name", "One");
Map<String, Object> data3 = new HashMap<>();
data3.put("y", 1);
data3.put("isZero", true);
data3.put("name", "One");
return new AAOptions()
// .title((id)NSNull.null)
.chart(new AAChart()
.type(AAChartType.Pie))
.series(new AASeriesElement[]{
new AASeriesElement()
.name("ZeroDataPie")
.data(new Object[]{data1, data2, data3
})
.tooltip(new AATooltip()
.shared(false)
.pointFormatter("function() {\n" +
" return \"<span style=\\'color:\" + this.color + \"\\'> ◉ </span>\"\n" +
" + this.series.name\n" +
" + \": <b>\"\n" +
" + (this.options.isZero ? 0 : this.y)\n" +
" + \"</b><br/>\";\n" +
" }"))
});
};
//https://github.com/AAChartModel/AAChartKit-Swift/issues/365
//https://api.highcharts.com/highcharts/tooltip.formatter
//Callback function to format the text of the tooltip from scratch. In case of single or shared tooltips,
//a string should be returned. In case of split tooltips, it should return an array where the first item
//is the header, and subsequent items are mapped to the points. Return `false` to disable tooltip for a
//specific point on series.
public static AAOptions customColumnChartBorderStyleAndStatesHoverColor() {
AAChartModel aaChartModel = new AAChartModel()
.chartType(AAChartType.Column)
.stacking(AAChartStackingType.Normal)
.colorsTheme(new String[]{AAColor.DarkGray, AAColor.LightGray})//Colors theme
.categories(new String[]{
"January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December"
})
.series(new AASeriesElement[]{
new AASeriesElement()
.name("Berlin Hot")
.borderColor(AAColor.White)
.borderWidth(3)
.borderRadius(10)
.states(new AAStates()
.hover(new AAHover()
.color(AAColor.Red)))
.data(new Object[]{7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6}),
new AASeriesElement()
.name("Beijing Hot")
.borderColor(AAColor.White)
.borderWidth(3)
.borderRadius(10)
.states(new AAStates()
.hover(new AAHover()
.color("dodgerblue")))// Dodgerblue/道奇藍/#1e90ff十六进制颜色代码
.data(new Object[]{0.2, 0.8, 5.7, 11.3, 17.0, 22.0, 24.8, 24.1, 20.1, 14.1, 8.6, 2.5}),
});
AAOptions aaOptions = aaChartModel.aa_toAAOptions();
aaOptions.tooltip
.formatter("function () {\n" +
" return false;\n" +
" }");
return aaOptions;
}
}
| AAChartModel/AAChartCore | app/src/main/java/com/example/anan/AAChartCore/ChartsDemo/chartcomposer/JSFunctionForAATooltipComposer.java |
64,749 | package com.zy.blog.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.zy.blog.base.EntityBase;
import lombok.Data;
/**
* @description:
* @author: 小章鱼
* @date: 2021/9/28 16:13
**/
@TableName("t_comment_report")
@Data
public class CommentReport extends EntityBase<CommentReport> {
private static final long serialVersionUID = 1L;
/**
* 举报人UID
*/
private String userUid;
/**
* 被举报的评论Uid
*/
private String reportCommentUid;
/**
* 被举报的用户uid
*/
private String reportUserUid;
/**
* 举报原因
*/
private String content;
/**
* 进展状态: 0 未查看 1: 已查看 2:已处理
*/
private Integer progress;
}
| Zhrzy/SpringCloudBlog | blog_entity/src/main/java/com/zy/blog/entity/CommentReport.java |
64,750 | package com.moxi.hyblog.commons.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.moxi.hyblog.base.entity.SuperEntity;
import lombok.Data;
/**
* <p>
* 评论举报表
* </p>
*
* @author 陌溪
* @since 2020年1月12日15:42:19
*/
@Data
@TableName("t_comment_report")
public class CommentReport extends SuperEntity<CommentReport> {
private static final long serialVersionUID = 1L;
/**
* 举报人UID
*/
private String userUid;
/**
* 被举报的评论Uid
*/
private String reportCommentUid;
/**
* 被举报的用户uid
*/
private String reportUserUid;
/**
* 举报原因
*/
private String content;
/**
* 进展状态: 0 未查看 1: 已查看 2:已处理
*/
private Integer progress;
}
| javacxyxbc/yunheng_blog | hy_commons/src/main/java/com/moxi/hyblog/commons/entity/CommentReport.java |
64,751 | package com.atits.entity;
import com.fasterxml.jackson.annotation.JsonIgnore;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
@Entity(name = "t_task_progress")
public class TaskProgress {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private int id;
@ManyToOne
@JoinColumn(name = "sub_task_id", referencedColumnName = "id", nullable = true)
private SubTask subTask;// 任务
// @ManyToOne(targetEntity = Person.class)
// @JoinColumn(name = "editor",referencedColumnName = "id",nullable = true)
// private Person editor;
@Column(name = "title")
private String title;//进展标题
@Column(name = "content", length = 100000)
private String content;//进展主要内容
@Column(name = "time")
private String time;
@Column(name = "date")
private String date;
@Column(name = "file_id")
private String fileId;//相关文件
@Column(name = "state")
private int state;
// public Person getEditor() {
// return editor;
// }
//
// public void setEditor(Person editor) {
// this.editor = editor;
// }
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public SubTask getSubTask() {
return subTask;
}
public void setSubTask(SubTask subTask) {
this.subTask = subTask;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
public String getFileId() {
return fileId;
}
public void setFileId(String fileId) {
this.fileId = fileId;
}
public int getState() {
return state;
}
public void setState(int state) {
this.state = state;
}
@Override
public String toString() {
return "TaskProgress{" +
"id=" + id +
", subTask=" + subTask.getId() + '\'' +
", title='" + title + '\'' +
", content='" + content + '\'' +
", time='" + time + '\'' +
", date='" + date + '\'' +
", fileId='" + fileId + '\'' +
", state=" + state +
'}';
}
}
| TeamAndCreator/atits | src/main/java/com/atits/entity/TaskProgress.java |
64,753 | package cn.bc.remoting.demo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.servlet.*;
import javax.servlet.annotation.WebInitParam;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Date;
/**
* Created by dragon on 2015/1/22.
*
* @ref http://www.ibm.com/developerworks/cn/java/j-lo-servlet30/
*/
@WebServlet(value = {"/asyncdemo"}
// 不指定默认为类的全名
//, name = "cn.bc.remoting.demo.AsyncDemoServlet"
// 异步支持
, asyncSupported = true
// 初始化参数
, initParams = {@WebInitParam(name = "author", value = "dragon")}
)
public class AsyncDemoServlet extends HttpServlet {
private static Logger logger = LoggerFactory.getLogger(AsyncDemoServlet.class);
@Override
public void init(ServletConfig config) throws ServletException {
logger.debug("author={}", config.getInitParameter("author"));
super.init(config);
}
@Override
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException {
logger.debug("doGet start {}", new Date());
resp.setContentType("text/html;charset=UTF-8");
PrintWriter out = resp.getWriter();
out.println("进入Servlet的时间:" + new Date() + ".");
out.flush();
// 在子线程中执行业务调用,并由其负责输出响应,主线程退出
AsyncContext ctx = req.startAsync();
ctx.addListener(new DemoAsyncListener());// 监听异步处理的进展
new Thread(new DemoRunable(ctx)).start();
out.println("结束Servlet的时间:" + new Date() + ".");
out.flush();
logger.debug("doGet end {}", new Date());
req.getSession().invalidate();
logger.debug("session invalidate");
}
public class DemoRunable implements Runnable {
private AsyncContext ctx = null;
public DemoRunable(AsyncContext ctx) {
this.ctx = ctx;
}
public void run() {
logger.debug("DemoRunable start {}", new Date());
try {
//等待十秒钟,以模拟业务方法的执行
Thread.sleep(1000);
PrintWriter out = ctx.getResponse().getWriter();
out.println("业务处理完毕的时间:" + new Date() + ".");
out.flush();
ctx.complete();
} catch (Exception e) {
e.printStackTrace();
}
logger.debug("DemoRunable end {}", new Date());
}
}
public class DemoAsyncListener implements AsyncListener {
@Override
public void onComplete(AsyncEvent event) throws IOException {
logger.debug("DemoAsyncListener onComplete {}", new Date());
}
@Override
public void onTimeout(AsyncEvent event) throws IOException {
}
@Override
public void onError(AsyncEvent event) throws IOException {
}
@Override
public void onStartAsync(AsyncEvent event) throws IOException {
// ? 测试结果:没有执行
logger.debug("DemoAsyncListener onStartAsync {}", new Date());
}
}
} | bcsoft/bc-framework | bc-remoting-server/src/main/java/cn/bc/remoting/demo/AsyncDemoServlet.java |
64,754 | /**
* DDD: application 应用层
* 相对于领域层,应用层是很薄的一层,应用层定义了软件要完成的任务,要尽量简单.
* 它不包含任务业务规则或知识, 为下一层的领域对象协助任务、委托工作。
* 它没有反映业务情况的状态,但它可以具有反映用户或程序的某个任务的进展状态。
* 对外 为展现层提供各种应用功能(service)。
* 对内 调用领域层(领域对象或领域服务)完成各种业务逻辑任务
* 这一层也很适合写一些任务处理,日志监控
**/
package com.github.application;
| EalenXie/spring-microservice-ddd | src/main/java/com/github/application/package-info.java |
64,788 | package org.easypr.core;
import static org.bytedeco.javacpp.opencv_core.*;
import static org.bytedeco.javacpp.opencv_highgui.cvShowImage;
import static org.bytedeco.javacpp.opencv_highgui.cvWaitKey;
import static org.bytedeco.javacpp.opencv_imgproc.CV_BGR2HSV;
import static org.bytedeco.javacpp.opencv_imgproc.cvtColor;
import static org.bytedeco.javacpp.opencv_imgproc.equalizeHist;
import static org.bytedeco.javacpp.opencv_imgproc.resize;
import org.bytedeco.javacpp.BytePointer;
import org.bytedeco.javacpp.opencv_core.IplImage;
import org.bytedeco.javacpp.opencv_core.Mat;
import org.bytedeco.javacpp.opencv_core.MatVector;
import org.bytedeco.javacpp.opencv_core.Size;
import org.bytedeco.javacpp.indexer.FloatIndexer;
/**
* @author lin.yao
*
*/
public class CoreFunc {
public enum Color {
UNKNOWN, BLUE, YELLOW
};
public enum Direction {
UNKNOWN, VERTICAL, HORIZONTAL
}
/**
* 根据一幅图像与颜色模板获取对应的二值图
*
* @param src
* 输入RGB图像
* @param r
* 颜色模板(蓝色、黄色)
* @param adaptive_minsv
* S和V的最小值由adaptive_minsv这个bool值判断
* <ul>
* <li>如果为true,则最小值取决于H值,按比例衰减
* <li>如果为false,则不再自适应,使用固定的最小值minabs_sv
* </ul>
* @return 输出灰度图(只有0和255两个值,255代表匹配,0代表不匹配)
*/
public static Mat colorMatch(final Mat src, final Color r, final boolean adaptive_minsv) {
final float max_sv = 255;
final float minref_sv = 64;
final float minabs_sv = 95;
// blue的H范围
final int min_blue = 100;
final int max_blue = 140;
// yellow的H范围
final int min_yellow = 15;
final int max_yellow = 40;
// 转到HSV空间进行处理,颜色搜索主要使用的是H分量进行蓝色与黄色的匹配工作
Mat src_hsv = new Mat();
cvtColor(src, src_hsv, CV_BGR2HSV);
MatVector hsvSplit = new MatVector();
split(src_hsv, hsvSplit);
equalizeHist(hsvSplit.get(2), hsvSplit.get(2));
merge(hsvSplit, src_hsv);
// 匹配模板基色,切换以查找想要的基色
int min_h = 0;
int max_h = 0;
switch (r) {
case BLUE:
min_h = min_blue;
max_h = max_blue;
break;
case YELLOW:
min_h = min_yellow;
max_h = max_yellow;
break;
default:
break;
}
float diff_h = (float) ((max_h - min_h) / 2);
int avg_h = (int) (min_h + diff_h);
int channels = src_hsv.channels();
int nRows = src_hsv.rows();
// 图像数据列需要考虑通道数的影响;
int nCols = src_hsv.cols() * channels;
// 连续存储的数据,按一行处理
if (src_hsv.isContinuous()) {
nCols *= nRows;
nRows = 1;
}
for (int i = 0; i < nRows; ++i) {
BytePointer p = src_hsv.ptr(i);
for (int j = 0; j < nCols; j += 3) {
int H = p.get(j) & 0xFF;
int S = p.get(j + 1) & 0xFF;
int V = p.get(j + 2) & 0xFF;
boolean colorMatched = false;
if (H > min_h && H < max_h) {
int Hdiff = 0;
if (H > avg_h)
Hdiff = H - avg_h;
else
Hdiff = avg_h - H;
float Hdiff_p = Hdiff / diff_h;
float min_sv = 0;
if (true == adaptive_minsv)
min_sv = minref_sv - minref_sv / 2 * (1 - Hdiff_p);
else
min_sv = minabs_sv;
if ((S > min_sv && S <= max_sv) && (V > min_sv && V <= max_sv))
colorMatched = true;
}
if (colorMatched == true) {
p.put(j, (byte) 0);
p.put(j + 1, (byte) 0);
p.put(j + 2, (byte) 255);
} else {
p.put(j, (byte) 0);
p.put(j + 1, (byte) 0);
p.put(j + 2, (byte) 0);
}
}
}
// 获取颜色匹配后的二值灰度图
MatVector hsvSplit_done = new MatVector();
split(src_hsv, hsvSplit_done);
Mat src_grey = hsvSplit_done.get(2);
return src_grey;
}
/**
* 判断一个车牌的颜色
*
* @param src
* 车牌mat
* @param r
* 颜色模板
* @param adaptive_minsv
* S和V的最小值由adaptive_minsv这个bool值判断
* <ul>
* <li>如果为true,则最小值取决于H值,按比例衰减
* <li>如果为false,则不再自适应,使用固定的最小值minabs_sv
* </ul>
* @return
*/
public static boolean plateColorJudge(final Mat src, final Color color, final boolean adaptive_minsv) {
// 判断阈值
final float thresh = 0.49f;
Mat gray = colorMatch(src, color, adaptive_minsv);
float percent = (float) countNonZero(gray) / (gray.rows() * gray.cols());
return (percent > thresh) ? true : false;
}
/**
* getPlateType 判断车牌的类型
*
* @param src
* @param adaptive_minsv
* S和V的最小值由adaptive_minsv这个bool值判断
* <ul>
* <li>如果为true,则最小值取决于H值,按比例衰减
* <li>如果为false,则不再自适应,使用固定的最小值minabs_sv
* </ul>
* @return
*/
public static Color getPlateType(final Mat src, final boolean adaptive_minsv) {
if (plateColorJudge(src, Color.BLUE, adaptive_minsv) == true) {
return Color.BLUE;
} else if (plateColorJudge(src, Color.YELLOW, adaptive_minsv) == true) {
return Color.YELLOW;
} else {
return Color.UNKNOWN;
}
}
/**
* 获取垂直或水平方向直方图
*
* @param img
* @param direction
* @return
*/
public static float[] projectedHistogram(final Mat img, Direction direction) {
int sz = 0;
switch (direction) {
case HORIZONTAL:
sz = img.rows();
break;
case VERTICAL:
sz = img.cols();
break;
default:
break;
}
// 统计这一行或一列中,非零元素的个数,并保存到nonZeroMat中
float[] nonZeroMat = new float[sz];
extractChannel(img, img, 0);
for (int j = 0; j < sz; j++) {
Mat data = (direction == Direction.HORIZONTAL) ? img.row(j) : img.col(j);
int count = countNonZero(data);
nonZeroMat[j] = count;
}
// Normalize histogram
float max = 0;
for (int j = 0; j < nonZeroMat.length; ++j) {
max = Math.max(max, nonZeroMat[j]);
}
if (max > 0) {
for (int j = 0; j < nonZeroMat.length; ++j) {
nonZeroMat[j] /= max;
}
}
return nonZeroMat;
}
/**
* Assign values to feature
* <p>
* 样本特征为水平、垂直直方图和低分辨率图像所组成的矢量
*
* @param in
* @param sizeData
* 低分辨率图像size = sizeData*sizeData, 可以为0
* @return
*/
public static Mat features(final Mat in, final int sizeData) {
float[] vhist = projectedHistogram(in, Direction.VERTICAL);
float[] hhist = projectedHistogram(in, Direction.HORIZONTAL);
Mat lowData = new Mat();
if (sizeData > 0) {
resize(in, lowData, new Size(sizeData, sizeData));
}
int numCols = vhist.length + hhist.length + lowData.cols() * lowData.rows();
Mat out = Mat.zeros(1, numCols, CV_32F).asMat();
FloatIndexer idx = out.createIndexer();
int j = 0;
for (int i = 0; i < vhist.length; ++i, ++j) {
idx.put(0, j, vhist[i]);
}
for (int i = 0; i < hhist.length; ++i, ++j) {
idx.put(0, j, hhist[i]);
}
for (int x = 0; x < lowData.cols(); x++) {
for (int y = 0; y < lowData.rows(); y++, ++j) {
float val = lowData.ptr(x, y).get() & 0xFF;
idx.put(0, j, val);
}
}
return out;
}
/**
* Show image
*
* @param title
* @param src
*/
public static void showImage(final String title, final Mat src) {
try {
IplImage image = src.asIplImage();
if (image != null) {
cvShowImage(title, image);
cvWaitKey(0);
}
} catch (Exception ex) {
}
}
}
| fan-wenjie/EasyPR-Java | src/org/easypr/core/CoreFunc.java |
64,790 | package org.bukkit.entity;
import org.jetbrains.annotations.NotNull;
/**
* 代表鹦鹉.
*/
public interface Parrot extends Tameable, Sittable {
/**
* 获得鹦鹉变体.
* <p>
* 原文:
* Get the variant of this parrot.
*
* @return 鹦鹉变体
*/
@NotNull
public Variant getVariant();
/**
* 设置鹦鹉变体.
* <p>
* 原文:
* Set the variant of this parrot.
*
* @param variant 鹦鹉变体
*/
public void setVariant(@NotNull Variant variant);
/**
* Gets whether a parrot is dancing
*
* @return Whether the parrot is dancing
*/
public boolean isDancing();
/**
* 代表鹦鹉变体(颜色).
* <p>
* 原文:
* Represents the variant of a parrot - ie its color.
*/
public enum Variant {
/**
* 传统鹦鹉 - 红翅膀.
* <p>
* 原文:
* Classic parrot - red with colored wingtips.
*/
RED,
/**
* 蓝色.
* <p>
* 原文:
* Royal blue colored parrot.
*/
BLUE,
/**
* 绿色.
* <p>
* 原文:
* Green colored parrot.
*/
GREEN,
/**
* 蓝绿色鹦鹉.
* <p>
* 原文:
* Cyan colored parrot.
*/
CYAN,
/**
* 灰色鹦鹉.
* <p>
* 原文:
* Gray colored parrot.
*/
GRAY;
}
}
| BukkitAPI-Translation-Group/Chinese_BukkitAPI | BukkitApi/org/bukkit/entity/Parrot.java |
64,794 | /**
* 接雨水
* 给定 n 个非负整数表示每个宽度为 1 的柱子的高度图,计算按此排列的柱子,下雨之后能接多少雨水。
*
* 上面是由数组 [0,1,0,2,1,0,1,3,2,1,2,1] 表示的高度图,在这种情况下,可以接 6 个单位的雨水(蓝色部分表示雨水)
*
* 示例:
*
* 输入: [0,1,0,2,1,0,1,3,2,1,2,1]
* 输出: 6
*
*/
class Solution {
public int trap(int[] height) {
int result = 0;
//find the highest value/position
int maxHigh = 0;
int maxIdx = 0;
for (int i = 0; i < height.length; i++) {
if (height[i] > maxHigh){
maxHigh = height[i];
maxIdx = i;
}
}
//from the left to the highest postion
int prevHigh = 0;
for (int i = 0; i < maxIdx; i++) {
if(height[i] > prevHigh){
prevHigh = height[i];
}
result += (prevHigh - height[i]);
}
//from the right to the highest postion
prevHigh=0;
for (int i = height.length-1; i > maxIdx; i--) {
if(height[i] > prevHigh) {
prevHigh = height[i];
}
result += (prevHigh - height[i]);
}
return result;
}
} | algorithm004-01/algorithm004-01 | Week 01/id_751/LeetCode_42_751.java |
64,795 | class Solution {
public int minCost(int[][] costs) {
if (costs == null || costs.length == 0) {
return 0;
}
int n = costs.length;
//定义dp数组
int[][] f = new int[n + 1][3];
//初始值
f[0][0] = f[0][1] = f[0][2] = 0;
//计算顺序:从第一个到第n个的遍历
for (int i = 1; i <= n; i++) {
//遍历第i个位置(A[i - 1])的可能值
for (int j = 0; j < 3; j++) {
//赋初始值
f[i][j] = Integer.MAX_VALUE;
//遍历第i-1个位置的(A[i - 2])的可能值
for (int k = 0; k < 3; k++) {
if (j != k) { //满足条件才能更新
f[i][j] = Math.min(f[i][j], f[i - 1][k] + costs[i - 1][j]);
}
}
}
}
//在最后一个位置上的所有状态中找最小的一个
return Math.min(f[n][0], Math.min(f[n][1], f[n][2]));
}
}
/* f[i][0], f[i][1], f[i][2] = 油漆前i栋房子并且房子i - 1是红色,蓝色,绿色的最小花费
** 转移方程:f[i][0] = min{f[i-1][1] + cost[i-1][0], f[i-1][2] + cost[i-1][0]}
** */ | Mol1122/leetcode | 256. Paint House.java |
64,797 | package stone_editor;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.TextAttribute;
import org.eclipse.jface.text.presentation.PresentationReconciler;
import org.eclipse.jface.text.rules.DefaultDamagerRepairer;
import org.eclipse.jface.text.rules.IRule;
import org.eclipse.jface.text.rules.NumberRule;
import org.eclipse.jface.text.rules.PatternRule;
import org.eclipse.jface.text.rules.RuleBasedScanner;
import org.eclipse.jface.text.rules.SingleLineRule;
import org.eclipse.jface.text.rules.Token;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
public class 协调器 extends PresentationReconciler {
Token 深红 = 字号(SWT.COLOR_DARK_RED);
Token 深绿 = 字号(SWT.COLOR_DARK_GREEN);
Token 蓝色 = 字号(SWT.COLOR_BLUE);
public 协调器() {
SingleLineRule 单引号 = new SingleLineRule("'", "'", 深红);
SingleLineRule 双引号 = new SingleLineRule("\"", "\"", 深红);
NumberRule 数字 = new NumberRule(蓝色);
PatternRule 模式规则 = new PatternRule("//", null, 深绿, (char) 0, true);
石头语言用词规则 用词规则 = new 石头语言用词规则();
RuleBasedScanner 扫描器 = new RuleBasedScanner();
扫描器.setRules(new IRule[] {单引号, 双引号, 用词规则, 模式规则, 数字});
DefaultDamagerRepairer 修理器 = new DefaultDamagerRepairer(扫描器);
this.setDamager(修理器, IDocument.DEFAULT_CONTENT_TYPE);
this.setRepairer(修理器, IDocument.DEFAULT_CONTENT_TYPE);
}
private Token 字号(int 色号) {
return new Token(new TextAttribute(Display.getCurrent().getSystemColor(色号)));
}
}
| program-in-chinese/stone-editor-eclipse | src/stone_editor/协调器.java |
64,798 | package javaStudy.enumStudy;
public class enumStudy {
public static void main(String args[]){
for(Color c:Color.values()){
System.out.println(""+c.ordinal()+"-"+c.name()+"-"+c.toString());
}
// 枚举类继承接口
IMessage msg = Color.RED;
System.out.println(msg.getMessage());
}
}
interface IMessage{
public String getMessage();
}
enum Color implements IMessage{ //枚举类
RED("红色"), GREEN("绿色"), BLUE("蓝色");//枚举对象第一行
private String title;
private Color(String title){
this.title = title;
}
public String toString(){
return this.title;
}
public String getMessage(){
return this.title;
}
}
| hzc869046779/JAVA-STUDY | src/javaStudy/enumStudy/enumStudy.java |
64,804 | package com.wupgig.record;
import java.text.DecimalFormat;
import com.wupgig.message.RivalRecordMessage;
import com.wupgig.pojo.User;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.image.Image;
import javafx.scene.layout.Background;
import javafx.scene.layout.BackgroundFill;
import javafx.scene.layout.Pane;
import javafx.scene.paint.Color;
import javafx.scene.text.Font;
import javafx.scene.text.FontPosture;
import javafx.scene.text.Text;
import javafx.stage.Stage;
/**
* 对手战绩显示界面
* @author wupgig
* @email [email protected]
* @version
* @date 2021年3月25日下午12:00:09
*
*/
public class RivalRecord extends Stage{
//用来保存对手发送过来的用户信息,即User类
public static RivalRecordMessage recordMessage;
public RivalRecord() {
// 设置窗口大小不可改变
this.setResizable(false);
// 设置图标
this.getIcons().add(new Image("images/icon-1.jpg"));
// 设置窗口标题
this.setTitle("我的战绩");
// 创建主舞台
Pane pane = new Pane();
// 设置舞台背景-蓝色
pane.setBackground(new Background(new BackgroundFill(Color.AZURE,null,null)));
// 创建场景对象 长为400像素,宽为400像素
Scene scene = new Scene(pane, 400, 400);
// 将场景放入舞台
this.setScene(scene);
// 加入文本
this.addText(pane);
// 加入按钮
this.addButton(pane);
}
private void addText(Pane pane) {
User user = recordMessage.getUser();
// 账号
Text accountText = new Text(160, 20, "账号:" + user.getAccount());
accountText.setFill(Color.BLACK);
accountText.setFont(Font.font("宋体",
FontPosture.REGULAR, 15));
// 积分
Text scoreText = new Text(160, 50, "积分:" + user.getScore());
scoreText.setFill(Color.BLACK);
scoreText.setFont(Font.font("宋体",
FontPosture.REGULAR, 15));
// 总局数
Text totalText = new Text(160, 100, "总局数:" + user.getTotalNums());
totalText.setFill(Color.BLACK);
totalText.setFont(Font.font("宋体",
FontPosture.REGULAR, 15));
// 胜局数
Text winText = new Text(160, 150, "胜局数:" + user.getWinNums());
winText.setFill(Color.BLACK);
winText.setFont(Font.font("宋体",
FontPosture.REGULAR, 15));
// 败局数
Text lostText = new Text(160, 200, "败局数:" + user.getLostNums());
lostText.setFill(Color.BLACK);
lostText.setFont(Font.font("宋体",
FontPosture.REGULAR, 15));
// 平局数
Text drawText = new Text(160, 250, "平局数:" + user.getDrawNums());
drawText.setFill(Color.BLACK);
drawText.setFont(Font.font("宋体",
FontPosture.REGULAR, 15));
// 胜率,保留两位小数
DecimalFormat df = new DecimalFormat("0.00");
Text oddsText = new Text(160, 300, "胜率:" +
df.format(user.getWinNums() * 100.0 / (user.getTotalNums() == 0 ? 1 : user.getTotalNums())) + "%");
oddsText.setFill(Color.BLACK);
oddsText.setFont(Font.font("宋体",
FontPosture.REGULAR, 15));
// 将文字加入场景
pane.getChildren().addAll(accountText, scoreText, totalText,
winText, lostText, drawText, oddsText);
}
/**
* 添加按钮
* @Description
* @author wupgig
* @version
* @date 2021年3月25日上午10:47:53
* @param pane
*/
private void addButton(Pane pane) {
// 添加关闭按钮
this.closeButton(pane);
}
/**
* 关闭战绩页面按钮
* @Description
* @author wupgig
* @version
* @date 2021年3月25日上午10:52:10
* @param pane
*/
private void closeButton(Pane pane) {
Button closeButton = new Button("关闭");
closeButton.setPrefSize(40, 40);
closeButton.setLayoutX(180);
closeButton.setLayoutY(350);
pane.getChildren().add(closeButton);
closeButton.setOnAction(e -> {
// 关闭战绩页面
this.close();
});
}
}
| wupgig/Gobang-IDEA | gobang/src/com/wupgig/record/RivalRecord.java |
64,805 | 2.
现有n个房子排成一排,需要刷漆,分别有红绿蓝三种漆色,要求每个房子与相邻的房子不能刷相同的颜色
对于第i个房子,刷三种颜色中的其中一种,如果刷成红色/绿色/蓝色,那么需要刷漆量 r[i]/g[i]/b[i]
求满足条件 n 个房子相邻不同颜色的最少刷漆量。
例如:
100 77 73
41 74 83
9 91 93
50 16 31
输入:n = 4, r = [100,41,9,50], g = [77,74,91,16], b = [73,83,93,31]
输出:172
/*
动态规划:
每个房子都有 3 种选择:当前房子选择红色,那么上一个房子只能选择蓝色或绿色,求得最少的刷漆量。
选择红色
dp[i][0] = Math.min(dp[i - 1][1], dp[i - 1][2]) + r[i]
选择绿色
dp[i][1] = Math.min(dp[i - 1][0], dp[i - 1][2]) + g[i]
选择红色
dp[i][2] = Math.min(dp[i - 1][0], dp[i - 1][1]) + b[i]
*/
private int te(int n, int[] r, int[] g, int[] b) {
int[][] dp = new int[n + 1][3];
for(int i = 1; i <= n; i++){
// 选择红色
dp[i][0] = Math.min(dp[i - 1][1], dp[i - 1][2]) + r[i - 1];
// 选择绿色
dp[i][1] = Math.min(dp[i - 1][0], dp[i - 1][2]) + g[i - 1];
// 选择红色
dp[i][2] = Math.min(dp[i - 1][0], dp[i - 1][1]) + b[i - 1];
}
return Math.min(Math.min(dp[n][0], dp[n][1]), dp[n][2]);
} | 1471104698/leetcode | 腾讯笔试/房子刷漆.java |
64,806 | import java.awt.Color;import java.util.List;import java.io.IOException;
import java.util.List;
import java.util.Set;
import com.ansj.vec.domain.WordEntry;
import me.xiaosheng.util.Segment;
import me.xiaosheng.word2vec.Word2Vec;
import dao.ContImp;
import model.Allcontent;
import com.mysql.jdbc.Connection;
import com.mysql.jdbc.PreparedStatement;
import java.util.List;
import model.Allcontent;
import dao.ContImp;
import java.io.File;
import java.io.FileOutputStream;
import com.lowagie.text.Chunk;
import com.lowagie.text.Document;
import com.lowagie.text.Font;
import com.lowagie.text.Chapter;
import com.lowagie.text.Element;
import com.lowagie.text.Image;
import com.lowagie.text.PageSize;
import com.lowagie.text.Paragraph;
import com.lowagie.text.Phrase;
import com.lowagie.text.pdf.BaseFont;
import com.lowagie.text.pdf.PdfPCell;
import com.lowagie.text.pdf.PdfPTable;
import com.lowagie.text.pdf.PdfWriter;
public class ToPdf {
private Color black = new Color(0, 0, 0); // 黑色
private Color red = new Color(255, 0, 0); // 红色
private Color blue = new Color(0, 0, 255); // 蓝色
private int bold = Font.BOLD; // 粗体
private int normal = Font.NORMAL; // 正常字体
private int italic = Font.ITALIC; // 斜体
private int boldItalic = Font.BOLDITALIC; // 粗斜体
private float setting = 100; // 首行缩进参数
public Document createDoc(String filename) throws Exception {
// 新建document对象
// 第一个参数是页面大小。接下来的参数分别是左、右、上和下页边距。
Document document = new Document(PageSize.A4, 50, 50, 50, 50);
// 建立一个书写器(Writer)与document对象关联,通过书写器(Writer)可以将文档写入到磁盘中。
// 创建 PdfWriter 对象 第一个参数是对文档对象的引用,第二个参数是文件的实际名称,在该名称中还会给出其输出路径。
PdfWriter.getInstance(document, new FileOutputStream(filename));
return document;
}
public void writePdf(String filename) throws Exception {
ContImp contImp=new ContImp();
List<Allcontent> cons=contImp.search1();
Document document = createDoc(filename); // 打开文档
document.open(); // 文档里写入
Paragraph centerPar = convertParToChinese("河北省信息技术手册检测", 23, normal, black);
centerPar.setAlignment(Element.ALIGN_CENTER);
document.add(centerPar); // 新建章节
Paragraph centerPar1 = convertParToChinese("【PDF报告-大学生版】", 12, normal, black);
centerPar1.setAlignment(Element.ALIGN_CENTER);
document.add(centerPar1); // 新建章节
document.add(new Paragraph("\n"));
document.add(new Paragraph("\n"));
//表头
document.add(convertParToChinese(" 报告编号:42d24399ae45f987 检测时间:2019-04-09 00:21:18 检测字数:16,009字", 10, normal, black));
document.add(new Paragraph("\n"));
document.add(convertParToChinese(" 作者名称:XXX 所属单位:石家庄铁道大学软件工程专业 ", 10, normal, black));
document.add(new Paragraph("\n"));
document.add(convertParToChinese(" ======================================================", 14, normal, blue));
document.add(convertParToChinese("\n 检测范围:\r\n" +
" ◎ 百度百科 ◎ 搜狗百科 ◎ Word2Vec语料库\r\n" +
" 时间范围:不限\n\n", 10,normal, black));
document.add(convertParToChinese(" ======================================================", 14, normal, blue));
document.add(convertParToChinese("\n 检测结论:\r\n" +
" 全文总相似比: 14.63% (总相似比=复写率+他引率+自引率)\r\n" +
" 自引率: 0% (引用自己已发表部分占全文的比重,请正确标注引用)\r\n" +
" 总相似片段:63\r\n" +
" 期刊:4 博硕:36 外文:2 综合:0 自建库:47 互联网:3\n\n", 10,normal, black));
document.add(convertParToChinese(" ======================================================", 14, normal, blue));
document.add(new Paragraph("\n"));
document.add(new Paragraph("\n"));
document.add(new Paragraph("\n"));
Paragraph centerPar3 = convertParToChinese("原文对照检测", 20, normal, red);
centerPar3.setAlignment(Element.ALIGN_CENTER);
document.add(centerPar3); // 新建章节
Paragraph par = new Paragraph();
document.add(convertParToChinese("\n 颜色标注说明:\r\n" +
" ■自写片段\r\n",10,normal, black));
Chunk chunk1 = new Chunk(convertChunkByChinese(" ■", 10, normal, red));
Chunk chunk2 = new Chunk(convertChunkByChinese("复写片段(相似或疑似重复)",10, normal, black));
par.add(chunk1);
par.add(chunk2); // chunk将两行合并为一行显示
document.add(par);
document.add(convertParToChinese(" ----------------------------------------------------------------------------------------", 14, normal, black));
document.add(convertParToChinese(" 第一篇 新技术篇\r\n" +
" 第一章 信息化热词 1\r\n" +
" 1 互联网+ 1\r\n" +
" 2 三网融合 1\r\n" +
" 3 数字城市 2\r\n" +
" 4 个人媒体时代 3\r\n" +
" 5 电子政府 4\r\n" +
" 6 虚拟现实(VR) 5\r\n" +
" 7 增强现实(AR) 5\r\n" +
" 8 自媒体 6\r\n" +
" 9 互联网数据中心(IDC) 6\r\n" +
" 10 虚拟专用网络(VPN) 7\r\n" +
" 11 办公自动化(OA) 7\r\n" +
" 12 企业资源计划(ERP) 8\r\n" +
" 13 二维码 8\r\n" +
" 14 交互式网络电视(IPTV) 9\r\n" +
" 15 可穿戴设备 10\r\n" +
" 16 共享经济 10\r\n" +
" 17 移动支付 11\r\n" +
" 18 智能硬件 11\r\n" +
" 19 智能家居 12\r\n" +
" 20 车联网 12\r\n" +
" 21 工业4.0 13\r\n" +
" 22 零售O2O 14\r\n" +
" 23 智慧农业 14\r\n" +
" 24 3D打印 15\r\n" +
" 第二章 大数据 16\r\n" +
" 25 大数据 16\r\n" +
" 26 分布式存储 16\r\n" +
" 27 数据挖掘 16\r\n" +
" 28 数据挖掘的基本任务 17\r\n" +
" 29 数据挖掘的基本技术 21\r\n" +
" 30 什么类型的数据可以进行挖掘? 23\r\n" +
" 31 数据可视化 23\r\n" +
" 32 为什么要进行数据预处理? 23\r\n" +
" 33 数据预处理的主要任务 24\r\n" +
" 34 数据仓库 25\r\n" +
" 35 数据仓库的特点 25\r\n" +
" 36 数据仓库的作用 26\r\n" +
" 37 操作数据库系统和数据仓库的区别 27\r\n" +
" 38 数据立方体 27\r\n" +
" 39 有哪些数据防护技术? 28\r\n" +
" 40 有哪些数据安全技术? 31\r\n" +
" 41 数据安全的特点有哪些? 33\r\n" +
" 42 企业可以通过哪些方法维护数据安全? 34\r\n" +
" 第三章 物联网 36\r\n" +
" 43 物联网 36\r\n" +
" 44 物联网的特性 37\r\n" +
" 45 感知中国 37\r\n" +
" 46 物联网的架构分为哪几层? 38\r\n" +
" 47 射频识别技术(RFID) 39\r\n" +
" 48 物联网的应用有哪些? 40\r\n" +
" 49 传感器 44\r\n" +
" 50 遥感技术 44\r\n" +
" 51 无线传感器网络(WSN) 45\r\n" +
" 52 第五代通信技术有哪些优势 46\r\n" +
" 53 5G的发展历程 46\r\n" +
" 54 目前5G的商用情况 52\r\n" +
" 第四章 云计算 53\r\n" +
" 55 云计算 53\r\n" +
" 56 云计算的特征 53\r\n" +
" 57 云计算有哪些优势? 54\r\n" +
" 58 云计算的供货商有哪些? 56\r\n" +
" 59 双机热备 57\r\n" +
" .......... 58\r\n" +
" 254 计算机信息网络进行国际联网的原则 277\r\n" , 10,normal, black));
document.add(new Paragraph("\n"));
document.add(new Paragraph("\n"));
int lim=1;
Word2Vec vec = new Word2Vec();
try {
vec.loadGoogleModel("data/wiki_chinese_word2vec(Google).model");
} catch (IOException e) {
e.printStackTrace();
}
for(int m=0;m<cons.size();m++){
String s11 = cons.get(m).getContent();
String s21 = cons.get(m).getBaidu();
//System.out.println(cons.get(i).getContent()+"\n"+cons.get(i).getBaidu());
//分割
String [] resultju=new String[250];
for(int r=0;r<resultju.length;r++)
resultju[r]="";
String[] sourceStrArray1 = s11.split("。");
String[] sourceStrArray2 = s21.split("。");
if(sourceStrArray1.length!=1) //如果句子只是一句话就不分割直接查找最大子串即可
{
String titall=cons.get(m).getTitle00()+" "+cons.get(m).getTitle01()+cons.get(m).getTitle02();
document.add(convertParToChinese(titall,11,normal, black));
for (int n1 = 0; n1 < sourceStrArray1.length; n1++)
{
for (int n2 = 0; n2 < sourceStrArray2.length; n2++)
{
//分词,获取词语列表
System.out.println("分割句1: "+sourceStrArray1[n1]);
System.out.println("分割句2: "+sourceStrArray2[n2]);
List<String> wordList1 = Segment.getWords(sourceStrArray1[n1]);
List<String> wordList2 = Segment.getWords(sourceStrArray2[n2]);
// System.out.println("句子相似度(名词、动词权值设为1,其他设为0.8):");
float[] weightArray1 = Segment.getPOSWeightArray(Segment.getPOS(sourceStrArray1[n1]));
float[] weightArray2 = Segment.getPOSWeightArray(Segment.getPOS(sourceStrArray2[n2]));
System.out.println("s11|s21: " + vec.sentenceSimilarity(wordList1, wordList2, weightArray1, weightArray2));
float f = (int)Math.round((vec.sentenceSimilarity(wordList1, wordList2, weightArray1, weightArray2))*1000)/1000f;
//使相似度保留三位小数
if(f>0.75)
{
System.out.println("相似度高: "+sourceStrArray1[n1]);
resultju[n1]=sourceStrArray1[n1];
break;
}
}
}
int len=0;
Paragraph pars1 = new Paragraph();
for(int g=0;g<resultju.length;g++)//相似度高的句子的数组
{
if(resultju[g]!="")
len++;
}
int pan=0;
for(int kk=0;kk<sourceStrArray1.length;kk++)
{
for(int kk1=0;kk1<len;kk1++)
if(sourceStrArray1[kk].equals(resultju[kk1]))
{
pan=1;
break;
}
if(pan==0)
{
Chunk chunk111 = new Chunk(convertChunkByChinese(sourceStrArray1[kk]+"。", 10, normal, black));
pars1.add(chunk111);// chunk将两行合并为一行显示
}
if(pan==1)
{ pan=0;
Chunk chunk111 = new Chunk(convertChunkByChinese(sourceStrArray1[kk]+"。", 10, normal, red));
pars1.add(chunk111);// chunk将两行合并为一行显示
}
}
document.add(pars1);
document.add(convertParToChinese("对比相似度: "+cons.get(m).getSamenum(),15,normal, blue));
}
else {
String s1=cons.get(m).getContent();
String s2=cons.get(m).getBaidu();
String s=MaxSubstring(s1,s2);
//System.out.println("s="+s+"长度:"+s.length());
String str1="";
String str2="";
String str3="";
for(int i=0;i<s1.indexOf(s);i++){ //找出出现字符串的位置
str1+=s1.charAt(i);
}
str2=s;
for(int i=s1.indexOf(s)+s.length();i<s1.length();i++){
str3+=s1.charAt(i);
}
System.out.println(s1);
System.out.println("第一: "+str1);
System.out.println("第er: "+str2);
System.out.println("第san: "+str3);
Paragraph par1 = new Paragraph();
Chunk chunk11 = new Chunk(convertChunkByChinese(str1, 10, normal, black));
Chunk chunk12 = new Chunk(convertChunkByChinese(str2,10, normal, red));
Chunk chunk13 = new Chunk(convertChunkByChinese(str3,10, normal, black));
par1.add(chunk11);
par1.add(chunk12);
par1.add(chunk13);// chunk将两行合并为一行显示
String titall=cons.get(m).getTitle00()+" "+cons.get(m).getTitle01()+cons.get(m).getTitle02();
document.add(convertParToChinese(titall,11,normal, black));
document.add(par1);
document.add(convertParToChinese("对比相似度: "+cons.get(m).getSamenum(),15,normal, blue));
}
}
document.close();
}
public boolean checkFile(String path) {
File file = new File(path);
if (file.exists()) {
return true;
}
return false;
}
public static Paragraph convertParToChinese(String text, int fontsize, int fontStyle, Color color)
throws Exception {
BaseFont baseFontChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);
Font fontChinese = new Font(baseFontChinese, fontsize, fontStyle, color);
Paragraph graph = new Paragraph(text, fontChinese);
return graph;
}
public Chunk convertChunkByChinese(String text, int fontsize, int fontStyle, Color color) throws Exception {
BaseFont baseFontChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);
Font fontChinese = new Font(baseFontChinese, fontsize, fontStyle, color);
Chunk chunk = new Chunk(text, fontChinese);
return chunk;
}
private static String MaxSubstring(String s1,String s2){
String max=null;
String min=null;
max=(s1.length()>s2.length())?s1:s2;
min=max.equals(s1)?s2:s1;
for (int i = 0; i <min.length(); i++) {
for (int a = 0,b=min.length()-i; b!=min.length()+1; a++,b++) {
String sub=min.substring(a, b);
if(max.contains(sub))
return sub;
}
}
return null;//没有相同的子串,返回null
}
public static void main(String[] args) throws Exception {
ToPdf pdfDemo = new ToPdf();
pdfDemo.writePdf("C:\\Users\\神奇的刘dd\\Desktop\\test1.pdf");
System.out.println("ok");
}
} | mmmjh/WeightCheckingPlatform | SameWork/src/ToPdf.java |
64,807 |
import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
/**
* Description:
* 网站: <a href="http://www.crazyit.org">疯狂Java联盟</a><br>
* Copyright (C), 2001-2018, Yeeku.H.Lee<br>
* This program is protected by copyright laws.<br>
* Program Name:<br>
* Date:<br>
* @author Yeeku.H.Lee [email protected]
* @version 1.0
*/
public class HandDraw
{
// 画图区的宽度
private final int AREA_WIDTH = 500;
// 画图区的高度
private final int AREA_HEIGHT = 400;
// 下面的preX、preY保存了上一次鼠标拖动事件的鼠标坐标
private int preX = -1;
private int preY = -1;
// 定义一个右键菜单用于设置画笔颜色
PopupMenu pop = new PopupMenu();
MenuItem redItem = new MenuItem("红色");
MenuItem greenItem = new MenuItem("绿色");
MenuItem blueItem = new MenuItem("蓝色");
// 定义一个BufferedImage对象
BufferedImage image = new BufferedImage(AREA_WIDTH
, AREA_HEIGHT , BufferedImage.TYPE_INT_RGB);
// 获取image对象的Graphics
Graphics g = image.getGraphics();
private Frame f = new Frame("简单手绘程序");
private DrawCanvas drawArea = new DrawCanvas();
// 用于保存画笔颜色
private Color foreColor = new Color(255, 0 ,0);
public void init()
{
// 定义右键菜单的事件监听器。
ActionListener menuListener = e ->
{
if (e.getActionCommand().equals("绿色"))
{
foreColor = new Color(0 , 255 , 0);
}
if (e.getActionCommand().equals("红色"))
{
foreColor = new Color(255 , 0 , 0);
}
if (e.getActionCommand().equals("蓝色"))
{
foreColor = new Color(0 , 0 , 255);
}
};
// 为三个菜单添加事件监听器
redItem.addActionListener(menuListener);
greenItem.addActionListener(menuListener);
blueItem.addActionListener(menuListener);
// 将菜单项组合成右键菜单
pop.add(redItem);
pop.add(greenItem);
pop.add(blueItem);
// 将右键菜单添加到drawArea对象中
drawArea.add(pop);
// 将image对象的背景色填充成白色
g.fillRect(0 , 0 ,AREA_WIDTH , AREA_HEIGHT);
drawArea.setPreferredSize(new Dimension(AREA_WIDTH , AREA_HEIGHT));
// 监听鼠标移动动作
drawArea.addMouseMotionListener(new MouseMotionAdapter()
{
// 实现按下鼠标键并拖动的事件处理器
public void mouseDragged(MouseEvent e)
{
// 如果preX和preY大于0
if (preX > 0 && preY > 0)
{
// 设置当前颜色
g.setColor(foreColor);
// 绘制从上一次鼠标拖动事件点到本次鼠标拖动事件点的线段
g.drawLine(preX , preY , e.getX() , e.getY());
}
// 将当前鼠标事件点的X、Y坐标保存起来
preX = e.getX();
preY = e.getY();
// 重绘drawArea对象
drawArea.repaint();
}
});
// 监听鼠标事件
drawArea.addMouseListener(new MouseAdapter()
{
// 实现鼠标松开的事件处理器
public void mouseReleased(MouseEvent e)
{
// 弹出右键菜单
if (e.isPopupTrigger())
{
pop.show(drawArea , e.getX() , e.getY());
}
// 松开鼠标键时,把上一次鼠标拖动事件的X、Y坐标设为-1。
preX = -1;
preY = -1;
}
});
f.add(drawArea);
f.pack();
f.setVisible(true);
}
public static void main(String[] args)
{
new HandDraw().init();
}
class DrawCanvas extends Canvas
{
// 重写Canvas的paint方法,实现绘画
public void paint(Graphics g)
{
// 将image绘制到该组件上
g.drawImage(image , 0 , 0 , null);
}
}
}
| TunomonSW/crazyJava | crazyJava/11/11.8/HandDraw.java |
64,808 | package pers.han.scheduler.io;
/**
* 图表中各类型任务的颜色
* FileName: ChartColor.java
*
* @author hanYG
* @createDate 2021.10.15
* @alterDate 2021.10.19
* @version 1.0
*
*/
public final class ChartColor {
/** 偶发性任务的表示颜色 */
private static final String[] sporadicTaskColorStrArray = {
"#FF0000", // 红色
"#00FF00", // 绿色
"#0000FF", // 蓝色
"#FF00FF", // 紫色
"#FFFF00", // 黄色
"#00FFFF", //
// "#FFFFFF" // 白色
"#000000" // 黑色
};
/** 非周期性任务的表示颜色 */
private static final String[] aperiodicTaskColorStrArray = {
"#FF0000", // 红色
"#00FF00", // 绿色
"#0000FF", // 蓝色
"#FF00FF", // 紫色
"#FFFF00", // 黄色
"#00FFFF", //
// "#FFFFFF" // 白色
"#000000" // 黑色
};
/** 周期性任务的表示颜色 */
private static final String[] periodicTaskColorStrArray = {
"#FF0000", // 红色
"#00FF00", // 绿色
"#0000FF", // 蓝色
"#FF00FF", // 紫色
"#FFFF00", // 黄色
"#00FFFF", //
// "#FFFFFF" // 白色
"#000000" // 黑色
};
/** windows 默认颜色 r=51 g=51 b=51 */
public static final String defaultColorStr = "#515151";
/** 红色 */
public static final String redStr = "#FF0000";
/** 绿色 */
public static final String greenStr = "#00FF00";
/** 蓝色 */
public static final String blueStr = "#0000FF";
/** 指向偶发性任务颜色的标记 */
private int sporadicTaskColorStrArrayIndex = 0;
/** 指向非周期性任务颜色的标记 */
private int aperiodicTaskColorStrArrayIndex = 0;
/** 指向周期性任务颜色的标记 */
private int periodicTaskColorStrArrayIndex = 0;
/**
* 获取偶发任务的下一个表示颜色
* @return String
*/
public String getSporadicTaskColorStr() {
if (this.sporadicTaskColorStrArrayIndex >= ChartColor.sporadicTaskColorStrArray.length) {
this.sporadicTaskColorStrArrayIndex = 0;
}
return ChartColor.sporadicTaskColorStrArray[this.sporadicTaskColorStrArrayIndex++];
}
/**
* 获取非周期性任务的下一个表示颜色
* @return String
*/
public String getAperiodicTaskColorStr() {
if (this.aperiodicTaskColorStrArrayIndex >= ChartColor.aperiodicTaskColorStrArray.length) {
this.aperiodicTaskColorStrArrayIndex = 0;
}
return ChartColor.aperiodicTaskColorStrArray[this.aperiodicTaskColorStrArrayIndex++];
}
/**
* 获取周期性任务的下一个表示颜色
* @return String
*/
public String getPeriodicTaskColorStr() {
if (this.periodicTaskColorStrArrayIndex >= ChartColor.periodicTaskColorStrArray.length) {
this.periodicTaskColorStrArrayIndex = 0;
}
return ChartColor.periodicTaskColorStrArray[this.periodicTaskColorStrArrayIndex++];
}
/**
* 获取偶发性任务表示的颜色
* @param index 索引
* @return String
*/
public static String getSporadicTaskColorStr(int index) {
return ChartColor.sporadicTaskColorStrArray[index % ChartColor.sporadicTaskColorStrArray.length];
}
/**
* 获取非周期任务表示的颜色
* @param index 索引
* @return String
*/
public static String getAperiodicTaskColorStr(int index) {
return ChartColor.aperiodicTaskColorStrArray[index % ChartColor.aperiodicTaskColorStrArray.length];
}
/**
* 获取周期性任务表示的颜色
* @param index 索引
* @return String
*/
public static String getPeriodicTaskColorStr(int index) {
return ChartColor.periodicTaskColorStrArray[index % ChartColor.periodicTaskColorStrArray.length];
}
/**
* 构造函数
*/
public ChartColor() { }
}
| 1501106169/scheduler | src/pers/han/scheduler/io/ChartColor.java |
64,813 | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package tools.api;
/**
* @author zisedk
*/
public class Console {
private static final Kernel32 kernel32 = Kernel32.INSTANCE;
private static final int hStdout = kernel32.GetStdHandle(-11);
/**
* 设置控制台窗口标题
*
* @param title
*/
public static void setTitle(String title) {
kernel32.SetConsoleTitleA(title);
}
/**
* 控制台清屏
*/
public static void clear() {
PCONSOLE_SCREEN_BUFFER_INFO buff = new PCONSOLE_SCREEN_BUFFER_INFO();
kernel32.GetConsoleScreenBufferInfo(hStdout, buff);
int dwConSize = buff.dwSize.x * buff.dwSize.y;
kernel32.FillConsoleOutputCharacterA(hStdout, 32, dwConSize, 0, new int[1]);
kernel32.GetConsoleScreenBufferInfo(hStdout, buff);
kernel32.FillConsoleOutputAttribute(hStdout, buff.wAttributes, dwConSize, 0, new int[1]);
kernel32.SetConsoleCursorPosition(hStdout, 0);
}
/**
* 设置输出颜色 10 = 绿色 11 = 蓝色 12 = 红色 13 = 粉色 14 = 黄色 15 = 白色
*/
public static void setColor(int color) {
kernel32.SetConsoleTextAttribute(hStdout, color);
}
/*
* [ 0x?? 中 ? 的取值 ] 例如 0x12 = 背景为蓝色,前景为绿色 设置默认的控制台前景和背景颜色。
*
* attr 指定控制台输出的颜色属性
*
* 颜色属性由两个十六进制数字指定 -- 第一个为背景,第二个则为 前景。每个数字可以为以下任何值之一:
*
* 0 = 黑色 8 = 灰色 1 = 蓝色 9 = 淡蓝色 2 = 绿色 A = 淡绿色 3 = 湖蓝色 B = 淡浅绿色 4 = 红色 C = 淡红色 5 = 紫色 D = 淡紫色 6 = 黄色 E = 淡黄色 7 = 白色 F = 亮白色
*
* 。这个值来自当前控制台窗口、/T 开关或DefaultColor 注册表值。
*/
}
| v3921358/YSMS133.1 | src/tools/api/Console.java |
64,814 | import java.awt.Dimension;
import java.awt.geom.RoundRectangle2D;
import java.io.IOException;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.UIManager;
import org.jvnet.substance.SubstanceLookAndFeel;
import org.jvnet.substance.border.*;
import org.jvnet.substance.button.StandardButtonShaper;
import org.jvnet.substance.skin.OfficeBlue2007Skin;
import org.jvnet.substance.skin.SubstanceGreenMagicLookAndFeel;
import org.jvnet.substance.theme.*;
import org.jvnet.substance.watermark.SubstanceBinaryWatermark;
import org.jvnet.substance.watermark.SubstanceBubblesWatermark;
//import com.sun.awt.AWTUtilities;
//http://blog.csdn.net/ja5on/article/details/5871348
/**
* 词典入口类,进行组件的注册和界面初始化
* @author Zheng Sujin, Zheng Huixiang, Zheng qirong, foxandhuzh
*
*/
public class DictionaryTest {
public static void main(String[] args) {
try {
// 组件注册
String classDir = DictionaryTest.class.getClass().getClass().getResource("/").getPath();
classDir=classDir.substring(1, classDir.length());
Runtime.getRuntime().exec("regsvr32 /s \""+classDir+"XdictGrb.dll"+"\"");
Runtime.getRuntime().exec("C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\regasm "+classDir+"WordGrabber.dll /codebase");
Runtime.getRuntime().exec("C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\regasm "+classDir+"SoundRecognition.dll /codebase");
// 界面
UIManager.setLookAndFeel(new SubstanceGreenMagicLookAndFeel());
UIManager.put("swing.boldMetal", false);
if (System.getProperty("substancelaf.useDecorations") == null)
{
JFrame.setDefaultLookAndFeelDecorated(true);
JDialog.setDefaultLookAndFeelDecorated(true);
}
// System.setProperty("sun.awt.noerasebackground", "true");
// SubstanceLookAndFeel.setCurrentTheme(new SubstanceBrownTheme());
// SubstanceLookAndFeel.setCurrentTheme(new SubstanceJadeForestTheme());
// SubstanceLookAndFeel.setCurrentTheme(new SubstanceDarkVioletTheme());//紫黑
// SubstanceLookAndFeel.setCurrentTheme(new SubstanceCharcoalTheme());//酷hong黑
// SubstanceLookAndFeel.setCurrentTheme(new SubstanceBrownTheme());//棕色
// SubstanceLookAndFeel.setCurrentTheme(new SubstanceCremeTheme());//原始灰色
SubstanceLookAndFeel.setCurrentTheme(new SubstanceLimeGreenTheme());//浅绿色
// SubstanceLookAndFeel.setCurrentTheme(new SubstanceBarbyPinkTheme());//粉红
// SubstanceLookAndFeel.setCurrentTheme(new SubstanceLightAquaTheme());//蓝色
// SubstanceLookAndFeel.setCurrentTheme(new SubstanceTerracottaTheme());//浅橙色
SubstanceLookAndFeel.setCurrentButtonShaper(new StandardButtonShaper());
// SubstanceLookAndFeel.setCurrentWatermark(new SubstanceBubblesWatermark());//泡泡
// SubstanceLookAndFeel.setCurrentWatermark(new SubstanceBinaryWatermark());//二进制
// SubstanceLookAndFeel.setCurrentBorderPainter(new StandardBorderPainter());
// SubstanceLookAndFeel.setCurrentBorderPainter(new GlassBorderPainter());
//设置当前的主题风格,同样我 们还可以设置当前的按钮形状,水印风格等等
}
catch (Exception e) {
System.err.println("Oops! Something went wrong!");
}
Dictionary frame=new Dictionary();
// frame.setDefaultCloseOperation();
// JFrame.setDefaultLookAndFeelDecorated(true);
// AWTUtilities.setWindowShape(frame,
// new RoundRectangle2D.Double(0.0D, 0.0D, frame.getWidth(),
// frame.getHeight(), 6.0D, 6.0D));
// frame.setUndecorated(true);
//
// /** 设置圆角 */
// AWTUtilities.setWindowShape(frame, new RoundRectangle2D.Double(
// 0.0D, 0.0D, frame.getWidth(), frame.getHeight(), 26.0D,
// 26.0D));
frame.setVisible(true);
}
}
| maxzhx/WuDaoDictionary | src/DictionaryTest.java |
64,815 |
import java.awt.*;
import javax.swing.*;
/**
* Description:
* 网站: <a href="http://www.crazyit.org">疯狂Java联盟</a><br>
* Copyright (C), 2001-2018, Yeeku.H.Lee<br>
* This program is protected by copyright laws.<br>
* Program Name:<br>
* Date:<br>
* @author Yeeku.H.Lee [email protected]
* @version 1.0
*/
public class CommonComponent
{
Frame f = new Frame("测试");
// 定义一个按钮
Button ok = new Button("确认");
CheckboxGroup cbg = new CheckboxGroup();
// 定义一个单选框(处于cbg组),初始处于被选中状态
Checkbox male = new Checkbox("男" , cbg , true);
// 定义一个单选框(处于cbg组),初始处于没有选中状态
Checkbox female = new Checkbox("女" , cbg , false);
// 定义一个复选框,初始处于没有选中状态
Checkbox married = new Checkbox("是否已婚?" , false);
// 定义一个下拉选择框
Choice colorChooser = new Choice();
// 定义一个列表选择框
List colorList = new List(6, true);
// 定义一个5行、20列的多行文本域
TextArea ta = new TextArea(5, 20);
// 定义一个50列的单行文本域
TextField name = new TextField(50);
public void init()
{
colorChooser.add("红色");
colorChooser.add("绿色");
colorChooser.add("蓝色");
colorList.add("红色");
colorList.add("绿色");
colorList.add("蓝色");
// 创建一个装载了文本框、按钮的Panel
Panel bottom = new Panel();
bottom.add(name);
bottom.add(ok);
f.add(bottom , BorderLayout.SOUTH);
// 创建一个装载了下拉选择框、三个Checkbox的Panel
Panel checkPanel = new Panel();
checkPanel.add(colorChooser);
checkPanel.add(male);
checkPanel.add(female);
checkPanel.add(married);
// 创建一个垂直排列组件的Box,盛装多行文本域、Panel
Box topLeft = Box.createVerticalBox();
topLeft.add(ta);
topLeft.add(checkPanel);
// 创建一个水平排列组件的Box,盛装topLeft、colorList
Box top = Box.createHorizontalBox();
top.add(topLeft);
top.add(colorList);
// 将top Box容器添加到窗口的中间
f.add(top);
f.pack();
f.setVisible(true);
}
public static void main(String[] args)
{
new CommonComponent().init();
}
}
| TunomonSW/crazyJava | crazyJava/11/11.4/CommonComponent.java |
64,816 | // © 2022 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
package com.ibm.icu.impl.breakiter;
import static com.ibm.icu.impl.CharacterIteration.DONE32;
import static com.ibm.icu.impl.CharacterIteration.current32;
import static com.ibm.icu.impl.CharacterIteration.next32;
import static com.ibm.icu.impl.CharacterIteration.previous32;
import java.text.CharacterIterator;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import com.ibm.icu.impl.ICUData;
import com.ibm.icu.text.UnicodeSet;
import com.ibm.icu.util.UResourceBundle;
import com.ibm.icu.util.UResourceBundleIterator;
enum ModelIndex {
kUWStart(0), kBWStart(6), kTWStart(9);
private final int value;
private ModelIndex(int value) {
this.value = value;
}
public int getValue() {
return value;
}
}
public class MlBreakEngine {
// {UW1, UW2, ... UW6, BW1, ... BW3, TW1, TW2, ... TW4} 6+3+4= 13
private static final int MAX_FEATURE = 13;
private UnicodeSet fDigitOrOpenPunctuationOrAlphabetSet;
private UnicodeSet fClosePunctuationSet;
private List<HashMap<String, Integer>> fModel;
private int fNegativeSum;
/**
* Constructor for Chinese and Japanese phrase breaking.
*
* @param digitOrOpenPunctuationOrAlphabetSet An unicode set with the digit and open punctuation
* and alphabet.
* @param closePunctuationSet An unicode set with the close punctuation.
*/
public MlBreakEngine(UnicodeSet digitOrOpenPunctuationOrAlphabetSet,
UnicodeSet closePunctuationSet) {
fDigitOrOpenPunctuationOrAlphabetSet = digitOrOpenPunctuationOrAlphabetSet;
fClosePunctuationSet = closePunctuationSet;
fModel = new ArrayList<HashMap<String, Integer>>(MAX_FEATURE);
for (int i = 0; i < MAX_FEATURE; i++) {
fModel.add(new HashMap<String, Integer>());
}
fNegativeSum = 0;
loadMLModel();
}
/**
* Divide up a range of characters handled by this break engine.
*
* @param inText An input text.
* @param startPos The start index of the input text.
* @param endPos The end index of the input text.
* @param inString A input string normalized from inText from startPos to endPos
* @param codePointLength The number of code points of inString
* @param charPositions A map that transforms inString's code point index to code unit index.
* @param foundBreaks A list to store the breakpoint.
* @return The number of breakpoints
*/
public int divideUpRange(CharacterIterator inText, int startPos, int endPos,
CharacterIterator inString, int codePointLength, int[] charPositions,
DictionaryBreakEngine.DequeI foundBreaks) {
if (startPos >= endPos) {
return 0;
}
ArrayList<Integer> boundary = new ArrayList<Integer>(codePointLength);
String inputStr = transform(inString);
// The ML algorithm groups six char and evaluates whether the 4th char is a breakpoint.
// In each iteration, it evaluates the 4th char and then moves forward one char like
// sliding window. Initially, the first six values in the indexList are
// [-1, -1, 0, 1, 2, 3]. After moving forward, finally the last six values in the indexList
// are [length-4, length-3, length-2, length-1, -1, -1]. The "+4" here means four extra
// "-1".
int indexSize = codePointLength + 4;
int indexList[] = new int[indexSize];
int numCodeUnits = initIndexList(inString, indexList, codePointLength);
// Add a break for the start.
boundary.add(0, 0);
for (int idx = 0; idx + 1 < codePointLength; idx++) {
evaluateBreakpoint(inputStr, indexList, idx, numCodeUnits, boundary);
if (idx + 4 < codePointLength) {
indexList[idx + 6] = numCodeUnits;
numCodeUnits += Character.charCount(next32(inString));
}
}
// Add a break for the end if there is not one there already.
if (boundary.get(boundary.size() - 1) != codePointLength) {
boundary.add(codePointLength);
}
int correctedNumBreaks = 0;
int previous = -1;
int numBreaks = boundary.size();
for (int i = 0; i < numBreaks; i++) {
int pos = charPositions[boundary.get(i)] + startPos;
// In phrase breaking, there has to be a breakpoint between Cj character and close
// punctuation.
// E.g.[携帯電話]正しい選択 -> [携帯▁電話]▁正しい▁選択 -> breakpoint between ] and 正
inText.setIndex(pos);
if (pos > previous) {
if (pos != startPos
|| (pos > 0
&& fClosePunctuationSet.contains(previous32(inText)))) {
foundBreaks.push(pos);
correctedNumBreaks++;
}
}
previous = pos;
}
if (!foundBreaks.isEmpty() && foundBreaks.peek() == endPos) {
// In phrase breaking, there has to be a breakpoint between Cj character and
// the number/open punctuation.
// E.g. る文字「そうだ、京都」->る▁文字▁「そうだ、▁京都」-> breakpoint between 字 and「
// E.g. 乗車率90%程度だろうか -> 乗車▁率▁90%▁程度だろうか -> breakpoint between 率 and 9
// E.g. しかもロゴがUnicode! -> しかも▁ロゴが▁Unicode!-> breakpoint between が and U
inText.setIndex(endPos);
int current = current32(inText);
if (current != DONE32 && !fDigitOrOpenPunctuationOrAlphabetSet.contains(current)) {
foundBreaks.pop();
correctedNumBreaks--;
}
}
if (!foundBreaks.isEmpty()) {
inText.setIndex(foundBreaks.peek());
}
return correctedNumBreaks;
}
/**
* Transform a CharacterIterator into a String.
*/
private String transform(CharacterIterator inString) {
StringBuilder sb = new StringBuilder();
inString.setIndex(0);
for (char c = inString.first(); c != CharacterIterator.DONE; c = inString.next()) {
sb.append(c);
}
return sb.toString();
}
/**
* Evaluate whether the breakpointIdx is a potential breakpoint.
*
* @param inputStr An input string to be segmented.
* @param indexList A code unit index list of the inputStr.
* @param startIdx The start index of the indexList.
* @param numCodeUnits The current code unit boundary of the indexList.
* @param boundary A list including the index of the breakpoint.
*/
private void evaluateBreakpoint(String inputStr, int[] indexList, int startIdx,
int numCodeUnits, ArrayList<Integer> boundary) {
int start = 0, end = 0;
int score = fNegativeSum;
for (int i = 0; i < 6; i++) {
// UW1 ~ UW6
start = startIdx + i;
if (indexList[start] != -1) {
end = (indexList[start + 1] != -1) ? indexList[start + 1] : numCodeUnits;
score += fModel.get(ModelIndex.kUWStart.getValue() + i).getOrDefault(
inputStr.substring(indexList[start], end), 0);
}
}
for (int i = 0; i < 3; i++) {
// BW1 ~ BW3
start = startIdx + i + 1;
if (indexList[start] != -1 && indexList[start + 1] != -1) {
end = (indexList[start + 2] != -1) ? indexList[start + 2] : numCodeUnits;
score += fModel.get(ModelIndex.kBWStart.getValue() + i).getOrDefault(
inputStr.substring(indexList[start], end), 0);
}
}
for (int i = 0; i < 4; i++) {
// TW1 ~ TW4
start = startIdx + i;
if (indexList[start] != -1
&& indexList[start + 1] != -1
&& indexList[start + 2] != -1) {
end = (indexList[start + 3] != -1) ? indexList[start + 3] : numCodeUnits;
score += fModel.get(ModelIndex.kTWStart.getValue() + i).getOrDefault(
inputStr.substring(indexList[start], end), 0);
}
}
if (score > 0) {
boundary.add(startIdx + 1);
}
}
/**
* Initialize the index list from the input string.
*
* @param inString An input string to be segmented.
* @param indexList A code unit index list of the inString.
* @param codePointLength The number of code points of the input string
* @return The number of the code units of the first six characters in inString.
*/
private int initIndexList(CharacterIterator inString, int[] indexList, int codePointLength) {
int index = 0;
inString.setIndex(index);
Arrays.fill(indexList, -1);
if (codePointLength > 0) {
indexList[2] = 0;
index += Character.charCount(current32(inString));
if (codePointLength > 1) {
indexList[3] = index;
index += Character.charCount(next32(inString));
if (codePointLength > 2) {
indexList[4] = index;
index += Character.charCount(next32(inString));
if (codePointLength > 3) {
indexList[5] = index;
index += Character.charCount(next32(inString));
}
}
}
}
return index;
}
/**
* Load the machine learning's model file.
*/
private void loadMLModel() {
int index = 0;
UResourceBundle rb = UResourceBundle.getBundleInstance(ICUData.ICU_BRKITR_BASE_NAME,
"jaml");
initKeyValue(rb, "UW1Keys", "UW1Values", fModel.get(index++));
initKeyValue(rb, "UW2Keys", "UW2Values", fModel.get(index++));
initKeyValue(rb, "UW3Keys", "UW3Values", fModel.get(index++));
initKeyValue(rb, "UW4Keys", "UW4Values", fModel.get(index++));
initKeyValue(rb, "UW5Keys", "UW5Values", fModel.get(index++));
initKeyValue(rb, "UW6Keys", "UW6Values", fModel.get(index++));
initKeyValue(rb, "BW1Keys", "BW1Values", fModel.get(index++));
initKeyValue(rb, "BW2Keys", "BW2Values", fModel.get(index++));
initKeyValue(rb, "BW3Keys", "BW3Values", fModel.get(index++));
initKeyValue(rb, "TW1Keys", "TW1Values", fModel.get(index++));
initKeyValue(rb, "TW2Keys", "TW2Values", fModel.get(index++));
initKeyValue(rb, "TW3Keys", "TW3Values", fModel.get(index++));
initKeyValue(rb, "TW4Keys", "TW4Values", fModel.get(index++));
fNegativeSum /= 2;
}
/**
* In the machine learning's model file, specify the name of the key and value to load the
* corresponding feature and its score.
*
* @param rb A RedouceBundle corresponding to the model file.
* @param keyName The kay name in the model file.
* @param valueName The value name in the model file.
* @param map A HashMap to store the pairs of the feature and its score.
*/
private void initKeyValue(UResourceBundle rb, String keyName, String valueName,
HashMap<String, Integer> map) {
int idx = 0;
UResourceBundle keyBundle = rb.get(keyName);
UResourceBundle valueBundle = rb.get(valueName);
int[] value = valueBundle.getIntVector();
UResourceBundleIterator iterator = keyBundle.getIterator();
while (iterator.hasNext()) {
fNegativeSum -= value[idx];
map.put(iterator.nextString(), value[idx++]);
}
}
}
| unicode-org/icu | icu4j/main/core/src/main/java/com/ibm/icu/impl/breakiter/MlBreakEngine.java |
64,818 | package open.dolphin.msg;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.StringWriter;
import java.text.NumberFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Properties;
import java.util.logging.Logger;
import javax.mail.Message.RecipientType;
import javax.mail.MessagingException;
import javax.mail.PasswordAuthentication;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import open.dolphin.infomodel.ActivityModel;
import open.dolphin.session.AccountSummary;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.Velocity;
import org.apache.velocity.exception.MethodInvocationException;
import org.apache.velocity.exception.ParseErrorException;
import org.apache.velocity.exception.ResourceNotFoundException;
public class OidSender {
private static final String GMAIL_ACCOUNT = "[email protected]";
private static final String GMAIL_PASSWD = "hanagui++";
private static final String MAIL_ENC = "ISO-2022-JP";
//s.oh^ 2014/07/08 クラウド0対応
//private static final String DOLPHIN_EMAIL_ADDRESS = "[email protected]";
//private static final String ACCOUNT_MAKING_RESULT = "OpenDolphinアカウント作成のお知らせ";
private static final String DG_DOLPHIN_EMAIL_ADDRESS = "[email protected]";
private static final String ACTIVITY_RESULT = "【使用量レポート】";
//s.oh$
private static final String DOLPHIN_EMAIL_ADDRESS = "[email protected]";
//s.oh^ 2014/07/08 クラウド0対応
//private static final String ACCOUNT_MAKING_RESULT = "DolphinProアカウント作成のお知らせ";
private static final String ACCOUNT_MAKING_RESULT = "OpenDolphinアカウント作成のお知らせ";
//s.oh$
private static final String MEMBER_TEMPLATE = "member-mail.vm";
private static final String TESTER_TEMPLATE = "account-mail.vm";
private static final String TEMPLATE_ENC = "SHIFT_JIS";
private static final String OBJECT_NAME = "account";
private static final String ASP_TESTER = "ASP_TESTER";
private static final String ASP_MEMBER = "ASP_MEMBER";
public void send(AccountSummary account) {
try {
VelocityContext context = VelocityHelper.getContext();
context.put(OBJECT_NAME, account);
StringWriter sw = new StringWriter();
//s.oh^ 2014/07/08 クラウド0対応
//BufferedWriter bw = new BufferedWriter(sw);
//
//// ライセンスのタイプでテンプレートを選択する
//if (account.getMemberType().equals(ASP_TESTER)) {
// Velocity.mergeTemplate(TESTER_TEMPLATE, TEMPLATE_ENC, context, bw);
//} else if (account.getMemberType().equals(ASP_MEMBER)) {
// Velocity.mergeTemplate(MEMBER_TEMPLATE, TEMPLATE_ENC, context, bw);
//}
//
//bw.flush();
//bw.close();
//String body = sw.toString();
//
//Properties props = new Properties();
//// gmail -------------------------------
///*props.put("mail.smtp.host", "smtp.gmail.com");
//props.put("mail.smtp.socketFactory.port", "465");
//props.put("mail.smtp.socketFactory.class","javax.net.ssl.SSLSocketFactory");
//props.put("mail.smtp.auth", "true");
//props.put("mail.smtp.port", "465");*/
//
//props.put("mail.smtp.host", "mails.lscc.co.jp");
////props.put("mail.smtp.socketFactory.port", "465");
////props.put("mail.smtp.socketFactory.class","javax.net.ssl.SSLSocketFactory");
//props.put("mail.smtp.auth", "true");
//props.put("mail.smtp.port", "25");
//// id: dolphin
//// pass: dolphin
////--------------------------------------
try (BufferedWriter bw = new BufferedWriter(sw)) {
// ライセンスのタイプでテンプレートを選択する
switch (account.getMemberType()) {
case ASP_TESTER:
Velocity.mergeTemplate(TESTER_TEMPLATE, TEMPLATE_ENC, context, bw);
break;
case ASP_MEMBER:
Velocity.mergeTemplate(MEMBER_TEMPLATE, TEMPLATE_ENC, context, bw);
break;
}
bw.flush();
}
String body = sw.toString();
Properties props = this.getMailProperties();
//s.oh$
Session session = Session.getDefaultInstance(props,
new javax.mail.Authenticator() {
@Override
protected PasswordAuthentication getPasswordAuthentication() {
//return new PasswordAuthentication(GMAIL_ACCOUNT,GMAIL_PASSWD);
return new PasswordAuthentication("dolphin","dolphin");
}
});
javax.mail.internet.MimeMessage mimeMessage = new javax.mail.internet.MimeMessage(session);
mimeMessage.setFrom(new InternetAddress(DOLPHIN_EMAIL_ADDRESS));
mimeMessage.setRecipients(javax.mail.Message.RecipientType.TO, InternetAddress.parse(account.getUserEmail()));
mimeMessage.addRecipients(RecipientType.BCC, DOLPHIN_EMAIL_ADDRESS);
mimeMessage.setSubject(ACCOUNT_MAKING_RESULT, MAIL_ENC);
mimeMessage.setText(body, MAIL_ENC);
Transport.send(mimeMessage);
} catch (IOException | ResourceNotFoundException | ParseErrorException | MethodInvocationException | MessagingException e) {
e.printStackTrace(System.err);
Logger.getLogger("open.dolphin").warning(e.getMessage());
}
}
//s.oh^ 2014/07/08 クラウド0対応
public void sendActivity(ActivityModel ams[]) {
ActivityModel am = ams[0];
ActivityModel total = ams[1];
Properties config = new Properties();
StringBuilder path = new StringBuilder();
path.append(System.getProperty("jboss.home.dir"));
path.append(File.separator);
path.append("custom.properties");
File f = new File(path.toString());
try {
FileInputStream fin = new FileInputStream(f);
try (InputStreamReader r = new InputStreamReader(fin, "JISAutoDetect")) {
config.load(r);
}
} catch (IOException ex) {
ex.printStackTrace(System.err);
throw new RuntimeException(ex.getMessage());
}
String mailFrom = config.getProperty("cloud.zero.mail.from");
if(mailFrom == null || mailFrom.length() <= 0) {
mailFrom = DOLPHIN_EMAIL_ADDRESS;
}
String mailTo = config.getProperty("cloud.zero.mail.to");
if(mailTo == null || mailTo.length() <= 0) {
mailTo = DOLPHIN_EMAIL_ADDRESS;
}
final String account = config.getProperty("cloud.zero.mail.account");
final String password = config.getProperty("cloud.zero.mail.password");
try {
// 本文
StringBuilder sb = new StringBuilder();
sb.append("集計期間=").append(targetDateFromDate(am.getFromDate())).append("~").append(targetDateFromDate(am.getToDate())).append("\n");
sb.append("------------------------------------").append("\n");
sb.append("医療機関ID=").append(total.getFacilityId()).append("\n");
sb.append("医療機関名=").append(total.getFacilityName()).append("\n");
sb.append("郵便番号=").append(total.getFacilityZip()).append("\n");
sb.append("住所=").append(total.getFacilityAddress()).append("\n");
sb.append("電話=").append(total.getFacilityTelephone()).append("\n");
sb.append("FAX=").append(total.getFacilityFacimile()).append("\n");
sb.append("利用者数=").append(total.getNumOfUsers()).append("\n");
sb.append("************************************").append("\n");
sb.append("患者登録数= ").append(formatNumber(am.getNumOfPatients())).append(" / ").append(formatNumber(total.getNumOfPatients())).append("\n");
sb.append("来院数= ").append(formatNumber(am.getNumOfPatientVisits())).append(" / ").append(formatNumber(total.getNumOfPatientVisits())).append("\n");
sb.append("病名数= ").append(formatNumber(am.getNumOfDiagnosis())).append(" / ").append(formatNumber(total.getNumOfDiagnosis())).append("\n");
sb.append("カルテ枚数= ").append(formatNumber(am.getNumOfKarte())).append(" / ").append(formatNumber(total.getNumOfKarte())).append("\n");
sb.append("画像数= ").append(formatNumber(am.getNumOfImages())).append(" / ").append(formatNumber(total.getNumOfImages())).append("\n");
sb.append("添付文書数= ").append(formatNumber(am.getNumOfAttachments())).append(" / ").append(formatNumber(total.getNumOfAttachments())).append("\n");
sb.append("紹介状数= ").append(formatNumber(am.getNumOfLetters())).append(" / ").append(formatNumber(total.getNumOfLetters())).append("\n");
sb.append("検査数= ").append(formatNumber(am.getNumOfLabTests())).append(" / ").append(formatNumber(total.getNumOfLabTests())).append("\n");
sb.append("************************************").append("\n");
sb.append("データベース容量= ").append(total.getDbSize()).append("\n");
sb.append("IPアドレス= ").append(total.getBindAddress()).append("\n");
sb.append("\n");
sb.append("*** 集計期間数/総数 を表示").append("\n");
String body = sb.toString();
// Session
//Properties props = this.getGmailProperties();
Properties props = new Properties();
props.put("mail.smtp.host", config.getProperty("cloud.zero.mail.host"));
props.put("mail.smtp.auth", config.getProperty("cloud.zero.mail.auth"));
props.put("mail.smtp.port", config.getProperty("cloud.zero.mail.port"));
Session session = Session.getDefaultInstance(props,
new javax.mail.Authenticator() {
@Override
protected PasswordAuthentication getPasswordAuthentication() {
//return new PasswordAuthentication(GMAIL_ACCOUNT,GMAIL_PASSWD);
return new PasswordAuthentication(account, password);
//return new PasswordAuthentication("dolphin","dolphin");
}
});
// Message
javax.mail.internet.MimeMessage mimeMessage = new javax.mail.internet.MimeMessage(session);
// 差出人
mimeMessage.setFrom(new InternetAddress(mailFrom));
// 宛先
InternetAddress[] addressTo = new InternetAddress[1];
addressTo[0] = new InternetAddress(mailTo);
mimeMessage.setRecipients(javax.mail.Message.RecipientType.TO, addressTo);
// BCC
mimeMessage.addRecipients(RecipientType.BCC, DG_DOLPHIN_EMAIL_ADDRESS);
// Title
sb = new StringBuilder();
//sb.append(ACTIVITY_RESULT).append(this.reportDateFromDate(am.getFromDate())).append("-").append(am.getFacilityName());
sb.append(ACTIVITY_RESULT).append(this.reportDateFromDate(am.getFromDate())).append("-").append(total.getFacilityName());
mimeMessage.setSubject(sb.toString(), MAIL_ENC);
mimeMessage.setText(body, MAIL_ENC);
Transport.send(mimeMessage);
} catch (ResourceNotFoundException | ParseErrorException | MethodInvocationException | MessagingException e) {
e.printStackTrace(System.err);
Logger.getLogger("open.dolphin").warning(e.getMessage());
}
}
private Properties getGmailProperties() {
Properties props = new Properties();
props.put("mail.smtp.host", "smtp.gmail.com");
props.put("mail.smtp.socketFactory.port", "465");
props.put("mail.smtp.socketFactory.class","javax.net.ssl.SSLSocketFactory");
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.port", "465");
return props;
}
private Properties getMailProperties() {
Properties props = new Properties();
props.put("mail.smtp.host", "mails.lscc.co.jp");
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.port", "25");
return props;
}
private String targetDateFromDate(Date d) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy'年'MM'月'dd'日'");
return sdf.format(d);
}
private String reportDateFromDate(Date d) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy'年'MM'月'");
return sdf.format(d);
}
private String formatNumber(long num) {
NumberFormat nf = NumberFormat.getNumberInstance();
return nf.format(num);
}
//s.oh$
}
| dolphin-dev/OpenDolphin | server/src/main/java/open/dolphin/msg/OidSender.java |
64,819 | package kadai;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* Servlet implementation class kousinn
*/
public class kousinn extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public kousinn() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
response.setContentType("text/html; charset=UTF-8");
request.setCharacterEncoding("UTF-8");
String id = request.getParameter("list");
Connection conn = null;
String url = "jdbc:mysql://localhost/sample";
String user = "root";
String pass = "sazi6675";
try {
//データベースに接続
conn = DriverManager.getConnection(url, user, pass);
//表示
PrintWriter out = response.getWriter();
//SQL ステートメント・オブジェクトの作成
Statement stmt = conn.createStatement();
//SQL ステートメントの発行
String query = "SELECT * from sample.tbaddress where id = "+id;
ResultSet rs = stmt.executeQuery(query) ;
rs.next();
out.println("<html>");
out.println("<head>");
out.println("<title>" + "会員情報の更新/削除</title>");
out.println("<link rel=\"stylesheet\" type=\"text/css\" href=\"${pageContext.request.contextPath}/../servlet_css.css\">");
out.print("<SCRIPT language=\"JavaScript\">");
out.println("function numOnly() {");
out.println("var str =\"document.iform.AgeText.value;\"");
out.println("if(str.match( /[^0-9]+/ ) return false;");
out.println("return true;");
out.println("}");
out.println("</SCRIPT>");
out.println("</head>");
out.println("<body>");
out.println("<h1>"+ "更新</h1><br>");
int id2 = rs.getInt("id");
String name = rs.getString("name");
String address = rs.getString("address");
String tell = rs.getString("tel");
out.println("<p>"+"名前:" + name + "住所:" + address + "電話:" + tell+"</p>" );
out.println("<form action=\""+"/kadai01/change\" method=\"post\">");
out.println("<p>");
out.println("<label for=name> 氏名:</label>");
out.println("<input type=\"text\" name=\"name\">");
out.println("</p>");
out.println("<p>");
out.println("<label for=name> 住所:</label>");
out.println("<input type=\"text\" name=\"address\">");
out.println("</p>");
out.println("<p>");
out.println("<label for=name> 電話:</label>");
out.println("<input type=\"text\" name=\"tell\" maxlength=\"10\" onkeyDown=\"return numOnly()\">");
out.println("</p>");
out.println("<input type=\"hidden\" name=\"id\" value= " +id2+">");
out.println("<input type=\"submit\" value=\"更新\">");
out.println("<input type=\"reset\" value=\"リセット\">");
out.println("</form>");
out.println("<form action=\""+ "/kadai01/itirann\" method=\"post\">");
out.println("<input type=\"submit\" value=\"一覧表示\">");
out.println("</form>");
out.println("<form action=\""+ "/kadai01/sakujo \" method=\"post\">");
out.println("<input type=\"hidden\" name=\"id\" value= " +id2+">");
out.println("<input type=\"submit\" value=\"削除\">");
out.println("</form>");
out.println("</body>");
out.println("</html>");
//データベースのクローズ
rs.close();
stmt.close();
conn.close();
} catch (SQLException e) {
//表示
response.setContentType("text/html; charset=UTF-8");
PrintWriter out = response.getWriter();
out.println("例外発生:" + e );
System.out.println("例外発生:" + e);
}
}
}
| sep-dev/training | babatakumi/kadai01/src/kadai/kousinn.java |
64,820 | package com.example.android.recipe041;
import java.util.ArrayList;
import java.util.List;
import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.TextView;
public class Recipe041 extends Activity {
private static final String TAG = "Recipe041";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
// アイコン画像を生成
Bitmap defaultImage;
defaultImage = BitmapFactory.decodeResource(
getResources(), R.drawable.default_image);
// テストデータを作成
List<ListItem> list = new ArrayList<ListItem>();
ListItem item1 = new ListItem();
item1.image = defaultImage;
item1.name = "gabu";
item1.comment = "検索なら http://google.com/ がオススメ。";
list.add(item1);
ListItem item2 = new ListItem();
item2.image = defaultImage;
item2.name = "gabu";
item2.comment = "連絡先は [email protected] です!";
list.add(item2);
ListItem item3 = new ListItem();
item3.image = defaultImage;
item3.name = "gabu";
item3.comment = "電話 090-9999-9999";
list.add(item3);
ListItem item4 = new ListItem();
item4.image = defaultImage;
item4.name = "gabu";
item4.comment = "Address: 620 Eighth Avenue New York, NY 10018";
list.add(item4);
ListItem item5 = new ListItem();
item5.image = defaultImage;
item5.name = "gabu";
item5.comment = "日本表記だと?住所: 〒460-0031 愛知県名古屋市中区本丸1−1";
list.add(item5);
// ListItemAdapterを生成
ListItemAdapter adapter;
adapter = new ListItemAdapter(this, 0, list);
// ListViewにListItemAdapterをセット
ListView listView = (ListView) findViewById(R.id.ListView01);
listView.setAdapter(adapter);
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
ListView listView = (ListView) parent;
// ListItem item = (ListItem)listView.getSelectedItem(); // itemがnull
ListItem item = (ListItem)listView.getItemAtPosition(position);
Log.d(TAG, "選択されたアイテムのcomment=" + item.comment);
TextView textView = (TextView)view.findViewById(R.id.name);
Log.d(TAG, "選択されたViewのTextView(name)のtext=" + textView.getText());
}
});
listView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
Log.d(TAG, "onItemLongClick position=" + position);
// ちなみに、falseを返すとイベントが継続するのでonItemClickも呼び出されます。
return true;
}
});
}
} | gabu/AndroidSDK-RecipeBook | Recipe041-044/src/com/example/android/recipe041/Recipe041.java |
64,821 | package example.domain.model.employee;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
/**
* 電話番号
*/
public class PhoneNumber {
@NotBlank(message = "電話番号を入力してください")
@Pattern(regexp = "([0-9]{2,4}-[0-9]{2,4}-[0-9]{2,4})?", message = "xx-xxxx-xxxxの形式で入力してください")
@Size(min = 8, max = 13, message = "桁数は8桁以上13桁以下で入力してください")
String value = "";
public PhoneNumber() {
}
public PhoneNumber(String phoneNumber) {
value = phoneNumber;
}
@Override
public String toString() {
return value;
}
}
| system-sekkei/isolating-the-domain | src/main/java/example/domain/model/employee/PhoneNumber.java |
64,823 |
public class SmartPhone extends Mp3Player {
public void play() {
System.out.println("再生(ハイレゾ機能)");
}
public void stop() {
System.out.println("停止(ハイレゾ機能)");
}
public void next() {
System.out.println("次へ(ハイレゾ機能)");
}
public void back() {
System.out.println("戻る(ハイレゾ機能)");
}
public void call() {
System.out.println("電話");
}
public void mail() {
System.out.println("メール");
}
public void photo() {
System.out.println("写真");
}
public void internet() {
System.out.println("インターネット");
}
}
| keita-komoto/Iphone | src/SmartPhone.java |
64,824 | package com.fruitpay.comm.model;
import java.util.EnumMap;
import java.util.Map;
public class EnumMapOrder {
public static Map<Order, String> getOrderColEnumMap() {
Map<Order, String> map = new EnumMap<Order, String>(Order.class);
map.put(Order.orderStatus, "訂單狀態");
map.put(Order.programName, "品名");
map.put(Order.periodName, "週期");
map.put(Order.platformName, "平台");
map.put(Order.orderDate, "訂單日期");
map.put(Order.orderId, "訂單編號");
map.put(Order.shipmentTime, "配送時間");
map.put(Order.unlike, "不吃");
map.put(Order.receiveWay, "收貨方式");
map.put(Order.remark, "備註");
map.put(Order.payOnReceive, "貨到付款");
map.put(Order.receiverName, "收件人");
map.put(Order.receiverAddress, "地址");
map.put(Order.receiverCellphone, "手機");
map.put(Order.receiverHousePhone, "電話");
map.put(Order.email, "信箱");
map.put(Order.totalPrice, "售價");
map.put(Order.comingFrom, "得知我們");
map.put(Order.customerReponse, "客戶回應");
map.put(Order.name, "訂購人");
map.put(Order.cellphone, "訂購人手機");
map.put(Order.housePhone, "訂購人電話");
map.put(Order.coupons, "優惠券");
map.put(Order.receiptType, "發票類型");
map.put(Order.receiptTitle, "統編抬頭");
map.put(Order.receiptVatNumber, "統編");
map.put(Order.deliveryDay, "出貨日");
map.put(Order.programNum, "果物箱數量");
return map;
}
}
| willhsu0604/fruitpay | src/main/java/com/fruitpay/comm/model/EnumMapOrder.java |
64,825 | package com.ua.robot.homeWork17;
import java.util.*;
public class Main {
public static void main(String[] args) {
Map<String, List<String>> ukrMap = new HashMap<>();
ukrMap.put("привіт", List.of("hello", "hallo", "こんにちは"));
ukrMap.put("ручка", List.of("pen", "stift", "ペン"));
ukrMap.put("зошит", List.of("copybook", "heft", "お手本"));
ukrMap.put("телефон", List.of("phone", "telefon", "電話"));
ukrMap.put("ноутбук", List.of("laptop", "laptop", "ラップトップ"));
ukrMap.put("олівець", List.of("pencil", "bleistift", "鉛筆"));
ukrMap.put("слон", List.of("elephant", "elefant", "象"));
ukrMap.put("лев", List.of("lion", "löwe", "ライオン"));
ukrMap.put("робот", List.of("robot", "roboter", "ロボット"));
ukrMap.put("джава", List.of("java", "java", "ジャワ"));
Scanner scanner = new Scanner(System.in);
System.out.println("Впишіть слово: ");
String word = scanner.nextLine().toLowerCase();
System.out.println(ukrMap.get(word));
}
}
| Tarask2/firstProject | src/com/ua/robot/homeWork17/Main.java |
64,826 | package p000;
import java.util.function.Function;
/* renamed from: kma */
/* compiled from: :com.google.android.gms@[email protected] (120300-306758586) */
final class kma {
/* renamed from: a */
private static final bngx f24449a = bngx.m109363a(kpb.OTP_1, kpb.OTP_2, kpb.OTP_3, kpb.OTP_4, kpb.OTP_5, kpb.OTP_6, kpb.OTP_7, kpb.OTP_8);
/* renamed from: b */
private static final bngx f24450b = bngx.m109363a("one", "two", "three", "four", "five", "six", "seven", "eight");
/* renamed from: c */
private static kpd f24451c = null;
/* renamed from: d */
private static kkp f24452d = null;
/* renamed from: a */
private static koy m18146a(String str, int i) {
bxvd da = koy.f24646c.mo74144da();
if (da.f164950c) {
da.mo74035c();
da.f164950c = false;
}
koy koy = (koy) da.f164949b;
str.getClass();
koy.f24649b = str;
koy.f24648a = i;
return (koy) da.mo74062i();
}
/* renamed from: b */
private static koz m18152b(String str, int i) {
bxvd da = koz.f24650c.mo74144da();
if (da.f164950c) {
da.mo74035c();
da.f164950c = false;
}
koz koz = (koz) da.f164949b;
str.getClass();
koz.f24653b = str;
koz.f24652a = i;
return (koz) da.mo74062i();
}
/* renamed from: c */
private static kpf m18154c(String str, int i) {
bxvd da = kpf.f24737c.mo74144da();
if (da.f164950c) {
da.mo74035c();
da.f164950c = false;
}
kpf kpf = (kpf) da.f164949b;
str.getClass();
kpf.f24740b = str;
kpf.f24739a = i;
return (kpf) da.mo74062i();
}
/* renamed from: d */
private static kpg m18155d(String str, int i) {
bxvd da = kpg.f24741c.mo74144da();
if (da.f164950c) {
da.mo74035c();
da.f164950c = false;
}
kpg kpg = (kpg) da.f164949b;
str.getClass();
kpg.f24744b = str;
kpg.f24743a = i;
return (kpg) da.mo74062i();
}
/* renamed from: e */
private static kox m18156e(String str, int i) {
bxvd da = kox.f24642c.mo74144da();
if (da.f164950c) {
da.mo74035c();
da.f164950c = false;
}
kox kox = (kox) da.f164949b;
str.getClass();
kox.f24645b = str;
kox.f24644a = i;
return (kox) da.mo74062i();
}
/* renamed from: a */
private static kpa m18147a(int i, int i2) {
bxvd da = kpa.f24655c.mo74144da();
if (da.f164950c) {
da.mo74035c();
da.f164950c = false;
}
kpa kpa = (kpa) da.f164949b;
kpa.f24658b = i;
kpa.f24657a = i2;
return (kpa) da.mo74062i();
}
/* renamed from: b */
public static kpd m18153b(kkp kkp) {
bxvd da = kpd.f24723c.mo74144da();
if (da.f164950c) {
da.mo74035c();
da.f164950c = false;
}
((kpd) da.f164949b).f24726b = 10;
if (kkp.mo14594m()) {
m18151a(da, kkp);
}
return (kpd) da.mo74062i();
}
/* renamed from: a */
private static kpc m18148a(int i, int i2, int i3) {
bxvd da = kpc.f24718d.mo74144da();
if (da.f164950c) {
da.mo74035c();
da.f164950c = false;
}
kpc kpc = (kpc) da.f164949b;
kpc.f24721b = i;
kpc.f24722c = i2;
kpc.f24720a = i3;
return (kpc) da.mo74062i();
}
/* renamed from: a */
public static kpd m18149a(kkp kkp) {
String str;
String str2;
String str3;
String str4;
String str5;
String str6;
String str7;
String str8;
String str9;
String str10;
bxvd bxvd;
kpe kpe;
bxvd bxvd2;
if (kkp.mo14596o()) {
str9 = "search|^q$|query|qry|suche.*|搜索|探す|検索|recherch.*|busca|جستجو|искать|найти|поиск";
str8 = "verification|card.?identification|(security|card|cc).?code|security.?number|card.?pin|c-v-v|(cvn|cvv|cvc|csc|cvd|cid|ccv)(field)?|\\bcid\\b|security.?value";
str7 = "e.?mail|courriel|メールアドレス|Электронной.?Почты|邮件|邮箱|電郵地址|(?:이메일|전자.?우편|[Ee]-?mail)(.?주소)?|correo.*electr(o|ó)nico|ایمیل|پست.*الکترونیک";
str6 = "^name|full.?name|your.?name|customer.?name|bill.?name|ship.?name|name.*first.*last|firstandlastname|nombre.*y.*apellidos|^nom|お名前|氏名|^nome|姓名|성명|نام.*نام.*خانوادگی";
str5 = "first.*name|initials|fname|first$|given.*name|vorname|nombre|forename|prénom|prenom|名|nome|Имя|이름|نام";
str4 = "last.*name|lname|surname|last$|secondname|family.*name|nachname|apellido|famille|^nom|cognome|姓|morada|apelidos|surename|sobrenome|Фамилия|\\b성(?:[^명]|\\b)|نام.*خانوادگی";
str3 = "(?<!united )state|county|region|province|\\bland\\b|county|principality|都道府県|estado|provincia|область|省|地區|^시[·・]?도|استان";
str2 = "country|countries|país|pais|国|国家|국가|나라|کشور";
str = "year|^yy$|^yyyy$|ablaufdatum|gueltig|gültig|jahr|fecha|scadenza|有効期限|validade|Срок действия карты|年|有效期|date.*exp";
} else {
str = "year|^yy$|^yyyy$|ablaufdatum|gueltig|gültig|jahr|fecha|scadenza|有効期限|validade|Срок действия карты|年|有效期";
str2 = "country|countries|país|pais|国|国家|국가|나라";
str3 = "(?<!united )state|county|region|province|\\bland\\b|county|principality|都道府県|estado|provincia|область|省|地區|^시[·・]?도";
str4 = "last.*name|lname|surname|last$|secondname|family.*name|nachname|apellido|famille|^nom|cognome|姓|morada|apelidos|surename|sobrenome|Фамилия|\\b성(?:[^명]|\\b)";
str5 = "first.*name|initials|fname|first$|given.*name|vorname|nombre|forename|prénom|prenom|名|nome|Имя|이름";
str6 = "^name|full.?name|your.?name|customer.?name|bill.?name|ship.?name|name.*first.*last|firstandlastname|nombre.*y.*apellidos|^nom|お名前|氏名|^nome|姓名|성명";
str7 = "e.?mail|courriel|メールアドレス|Электронной.?Почты|邮件|邮箱|電郵地址|(?:이메일|전자.?우편|[Ee]-?mail)(.?주소)?";
str8 = "verification|card.?identification|(security|card|cc).?code|security.?number|card.?pin|c-v-v|(cvn|cvv|cvc|csc|cvd|cid|ccv)(field)?|\\bcid\\b";
str9 = "search";
}
bxvd da = kpe.f24727i.mo74144da();
kpb kpb = kpb.USERNAME;
if (da.f164950c) {
da.mo74035c();
da.f164950c = false;
}
((kpe) da.f164949b).f24729a = kpb.mo3214a();
da.mo74005a(m18146a("(user|sign.?in|log.?in|log.?on).?(name|id)|^user$", 10));
da.mo74006a(m18152b("(user|sign.?in|log.?in|log.?on).?(name|id)|^user$", 10));
da.mo74010a(m18154c("(user|sign.?in|log.?in|log.?on).?(name|id)|^user$", 10));
da.mo74005a(m18146a("^to($|[^a-z])|recipient|participant", -10000));
da.mo74006a(m18152b("^to($|[^a-z])|recipient|participant", -10000));
da.mo74010a(m18154c("^to($|[^a-z])|recipient|participant", -10000));
da.mo74005a(m18146a(str9, -10000));
da.mo74006a(m18152b(str9, -10000));
da.mo74010a(m18154c(str9, -10000));
if (kkp.mo14590i()) {
da.mo74005a(m18146a("^(John|Jane|Richard)$", -10000));
}
if (kkp.mo14576D()) {
da.mo74011a(m18155d("search", -10000));
}
bxvd da2 = kpe.f24727i.mo74144da();
kpb kpb2 = kpb.PASSWORD;
if (da2.f164950c) {
da2.mo74035c();
da2.f164950c = false;
}
((kpe) da2.f164949b).f24729a = kpb2.mo3214a();
da2.mo74005a(m18146a("pass.?word", 10));
da2.mo74006a(m18152b("pass.?word", 10));
da2.mo74010a(m18154c("pass.?word", 10));
da2.mo74011a(m18155d("password", 10));
da2.mo74007a(m18147a(129, 10));
da2.mo74007a(m18147a(225, 10));
da2.mo74005a(m18146a(str8, -10000));
da2.mo74006a(m18152b(str8, -10000));
da2.mo74010a(m18154c(str8, -10000));
if (kkp.mo14587g()) {
da2.mo74006a(m18152b("login.*(pw|psw|pass)", 5));
da2.mo74004a(m18156e("log.?in|sign.?in|sign.?up", 5));
da2.mo74007a(m18147a(18, 5));
} else {
da2.mo74007a(m18147a(18, 10));
}
if (kkp.mo14590i()) {
da2.mo74005a(m18146a("^([*●x])\\1{7,15}$", 5));
}
if (kkp.mo14592k()) {
da2.mo74005a(m18146a("(choose|confirm|create|new|pick|repeat|re.?enter|re.?type|set).*(password)|(confirm|nouveau).*(mot de passe)|password.*[0-9] char", -10000));
da2.mo74006a(m18152b("(change|confirm|choose|create|new|pick|re.?enter|repeat|sign.?up|verify)(?!.*current|.*old|.*original).*(pass|pwd|psw)|(pass|pwd|psw).*(change|confirm|choose|create|new|pick|repeat|signup)", -10000));
}
if (kkp.mo14574B()) {
str10 = str;
bxvd = da;
da2.mo74008a(m18148a(0, 3, -10000));
} else {
str10 = str;
bxvd = da;
}
bxvd da3 = kpe.f24727i.mo74144da();
kpb kpb3 = kpb.NEW_PASSWORD;
if (da3.f164950c) {
da3.mo74035c();
da3.f164950c = false;
}
((kpe) da3.f164949b).f24729a = kpb3.mo3214a();
da3.mo74005a(m18146a("(choose|confirm|create|new|pick|repeat|re.?enter|re.?type|set).*(password)|(confirm|nouveau).*(mot de passe)|password.*[0-9] char", 10));
da3.mo74006a(m18152b("(change|confirm|choose|create|new|pick|re.?enter|repeat|sign.?up|verify)(?!.*current|.*old|.*original).*(pass|pwd|psw)|(pass|pwd|psw).*(change|confirm|choose|create|new|pick|repeat|signup)", 10));
da3.mo74010a(m18154c("(change|confirm|choose|create|new|pick|re.?enter|repeat|sign.?up|verify)(?!.*current|.*old|.*original).*(pass|pwd|psw)|(pass|pwd|psw).*(change|confirm|choose|create|new|pick|repeat|signup)", 10));
kpe kpe2 = (kpe) da3.mo74062i();
bxvd da4 = kpe.f24727i.mo74144da();
kpb kpb4 = kpb.EMAIL_ADDRESS;
if (da4.f164950c) {
da4.mo74035c();
da4.f164950c = false;
}
((kpe) da4.f164949b).f24729a = kpb4.mo3214a();
da4.mo74005a(m18146a(str7, 10));
da4.mo74006a(m18152b(str7, 10));
da4.mo74010a(m18154c(str7, 10));
da4.mo74005a(m18146a("^to($|[^a-z])|recipient|participant", -10000));
da4.mo74006a(m18152b("^to($|[^a-z])|recipient|participant", -10000));
da4.mo74010a(m18154c("^to($|[^a-z])|recipient|participant", -10000));
da4.mo74005a(m18146a(str9, -10000));
da4.mo74006a(m18152b(str9, -10000));
da4.mo74010a(m18154c(str9, -10000));
if (kkp.mo14590i()) {
da4.mo74005a(m18146a("^([a-zA-Z0-9_\\-\\.]+)@([a-zA-Z0-9_\\-\\.]+)\\.([a-zA-Z]{2,5})$", 10));
}
if (kkp.mo14576D()) {
da4.mo74011a(m18155d("email", 5));
da4.mo74011a(m18155d("search", -10000));
}
bxvd da5 = kpe.f24727i.mo74144da();
kpb kpb5 = kpb.PHONE_NUMBER;
if (da5.f164950c) {
da5.mo74035c();
da5.f164950c = false;
}
((kpe) da5.f164949b).f24729a = kpb5.mo3214a();
da5.mo74005a(m18146a("phone|mobile|contact.?number|telefonnummer|telefono|teléfono|telfixe|電話|telefone|telemovel|телефон|电话|(?:전화|핸드폰|휴대폰|휴대전화)(?:.?번호)?", 10));
da5.mo74006a(m18152b("phone|mobile|contact.?number|telefonnummer|telefono|teléfono|telfixe|電話|telefone|telemovel|телефон|电话|(?:전화|핸드폰|휴대폰|휴대전화)(?:.?번호)?", 10));
da5.mo74010a(m18154c("phone|mobile|contact.?number|telefonnummer|telefono|teléfono|telfixe|電話|telefone|telemovel|телефон|电话|(?:전화|핸드폰|휴대폰|휴대전화)(?:.?번호)?", 10));
da5.mo74005a(m18146a("^to($|[^a-z])|recipient|participant", -10000));
da5.mo74006a(m18152b("^to($|[^a-z])|recipient|participant", -10000));
da5.mo74010a(m18154c("^to($|[^a-z])|recipient|participant", -10000));
da5.mo74005a(m18146a(str9, -10000));
da5.mo74006a(m18152b(str9, -10000));
da5.mo74010a(m18154c(str9, -10000));
da5.mo74010a(m18154c("quantity", -10000));
if (kkp.mo14590i()) {
da5.mo74005a(m18146a("(^| )(\\+\\d{1,3}\\s)\\(?\\d{3}\\)?[\\s.-]?\\d{3}[\\s.-]\\d{4}($| )|(^| )(\\+\\d{1,3}\\s)\\(?([_x#])\\6{2}\\)?[\\s.-]?\\6{3}[\\s.-]\\6{4}($| )", 10));
}
if (kkp.mo14576D()) {
da5.mo74011a(m18155d("tel", 3));
da5.mo74011a(m18155d("search", -10000));
if (kkp.mo14574B()) {
kpe = kpe2;
da5.mo74008a(m18148a(1, 5, -10000));
da5.mo74008a(m18148a(11, 15, 3));
} else {
kpe = kpe2;
}
} else {
kpe = kpe2;
}
bxvd da6 = kpe.f24727i.mo74144da();
kpb kpb6 = kpb.PHONE_NATIONAL;
if (da6.f164950c) {
da6.mo74035c();
da6.f164950c = false;
}
((kpe) da6.f164949b).f24729a = kpb6.mo3214a();
da6.mo74005a(m18146a("phone|mobile|contact.?number|telefonnummer|telefono|teléfono|telfixe|電話|telefone|telemovel|телефон|电话|(?:전화|핸드폰|휴대폰|휴대전화)(?:.?번호)?", 10));
da6.mo74006a(m18152b("phone|mobile|contact.?number|telefonnummer|telefono|teléfono|telfixe|電話|telefone|telemovel|телефон|电话|(?:전화|핸드폰|휴대폰|휴대전화)(?:.?번호)?", 10));
da6.mo74010a(m18154c("phone|mobile|contact.?number|telefonnummer|telefono|teléfono|telfixe|電話|telefone|telemovel|телефон|电话|(?:전화|핸드폰|휴대폰|휴대전화)(?:.?번호)?", 10));
da6.mo74005a(m18146a("^to($|[^a-z])|recipient|participant", -10000));
da6.mo74006a(m18152b("^to($|[^a-z])|recipient|participant", -10000));
da6.mo74010a(m18154c("^to($|[^a-z])|recipient|participant", -10000));
da6.mo74005a(m18146a(str9, -10000));
da6.mo74006a(m18152b(str9, -10000));
da6.mo74010a(m18154c(str9, -10000));
da6.mo74010a(m18154c("quantity", -10000));
if (kkp.mo14590i()) {
da6.mo74005a(m18146a("(^| )\\(?\\d{3}\\)?[\\s.-]?\\d{3}[\\s.-]\\d{4}($| )|(^| )\\(?([_x#])\\4{2}\\)?[\\s.-]?\\4{3}[\\s.-]\\4{4}($| )", 10));
da6.mo74005a(m18146a("(^| )(\\+\\d{1,3}\\s)\\(?\\d{3}\\)?[\\s.-]?\\d{3}[\\s.-]\\d{4}($| )|(^| )(\\+\\d{1,3}\\s)\\(?([_x#])\\6{2}\\)?[\\s.-]?\\6{3}[\\s.-]\\6{4}($| )", -10000));
}
if (kkp.mo14576D()) {
da6.mo74011a(m18155d("tel", 3));
da6.mo74011a(m18155d("search", -10000));
if (kkp.mo14574B()) {
da6.mo74008a(m18148a(1, 5, -10000));
da6.mo74008a(m18148a(10, 10, 3));
}
}
bxvd da7 = kpe.f24727i.mo74144da();
kpb kpb7 = kpb.PHONE_COUNTRY_CODE;
if (da7.f164950c) {
da7.mo74035c();
da7.f164950c = false;
}
((kpe) da7.f164949b).f24729a = kpb7.mo3214a();
if (kkp.mo14590i()) {
da7.mo74005a(m18146a("^\\+\\d{1,3}$", 10));
}
if (kkp.mo14576D()) {
da7.mo74011a(m18155d("search", -10000));
if (kkp.mo14574B()) {
bxvd2 = da6;
da7.mo74008a(m18148a(4, 15, -10000));
} else {
bxvd2 = da6;
}
} else {
bxvd2 = da6;
}
bxvd da8 = kpe.f24727i.mo74144da();
kpb kpb8 = kpb.PERSON_NAME;
if (da8.f164950c) {
da8.mo74035c();
da8.f164950c = false;
}
((kpe) da8.f164949b).f24729a = kpb8.mo3214a();
da8.mo74005a(m18146a(str6, 10));
da8.mo74006a(m18152b(str6, 10));
da8.mo74010a(m18154c(str6, 10));
da8.mo74005a(m18146a("user.?name|user.?id|nickname|maiden name|title|prefix|suffix|vollständiger.?name|用户名|(?:사용자.?)?아이디|사용자.?ID", -10000));
da8.mo74006a(m18152b("user.?name|user.?id|nickname|maiden name|title|prefix|suffix|vollständiger.?name|用户名|(?:사용자.?)?아이디|사용자.?ID", -10000));
da8.mo74010a(m18154c("user.?name|user.?id|nickname|maiden name|title|prefix|suffix|vollständiger.?name|用户名|(?:사용자.?)?아이디|사용자.?ID", -10000));
da8.mo74005a(m18146a("^to($|[^a-z])|recipient|participant", -10000));
da8.mo74006a(m18152b("^to($|[^a-z])|recipient|participant", -10000));
da8.mo74010a(m18154c("^to($|[^a-z])|recipient|participant", -10000));
da8.mo74005a(m18146a(str9, -10000));
da8.mo74006a(m18152b(str9, -10000));
da8.mo74010a(m18154c(str9, -10000));
if (kkp.mo14588h()) {
da8.mo74005a(m18146a("^([a-zA-Z0-9_\\-\\.]+)@([a-zA-Z0-9_\\-\\.]+)\\.([a-zA-Z]{2,5})$", -10000));
}
if (kkp.mo14590i()) {
da8.mo74005a(m18146a("^(John Doe|Jane Doe|John Appleseed|Richard Roe|Jane Roe|Lando Calrissian|Turanga Leela)$", 10));
}
if (kkp.mo14576D()) {
da8.mo74011a(m18155d("search", -10000));
}
bxvd da9 = kpe.f24727i.mo74144da();
kpb kpb9 = kpb.PERSON_NAME_GIVEN;
if (da9.f164950c) {
da9.mo74035c();
da9.f164950c = false;
}
((kpe) da9.f164949b).f24729a = kpb9.mo3214a();
da9.mo74005a(m18146a(str5, 10));
da9.mo74006a(m18152b(str5, 10));
da9.mo74010a(m18154c(str5, 10));
if (kkp.mo14590i()) {
da9.mo74005a(m18146a("^(John|Jane|Richard)$", 10));
da9.mo74005a(m18146a("^(John Doe|Jane Doe|John Appleseed|Richard Roe|Jane Roe|Lando Calrissian|Turanga Leela)$", -10000));
}
bxvd da10 = kpe.f24727i.mo74144da();
kpb kpb10 = kpb.PERSON_NAME_MIDDLE;
if (da10.f164950c) {
da10.mo74035c();
da10.f164950c = false;
}
((kpe) da10.f164949b).f24729a = kpb10.mo3214a();
da10.mo74005a(m18146a("middle.*name|mname|middle$|apellido.?materno|lastlastname", 10));
da10.mo74006a(m18152b("middle.*name|mname|middle$|apellido.?materno|lastlastname", 10));
da10.mo74010a(m18154c("middle.*name|mname|middle$|apellido.?materno|lastlastname", 10));
kpe kpe3 = (kpe) da10.mo74062i();
bxvd da11 = kpe.f24727i.mo74144da();
kpb kpb11 = kpb.PERSON_NAME_MIDDLE_INITAL;
if (da11.f164950c) {
da11.mo74035c();
da11.f164950c = false;
}
((kpe) da11.f164949b).f24729a = kpb11.mo3214a();
da11.mo74005a(m18146a("middle.*initial|m\\.i\\.|mi$|\\bmi\\b", 10));
da11.mo74006a(m18152b("middle.*initial|m\\.i\\.|mi$|\\bmi\\b", 10));
da11.mo74010a(m18154c("middle.*initial|m\\.i\\.|mi$|\\bmi\\b", 10));
kpe kpe4 = (kpe) da11.mo74062i();
bxvd da12 = kpe.f24727i.mo74144da();
kpb kpb12 = kpb.PERSON_NAME_FAMILY;
if (da12.f164950c) {
da12.mo74035c();
da12.f164950c = false;
}
((kpe) da12.f164949b).f24729a = kpb12.mo3214a();
da12.mo74005a(m18146a(str4, 10));
da12.mo74006a(m18152b(str4, 10));
da12.mo74010a(m18154c(str4, 10));
if (kkp.mo14590i()) {
da12.mo74005a(m18146a("^(Doe|Appleseed|Roe)$", 10));
da12.mo74005a(m18146a("^(John Doe|Jane Doe|John Appleseed|Richard Roe|Jane Roe|Lando Calrissian|Turanga Leela)$", -10000));
}
int i = !kkp.mo14588h() ? 10 : 9;
bxvd da13 = kpe.f24727i.mo74144da();
kpb kpb13 = kpb.POSTAL_ADDRESS_STREET_ADDRESS;
if (da13.f164950c) {
da13.mo74035c();
da13.f164950c = false;
}
((kpe) da13.f164949b).f24729a = kpb13.mo3214a();
da13.mo74005a(m18146a("address$|address.?line.?(1|one)|address1|addr1|street|(?:shipping|billing)address$|strasse|straße|hausnummer|housenumber|house.?name|direccion|dirección|adresse|indirizzo|^住所$|住所1|morada|endereço|Адрес|地址|^주소.?$|주소.?1", i));
da13.mo74006a(m18152b("address$|address.?line.?(1|one)|address1|addr1|street|(?:shipping|billing)address$|strasse|straße|hausnummer|housenumber|house.?name|direccion|dirección|adresse|indirizzo|^住所$|住所1|morada|endereço|Адрес|地址|^주소.?$|주소.?1", i));
da13.mo74010a(m18154c("address$|address.?line.?(1|one)|address1|addr1|street|(?:shipping|billing)address$|strasse|straße|hausnummer|housenumber|house.?name|direccion|dirección|adresse|indirizzo|^住所$|住所1|morada|endereço|Адрес|地址|^주소.?$|주소.?1", i));
da13.mo74005a(m18146a("address.?line.?(2|two)|address2|addr2|street2|suite|unit|adresszusatz|ergänzende.?angaben|direccion2|colonia|adicional|addresssuppl|complementnom|appartement|indirizzo2|住所2|complemento|addrcomplement|Улица|地址2|주소.?2", -10000));
da13.mo74006a(m18152b("address.?line.?(2|two)|address2|addr2|street2|suite|unit|adresszusatz|ergänzende.?angaben|direccion2|colonia|adicional|addresssuppl|complementnom|appartement|indirizzo2|住所2|complemento|addrcomplement|Улица|地址2|주소.?2", -10000));
da13.mo74010a(m18154c("address.?line.?(2|two)|address2|addr2|street2|suite|unit|adresszusatz|ergänzende.?angaben|direccion2|colonia|adicional|addresssuppl|complementnom|appartement|indirizzo2|住所2|complemento|addrcomplement|Улица|地址2|주소.?2", -10000));
bxvd da14 = kpe.f24727i.mo74144da();
kpb kpb14 = kpb.POSTAL_ADDRESS_EXTENDED_ADDRESS;
kpe kpe5 = (kpe) da13.mo74062i();
if (da14.f164950c) {
da14.mo74035c();
da14.f164950c = false;
}
((kpe) da14.f164949b).f24729a = kpb14.mo3214a();
da14.mo74005a(m18146a("address.?line.?(2|two)|address2|addr2|street2|suite|unit|adresszusatz|ergänzende.?angaben|direccion2|colonia|adicional|addresssuppl|complementnom|appartement|indirizzo2|住所2|complemento|addrcomplement|Улица|地址2|주소.?2", 10));
da14.mo74006a(m18152b("address.?line.?(2|two)|address2|addr2|street2|suite|unit|adresszusatz|ergänzende.?angaben|direccion2|colonia|adicional|addresssuppl|complementnom|appartement|indirizzo2|住所2|complemento|addrcomplement|Улица|地址2|주소.?2", 10));
da14.mo74010a(m18154c("address.?line.?(2|two)|address2|addr2|street2|suite|unit|adresszusatz|ergänzende.?angaben|direccion2|colonia|adicional|addresssuppl|complementnom|appartement|indirizzo2|住所2|complemento|addrcomplement|Улица|地址2|주소.?2", 10));
kpe kpe6 = (kpe) da14.mo74062i();
bxvd da15 = kpe.f24727i.mo74144da();
kpb kpb15 = kpb.POSTAL_ADDRESS_LOCALITY;
if (da15.f164950c) {
da15.mo74035c();
da15.f164950c = false;
}
((kpe) da15.f164949b).f24729a = kpb15.mo3214a();
kpe kpe7 = kpe6;
da15.mo74005a(m18146a("city|town|\\bort\\b|stadt|suburb|ciudad|provincia|localidad|poblacion|ville|commune|localita|市区町村|cidade|Город|市|分區|^시[^도·・]|시[·・]?군[·・]?구", 10));
da15.mo74006a(m18152b("city|town|\\bort\\b|stadt|suburb|ciudad|provincia|localidad|poblacion|ville|commune|localita|市区町村|cidade|Город|市|分區|^시[^도·・]|시[·・]?군[·・]?구", 10));
da15.mo74010a(m18154c("city|town|\\bort\\b|stadt|suburb|ciudad|provincia|localidad|poblacion|ville|commune|localita|市区町村|cidade|Город|市|分區|^시[^도·・]|시[·・]?군[·・]?구", 10));
kpe kpe8 = (kpe) da15.mo74062i();
bxvd da16 = kpe.f24727i.mo74144da();
kpb kpb16 = kpb.POSTAL_ADDRESS_REGION;
if (da16.f164950c) {
da16.mo74035c();
da16.f164950c = false;
}
((kpe) da16.f164949b).f24729a = kpb16.mo3214a();
da16.mo74005a(m18146a(str3, 10));
da16.mo74006a(m18152b(str3, 10));
da16.mo74010a(m18154c(str3, 10));
kpe kpe9 = (kpe) da16.mo74062i();
bxvd da17 = kpe.f24727i.mo74144da();
kpb kpb17 = kpb.POSTAL_ADDRESS_POSTAL_CODE;
if (da17.f164950c) {
da17.mo74035c();
da17.f164950c = false;
}
((kpe) da17.f164949b).f24729a = kpb17.mo3214a();
kpe kpe10 = kpe9;
da17.mo74005a(m18146a("zip|postal|post.*code|pcode|pin.?code|postleitzahl|\\bcp\\b|\\bcdp\\b|\\bcap\\b|郵便番号|codigo|codpos|\\bcep\\b|Почтовый.?Индекс|邮政编码|邮编|郵遞區號|우편.?번호", 10));
da17.mo74006a(m18152b("zip|postal|post.*code|pcode|pin.?code|postleitzahl|\\bcp\\b|\\bcdp\\b|\\bcap\\b|郵便番号|codigo|codpos|\\bcep\\b|Почтовый.?Индекс|邮政编码|邮编|郵遞區號|우편.?번호", 10));
da17.mo74010a(m18154c("zip|postal|post.*code|pcode|pin.?code|postleitzahl|\\bcp\\b|\\bcdp\\b|\\bcap\\b|郵便番号|codigo|codpos|\\bcep\\b|Почтовый.?Индекс|邮政编码|邮编|郵遞區號|우편.?번호", 10));
kpe kpe11 = (kpe) da17.mo74062i();
bxvd da18 = kpe.f24727i.mo74144da();
kpb kpb18 = kpb.POSTAL_ADDRESS_COUNTRY;
if (da18.f164950c) {
da18.mo74035c();
da18.f164950c = false;
}
((kpe) da18.f164949b).f24729a = kpb18.mo3214a();
da18.mo74005a(m18146a(str2, 10));
da18.mo74006a(m18152b(str2, 10));
da18.mo74010a(m18154c(str2, 10));
kpe kpe12 = (kpe) da18.mo74062i();
bxvd da19 = kpe.f24727i.mo74144da();
kpb kpb19 = kpb.PAYMENT_CARD_NUMBER;
if (da19.f164950c) {
da19.mo74035c();
da19.f164950c = false;
}
((kpe) da19.f164949b).f24729a = kpb19.mo3214a();
kpe kpe13 = kpe11;
da19.mo74005a(m18146a("(add)?(?:card|cc|acct).?(?:number|#|no|num|field)|nummer|credito|numero|número|numéro|カード番号|Номер.*карты|信用卡号|信用卡号码|信用卡卡號|카드", 10));
da19.mo74006a(m18152b("(add)?(?:card|cc|acct).?(?:number|#|no|num|field)|nummer|credito|numero|número|numéro|カード番号|Номер.*карты|信用卡号|信用卡号码|信用卡卡號|카드", 10));
da19.mo74010a(m18154c("(add)?(?:card|cc|acct).?(?:number|#|no|num|field)|nummer|credito|numero|número|numéro|カード番号|Номер.*карты|信用卡号|信用卡号码|信用卡卡號|카드", 10));
if (kkp.mo14590i()) {
da19.mo74005a(m18146a("^\\d{4}[\\s-]\\d{4,6}?[\\s-]\\d{4,5}[\\s-]?(\\d{0}|\\d{4})$|^[x]{4}[\\s-][x]{4,6}?[\\s-][x]{4,5}[\\s-]?([x]{0}|[x]{4})$", 10));
}
bxvd da20 = kpe.f24727i.mo74144da();
kpb kpb20 = kpb.PAYMENT_CARD_HOLDER_NAME;
if (da20.f164950c) {
da20.mo74035c();
da20.f164950c = false;
}
((kpe) da20.f164949b).f24729a = kpb20.mo3214a();
bxvd bxvd3 = da19;
da20.mo74005a(m18146a("card.?(?:holder|owner)|name.*(\\b)?on(\\b)?.*card|(?:card|cc).?name|cc.?full.?name|karteninhaber|nombre.*tarjeta|nom.*carte|nome.*cart|名前|Имя.*карты|信用卡开户名|开户名|持卡人姓名|持卡人姓名", 10));
da20.mo74006a(m18152b("card.?(?:holder|owner)|name.*(\\b)?on(\\b)?.*card|(?:card|cc).?name|cc.?full.?name|karteninhaber|nombre.*tarjeta|nom.*carte|nome.*cart|名前|Имя.*карты|信用卡开户名|开户名|持卡人姓名|持卡人姓名", 10));
da20.mo74010a(m18154c("card.?(?:holder|owner)|name.*(\\b)?on(\\b)?.*card|(?:card|cc).?name|cc.?full.?name|karteninhaber|nombre.*tarjeta|nom.*carte|nome.*cart|名前|Имя.*карты|信用卡开户名|开户名|持卡人姓名|持卡人姓名", 10));
kpe kpe14 = (kpe) da20.mo74062i();
bxvd da21 = kpe.f24727i.mo74144da();
kpb kpb21 = kpb.PAYMENT_CARD_CVN;
if (da21.f164950c) {
da21.mo74035c();
da21.f164950c = false;
}
((kpe) da21.f164949b).f24729a = kpb21.mo3214a();
da21.mo74005a(m18146a(str8, 10));
da21.mo74006a(m18152b(str8, 10));
da21.mo74010a(m18154c(str8, 10));
if (kkp.mo14590i()) {
da21.mo74005a(m18146a("^\\d{3}$|^([*x_])\\1{2}$", 4));
}
if (kkp.mo14574B()) {
da21.mo74008a(m18148a(7, 10, -10000));
}
if (kkp.mo14575C()) {
da21.mo74005a(m18146a("otp|((^|\\D)\\d\\D+digit|sms|verif)(?!.*pin).*code|Nhập mã xác", -10000));
}
bxvd da22 = kpe.f24727i.mo74144da();
kpb kpb22 = kpb.PAYMENT_CARD_EXPIRATION_MONTH;
if (da22.f164950c) {
da22.mo74035c();
da22.f164950c = false;
}
((kpe) da22.f164949b).f24729a = kpb22.mo3214a();
bxvd bxvd4 = da21;
da22.mo74005a(m18146a("exp.*mo|month|^mm$|gueltig|gültig|monat|fecha|date.*exp|scadenza|有効期限|validade|Срок действия карты|月", 10));
da22.mo74006a(m18152b("exp.*mo|month|^mm$|gueltig|gültig|monat|fecha|date.*exp|scadenza|有効期限|validade|Срок действия карты|月", 10));
da22.mo74010a(m18154c("exp.*mo|month|^mm$|gueltig|gültig|monat|fecha|date.*exp|scadenza|有効期限|validade|Срок действия карты|月", 10));
kpe kpe15 = (kpe) da22.mo74062i();
bxvd da23 = kpe.f24727i.mo74144da();
kpb kpb23 = kpb.PAYMENT_CARD_EXPIRATION_YEAR;
if (da23.f164950c) {
da23.mo74035c();
da23.f164950c = false;
}
((kpe) da23.f164949b).f24729a = kpb23.mo3214a();
kpe kpe16 = kpe15;
da23.mo74005a(m18146a(str10, 10));
da23.mo74006a(m18152b(str10, 10));
da23.mo74010a(m18154c(str10, 10));
kpe kpe17 = (kpe) da23.mo74062i();
bxvd da24 = kpe.f24727i.mo74144da();
kpb kpb24 = kpb.PAYMENT_CARD_EXPIRATION_DATE;
if (da24.f164950c) {
da24.mo74035c();
da24.f164950c = false;
}
((kpe) da24.f164949b).f24729a = kpb24.mo3214a();
da24.mo74005a(m18146a("expir|exp.*date|^expfield$|gueltig|gültig|fecha|date.*exp|scadenza|有効期限|validade|Срок действия карты", 10));
da24.mo74006a(m18152b("expir|exp.*date|^expfield$|gueltig|gültig|fecha|date.*exp|scadenza|有効期限|validade|Срок действия карты", 10));
da24.mo74010a(m18154c("expir|exp.*date|^expfield$|gueltig|gültig|fecha|date.*exp|scadenza|有効期限|validade|Срок действия карты", 10));
if (kkp.mo14590i()) {
da24.mo74005a(m18146a("(^| )mm.?(yy|yyyy)($| )", 10));
}
int i2 = !kkp.mo14588h() ? 10 : 8;
bxvd da25 = kpd.f24723c.mo74144da();
int i3 = i2;
da25.mo74042d(bxvd);
da25.mo74042d(da2);
da25.mo74042d(da4);
da25.mo74042d(da5);
da25.mo74042d(bxvd2);
da25.mo74042d(da7);
da25.mo74042d(da8);
da25.mo74042d(da9);
da25.mo74009a(kpe3);
da25.mo74009a(kpe4);
da25.mo74042d(da9);
da25.mo74042d(da12);
da25.mo74009a(kpe5);
da25.mo74009a(kpe7);
da25.mo74009a(kpe8);
da25.mo74009a(kpe10);
da25.mo74009a(kpe12);
da25.mo74009a(kpe13);
da25.mo74042d(bxvd3);
da25.mo74009a(kpe14);
da25.mo74042d(bxvd4);
da25.mo74009a(kpe16);
da25.mo74009a(kpe17);
da25.mo74042d(da24);
if (da25.f164950c) {
da25.mo74035c();
da25.f164950c = false;
}
((kpd) da25.f164949b).f24726b = i3;
if (kkp.mo14592k()) {
da25.mo74009a(kpe);
}
if (kkp.mo14594m()) {
m18151a(da25, kkp);
}
return (kpd) da25.mo74062i();
}
/* renamed from: a */
public static kpd m18150a(kkp kkp, boolean z) {
Function function;
kpd a = kkp.mo14580a();
if (!a.f24725a.isEmpty()) {
return a;
}
if (!z) {
function = klz.f24448a;
} else {
function = kly.f24447a;
}
if (kkp.mo14598q()) {
if (!kkp.equals(f24452d) || f24451c == null) {
f24451c = (kpd) function.apply(kkp);
}
f24452d = kkp;
return f24451c;
}
f24452d = null;
f24451c = null;
return (kpd) function.apply(kkp);
}
/* renamed from: a */
private static void m18151a(bxvd bxvd, kkp kkp) {
bxvd da = kpe.f24727i.mo74144da();
kpb kpb = kpb.OTP_FULL;
if (da.f164950c) {
da.mo74035c();
da.f164950c = false;
}
((kpe) da.f164949b).f24729a = kpb.mo3214a();
da.mo74005a(m18146a("otp|((^|\\D)\\d\\D+digit|sms|verif)(?!.*pin).*code|Nhập mã xác", 10));
da.mo74006a(m18152b("(?<!forg)otp(?!.*anel|.*one|.*two|.*three|.*four|.*five|.*six|.*seven|.*eight|.*\\d)|(sms|verif).*code", 10));
da.mo74010a(m18154c("(?<!forg)otp(?!.*anel|.*one|.*two|.*three|.*four|.*five|.*six|.*seven|.*eight|.*\\d)|(sms|verif).*code", 10));
da.mo74004a(m18156e("mail", -10000));
if (kkp.mo14574B()) {
da.mo74008a(m18148a(2, 10, 2));
da.mo74008a(m18148a(1, 1, -10000));
}
if (kkp.mo14575C()) {
da.mo74005a(m18146a("enter.?code", 5));
da.mo74010a(m18154c("enter.?code", 5));
}
bngs j = bngx.m109377j();
int i = 0;
while (i < f24449a.size()) {
bxvd da2 = kpe.f24727i.mo74144da();
kpb kpb2 = (kpb) f24449a.get(i);
if (da2.f164950c) {
da2.mo74035c();
da2.f164950c = false;
}
((kpe) da2.f164949b).f24729a = kpb2.mo3214a();
i++;
da2.mo74006a(m18152b(String.format("(otp|auth|pass).*((\\D%d(\\D|$))|%s)", Integer.valueOf(i), f24450b.get(i - 1)), 10));
if (kkp.mo14574B()) {
da2.mo74008a(m18148a(1, 1, 10));
da2.mo74008a(m18148a(2, Integer.MAX_VALUE, -10000));
}
j.mo67668c((kpe) da2.mo74062i());
}
bxvd.mo74042d(da);
bngx a = j.mo67664a();
if (bxvd.f164950c) {
bxvd.mo74035c();
bxvd.f164950c = false;
}
kpd kpd = (kpd) bxvd.f164949b;
kpd kpd2 = kpd.f24723c;
kpd.mo14761a();
bxsy.m123078a(a, kpd.f24725a);
}
}
| Romern/gms_decompiled | sources/p000/kma.java |
64,827 | package HW7;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
public class Homework7 {
public static void main(String[] args) {
new Q7_1().exec();
}
}
/**
* <pre>
*
*
* 今天各位要準備開一家飲料店
* 請使用物件導向方式
* 設計出以下幾個類別以及簡潔的點餐系統
*
* 1.點餐系統
* 2.訂單查詢
* 3.飲料維護 (進階)
* 4.飲料統計 (進階)
* 5.點餐修改 (進階)
*
* 飲料 : 要有"基本說明","材料","容量","卡洛里"與"價格"
*
* 飲料調整方式 : 飲料基本上會有"冰塊","甜度","大杯中杯"
* 的調整,請思考一下,如何搭配飲料類別去實作?
*
* 菜單 : 裡面需要包含一些基本飲料
* (建議一開始,自己初始化ㄧ些飲料)
*
* 點餐系統 : 1.使用者執行這個程式後
* 看到一個簡單的飲料清單
*
* 2.使用者開始點餐,需要記錄使用者點了甚麼飲料
* 還有冰塊,糖度,等等
*
* 3.點餐完畢,顯示使用者點完的結果
*
* 訂單查詢 : 我們需要一個訂單查詢系統
* 我們需要產生訂單號碼,使用者的姓名與電話
* 並紀錄點了多少飲料
*
* -----------------------------------------------
*
* 進階題
* 飲料統計 : 每次點餐完畢之後,可以根據功能選項
* 看到總共賣出多少飲料,消費總金額
* 以及統計每杯飲料點的數量
*
* 飲料維護 : 可以在維護介面新增飲料與修改
*
* 點餐修改 : 可以在這個選項裡,新增、修改、刪除客人的訂單
*
* Hit : 需要看到繼承,多型,封裝這三種物件導向基礎的類別設計
* </pre>
*/
class Q7_1 {
// 建立一個drinkInfo
Map<String, Drink> drinkInfo;
// 建立訂單資料
LinkedList<Order> orders;
// 執行
public void exec() {
genDrinkInfo();
genDefaultOrders();
genOrderSystem();
}
private void genDrinkInfo(){
drinkInfo = new GenDrinkInfo().initdrinkData();
for (String key : drinkInfo.keySet()) {
System.out.println(drinkInfo.get(key).toString());
}
}
private void genDefaultOrders() {
orders = new LinkedList<Order>();
}
private void genOrderSystem(){
boolean system = true;
while(system){
System.out.println("--------------------");
System.out.println("飲料點餐系統");
Scanner scanner = new Scanner(System.in);
System.out.println("1.點餐系統,請按1");
System.out.println("2.訂單查詢,請按2");
System.out.println("3.飲料維護,請按3");
System.out.println("4.飲料統計,請按4");
System.out.println("5.修改飲料,請按5");
System.out.println("0.結束功能,請按0");
System.out.print("請輸入要執行的功能:");
if(!scanner.hasNextInt()){
System.out.println("輸入錯誤,重新開始\n");
continue;
}
int functionFlag = Integer.parseInt(scanner.next());
System.out.println("--------------------");
switch(functionFlag){
case 1:
orderDrink();
break;
case 2:
orderQuery();
break;
case 3:
adjDrink();
break;
case 4:
drinkStat();
case 5:
drinkChange();
break;
case 0:
system = false;
System.out.println("飲料點餐系統結束");
break;
default:
System.out.println("您尚未選取到任何功能,請重新開始");
break;
}
}
}
private void drinkChange() {
System.out.println("--------------------");
boolean drinkStat = true;
while(drinkStat){
Scanner scanner = new Scanner(System.in);
System.out.println("5.1 您進入點餐介面");
System.out.println("1 : 選擇訂單編號,修改訂單");
System.out.println("0 : 離開");
System.out.print("請選擇你要的維護功能(1~0):");
String input = scanner.next();
if("01".indexOf(input) < 0){
System.out.println("請選擇正確的功能");
}
if("0".equals(input)){
System.out.println("5.1 結束");
System.out.println("-------------------");
drinkStat = false;
break;
}
int functionFlag = Integer.parseInt(input);
switch(functionFlag){
case 1:
for(int index = 0 ; index < orders.size() ; index++){
System.out.println(orders.get(index).toString());
}
System.out.print("請輸入要修改的訂單編號:");
input = scanner.next();
boolean checkNo = false;
for(Order data : orders){
if(input.equals(data.getNo())){
System.out.println(data.toString());
checkNo = true;
}
}
if(!checkNo){
System.out.println("查無資料!!");
break;
}
String no = input;
System.out.println("1:修改飲料內容");
System.out.println("2:刪除飲料");
System.out.println("3:加點");
System.out.println("0:離開");
System.out.println("請選擇以上功能:");
input = scanner.next();
if("0123".indexOf(input) < 0){
System.out.println("請選擇正確的功能");
}
if("0".equals(input)){
System.out.println("5.1 結束");
System.out.println("-------------------");
drinkStat = false;
break;
}
Order order = orders.get(Integer.parseInt(no)-1);
switch(input){
case "1":
System.out.println(order.printDrinks());
System.out.println("請輸入要修改的飲料編號:");
input = scanner.next();
if(order.getDrinks().get(Integer.parseInt(input)-1)==null){
System.out.println("查無資料!!");
break;
}
// 顯示飲料清單
int orderDrinkNo = Integer.parseInt(input)-1;
System.out.println("-------------------");
boolean settingDrinkSystem = true;
while(settingDrinkSystem){
Map<String, Drink> drinkInfoDetail = drinkInfo;
drinkInfoDetail.get(order.getDrinks().get(orderDrinkNo).getProdNumber());
boolean isTheProdNumber = false;
for(String key : drinkInfoDetail.keySet()){
if(input.equals(key)){
isTheProdNumber = true;
break;
}
}
if(!isTheProdNumber){
System.out.println("請選擇正確的飲料");
continue;
}
System.out.println("--------------------");
// 根據編號取得飲料,開始設定冰塊,糖度,etc...
Drink drink = drinkInfoDetail.get(input);
System.out.print("糖度(全糖:1,七分糖:2,五分糖:3,三分糖:4,無糖:5)(離開請按0):");
String sugar = scanner.next();
if("0".equals(sugar)){
System.out.println("取消點餐");
drinkStat = false;
break;
}
if("12345".indexOf(sugar) < 0){
System.out.println("請選擇正確的糖度");
continue;
}
System.out.print("冷熱(冷:1,熱:2)(離開請按0):");
String hot = scanner.next();
if("0".equals(hot)){
System.out.println("取消點餐");
drinkStat = false;
break;
}
if("12".indexOf(hot) < 0){
System.out.println("請選擇正確的冷熱");
continue;
}
String ice = "";
if("1".equals(hot)){
System.out.print("冰量(正常冰:1,少冰:2,微冰:3,去冰:4)(離開請按0):");
ice = scanner.next();
if("0".equals(ice)){
System.out.println("取消點餐");
drinkStat = false;
break;
}
if("1234".indexOf(ice) < 0){
System.out.println("請選擇正確的冰量");
continue;
}
}
System.out.print("幾杯(數字)(離開請按0):");
String strNumber = scanner.next();
if("0".equals(strNumber)){
System.out.println("取消點餐");
drinkStat = false;
break;
}
if(Integer.parseInt(strNumber) <= 0 ){
System.out.println("請選擇正確的杯數");
continue;
}
drink.setting(sugar , (hot.equals("1") ? false : true) , ice , Integer.parseInt(strNumber));
order.getDrinks().remove(orderDrinkNo);
order.getDrinks().add(drink);
break;
}
case "2":
System.out.println(order.printDrinks());
System.out.println("請輸入要刪除的飲料編號:");
input = scanner.next();
if(order.getDrinks().get(Integer.parseInt(input)-1)==null){
System.out.println("查無資料!!");
break;
}
order.getDrinks().remove(Integer.parseInt(input)-1);
break;
case "3":
// 顯示飲料清單
System.out.println("-------------------");
System.out.println("以下是飲料清單,請根據下方清單進行點選");
List<Drink> drinks = new LinkedList<Drink>();
boolean settingDrinkSystemTwo = true;
while(settingDrinkSystemTwo){
Map<String, Drink> drinkInfoDetail = drinkInfo;
for(String key : drinkInfoDetail.keySet()){
System.out.println("編號 : " + drinkInfoDetail.get(key).getProdNumber()+
" 飲料 : " + drinkInfoDetail.get(key).getName() +
" 大小 : " + drinkInfoDetail.get(key).getBigsmall() +
" 價格 : " + drinkInfoDetail.get(key).getPrice());
}
System.out.print("請選擇飲料編號(離開請按0):");
input = scanner.next();
if("0".equals(input)){
System.out.println("取消點餐");
drinkStat = false;
break;
}
boolean isTheProdNumber = false;
for(String key : drinkInfoDetail.keySet()){
if(input.equals(key)){
isTheProdNumber = true;
break;
}
}
if(!isTheProdNumber){
System.out.println("請選擇正確的飲料");
continue;
}
System.out.println("--------------------");
// 根據編號取得飲料,開始設定冰塊,糖度,etc...
Drink drink = drinkInfoDetail.get(input);
System.out.print("糖度(全糖:1,七分糖:2,五分糖:3,三分糖:4,無糖:5)(離開請按0):");
String sugar = scanner.next();
if("0".equals(sugar)){
System.out.println("取消點餐");
drinkStat = false;
break;
}
if("12345".indexOf(sugar) < 0){
System.out.println("請選擇正確的糖度");
continue;
}
System.out.print("冷熱(冷:1,熱:2)(離開請按0):");
String hot = scanner.next();
if("0".equals(hot)){
System.out.println("取消點餐");
drinkStat = false;
break;
}
if("12".indexOf(hot) < 0){
System.out.println("請選擇正確的冷熱");
continue;
}
String ice = "";
if("1".equals(hot)){
System.out.print("冰量(正常冰:1,少冰:2,微冰:3,去冰:4)(離開請按0):");
ice = scanner.next();
if("0".equals(ice)){
System.out.println("取消點餐");
drinkStat = false;
break;
}
if("1234".indexOf(ice) < 0){
System.out.println("請選擇正確的冰量");
continue;
}
}
System.out.print("幾杯(數字)(離開請按0):");
String strNumber = scanner.next();
if("0".equals(strNumber)){
System.out.println("取消點餐");
drinkStat = false;
break;
}
if(Integer.parseInt(strNumber) <= 0 ){
System.out.println("請選擇正確的杯數");
continue;
}
drink.setting(sugar , (hot.equals("1") ? false : true) , ice , Integer.parseInt(strNumber));
drinks.add(drink);
System.out.print("是否還需要繼續點餐? (1:繼續 , 0:離開) : ");
String isOrderAgain = scanner.next();
if("1".indexOf(isOrderAgain) == 0){
System.out.println("(繼續點餐)");
System.out.println("-------------------");
continue;
} else {
order.setNo(String.valueOf(orders.size() + 1));
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd-HH:mm:ss:SSS");
order.setOrderDate(sdf.format(new Date()));
order.setDrinks(drinks);
orders.add(order);
System.out.println("(點餐完畢)");
System.out.println("-------------------");
System.out.println(order.toString());
settingDrinkSystem = false;
settingDrinkSystemTwo = false;
}
break;
}
}
System.out.println("重新修改後的點餐內容");
System.out.println(order.printDrinks());
System.out.println("-------------------------");
break;
case 0:
System.out.println("5.1 結束");
System.out.println("-------------------");
drinkStat = false;
break;
}
System.out.println("--------------------");
}
}
private void drinkStat() {
System.out.println("--------------------");
System.out.println("4.1 您進入飲料統計介面");
boolean drinkStat = true;
while(drinkStat){
Scanner scanner = new Scanner(System.in);
System.out.println("1 : 統計每份飲料總數量與金額");
System.out.println("0 : 離開");
System.out.print("請選擇你要的維護功能(1):");
String input = scanner.next();
if("01".indexOf(input) < 0){
System.out.println("請選擇正確的功能");
}
if("0".equals(input)){
System.out.println("4.1 結束");
System.out.println("-------------------");
drinkStat = false;
break;
}
int functionFlag = Integer.parseInt(input);
switch(functionFlag){
case 1:
Map<String, Drink> drinkStatData = new GenDrinkInfo().initdrinkData();
for(Order order : orders){
for(Drink drink :order.getDrinks()){
if(drinkStatData.get(drink.getProdNumber())!=null){
Drink info = drinkStatData.get(drink.getProdNumber());
info.setNumber(info.getNumber() + drink.getNumber());
}
}
}
for(String key : drinkStatData.keySet()){
Drink info = drinkStatData.get(key);
System.out.println("飲料:"+info.getName() +
" 杯數:" + info.getNumber() +
" 總金額:"+ (info.getPrice() * info.getNumber()));
}
break;
case 0:
System.out.println("4.1 結束");
System.out.println("-------------------");
drinkStat = false;
break;
}
System.out.println("--------------------");
}
}
private void adjDrink() {
System.out.println("--------------------");
System.out.println("3.1 您進入飲料維護介面");
boolean adjDrink = true;
while(adjDrink){
Scanner scanner = new Scanner(System.in);
System.out.println("1 : 新增飲料");
System.out.println("2 : 調整飲料");
System.out.println("3 : 移除飲料");
System.out.println("4 : 查詢目前的飲料");
System.out.println("0 : 離開");
System.out.print("請選擇你要的維護功能(1~3):");
String input = scanner.next();
if("0123".indexOf(input) < 0){
System.out.println("請選擇正確的功能");
}
if("0".equals(input)){
System.out.println("3.1 維護結束");
System.out.println("-------------------");
adjDrink = false;
break;
}
int functionFlag = Integer.parseInt(input);
switch(functionFlag){
case 1:
// drink.put("1", new Drink("1" , DrinkName.大正紅茶.getName() , "茶葉 原產地:印度", "茶葉" , "L" , 30 , "700", "140"));
System.out.print("請輸入飲料的名稱(離開請按0):");
String name = scanner.next();
if("0".equals(name)){
System.out.println("取消設定");
break;
}
System.out.print("請輸入飲料的說明(離開請按0):");
String desc = scanner.next();
if("0".equals(desc)){
System.out.println("取消設定");
break;
}
System.out.print("請輸入飲料的原料(離開請按0):");
String raw = scanner.next();
if("0".equals(raw)){
System.out.println("取消設定");
break;
}
System.out.print("請輸入飲料的大小杯(離開請按0):");
String bigSmall = scanner.next();
if("0".equals(bigSmall)){
System.out.println("取消設定");
break;
}
System.out.print("請輸入飲料的價格(離開請按0):");
String price = scanner.next();
if("0".equals(price)){
System.out.println("取消設定");
break;
}
System.out.print("請輸入飲料的容量(離開請按0):");
String ml = scanner.next();
if("0".equals(ml)){
System.out.println("取消設定");
break;
}
System.out.print("請輸入飲料的卡洛里(離開請按0):");
String kcal = scanner.next();
if("0".equals(kcal)){
System.out.println("取消設定");
break;
}
drinkInfo.put(String.valueOf(drinkInfo.size() + 1), new Drink( String.valueOf(drinkInfo.size() + 1), name , desc, raw , "L" , Integer.parseInt(price) , ml, kcal));
System.out.println("新增後資料的飲料清單");
for(String key : drinkInfo.keySet()){
System.out.println("編號 : " + drinkInfo.get(key).getProdNumber()+
" 飲料 : " + drinkInfo.get(key).getName() +
" 大小 : " + drinkInfo.get(key).getBigsmall() +
" 價格 : " + drinkInfo.get(key).getPrice());
}
break;
case 2:
for(String key : drinkInfo.keySet()){
System.out.println("編號 : " + drinkInfo.get(key).getProdNumber()+
" 飲料 : " + drinkInfo.get(key).getName() +
" 大小 : " + drinkInfo.get(key).getBigsmall() +
" 價格 : " + drinkInfo.get(key).getPrice());
}
System.out.println("請輸入想要修改的飲料(不修此項按S,離開請按0):");
String prodNumber = scanner.next();
if(drinkInfo.get(prodNumber) == null){
System.out.print("請入的飲料編號錯誤,請重新選擇維護飲料功能重新開始");
break;
}
System.out.print("請輸入飲料的名稱(離開請按0):");
String editName = scanner.next();
if("0".equals(editName)){
System.out.println("取消設定");
break;
}
if("S".equals(editName)){
editName = drinkInfo.get(prodNumber).getName();
}
System.out.print("請輸入飲料的說明(不修此項按S,離開請按0):");
String editDesc = scanner.next();
if("0".equals(editDesc)){
System.out.println("取消設定");
break;
}
if("S".equals(editDesc)){
editName = drinkInfo.get(prodNumber).getDesc();
}
System.out.print("請輸入飲料的原料(不修此項按S,離開請按0):");
String editRaw = scanner.next();
if("0".equals(editRaw)){
System.out.println("取消設定");
break;
}
System.out.print("請輸入飲料的大小杯(不修此項按S,離開請按0):");
String editBigSmall = scanner.next();
if("0".equals(editBigSmall)){
System.out.println("取消設定");
break;
}
System.out.print("請輸入飲料的價格(不修此項按S,離開請按0):");
String editPrice = scanner.next();
if("0".equals(editPrice)){
System.out.println("取消設定");
break;
}
System.out.print("請輸入飲料的容量(不修此項按S,離開請按0):");
String editMl = scanner.next();
if("0".equals(editMl)){
System.out.println("取消設定");
break;
}
System.out.print("請輸入飲料的卡洛里(不修此項按S,離開請按0):");
String editKcal = scanner.next();
if("0".equals(editKcal)){
System.out.println("取消設定");
break;
}
drinkInfo.put(drinkInfo.get(prodNumber).getProdNumber() , new Drink( drinkInfo.get(prodNumber).getProdNumber(), editName , editDesc, editRaw , "L" , Integer.parseInt(editPrice) , editMl, editKcal));
for(String key : drinkInfo.keySet()){
System.out.println("編號 : " + drinkInfo.get(key).getProdNumber()+
" 飲料 : " + drinkInfo.get(key).getName() +
" 大小 : " + drinkInfo.get(key).getBigsmall() +
" 價格 : " + drinkInfo.get(key).getPrice());
}
break;
case 3:
for(String key : drinkInfo.keySet()){
System.out.println("編號 : " + drinkInfo.get(key).getProdNumber()+
" 飲料 : " + drinkInfo.get(key).getName() +
" 大小 : " + drinkInfo.get(key).getBigsmall() +
" 價格 : " + drinkInfo.get(key).getPrice());
}
System.out.print("請輸入要刪除的飲料(離開請按0):");
String removeProdNumber = scanner.next();
if("0".equals(removeProdNumber)){
System.out.println("取消設定");
break;
}
if(drinkInfo.get(removeProdNumber) == null){
System.out.print("請入的飲料編號錯誤,請重新選擇維護飲料功能重新開始");
break;
}
drinkInfo.remove(removeProdNumber);
System.out.println("移除資料的飲料清單");
for(String key : drinkInfo.keySet()){
System.out.println("編號 : " + drinkInfo.get(key).getProdNumber()+
" 飲料 : " + drinkInfo.get(key).getName() +
" 大小 : " + drinkInfo.get(key).getBigsmall() +
" 價格 : " + drinkInfo.get(key).getPrice());
}
break;
case 4:
for(String key : drinkInfo.keySet()){
System.out.println("編號 : " + drinkInfo.get(key).getProdNumber()+
" 飲料 : " + drinkInfo.get(key).getName() +
" 大小 : " + drinkInfo.get(key).getBigsmall() +
" 價格 : " + drinkInfo.get(key).getPrice());
}
break;
case 0:
System.out.println("飲料維護結束");
adjDrink = false;
break;
}
System.out.println("--------------------");
}
}
private void orderDrink(){
System.out.println("--------------------");
System.out.println("1.1 您進入點餐介面");
boolean orderDrinkSystem = true;
Order order = new Order();
while(orderDrinkSystem){
Scanner scanner = new Scanner(System.in);
// 姓名
System.out.print("請輸入顧客姓名(離開請按0):");
String input = scanner.next();
if("0".equals(input)){
System.out.println("取消點餐");
orderDrinkSystem = false;
break;
}
order.setCusName(input);
// 電話
System.out.print("請輸入顧客電話(離開請按0):");
input = scanner.next();
if("0".equals(input)){
System.out.println("取消點餐");
orderDrinkSystem = false;
break;
}
order.setCusTelphone(input);
// 外帶還內用
System.out.print("外帶請按1,內用請按2(離開請按0):");
input = scanner.next();
if("0".equals(input)){
System.out.println("取消點餐");
orderDrinkSystem = false;
break;
}
if("1".equals(input)){
order.setToGo(true);
} else {
order.setToGo(false);
}
// 地址
if(order.isToGo()){
System.out.print("請輸入顧客地址(離開請按0):");
input = scanner.next();
if("0".equals(input)){
System.out.println("取消點餐");
orderDrinkSystem = false;
break;
}
order.setAddress(input);
}
// 顯示飲料清單
System.out.println("-------------------");
System.out.println("以下是飲料清單,請根據下方清單進行點選");
List<Drink> drinks = new LinkedList<Drink>();
boolean settingDrinkSystem = true;
while(settingDrinkSystem){
Map<String, Drink> drinkInfoDetail = drinkInfo;
for(String key : drinkInfoDetail.keySet()){
System.out.println("編號 : " + drinkInfoDetail.get(key).getProdNumber()+
" 飲料 : " + drinkInfoDetail.get(key).getName() +
" 大小 : " + drinkInfoDetail.get(key).getBigsmall() +
" 價格 : " + drinkInfoDetail.get(key).getPrice());
}
System.out.print("請選擇飲料編號(離開請按0):");
input = scanner.next();
if("0".equals(input)){
System.out.println("取消點餐");
orderDrinkSystem = false;
break;
}
boolean isTheProdNumber = false;
for(String key : drinkInfoDetail.keySet()){
if(input.equals(key)){
isTheProdNumber = true;
break;
}
}
if(!isTheProdNumber){
System.out.println("請選擇正確的飲料");
continue;
}
System.out.println("--------------------");
// 根據編號取得飲料,開始設定冰塊,糖度,etc...
Drink drink = drinkInfoDetail.get(input);
System.out.print("糖度(全糖:1,七分糖:2,五分糖:3,三分糖:4,無糖:5)(離開請按0):");
String sugar = scanner.next();
if("0".equals(sugar)){
System.out.println("取消點餐");
orderDrinkSystem = false;
break;
}
if("12345".indexOf(sugar) < 0){
System.out.println("請選擇正確的糖度");
continue;
}
System.out.print("冷熱(冷:1,熱:2)(離開請按0):");
String hot = scanner.next();
if("0".equals(hot)){
System.out.println("取消點餐");
orderDrinkSystem = false;
break;
}
if("12".indexOf(hot) < 0){
System.out.println("請選擇正確的冷熱");
continue;
}
String ice = "";
if("1".equals(hot)){
System.out.print("冰量(正常冰:1,少冰:2,微冰:3,去冰:4)(離開請按0):");
ice = scanner.next();
if("0".equals(ice)){
System.out.println("取消點餐");
orderDrinkSystem = false;
break;
}
if("1234".indexOf(ice) < 0){
System.out.println("請選擇正確的冰量");
continue;
}
}
System.out.print("幾杯(數字)(離開請按0):");
String strNumber = scanner.next();
if("0".equals(strNumber)){
System.out.println("取消點餐");
orderDrinkSystem = false;
break;
}
if(Integer.parseInt(strNumber) <= 0 ){
System.out.println("請選擇正確的杯數");
continue;
}
drink.setting(sugar , (hot.equals("1") ? false : true) , ice , Integer.parseInt(strNumber));
drinks.add(drink);
System.out.print("是否還需要繼續點餐? (1:繼續 , 0:離開) : ");
String isOrderAgain = scanner.next();
if("1".indexOf(isOrderAgain) == 0){
System.out.println("(繼續點餐)");
System.out.println("-------------------");
continue;
} else {
order.setNo(String.valueOf(orders.size() + 1));
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd-HH:mm:ss:SSS");
order.setOrderDate(sdf.format(new Date()));
order.setDrinks(drinks);
orders.add(order);
System.out.println("(點餐完畢)");
System.out.println("-------------------");
System.out.println(order.toString());
settingDrinkSystem = false;
orderDrinkSystem = false;
}
}
}
}
private void orderQuery(){
boolean isQuery = true;
System.out.println("-------------------");
System.out.println("2.1 您進入點餐查詢介面");
while(isQuery){
Scanner scanner = new Scanner(System.in);
System.out.println("1 : 查詢全部交易");
System.out.println("2 : 查詢編號");
System.out.println("3 : 查詢訂購者");
System.out.println("4 : 查詢訂購者電話");
System.out.println("5 : 查詢單日訂單(ex:20170517)");
System.out.println("0 : 離開");
System.out.print("請選擇你要的查詢功能(1~5):");
String input = scanner.next();
if("012345".indexOf(input) < 0){
System.out.println("請選擇正確的功能");
}
if("0".equals(input)){
System.out.println("2.1 查詢結束");
System.out.println("-------------------");
isQuery = false;
break;
}
int functionFlag = Integer.parseInt(input);
switch(functionFlag){
case 1:
for(Order data : orders){
System.out.println(data.toString());
}
break;
case 2:
System.out.print("請輸入要查詢的編號:");
input = scanner.next();
boolean checkNo = false;
for(Order data : orders){
if(input.equals(data.getNo())){
System.out.println(data.toString());
checkNo = true;
}
}
if(!checkNo){
System.out.println("查無資料!!");
}
break;
case 3:
System.out.print("請輸入要查詢的訂購者:");
input = scanner.next();
boolean checkCusName = false;
for(Order data : orders){
if(input.equals(data.getCusName())){
System.out.println(data.toString());
checkCusName = true;
}
}
if(!checkCusName){
System.out.println("查無資料!!");
}
break;
case 4:
System.out.print("請輸入要查詢的訂購者電話:");
input = scanner.next();
boolean checkCusTelphone = false;
for(Order data : orders){
if(input.equals(data.getCusTelphone())){
System.out.println(data.toString());
checkCusTelphone = true;
}
}
if(!checkCusTelphone){
System.out.println("查無資料!!");
}
break;
case 5:
System.out.print("請輸入要查詢的訂購日期(ex:20170517):");
input = scanner.next();
boolean checkOrderDate = false;
for(Order data : orders){
if(data.getOrderDate().indexOf(input) >= 0){
System.out.println(data.toString());
checkOrderDate = true;
}
}
if(!checkOrderDate){
System.out.println("查無資料!!");
}
break;
}
System.out.println("-------------------");
}
}
}
//1.建立共同food類別
abstract class Food {
private String name;
private String desc;
public Food(String name , String desc) { // 2.建立建構子初始化
setName(name);
setDesc(desc);
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
}
//設定飲料的動作(可變動)
interface SetDrinkAction {
public void setting(String sugar , boolean hot , String ice , int number);
}
class Drink extends Food implements SetDrinkAction {
// 初始不可變動飲料參數
public Drink(String prodNumber , String name , String desc , String raw , String bigsmall , int price , String ml , String kcal) {
super(name, desc);
setProdNumber(prodNumber);
setRaw(raw);
setBigsmall(bigsmall);
setPrice(price);
setMl(ml);
setKcal(kcal);
}
// 不可變動
private String prodNumber;
private String raw;
private String bigsmall;
private int price;
private String ml;
private String kcal;
// 可以變動
private boolean hot;
private String ice;
private String sugar;
private int number;
public String getProdNumber() {
return prodNumber;
}
public void setProdNumber(String prodNumber) {
this.prodNumber = prodNumber;
}
public String getRaw() {
return raw;
}
private void setRaw(String raw) {
this.raw = raw;
}
public String getMl() {
return ml;
}
public String getKcal() {
return kcal;
}
public void setKcal(String kcal) {
this.kcal = kcal;
}
public int getPrice() {
return price;
}
private void setPrice(int price) {
this.price = price;
}
public String getIce() {
return ice;
}
public String getSugar() {
return sugar;
}
public String getBigsmall() {
return bigsmall;
}
private void setBigsmall(String bigsmall) {
this.bigsmall = bigsmall;
}
public int getNumber() {
return number;
}
public void setNumber(int number) {
this.number = number;
}
public boolean isHot() {
return hot;
}
public void setHot(boolean hot) {
this.hot = hot;
}
private void setMl(String ml) {
this.ml = ml;
}
public void setIce(String ice) {
if(this.hot){
ice = "";
} else {
this.ice = ice;
}
}
public void setSugar(String sugar) {
this.sugar = sugar;
}
@Override
public void setting(String sugar , boolean hot , String ice , int number) {
this.sugar = sugar;
this.hot = hot;
// 需要確認冷熱後,才能決定冰塊
setIce(ice);
this.number = number;
}
//內建system.out.println toString方法
public String toString() {
return "name = " + getName() + ",desc = " + getDesc() + ",raw = " + getRaw()
+ ",ml = " + getMl() + ",kcal = " + getKcal() + ",price = " + getPrice()
+ ",bigsmall =" + getBigsmall() + ",sugar = " + getSugar() + ",hot =" + isHot()
+ ",ice =" + getIce() + ",number =" + getNumber();
}
public String printDrink(){
DrinkSettingConvert convert = new DrinkSettingConvert();
return "飲料 : " + getName() + " , 價格 : " + getPrice()
+ " , 大小 : " + getBigsmall() + " , 糖量 : " + convert.sugarName(getSugar()) + " , 冷熱 : " + convert.coldOrHot(isHot())
+ " , 冰量 : " + convert.iceAmount(getIce()) + " , 杯數 : " + getNumber();
}
}
enum DrinkName {
大正紅茶("大正紅茶"),
初露青茶("初露青茶"),
珍珠紅茶拿鐵("珍珠紅茶拿鐵");
private final String name;
DrinkName(String name){
this.name = name;
}
public String getName(){
return name;
}
}
class DrinkSettingConvert {
public String sugarName(String sugar){
if("1".equals(sugar)){
return "全糖";
}
if("2".equals(sugar)){
return "七分糖";
}
if("3".equals(sugar)){
return "五分糖";
}
if("4".equals(sugar)){
return "三分糖";
}
if("5".equals(sugar)){
return "無糖";
}
return "";
}
public String coldOrHot(boolean hot){
// 冷:false,熱:True
return hot ? "熱": "冷";
}
public String iceAmount(String ice){
// 正常冰:1,少冰:2,微冰:3,去冰:4
if("1".equals(ice)){
return "正常冰";
}
if("2".equals(ice)){
return "少冰";
}
if("3".equals(ice)){
return "微冰";
}
if("4".equals(ice)){
return "去冰";
}
return "";
}
}
class GenDrinkInfo {
public Map<String, Drink> initdrinkData() { // initdrinkData方法名稱
Map<String, Drink> drink = new LinkedHashMap<String, Drink>();
drink.put("1", new Drink("1" , DrinkName.大正紅茶.getName() , "茶葉 原產地:印度", "茶葉" , "L" , 30 , "700", "140"));
drink.put("2", new Drink("2" ,DrinkName.初露青茶.getName() , "茶葉 原產地:台灣", "茶葉" , "L" , 30 , "700", "140"));
drink.put("3", new Drink("3" ,DrinkName.珍珠紅茶拿鐵.getName() , "茶葉 原產地:印度", "茶葉 , 牛奶 , 珍珠" , "M" , 50 , "500", "100"));
drink.put("4", new Drink("4" ,DrinkName.珍珠紅茶拿鐵.getName() , "茶葉 原產地:印度", "茶葉 , 牛奶 , 珍珠" , "L" , 60 , "700", "120"));
return drink;
}
}
class Order {
private String no;
private String cusName;
private String cusTelphone;
private String address;
private boolean toGo;
private String orderDate;
private List<Drink> drinks;
public String getNo() {
return no;
}
public String printDrinks() {
StringBuilder builder = new StringBuilder();
if(getDrinks()!=null){
builder.append("\n飲料清單");
for(int index = 0 ; index <getDrinks().size() ; index++){
builder.append("\n" + (index+1) +":"+ getDrinks().get(index).printDrink());
}
} else {
builder.append("\n尚未設定飲料");
}
builder.append("\n-------------------");
return builder.toString();
}
public void setNo(String no) {
this.no = no;
}
public String getCusName() {
return cusName;
}
public void setCusName(String cusName) {
this.cusName = cusName;
}
public String getCusTelphone() {
return cusTelphone;
}
public void setCusTelphone(String cusTelphone) {
this.cusTelphone = cusTelphone;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public boolean isToGo() {
return toGo;
}
public void setToGo(boolean toGo) {
this.toGo = toGo;
}
public String getOrderDate() {
return orderDate;
}
public void setOrderDate(String orderDate) {
this.orderDate = orderDate;
}
public List<Drink> getDrinks() {
return drinks;
}
public void setDrinks(List<Drink> drinks) {
this.drinks = drinks;
}
public String toString(){
StringBuilder builder = new StringBuilder();
builder.append("-------------------");
builder.append("\n訂購資訊");
builder.append("\n編號 : " + getNo());
builder.append("\n顧客姓名 : " + getCusName());
builder.append("\n手機號碼 : " + getCusTelphone());
builder.append("\n是否外帶 : " + isToGo());
builder.append("\n地址 : " + getAddress());
builder.append("\n訂購日期 : " + getOrderDate());
builder.append("\n-------------------");
if(getDrinks()!=null){
builder.append("\n飲料清單");
for(Drink data : getDrinks()){
builder.append("\n" + data.printDrink());
}
} else {
builder.append("\n尚未設定飲料");
}
builder.append("\n-------------------");
return builder.toString();
}
} | loveu8/learnJava | src/HW7/Homework7.java |
64,828 | package com.java110.core.language;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.java110.dto.menu.MenuCatalogDto;
import com.java110.utils.util.StringUtil;
import com.java110.vo.ResultVo;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 繁体
*/
@Component
public class Cn extends DefaultLanguage {
private static Map<String, String> menuCatalogs = new HashMap<>();
private static Map<String, String> menus = new HashMap<>();
private static Map<String, String> msgs = new HashMap<>();
public List<MenuCatalogDto> getMenuCatalog(List<MenuCatalogDto> menuCatalogDtos) {
String menuCatalogsName = "";
for (MenuCatalogDto menuCatalogDto : menuCatalogDtos) {
menuCatalogsName = menuCatalogs.get(menuCatalogDto.getName());
if (!StringUtil.isEmpty(menuCatalogsName)) {
menuCatalogDto.setName(menuCatalogsName);
}
}
return menuCatalogDtos;
}
@Override
public List<Map> getMenuDto(List<Map> menuDtos) {
String menuName = "";
for (Map menuDto : menuDtos) {
menuName = menus.get(menuDto.get("menuGroupName"));
if (!StringUtil.isEmpty(menuName)) {
menuDto.put("menuGroupName", menuName);
}
menuName = menus.get(menuDto.get("menuName"));
if (!StringUtil.isEmpty(menuName)) {
menuDto.put("menuName", menuName);
}
}
return menuDtos;
}
@Override
public JSONArray getPrivilegeMenuDto(JSONArray tmpPrivilegeArrays) {
String menuName = "";
JSONObject priObj = null;
for (int priIndex = 0; priIndex < tmpPrivilegeArrays.size(); priIndex++) {
priObj = tmpPrivilegeArrays.getJSONObject(priIndex);
menuName = menus.get(priObj.get("gName"));
if (!StringUtil.isEmpty(menuName)) {
priObj.put("gName", menuName);
}
menuName = menus.get(priObj.get("mName"));
if (!StringUtil.isEmpty(menuName)) {
priObj.put("mName", menuName);
}
menuName = menus.get(priObj.get("pName"));
if (!StringUtil.isEmpty(menuName)) {
priObj.put("pName", menuName);
}
}
return tmpPrivilegeArrays;
}
@Override
public ResultVo getResultVo(ResultVo resultVo) {
String msg = msgs.get(resultVo.getMsg());
if (!StringUtil.isEmpty(msg)) {
resultVo.setMsg(msg);
}
return resultVo;
}
public String getLangMsg(String msg) {
String msgStr = msgs.get(msg);
if (!StringUtil.isEmpty(msgStr)) {
return msgStr;
}
return msg;
}
static {
menuCatalogs.put("设备", "設備");
menuCatalogs.put("首页", "首頁");
menuCatalogs.put("业务受理", "業務受理");
menuCatalogs.put("费用报表", "費用報表");
menuCatalogs.put("物业服务", "物業服務");
menuCatalogs.put("设备停车", "設備停車");
menuCatalogs.put("常用菜单", "常用菜單");
menuCatalogs.put("设置", "設置");
menus.put("小区管理", "小區管理");
menus.put("我的小区", "我的小區");
menus.put("小区大屏", "小區大屏");
menus.put("业务受理", "業務受理");
menus.put("房屋装修", "房屋裝修");
menus.put("结构图", "結構圖");
menus.put("车位结构图", "車位結構圖");
menus.put("产权登记", "產權登記");
menus.put("视频监控", "視頻監控");
menus.put("资产管理", "資產管理");
menus.put("楼栋信息", "樓棟信息");
menus.put("单元信息", "單元信息");
menus.put("房屋管理", "房屋管理");
menus.put("商铺管理", "商舖管理");
menus.put("业主管理", "業主管理");
menus.put("业主信息", "業主信息");
menus.put("业主成员", "業主成員");
menus.put("绑定业主", "綁定業主");
menus.put("业主账号", "業主賬號");
menus.put("费用管理", "費用管理");
menus.put("费用项设置", "費用項設置");
menus.put("房屋收费", "房屋收費");
menus.put("车辆收费", "車輛收費");
menus.put("合同收费", "合同收費");
menus.put("账单催缴", "賬單催繳");
menus.put("费用导入", "費用導入");
menus.put("员工收费", "員工收費");
menus.put("费用汇总表", "費用匯總表");
menus.put("退费审核", "退費審核");
menus.put("欠费信息", "欠費信息");
menus.put("抄表类型", "抄表類型");
menus.put("水电抄表", "水電抄表");
menus.put("补打收据", "補打收據");
menus.put("公摊公式", "公攤公式");
menus.put("缴费审核", "繳費審核");
menus.put("折扣设置", "折扣設置");
menus.put("优惠申请", "優惠申請");
menus.put("优惠类型", "優惠類型");
menus.put("临时车收费", "臨時車收費");
menus.put("临时车缴费清单", "臨時車繳費清單");
menus.put("取消费用", "取消費用");
menus.put("智慧停车", "智慧停車");
menus.put("停车场管理", "停車場管理");
menus.put("车位信息", "車位信息");
menus.put("岗亭管理", "崗亭管理");
menus.put("业主车辆", "業主車輛");
menus.put("进场记录", "進場記錄");
menus.put("在场车辆", "在場車輛");
menus.put("黑白名单", "黑白名單");
menus.put("剩余车位", "剩餘車位");
menus.put("车位申请", "車位申請");
menus.put("报修管理", "報修管理");
menus.put("报修设置", "報修設置");
menus.put("电话报修", "電話報修");
menus.put("工单池", "工單池");
menus.put("报修待办", "報修待辦");
menus.put("报修已办", "報修已辦");
menus.put("报修回访", "報修回訪");
menus.put("强制回单", "強制回單");
menus.put("疫情管控", "疫情管控");
menus.put("疫情设置", "疫情設置");
menus.put("返省上报", "返省上報");
menus.put("疫情上报", "疫情上報");
menus.put("合同管理", "合同管理");
menus.put("合同类型", "合同類型");
menus.put("合同甲方", "合同甲方");
menus.put("起草合同", "起草合同");
menus.put("合同查询", "合同查詢");
menus.put("合同变更", "合同變更");
menus.put("到期合同", "到期合同");
menus.put("报表管理", "報表管理");
menus.put("报表专家", "報表專家");
menus.put("楼栋费用表", "樓棟費用表");
menus.put("费用分项表", "費用分項表");
menus.put("费用明细表", "費用明細表");
menus.put("缴费清单", "繳費清單");
menus.put("欠费明细表", "欠費明細表");
menus.put("预缴费提醒", "預繳費提醒");
menus.put("费用到期提醒", "費用到期提醒");
menus.put("缴费明细表", "繳費明細表");
menus.put("报修汇总表", "報修匯總表");
menus.put("未收费房屋", "未收費房屋");
menus.put("问卷明细表", "問卷明細表");
menus.put("业主缴费明细", "業主繳費明細");
menus.put("华宁物业报表", "華寧物業報表");
menus.put("押金报表", "押金報表");
menus.put("报修报表", "報修報表");
menus.put("营业报表", "營業報表");
menus.put("协同办公", "協同辦公");
menus.put("流程实例", "流程實例");
menus.put("我的流程", "我的流程");
menus.put("工作办理", "工作辦理");
menus.put("发布公告", "發佈公告");
menus.put("电话投诉", "電話投訴");
menus.put("访客登记", "訪客登記");
menus.put("信息发布", "信息發布");
menus.put("信息大类", "信息大類");
menus.put("智慧考勤", "智慧考勤");
menus.put("今日考勤", "今日考勤");
menus.put("月考勤", "月考勤");
menus.put("考勤记录", "考勤記錄");
menus.put("问卷投票", "問卷投票");
menus.put("我的问卷", "我的問卷");
menus.put("活动规则", "活動規則");
menus.put("采购管理", "採購管理");
menus.put("仓库信息", "倉庫信息");
menus.put("物品信息", "物品信息");
menus.put("物品类型", "物品類型");
menus.put("物品供应商", "物品供應商");
menus.put("物品规格", "物品規格");
menus.put("采购申请", "採購申請");
menus.put("调拨记录", "調撥記錄");
menus.put("出入库明细", "出入庫明細");
menus.put("调拨明细", "調撥明細");
menus.put("物品领用", "物品領用");
menus.put("我的物品", "我的物品");
menus.put("转赠记录", "轉贈記錄");
menus.put("物品使用记录", "物品使用記錄");
menus.put("巡检管理", "巡檢管理");
menus.put("巡检项目", "巡檢項目");
menus.put("巡检点", "巡檢點");
menus.put("巡检路线", "巡檢路線");
menus.put("巡检计划", "巡檢計劃");
menus.put("巡检任务", "巡檢任務");
menus.put("巡检明细", "巡檢明細");
menus.put("设备管理", "設備管理");
menus.put("设备信息", "設備信息");
menus.put("设备类型", "設備類型");
menus.put("设备数据同步", "設備數據同步");
menus.put("开门记录", "開門記錄");
menus.put("访客留影", "訪客留影");
menus.put("申请钥匙", "申請鑰匙");
menus.put("钥匙审核", "鑰匙審核");
menus.put("员工门禁授权", "員工門禁授權");
menus.put("组织管理", "組織管理");
menus.put("组织信息", "組織信息");
menus.put("员工信息", "員工信息");
menus.put("员工认证", "員工認證");
menus.put("系统管理", "系統管理");
menus.put("权限组", "權限組");
menus.put("员工权限", "員工權限");
menus.put("小区配置", "小區配置");
menus.put("流程管理", "流程管理");
menus.put("修改密码", "修改密碼");
menus.put("商户信息", "商戶信息");
menus.put("公众号", "公眾號");
menus.put("小程序配置", "小程序配置");
menus.put("短信配置", "短信配置");
menus.put("位置信息", "位置信息");
menus.put("资产导入导出", "資產導入導出");
menus.put("历史缴费导入", "歷史繳費導入");
menus.put("打印配置", "打印配置");
menus.put("收据模板", "收據模板");
menus.put("基础数据", "基礎數據");
menus.put("小区信息", "小區信息");
menus.put("物业公司", "物業公司");
menus.put("周边商家", "周邊商家");
menus.put("入驻审核", "入駐審核");
menus.put("租赁管理", "租賃管理");
menus.put("租赁配置", "租賃配置");
menus.put("房源信息", "房源信息");
menus.put("出租审核", "出租審核");
menus.put("租赁预约", "租賃預約");
menus.put("出租历史", "出租歷史");
menus.put("智慧运营", "智慧運營");
menus.put("旧货甩卖", "舊貨甩賣");
menus.put("发布需求", "發布需求");
menus.put("制作优惠券", "製作優惠券");
menus.put("购买记录", "購買記錄");
menus.put("商家店铺", "商家店鋪");
menus.put("商城菜单", "商城菜單");
menus.put("开店审核", "開店審核");
menus.put("店铺信息", "店鋪信息");
menus.put("小区店铺", "小區店鋪");
menus.put("专区目录", "專區目錄");
menus.put("专区商品", "專區商品");
menus.put("店铺类型", "店鋪類型");
menus.put("上架服务", "上架服務");
menus.put("上架商品", "上架商品");
menus.put("店铺变更", "店鋪變更");
menus.put("财务管理", "財務管理");
menus.put("提现审核", "提現審核");
menus.put("提现付款", "提現付款");
menus.put("提现记录", "提現記錄");
menus.put("设置保证金", "設置保證金");
menus.put("保证金明细", "保證金明細");
menus.put("商户管理", "商戶管理");
menus.put("商户管理员", "商戶管理員");
menus.put("营销中心", "營銷中心");
menus.put("发布广告", "發布廣告");
menus.put("便民菜单维护", "便民菜單維護");
menus.put("订单中心", "訂單中心");
menus.put("受理单", "受理單");
menus.put("登录日志", "登錄日誌");
menus.put("商城订单", "商城訂單");
menus.put("退货订单", "退貨訂單");
menus.put("服务管理", "服務管理");
menus.put("应用信息", "應用信息");
menus.put("服务信息", "服務信息");
menus.put("服务注册", "服務註冊");
menus.put("服务实现", "服務實現");
menus.put("服务提供", "服務提供");
menus.put("业务轨迹", "業務軌跡");
menus.put("菜单管理", "菜單管理");
menus.put("菜单目录", "菜單目錄");
menus.put("菜单组", "菜單組");
menus.put("菜单维护", "菜單維護");
menus.put("映射管理", "映射管理");
menus.put("编码映射", "編碼映射");
menus.put("属性管理", "屬性管理");
menus.put("属性", "屬性");
menus.put("报表开发", "報表開發");
menus.put("报表组", "報表組");
menus.put("报表信息", "報表信息");
menus.put("报表组件", "報表組件");
menus.put("缓存管理", "緩存管理");
menus.put("刷新缓存", "刷新緩存");
menus.put("定时任务管理", "定時任務管理");
menus.put("定时任务", "定時任務");
menus.put("日志中心", "日誌中心");
menus.put("交互日志", "交互日誌");
menus.put("初始化小区", "初始化小區");
}
}
| java110/MicroCommunity | java110-core/src/main/java/com/java110/core/language/Cn.java |
64,831 | package com.cbh.web;
import com.cbh.entity.Disease;
import com.cbh.entity.HospitalRegisteredRecord;
import com.cbh.entity.PersonRecord;
import com.cbh.mongo.HospitalGeoResponse;
import com.cbh.mongo.LineHospitalMessage;
import com.cbh.mongo.LineMessage;
import com.cbh.mongo.Statements;
import com.cbh.service.HospitalGeoMongoService;
import com.cbh.service.LineHospitalMessageMongoService;
import com.cbh.service.LineMessageMongoService;
import com.cbh.service.StatementsMongoService;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import com.google.common.io.ByteStreams;
import com.huaban.analysis.jieba.JiebaSegmenter;
import com.huaban.analysis.jieba.SegToken;
import com.linecorp.bot.client.LineMessagingServiceBuilder;
import com.linecorp.bot.model.ReplyMessage;
import com.linecorp.bot.model.action.Action;
import com.linecorp.bot.model.action.PostbackAction;
import com.linecorp.bot.model.action.URIAction;
import com.linecorp.bot.model.event.CallbackRequest;
import com.linecorp.bot.model.event.Event;
import com.linecorp.bot.model.event.MessageEvent;
import com.linecorp.bot.model.event.PostbackEvent;
import com.linecorp.bot.model.event.message.LocationMessageContent;
import com.linecorp.bot.model.event.message.TextMessageContent;
import com.linecorp.bot.model.event.postback.PostbackContent;
import com.linecorp.bot.model.message.TemplateMessage;
import com.linecorp.bot.model.message.TextMessage;
import com.linecorp.bot.model.message.template.CarouselColumn;
import com.linecorp.bot.model.message.template.CarouselTemplate;
import com.linecorp.bot.model.message.template.Template;
import com.linecorp.bot.model.profile.UserProfileResponse;
import com.linecorp.bot.model.response.BotApiResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.data.geo.*;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.NearQuery;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import retrofit2.Response;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.*;
/**
* Created by Tommy on 2017/4/14.
*/
@RequestMapping("/line")
@Controller
public class LineBotController {
private final ObjectMapper objectMapper=buildObjectMapper();
@Autowired
private StatementsMongoService statementsMongoService;
@Autowired
private LineMessageMongoService lineMessageService;
@Autowired
private LineHospitalMessageMongoService lineHospitalMessageMongoService;
@Autowired
HospitalGeoMongoService hospitalGeoMongoService;
@Autowired
MongoTemplate mongoTemplate;
@RequestMapping(value = "block",method ={RequestMethod.GET, RequestMethod.POST}, produces = "application/json")
@ResponseBody
public String blockTemplate(HttpServletRequest httpServletRequest) throws IOException {
String channelToken="hhNohi5sJV4/yj1tvTCvBPrxSop6WKo+GsxOCbE7dI8tYc1+8xbUIFm7raVZ7CrBpkt2N29F3QngT7HyEC/OOi1Tw+n281xb7YOwXku1c1SnK4FAbkpa0J+Vzy5Xz3/6+uCw9JMjibkIjY3nilOg6wdB04t89/1O/w1cDnyilFU=";
//LineBotCallbackRequestParser lineBotCallbackRequestParser=new LineBotCallbackRequestParser(new LineSignatureValidator(channelToken.getBytes()));// StringWriter writer = new StringWriter();
// IOUtils.copy(httpServletRequest.getInputStream(), writer, "utf-8");
String theString ="";
boolean isMiss;
// System.out.println(theString);
try {
// CallbackRequest callbackRequest = lineBotCallbackRequestParser.handle(httpServletRequest);
byte[] json = ByteStreams.toByteArray(httpServletRequest.getInputStream());
CallbackRequest callbackRequest = (CallbackRequest) objectMapper.readValue(json, CallbackRequest.class);
List<Event> events= callbackRequest.getEvents();
for(Event event:events){
if(event instanceof MessageEvent) {
MessageEvent env=(MessageEvent) event;
PersonRecord personRecord=null;
try {
personRecord=PersonRecord.findPersonRecord(env.getSource().getUserId());
}catch (Exception e){
Response<UserProfileResponse> response=LineMessagingServiceBuilder
.create(channelToken)
.build().getProfile(env.getSource().getUserId()).execute();
UserProfileResponse userProfileResponse=response.body();
System.out.println("user profile : "+userProfileResponse.getUserId());
personRecord=new PersonRecord();
personRecord.setLineId(userProfileResponse.getUserId());
personRecord.setUserName(userProfileResponse.getDisplayName());
personRecord.persist();
e.printStackTrace();
return"";
}
if(env.getMessage() instanceof TextMessageContent) {
MessageEvent<TextMessageContent> askContent=(MessageEvent<TextMessageContent>) event;
TextMessage ask=new TextMessage(askContent.getMessage().getText());
String askForJeiba=".*";
String responseAns= "對不起,我聽不懂你再說什麼";
JiebaSegmenter segmenter = new JiebaSegmenter();
System.out.println(segmenter.process(ask.getText(), JiebaSegmenter.SegMode.SEARCH).toString());
List<SegToken> segTokenList=segmenter.process(ask.getText(), JiebaSegmenter.SegMode.SEARCH);
for(SegToken segToken:segTokenList){
System.out.println(segToken.word.toString());
askForJeiba=askForJeiba+segToken.word.toString()+".*";
}
List<Statements> statementsList=statementsMongoService.findStatementsByRegexpResponse(askForJeiba);
if(! (statementsList==null)){
int ran= (int)(Math.random()*300+1);
if(statementsList.size()!=0){
int i=ran % statementsList.size();
responseAns=statementsList.get(i).getText();
TextMessage textMessage = new TextMessage(responseAns);
ReplyMessage replyMessage = new ReplyMessage(
env.getReplyToken() ,
textMessage
);
Response<BotApiResponse> response =
LineMessagingServiceBuilder
.create(channelToken)
.build()
.replyMessage(replyMessage)
.execute();
}else{
TextMessage textMessage = new TextMessage(askContent.getMessage().getText());
ReplyMessage replyMessage = new ReplyMessage(
env.getReplyToken() ,
textMessage
);
Response<BotApiResponse> response =
LineMessagingServiceBuilder
.create(channelToken)
.build()
.replyMessage(replyMessage)
.execute();
}
}
LineMessage lineMessage=new LineMessage();
lineMessage.setAskMessage(ask.getText());
lineMessage.setResponseMessage(responseAns);
lineMessage.setUserLineId(event.getSource().getUserId());
lineMessage.setCreateDate(new Date());
lineMessageService.save(lineMessage);
}else if(env.getMessage() instanceof LocationMessageContent){
LocationMessageContent locationMessageContent=(LocationMessageContent) env.getMessage();
personRecord.setLatitude(locationMessageContent.getLatitude());
personRecord.setLongtitude(locationMessageContent.getLongitude());
personRecord.setCurrentStatus("location");
personRecord.merge();
}
else{
System.out.println(env.getMessage().getClass().getClass().getName());
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
return "{\"test\":\""+theString+"\"}";
}
@RequestMapping(value = "hospital",method ={RequestMethod.GET, RequestMethod.POST}, produces = "application/json")
@ResponseBody
public String hospital(HttpServletRequest httpServletRequest) throws IOException {
String channelToken="CoDTDBUonrzgtPtnIPT9gIcrFcZHfzOpqz/B5+BXbiVgCfuNN1quroMByxu0Igln5z7PR5DeI7tGEtoDxNGeRF/zl//mXmt0BPE7yI3K86DSqqASCoTl0behGFCx1QAX/EJUK3iQUtRo3aqeFBSfFQdB04t89/1O/w1cDnyilFU=";
//LineBotCallbackRequestParser lineBotCallbackRequestParser=new LineBotCallbackRequestParser(new LineSignatureValidator(channelToken.getBytes()));// StringWriter writer = new StringWriter();
// IOUtils.copy(httpServletRequest.getInputStream(), writer, "utf-8");
String theString ="";
boolean isMiss;
// System.out.println(theString);
try {
// CallbackRequest callbackRequest = lineBotCallbackRequestParser.handle(httpServletRequest);
byte[] json = ByteStreams.toByteArray(httpServletRequest.getInputStream());
CallbackRequest callbackRequest = (CallbackRequest) objectMapper.readValue(json, CallbackRequest.class);
List<Event> events= callbackRequest.getEvents();
for(Event event:events){
if(event instanceof MessageEvent) {
MessageEvent env=(MessageEvent) event;
PersonRecord personRecord=null;
try {
personRecord=PersonRecord.findPersonRecord(env.getSource().getUserId());
}catch (EmptyResultDataAccessException e){
Response<UserProfileResponse> response=LineMessagingServiceBuilder
.create(channelToken)
.build().getProfile(env.getSource().getUserId()).execute();
UserProfileResponse userProfileResponse=response.body();
System.out.println("user profile : "+userProfileResponse.getDisplayName());
personRecord=new PersonRecord();
personRecord.setLineId(userProfileResponse.getUserId());
personRecord.setUserName(hex2Str(userProfileResponse.getDisplayName()));
personRecord.persist();
e.printStackTrace();
return"";
}catch (Exception e){
e.printStackTrace();
return"";
}
if(env.getMessage() instanceof TextMessageContent) {
MessageEvent<TextMessageContent> askContent=(MessageEvent<TextMessageContent>) event;
TextMessage ask=new TextMessage(askContent.getMessage().getText());
if("".equals(ask.getText().trim())){
TextMessage textMessage = new TextMessage("請輸入不舒服的症狀喔!");
ReplyMessage replyMessage = new ReplyMessage(
((PostbackEvent) event).getReplyToken(),
textMessage
);
}
if(ask.getText().contains("不舒服")){
TextMessage textMessage = new TextMessage("保持愉快的心情會好的快一點喔 இдஇ");
ReplyMessage replyMessage = new ReplyMessage(
((PostbackEvent) event).getReplyToken(),
textMessage
);
Response<BotApiResponse> response =
LineMessagingServiceBuilder
.create(channelToken)
.build()
.replyMessage(replyMessage)
.execute();
}
JiebaSegmenter segmenter = new JiebaSegmenter();
System.out.println(segmenter.process(ask.getText(), JiebaSegmenter.SegMode.SEARCH).toString());
List<SegToken> segTokenList = segmenter.process(ask.getText(), JiebaSegmenter.SegMode.SEARCH);
List<Disease> diseaseList = null;
Set<Disease> diseaseSet = new HashSet<Disease>();
for (SegToken segToken : segTokenList) {
System.out.println(segToken.word.toString());
diseaseList = Disease.findAllLikeDiseases(segToken.word.trim());
diseaseSet.addAll(diseaseList);
}
if (diseaseList != null) {
for (Disease disease : diseaseSet) {
for (SegToken segToken : segTokenList) {
if (disease.getSymptom().contains(segToken.word)) {
disease.setOrderDis(disease.getOrderDis() + 1);
}
}
}
}
Collections.sort(diseaseList, new Comparator<Disease>() {
@Override
public int compare(Disease lhs, Disease rhs) {
// -1 - less than, 1 - greater than, 0 - equal, all inversed for descending
return lhs.getOrderDis() > rhs.getOrderDis() ? -1 : (lhs.getOrderDis() < rhs.getOrderDis()) ? 1 : 0;
}
});
String responseCat = "";
for (Disease disease : diseaseList) {
responseCat += "" + disease.getCategory() + ",";
System.out.println("症狀 : "+disease.getCategory());
}
TextMessage textMessage = new TextMessage(responseCat);
ReplyMessage replyMessage = new ReplyMessage(
env.getReplyToken() ,
textMessage
);
Response<BotApiResponse> response =
LineMessagingServiceBuilder
.create(channelToken)
.build()
.replyMessage(replyMessage)
.execute();
personRecord.setSymptom(ask.getText());
personRecord.setCurrentStatus("disease");
personRecord.merge();
LineHospitalMessage lineHospitalMessage=new LineHospitalMessage();
lineHospitalMessage.setAskMessage(ask.getText());
lineHospitalMessage.setResponseMessage(responseCat);
lineHospitalMessage.setUserLineId(event.getSource().getUserId());
lineHospitalMessage.setCreateDate(new Date());
lineHospitalMessageMongoService.save(lineHospitalMessage);
}else if(env.getMessage() instanceof LocationMessageContent){
LocationMessageContent locationMessageContent=(LocationMessageContent) env.getMessage();
personRecord.setLatitude(locationMessageContent.getLatitude());
personRecord.setLongtitude(locationMessageContent.getLongitude());
personRecord.setCurrentStatus("location");
personRecord.merge();
Point DUS = new Point( personRecord.getLongtitude(), personRecord.getLatitude() );
JiebaSegmenter segmenter = new JiebaSegmenter();
System.out.println(segmenter.process(personRecord.getSymptom(), JiebaSegmenter.SegMode.SEARCH).toString());
List<SegToken> segTokenList = segmenter.process(personRecord.getSymptom(), JiebaSegmenter.SegMode.SEARCH);
List<Disease> diseaseList = null;
Set<Disease> diseaseSet = new HashSet<Disease>();
for (SegToken segToken : segTokenList) {
System.out.println(segToken.word.toString());
diseaseList = Disease.findAllLikeDiseases(segToken.word.trim());
diseaseSet.addAll(diseaseList);
}
if (diseaseList != null) {
for (Disease disease : diseaseSet) {
for (SegToken segToken : segTokenList) {
if (disease.getSymptom().contains(segToken.word)) {
disease.setOrderDis(disease.getOrderDis() + 1);
}
}
}
}
Collections.sort(diseaseList, new Comparator<Disease>() {
@Override
public int compare(Disease lhs, Disease rhs) {
// -1 - less than, 1 - greater than, 0 - equal, all inversed for descending
return lhs.getOrderDis() > rhs.getOrderDis() ? -1 : (lhs.getOrderDis() < rhs.getOrderDis()) ? 1 : 0;
}
});
Criteria criteria = new Criteria();
List<Criteria> criteriaList=new ArrayList<Criteria>();
Query query = new Query(Criteria.where("name").regex("(醫院)|(診所)"));
String str="";
int i=0;
for(Disease disease:diseaseSet){
i++;
if(i<diseaseSet.size()){
str=str+"("+disease.getCategory()+")|";
}else{
str=str+"("+disease.getCategory()+")";
}
System.out.println(disease.getCategory());
}
System.out.println(query.toString());
NearQuery nearQuery = NearQuery.near(DUS).maxDistance(new Distance(5, Metrics.KILOMETERS));
nearQuery.query(query);
nearQuery.num(5);
GeoResults<HospitalGeoResponse> data = mongoTemplate.geoNear(nearQuery, HospitalGeoResponse.class);
CarouselColumn column=null;
List<CarouselColumn> columns=new ArrayList<CarouselColumn>();
for(GeoResult<HospitalGeoResponse> hospitalGeoResponse:data){
HospitalGeoResponse hospitalGeoResponse1=hospitalGeoResponse.getContent();
String title=(hospitalGeoResponse1.getName() ==null ? "": hospitalGeoResponse1.getName());
String text= ((hospitalGeoResponse1.getServiceItem()==null || hospitalGeoResponse1.getServiceItem().equals("")) ? "一般門診": hospitalGeoResponse1.getServiceItem());
List<Action> actions=new ArrayList<Action>();
String labelMap="地圖";
String uriMap="https://www.google.com/maps/place/"+ URLEncoder.encode(hospitalGeoResponse1.getAddress());
String labelPhone="電話";
String uriPhone="tel:"+hospitalGeoResponse1.getPhone().replaceAll("-","");
URIAction action=new URIAction(labelMap,uriMap);
URIAction actionPh=new URIAction(labelPhone,uriPhone);
// PostbackAction postbackAction=new PostbackAction("掛號","registered");
actions.add(action);
actions.add(actionPh);
// actions.add(postbackAction);
column=new CarouselColumn(null,title,text,actions);
System.out.println(hospitalGeoResponse.getContent().getAddress());
System.out.println(hospitalGeoResponse.getContent().getName());
System.out.println(hospitalGeoResponse.getContent().getCategory());
columns.add(column);
}
CarouselTemplate template=new CarouselTemplate(columns);
for(CarouselColumn carouselColumn:template.getColumns()){
System.out.println(carouselColumn.getText());
System.out.println(carouselColumn.getActions());
}
TemplateMessage templateMessage=new TemplateMessage("附近醫院",template);
System.out.print(templateMessage.getAltText());
System.out.print(templateMessage);
ReplyMessage replyMessage = new ReplyMessage(
env.getReplyToken() ,
templateMessage
);
Response<BotApiResponse> response =
LineMessagingServiceBuilder
.create(channelToken)
.build()
.replyMessage(replyMessage)
.execute();
if(response!=null){
if(response.errorBody() !=null){
System.out.println(response.isSuccessful());
System.out.println(response.errorBody().string());
}else{
System.out.println(response);
System.out.println(response.isSuccessful());
}
}
}else{
System.out.println(env.getMessage().getClass().getClass().getName());
}
}else if(event instanceof PostbackEvent){
PostbackEvent postbackEvent=(PostbackEvent) event;
PersonRecord personRecord=null;
personRecord=PersonRecord.findPersonRecord(event.getSource().getUserId());
String postback=postbackEvent.getPostbackContent().getData();
personRecord.setCurrentStatus("registered");
personRecord.merge();
System.out.println("postback data : "+postback);
HospitalRegisteredRecord hospitalRegisteredRecord=new HospitalRegisteredRecord();
hospitalRegisteredRecord.setDidRegist("false");
hospitalRegisteredRecord.setSymptom(personRecord.getSymptom());
hospitalRegisteredRecord.persist();
TextMessage textMessage = new TextMessage("恭喜掛號成功 ε٩(๑> ₃ <)۶з");
ReplyMessage replyMessage = new ReplyMessage(
((PostbackEvent) event).getReplyToken(),
textMessage
);
Response<BotApiResponse> response =
LineMessagingServiceBuilder
.create(channelToken)
.build()
.replyMessage(replyMessage)
.execute();
}
}
} catch (Exception e) {
e.printStackTrace();
}
return "{\"test\":\""+theString+"\"}";
}
private static ObjectMapper buildObjectMapper() {
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
objectMapper.registerModule(new JavaTimeModule()).configure(DeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS, false);
return objectMapper;
}
public static String hex2Str(String str) throws UnsupportedEncodingException {
String strArr[] = str.split("\\\\"); // 分割拿到形如 xE9 的16进制数据
byte[] byteArr = new byte[strArr.length - 1];
for (int i = 1; i < strArr.length; i++) {
Integer hexInt = Integer.decode("0" + strArr[i]);
byteArr[i - 1] = hexInt.byteValue();
}
return new String(byteArr, "UTF-8");
}
}
| OpenHCOS/HCOS | projects/ORS/cbh/src/main/java/com/cbh/web/LineBotController.java |
64,832 | /*
* Copyright 20112 YAMAZAKI Makoto<[email protected]>
*
* 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 org.zakky.tabletdetector;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
/**
* ハンドセット(電話)とタブレットでメッセージを変えるようにしたアクティビティです。
*/
public class MainActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
TextView tv = (TextView) findViewById(R.id.text);
tv.setText(isTabletMode() ? "Hello Tablet!" : "Hello Handset!");
}
private boolean isTabletMode() {
return getResources().getBoolean(R.bool.is_tablet);
}
}
| zaki50/DetectTabletByResource | src/org/zakky/tabletdetector/MainActivity.java |
64,833 | package member.controller;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import member.model.MemberHibernateDAO;
import member.model.MemberVO;
import tools.InputFilter;
import coupon.controller.CouponFacade;
import coupon.model.CouponDAO;
import coupon.model.CouponVO;
import coupon_set.model.Coupon_setDAO;
public class register extends HttpServlet {
private static final long serialVersionUID = 1L;
public register() {
super();
}
InputFilter inputfilter = new InputFilter();
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
}
protected void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
try {
request.setCharacterEncoding("UTF-8");
// ajax檢查帳號是否重複
if (request.getParameter("action") != null) {
String m_id = inputfilter.sizeFomat(
request.getParameter("m_id"), 20);
System.out.println("------------------------------------------"+m_id);
if (m_id!=null && m_id.length()>2) {
MemberHibernateDAO DAO = new MemberHibernateDAO();
if (DAO.findHaveName(m_id) != 0) {
System.out.println("------------------------------------------DUPLICATE M_ID!");
response.setCharacterEncoding("UTF-8");
response.getWriter().write("duplicateMid_這個帳號已存在,請更改。");
} else {
response.setCharacterEncoding("UTF-8");
response.getWriter().write("okMid_這個帳號OK");
}
}
} else {
List<String> errorMsg = new ArrayList<String>();
request.setAttribute("ErrorMsgKey", errorMsg);
// 1. 讀取使用者輸入資料
String m_id = inputfilter.sizeFomat(
request.getParameter("m_id"), 20);
String m_name = inputfilter.sizeFomat(
request.getParameter("m_name"), 30);
String m_pwd =request.getParameter("m_pwd");
String m_mobile = inputfilter.sizeFomat(
request.getParameter("m_mobile"), 10);
String m_email = inputfilter.sizeFomat(
request.getParameter("m_email"), 40);
String m_bday = inputfilter.sizeFomat(
request.getParameter("m_bday"), 20);
String m_addr = inputfilter.sizeFomat(
request.getParameter("m_addr"), 200);
// 3. 檢查使用者輸入資料
if (m_id == null || m_id.trim().length() == 0) {
errorMsg.add("請輸入「帳號」");
}
if (m_pwd == null || m_pwd.trim().length() == 0) {
errorMsg.add("請輸入「密碼」");
}
if (m_name == null || m_name.trim().length() == 0) {
errorMsg.add("請輸入「姓名」");
}
if (m_email == null || m_email.trim().length() == 0) {
errorMsg.add("請輸入「Email」");
}
if (m_mobile == null || m_mobile.trim().length() == 0) {
errorMsg.add("請輸入「行動電話號碼」");
}
if (m_bday == null || m_bday.trim().length() == 0) {
errorMsg.add("請輸入「生日」");
}
if (m_addr == null || m_addr.trim().length() == 0) {
errorMsg.add("請輸入「通訊地址」");
}
if (!errorMsg.isEmpty()) {
RequestDispatcher rd = request
.getRequestDispatcher("/error.jsp");
rd.forward(request, response);
return;
}
// 4. 進行 Business Logic 運算
MemberHibernateDAO DAO = new MemberHibernateDAO();
if (DAO.findHaveName(m_id) != 0) {
errorMsg.add("帳號 (" + m_id + ") 已存在,請選擇其它的帳號");
RequestDispatcher rd = request
.getRequestDispatcher("/error.jsp");
rd.forward(request, response);
return;
} else {
// 過程完全無誤,新增會員帳號
// MessageDigest md=null;
MessageDigest md = MessageDigest.getInstance("MD5");
byte[] b = m_pwd.trim().getBytes();
byte[] hash = md.digest(b);
StringBuilder pwd = new StringBuilder();
for (byte bb : hash) {
pwd.append(String.format("%02X", bb));
}
MemberVO memberVo = new MemberVO();
memberVo.setM_id(m_id);
memberVo.setM_pwd(pwd.toString());
// memberVo.setM_pwd(m_pwd);
memberVo.setM_name(m_name);
memberVo.setM_email(m_email);
memberVo.setM_mobile(m_mobile);
memberVo.setM_bday(new java.sql.Date(new java.util.Date()
.getTime()));
memberVo.setM_addr(m_addr);
memberVo.setM_status(1);
DAO.insert(memberVo);
int rand = (int) (Math.random() * 100000 + 99999);
// // 變數宣告
String msg;
String thisLine;
URL u;
URLConnection uc;
// 設定參數
String username = "davidou"; // 帳號
String password = ""; // 密碼
String mobile = m_mobile; // 電話 m_mobile 0971091213
String message =
"hello!"+username+" 感謝您註冊成為酒迷的會員 以下是您的酒迷驗證碼:"+rand; //
// 簡訊內容
msg = "http://api.twsms.com/smsSend.php?username=" +
username
+ "&password=" + password + "&mobile=" + mobile
+ "&message=" + URLEncoder.encode(message);
u = new URL(msg);
try {
uc = u.openConnection();
BufferedReader theHTML = new BufferedReader(
new InputStreamReader(uc.getInputStream()));
thisLine = theHTML.readLine();
System.out.println(thisLine);//回傳訊息:
} catch (Exception e) {
System.out.println(e.getMessage()); //無法連結網站
}
// // 簡訊結束
MemberHibernateDAO dao = new MemberHibernateDAO();
MemberVO member = dao.Login(m_id, pwd.toString());
HttpSession session = request.getSession();
if (member != null) {
// 登入成功狀況
session.setAttribute("access", "y");
session.setAttribute("m_id", member.getM_id()); // 會員帳號
session.setAttribute("m_no", member.getM_no()); // 會員編號
session.setAttribute("m_name", member.getM_name()); // 會員姓名
session.setAttribute("smscheck_num", rand); // 會員姓名
session.setMaxInactiveInterval(3600);
}
request.setAttribute("m_idKey", m_id);
if (errorMsg.isEmpty()) {
// 註冊成功贈送coupon
String c_key = CouponFacade.createCoupon();
Integer c_price = new Coupon_setDAO().getAll().get(0)
.getCs_price();
CouponVO couponVO = new CouponVO();
couponVO.setC_key(c_key);
couponVO.setC_price(c_price);
couponVO.setM_no(member.getM_no());
couponVO.setC_status(true);
couponVO.setC_deadline(new Timestamp(
new java.util.Date().getTime() + 30 * 60 * 60
* 24));
new CouponDAO().insert(couponVO);
System.out.println(c_key);
request.setAttribute("newCoupon", couponVO);
RequestDispatcher rd = request
.getRequestDispatcher("/smscheck.jsp");
rd.forward(request, response);
return;
} else {
RequestDispatcher rd = request
.getRequestDispatcher("/error.jsp");
rd.forward(request, response);
return;
}
}
// 5.依照 Business Logic 運算結果來挑選適當的畫面
} // if-else of action!=null
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
String rand = String.valueOf((int) (Math.random() * 100000 + 99999));
System.out.println(rand);
}
}
| yangsanta/wineProject | WineProject/src/member/controller/register.java |
64,834 | package ex14;
import java.awt.BorderLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;
public class AddressTableKai extends JFrame {
JTable table;
TableModel tableModel;
public static void main(String[] args) {
JFrame frame = new AddressTableKai("プログラミング言語表[");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public static String file_path = "ex14/data/";
public static String file_name = "address.txt";
AddressTableKai(String title) {
super(title);
tableModel = new TableModel();
table = new JTable(tableModel);
table.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
// DefaultTableColumnModel tcm = (DefaultTableColumnModel) table.getColumnModel();
JScrollPane scroll = new JScrollPane(table);
JPanel pane = (JPanel) this.getContentPane();
pane.setLayout(new BorderLayout());
pane.add(scroll, BorderLayout.CENTER);
JPanel headPane = new JPanel (new GridLayout(1, 3));
JButton buAdd = new JButton("行の追加");
JButton buRead = new JButton("読み込み");
JButton buWrite = new JButton("書き込み");
buAdd.addActionListener(new AddActionListener());
buRead.addActionListener(new ReadActionListener());
buWrite.addActionListener(new WriteActionListener());
headPane.add(buAdd);
headPane.add(buRead);
headPane.add(buWrite);
pane.add(headPane, BorderLayout.PAGE_START);
setSize(750, 200);
setVisible(true);
}
class AddActionListener implements ActionListener {
@Override
public void actionPerformed(ActionEvent e) {
tableModel.addRow();
}
}
class WriteActionListener implements ActionListener {
@Override
public void actionPerformed(ActionEvent e) {
tableModel.write();
}
}
class ReadActionListener implements ActionListener {
@Override
public void actionPerformed(ActionEvent e) {
tableModel.read();
}
}
class TableModel extends DefaultTableModel {
String[] columnNames = "名前,住所,電話,メール".split(",");
ArrayList<String[]> list;
public TableModel() {
super();
list = new ArrayList<String[]>();
}
public void read() {
this.list.clear();
try {
@SuppressWarnings("resource")
BufferedReader br = new BufferedReader(new FileReader(new File(file_path + file_name)));
String line;
while ((line = br.readLine()) != null) {
String[] words = line.split(",");
list.add(words);
for (String w: words) System.out.println(w);
}
} catch (FileNotFoundException e) {
System.out.println(file_path + file_name + "が見つかりません。");
} catch (IOException e) {
System.out.println(e);
}
this.fireTableStructureChanged();
}
public void write() {
try {
BufferedWriter bw = new BufferedWriter(new FileWriter(new File(file_path + file_name)));
for (String[] cells : list) {
String line = cells[0];
for (int i = 1; i < cells.length; i++)
line += "," + cells[i];
System.out.println(line);
bw.write(line + "\n");
}
bw.close();
} catch (FileNotFoundException e) {
System.out.println(file_path + file_name + "が見つかりません。");
} catch (IOException e) {
System.out.println(e);
}
}
public void addRow() {
this.list.add(new String[list.get(0).length]);
fireTableDataChanged();
}
@Override
public int getColumnCount() {
return columnNames.length;
}
@Override
public int getRowCount() {
if (list == null) return 0;
return list.size();
}
@Override
public String getColumnName(int col) {
return columnNames[col];
}
@Override
public Object getValueAt(int row, int col) {
System.out.println(row + ":" + col);
return list.get(row)[col];
}
@Override
public Class getColumnClass(int col) {
return getValueAt(0, col).getClass();
}
@Override
public boolean isCellEditable(int row, int col) {
return true;
}
@Override
public void setValueAt(Object value, int row, int column) {
list.get(row)[column] = (String) value;
}
}
}
| elzup/lecture_gui | ex14/AddressTableKai.java |
64,835 | package com.coderyo.d20231228;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
public class MyDb extends SQLiteOpenHelper {
private static int VERSION = 1;//資料庫版本
private static String DB_NAME = "MyDb.db";//資料庫名稱
private static MyDb busDB ;
public MyDb(Context context) {
super(context, DB_NAME, null, VERSION);
}
/**
* 獲取資料庫產生實體
* @param context 上下文對象
* @return BusDB對象
*/
public static MyDb getInstance(Context context) {
if(busDB==null){
busDB = new MyDb(context);
return busDB;
}else{
return busDB;
}
}
/**
* 創建表,定義表字段
* */
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL("CREATE TABLE Info (_id INTEGER PRIMARY KEY AUTOINCREMENT,id TEXT, name TEXT,phone TEXT,address TEXT,money TEXT,state INTEGER)");
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
if (oldVersion == 1 && newVersion == 2) {// 升級判斷,如果再升級就要再加兩個判斷,從1到3,從2到3
db.execSQL("ALTER TABLE register ADD phone TEXT;");
}
}
/**
* 查詢表
* @param table 表名 有 BusCard 和 BusCardInfo
* @param where 條件
* @param orderBy 排序 沒有則傳入null
* @return 返回郵標
*/
public Cursor select(String where, String orderBy) {// 返回表中的資料,where是調用時候傳進來的搜索內容,orderby是設置中傳進來的列表排序類型
StringBuilder buf = new StringBuilder("SELECT * FROM "+"Info");
if (where != null) {
buf.append(" WHERE ");
buf.append(where);
}
if (orderBy != null) {
buf.append(" ORDER BY ");
buf.append(orderBy);
}
Log.e("buf", buf.toString());
return (getWritableDatabase().rawQuery(buf.toString(), null));
}
/**
* 插入記錄
* @param id 訂單號
* @param name 姓名
* @param phone 電話
* @param address 地址
* @param money 金額
*/
public void insert(String id,String name,String phone,String address,String money,int state){
ContentValues cv = new ContentValues();
cv.put("id", id);
cv.put("name", name);
cv.put("phone", phone);
cv.put("address", address);
cv.put("money", money);
cv.put("state", state);
getReadableDatabase().insert("Info", "name", cv);
}
/**
* 獲取訂單號
* @param c 查詢後的游標
* @return 訂單號
*/
public String getID(Cursor c){
return c.getString(1);
}
/**
* 獲取姓名
* @param c 查詢後的游標
* @return 姓名
*/
public String getName(Cursor c){
return c.getString(2);
}
/**
* 獲取電話
* @param c 查詢後的游標
* @return 電話
*/
public String gePhone(Cursor c){
return c.getString(3);
}
/**
* 獲取地址
* @param c 查詢後的游標
* @return 地址
*/
public String getAddress(Cursor c){
return c.getString(4);
}
/**
* 獲取金額
* @param c 查詢後的游標
* @return 姓名
*/
public String getMoney(Cursor c){
return c.getString(5);
}
/**
* 獲取狀態
* @param c 查詢後的游標
* @return 狀態
*/
public String getState(Cursor c){
int state = c.getInt(6);
if(state == 0 ){
return "未出貨";
}
return "已出貨";
}
}
| KageRyo-Lab/ClassPractice | 行動裝置程式設計/week16/03/MyDb.java |
64,836 | package model;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* 此class存放order點餐時相關的method(菜單顯示、計算點餐....)
*/
public class Order {
private static String regex = "[\u4e00-\u9fa5]";
public static String fee;
/**
* 輸入店家名稱以獲得其菜單
*
* @param storename 輸入店家名稱
* @return 獲得其菜單
*/
public static String setMenu(String storename) {
Owner owner = MySQLJDBC.findOwnerInName(storename);
String menu = owner.getMenu();
String m = menu.replaceAll("}", "\n").replaceAll("\\p{Punct}", "").replaceAll(" ", "").replaceAll("name", "")
.replaceAll("price", " ");
int full = MySQLJDBC.checkFull(storename);
int discount = MySQLJDBC.checkDiscount(storename);
return m + "\n" + "店家折扣: " + "滿" + full + "送" + discount;
}
/**
* 輸入店家名稱與點餐內容,回傳餐點內容與總價錢
*
* @param storename 輸入店家名稱
* @param order 輸入點餐內容
* @return 回傳餐點內容與總價錢
*/
public static String count(String storename, int cost, double distance, boolean vip) {
Owner owner = MySQLJDBC.findOwnerInName(storename);
if(cost > 199 &&vip) {
cost = (int) (cost + (distance/750*5));
}
return "總共金額 : " + cost+"元";
}
public static int quickcount(String order) {
String[] split = order.split(" ");
int i=0;
i= (Integer.valueOf(split[1]).intValue())*(Integer.valueOf(split[2]).intValue());
return i;
}
public static String setStoreInfromation(String storename) {
Owner owner = MySQLJDBC.findOwnerInName(storename);
String name= "店家名稱: "+owner.getName()+"\n";
String phone= "電話: "+owner.getPhone()+"\n";
String time="營業時間 :\n"+owner.getBusiness_time().replaceAll(",","\n").replaceAll("\\p{Punct}", "").replaceAll(" end", "end time :").replaceAll(" start", "start time :").replaceAll("fri","Friday:\n").replaceAll(" mon","Monday:\n").replaceAll(" sat","Saturday:\n").replaceAll(" sun","Sunday:\n").replaceAll(" thu","Thursday:\n").replaceAll(" tue","Tuesday:\n").replaceAll(" wed","Wednesday:\n")+"\n";
String position=owner.getPosition();
String newPosition[] = position.split("\"");
String position1 ="店家名稱 :"+newPosition[3]+"\n";
String type="餐點類別 :"+owner.getType().replaceAll(","," ").replaceAll("\\p{Punct}", "")+"\n";
String store_description="店家描述 :"+owner.getStore_description()+"\n";
String order_description="點餐描述 :"+owner.getOrder_description();
String information=name+phone+time+position1+type+store_description+order_description;
return information;
}
}
| chiangej/2023OOP_Final | FinalProject/src/model/Order.java |
64,837 | package com.example.joan.myapplication;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.TextView;
import com.example.joan.myapplication.database.model.LawFirmModel;
public class SearchLawFirmDetailActivity extends AppCompatActivity implements View.OnClickListener {
TextView name ;
TextView tag;
TextView addr;
TextView phone;
TextView intro;
TextView major;
LawFirmModel firm;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.law_firm_detail);
firm = (LawFirmModel) getIntent().getSerializableExtra("firm");
initView();
initData();
findViewById(R.id.btn_back).setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v){
finish();
}
});
}
@Override
public void onClick(View v){
switch (v.getId()){
case R.id.like:{
}break;
case R.id.follow:{
}break;
case R.id.contact:{
}break;
}
}
private void initView(){
name = findViewById(R.id.name);
tag = findViewById(R.id.tag);
addr = findViewById(R.id.addr);
phone = findViewById(R.id.phone);
intro = findViewById(R.id.intro);
major = findViewById(R.id.major);
}
private void initData(){
name.setText(firm.getName());
addr.setText("地址:" + firm.getAddress());
phone.setText("電話:" + firm.getPhone());
intro.setText(firm.getIntroduction());
major.setText(firm.getMajor());
}
}
| OliviaXu312/Legal_Assistance_App | myapplication/SearchLawFirmDetailActivity.java |
64,838 | package com.tw.form.dto;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class BloggerData {
String name;
String phone;
String email;
String portfolioLink;
String message;
@Override
public String toString() {
return "姓名:"+ name +"<br>"+
"電話:"+ phone +"<br>"+
"信箱:"+ email +"<br>"+
"作品連結:"+ portfolioLink +"<br>"+
"其他需求:"+ message +"<br>";
}
}
| srwh1234/CHA101G2_TripLight | src/main/java/com/tw/form/dto/BloggerData.java |
64,839 | package com.tw.form.dto;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class ContactData {
String name;
String email;
String phone;
String message;
@Override
public String toString() {
return "姓名:"+ name +"<br>"+
"電話:"+ phone +"<br>"+
"信箱:"+ email +"<br>"+
"其他需求:"+ message +"<br>";
}
}
| srwh1234/CHA101G2_TripLight | src/main/java/com/tw/form/dto/ContactData.java |
64,840 | package com.csim.scu.aibox.model;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
/**
* Created by kenny on 2018/10/24.
*/
public abstract class GasStation {
@Expose
@SerializedName("保養間時間")
private String 保養間時間;
@Expose
@SerializedName("etag儲值時間")
private String etag儲值時間;
@Expose
@SerializedName("洗車類別")
private String 洗車類別;
@Expose
@SerializedName("營業時間")
private String 營業時間;
@Expose
@SerializedName("緯度")
private double 緯度;
@Expose
@SerializedName("經度")
private double 經度;
@Expose
@SerializedName("HappyCash")
private String HappyCash;
@Expose
@SerializedName("一卡通")
private String 一卡通;
@Expose
@SerializedName("悠遊卡")
private String 悠遊卡;
@Expose
@SerializedName("電子發票")
private String 電子發票;
@Expose
@SerializedName("自助柴油站")
private String 自助柴油站;
@Expose
@SerializedName("刷卡自助")
private String 刷卡自助;
@Expose
@SerializedName("會員卡")
private String 會員卡;
@Expose
@SerializedName("超柴")
private String 超柴;
@Expose
@SerializedName("煤油")
private int 煤油;
@Expose
@SerializedName("酒精汽油")
private String 酒精汽油;
@Expose
@SerializedName("無鉛98")
private String 無鉛98;
@Expose
@SerializedName("無鉛95")
private String 無鉛95;
@Expose
@SerializedName("無鉛92")
private String 無鉛92;
@Expose
@SerializedName("國道高速公路")
private int 國道高速公路;
@Expose
@SerializedName("營業中")
private int 營業中;
@Expose
@SerializedName("服務中心")
private String 服務中心;
@Expose
@SerializedName("電話")
private String 電話;
@Expose
@SerializedName("地址")
private String 地址;
@Expose
@SerializedName("鄉鎮區")
private String 鄉鎮區;
@Expose
@SerializedName("縣市")
private String 縣市;
@Expose
@SerializedName("站名")
private String 站名;
@Expose
@SerializedName("類別")
private String 類別;
@Expose
@SerializedName("站代號")
private String 站代號;
@Expose
@SerializedName("_id")
private _id _id;
public String get保養間時間() {
return 保養間時間;
}
public void set保養間時間(String 保養間時間) {
this.保養間時間 = 保養間時間;
}
public String getEtag儲值時間() {
return etag儲值時間;
}
public void setEtag儲值時間(String etag儲值時間) {
this.etag儲值時間 = etag儲值時間;
}
public String get洗車類別() {
return 洗車類別;
}
public void set洗車類別(String 洗車類別) {
this.洗車類別 = 洗車類別;
}
public String get營業時間() {
return 營業時間;
}
public void set營業時間(String 營業時間) {
this.營業時間 = 營業時間;
}
public double get緯度() {
return 緯度;
}
public void set緯度(double 緯度) {
this.緯度 = 緯度;
}
public double get經度() {
return 經度;
}
public void set經度(double 經度) {
this.經度 = 經度;
}
public String getHappyCash() {
return HappyCash;
}
public void setHappyCash(String HappyCash) {
this.HappyCash = HappyCash;
}
public String get一卡通() {
return 一卡通;
}
public void set一卡通(String 一卡通) {
this.一卡通 = 一卡通;
}
public String get悠遊卡() {
return 悠遊卡;
}
public void set悠遊卡(String 悠遊卡) {
this.悠遊卡 = 悠遊卡;
}
public String get電子發票() {
return 電子發票;
}
public void set電子發票(String 電子發票) {
this.電子發票 = 電子發票;
}
public String get自助柴油站() {
return 自助柴油站;
}
public void set自助柴油站(String 自助柴油站) {
this.自助柴油站 = 自助柴油站;
}
public String get刷卡自助() {
return 刷卡自助;
}
public void set刷卡自助(String 刷卡自助) {
this.刷卡自助 = 刷卡自助;
}
public String get會員卡() {
return 會員卡;
}
public void set會員卡(String 會員卡) {
this.會員卡 = 會員卡;
}
public String get超柴() {
return 超柴;
}
public void set超柴(String 超柴) {
this.超柴 = 超柴;
}
public int get煤油() {
return 煤油;
}
public void set煤油(int 煤油) {
this.煤油 = 煤油;
}
public String get酒精汽油() {
return 酒精汽油;
}
public void set酒精汽油(String 酒精汽油) {
this.酒精汽油 = 酒精汽油;
}
public String get無鉛98() {
return 無鉛98;
}
public void set無鉛98(String 無鉛98) {
this.無鉛98 = 無鉛98;
}
public String get無鉛95() {
return 無鉛95;
}
public void set無鉛95(String 無鉛95) {
this.無鉛95 = 無鉛95;
}
public String get無鉛92() {
return 無鉛92;
}
public void set無鉛92(String 無鉛92) {
this.無鉛92 = 無鉛92;
}
public int get國道高速公路() {
return 國道高速公路;
}
public void set國道高速公路(int 國道高速公路) {
this.國道高速公路 = 國道高速公路;
}
public int get營業中() {
return 營業中;
}
public void set營業中(int 營業中) {
this.營業中 = 營業中;
}
public String get服務中心() {
return 服務中心;
}
public void set服務中心(String 服務中心) {
this.服務中心 = 服務中心;
}
public String get電話() {
return 電話;
}
public void set電話(String 電話) {
this.電話 = 電話;
}
public String get地址() {
return 地址;
}
public void set地址(String 地址) {
this.地址 = 地址;
}
public String get鄉鎮區() {
return 鄉鎮區;
}
public void set鄉鎮區(String 鄉鎮區) {
this.鄉鎮區 = 鄉鎮區;
}
public String get縣市() {
return 縣市;
}
public void set縣市(String 縣市) {
this.縣市 = 縣市;
}
public String get站名() {
return 站名;
}
public void set站名(String 站名) {
this.站名 = 站名;
}
public String get類別() {
return 類別;
}
public void set類別(String 類別) {
this.類別 = 類別;
}
public String get站代號() {
return 站代號;
}
public void set站代號(String 站代號) {
this.站代號 = 站代號;
}
public _id get_id() {
return _id;
}
public void set_id(_id _id) {
this._id = _id;
}
public static class _id {
@Expose
@SerializedName("$oid")
private String $oid;
public String get$oid() {
return $oid;
}
public void set$oid(String $oid) {
this.$oid = $oid;
}
}
}
| KennyChenFight/Mango-App | app/src/main/java/com/csim/scu/aibox/model/GasStation.java |
64,841 | package gg.nbp.web.Member.service;
import java.util.List;
import gg.nbp.core.service.CoreService;
import gg.nbp.web.Member.entity.Member;
public interface MemberService extends CoreService {
Member register(Member member); //會員註冊
Member login(Member member); //會員登入
Member edit(Member member); //會員編輯會員資料(只能編輯暱稱、email、電話、大頭照、地址)
List<Member> findAll(); //尋找所有會員
boolean remove(Integer id); //移除會員
public Member forgetPassword(Member member);
Member selectMember(Integer member_id);
}
| YutenC/gg4nbp | src/main/java/gg/nbp/web/Member/service/MemberService.java |
64,843 | package gg.nbp.web.Act.controller;
import gg.nbp.web.Act.model.ApplyData;
import gg.nbp.web.Act.service.EmailSenderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
@CrossOrigin
@RestController
public class ApplyController {
private final EmailSenderService emailSenderService;
@Autowired
public ApplyController(EmailSenderService emailSenderService) {
this.emailSenderService = emailSenderService;
}
@PostMapping("/apply")
public Boolean getApply(@RequestBody ApplyData applyData) {
String message = applyData.toString() + "<br><br>聯絡工作人員🙋🏻:這個男人叫做小帥<br>電話📞:0975654320<br><br>謝謝您報名我們的活動祝您活動愉快";
emailSenderService.sendEmail(applyData.getEmail(), "★★★★★★★★★★★★★★★NBP.gg活動確認單★★★★★★★★★★★★★★★", message);
emailSenderService.sendEmail("[email protected]", "平台方確認表單", message);
return true;
}
// Here you could deserialize the requestBody into an ApplyData object
// For example (assuming you are using the Jackson library)
// ObjectMapper objectMapper = new ObjectMapper();
// ApplyData applyData = objectMapper.readValue(requestBody, ApplyData.class);
// Continue your implementation...
}
| YutenC/gg4nbp | src/main/java/gg/nbp/web/Act/controller/ApplyController.java |
64,844 | package web.donate.controller;
import java.io.IOException;
import java.io.PrintWriter;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.google.gson.Gson;
import ecpay.payment.integration.AllInOne;
import ecpay.payment.integration.domain.AioCheckOutALL;
import web.donate.entity.DonateVO;
import web.donate.service.DonateService;
import web.tools.AuthCode;
/**
* Servlet implementation class NewDonate
*/
@WebServlet("/NewDonate")
public class NewDonate extends HttpServlet {
public static AllInOne allInOne;
protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
doPost(req, res);
}
protected void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
req.setCharacterEncoding("UTF-8");
res.setContentType("text/plain; charset=UTF-8");
String action = req.getParameter("action");
System.out.println("Action = " + action);
// ---------------------------------------Manager_New_Emp---------------------------------------
if ("New_Donate".equals(action)) {
System.out.println("AAAA");
List<String> errorMsgs = new LinkedList<String>();
// Store this set in the request scope, in case we need to
// send the ErrorPage view.
req.setAttribute("errorMsgs", errorMsgs);
// try {
System.out.println(req.getParameter("memID"));
Integer memID = new Integer(req.getParameter("memID"));
Integer catID = new Integer(req.getParameter("catID"));
System.out.println(catID);
String shelterName = req.getParameter("shelterName").trim();
System.out.println(shelterName);
String last_name = req.getParameter("last_name").trim();
String first_name = req.getParameter("first_name").trim();
String donateName = last_name + first_name;
System.out.println(donateName);
String donateEmail = req.getParameter("donateEmail").trim();
System.out.println(donateEmail);
String phone = req.getParameter("phone").trim();
System.out.println(phone);
String city = req.getParameter("city").trim();
String town = req.getParameter("town").trim();
String street_address = req.getParameter("street_address").trim();
String donateAddr = city + town + street_address;
System.out.println(donateAddr);
Integer donateAmo = new Integer(req.getParameter("donateAmo"));
System.out.println(donateAmo);
Integer donateStatus = new Integer(req.getParameter("donateStatus"));
System.out.println(donateStatus);
String donateMes = req.getParameter("donateMes").trim();
System.out.println(donateMes);
String donateEmailReg = "^\\w+((-\\w+)|(\\.\\w+))*\\@[A-Za-z0-9]+((\\.|-)[A-Za-z0-9]+)*\\.[A-Za-z]+$";
if (donateEmail == null || donateEmail.trim().length() == 0) {
System.out.println("Email: 請勿空白");
errorMsgs.add("Email: 請勿空白");
} else if (!donateEmail.trim().matches(donateEmailReg)) { // 以下練習正則(規)表示式(regular-expression)
System.out.println("email: 請輸入正確的格式。");
errorMsgs.add("email: 請輸入正確的格式。");
}
String phoneReg = "^[0-9]{10}$";
if (phone == null || phone.trim().length() == 0) {
System.out.println("電話: 請勿空白");
errorMsgs.add("電話: 請勿空白");
} else if (!phone.trim().matches(phoneReg)) { // 以下練習正則(規)表示式(regular-expression)
System.out.println("電話號碼格式有誤!(09-12123123)");
errorMsgs.add("電話號碼格式有誤!(09-12123123)");
}
DonateVO donVO = new DonateVO();
donVO.setMemID(memID);
donVO.setCatID(catID);
donVO.setShelterName(shelterName);
donVO.setDonateName(donateName);
donVO.setDonateEmail(donateEmail);
donVO.setPhone(phone);
donVO.setDonateAddr(donateAddr);
donVO.setDonateAmo(donateAmo);
donVO.setDonateStatus(donateStatus);
donVO.setDonateMes(donateMes);
// Send the use back to the form, if there were errors
if (!errorMsgs.isEmpty()) {
req.setAttribute("DonateVO", donVO);
RequestDispatcher failureView = req.getRequestDispatcher("/views/donate/donate.jsp");
failureView.forward(req, res);
System.out.println("AAAAAA");
return;
}
DonateService donSvc = new DonateService();
donVO = donSvc.addDonate(memID, catID, shelterName, donateName, donateEmail,phone,donateAddr,donateAmo,donateStatus,donateMes);
req.setAttribute("donVO", donVO);
System.out.println("CCCC");
// String url = "/views/donate/donate.jsp";
// RequestDispatcher successView = req.getRequestDispatcher(url);
// successView.forward(req, res);
//===========================================綠界金流=================================================
AuthCode authcode = new AuthCode();
authcode.setTargetStringLength(10);
String ListID = authcode.givenUsingJava8_whenGeneratingRandomAlphanumericString_thenCorrect();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
String Donatedate = sdf.format(new Date());
String itemName ="Adopets平台-貓咪愛心援助捐款";
allInOne = new AllInOne("");
AioCheckOutALL aCheckOut = new AioCheckOutALL();
aCheckOut.setMerchantTradeNo(donVO.getDonateID() + ListID);
aCheckOut.setMerchantTradeDate(Donatedate);
aCheckOut.setTotalAmount(donateAmo + "");
aCheckOut.setTradeDesc("test");
aCheckOut.setItemName(itemName);
aCheckOut.setClientBackURL("http://localhost:8081/Adopets/views/catInfo/My_home.jsp");
aCheckOut.setReturnURL("http://localhost:8081/Adopets//epayCheckOrder");
// aCheckOut.setReturnURL("http://211.23.128.214:5000/");
aCheckOut.setNeedExtraPaidInfo("N");
String outStr= allInOne.aioCheckOut(aCheckOut, null);
PrintWriter out = res.getWriter();
out.println(outStr);
System.out.println(outStr);
out.close();
// } catch (Exception e) {
// System.out.println("BBBB");
// errorMsgs.add("修改資料失敗:" + e.getMessage());
// RequestDispatcher failureView = req.getRequestDispatcher("/views/donate/donate.jsp");
// failureView.forward(req, res);
// }
}
}
}
| splat131468/Adopets | src/main/java/web/donate/controller/NewDonate.java |
64,845 | package AB;
import java.awt.*;
import javax.swing.*;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel;
import javax.swing.table.TableRowSorter;
import java.io.*;
import java.util.ArrayList;
import java.util.Vector;
//读取学生信息,展示在窗口
@SuppressWarnings("unused")
public class show_stuall {
JTable table = null;
DefaultTableModel model = null;
// 显示全部学生信息
@SuppressWarnings("unchecked")
public show_stuall() {
JFrame jf = new JFrame("顯示學生信息");
JPanel panel = new JPanel();
@SuppressWarnings("rawtypes")
Vector columnNames = createColumnNames();
@SuppressWarnings("rawtypes")
Vector data = createTableModelData();
model = new DefaultTableModel(data, columnNames);
table = new JTable(model);
table.setPreferredScrollableViewportSize(new Dimension(400, 80));
JScrollPane tablePanel = new JScrollPane(table);
table.setForeground(Color.BLACK);
table.setFont(new Font(null, Font.PLAIN, 14));
table.setSelectionForeground(Color.DARK_GRAY);
table.setSelectionBackground(Color.LIGHT_GRAY);
table.setGridColor(Color.GRAY);
table.getTableHeader().setFont(new Font(null, Font.BOLD, 14));
table.getTableHeader().setForeground(Color.RED);
table.getTableHeader().setResizingAllowed(false);
table.getTableHeader().setReorderingAllowed(false);
table.setRowHeight(40);
table.getColumnModel().getColumn(0).setPreferredWidth(40);
table.setPreferredScrollableViewportSize(new Dimension(900, 320));
// 排序器
@SuppressWarnings({ "rawtypes" })
RowSorter sorter = new TableRowSorter(model);
table.setRowSorter(sorter);
JScrollPane pane = new JScrollPane(table);
JScrollPane scrollPane = new JScrollPane(table);
panel.add(scrollPane);
// JScrollPane pane = new JScrollPane(table);
// 设置 内容面板 到 窗口
jf.setContentPane(panel);
jf.pack();
jf.setSize(900, 600);
jf.add(scrollPane, BorderLayout.CENTER);
// 数据居中显示
DefaultTableCellRenderer r = new DefaultTableCellRenderer();
r.setHorizontalAlignment(JLabel.CENTER);
table.setDefaultRenderer(Object.class, r);
jf.setLocationRelativeTo(null);
int t = table.getRowCount();
if (t <= 0) {
JOptionPane.showMessageDialog(null, "系统中還没有登入學生資訊!!!");
jf.setVisible(false);
} else {
jf.setVisible(true);
}
}
@SuppressWarnings({ "rawtypes", "unchecked" })
private Vector createColumnNames() {
Vector columnNames = new Vector();
// columnNames.add("序号");
columnNames.add("學號");
columnNames.add("姓名");
columnNames.add("性别");
columnNames.add("年齡");
//columnNames.add("電話");
columnNames.add(" ");
columnNames.add(" ");
return columnNames;
}
@SuppressWarnings({ "rawtypes", "unchecked" })
private Vector createTableModelData() {
Vector data = new Vector();
String t = null;
try {
FileReader f1 = new FileReader("D:\\student.txt");
BufferedReader br = new BufferedReader(f1);
// arry.clear();// 清除原数组列表中的数据
int i = 0;
while ((t = br.readLine()) != null) {
String[] s = t.split(",|\\s|;"); // 通过空格分割字符串数组
Vector rowData = new Vector();
// rowData.add("i");
rowData.add(s[0]);
rowData.add(s[1]);
rowData.add(s[2]);
rowData.add(s[3]);
rowData.add(" ");
rowData.add(" ");
rowData.add(" ");
data.add(rowData);
// System.out.print(s[6]);
i++;
}
f1.close();
br.close();
} catch (IOException e) {
// TODO 自动生成的 catch 块
e.printStackTrace();
}
return data;
}
}
| einsyang723/KYUTES | AB/show_stuall.java |
64,879 | package com.his.surgery.entity;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
/**
* 护士
*/
@Entity
public class Nurse {
private int nurseId;
private String nurseName;
@Id
@Column(name = "nurse_id", nullable = false)
public int getNurseId() {
return nurseId;
}
public void setNurseId(int nurseId) {
this.nurseId = nurseId;
}
@Basic
@Column(name = "nurse_name", nullable = true, length = 8)
public String getNurseName() {
return nurseName;
}
public void setNurseName(String nurseName) {
this.nurseName = nurseName;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Nurse nurse = (Nurse) o;
if (nurseId != nurse.nurseId) return false;
if (nurseName != null ? !nurseName.equals(nurse.nurseName) : nurse.nurseName != null) return false;
return true;
}
@Override
public int hashCode() {
int result = nurseId;
result = 31 * result + (nurseName != null ? nurseName.hashCode() : 0);
return result;
}
}
| weituotian/HIS_surgery | src/com/his/surgery/entity/Nurse.java |
64,880 | package com.forge.shiro;
/**
* shiro角色的常量接口,配合权限注解使用
*/
public interface RoleConst {
/**
* 超级管理员
*/
String ADMIN = "admin";
/**
* 管理员
*/
String MANAGER = "manager";
/**
* 护士
*/
String NURSE = "nurse";
/**
* 临时工
*/
String LOSER = "loser";
/**
* 医生
*/
String DOCTOR = "doctor";
/**
* 用户
*/
String CLIENT = "client";
}
| MixJade/MixPet | forgePet/src/main/java/com/forge/shiro/RoleConst.java |
64,883 | package pkuhit.xap.ac;
import java.util.List;
import java.util.Map;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import xap.sv.annotation.Service;
import xap.sv.servlet.mvc.annotation.ModelAttribute;
import xap.sv.servlet.mvc.annotation.RequestParam;
import xap.sv.model.ArrayResult;
import xap.sv.model.SingleResult;
/**
* 用户角色资源相关的服务接口
* @author wu.junhui
*
*/
@Service
public interface UserRoleService
{
/**
* 1、更新用户信息,只会更新密码和用户启用状态
* 2、更新用户权限,需要科室code,用户id和角色code
* @description 创建用户角色
* @author jiao_xiantong
* @date 2014年12月12日 上午11:23:14
* @param user
* @return
*/
@RequestMapping(value = "/user/role", method = RequestMethod.POST)
public SingleResult<UserRole> create(@ModelAttribute User user);
/**
* 更新用户角色
* @param userRole
* @return
*/
@RequestMapping(value = "/user/role/{id}", method = RequestMethod.PUT)
public SingleResult<UserRole> update(@PathVariable("id") String userRoleId, @ModelAttribute UserRole userRole);
/**
* 删除用户角色
* @param userRoleId
* @return
*/
@RequestMapping(value = "/user/role/{id}", method = RequestMethod.DELETE)
public SingleResult<UserRole> delete(@PathVariable("id") String userRoleId);
/**
* 获取用户角色
* @param userRoleId
* @return
*/
@RequestMapping(value = "/user/role/{id}", method = RequestMethod.GET)
public SingleResult<UserRole> selectById(@PathVariable("id") String userRoleId);
/**
* 查询用户角色列表
* @param userId String [用户ID]查询条件
* @param orgCd String [组织结构编码]查询条件
* @param roleId String [角色id]查询条件
* @return
*/
@RequestMapping(value = "/user/roles", method = RequestMethod.GET)
public ArrayResult<UserRole> search(@RequestParam Map<String, String> params);
/**
* 根据用户id 查询角色,是医生,护士,还是科室管理员
* @param userId 用户id
* @return 医生 护士标志 医生(临床医生 门诊医生) --1 ,护士---0,其他为null
*
* */
@RequestMapping(value = "/user/role/getDNFlag", method = RequestMethod.POST)
public SingleResult<Integer> getDoctorOrNurseFlag(@RequestParam("userId") String userId);
/**
* 获取有病历管理权限的科室列表
* @param userId 用户
* @param searchDeptCode 查询科室
* @return 全院返回空列表,科室返回科室列表,没有科室返回null
* 本用户有全院病历管理员权限,可以修改所有科室病历
* 本用户有科室病历管理员权限,可以修改自己管理的科室病历
* */
@RequestMapping(value = "/user/roles/mrb", method = RequestMethod.GET)
public List<String> userRoleMrbDeptList(@RequestParam("userId") String userId,@RequestParam("searchDeptCode") String searchDeptCode ) ;
/**
* 验证当前是医生还是实习医生
* */
public Boolean checkPracticeDoctor(String userId,String deptCd) ;
/**
* 验证当前登录医生有没有提交病历权限
* 科室 登录名 密码 验证
* @param loginNm 用户
* @param Pwd 密码
* @param deptCd 创建科室
* @return 返回医生信息
* */
@RequestMapping(value = "/user/roles/mrCheckSubmitUser", method = RequestMethod.POST)
public Object mrCheckSubmitUser(@ModelAttribute User user) ;
}
| gjkfyy/emr-code | pkuhit.xap-api/src/main/java/pkuhit/xap/ac/UserRoleService.java |
64,884 | package com.olocat.nsims.mapper;
import com.olocat.nsims.pojo.person.Nurse;
import java.util.List;
/**
* 护士 Mapper 接口
* @author olocat
* @date 2019/9/9
* @version 0.2.0
*/
public interface NurseMapper {
/**
* 获取全部护士信息
* @return 护士信息集合
*/
List<Nurse> getNurseList();
/**
* 获取指定护士信息
* @param nurseID 要获护士的 ID
* @return 护士信息
*/
Nurse getNurseByID(String nurseID);
/**
* 更新护士信息
* @param nurse 要更新护士信息
*/
void updateNurse(Nurse nurse);
/**
* 添加护士信息
* @param nurse 要添加的护士信息
*/
void addNurse(Nurse nurse);
/**
* 删除护士信息
* @param nurseID 被删除的护士 ID
*/
void deleteNurseByID(String nurseID);
}
| olocat/nsims | src/main/java/com/olocat/nsims/mapper/NurseMapper.java |
64,885 | package com.lachesis.mnis.web;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import com.lachesis.mnis.core.OrderService;
import com.lachesis.mnis.core.PatientService;
import com.lachesis.mnis.core.constants.MnisConstants;
import com.lachesis.mnis.core.identity.entity.UserInformation;
import com.lachesis.mnis.core.order.entity.OrderExecGroup;
import com.lachesis.mnis.core.task.TaskService;
import com.lachesis.mnis.core.util.DateUtil;
import com.lachesis.mnis.core.util.DateUtil.DateFormat;
import com.lachesis.mnis.core.util.GsonUtils;
import com.lachesis.mnis.web.common.ResultCst;
import com.lachesis.mnis.web.common.util.WebContextUtils;
import com.lachesis.mnis.web.common.vo.BaseListVo;
import com.lachesis.mnis.web.common.vo.BaseVo;
import com.lachesis.mnis.web.vo.OrderFreqPlanTimeVo;
/**
* The class BodySignRecordAction.
*
* 护士--医嘱管理相关
*
* @author yuliang.xu
* @since: 2014-9-2
* @version: $Revision$ $Date$ $LastChangedBy$
*
*/
//@Controller
//@RequestMapping(ActionCst.FORWARD_NURSE_ORDER_MANAGER)
public class NurseOrderManagerAction {
static final Logger LOGGER = LoggerFactory.getLogger(NurseOrderManagerAction.class);
@Autowired
private OrderService orderService;
@Autowired
private PatientService patientService;
@Autowired
private TaskService taskService;
@RequestMapping("/check")
public String orderCHeck(Model model, String patientId){
model.addAttribute("patientId", patientId);
model.addAttribute("currentDate", DateUtil.format(DateFormat.YMD));
return "/test/prescriptionCheck";
}
@RequestMapping("/exec")
public String orderExec(Model model, String patientId){
model.addAttribute("patientId", patientId);
model.addAttribute("currentDate", DateUtil.format(DateFormat.YMD));
return "/test/prescriptionExe";
}
/**
* 查询病人列表的待审核医嘱
* @param patientIds 可传入选择的病人id列表,已逗号分隔
* @param orderTypeCode 医嘱类型,全部/CZ/LZ,pc端查询字段
* @param startTime 医嘱开立开始时间
* @param endTime 医嘱开立结束时间
* @param state
* @return
*/
@RequestMapping("/selectPatientDoctorCreateOrder")
public @ResponseBody
BaseListVo getPatientListOrderDetail(
@RequestParam(value = "patientIdList", required = false) String patientIds,
@RequestParam(value = "orderTypeCode", required = false) String orderTypeCode,
@RequestParam(value = "state", required = false) String state,
@RequestParam(value = "startTime", required = false) String startTime,
@RequestParam(value = "endTime", required = false) String endTime
) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(" >>>>>>>>>>>>> NurseOrderManagerAction execute getPatientListOrderDetail, patientIds:" + patientIds
+", orderTypeCode:"+orderTypeCode +", startTime:"+startTime+", endTime:"+endTime);
}
BaseListVo vo = new BaseListVo();
List<String> patientIdList = null;
// 查询出病人列表
if (StringUtils.isEmpty(patientIds)) {
UserInformation userInformation = WebContextUtils.getSessionUserInfo();
patientIdList = patientService.getAttention(userInformation.getCode(), userInformation.getDeptCode());
}else{
patientIdList = Arrays.asList(patientIds.split(MnisConstants.COMMA));
}
if(patientIdList == null || patientIdList.size() == 0){
vo.setRslt(ResultCst.INVALID_PARAMETER);
vo.setMsg("未关注的任何病人");
return vo;
}
try {
vo.setList(orderService.getOrderBaseGroupList(patientIdList, orderTypeCode, state, startTime, endTime));
vo.setRslt(ResultCst.SUCCESS);
return vo;
} catch (Exception e) {
LOGGER.info(ResultCst.INVALID_PARAMETER, e);
vo.setRslt(ResultCst.INVALID_PARAMETER);
vo.setMsg("系统出现出错");
return vo;
}
}
/**
* NDA端根据护士id查询关注病人列表的待审核医嘱
* @param nurseId 护士ID,根据护士ID获取护士所关注的病人列表
* @return
*/
@RequestMapping("/attentPatientDoctorCreateOrder")
@ResponseBody
public BaseListVo getPatientListOrderDetail(
String nurseId,
String deptCode,
@RequestParam(value = "orderTypeCode", required = false) String orderTypeCode,
@RequestParam(value = "state", required = false) String state) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(" >>>>>>>>>>>>> NurseOrderManagerAction execute getPatientListOrderDetail, nurseId:" + nurseId);
}
BaseListVo vo = new BaseListVo();
//查询出关注的病人列表
List<String> patientIdList = patientService.getAttention(nurseId, deptCode);
if(patientIdList == null || patientIdList.size() == 0){
vo.setRslt(ResultCst.INVALID_PARAMETER);
vo.setMsg("未关注的任何病人");
return vo;
}
try {
// vo.setList(orderService.getOrderBaseGroupList(patientIdList, orderTypeCode, state, null, null));
vo.setRslt(ResultCst.SUCCESS);
return vo;
} catch (Exception e) {
LOGGER.info(ResultCst.INVALID_PARAMETER, e);
vo.setRslt(ResultCst.INVALID_PARAMETER);
vo.setMsg("系统出现出错");
return vo;
}
}
/**
* 分解医嘱
* @param nurseId 护士ID,分解护士所有关注病人的医嘱
* @param orderGroupId 医嘱组id,分解医嘱组id对应的医嘱,多个已逗号分隔
* @return
*/
@RequestMapping("/decomposeOrder")
@ResponseBody
public BaseListVo decomposeOrder(
@RequestParam(value = "nurseId", required = false) String nurseId,
@RequestParam(value = "patientIdList", required = false) String patientIds ,
@RequestParam(value = "orderTypeCode", required = false) String orderTypeCode,
@RequestParam(value = "state", required = false) String state,
@RequestParam(value = "startTime", required = false) String startTime,
@RequestParam(value = "endTime", required = false) String endTime) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(" >>>>>>>>>>>>> NurseOrderManagerAction execute decomposeOrder, nurseId:" + nurseId);
}
BaseListVo vo = new BaseListVo();
/*List<String> patientIdList = null;
// 查询出病人列表
if (StringUtils.isEmpty(patientIds)) {
patientIdList = taskService.getAttention(nurseId);
}else{
patientIdList = Arrays.asList(patientIds.split(CommonCst.COMMA));
}
if(patientIdList == null || patientIdList.size() == 0){
vo.setRslt(ResultCst.INVALID_PARAMETER);
vo.setMsg("未关注或未选择的任何病人");
return vo;
}
vo.setLst(orderService.handDecompPendingOrderGroups(patientIdList, orderTypeCode, state, startTime, endTime));
vo.setRslt(ResultCst.SUCCESS);*/
return vo;
}
@RequestMapping("/decomposeOrderFromGroupNo")
@ResponseBody
public BaseListVo decomposeOrderByGroupNo(
@RequestParam(value = "orderGroupNo") String orderGroupNo) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(" >>>>>>>>>>>>> NurseOrderManagerAction execute decomposeOrderByGroupNo, orderGroupNo:" + orderGroupNo);
}
BaseListVo vo = new BaseListVo();
/*List<String> groupNoList = Arrays.asList(orderGroupNo.split(CommonCst.COMMA));
if(groupNoList == null || groupNoList.size() == 0){
vo.setRslt(ResultCst.INVALID_PARAMETER);
vo.setMsg("医嘱组号不能为空");
return vo;
}
vo.setLst(orderService.handDecompPendingOrderGroups(groupNoList));
vo.setRslt(ResultCst.SUCCESS);
vo.setMsg("医嘱审核成功");*/
return vo;
}
@RequestMapping("/getAllPendingOrder")
@ResponseBody
public BaseListVo getAllPenddingOrder(
@RequestParam(value = "nurseId", required = false) String userCode,
@RequestParam(value = "deptCode", required = false) String deptCode,
@RequestParam(value = "patientIdList", required = false) String patientIds,
@RequestParam(value = "orderTypeCode", required = false) String orderTypeCode,
@RequestParam(value = "orderExecTypeCode", required = false) String orderExecTypeCode,
@RequestParam(value = "startTime", required = false) String startPlanTime,
@RequestParam(value = "endTime", required = false) String endPlanTime) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(" >>>>>>>>>>>>> NurseOrderManagerAction execute getAllPenddingOrder, nurseId:" + userCode);
}
BaseListVo vo = new BaseListVo();
List<String> patientIdList = null;
// 查询出病人列表
if (StringUtils.isEmpty(patientIds)) {
patientIdList = patientService.getAttention(userCode, deptCode);
}else{
patientIdList = Arrays.asList(patientIds.split(MnisConstants.COMMA));
}
if(patientIdList == null || patientIdList.size() == 0){
vo.setRslt(ResultCst.INVALID_PARAMETER);
vo.setMsg("未关注或未选择的任何病人");
return vo;
}
//删除
// List<OrderExecGroup> orderGroup = orderService.getAllOrderExecOrder(patientIdList, orderTypeCode, orderExecTypeCode, startPlanTime, endPlanTime);
List<OrderExecGroup> orderGroup = new ArrayList<>();
for (OrderExecGroup orderExecGroup : orderGroup) {
orderExecGroup.getOrderGroup().setPatientBedCode(orderExecGroup.getOrderGroup().getPatientBedCode());
orderExecGroup.getOrderExecLog().setPlanDate(orderExecGroup.getOrderExecLog().getPlanDate());
orderExecGroup.getOrderGroup().setCreateDate(orderExecGroup.getOrderGroup().getCreateDate());
}
vo.setList(orderGroup);
vo.setRslt(ResultCst.SUCCESS);
return vo;
}
/**
* 设置部门频次默认执行时间
* @param orderFreqList
* @return
*/
@RequestMapping("/setFreqDefaultPlanTime")
@ResponseBody
public BaseListVo insertOrderFreqPlanTimeRecord(String lst){
BaseListVo vo = new BaseListVo();
OrderFreqPlanTimeVo result = GsonUtils.fromJson(lst, OrderFreqPlanTimeVo.class);
if(result == null || result.getOrderFreqList() == null || result.getOrderFreqList().size() == 0){
vo.setRslt(ResultCst.INVALID_PARAMETER);
vo.setMsg("不合法的参数");
return vo;
}
//删除...
// try {
// orderService.insertOrderFreqPlanTimeRecord(result.getOrderFreqList());
// }catch(Exception e){
// LOGGER.error("", e);
// vo.setList(result.getOrderFreqList());
// vo.setRslt(ResultCst.SYSTEM_ERROR);
// vo.setMsg("设置部门频次默认执行时间失败");
// return vo;
// }
vo.setList(result.getOrderFreqList());
vo.setRslt(ResultCst.SUCCESS);
vo.setMsg("成功设置部门频次默认执行时间");
return vo;
}
/**
* 获取某个部门频次默认执行时间
* @param deptCode
* @return
*/
@RequestMapping("/getFreqDefaultPlanTime")
@ResponseBody
public BaseListVo getOrderFreqPlanTimeByDeptCode(String deptCode){
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(" >>>>>>>>>>>>> NurseOrderManagerAction execute getOrderFreqPlanTimeByDeptCode, deptCode:" + deptCode);
}
BaseListVo vo = new BaseListVo();
if(StringUtils.isBlank(deptCode)){
vo.setRslt(ResultCst.INVALID_PARAMETER);
vo.setMsg("部门不能为空");
return vo;
}
//删除...
// vo.setList(orderService.getDeptOrderGroupPlanExecTime(deptCode));
vo.setRslt(ResultCst.SUCCESS);
vo.setMsg("成功设置开立医嘱执行时间");
return vo;
}
/**
* 设置开立医嘱执行时间,首次执行时间
* @param orderFreqList
* @return
*/
@RequestMapping("/setOrderDefaultPlanTime")
@ResponseBody
public BaseVo setOrderGroupPlanExecTime(String orderGroupNo, String planExecTime, String firstPlanExecTime){
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(" >>>>>>>>>>>>> NurseOrderManagerAction execute setOrderGroupPlanExecTime, orderGroupNo:" + orderGroupNo
+ ", planExecTime:" + planExecTime + ", firstPlanExecTime:" + firstPlanExecTime);
}
BaseVo vo = new BaseVo();
//删除...
//
// try {
// orderService.setOrderGroupPlanExecTime(orderGroupNo, planExecTime, firstPlanExecTime);
// }catch(Exception e){
// LOGGER.info("", e);
// vo.setRslt(ResultCst.SYSTEM_ERROR);
// vo.setMsg("设置开立医嘱执行时间失败");
// return vo;
// }
//
vo.setRslt(ResultCst.SUCCESS);
vo.setMsg("成功设置开立医嘱执行时间");
return vo;
}
/**
* 设置待执行医嘱计划执行时间
* @param orderFreqList
* @return
*/
@RequestMapping("/setPendingOrderPlanTime")
@ResponseBody
public BaseVo setOrderExecPlanTime(String orderExecId, String planExecTime){
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(" >>>>>>>>>>>>> NurseOrderManagerAction execute setOrderExecPlanTime, orderExecId:" + orderExecId
+ ", planExecTime:" + planExecTime);
}
BaseVo vo = new BaseVo();
//删除...
// try {
// orderService.setOrderExecPlanTime(orderExecId, planExecTime);
// }catch(Exception e){
// LOGGER.error("", e);
// vo.setRslt(ResultCst.SYSTEM_ERROR);
// vo.setMsg("设置待执行医嘱计划执行时间失败");
// return vo;
// }
vo.setRslt(ResultCst.SUCCESS);
vo.setMsg("成功设置待执行医嘱计划执行时间");
return vo;
}
}
| gavin2lee/incubator | mnis/web/src/main/java/com/lachesis/mnis/web/NurseOrderManagerAction.java |
64,886 | package com.yly.cdr.hl7.dto;
import java.util.List;
import org.hibernate.validator.constraints.NotEmpty;
import com.yly.cdr.hl7.dto.OrderItems;
public class OtherOrder extends BaseDto
{
/**
* 域ID
*/
@NotEmpty(message = "{OtherOrder.patientDomain}")
private String patientDomain;
/**
* 门诊系统患者ID
*/
@NotEmpty(message = "{OtherOrder.patientLid}")
private String patientLid;
/**
* 床号
*/
private String bedNo;
// $Author :tong_meng
// $Date : 2012/9/17 11:30$
// [BUG]0009718 ADD BEGIN
/**
* 患者姓名
*/
// @NotEmpty(message = "{OtherOrder.patientName}")
private String patientName;
/**
* 性别代码
*/
// @NotEmpty(message = "{OtherOrder.genderCode}")
private String genderCode;
/**
* 出生日期
*/
// @NotEmpty(message = "{OtherOrder.birthday}")
// [BUG]0009718 ADD END
private String birthday;
/**
* 年龄
*/
private String age;
// $Author :tong_meng
// $Date : 2012/9/17 11:30$
// [BUG]0009718 ADD BEGIN
/**
* 确认时间(护士)
*/
// @NotEmpty(message = "{OtherOrder.nurseConfirmTime}")
private String nurseConfirmTime;
/**
* 确认人标识(护士)
*/
// @NotEmpty(message = "{OtherOrder.nurseConfirmPerson}")
private String nurseConfirmPerson;
/**
* 确认人姓名(护士)
*/
// @NotEmpty(message = "{OtherOrder.nurseConfirmPersonName}")
private String nurseConfirmPersonName;
// [BUG]0009718 ADD END
/**
* 医嘱项信息
*/
@NotEmpty(message = "{OtherOrder.OrderItems}")
private List<OrderItems> OrderItems;
/**
* 就诊次数
*/
// @NotEmpty(message = "{OtherOrder.visitTimes}")
private String visitTimes;
/**
* 患者所在科室标识
*/
private String deptNo;
/**
* 患者所在科室名称
*/
private String deptName;
/**
* 患者所在病区ID
*/
private String wardNo;
/**
* 患者所在病区名
*/
private String wardName;
/**
* 医嘱描述
*/
private String orderDescibe;
/**
* 医嘱组套编码
*/
private String orderSetCode;
/**
* 就诊流水号
*/
@NotEmpty(message = "{OtherOrder.visitOrdNo}")
private String visitOrdNo;
/**
* 就诊类别编码
*/
@NotEmpty(message = "{OtherOrder.visitType}")
private String visitType;
/**
* 就诊类别名称
*/
//@NotEmpty(message = "{OtherOrder.visitTypeName}")
private String visitTypeName;
public String getWardNo()
{
return wardNo;
}
public String getWardName()
{
return wardName;
}
public String getDeptNo()
{
return deptNo;
}
public String getDeptName()
{
return deptName;
}
public String getPatientDomain()
{
return patientDomain;
}
public String getPatientLid()
{
return patientLid;
}
public String getBedNo()
{
return bedNo;
}
public String getPatientName()
{
return patientName;
}
public String getGenderCode()
{
return genderCode;
}
public String getBirthday()
{
return birthday;
}
public String getAge()
{
return age;
}
public List<OrderItems> getOrderItems()
{
return OrderItems;
}
public String getNurseConfirmTime()
{
return nurseConfirmTime;
}
public String getNurseConfirmPerson()
{
return nurseConfirmPerson;
}
public String getNurseConfirmPersonName()
{
return nurseConfirmPersonName;
}
public String getVisitTimes()
{
return visitTimes;
}
public String getOrderDescibe() {
return orderDescibe;
}
public String getOrderSetCode() {
return orderSetCode;
}
public String getVisitOrdNo() {
return visitOrdNo;
}
public String getVisitType() {
return visitType;
}
public void setOrderDescibe(String orderDescibe) {
this.orderDescibe = orderDescibe;
}
@Override
public String toString()
{
StringBuilder builder = new StringBuilder();
builder.append("OtherOrder [patientDomain=");
builder.append(patientDomain);
builder.append(", patientLid=");
builder.append(patientLid);
builder.append(", OrderItems=");
builder.append(OrderItems);
builder.append(", visitTimes=");
builder.append(visitTimes);
builder.append(", orderDescibe=");
builder.append(orderDescibe);
builder.append(", orderSetCode=");
builder.append(orderSetCode);
builder.append(", visitOrdNo=");
builder.append(visitOrdNo);
builder.append(", visitType=");
builder.append(visitType);
builder.append("]");
return builder.toString();
}
}
| medicalhome/szbj-code | cdr.batch/src/main/java/com/yly/cdr/hl7/dto/OtherOrder.java |
64,887 | package com.ar.evan.arnavigation.model;
import java.util.List;
import lombok.Data;
/**
* Created by Evan on 2018/3/4.
*/
@Data
public class DataVO {
/**
* name : 黄河路
* type : 1
* locationList : [{"id":"123456","name":"丹尼斯","latitude":12.335,"longitude":34.225,"altitude":5.2,"description":"一个购物的地方","icon":"http://www.dennis.com.cn/u/cms/www/201707/191157482x37.jpg","link":"http://122.114.223.188/toShow?VRourEditor=206","people":[{"name":"jack","responsibility":"doctor","phone":"13253312194"},{"name":"evan","responsibility":"护士","phone":"13565667488"}]},{"id":"123457","name":"微阿科技","latitude":44.123,"longtitude":33.124,"altitude":5.2,"description":"公司","icon":"http://www.dennis.com.cn/u/cms/www/201707/191157482x37.jpg","link":"http://122.114.223.188/toShow?VRourEditor=206","people":[{"name":"linda","responsibility":"doctor","phone":"1325355555"},{"name":"tim","responsibility":"护士","phone":"13561125488"}]}]
*/
private String name;
private int type;
private String locations;
}
| Evanlovea/AR-App | ARNavigation/app/src/main/java/com/ar/evan/arnavigation/model/DataVO.java |
64,888 | package com.hspedu.homework;
import javax.print.Doc;
public class HomeWork10 {
public static void main(String[] args) {
Doctor doctor = new Doctor("张三", 23, "牙医", '男', 3000);
Doctor doctor1 = new Doctor("张三", 23, "牙医", '男', 3000);
Doctor doctor2 = new Doctor("李四", 23, "护士", '男', 3000);
System.out.println(doctor.equals(doctor1)); // true
System.out.println(doctor.equals(doctor2)); // false
}
}
class Doctor {
private String name;
private int age;
private String job;
private char gender;
private double sal;
public Doctor(String name, int age, String job, char gender, double sal) {
this.name = name;
this.age = age;
this.job = job;
this.gender = gender;
this.sal = sal;
}
@Override
public boolean equals(Object obj) {
// 判断两个比较对象是否相同
if (this == obj) { // 同一个对象
return true;
}
if (obj instanceof Doctor) { // 判断 obj 是否是 Doctor类型或其子类
Doctor d = (Doctor) obj; // 向下转型
return this.name.equals(d.name) && this.age == d.age && this.job.equals(d.job)
&& this.gender == d.gender && this.sal == d.sal;
}
return false;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public String getJob() {
return job;
}
public void setJob(String job) {
this.job = job;
}
public char getGender() {
return gender;
}
public void setGender(char gender) {
this.gender = gender;
}
public double getSal() {
return sal;
}
public void setSal(double sal) {
this.sal = sal;
}
} | CharlieHon/Java-base | chapter08/src/com/hspedu/homework/HomeWork10.java |
64,890 | package com.dao;
import com.entity.HushiEntity;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import java.util.List;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.pagination.Pagination;
import org.apache.ibatis.annotations.Param;
import com.entity.vo.HushiVO;
import com.entity.view.HushiView;
/**
* 护士
*
* @author
* @email
* @date 2021-04-15 15:10:23
*/
public interface HushiDao extends BaseMapper<HushiEntity> {
List<HushiVO> selectListVO(@Param("ew") Wrapper<HushiEntity> wrapper);
HushiVO selectVO(@Param("ew") Wrapper<HushiEntity> wrapper);
List<HushiView> selectListView(@Param("ew") Wrapper<HushiEntity> wrapper);
List<HushiView> selectListView(Pagination page,@Param("ew") Wrapper<HushiEntity> wrapper);
HushiView selectView(@Param("ew") Wrapper<HushiEntity> wrapper);
}
| 1120041844/HospitalManagementSystem | src/main/java/com/dao/HushiDao.java |
64,891 | package com.example.demo.pojo;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.*;
/**
* 医生基本信息表
*
* @author Autumn
* @email
* @date 2019-10-22 16:25:35
*/
@Table(name = "dzm_his_doctor")
public class DzmHisDoctor implements Serializable {
private static final long serialVersionUID = 1L;
//用户id
@Id
private Integer id;
//用户个人资料真实姓名
@Column(name = "true_name")
private String trueName;
//年龄
@Column(name = "age")
private Integer age;
//头像
@Column(name = "picture")
private String picture;
//性别 0,空1:男 2:女
@Column(name = "sex")
private Integer sex;
//学历 1:专科 2:本科 3:研究生 4:博士 5:博士后
@Column(name = "background")
private Integer background;
//手机号
@Column(name = "phone")
private String phone;
//邮箱
@Column(name = "mailbox")
private String mailbox;
//擅长
@Column(name = "strong")
private String strong;
//荣誉
@Column(name = "honor")
private String honor;
//简介
@Column(name = "introduction")
private String introduction;
//注册时间
@Column(name = "create_time")
private Integer createTime;
//修改时间
@Column(name = "update_time")
private Integer updateTime;
//用户表userid
@Column(name = "uid")
private Integer uid;
//科室id
@Column(name = "department_id")
private Integer departmentId;
//医生级别 0:其他 1:主治医师 2:副主任医师 3:主任医师 4:医士 5:医师 6:助理医师 7:实习医师 8:主管护师 9:护师 10:护士 11:医师助理 12:研究生 13:随访员
@Column(name = "rank")
private Integer rank;
public DzmHisDoctor(String trueName, Integer age, Integer sex, String phone, Integer createTime, Integer updateTime,
Integer uid, Integer departmentId, Integer rank) {
super();
this.trueName = trueName;
this.age = age;
this.sex = sex;
this.phone = phone;
this.createTime = createTime;
this.updateTime = updateTime;
this.uid = uid;
this.departmentId = departmentId;
this.rank = rank;
}
/**
* 设置:用户id
*/
public void setId(Integer id) {
this.id = id;
}
/**
* 获取:用户id
*/
public Integer getId() {
return id;
}
/**
* 设置:用户个人资料真实姓名
*/
public void setTrueName(String trueName) {
this.trueName = trueName;
}
/**
* 获取:用户个人资料真实姓名
*/
public String getTrueName() {
return trueName;
}
/**
* 设置:年龄
*/
public void setAge(Integer age) {
this.age = age;
}
/**
* 获取:年龄
*/
public Integer getAge() {
return age;
}
/**
* 设置:头像
*/
public void setPicture(String picture) {
this.picture = picture;
}
/**
* 获取:头像
*/
public String getPicture() {
return picture;
}
/**
* 设置:性别 0,空1:男 2:女
*/
public void setSex(Integer sex) {
this.sex = sex;
}
/**
* 获取:性别 0,空1:男 2:女
*/
public Integer getSex() {
return sex;
}
/**
* 设置:学历 1:专科 2:本科 3:研究生 4:博士 5:博士后
*/
public void setBackground(Integer background) {
this.background = background;
}
/**
* 获取:学历 1:专科 2:本科 3:研究生 4:博士 5:博士后
*/
public Integer getBackground() {
return background;
}
/**
* 设置:手机号
*/
public void setPhone(String phone) {
this.phone = phone;
}
/**
* 获取:手机号
*/
public String getPhone() {
return phone;
}
/**
* 设置:邮箱
*/
public void setMailbox(String mailbox) {
this.mailbox = mailbox;
}
/**
* 获取:邮箱
*/
public String getMailbox() {
return mailbox;
}
/**
* 设置:擅长
*/
public void setStrong(String strong) {
this.strong = strong;
}
/**
* 获取:擅长
*/
public String getStrong() {
return strong;
}
/**
* 设置:荣誉
*/
public void setHonor(String honor) {
this.honor = honor;
}
/**
* 获取:荣誉
*/
public String getHonor() {
return honor;
}
/**
* 设置:简介
*/
public void setIntroduction(String introduction) {
this.introduction = introduction;
}
/**
* 获取:简介
*/
public String getIntroduction() {
return introduction;
}
/**
* 设置:注册时间
*/
public void setCreateTime(Integer createTime) {
this.createTime = createTime;
}
/**
* 获取:注册时间
*/
public Integer getCreateTime() {
return createTime;
}
/**
* 设置:修改时间
*/
public void setUpdateTime(Integer updateTime) {
this.updateTime = updateTime;
}
/**
* 获取:修改时间
*/
public Integer getUpdateTime() {
return updateTime;
}
/**
* 设置:用户表userid
*/
public void setUid(Integer uid) {
this.uid = uid;
}
/**
* 获取:用户表userid
*/
public Integer getUid() {
return uid;
}
/**
* 设置:科室id
*/
public void setDepartmentId(Integer departmentId) {
this.departmentId = departmentId;
}
/**
* 获取:科室id
*/
public Integer getDepartmentId() {
return departmentId;
}
/**
* 设置:医生级别 0:其他 1:主治医师 2:副主任医师 3:主任医师 4:医士 5:医师 6:助理医师 7:实习医师 8:主管护师 9:护师 10:护士 11:医师助理 12:研究生 13:随访员
*/
public void setRank(Integer rank) {
this.rank = rank;
}
/**
* 获取:医生级别 0:其他 1:主治医师 2:副主任医师 3:主任医师 4:医士 5:医师 6:助理医师 7:实习医师 8:主管护师 9:护师 10:护士 11:医师助理 12:研究生 13:随访员
*/
public Integer getRank() {
return rank;
}
}
| anxinghei/HIS_JAVA | src/main/java/com/example/demo/pojo/DzmHisDoctor.java |
64,894 | package cn.hsa.module.emr.emrpatient.dto;
import cn.hsa.module.emr.emrpatient.entity.EmrPatientDO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import java.io.Serializable;
import java.util.Map;
/**
* @Package_name: cn.hsa.module.emr.emrpatient.dto
* @Class_name: EmrPatientDTO
* @Describe: TODO
* @Author: guanhongqiang
* @Eamil: [email protected]
* @Date: 2020/9/22 11:55
* @Company: CopyRight@2014 POWERSI Inc.All Rights Reserverd
**/
@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString(callSuper = true)
public class EmrPatientDTO extends EmrPatientDO implements Serializable {
private static final long serialVersionUID = -1991180396605059238L;
private Map<String, Object> nrMap;
// html格式的病历内容
private String stringHtml;
private byte[] html;
// 病历编码
private String classifyCode;
// 病历分类名称
private String classifyName;
// 是否送审
private String isAudit;
// 是否拥有历史记录
private String haveHistory;
// 是否常用病历
private String isCommon;
// 病历关联的元素集合中元素性别约束与当前患者性别相反的元素集合
private Map<String, Object> oppositeSexMap;
// 是否换页打印
private String isPagePrint;
private String deptType; // 当前病人是门诊病人or住院病人, 1:门诊 2:住院
// liuliyun 20210623
private Integer validTime; // 电子病历创建时效性
private String allowEdit; // 编辑 :1 允许同级编辑;2 只能上级编辑
private String isNurse; // 是否是护士 0:其他 1:护士
private String docCode; // 病历文档类型
}
| fengzaiqishi11/hsa-his | hsa-com/src/main/java/cn/hsa/module/emr/emrpatient/dto/EmrPatientDTO.java |
64,897 | package com.hims.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.hims.mapper.RoleMapper;
import com.hims.pojo.Role;
import com.hims.pojo.User;
import com.hims.mapper.UserMapper;
import com.hims.service.IUserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
* <p>
* 服务实现类
* </p>
*
* @author bruce
* @since 2021-08-25
*/
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IUserService {
@Autowired
UserMapper userMapper;
@Autowired
RoleMapper roleMapper;
@Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
User userPojo= userMapper.selectOne(new QueryWrapper<User>().eq("user_name",username).eq("user_del",0));
if(userPojo!=null){
//角色ID
Integer roleId = userPojo.getUserDescribe();
Role role = roleMapper.selectById(roleId);
System.out.println("------------------>当前用户"+username+"查询数据库的角色是:"+role.getRoleName());
List<SimpleGrantedAuthority> authorities = new ArrayList<SimpleGrantedAuthority>();
authorities.add(new SimpleGrantedAuthority("ROLE_"+role.getRoleName())); // ROLE_护士 ROLE_医生 ROLE_XXXX
return new org.springframework.security.core.userdetails.User(userPojo.getUserName(),userPojo.getUserPassword(), authorities);
}
//账号不存在,数据库中查询不到账号
return null;
}
}
| Piercely/HIMS_master | HIMS/src/main/java/com/hims/service/impl/UserServiceImpl.java |
64,901 | package com.groot.hospital.web.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.groot.hospital.web.entity.Nurse;
/**
* <p>
* 护士 服务类
* </p>
*
* @author groot
* @since 2019-04-16
*/
public interface INurseService extends IService<Nurse> {
}
| grootma/hospital | src/main/java/com/groot/hospital/web/service/INurseService.java |
64,902 | package com.hims.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hims.pojo.*;
import com.hims.service.ISignService;
import com.hims.utils.DateUtils;
import com.hims.utils.PageUtils;
import com.hims.utils.ResultCode;
import com.hims.utils.ResultCommon;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.annotation.Secured;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import org.springframework.stereotype.Controller;
import javax.servlet.http.HttpSession;
import java.util.List;
/**
* <p>
* 前端控制器
* </p>
*
* @author bruce
* @since 2021-08-30
*/
@Controller
@RequestMapping("/sign")
public class SignController {
@Autowired
ISignService signService;
/**
* 01-录入体征数据
* @return
*/
@PostMapping("signSave")
@ResponseBody
public ResultCommon signSave(Sign sign, HttpSession session){
User user= (User) session.getAttribute("loginUser");
sign.setUserId(user.getUserId());
sign.setUserName(user.getUserName());
sign.setCreateTime(DateUtils.nowTime());
System.out.println("要新增的对象:"+sign);
boolean b = signService.save(sign);
if(b){
return ResultCommon.success(ResultCode.SUCCESS);
}else{
return ResultCommon.success(ResultCode.FAIL);
}
}
/**
* 02-体征数据查询
* @param model
* @return
*/
@Secured(value = {"ROLE_护士"})
@RequestMapping("find")
public String find(Model model, SignVo signVo, @RequestParam(defaultValue = "1") Long pageIndex,
@RequestParam(defaultValue = "10") Long pageSize){
QueryWrapper<Sign> qw = new QueryWrapper<Sign>();
if(signVo.getPatientId()!=null&&!signVo.getPatientId().equals("")){
qw.like("patientId",signVo.getPatientId());
}
if(signVo.getTestStartTime()!=null&&!signVo.getTestStartTime().equals("")){
qw.ge("measureTime",signVo.getTestStartTime());
}
if(signVo.getTestEndTime()!=null&&!signVo.getTestEndTime().equals("")){
qw.le("measureTime",signVo.getTestEndTime());
}
//分页API
IPage<Sign> pager = signService.page(new Page<Sign>(pageIndex, pageSize), qw);
List<Sign> signs = pager.getRecords();
long totalCount = pager.getTotal();
long pageCount = pager.getPages();
//封装一个分页工具类
PageUtils<Sign> pageUtils=new PageUtils<Sign>(pageIndex,pageSize,totalCount,pageCount,signs);
model.addAttribute("pageUtils",pageUtils);
model.addAttribute("signVo",signVo); // 查询数据回显
return "sign-query";
}
}
| Piercely/HIMS_master | HIMS/src/main/java/com/hims/controller/SignController.java |
64,903 | package com.othershe.calendarview.utils;
import android.text.TextUtils;
import java.util.Calendar;
public class SolarUtil {
/**
* 计算阳历节日
*
* @param year
* @param month
* @param day
* @return
*/
public static String getSolarHoliday(int year, int month, int day) {
int md = (int) (month * Math.pow(10, day >= 10 ? 2 : 1) + day);
String holiday = "";
switch (md) {
case 11:
holiday = "元旦";
break;
case 214:
holiday = "情人节";
break;
case 38:
holiday = "妇女节";
break;
case 312:
holiday = "植树节";
break;
case 41:
holiday = "愚人节";
break;
case 51:
holiday = "劳动节";
break;
case 54:
holiday = "青年节";
break;
case 512:
holiday = "护士节";
break;
case 61:
holiday = "儿童节";
break;
case 71:
holiday = "建党节";
break;
case 81:
holiday = "建军节";
break;
case 910:
holiday = "教师节";
break;
case 101:
holiday = "国庆节";
break;
case 1111:
holiday = "光棍节";
break;
case 1224:
holiday = "平安夜";
break;
case 1225:
holiday = "圣诞节";
break;
}
if (!TextUtils.isEmpty(holiday)) {
return holiday;
}
if (month == 4) {
holiday = chingMingDay(year, day);
} else if (month == 5) {
if (day == motherFatherDay(year, month, 1)) {
holiday = "母亲节";
}
} else if (month == 6) {
if (day == motherFatherDay(year, month, 2)) {
holiday = "父亲节";
}
}
return holiday;
}
/**
* 计算母亲节、父亲节是几号
*
* @param year
* @param month
* @param delta
* @return
*/
private static int motherFatherDay(int year, int month, int delta) {
int f = getFirstWeekOfMonth(year, month - 1);
f = f == 0 ? 7 : f;
return 7 - f + 1 + 7 * delta;
}
public static String chingMingDay(int year, int day) {
String holiday = "";
if (day >= 4 && day <= 6) {
if (year <= 1999) {
int compare = (int) (((year - 1900) * 0.2422 + 5.59) - ((year - 1900) / 4));
if (compare == day) {
holiday = "清明节";
}
} else {
int compare = (int) (((year - 2000) * 0.2422 + 4.81) - ((year - 2000) / 4));
if (compare == day) {
holiday = "清明节";
}
}
}
return holiday;
}
/**
* 计算指定月份的天数
*
* @param year
* @param month
* @return
*/
public static int getMonthDays(int year, int month) {
switch (month) {
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
case 12:
return 31;
case 4:
case 6:
case 9:
case 11:
return 30;
case 2:
if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) {
return 29;
} else {
return 28;
}
default:
return -1;
}
}
/**
* 计算当月1号是周几
*
* @param year
* @param month
* @return
*/
public static int getFirstWeekOfMonth(int year, int month) {
Calendar calendar = Calendar.getInstance();
calendar.set(year, month, 1);
return calendar.get(Calendar.DAY_OF_WEEK) - 1;
}
}
| shehuan/CalendarView | calendarview/src/main/java/com/othershe/calendarview/utils/SolarUtil.java |
64,904 | package System.view.controller;
import System.model.Administrator;
import com.jfoenix.controls.JFXComboBox;
import com.jfoenix.controls.JFXDatePicker;
import com.jfoenix.controls.JFXTextField;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Alert;
import javafx.stage.Stage;
import java.net.URL;
import java.util.ResourceBundle;
/**
* @author wanghao
*/
public class AdminAEController implements Initializable {
@FXML
private JFXTextField id;
@FXML
private JFXTextField name;
@FXML
private JFXTextField password;
@FXML
private JFXTextField spcialty;
@FXML
private JFXComboBox<String> jobtitle;
@FXML
private JFXTextField phone;
@FXML
private JFXDatePicker birthday;
private boolean ok = false;
private Administrator adm;
private Stage dialogStage;
private int choice;
@Override
public void initialize(URL location, ResourceBundle resources) {
}
public void setDialogStage(Stage dialogStage) {
this.dialogStage = dialogStage;
}
public void confirm() {
if (isInputValid()) {
ok = true;
adm.setId(id.getText());
adm.setName(name.getText());
adm.setJobtitle(jobtitle.getValue());
adm.setPassword(password.getText());
adm.setBirthday(birthday.getEditor().getText());
adm.setSpecialty(spcialty.getText());
adm.setPhone(phone.getText());
dialogStage.close();
}
}
public void cancel() {
dialogStage.close();
}
public void setChoice(int choice) {
this.choice = choice;
}
public void add(Administrator adm) {
ObservableList<String> options = null;
switch (choice) {
case 1:
options = FXCollections.observableArrayList("医生");
break;
case 2:
options = FXCollections.observableArrayList("护士");
break;
case 3:
options = FXCollections.observableArrayList("护工");
break;
default:
break;
}
jobtitle.setItems(options);
this.adm = adm;
}
public void edit(Administrator adm) {
this.adm = adm;
id.setText(adm.getId());
name.setText(adm.getName());
birthday.getEditor().setText(adm.getBirthday());
spcialty.setText(adm.getSpecialty());
jobtitle.setValue(adm.getJobtitle());
phone.setText(adm.getPhone());
password.setText(adm.getPassword());
this.add(adm);
}
private boolean isInputValid() {
String errorMessage = "";
if (id.getText() == null || id.getText().length() == 0) {
errorMessage += "非法用户名!\n";
}
if (name.getText() == null || name.getText().length() == 0) {
errorMessage += "非法姓名!\n";
}
if (password.getText() == null || password.getText().length() == 0) {
errorMessage += "非法密码\n";
}
if (jobtitle.getValue() == null || jobtitle.getValue().length() == 0) {
errorMessage += "非法职称!\n";
}
if (phone.getText() == null || phone.getText().length() == 0) {
errorMessage += "非法电话号码!\n";
} else {
try {
Long.parseLong(phone.getText());
} catch (NumberFormatException e) {
errorMessage += "电话号码必须是数字!\n";
}
}
if (birthday.toString() == null || birthday.toString().length() == 0) {
errorMessage += "非法生日!\n";
}
if (spcialty.getText() == null || spcialty.getText().length() == 0) {
errorMessage += "非法专长!\n";
}
if (errorMessage.length() == 0) {
return true;
} else {
ok = false;
Alert alert = new Alert(Alert.AlertType.ERROR);
alert.initOwner(dialogStage);
alert.setTitle("错误");
alert.setHeaderText("请检查以下信息是否正确");
alert.setContentText(errorMessage);
alert.showAndWait();
return false;
}
}
public boolean isOk() {
return ok;
}
} | aahowe/JavaFX-neuSystem | src/System/view/controller/AdminAEController.java |
64,905 | package com.oral.model.vo;
import lombok.Data;
import java.time.LocalDateTime;
@Data
public class SickroomVO {
/**
* 创建时间
*/
private LocalDateTime createTime;
/**
* id
*/
private Long id;
/**
* 护士
*/
private String nurse;
/**
* 病房号
*/
private Integer roomNo;
/**
* 病床数
*/
private Integer roomNumber;
/**
* 0-普通病房,1-重症病房
*/
private Integer type;
/**
* 更新时间
*/
private LocalDateTime updateTime;
}
| Moriic/oral-backend | src/main/java/com/oral/model/vo/SickroomVO.java |
64,936 | /**
* Description:职业技能
* Author:Icelemon1314 [email protected]
* Create:2015-5-27
*/
package server.skill.冒险家;
public class 魔法师 {
public static final int 魔力恢复 = 2000000;
public static final int 魔力强化 = 2000001;
public static final int 魔法盾 = 2001002;
public static final int 魔法铠甲 = 2001003;
public static final int 魔法弹 = 2001004;
public static final int 魔法双击 = 2001005;
}
| icelemon1314/mapleLemon | src/server/skill/冒险家/魔法师.java |
64,937 | /**
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package jp.l1j.server.codes;
public class Opcodes {
public Opcodes() {
}
/** 3.63C測試 Client Packet */
/** 要求下一頁 ( 公佈欄 )*/
public static final int C_OPCODE_BOARDNEXT = 221;//98;//49;
/** 要求回到輸入帳號密碼畫面 */
public static final int C_OPCODE_RETURNTOLOGIN = 218;//68;//1;
/** 要求船票數量 */
public static final int C_OPCODE_SHIP = 117;//97;//-101;
/** 要求選擇 變更攻城時間 */
public static final int S_OPCODE_WARTIME = 150;//44;//103;
/** 要求領出資金 */
public static final int C_OPCODE_DRAWAL = 192;//232;//108;
/** 要求存入資金 */
public static final int C_OPCODE_DEPOSIT = 35;//206;//109;
/** 要求稅收設定封包 */
public static final int C_OPCODE_TAXRATE = 200;//165;//1010;
/** 要求召喚到身邊(gm) */
public static final int C_OPCODE_CALL = 144;//90;//179;
/** 要求使用寵物裝備 */
public static final int C_OPCODE_USEPETITEM = 213;//49;//-1014;
/** 要求重置人物點數 */
public static final int C_OPCODE_CHARRESET = 236;//125;//-1016;
/** 要求設置治安管理 */
public static final int C_OPCODE_CASTLESECURITY = 125;//76;//-1011;
/** 要求變更倉庫密碼 && 送出倉庫密碼 */
public static final int C_OPCODE_WAREHOUSELOCK = 81;//147;//137;
/** 要求賦予封號 */
public static final int C_OPCODE_TITLE = 96;//79;//195;
/** 要求查詢PK次數 */
public static final int C_OPCODE_CHECKPK = 137;//83;//230;
/** 要求血盟數據(例如盟標) */
public static final int C_OPCODE_CLAN = 246;//156;//197;
/** 要求紀錄快速鍵 */
public static final int C_OPCODE_CHARACTERCONFIG = 129;//129;//42;
/** 要求切換角色 (到選人畫面) */
public static final int C_OPCODE_CHANGECHAR = 237;//112;//227;
/** 要求使用遠距武器 */
public static final int C_OPCODE_ARROWATTACK = 247;//243;
/** 要求使用物品 */
public static final int C_OPCODE_USEITEM = 44;//0;//106;
/** 要求使用技能 */
public static final int C_OPCODE_USESKILL = 115;//94;//206;
/** 要求物件對話視窗 */
public static final int C_OPCODE_NPCTALK = 58;//184;//21;
/** 要求使用廣播聊天頻道 */
public static final int C_OPCODE_CHATGLOBAL = 62;//176;//210;
/** 要求登入測試 ( 接收伺服器版本 ) */
public static final int C_OPCODE_CLIENTVERSION = 127;//211;//160;
/** 要求自動登錄伺服器 與 師徒系統*/
public static final int C_OPCODE_AUTOLOGIN = 162;//62;//204;
/** 要求進入遊戲 */
public static final int C_OPCODE_LOGINTOSERVER = 131;//20;//63;
/** 要求更新時間 */
public static final int C_OPCODE_KEEPALIVE = 182;//245;//176;
/** 要求使用密語聊天頻道 */
public static final int C_OPCODE_CHATWHISPER = 122;//172;//171;
/** 要求物件對話視窗結果 */
public static final int C_OPCODE_NPCACTION = 37;//33;//178;
/** 要求丟棄物品 */
public static final int C_OPCODE_DROPITEM = 54;//4;//52;
/** 要求撿取物品 */
public static final int C_OPCODE_PICKUPITEM = 188;//131;//92;
/** 要求開關門 */
public static final int C_OPCODE_DOOR = 199;//77;//143;
/** 要求列表物品取得 */
public static final int C_OPCODE_RESULT = 40;//115;//115;
/** 要求刪除物品 */
public static final int C_OPCODE_DELETEINVENTORYITEM = 209;//107;//39;
/** 要求創造角色 */
public static final int C_OPCODE_NEWCHAR = 253;//93;//245;
/** 要求刪除角色 */
public static final int C_OPCODE_DELETECHAR = 10;//50;//188;
/** 要求查詢血盟成員 */
public static final int C_OPCODE_PLEDGE = 225;//18;//252;
/** 玩家傳送鎖定*/
public static final int C_OPCODE_TELEPORTLOCK = 226;//7;//134;
/** 要求維修物品清單 */
public static final int C_OPCODE_FIX_WEAPON_LIST = 106;//151;//183;
/** 要求傳送位置 */
public static final int C_OPCODE_SENDLOCATION = 41;
/** 要求學習魔法(金幣) */
public static final int C_OPCODE_SKILLBUY = 173;//9;//140;
/** 要求傳送 */
public static final int C_OPCODE_TELEPORT = 242;//25;//225;
/** 要求開個人商店 */
public static final int C_OPCODE_SHOP = 16;//198;//69;
/** 要求改變角色面向 */
public static final int C_OPCODE_CHANGEHEADING = 65;//205;//234;
/** 要求死亡後重新開始 */
public static final int C_OPCODE_RESTART = 71;//55;//103;
/** 要求讀取公佈欄 */
public static final int C_OPCODE_BOARD = 73;//247;//13;
/** 要求閱讀佈告單個欄訊息 */
public static final int C_OPCODE_BOARDREAD = 59;//13;//55;
/** 要求寫入公佈欄訊息 */
public static final int C_OPCODE_BOARDWRITE = 14;//8;//28;
/** 3.3新地图系统 */
public static final int C_OPCODE_MAPSYSTEM = 41;//59;//254;
/** 登入伺服器OK */
public static final int C_OPCODE_LOGINTOSERVEROK = 75;//118;//196;
/** 要求打開郵箱 */
public static final int C_OPCODE_MAIL = 22;//73;//46;
/** 要求給予角色血盟階級*/
public static final int C_OPCODE_RANK = 88;//244;//113;
/** 要求刪除公佈欄內容 */
public static final int C_OPCODE_BOARDDELETE = 12;//63;//29;
/** 要求查詢遊戲人數 */
public static final int C_OPCODE_WHO = 49;//157;//8;
/** 要求攻擊指定物件(寵物&召喚) */
public static final int C_OPCODE_SELECTTARGET = 155;//38;//96;
/** 要求新增好友 */
public static final int C_OPCODE_ADDBUDDY = 99;//135;//175;
/** 要求查詢朋友名單 */
public static final int C_OPCODE_BUDDYLIST = 60;//132;//222;
/** 要求刪除好友 */
public static final int C_OPCODE_DELETEBUDDY = 211;//72;//233;
/** 要求增加記憶座標 */
public static final int C_OPCODE_BOOKMARK = 134;//29;//255;
/** 要求刪除記憶座標 */
public static final int C_OPCODE_BOOKMARKDELETE = 223;//23;//149;
/** 要求給予物品 */
public static final int C_OPCODE_GIVEITEM = 244;//250;//98;
/** 要求寵物回報選單(顯示寵物背包物品窗口) */
public static final int C_OPCODE_PETMENU = 217;//160;//127;
/** 要求退出觀看模式 */
public static final int C_OPCODE_EXIT_GHOST = 210;//154;//59;
/** 要求角色表情動作 */
public static final int C_OPCODE_EXTCOMMAND = 157;//182;//108;
/** 要求加入血盟 */
public static final int C_OPCODE_JOINCLAN = 30;;//224;//217;
/** 要求創立血盟 */
public static final int C_OPCODE_CREATECLAN = 154;//148;//166;
/** 要求驅逐人物離開血盟 */
public static final int C_OPCODE_BANCLAN = 222;//200;//118;
/** 要求確定數量選取 */
public static final int C_OPCODE_AMOUNT = 109;//67;//62;
/** 要求使用拒絕名單(開啟指定人物訊息)/exclude 名字*/
public static final int C_OPCODE_EXCLUDE = 101;//37;//72;
/** 要求點選項目的結果 */
public static final int C_OPCODE_ATTR = 61;//10;//5;
/** 要求交易(個人) */
public static final int C_OPCODE_TRADE = 103;//181;//19;
/** 要求交易(添加物品) */
public static final int C_OPCODE_TRADEADDITEM = 241;//188;//211;
/** 要求完成交易(個人) */
public static final int C_OPCODE_TRADEADDOK = 110;//170;//50;
/** 要求取消交易(個人) */
public static final int C_OPCODE_TRADEADDCANCEL = 167;//88;//94;
/** 要求個人商店 (物品列表) */
public static final int C_OPCODE_PRIVATESHOPLIST = 193;//123;//105;
/** 要求決鬥 */
public static final int C_OPCODE_FIGHT = 47;//41;//38;
/** 要求邀請加入隊伍(要求創立隊伍) 3.3新增委任隊長功能*/
public static final int C_OPCODE_CREATEPARTY = 166;//16;//145;
/** 要求隊伍對話控制(命令/chatparty) */
public static final int C_OPCODE_CAHTPARTY = 113;//61;//2;
/** 要求脫離隊伍 */
public static final int C_OPCODE_LEAVEPARTY = 204;//43;//84;
/** 要求查看隊伍 */
public static final int C_OPCODE_PARTYLIST = 42;//190;//174;
/** 要求踢出隊伍 */
public static final int C_OPCODE_BANPARTY = 70;//213;//170;
/** 要求結婚 (指令 /求婚)*/
public static final int C_OPCODE_PROPOSE = 185;//201;//33;
/**要求鼠標右鍵傳入洞穴 */
public static final int C_OPCODE_ENTERPORTAL = 249;//239;//229;
/** 要求釣魚收桿 */
public static final int C_OPCODE_FISHCLICK = 26;//161;//23;
/** 要求離開遊戲 */
public static final int C_OPCODE_QUITGAME = 104;//66;//30;
/** 要求使用一般聊天頻道 */
public static final int C_OPCODE_CHAT = 190;//193;//146;
/** 要求角色移動 */
public static final int C_OPCODE_MOVECHAR = 95;//163;//190;
/** 要求角色攻擊 */
public static final int C_OPCODE_ATTACK = 68;//120;//165;
/** 要求上傳盟標 */
public static final int C_OPCODE_EMBLEM = 107;//253;//9;
/** 要求物品維修/取出寵物 */
public static final int C_OPCODE_SELECTLIST = 238;//166;//205;
/** 要求宣戰 */
public static final int C_OPCODE_WAR = 235;//;//100;//246;
/** 要求脫離血盟 */
public static final int C_OPCODE_LEAVECLANE = 121;//102;//220;
/** 要求學習魔法完成 */
public static final int C_OPCODE_SKILLBUYOK = 207;//177;
/** 要求下一步 ( 公告資訊 ) */
public static final int C_OPCODE_COMMONCLICK = 53;//;//178;//1013;
/** 要求登入伺服器 */
public static final int C_OPCODE_LOGINPACKET = 57;//199;//191;
/** 要求寄送簡訊 未用 */
public static final int C_OPCODE_SMS = 45;//122;//82;
/** 血盟推薦 */
public static final int C_OPCODE_PLEDGE_RECOMMENDATION = 228;
// 未知
/** 請求 配置已僱用的士兵. */
public static final int C_OPCODE_PUTSOLDIER = 3; // XXX
/** 未使用 - 請求 配置已僱用的士兵OK. */
public static final int C_OPCODE_PUTHIRESOLDIER = 5; // XXX
/** 請求 配置城牆上的弓箭手OK. */
public static final int C_OPCODE_PUTBOWSOLDIER = 7; // XXX
/** 未使用 - 請求 進入遊戲(確定服務器登入訊息). */
public static final int C_OPCODE_COMMONINFO = 9; // XXX
/** 請求 決定下次圍城時間(官方已取消使用)-->修正城堡總管全部功能. */
public static final int C_OPCODE_CHANGEWARTIME = 4;
/** 3.63C測試 Server Packet (服務端代碼) */
/** 效果圖示 { 水底呼吸 } */
public static final int S_OPCODE_BLESSOFEVA = 12;//52;//0;
/** 產生對話視窗 */
public static final int S_OPCODE_SHOWHTML = 119;//135;//105;
/** 物品購買 */
public static final int S_OPCODE_SHOWSHOPBUYLIST = 254;//4;//206;
/** 物品增加封包 */
public static final int S_OPCODE_ADDITEM = 63;//37;//149;
/** 物品刪除 */
public static final int S_OPCODE_DELETEINVENTORYITEM = 148;//38;//156;
/** 丟棄物品封包 */
public static final int S_OPCODE_DROPITEM = 3;//39;//176;
/** 遊戲天氣 */
public static final int S_OPCODE_WEATHER = 193;//239;//42;
/** 角色皇冠 */
public static final int S_OPCODE_CASTLEMASTER = 66;//48;//85;
/** 角色狀態 (2) */
public static final int S_OPCODE_OWNCHARSTATUS2 = 216;//203;//41;
/** 角色列表 */
public static final int S_OPCODE_CHARAMOUNT = 126;//103;//62;
/** 重置設定 */
public static final int S_OPCODE_CHARRESET = 33;//57;//130;
/** 角色資訊 */
public static final int S_OPCODE_CHARLIST = 184;//167;//15;
/** 更新角色所在的地圖 */
public static final int S_OPCODE_MAPID = 150;//82;//113;
/** 物件封包 */
public static final int S_OPCODE_CHARPACK = 3;//39;//176;
/** 更新目前遊戲時間 ( 遊戲時間 ) */
public static final int S_OPCODE_GAMETIME = 194;//17;//38;
/** 物件刪除 */
public static final int S_OPCODE_REMOVE_OBJECT = 185;//75;//169;
/** 初始化OpCode */
public static final int S_OPCODE_INITPACKET = 161;//206;//180;
/** 伺服器版本 */
public static final int S_OPCODE_SERVERVERSION = 151;//106;//221;
/** 登入狀態 */
public static final int S_OPCODE_LOGINRESULT = 51;//109;//5;
/** 廣播聊天頻道 */
public static final int S_OPCODE_GLOBALCHAT = 10;//124;//137;
/** 廣播聊天頻道 / 伺服器訊息 ( 字串 ) */
public static final int S_OPCODE_SYSMSG = 10;//124;//137;
/** 伺服器訊息 ( 行數 ) / ( 行數, 附加字串 ) */
public static final int S_OPCODE_SERVERMSG = 14;//242;//212;
/** 一般聊天頻道 */
public static final int S_OPCODE_NORMALCHAT = 76;//81;//216;
/** 非玩家聊天頻道 { 一般 & 大喊 } NPC */
public static final int S_OPCODE_NPCSHOUT = 133;//251;//119;
/** 郵件封包 */
public static final int S_OPCODE_MAIL = 1;//113;//231;
/** 物件移動 */
public static final int S_OPCODE_MOVEOBJECT = 122;//137;//80;
/** 物件屬性 (門 開關)*/
public static final int S_OPCODE_ATTRIBUTE = 35;//138;//60;
/** 物件攻擊 */
public static final int S_OPCODE_ATTACKPACKET = 142;//67;//240;
/** 正義值更新 */
public static final int S_OPCODE_LAWFUL = 140;//56;//36;
/** 進入遊戲 */
public static final int S_OPCODE_LOGINTOGAME = 131;//27;//163;
/** 物品名單 */
public static final int S_OPCODE_INVLIST = 180;//51;//204;
/** 物品顯示名稱 */
public static final int S_OPCODE_ITEMNAME = 195;//230;//225;
/** 封包盒子(多功能封包). */
public static final int S_OPCODE_PACKETBOX = 40;
/** 封包盒子(多功能封包). */
public static final int S_OPCODE_ACTIVESPELLS = 40;
/** 封包盒子(多功能封包). */
public static final int S_OPCODE_SKILLICONGFX = 40;
/** 魔法攻擊力與魔法防禦力 */
public static final int S_OPCODE_SPMR = 174;//85;//210;
/** 增加魔法進魔法名單 */
public static final int S_OPCODE_ADDSKILL = 48;//61;//108;
/** 角色屬性與能力值 */
public static final int S_OPCODE_OWNCHARSTATUS = 145;//238;//255;
/** 物品可用次數 */
public static final int S_OPCODE_ITEMAMOUNT = 127;//227;//97;
/** 物品狀態更新 */
public static final int S_OPCODE_ITEMSTATUS = 127;//227;//97;
/** 物件動作種類 ( 短時間 ) */
public static final int S_OPCODE_DOACTIONGFX = 218;//189;//72;
/** 體力更新 */
public static final int S_OPCODE_HPUPDATE = 42;//245;//47;
/** 魔力更新 */
public static final int S_OPCODE_MPUPDATE = 73;//195;//126;
/** 產生動畫 [ 物件 ] */
public static final int S_OPCODE_SKILLSOUNDGFX = 232;//95;//254;
/** 物件面向 */
public static final int S_OPCODE_CHANGEHEADING = 199;//77;//124;
/** 佈告欄 ( 訊息列表 ) */
public static final int S_OPCODE_BOARD = 64;//45;//189;
/** 佈告欄( 訊息閱讀 ) */
public static final int S_OPCODE_BOARDREAD = 56;//194;//195;
/** 物件隱形 & 現形 */
public static final int S_OPCODE_INVIS = 57;//3;//186;
/** 角色創造失敗 */
public static final int S_OPCODE_NEWCHARWRONG = 153;//19;//74;
/** 創造角色封包 */
public static final int S_OPCODE_NEWCHARPACK = 212;//197;//141;
/** 角色移除 [ 非立即 ] */
public static final int S_OPCODE_DETELECHAROK = 5;//231;//222;
/** 角色盟徽 */
public static final int S_OPCODE_EMBLEM = 50;//140;//202;
/** 產生動畫 [ 地點 ] */
public static final int S_OPCODE_EFFECTLOCATION = 112;//132;//159;
/** 魔法 | 物品效果 { 加速纇 } */
public static final int S_OPCODE_SKILLHASTE = 149;//185;//24;
/** NPC物品販賣 */
public static final int S_OPCODE_SHOWSHOPSELLLIST = 170;//9;//53;
/** NPC外型改變 */
public static final int S_OPCODE_POLY = 164;//100;//182;
/** 物件動作種類 ( 長時間 ) */
public static final int S_OPCODE_CHARVISUALUPDATE = 113;//118;//220;
/** 損壞武器名單 */
public static final int S_OPCODE_SELECTLIST = 208;//129;//147;
/** 人物回碩檢測 OR 傳送鎖定 ( 無動畫 ) */
public static final int S_OPCODE_TELEPORTLOCK = 135;//102;//8;
/** 要求傳送 ( NPC傳送反手 ) */
public static final int S_OPCODE_TELEPORT = 4;//50;//170;
/** 魔法效果 - 暗盲咒術 { 編號 } */
public static final int S_OPCODE_CURSEBLIND = 238;//144;//178;
/** 角色防禦 & 屬性防禦 更新 */
public static final int S_OPCODE_OWNCHARATTRDEF = 15;//26;//226;
/** 倉庫物品名單 */
public static final int S_OPCODE_SHOWRETRIEVELIST = 250;//70;//248;
/** 角色封號 */
public static final int S_OPCODE_CHARTITLE = 202;//127;//233;
/** 角色記憶座標名單 */
public static final int S_OPCODE_BOOKMARKS = 11;//97;//70;
/** 魔法購買 (金幣) */
public static final int S_OPCODE_SKILLBUY = 222;//25;//90;
/** 選項封包 { Yes | No } */
public static final int S_OPCODE_YES_NO = 155;//24;//160;
/** 交易封包 */
public static final int S_OPCODE_TRADE = 77;//2;//146;
/** 增加交易物品封包 */
public static final int S_OPCODE_TRADEADDITEM = 86;//40;//131;
/** 交易狀態 */
public static final int S_OPCODE_TRADESTATUS = 239;//46;//181;
/** 物件復活 */
public static final int S_OPCODE_RESURRECTION = 227;//7;//13;
/** 物件血條 */
public static final int S_OPCODE_HPMETER = 128;//33;//150;
/** 改變物件名稱 */
public static final int S_OPCODE_CHANGENAME = 81;//175;//104;
/** 選擇一個目標 */
public static final int S_OPCODE_SELECTTARGET = 177;//5;//239;
/** 魔法效果 : 中毒 { 編號 } */
public static final int S_OPCODE_POISON = 93;//91;//183;
/** 更新新加入或退出的血盟數據*/
public static final int S_OPCODE_CLAN = 29;//160;//17;
/** 魔法動畫 { 精準目標 } */
public static final int S_OPCODE_TRUETARGET = 110;//6;//138;
/** 魔法效果 : 防禦纇 */
public static final int S_OPCODE_SKILLICONSHIELD = 69;//44;//81;
/** 物件亮度 */
public static final int S_OPCODE_LIGHT = 53;//177;//1;
/** 撥放音效 */
public static final int S_OPCODE_SOUND = 84;//161;//172;
/** 物品資訊訊息 { 使用String-h.tbl } */
public static final int S_OPCODE_IDENTIFYDESC = 43;//224;//76;
/** 海底波紋 */
public static final int S_OPCODE_LIQUOR = 31;//23;//120;
/** 魔法 | 物品效果圖示 { 勇敢藥水纇 } */
public static final int S_OPCODE_SKILLBRAVE = 200;//198;//3;
/** 力量提升封包 */
public static final int S_OPCODE_STRUP = 120;//31;//25;
/** 敏捷提升封包 */
public static final int S_OPCODE_DEXUP = 28;//253;//103;
/** 血盟小屋名單 */
public static final int S_OPCODE_HOUSELIST = 24;//252;//51;
/** 血盟小屋地圖 [ 地點 ] */
public static final int S_OPCODE_HOUSEMAP = 44;//101;//188;
/** 拍賣公告欄選取金幣數量 選取物品數量 */
public static final int S_OPCODE_INPUTAMOUNT = 253;//141;//136;
/** 要求使用密語聊天頻道 */
public static final int S_OPCODE_WHISPERCHAT = 255;//157;//75;
/** 角色名稱變紫色 */
public static final int S_OPCODE_PINKNAME = 252;//162;//174;
/** 魔法效果 : 詛咒類 { 編號 } 麻痺,癱瘓 */
public static final int S_OPCODE_PARALYSIS = 165;//226;//253;
/** 角色個人商店 { 購買 } */
public static final int S_OPCODE_PRIVATESHOPLIST = 190;//28;
/** 夜視功能 */
public static final int S_OPCODE_ABILITY = 116;//114;//144;
/** 範圍魔法 */
public static final int S_OPCODE_RANGESKILLS = 16;//174;//201;
/** 移除魔法出魔法名單 */
public static final int S_OPCODE_DELSKILL = 18;//146;//30;
/** 物品狀態 (祝福 & 詛咒)*/
public static final int S_OPCODE_ITEMCOLOR = 144;//98;//236;
/** 公告視窗 */
public static final int S_OPCODE_COMMONNEWS = 30;//249;//145;
/** 經驗值更新封包 */
public static final int S_OPCODE_EXP = 121;//229;//59;
/** 畫面正中出現紅色字(Account ? has just logged in form)*/
public static final int S_OPCODE_REDMESSAGE = 90;//53;//237;
/** 取出城堡寶庫金幣 (1) */
public static final int S_OPCODE_DRAWAL = 224;//16;//96;
/** 存入資金城堡寶庫 (2) */
public static final int S_OPCODE_DEPOSIT = 203;//84;//58;
/** 稅收設定封包 */
public static final int S_OPCODE_TAXRATE = 72;//128;//43;
/** 立即中斷連線 */
public static final int S_OPCODE_DISCONNECT = 95;//15;//175;
/** 血盟戰爭訊息 { 編號, 血盟名稱, 目標血盟名稱 } */
public static final int S_OPCODE_WAR = 123;//55;//123;
/** 藍色訊息 { 使用String-h.tbl } 紅色字(地獄顯示字)*/
public static final int S_OPCODE_BLUEMESSAGE = 59;//171;//177;
/** 更新角色所在的地圖 (水下)*/
public static final int S_OPCODE_UNDERWATER = 42;//74;//101;//103;//74;//49;//73;
/** 寵物控制條 */
public static final int S_OPCODE_PETCTRL = 33;
/** 魔法購買 (材料製作)*/
public static final int S_OPCODE_SKILLMAKE = 68;
/** 血盟推薦 */
public static final int S_OPCODE_PLEDGE_RECOMMENDATION = 192;
// 未知
/** 未使用 - 修理武器清單. */
public static final int S_OPCODE_FIX_WEAPON_MENU = 10;
/** 未使用 - 配置城牆上的弓箭手列表(傭兵購買視窗). */
public static final int S_OPCODE_PUTBOWSOLDIERLIST = 11;
/** 可配置排列傭兵數(HTML)(EX:僱用的總傭兵數:XX 可排列的傭兵數:XX ). */
public static final int S_OPCODE_PUTHIRESOLDIER = 13;
/** 請求 僱請傭兵列表(購買傭兵完成). */
public static final int C_OPCODE_HIRESOLDIER = 97;
/** 未使用 - 強制登出人物. */
public static final int S_OPCODE_CHAROUT = 17;
/** 僱請傭兵(傭兵購買視窗). */
public static final int S_OPCODE_HIRESOLDIER = 126;
/** 使用地圖道具.官方已棄用 */
public static final int S_OPCODE_USEMAP = 100;
}
| l1j/jp | src/jp/l1j/server/codes/Opcodes.java |
64,943 | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package server.maps;
import client.MapleBuffStat;
import client.MapleCharacter;
import client.MapleStat;
import handling.channel.handler.AttackInfo;
import server.life.MapleLifeFactory;
import server.life.MapleMonster;
import tools.MaplePacketCreator;
/**
* @author wubin
*/
public class MaplePvp {
private static int pvpDamage;
private static int maxDis;
private static int maxHeight;
private static boolean isAoe = false;
public static boolean isLeft = false;
public static boolean isRight = false;
private static boolean isMeleeAttack(AttackInfo attack) {
switch (attack.skill) {
case 1001004: //Power Strike
case 1001005: //Slash Blast
case 4001334: //Double Stab
case 4201005: //Savage Blow
case 1111004: //Panic: Axe
case 1111003: //Panic: Sword
case 1311004: //Dragon Fury: Pole Arm
case 1311003: //Dragon Fury: Spear
case 1311002: //Pole Arm Crusher
case 1311005: //Sacrifice
case 1311001: //Spear Crusher
case 1121008: //Brandish
case 1221009: //Blast
case 1121006: //Rush
case 1221007: //Rush
case 1321003: //Rush
case 4221001: //Assassinate
return true;
}
return false;
}
private static boolean isRangeAttack(AttackInfo attack) {
switch (attack.skill) {
case 2001004: //Energy Bolt
case 2001005: //Magic Claw
case 3001004: //Arrow Blow
case 3001005: //Double Shot
case 4001344: //Lucky Seven
case 2101004: //Fire Arrow
case 2101005: //Poison Brace
case 2201004: //Cold Beam
case 2301005: //Holy Arrow
case 4101005: //Drain
case 2211002: //Ice Strike
case 2211003: //Thunder Spear
case 3111006: //Strafe
case 3211006: //Strafe
case 4111005: //Avenger
case 4211002: //Assaulter
case 2121003: //Fire Demon
case 2221006: //Chain Lightning
case 2221003: //Ice Demon
case 2111006: //Element Composition F/P
case 2211006: //Element Composition I/L
case 2321007: //Angel's Ray
case 3121003: //Dragon Pulse
case 3121004: //Hurricane
case 3221003: //Dragon Pulse
case 3221001: //Piercing
case 3221007: //Sniping
case 4121003: //Showdown taunt
case 4121007: //Triple Throw
case 4221007: //Boomerang Step
case 4221003: //Showdown taunt
case 4111004: //Shadow Meso
return true;
}
return false;
}
private static boolean isAoeAttack(AttackInfo attack) {
switch (attack.skill) {
case 2201005: //Thunderbolt
case 3101005: //Arrow Bomb : Bow
case 3201005: //Iron Arrow : Crossbow
case 1111006: //Coma: Axe
case 1111005: //Coma: Sword
case 1211002: //Charged Blow
case 1311006: //Dragon Roar
case 2111002: //Explosion
case 2111003: //Poison Mist
case 2311004: //Shining Ray
case 3111004: //Arrow Rain
case 3111003: //Inferno
case 3211004: //Arrow Eruption
case 3211003: //Blizzard (Sniper)
case 4211004: //Band of Thieves
case 1221011: //Sanctuary Skill
case 2121001: //Big Bang
case 2121007: //Meteo
case 2121006: //Paralyze
case 2221001: //Big Bang
case 2221007: //Blizzard
case 2321008: //Genesis
case 2321001: //Big Bang
case 4121004: //Ninja Ambush
case 4121008: //Ninja Storm knockback
case 4221004: //Ninja Ambush
return true;
}
return false;
}
private static void getDirection(AttackInfo attack) {
isRight = true;
isLeft = true;
}
private static void DamageBalancer(AttackInfo attack) {
if (attack.skill == 0) {
pvpDamage = 100;
maxDis = 130;
maxHeight = 35;
} else if (isMeleeAttack(attack)) {
maxDis = 130;
maxHeight = 45;
isAoe = false;
if (attack.skill == 4201005) {
pvpDamage = (int) (Math.floor(Math.random() * (75 - 5) + 5));
} else if (attack.skill == 1121008) {
pvpDamage = (int) (Math.floor(Math.random() * (320 - 180) + 180));
maxHeight = 50;
} else if (attack.skill == 4221001) {
pvpDamage = (int) (Math.floor(Math.random() * (200 - 150) + 150));
} else if (attack.skill == 1121006 || attack.skill == 1221007 || attack.skill == 1321003) {
pvpDamage = (int) (Math.floor(Math.random() * (200 - 80) + 80));
} else {
pvpDamage = (int) (Math.floor(Math.random() * (600 - 250) + 250));
}
} else if (isRangeAttack(attack)) {
maxDis = 300;
maxHeight = 40;
isAoe = false;
if (attack.skill == 4201005) {
pvpDamage = (int) (Math.floor(Math.random() * (75 - 5) + 5));
} else if (attack.skill == 4121007) {
pvpDamage = (int) (Math.floor(Math.random() * (60 - 15) + 15));
} else if (attack.skill == 4001344 || attack.skill == 2001005) {
pvpDamage = (int) (Math.floor(Math.random() * (195 - 90) + 90));
} else if (attack.skill == 4221007) {
pvpDamage = (int) (Math.floor(Math.random() * (350 - 180) + 180));
} else if (attack.skill == 3121004 || attack.skill == 3111006 || attack.skill == 3211006) {
maxDis = 450;
pvpDamage = (int) (Math.floor(Math.random() * (50 - 20) + 20));
} else if (attack.skill == 2121003 || attack.skill == 2221003) {
pvpDamage = (int) (Math.floor(Math.random() * (600 - 300) + 300));
} else {
pvpDamage = (int) (Math.floor(Math.random() * (400 - 250) + 250));
}
} else if (isAoeAttack(attack)) {
maxDis = 350;
maxHeight = 350;
isAoe = true;
if (attack.skill == 2121001 || attack.skill == 2221001 || attack.skill == 2321001 || attack.skill == 2121006) {
maxDis = 175;
maxHeight = 175;
pvpDamage = (int) (Math.floor(Math.random() * (350 - 180) + 180));
} else {
pvpDamage = (int) (Math.floor(Math.random() * (700 - 300) + 300));
}
}
}
private static void monsterBomb(MapleCharacter player, MapleCharacter attackedPlayers, MapleMap map, AttackInfo attack) {
//level balances
if (attackedPlayers.getLevel() > player.getLevel() + 25) {
pvpDamage *= 1.35;
} else if (attackedPlayers.getLevel() < player.getLevel() - 25) {
pvpDamage /= 1.35;
} else if (attackedPlayers.getLevel() > player.getLevel() + 100) {
pvpDamage *= 1.50;
} else if (attackedPlayers.getLevel() < player.getLevel() - 100) {
pvpDamage /= 1.50;
}
//buff modifiers
Integer mguard = attackedPlayers.getBuffedValue(MapleBuffStat.MAGIC_GUARD);
Integer mesoguard = attackedPlayers.getBuffedValue(MapleBuffStat.MESOGUARD);
int magicattack = (player.getDex() + player.getInt() + player.getLuk() + player.getStr()) / 300; //4项属性值最后除以3=magicattack K攻击力+magicattack值
pvpDamage += magicattack;
int magicat = (player.getStat().getTotalMagic() + player.getStat().getTotalWatk()) / 100; //魔法+物理攻击除以100=magicat值 PK攻击力+magicat值
pvpDamage += magicat;
if (pvpDamage > 99999) {
pvpDamage = 99999;
}
if (mguard != null) {
int mploss = (int) (pvpDamage / .5);
pvpDamage *= .70;
if (mploss > attackedPlayers.getStat().getMp()) {
pvpDamage /= .70;
attackedPlayers.cancelEffectFromBuffStat(MapleBuffStat.MAGIC_GUARD);
} else {
attackedPlayers.setMp(attackedPlayers.getStat().getMp() - mploss);
attackedPlayers.updateSingleStat(MapleStat.MP, attackedPlayers.getStat().getMp());
}
} else if (mesoguard != null) {
int mesoloss = (int) (pvpDamage * .75);
pvpDamage *= .75;
if (mesoloss > attackedPlayers.getMeso()) {
pvpDamage /= .75;
attackedPlayers.cancelEffectFromBuffStat(MapleBuffStat.MESOGUARD);
} else {
attackedPlayers.gainMeso(-mesoloss, false);
}
}
//set up us teh bonmb
//training thingy = 9409000
MapleMonster pvpMob = MapleLifeFactory.getMonster(9400711);
map.spawnMonsterOnGroundBelow(pvpMob, attackedPlayers.getPosition());
for (int attacks = 0; attacks < attack.hits; attacks++) {
if (attack.skill == 0) {
map.broadcastMessage(MaplePacketCreator.damagePlayer(1, pvpMob.getId(), attackedPlayers.getId(), pvpDamage, 0, (byte) 0, 0, false, pvpMob.getObjectId(), (int) pvpMob.getPosition().getX(), (int) pvpMob.getPosition().getY()));
attackedPlayers.addHP(-pvpDamage);
} else {
map.broadcastMessage(MaplePacketCreator.damagePlayer(1, pvpMob.getId(), attackedPlayers.getId(), pvpDamage * attackedPlayers.getLevel(), 0, (byte) 0, 0, false, pvpMob.getObjectId(), (int) pvpMob.getPosition().getX(), (int) pvpMob.getPosition().getY()));
attackedPlayers.addHP(-pvpDamage * attackedPlayers.getLevel());
}
}
int attackedDamage = 0;
if (attack.skill == 0) {
attackedDamage = pvpDamage * attack.hits * attackedPlayers.getLevel();
} else {
attackedDamage = pvpDamage * attack.hits * attackedPlayers.getLevel();
}
attackedPlayers.getClient().sendPacket(MaplePacketCreator.getErrorNotice(player.getName() + " 打了 " + attackedDamage + " 点的伤害!"));
map.killMonster(pvpMob, player, false, false, (byte) -1);
//rewards
if (attackedPlayers.getStat().getHp() <= 0 && !attackedPlayers.isAlive()) {
int expReward = attackedPlayers.getLevel() * 100;
int gpReward = (int) (Math.floor(Math.random() * (200 - 50) + 50));
if (player.getLevel() * .25 >= player.getLevel()) {
expReward *= 20;
}
// player.gainExp(expReward, true, true, true);
// player.gainPvpKill();
player.getClient().sendPacket(MaplePacketCreator.getErrorNotice("你杀了 " + attackedPlayers.getName() + "!! !"));
// player.setPvpKills(player.getPvpKills() + 1);
attackedPlayers.getClient().sendPacket(MaplePacketCreator.getErrorNotice("无情的" + player.getName() + "杀了你"));
// attackedPlayers.gainPvpDeath();
// attackedPlayers.setPvpDeaths(player.getPvpDeaths() + 1);
int random = (int) Math.floor(Math.random() * 3000.0D);
if (attackedPlayers.getMeso() >= random) {
attackedPlayers.getMap().spawnMesoDrop(random, attackedPlayers.getPosition(), attackedPlayers, attackedPlayers, false, (byte) 0);
attackedPlayers.gainMeso(-random, true);
attackedPlayers.getClient().sendPacket(MaplePacketCreator.getErrorNotice("无情的" + player.getName() + "杀了你 你损失了" + random + "元!"));
} else {
attackedPlayers.dropMessage("[系统警告] 您的枫币已经不足,请马上离开。");
player.dropMessage("[系统警告] 请不要再残害他,对方枫币已耗尽。");
}
}
}
public static void doPvP(MapleCharacter player, MapleMap map, AttackInfo attack) {
DamageBalancer(attack);
getDirection(attack);
for (MapleCharacter attackedPlayers : player.getMap().getNearestPvpChar(player.getPosition(), maxDis, maxHeight, player.getMap().getCharacters())) {
if (attackedPlayers.getLevel() >= 70) {
if (attackedPlayers.isAlive() && (player.getParty() == null || player.getParty() != attackedPlayers.getParty())) {
monsterBomb(player, attackedPlayers, map, attack);
}
}
}
}
}
| huangshushu/ZLHSS2 | src/server/maps/MaplePvp.java |
64,945 | package decorator;
/**
* Created by lusaijie on 2018/2/12.
*/
public class DoctorS extends Superman {
public DoctorS(Human human) {
super(human);
}
public void magic(){
System.out.println("魔法");
}
@Override
public void move() {
super.move();
magic();
}
}
| lsjrepo/design_pattern_review | src/java/decorator/DoctorS.java |
64,947 | package PAST;
import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.border.TitledBorder;
public class CommandPanel extends JPanel implements ActionListener {
private static final int WIDTH = 170;
private static final int HEIGHT = 170;
private static final int X = 520;
private static final int Y = 370;
JButton attack, cure, magic;
public CommandPanel(){
setBounds(X,Y,WIDTH,HEIGHT);
// 変数などの初期化
setLayout(new FlowLayout());
setBackground(Color.BLUE);
setBorder(new TitledBorder("コマンドパネル"));
attack = new JButton("攻撃");
attack.setBounds(25, 20, 120,30);
attack.addActionListener(this);
add(attack);
cure = new JButton("回復");
cure.setBounds(25, 60, 120,30);
cure.addActionListener(this);
add(cure);
magic = new JButton("魔法");
magic.setBounds(25, 100, 120,30);
magic.addActionListener(this);
add(magic);
}
public void actionPerformed(ActionEvent e) {
if (e.getSource() == attack) {
Run.battleExec(1);
}
if (e.getSource() == cure) {
Run.battleExec(2);
}
if (e.getSource() == magic) {
Run.battleExec(3);
}
}
}
| SLP-KBIT/LKDA | src/PAST/CommandPanel.java |
64,948 | package website;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.ArrayList;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import Tool.DLTools;
import core.BookBasicInfo;
import core.DLBook_AllBook;
import ui.PanelControl;
public class DL_zxcs extends DLBook_AllBook {
public DL_zxcs(PanelControl pc) {
super(pc);
}
@Override
protected ArrayList<BookBasicInfo> getBookInfoByKey(String key) {
ArrayList<BookBasicInfo> bookinfos = new ArrayList<BookBasicInfo>();
String htmlurl = null;
try {
htmlurl = "http://www.zxcs.me/index.php?keyword=" + URLEncoder.encode(key, "utf-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
System.out.println("解码失败(utf-8,yubook):"+key);
return bookinfos;
}
String htmlinfo = DLTools.getHtmlInfo(htmlurl, "utf-8");
if (htmlinfo == null) return bookinfos;
Document doc = Jsoup.parse(htmlinfo);
Elements allbook = doc.select(".wrap>#pleft>#plist");
for(Element ele : allbook)
{
BookBasicInfo bookinfo = new BookBasicInfo();
String BookAndAnthor = ele.select("dt>a").text();
BookAndAnthor = BookAndAnthor.replaceAll("(校对版全本)", "");
int index = BookAndAnthor.indexOf("作者:");
String bookname = BookAndAnthor.substring(0, index);
String anthor = BookAndAnthor.substring(index).replaceAll("作者:", "");
String bookurl = ele.select("dt>a").attr("href");
bookinfo.setAuthor(anthor);
bookinfo.setBookName(bookname);
bookinfo.setBookUrl(bookurl);
bookinfo.setIsfinal(true);
bookinfo.setLastChapter("NA");
bookinfo.setWebsite(this.websitename);
bookinfos.add(bookinfo);
}
pc.setStateMsg(String.format("总搜索结果:%d,解析成功:%d,解析失败:%d(%s)",
bookinfos.size(), bookinfos.size(), 0, this.websitename), true, Thread.currentThread().getStackTrace()[1]);
return bookinfos;
}
@Override
protected ArrayList<String> getCatalog(String Url) {
ArrayList<String> dlurl = new ArrayList<String>();
//获取下载页面
String htmlinfo = DLTools.getHtmlInfo(Url, "utf-8");
if(htmlinfo == null) return null;
Document doc = Jsoup.parse(htmlinfo);
String bookdlurl = doc.select(".wrap>#pleft>#content>.pagefujian>.filecont>.filetit>a").attr("href");
//在下载页面中获取下载地址
htmlinfo = DLTools.getHtmlInfo(bookdlurl, "utf-8");
if(htmlinfo == null) return null;
doc = Jsoup.parse(htmlinfo);
String finalurl = doc.select(".downfile>a").first().attr("href");
dlurl.add(finalurl);
return dlurl;
}
// public static void main(String[] args)
// {
// PanelControl pc = new PanelControl();
// DL_zxcs dlbook = new DL_zxcs(pc);
// dlbook.StartSearch("魔法");
// dlbook.getCatalog(dlbook.getBookinfos().get(0).getBookUrl());
// }
}
| feiguiwoxin/DLBook | src/website/DL_zxcs.java |
64,950 | package dqr.api.Items;
import net.minecraft.item.Item;
public class DQMagics {
/*
public static Item bulletSource;
public static Item materials;
*/
//public static Item itemMera;
public static Item itemZaoraru; //
public static Item itemZaoriku; //
public static Item itemHaigou; //
public static Item itemHaigou2; //
public static Item itemParupunte; //
public static Item itemRemira; //
//魔法
public static Item itemGira;
public static Item itemBegirama;
public static Item itemBegiragon;
public static Item itemGiragureido;
public static Item itemMera;
public static Item itemMerami;
public static Item itemMerazoma;
public static Item itemMeragaia;
public static Item itemIo;
public static Item itemIora;
public static Item itemIonazun;
public static Item itemIogurande;
public static Item itemRaidein;
public static Item itemGigadein;
public static Item itemMinadein;
public static Item itemBagi;
public static Item itemBagima;
public static Item itemBagikurosu;
public static Item itemBagimutyo;
public static Item itemDoruma;
public static Item itemDorukuma;
public static Item itemDorumoa;
public static Item itemDorumadon;
public static Item itemHyado;
public static Item itemHyadaruko;
public static Item itemMahyado;
public static Item itemMahyadodesu;
public static Item itemMagicTool;
public static Item itemMagicTool2;
public static Item itemMagicTool3;
public static Item itemMagicTool4;
public static Item itemMagicTool5;
public static Item itemRurasin; //
public static Item itemRurasin2; //
public static Item itemRurasinC; //
public static Item itemRura;
public static Item itemRuraR;
public static Item itemRuraG;
public static Item itemRuraB;
public static Item itemRuraY;
public static Item itemRuraC;
public static Item itemRuraRC;
public static Item itemRuraGC;
public static Item itemRuraBC;
public static Item itemRuraYC;
public static Item itemBasirura;
public static Item itemBasiruraC;
public static Item itemBasiruraC2;
public static Item itemHoimi;
public static Item itemBehoimi;
public static Item itemBehoma;
public static Item itemBigban;
public static Item itemMadante; //
public static Item itemZaki; //
public static Item itemZaraki; //
public static Item itemZarakima; //
public static Item itemKiari;//
//補助魔法
public static Item itemBaikiruto;
public static Item itemSukara;
public static Item itemBaha;
public static Item itemPiora;
public static Item itemMagicbaria;
public static Item itemMahokanta;
public static Item itemBomie;
public static Item itemRariho;
public static Item itemManusa;
public static Item itemMahoton;
public static Item itemRukani;
public static Item itemMedapani;
public static Item itemHenatosu;
public static Item itemDivainsuperu;
public static Item itemRukanan;
public static Item itemRarihoma;
public static Item itemBomiosu;
//魔法剣
public static Item itemMahouken1;
public static Item itemMahouken2;
public static Item itemMahouken3;
public static Item itemMahouken4;
public static Item itemMahouken5;
public static Item itemMahouken6;
public static Item itemMahouken7;
//追加魔法
public static Item itemRura2;
public static Item itemRuraR2;
public static Item itemRuraG2;
public static Item itemRuraB2;
public static Item itemRuraY2;
public static Item itemUminarinotue;
public static Item itemCallCloud; //雨雲の杖
public static Item itemCallMagma; //熔岩の杖
public static Item itemHikarinotue; //
public static Item itemSukuruto;
public static Item itemFubaha;
public static Item itemPiorimu;
public static Item itemBehomara;
public static Item itemBehomazun;
public static Item itemMahoimi;
public static Item itemMahoriku;
public static Item itemMahoizun;
//ブレス系
public static Item itemBreathF1;
public static Item itemBreathF2;
public static Item itemBreathF3;
public static Item itemBreathF4;
public static Item itemBreathF5;
public static Item itemBreathS1;
public static Item itemBreathS2;
public static Item itemBreathS3;
public static Item itemBreathS4;
public static Item itemBreathS5;
public static Item itemJSkillBook;
public static Item itemJSkillBookR;
public static Item itemJSkillBookB;
public static Item itemJSkillBookG;
public static Item itemJSkillBookY;
}
| azelDqm/MC1.7.10_DQRmod | main/java/dqr/api/Items/DQMagics.java |
64,952 | package cn.interhorse.Q005;
import java.util.Scanner;
/**
* @author Inter Horse
* @date 2020-07-13
* <p>
* <p>
* 魔法
* 成绩: 5 / 折扣: 0.8
* 题面描述
* 魔法部急缺一批魔法师,于是他们急急忙忙新招聘了一批魔法师,应聘魔法师在他们上交的简历里写了各自的学历。学历仅包括初级魔法、中级魔法和高级魔法三门课程的成绩情况,用百分制表达。如果一位魔法师在某门课程上及格 (>=60 分 ) 的话,他就能得到相应的职称并担任对应的职业。当然,有高级职称的人可以担任低级职业。由于交上来的简历太多了,魔法部的负责人找到了你,想让你帮忙计算,能担任初级、中级、高级魔法师的人分别有多少人 ?
* <p>
* 输入数据
* 输入数据第一行为一个正整数 T ,表示测试数据的组数。 接下来是 T 组测试数据,每组测试数据的第一行为一个整数 n ,表示简历份数,随后的 n 行中,每行以低级、中级、高级的顺序表示三门课的成绩( 1≤T≤100 , 1≤n≤1000 , 0≤ 成绩 ≤100 )。
* <p>
* 输出数据
* 对于每一组输入数据,输出一行形如 ”Case #id: a b c” 的结果 , 表示第 id 组数据结果是 a,b,c , id 从 1 开始, a,b,c 表示三种人的数量。
* <p>
* 样例输入
* 2
* 3
* 12 23 99
* 66 66 77
* 99 88 23
* 2
* 100 100 100
* 100 100 100
* <p>
* 样例输出
* Case #1: 3 3 2
* Case #2: 2 2 2
* <p>
* 时间限制: 1 s
* 内存限制: 无限制
*/
public class Main {
public static void main(String[] args) {
Scanner cin = new Scanner(System.in);
// 循环次数
int t = 0;
if (cin.hasNextInt()) {
t = cin.nextInt();
}
for (int i = 0; i < t; i++) {
// 低、中、高人数
int lowNum = 0;
int mediumNum = 0;
int highNum = 0;
// 接收 n
int n = cin.nextInt();
for (int j = 0; j < n; j++) {
// 接受分数
int lowScore;
int mediumScore;
int highScore;
lowScore = cin.nextInt();
mediumScore = cin.nextInt();
highScore = cin.nextInt();
if (highScore >= 60) {
lowNum++;
mediumNum++;
highNum++;
continue;
}
if (mediumScore >= 60) {
lowNum++;
mediumNum++;
continue;
}
if (lowScore >= 60) {
lowNum++;
}
}
System.out.println(String.format("Case #%d: %d %d %d", i + 1, lowNum, mediumNum, highNum));
}
}
}
| InterHorse/bjtu-programs-exercises | java/src/cn/interhorse/Q005/Main.java |
64,953 | package class071;
// 魔法卷轴
// 给定一个数组nums,其中可能有正、负、0
// 每个魔法卷轴可以把nums中连续的一段全变成0
// 你希望数组整体的累加和尽可能大
// 卷轴使不使用、使用多少随意,但一共只有2个魔法卷轴
// 请返回数组尽可能大的累加和
// 对数器验证
public class Code03_MagicScrollProbelm {
// 暴力方法
// 为了测试
public static int maxSum1(int[] nums) {
int p1 = 0;
for (int num : nums) {
p1 += num;
}
int n = nums.length;
int p2 = mustOneScroll(nums, 0, n - 1);
int p3 = Integer.MIN_VALUE;
for (int i = 1; i < n; i++) {
p3 = Math.max(p3, mustOneScroll(nums, 0, i - 1) + mustOneScroll(nums, i, n - 1));
}
return Math.max(p1, Math.max(p2, p3));
}
// 暴力方法
// 为了测试
// nums[l...r]范围上一定要用一次卷轴情况下的最大累加和
public static int mustOneScroll(int[] nums, int l, int r) {
int ans = Integer.MIN_VALUE;
// l...r范围上包含a...b范围
// 如果a...b范围上的数字都变成0
// 返回剩下数字的累加和
// 所以枚举所有可能的a...b范围
// 相当暴力,但是正确
for (int a = l; a <= r; a++) {
for (int b = a; b <= r; b++) {
// l...a...b...r
int curAns = 0;
for (int i = l; i < a; i++) {
curAns += nums[i];
}
for (int i = b + 1; i <= r; i++) {
curAns += nums[i];
}
ans = Math.max(ans, curAns);
}
}
return ans;
}
// 正式方法
// 时间复杂度O(n)
public static int maxSum2(int[] nums) {
int n = nums.length;
if (n == 0) {
return 0;
}
// 情况1 : 完全不使用卷轴
int p1 = 0;
for (int num : nums) {
p1 += num;
}
// prefix[i] : 0~i范围上一定要用1次卷轴的情况下,0~i范围上整体最大累加和多少
int[] prefix = new int[n];
// 每一步的前缀和
int sum = nums[0];
// maxPresum : 之前所有前缀和的最大值
int maxPresum = Math.max(0, nums[0]);
for (int i = 1; i < n; i++) {
prefix[i] = Math.max(prefix[i - 1] + nums[i], maxPresum);
sum += nums[i];
maxPresum = Math.max(maxPresum, sum);
}
// 情况二 : 必须用1次卷轴
int p2 = prefix[n - 1];
// suffix[i] : i~n-1范围上一定要用1次卷轴的情况下,i~n-1范围上整体最大累加和多少
int[] suffix = new int[n];
sum = nums[n - 1];
maxPresum = Math.max(0, sum);
for (int i = n - 2; i >= 0; i--) {
suffix[i] = Math.max(nums[i] + suffix[i + 1], maxPresum);
sum += nums[i];
maxPresum = Math.max(maxPresum, sum);
}
// 情况二 : 必须用2次卷轴
int p3 = Integer.MIN_VALUE;
for (int i = 1; i < n; i++) {
// 枚举所有的划分点i
// 0~i-1 左
// i~n-1 右
p3 = Math.max(p3, prefix[i - 1] + suffix[i]);
}
return Math.max(p1, Math.max(p2, p3));
}
// 为了测试
public static int[] randomArray(int n, int v) {
int[] ans = new int[n];
for (int i = 0; i < n; i++) {
ans[i] = (int) (Math.random() * (v * 2 + 1)) - v;
}
return ans;
}
// 为了测试
public static void main(String[] args) {
int n = 50;
int v = 100;
int testTime = 10000;
System.out.println("测试开始");
for (int i = 0; i < testTime; i++) {
int len = (int) (Math.random() * n);
int[] nums = randomArray(len, v);
int ans1 = maxSum1(nums);
int ans2 = maxSum2(nums);
if (ans1 != ans2) {
System.out.println("出错了!");
}
}
System.out.println("测试结束");
}
}
| algorithmzuo/algorithm-journey | src/class071/Code03_MagicScrollProbelm.java |
64,954 | import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
public class DataInput extends MIDlet {
public DataInput() {
DataInputForm f = new DataInputForm();
Display.getDisplay(this).setCurrent(f);
}
public void startApp() {}
public void pauseApp() {}
public void destroyApp(boolean flg) {}
}
class DataInputForm extends Form implements ItemCommandListener {
String[] strJob={"勇者","魔法使い","神官","武闘家","盗賊"};
String[] strSex={"男","女"};
String[] strDet={"基本情報","パラメータ","装備、魔法"};
ChoiceGroup c1, c2, c3;
TextField t1;
StringItem b1;
DataInputForm() {
super("キャラクター設定");
append(new Spacer(240,5));
t1 = new TextField("名前","",10,TextField.ANY);
t1.setInitialInputMode("UCB_HIRAGANA");
append(t1);
append(new Spacer(240,5));
c1 = new ChoiceGroup("職業",Choice.POPUP);
for (int i=0; i<strJob.length; i++) {
c1.append(strJob[i],null);
}
append(c1);
append(new Spacer(240,5));
c2 = new ChoiceGroup("性別",Choice.EXCLUSIVE);
for (int i=0; i<strSex.length; i++) {
c2.append(strSex[i],null);
}
append(c2);
append(new Spacer(240,5));
c3 = new ChoiceGroup("詳細設定",Choice.MULTIPLE);
for (int i=0; i<strDet.length; i++) {
c3.append(strDet[i],null);
}
append(c3);
append(new Spacer(240,5));
b1 = new StringItem("","OK",Item.BUTTON);
b1.setLayout(Item.LAYOUT_RIGHT);
b1.setDefaultCommand(new Command("OK",Command.OK,1));
b1.setItemCommandListener(this);
append(b1);
}
public void commandAction(Command cmd, Item itm) {
if (!t1.getString().equals("")) {
System.out.println("***入力された値の確認***");
System.out.println("名前 : " + t1.getString());
System.out.println("職業 : " + strJob[c1.getSelectedIndex()]);
System.out.println("性別 : " + strSex[c2.getSelectedIndex()]);
System.out.print("詳細 : ");
for (int i=0; i<strDet.length; i++) {
if (c3.isSelected(i)) {
System.out.println(strDet[i] + " ");
}
}
System.out.println("");
}
}
}
| shu-yusa/j2mewtk | 2.5.2/apps/DataInput/src/DataInput.java |
64,955 | package org.bukkit;
import com.google.common.collect.Maps;
import java.util.Map;
import org.jetbrains.annotations.Nullable;
/**
* 代表两种煤.
*/
public enum CoalType {
COAL(0x0),
CHARCOAL(0x1);
private final byte data;
private static final Map<Byte, CoalType> BY_DATA = Maps.newHashMap();
private CoalType(final int data) {
this.data = (byte) data;
}
/**
* 获取表示该类型的煤的相关数据值.
* <p>
* 原文:
* Gets the associated data value representing this type of coal
* 获取煤的数据值
* @return 煤的数据值
* @deprecated 魔法值
*/
@Deprecated
public byte getData() {
return data;
}
/**
* 用数据值获取煤的类型.
* <p>
* 原文:
* Gets the type of coal with the given data value
*
* @param data 要获取的煤的类型
* @return {@link CoalType} 代表给定的值, 如果不存在则为null
* @deprecated 魔法值
*/
@Deprecated
@Nullable
public static CoalType getByData(final byte data) {
return BY_DATA.get(data);
}
static {
for (CoalType type : values()) {
BY_DATA.put(type.data, type);
}
}
} | BukkitAPI-Translation-Group/Chinese_BukkitAPI | BukkitApi/org/bukkit/CoalType.java |