Commit a91be29b authored by zhengjiangtao's avatar zhengjiangtao

项目初始化

parent 89de4b99
# Compiled class file
*.class
# Log file
*.log
# BlueJ files
*.ctxt
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
.idea
*.iml
*.settings
*.classpath
*.project
*.springBeans
*.factorypath
target
......@@ -20,6 +20,18 @@ public class CheckInputBusinessResponse {
* 检查项检查id
*/
private Long checkInputitemId;
private Long pointClassifyId;
public Long getPointClassifyId() {
return pointClassifyId;
}
public void setPointClassifyId(Long pointClassifyId) {
this.pointClassifyId = pointClassifyId;
}
public long getPointInputitemId() {
return pointInputitemId;
......
......@@ -3,66 +3,78 @@ package com.yeejoin.amos.patrol.common.core.response;
import java.util.List;
public class PointCheckInfoBusinessRespone {
/**
* 巡检点id
*/
private long id;
/**
* 巡检点名称
*/
private String name;
/**
* 状态1:合格,2:不合格,3:漏检
*/
private String nodeState;
private Long checkId;
/**
* 检查项
*/
private List<CheckInputBusinessResponse> pointInputitems;
/**
* 检查项(新版需要传入items对象)
*/
private List<CheckInputBusinessResponse> items;
public Long getCheckId() {
return checkId;
}
public void setCheckId(Long checkId) {
this.checkId = checkId;
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getNodeState() {
return nodeState;
}
public void setNodeState(String nodeState) {
this.nodeState = nodeState;
}
public List<CheckInputBusinessResponse> getPointInputitems() {
return pointInputitems;
}
public void setPointInputitems(List<CheckInputBusinessResponse> pointInputitems) {
this.pointInputitems = pointInputitems;
}
public List<CheckInputBusinessResponse> getItems() {
return items;
}
public void setItems(List<CheckInputBusinessResponse> items) {
this.items = items;
}
/**
* 巡检点id
*/
private long id;
/**
* 巡检点名称
*/
private String name;
/**
* 状态1:合格,2:不合格,3:漏检
*/
private String nodeState;
private Long checkId;
/**
* 检查项
*/
private List<CheckInputBusinessResponse> pointInputitems;
/**
* 检查项(新版需要传入items对象)
*/
private List<CheckInputBusinessResponse> items;
public Long getCheckId() {
return checkId;
}
public void setCheckId(Long checkId) {
this.checkId = checkId;
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getNodeState() {
return nodeState;
}
public void setNodeState(String nodeState) {
this.nodeState = nodeState;
}
public List<CheckInputBusinessResponse> getPointInputitems() {
return pointInputitems;
}
public void setPointInputitems(List<CheckInputBusinessResponse> pointInputitems) {
this.pointInputitems = pointInputitems;
}
public List<CheckInputBusinessResponse> getItems() {
return items;
}
public void setItems(List<CheckInputBusinessResponse> items) {
this.items = items;
}
}
......@@ -187,13 +187,13 @@ public class Point extends BasicEntity {
* 归属区域/部门id
*/
@Column(name="charge_dept_id")
private String chargeDeptId = "0";
private String chargeDeptId ;
/**
* 负责人id
*/
@Column(name="charge_person_id")
private String chargePersonId = "0";
private String chargePersonId ;
/**
* 状态:0 未纳入巡检,1 合格;2 不合格;3 漏检
......
......@@ -6,8 +6,8 @@ import java.util.List;
import java.util.Map;
public enum CheckStatusEnum {
QUALIFIED("合格","1",""),
UNQUALIFIED("不合格","2","#DF7400"),
QUALIFIED("正常","1",""),
UNQUALIFIED("异常","2","#DF7400"),
OMISSION("漏检", "3","#FF0000");
/**
......
......@@ -15,7 +15,7 @@ public enum MsgSubscribeTypeEnum {
作业活动推送("taskworkApp", "作业活动", "作业活动移动端推送", false, "default"),
通知公告推送("notifyApp", "通知公告", "通知公告推送", false, "default"),
有检查记录推送("checkRecordPushHavaRecordApp", "检查记录", "有检查记录推送", true, "check"),
不合格记录推送("checkRecordHavaNoPassRecordApp", "不合格记录", "有不合格记录推送", true, "check"),
异常记录推送("checkRecordHavaNoPassRecordApp", "异常记录", "有异常记录推送", true, "check"),
有漏检推送("checkRecordHaveMissRecordApp", "漏检记录", "有漏检才推送", true, "check"),
全部不推送("checkRecordNoPushApp", "全部不推送", "全部不推送", true, "check"),
隐患治理推送("latentDangerApp", "隐患治理", "隐患治理移动端推送", false, "default"),
......
......@@ -8,8 +8,8 @@ import java.util.Map;
public enum PlanTaskDetailStatusEnum {
NOTSTARTED("未开始","0"),
QUALIFIED("合格","1"),
UNQUALIFIED("不合格","2"),
QUALIFIED("正常","1"),
UNQUALIFIED("异常","2"),
OMISSION("漏检","3");
/**
......
......@@ -12,8 +12,8 @@ import java.util.Map;
*/
public enum PointStatusEnum {
UNPLAN("未纳入巡检计划", "0", ""),
QUALIFIED("合格", "1", ""),
UNQUALIFIED("不合格", "2", "#DF7400"),
QUALIFIED("正常", "1", ""),
UNQUALIFIED("异常", "2", "#DF7400"),
OMISSION("漏检", "3", "#FF0000");
/**
......
......@@ -10,7 +10,7 @@ public enum TaskStatisticsTypeEnum {
INSPECTORS("巡检人员",1),
ROUTE("巡检路线",2),
POINT("巡检点",3),
// DEPARTMENT("巡检部门",4),
DEPARTMENT("巡检部门",4),
PLAN("巡检计划",5),
TASKMONTH("任务日期",6),
TASTTIME("任务月份",7);
......
package com.yeejoin.amos.patrol.util;
import com.yeejoin.amos.patrol.common.entity.CommonResponse;
import com.yeejoin.amos.patrol.common.entity.Constants;
public class CommonResponseUtil
{
public static CommonResponse success()
{
CommonResponse response = new CommonResponse();
response.setResult(Constants.RESULT_SUCCESS);
return response;
}
public static CommonResponse success(Object obj)
{
CommonResponse response = new CommonResponse();
response.setResult(Constants.RESULT_SUCCESS);
response.setDataList(obj);
return response;
}
public static CommonResponse success(Object obj, String message)
{
CommonResponse response = new CommonResponse();
response.setResult(Constants.RESULT_SUCCESS);
response.setDataList(obj);
response.setMessage(message);
return response;
}
public static CommonResponse failure()
{
CommonResponse response = new CommonResponse();
response.setResult(Constants.RESULT_FAILURE);
return response;
}
public static CommonResponse failure(String message)
{
CommonResponse response = new CommonResponse();
response.setResult(Constants.RESULT_FAILURE);
response.setMessage(message);
return response;
}
public static CommonResponse failure(Object obj, String message)
{
CommonResponse response = new CommonResponse();
response.setResult(Constants.RESULT_FAILURE);
response.setDataList(obj);
response.setMessage(message);
return response;
}
}
package com.yeejoin.amos.patrol.util;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.List;
import java.util.Locale;
import java.util.Random;
import org.apache.commons.lang.StringUtils;
/**
* 日期工具类
*
*/
public class DateUtil {
// 默认日期格式
public static final String DATE_DEFAULT_FORMAT = "yyyy-MM-dd";
// 默认日期格式
public static final String DATE_YEARANDMONTH_FORMAT = "yyyy-MM";
// 默认时间格式
public static final String DATETIME_DEFAULT_FORMAT = "yyyy-MM-dd HH:mm:ss";
public static final String TIME_DEFAULT_FORMAT = "HH:mm:ss";
// 日期格式化
private static DateFormat dateFormat = null;
// 时间格式化
private static DateFormat dateTimeFormat = null;
// 年月格式化
private static DateFormat dateYearAndMonthFormat = null;
private static DateFormat timeFormat = null;
private static Calendar gregorianCalendar = null;
static {
dateFormat = new SimpleDateFormat(DATE_DEFAULT_FORMAT);
dateYearAndMonthFormat = new SimpleDateFormat(DATE_YEARANDMONTH_FORMAT);
dateTimeFormat = new SimpleDateFormat(DATETIME_DEFAULT_FORMAT);
timeFormat = new SimpleDateFormat(TIME_DEFAULT_FORMAT);
gregorianCalendar = new GregorianCalendar();
}
/**
* 日期格式化yyyy-MM-dd
*
* @param date
* @return
*/
public static Date formatDate(String date, String format) {
try {
return new SimpleDateFormat(format).parse(date);
} catch (ParseException e) {
e.printStackTrace();
}
return null;
}
/**
* 日期格式化yyyy-MM-dd
*
* @param date
* @return
*/
public static String getDateFormat(Date date) {
return dateFormat.format(date);
}
/**
* 日期格式化yyyy-MM
*
* @param date
* @return
*/
public static String getDateYearAndMonthFormat(Date date) {
return dateYearAndMonthFormat.format(date);
}
/**
* 日期格式化yyyy-MM-dd HH:mm:ss
*
* @param date
* @return
*/
public static String getDateTimeFormat(Date date) {
return dateTimeFormat.format(date);
}
/**
* 时间格式化
*
* @param date
* @return HH:mm:ss
*/
public static String getTimeFormat(Date date) {
return timeFormat.format(date);
}
/**
* 日期格式化
*
* @param date
* @param 格式类型
* @return
*/
public static String getDateFormat(Date date, String formatStr) {
if (StringUtils.isNotBlank(formatStr)) {
return new SimpleDateFormat(formatStr).format(date);
}
return null;
}
/**
* 日期格式化
*
* @param date
* @return
*/
public static Date getDateFormat(String date) {
try {
return dateFormat.parse(date);
} catch (ParseException e) {
e.printStackTrace();
}
return null;
}
/**
* 时间格式化
*
* @param date
* @return
*/
public static Date getDateTimeFormat(String date) {
try {
return dateTimeFormat.parse(date);
} catch (ParseException e) {
e.printStackTrace();
}
return null;
}
/**
* 获取当前日期(yyyy-MM-dd)
*
* @param date
* @return
*/
public static Date getNowDate() {
return DateUtil.getDateFormat(dateFormat.format(new Date()));
}
/**
* 获取当前日期星期一日期
*
* @return date
*/
public static Date getFirstDayOfWeek() {
gregorianCalendar.setFirstDayOfWeek(Calendar.MONDAY);
gregorianCalendar.setTime(new Date());
gregorianCalendar.set(Calendar.DAY_OF_WEEK, gregorianCalendar.getFirstDayOfWeek()); // Monday
return gregorianCalendar.getTime();
}
/**
* 获取当前日期星期日日期
*
* @return date
*/
public static Date getLastDayOfWeek() {
gregorianCalendar.setFirstDayOfWeek(Calendar.MONDAY);
gregorianCalendar.setTime(new Date());
gregorianCalendar.set(Calendar.DAY_OF_WEEK, gregorianCalendar.getFirstDayOfWeek() + 6); // Monday
return gregorianCalendar.getTime();
}
/**
* 获取日期星期一日期
*
* @param 指定日期
* @return date
*/
public static Date getFirstDayOfWeek(Date date) {
if (date == null) {
return null;
}
gregorianCalendar.setFirstDayOfWeek(Calendar.MONDAY);
gregorianCalendar.setTime(date);
gregorianCalendar.set(Calendar.DAY_OF_WEEK, gregorianCalendar.getFirstDayOfWeek()); // Monday
return gregorianCalendar.getTime();
}
/**
* 获取日期星期一日期
*
* @param 指定日期
* @return date
*/
public static Date getLastDayOfWeek(Date date) {
if (date == null) {
return null;
}
gregorianCalendar.setFirstDayOfWeek(Calendar.MONDAY);
gregorianCalendar.setTime(date);
gregorianCalendar.set(Calendar.DAY_OF_WEEK, gregorianCalendar.getFirstDayOfWeek() + 6); // Monday
return gregorianCalendar.getTime();
}
/**
* 获取当前月的第一天
*
* @return date
*/
public static Date getFirstDayOfMonth() {
gregorianCalendar.setTime(new Date());
gregorianCalendar.set(Calendar.DAY_OF_MONTH, 1);
return gregorianCalendar.getTime();
}
/**
* 获取当前月的最后一天
*
* @return
*/
public static Date getLastDayOfMonth() {
gregorianCalendar.setTime(new Date());
gregorianCalendar.set(Calendar.DAY_OF_MONTH, 1);
gregorianCalendar.add(Calendar.MONTH, 1);
gregorianCalendar.add(Calendar.DAY_OF_MONTH, -1);
return gregorianCalendar.getTime();
}
/**
* 获取指定月的第一天
*
* @param date
* @return
*/
public static Date getFirstDayOfMonth(Date date) {
gregorianCalendar.setTime(date);
gregorianCalendar.set(Calendar.DAY_OF_MONTH, 1);
return gregorianCalendar.getTime();
}
/**
* 获取指定月的最后一天
*
* @param date
* @return
*/
public static Date getLastDayOfMonth(Date date) {
gregorianCalendar.setTime(date);
gregorianCalendar.set(Calendar.DAY_OF_MONTH, 1);
gregorianCalendar.add(Calendar.MONTH, 1);
gregorianCalendar.add(Calendar.DAY_OF_MONTH, -1);
return gregorianCalendar.getTime();
}
/**
* 获取日期前一天
*
* @param date
* @return
*/
public static Date getDayBefore(Date date) {
gregorianCalendar.setTime(date);
int day = gregorianCalendar.get(Calendar.DATE);
gregorianCalendar.set(Calendar.DATE, day - 1);
return gregorianCalendar.getTime();
}
/**
* 获取日期后一天
*
* @param date
* @return
*/
public static Date getDayAfter(Date date) {
gregorianCalendar.setTime(date);
int day = gregorianCalendar.get(Calendar.DATE);
gregorianCalendar.set(Calendar.DATE, day + 1);
return gregorianCalendar.getTime();
}
/**
* 获取当前年
*
* @return
*/
public static int getNowYear() {
Calendar d = Calendar.getInstance();
return d.get(Calendar.YEAR);
}
/**
* 获取当前月份
*
* @return
*/
public static int getNowMonth() {
Calendar d = Calendar.getInstance();
return d.get(Calendar.MONTH) + 1;
}
/**
* 获取date的年
*
* @return
*/
public static int getDateYear(Date date) {
Calendar d = Calendar.getInstance();
d.setTime(date);
return d.get(Calendar.YEAR);
}
/**
* 获取date的月份
*
* @return
*/
public static int getDateMonth(Date date) {
Calendar d = Calendar.getInstance();
d.setTime(date);
return d.get(Calendar.MONTH) + 1;
}
/**
* 获取当月天数
*
* @return
*/
public static int getNowMonthDay() {
Calendar d = Calendar.getInstance();
return d.getActualMaximum(Calendar.DATE);
}
/**
* 获取时间段的每一天
*
* @param 开始日期
* @param 结算日期
* @return 日期列表
*/
public static List<Date> getEveryDay(Date startDate, Date endDate) {
if (startDate == null || endDate == null) {
return null;
}
// 格式化日期(yy-MM-dd)
startDate = DateUtil.getDateFormat(DateUtil.getDateFormat(startDate));
endDate = DateUtil.getDateFormat(DateUtil.getDateFormat(endDate));
List<Date> dates = new ArrayList<Date>();
gregorianCalendar.setTime(startDate);
dates.add(gregorianCalendar.getTime());
while (gregorianCalendar.getTime().compareTo(endDate) < 0) {
// 加1天
gregorianCalendar.add(Calendar.DAY_OF_MONTH, 1);
dates.add(gregorianCalendar.getTime());
}
return dates;
}
/**
* 获取提前多少个月
*
* @param monty
* @return
*/
public static Date getFirstMonth(int monty) {
Calendar c = Calendar.getInstance();
c.add(Calendar.MONTH, -monty);
return c.getTime();
}
/**
* 得到现在时间
*
* @return
*/
public static Date getNow()
{
Date currentTime = new Date();
return currentTime;
}
/**
* 获取现在时间
*
* @return 返回时间类型 yyyy-MM-dd HH:mm:ss
*/
public static String getNowDateLongForHandset()
{
Date currentTime = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy:MM:dd-HH:mm:ss");
String dateString = formatter.format(currentTime);
return dateString;
}
public static String getDateLongForHandset(java.util.Date dateDate){
SimpleDateFormat formatter = new SimpleDateFormat("yyyy:MM:dd HH:mm:ss");
String dateString = formatter.format(dateDate);
return dateString;
}
public static String getDateStr(String formatterstr) {
Date currentTime = new Date();
SimpleDateFormat formatter = new SimpleDateFormat(formatterstr);
String dateString = formatter.format(currentTime);
return dateString;
}
/**
* 获取现在时间
*
* @return 返回时间类型 yyyy-MM-dd HH:mm:ss
*/
public static Date getNowDateLong()
{
Date currentTime = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String dateString = formatter.format(currentTime);
ParsePosition pos = new ParsePosition(0);
Date currentTime_2 = formatter.parse(dateString, pos);
return currentTime_2;
}
/**
* 获取现在时间
*
* @return返回短时间格式 yyyy-MM-dd
*/
public static Date getNowDateShort()
{
Date currentTime = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
String dateString = formatter.format(currentTime);
ParsePosition pos = new ParsePosition(8);
Date currentTime_2 = formatter.parse(dateString, pos);
return currentTime_2;
}
/**
* 获取现在时间字符串
*
* @return返回字符串格式 yyyy-MM-dd HH:mm:ss
*/
public static String getNowStrLong()
{
Date currentTime = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String dateString = formatter.format(currentTime);
return dateString;
}
/**
* 获取现在时间字符串
*
* @return 返回短时间字符串格式yyyy-MM-dd
*/
public static String getNowStrShort()
{
Date currentTime = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
String dateString = formatter.format(currentTime);
return dateString;
}
/**
* 获取时间 小时:分;秒 HH:mm:ss
*
* @return
*/
public static String getNowHHMMSS()
{
SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss");
Date currentTime = new Date();
String dateString = formatter.format(currentTime);
return dateString;
}
/**
*
* <pre>
*
* </pre>
*
* @param strDate
* @param dateFormat
* @return
*/
public static Date str2Date(String strDate, String dateFormat)
{
SimpleDateFormat formatter = new SimpleDateFormat(dateFormat);
ParsePosition pos = new ParsePosition(0);
Date strtodate = formatter.parse(strDate, pos);
return strtodate;
}
/**
*
* <pre>
* e.g localDateStr ="2017-03-30T06:28:12.803Z";
* </pre>
*
* @param strDate
* @param dateFormat
* @return
*/
public static Date localDateStr2Date(String localDateStr)
{
LocalDateTime localDate = LocalDateTime.parse(localDateStr,DateTimeFormatter.ISO_ZONED_DATE_TIME);
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String formatLocalDate2Str = localDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
ParsePosition pos = new ParsePosition(0);
Date strtodate = formatter.parse(formatLocalDate2Str, pos);
return strtodate;
}
/**
* 将长时间格式字符串转换为时间 yyyy-MM-dd HH:mm:ss
*
* @param strDate
* @return
*/
public static Date longStr2Date(String strDate)
{
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
ParsePosition pos = new ParsePosition(0);
Date strtodate = formatter.parse(strDate, pos);
return strtodate;
}
/**
* 将长时间格式字符串转换为时间 yyyy-MM-dd HH:mm
*
* @param strDate
* @return
*/
public static Date longStr3Date(String strDate)
{
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm");
ParsePosition pos = new ParsePosition(0);
Date strtodate = formatter.parse(strDate, pos);
return strtodate;
}
/**
* 将长时间格式字符串转换为long型数据
*
* @param strDate
* @return
*/
public static Long longStr2Long(String strDate)
{
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
ParsePosition pos = new ParsePosition(0);
Date strtodate = formatter.parse(strDate, pos);
return strtodate.getTime();
}
/**
* 将长时间格式时间转换为字符串 yyyy-MM-dd HH:mm:ss
*
* @param dateDate
* @return
*/
public static String date2LongStr(Date dateDate)
{
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String dateString = formatter.format(dateDate);
return dateString;
}
/**
* 将短时间格式时间转换为字符串 yyyy-MM-dd
*
* @param dateDate
* @param k
* @return
*/
public static String date2ShortStr(java.util.Date dateDate)
{
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
String dateString = formatter.format(dateDate);
return dateString;
}
/**
*
* <pre>
*
* </pre>
*
* @param l
* @param dateFormat
* @return
*/
public static String long2Str(long l, String dateFormat)
{
if (l == 0)
{
return "";
}
try
{
Date dateDate = new Date(l);
SimpleDateFormat formatter = new SimpleDateFormat(dateFormat);
String dateString = formatter.format(dateDate);
return dateString;
}
catch (Exception e)
{
return "";
}
}
/**
* 把LONG数据类型转换为字符串
*
* @param l
* @return
*/
public static String long2LongStr(long l)
{
if (l == 0)
{
return "";
}
try
{
Date dateDate = new Date(l);
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String dateString = formatter.format(dateDate);
return dateString;
}
catch (Exception e)
{
return "";
}
}
/**
* 把LONG数据类型转换为字符串
*
* <pre>
*
* </pre>
*
* @param l
* @return
*/
public static String long2ShortStr(long l)
{
if (l == 0)
{
return "";
}
try
{
Date dateDate = new Date(l);
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
String dateString = formatter.format(dateDate);
return dateString;
}
catch (Exception e)
{
return "";
}
}
/**
* 将短时间格式字符串转换为时间 yyyy-MM-dd
*
* @param strDate
* @return
*/
public static Date shortStr2ShortDate(String strDate)
{
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
ParsePosition pos = new ParsePosition(0);
Date strtodate = formatter.parse(strDate, pos);
return strtodate;
}
/**
* 提取一个月中的最后一天
*
* @param day
* @return
*/
public static Date getLastDateOfThisMonth(long day)
{
Date date = new Date();
long date_3_hm = date.getTime() - 3600000 * 34 * day;
Date date_3_hm_date = new Date(date_3_hm);
return date_3_hm_date;
}
/**
* 获取日期中的年
*
* @param date
* @return
*/
public static String getYear(Date date) {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String dateString = formatter.format(date);
String year;
year = dateString.substring(0, 4);
return year;
}
/**
* 得到现在小时
*/
public static String getHour()
{
Date currentTime = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String dateString = formatter.format(currentTime);
String hour;
hour = dateString.substring(11, 13);
return hour;
}
/**
* 得到现在分钟
*
* @return
*/
public static String getMinute()
{
Date currentTime = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String dateString = formatter.format(currentTime);
String min;
min = dateString.substring(14, 16);
return min;
}
/**
* 根据用户传入的时间表示格式,返回当前时间的格式 如果是yyyyMMdd,注意字母y不能大写。
*
* @param sformat
* yyyyMMddhhmmss
* @return
*/
public static String parseDate(String sformat)
{
Date currentTime = new Date();
SimpleDateFormat formatter = new SimpleDateFormat(sformat);
String dateString = formatter.format(currentTime);
return dateString;
}
/**
* 二个小时时间间的差值,必须保证二个时间都是"HH:MM"的格式,返回字符型的分钟
*/
public static String getTwoHour(String st1, String st2)
{
String[] kk = null;
String[] jj = null;
kk = st1.split(":");
jj = st2.split(":");
if (Integer.parseInt(kk[0]) < Integer.parseInt(jj[0])) return "0";
else
{
double y = Double.parseDouble(kk[0]) + Double.parseDouble(kk[1]) / 60;
double u = Double.parseDouble(jj[0]) + Double.parseDouble(jj[1]) / 60;
if ((y - u) > 0) return y - u + "";
else
return "0";
}
}
/**
* 得到二个日期间的间隔天数
*/
public static String getTwoDay(String sj1, String sj2)
{
SimpleDateFormat myFormatter = new SimpleDateFormat("yyyy-MM-dd");
long day = 0;
try
{
java.util.Date date = myFormatter.parse(sj1);
java.util.Date mydate = myFormatter.parse(sj2);
day = (date.getTime() - mydate.getTime()) / (24 * 60 * 60 * 1000);
}
catch (Exception e)
{
return "";
}
return day + "";
}
/**
* 时间前推或后推分钟,其中JJ表示分钟.
*/
public static String getPreTime(String sj1, String jj)
{
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String mydate1 = "";
try
{
Date date1 = format.parse(sj1);
long Time = (date1.getTime() / 1000) + Integer.parseInt(jj) * 60;
date1.setTime(Time * 1000);
mydate1 = format.format(date1);
}
catch (Exception e)
{
mydate1 = "";
}
return mydate1;
}
/**
* 得到一个时间延后或前移几天的时间,nowdate为时间,delay为前移或后延的天数
*/
public static String getNextDay(String nowdate, String delay)
{
try
{
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
String mdate = "";
Date d = shortStr2ShortDate(nowdate);
long myTime = (d.getTime() / 1000) + Integer.parseInt(delay) * 24 * 60 * 60;
d.setTime(myTime * 1000);
mdate = format.format(d);
return mdate;
}
catch (Exception e)
{
return "";
}
}
/**
* 判断是否润年
*
* @param ddate
* @return
*/
public static boolean isLeapYear(String ddate)
{
/**
* 详细设计: 1.被400整除是闰年,否则: 2.不能被4整除则不是闰年 3.能被4整除同时不能被100整除则是闰年
* 3.能被4整除同时能被100整除则不是闰年
*/
Date d = shortStr2ShortDate(ddate);
GregorianCalendar gc = (GregorianCalendar) Calendar.getInstance();
gc.setTime(d);
int year = gc.get(Calendar.YEAR);
if ((year % 400) == 0) return true;
else if ((year % 4) == 0)
{
if ((year % 100) == 0) return false;
else
return true;
}
else
return false;
}
/**
* 返回美国时间格式 26 Apr 2006
*
* @param str
* @return
*/
public static String getEDate(String str)
{
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
ParsePosition pos = new ParsePosition(0);
Date strtodate = formatter.parse(str, pos);
String j = strtodate.toString();
String[] k = j.split(" ");
return k[2] + k[1].toUpperCase() + k[5].substring(2, 4);
}
/**
* 获取一个月的最后一天
*
* @param dat
* @return
*/
public static String getEndDateOfMonth(String dat)
{// yyyy-MM-dd
String str = dat.substring(0, 8);
String month = dat.substring(5, 7);
int mon = Integer.parseInt(month);
if (mon == 1 || mon == 3 || mon == 5 || mon == 7 || mon == 8 || mon == 10 || mon == 12)
{
str += "31";
}
else if (mon == 4 || mon == 6 || mon == 9 || mon == 11)
{
str += "30";
}
else
{
if (isLeapYear(dat))
{
str += "29";
}
else
{
str += "28";
}
}
return str;
}
/**
* 判断二个时间是否在同一个周
*
* @param date1
* @param date2
* @return
*/
public static boolean isSameWeekDates(Date date1, Date date2)
{
Calendar cal1 = Calendar.getInstance();
Calendar cal2 = Calendar.getInstance();
cal1.setTime(date1);
cal2.setTime(date2);
int subYear = cal1.get(Calendar.YEAR) - cal2.get(Calendar.YEAR);
if (0 == subYear)
{
if (cal1.get(Calendar.WEEK_OF_YEAR) == cal2.get(Calendar.WEEK_OF_YEAR)) return true;
}
else if (1 == subYear && 11 == cal2.get(Calendar.MONTH))
{
// 如果12月的最后一周横跨来年第一周的话则最后一周即算做来年的第一周
if (cal1.get(Calendar.WEEK_OF_YEAR) == cal2.get(Calendar.WEEK_OF_YEAR)) return true;
}
else if (-1 == subYear && 11 == cal1.get(Calendar.MONTH))
{
if (cal1.get(Calendar.WEEK_OF_YEAR) == cal2.get(Calendar.WEEK_OF_YEAR)) return true;
}
return false;
}
/**
* 产生周序列,即得到当前时间所在的年度是第几周
*
* @return
*/
public static String getSeqWeek()
{
Calendar c = Calendar.getInstance(Locale.CHINA);
String week = Integer.toString(c.get(Calendar.WEEK_OF_YEAR));
if (week.length() == 1) week = "0" + week;
String year = Integer.toString(c.get(Calendar.YEAR));
return year + week;
}
/**
* 获得一个日期所在的周的星期几的日期,如要找出2002年2月3日所在周的星期一是几号
*
* @param sdate
* @param num
* @return
*/
public static String getWeek(String sdate, String num)
{
// 再转换为时间
Date dd = shortStr2ShortDate(sdate);
Calendar c = Calendar.getInstance();
c.setTime(dd);
if (num.equals("1")) // 返回星期一所在的日期
c.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
else if (num.equals("2")) // 返回星期二所在的日期
c.set(Calendar.DAY_OF_WEEK, Calendar.TUESDAY);
else if (num.equals("3")) // 返回星期三所在的日期
c.set(Calendar.DAY_OF_WEEK, Calendar.WEDNESDAY);
else if (num.equals("4")) // 返回星期四所在的日期
c.set(Calendar.DAY_OF_WEEK, Calendar.THURSDAY);
else if (num.equals("5")) // 返回星期五所在的日期
c.set(Calendar.DAY_OF_WEEK, Calendar.FRIDAY);
else if (num.equals("6")) // 返回星期六所在的日期
c.set(Calendar.DAY_OF_WEEK, Calendar.SATURDAY);
else if (num.equals("0")) // 返回星期日所在的日期
c.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
return new SimpleDateFormat("yyyy-MM-dd").format(c.getTime());
}
/**
* 根据一个日期,返回是星期几的字符串
*
* @param sdate
* @return
*/
public static String getWeek(String sdate)
{
// 再转换为时间
Date date = shortStr2ShortDate(sdate);
Calendar c = Calendar.getInstance();
c.setTime(date);
// int hour=c.get(Calendar.DAY_OF_WEEK);
// hour中存的就是星期几了,其范围 1~7
// 1=星期日 7=星期六,其他类推
return new SimpleDateFormat("EEEE").format(c.getTime());
}
public static String getWeekStr(String sdate)
{
String str = "";
str = getWeek(sdate);
if ("1".equals(str))
{
str = "星期日";
}
else if ("2".equals(str))
{
str = "星期一";
}
else if ("3".equals(str))
{
str = "星期二";
}
else if ("4".equals(str))
{
str = "星期三";
}
else if ("5".equals(str))
{
str = "星期四";
}
else if ("6".equals(str))
{
str = "星期五";
}
else if ("7".equals(str))
{
str = "星期六";
}
return str;
}
/**
* 两个时间之间的天数
*
* @param date1
* @param date2
* @return
*/
public static long getDays(String date1, String date2)
{
if (date1 == null || date1.equals("")) return 0;
if (date2 == null || date2.equals("")) return 0;
// 转换为标准时间
SimpleDateFormat myFormatter = new SimpleDateFormat("yyyy-MM-dd");
java.util.Date date = null;
java.util.Date mydate = null;
try
{
date = myFormatter.parse(date1);
mydate = myFormatter.parse(date2);
}
catch (Exception e)
{
;
}
long day = (date.getTime() - mydate.getTime()) / (24 * 60 * 60 * 1000);
return day;
}
/**
* 形成如下的日历 , 根据传入的一个时间返回一个结构 星期日 星期一 星期二 星期三 星期四 星期五 星期六 下面是当月的各个时间
* 此函数返回该日历第一行星期日所在的日期
*
* @param sdate
* @return
*/
public static String getNowMonth(String sdate)
{
// 取该时间所在月的一号
sdate = sdate.substring(0, 8) + "01";
// 得到这个月的1号是星期几
Date date = shortStr2ShortDate(sdate);
Calendar c = Calendar.getInstance();
c.setTime(date);
int u = c.get(Calendar.DAY_OF_WEEK);
String newday = DateUtil.getNextDay(sdate, (1 - u) + "");
return newday;
}
/**
* 取得数据库主键 生成格式为yyyymmddhhmmss+k位随机数
*
* @param k
* 表示是取几位随机数,可以自己定
*/
public static String getNo(int k)
{
return parseDate("yyyyMMddhhmmss") + getRandom(k);
}
/**
* 返回一个随机数
*
* @param i
* @return
*/
private static String getRandom(int i)
{
Random jjj = new Random();
// int suiJiShu = jjj.nextInt(9);
if (i == 0) return "";
String jj = "";
for (int k = 0; k < i; k++)
{
jj = jj + jjj.nextInt(9);
}
return jj;
}
/**
*
* @param args
*/
public static boolean rightDate(String date)
{
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
if (date == null) return false;
if (date.length() > 10)
{
sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
}
else
{
sdf = new SimpleDateFormat("yyyy-MM-dd");
}
try
{
sdf.parse(date);
}
catch (ParseException e)
{
return false;
}
return true;
}
public static void main(String[] args)
{
//
}
/**
* 将date 按照指定 的 格式 formatStr 转换成 字符串
*
* @param date
* @param formatStr
* @return
*/
public static String date2Str(Date date, String formatStr)
{
SimpleDateFormat formatter = new SimpleDateFormat(formatStr);
String dateString = formatter.format(date);
return dateString;
}
/**
* 增加hours小時
*
* @param date
* @param hours
* @return
*/
public static Date addHours(Date date, int hours)
{
if (date == null) return null;
Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.add(Calendar.HOUR_OF_DAY, hours);// 24小时制
// cal.add(Calendar.HOUR, x);12小时制
date = cal.getTime();
return date;
}
/**
* 增加minutes分鐘
*
* @param date
* @param minutes
* @return
*/
public static Date addMinutes(Date date, int minutes)
{
if (date == null) return null;
Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.add(Calendar.MINUTE, minutes);//
date = cal.getTime();
return date;
}
/**
* 功能描述:格式化日期
*
* @param dateStr
* String 字符型日期
* @param format
* String 格式
* @return Date 日期
*/
public static Date parseDate(String dateStr, String format) {
Date date=null;
try {
DateFormat dateFormat = new SimpleDateFormat(format);
date = (Date) dateFormat.parse(dateStr);
} catch (Exception e) {
}
return date;
}
// 指定模式的时间格式
private static SimpleDateFormat getSDFormat(String pattern) {
return new SimpleDateFormat(pattern);
}
/**
* 当前日历,这里用中国时间表示
*
* @return 以当地时区表示的系统当前日历
*/
public static Calendar getCalendar() {
return Calendar.getInstance();
}
/**
* 默认日期按指定格式显示
*
* @param pattern
* 指定的格式
* @return 默认日期按指定格式显示
*/
public static String formatDate(String pattern) {
return getSDFormat(pattern).format(getCalendar().getTime());
}
/**
* 获取当前时间任意
* @return
*/
public static String get(int field) {
return String.valueOf(getCalendar().get(field));
}
/**
* 获取今日的开始时间
* @return
*/
public static Date getTodayBeginTime(){
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
Date today = calendar.getTime();
return today;
}
/**
* 获取今日的结束时间
* @return
*/
public static Date getTodayEndTime(){
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
calendar.set(Calendar.HOUR_OF_DAY, 23);
calendar.set(Calendar.MINUTE, 59);
calendar.set(Calendar.SECOND, 59);
Date today = calendar.getTime();
return today;
}
/**
* 获取两个时间相差的 *小时*分钟
* @param endDate
* @param nowDate
* @return
*/
public static String getDatePoorToMin(Date endDate, Date nowDate) {
// long nd = 1000 * 24 * 60 * 60;
long nh = 1000 * 60 * 60;
long nm = 1000 * 60;
// long ns = 1000;
// 获得两个时间的毫秒时间差异
long diff = endDate.getTime() - nowDate.getTime();
// 计算差多少天
// long day = diff / nd;
// 计算差多少小时
long hour = diff / nh;
// 计算差多少分钟
long min = diff % nh / nm;
// 计算差多少秒//输出结果
// long sec = diff % nd % nh % nm / ns;
return hour + "小时" + min + "分钟";
}
public static String getDatePoorToSec(Date endDate, Date nowDate) {
long nd = 1000 * 24 * 60 * 60;
long nh = 1000 * 60 * 60;
long nm = 1000 * 60;
long ss = 1000;
// long ns = 1000;
// 获得两个时间的毫秒时间差异
long diff = endDate.getTime() - nowDate.getTime();
// 计算差多少天
long day = diff / nd;
// 计算差多少小时
long hour = diff % nd / nh;
// 计算差多少分钟
long min = diff % nd % nh / nm;
long sen = diff % nd % nh % nm / ss;
// 计算差多少秒//输出结果
// long sec = diff % nd % nh % nm / ns;
return day + "天" + hour + "小时" + min + "分钟"+ sen + "秒";
}
}
\ No newline at end of file
package com.yeejoin.amos.patrol.util;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.google.gson.reflect.TypeToken;
/**
*
* <pre>
* JSON工具类
* </pre>
*
* @author dell
* @version $Id: JSONUtil.java, v 0.1 2017年3月28日 下午9:04:47 dell Exp $
*/
public class JSONUtil
{
private static Gson gson = null;
static
{
gson = new Gson();
}
public static synchronized Gson newInstance()
{
if (gson == null)
{
gson = new Gson();
}
return gson;
}
public static String toJson(Object obj)
{
return gson.toJson(obj);
}
public static <T> T toBean(String json, Class<T> clz)
{
return gson.fromJson(json, clz);
}
public static <T> Map<String, T> toMap(String json, Class<T> clz)
{
Map<String, JsonObject> map = gson.fromJson(json,
new TypeToken<Map<String, JsonObject>>() {
}.getType());
Map<String, T> result = new HashMap<>();
for (String key : map.keySet())
{
result.put(key, gson.fromJson(map.get(key), clz));
}
return result;
}
public static Map<String, Object> toMap(String json)
{
Map<String, Object> map = gson.fromJson(json,
new TypeToken<Map<String, Object>>() {
}.getType());
return map;
}
public static <T> List<T> toList(String json, Class<T> clz)
{
JsonArray array = new JsonParser().parse(json).getAsJsonArray();
List<T> list = new ArrayList<>();
for (final JsonElement elem : array)
{
list.add(gson.fromJson(elem, clz));
}
return list;
}
}
package com.yeejoin.amos.patrol.util;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang.enums.ValuedEnum;
/**
*
* <pre>
* 操作枚举
* </pre>
*
* @author as-hanshipeng
* @version $Id: QueryOperatorEnum.java, v 0.1 2016-12-10 下午03:07:33 as-hanshipeng Exp $
*/
public final class QueryOperatorEnum extends ValuedEnum
{
private static final long serialVersionUID = -375127751242109017L;
public static final int LESS_VALUE = 1; //小于
public static final int BIGGER_VALUE = 2; //大于
public static final int EQUAL_VALUE = 3; //等于
public static final int LESS_EQUAL_VALUE = 4; // 小于等于
public static final int BIGGER_EQUAL_VALUE = 5; //大于等于
public static final int NOT_EQUAL_VALUE = 6; //不等于
public static final int IN_VALUE = 7; //包含
public static final int LIKE_VALUE = 8; //like
public static final int OR_VALUE = 9; // 或者
public static final int ORDER_VALUE = 10; // 排序
public static final int NOT_IN_VALUE = 11; // 不包含
public static final int IS_VALUE= 12; //是
public static final QueryOperatorEnum LESS = new QueryOperatorEnum("LESS",
1, "<");
public static final QueryOperatorEnum BIGGER = new QueryOperatorEnum(
"BIGGER", 2, ">");
public static final QueryOperatorEnum EQUAL = new QueryOperatorEnum(
"EQUAL", 3, "=");
public static final QueryOperatorEnum LESS_EQUAL = new QueryOperatorEnum(
"LESS_EQUAL", 4, "<=");
public static final QueryOperatorEnum BIGGER_EQUAL = new QueryOperatorEnum(
"BIGGER_EQUAL", 5, ">=");
public static final QueryOperatorEnum NOT_EQUAL = new QueryOperatorEnum(
"NOT_EQUAL", 6, "<>");
public static final QueryOperatorEnum IN = new QueryOperatorEnum("IN", 7,
"IN");
public static final QueryOperatorEnum LIKE = new QueryOperatorEnum("LIKE",
8, "LIKE");
public static final QueryOperatorEnum OR = new QueryOperatorEnum("OR", 9,
"OR");
public static final QueryOperatorEnum ORDER_BY = new QueryOperatorEnum(
"ORDER BY", 10, "ORDER BY");
public static final QueryOperatorEnum NOT_IN = new QueryOperatorEnum(
"NOT IN", 11, "NOT IN");
public static final QueryOperatorEnum IS = new QueryOperatorEnum(
"IS", 12, "IS");
public String condition;
public String getCondition() {
return condition;
}
public void setCondition(String condition) {
this.condition = condition;
}
protected QueryOperatorEnum(String arg0, int arg1,String condition)
{
super(arg0, arg1);
this.condition = condition;
}
public static QueryOperatorEnum getEnum(String name)
{
try{
return ((QueryOperatorEnum)getEnum(QueryOperatorEnum.class, name));
}catch(Exception ex){return null;}
}
public static QueryOperatorEnum getEnum(int name)
{
try{
return ((QueryOperatorEnum)getEnum(QueryOperatorEnum.class, name));
}catch(Exception ex){return null;}
}
public static Map getMap()
{
try{
return getEnumMap(QueryOperatorEnum.class);
}catch(Exception ex){return null;}
}
public static List getList()
{
try{
return getEnumList(QueryOperatorEnum.class);
}catch(Exception ex){return null;}
}
public static Iterator iterator()
{
try{
return iterator(QueryOperatorEnum.class);
}catch(Exception ex){return null;}
}
}
package com.yeejoin.amos.patrol.util;
import java.math.BigDecimal;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class StringUtil {
private static Pattern NOT_ZERO_AT_THE_END = Pattern.compile("[1-9]+\\d*[1-9]+");
private static Pattern numericPattern = Pattern.compile("-?[0-9]+\\.?[0-9]*");
/**
* 鍒ゆ柇瀵硅薄鏄惁涓虹┖
*
* @param str
* @return
*/
public static boolean isNotEmpty(Object str) {
boolean flag = true;
if (str != null && !str.equals("")) {
if (str.toString().length() > 0) {
flag = true;
}
} else {
flag = false;
}
return flag;
}
/***************************************************************************
* repeat - 閫氳繃婧愬瓧绗︿覆閲嶅鐢熸垚N娆$粍鎴愭柊鐨勫瓧绗︿覆銆�
*
* @param src
* - 婧愬瓧绗︿覆 渚嬪: 绌烘牸(" "), 鏄熷彿("*"), "娴欐睙" 绛夌瓑...
* @param num
* - 閲嶅鐢熸垚娆℃暟
* @return 杩斿洖宸茬敓鎴愮殑閲嶅瀛楃涓�
* @version 1.0 (2006.10.10) Wilson Lin
**************************************************************************/
public static String repeat(String src, int num) {
StringBuffer s = new StringBuffer();
for (int i = 0; i < num; i++)
s.append(src);
return s.toString();
}
/**
* 鍒ゆ柇鏄惁鏁板瓧琛ㄧず
*
* @param
* @return 鏄惁鏁板瓧鐨勬爣蹇�
*/
public static boolean isNumeric(String str) {
// 璇ユ鍒欒〃杈惧紡鍙互鍖归厤鎵�鏈夌殑鏁板瓧 鍖呮嫭璐熸暟
String bigStr;
try {
bigStr = new BigDecimal(str).toString();
} catch (Exception e) {
return false;//寮傚父 璇存槑鍖呭惈闈炴暟瀛椼��
}
Matcher isNum = numericPattern.matcher(bigStr); // matcher鏄叏鍖归厤
if (!isNum.matches()) {
return false;
}
return true;
}
public static int toInt(String s) {
if (s != null && !"".equals(s.trim())) {
try {
return Integer.parseInt(s);
} catch (Exception e) {
return 0;
}
}
return 0;
}
/**
* 鎴彇鍓嶅悗閮戒笉鏄�0鐨勬暟瀛楀瓧绗︿覆
* <p>
* 12010102 => 12010102
* 12010100 => 120101
* ab1201100b => 12011
*
* @param str
* @return
*/
public static String delEndZero(String str) {
Matcher mat = NOT_ZERO_AT_THE_END.matcher(str);
boolean rs = mat.find();
if (rs) {
return mat.group(0);
}
return null;
}
/**
* <pre>
* 绉婚櫎瀛楃涓插悗闈㈢殑0
* </pre>
*
* @param s
* @return
*/
public static String removeSufixZero(String s) {
if (s == null) {
return "";
}
while (s.endsWith("0")) {
if (s.equals("0")) {
s = "";
break;
}
s = s.substring(0, s.length() - 1);
}
return s;
}
public static String notNull(String s){
return s!=null?s:"";
}
public static boolean isStartWithDigit(String str){
char firstCharacter = str.charAt(0);
return Character.isDigit(firstCharacter);
}
public static void main(String[] args){
System.out.println(isStartWithDigit("a3730e937-17e5-4720-8f69-99e8d87d2ee7"));
}
}
......@@ -252,17 +252,25 @@ public class BaseController {
// }
if (XJConstant.CCPC_PERSONAL.equals(roleTypeName)) {
//一线技术,一线业务只能看自己的
DaoCriteria compDaoCriteria = new DaoCriteria();
DaoCriteria compDaoCriteria = new DaoCriteria();
compDaoCriteria.setPropertyName("userId");
compDaoCriteria.setOperator(QueryOperatorEnum.EQUAL.getName());
compDaoCriteria.setValue(getUserId());
daoCriterias.add(compDaoCriteria);
// 添加子公司下的过滤条件
DaoCriteria childCompDaoCriteria = new DaoCriteria();
childCompDaoCriteria.setPropertyName("orgCode");
childCompDaoCriteria.setOperator(QueryOperatorEnum.LIKE.getName());
childCompDaoCriteria.setValue(orgCode + "*%");
daoCriterias.add(childCompDaoCriteria);
} else {
//管理员
daoCriterias = buildOrgDaoCriteriaInChildren(daoCriterias, orgCode);
}
}
return daoCriterias;
......@@ -288,15 +296,15 @@ public class BaseController {
if (XJConstant.CCPC_PERSONAL.equals(roleTypeName)) {
//一线技术,一线业务只能看自己的
DaoCriteria compDaoCriteria = new DaoCriteria();
paramMap.put("orgCode", orgCode);
paramMap.put("userId", getUserId());
paramMap.put("roleFlag", XJConstant.PERSON_FLAG);
paramMap.put("roleFlag", XJConstant.PERSON_FLAG);
} else {
//管理员
paramMap.put("orgCode", orgCode);
paramMap.put("roleFlag", XJConstant.DEPART_FLAG);
}
return paramMap;
}
......@@ -318,6 +326,7 @@ public class BaseController {
//一线技术,一线业务只能看自己的
DaoCriteria compDaoCriteria = new DaoCriteria();
paramMap.put("userId", getUserId());
paramMap.put("orgCode", orgCode);
paramMap.put("roleFlag", XJConstant.PERSON_FLAG);
} else {
......
......@@ -81,10 +81,15 @@ public class CatalogTreeController extends BaseController {
map.put("org_code", orgCode);
map.put("user_id", userId);
map.put("param", param);
if(param.getId()>0){
catalogTreeService.addCatalogTree(map);
return CommonResponseUtil.success();
}
List<CatalogTree> catalogTreelist = catalogTreeService.getCatalogListByPid(Long.valueOf(param.getParentId()), orgCode);
catalogTreelist = catalogTreelist.stream().filter(x -> param.getName().equals(x.getName())).collect(Collectors.toList());
if (catalogTreelist.size() == 0) {
catalogTreeService.addCatalogTree(map);
return CommonResponseUtil.success();
} else {
......
......@@ -101,6 +101,7 @@ import org.apache.http.client.utils.URIBuilder;
import org.apache.http.entity.ContentType;
import org.apache.http.util.EntityUtils;
@RestController
@RequestMapping(value = "/api/check")
@Api(tags = "巡检记录api")
......@@ -242,9 +243,7 @@ public class CheckController extends BaseController {
if(requestParam.getPlanTaskId()!=null){
planTask = planTaskService.selectPlanTaskStatus(requestParam.getPlanTaskId());
}
AgencyUserModel user = getUserInfo();
String userId = user.getUserId();
......@@ -296,9 +295,15 @@ public class CheckController extends BaseController {
asyncTask.pushCheckRecordMessage(checkDto.getCheckId(), realName, map);
//推送到风险系统
asyncTask.pushCheckInfoTo3D(checkDto.getCheckId());
//推送首页统计
asyncTask.pushChartResult();
//推送银行首页
//增建已超时,推送
asyncTask.pushChartResulplantask();
// //推送首页统计
// asyncTask.pushChartResult();
if (!CollectionUtils.isEmpty(checkDto.getUnCheckInputList())) {
//取消隐患添加
checkDto.setUnCheckInputList(null);
asyncTask.pushNoPassCheckRecordMessage(checkDto.getCheckId(), realName, map);
}
remoteWebSocketServer.wsDataRefresh("check");
......@@ -489,15 +494,11 @@ public class CheckController extends BaseController {
if (XJConstant.CCPC_PERSONAL.equals(roleTypeName)) {
//一线技术,一线业务只能看自己的
req.put("userId", getUserId());
req.put("orgCode", loginOrgCode);
} else {
//管理员
req.put("orgCode", loginOrgCode);
}
Map<String, Object> map = checkService.queryRecordByPointId(req);
return CommonResponseUtil.success(map);
}
......@@ -671,8 +672,8 @@ public class CheckController extends BaseController {
dd.setPageSize(pageSize);
dd.setCurrent(current);*/
CommonResponse lis= amosBankFeign.getVideos(pageSize, pageSize, parentId);
CommonResponse lis= amosBankFeign.getVideos(getSelectedOrgInfo().getCompany().getOrgCode(),current, pageSize, parentId);
String resultString = "";
resultString = JSONObject.toJSONString(lis);
......
......@@ -28,8 +28,6 @@ import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.UUID;
......@@ -50,7 +48,6 @@ public class CommonController extends BaseController {
@ApiOperation(value = "任务统计口径类型", notes = "任务统计口径类型")
@RequestMapping(value = "/taskgetStatisticsType", method = RequestMethod.GET)
public CommonResponse getTaskStatisticsType() {
return CommonResponseUtil.success(TaskStatisticsTypeEnum.getEnumList());
}
......
......@@ -44,6 +44,72 @@ public class GroupController extends BaseController {
@Autowired
private RemoteSecurityService remoteSecurityService;
/**
* 部门查询
*
* @return
*/
@ApiOperation(value = "获取当前用户所属公司的所有部门", notes = "获取当前用户所属公司的所有部门")
@RequestMapping(value = "/queryDept1", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
public CommonResponse queryCurrentCompanyDept1() {
ReginParams reginParams = getSelectedOrgInfo();
String dep = reginParams.getCompany().getSequenceNbr();
List<DepartmentModel> departmentModels =null;
//判断当前登录用
if(reginParams.getDepartment()==null){
departmentModels = remoteSecurityService.listDepartmentsByCompanyId(getToken(), getProduct(), getAppKey(), dep);
}else{
departmentModels = remoteSecurityService.listDepartmentsByCompanyId1(getToken(), getProduct(), getAppKey(), reginParams.getDepartment().getSequenceNbr());
}
List<DepartmentBo> departmentBos = ModelToBo(departmentModels);
if(reginParams.getDepartment()!=null){
DepartmentBo ddd=new DepartmentBo();
ddd.setSequenceNbr(reginParams.getDepartment().getSequenceNbr());
ddd.setDepartmentName(reginParams.getDepartment().getDepartmentName());
departmentBos.add(ddd);
}
return CommonResponseUtil.success(departmentBos);
}
/**
* 部门查询
*
* @return
*/
@ApiOperation(value = "获取当前用户所属公司的所有部门", notes = "获取当前用户所属公司的所有部门")
@RequestMapping(value = "/queryDept2", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
public CommonResponse queryCurrentCompanyDept2() {
ReginParams reginParams = getSelectedOrgInfo();
String dep = reginParams.getCompany().getSequenceNbr();
List<DepartmentModel> departmentModels =null;
//判断当前登录用
departmentModels = remoteSecurityService.listDepartmentsByCompanyId(getToken(), getProduct(), getAppKey(), dep);
List<DepartmentBo> departmentBos = ModelToBo(departmentModels);
return CommonResponseUtil.success(departmentBos);
}
/**
* 部门查询
......@@ -53,43 +119,32 @@ public class GroupController extends BaseController {
@ApiOperation(value = "获取当前用户所属公司的所有部门", notes = "获取当前用户所属公司的所有部门")
@RequestMapping(value = "/queryDept", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
public CommonResponse queryCurrentCompanyDept() {
// String loginOrgCode = getLoginOrgCode();
// String[] orgs = loginOrgCode.split("\\*");
// List<SDepartment> list = groupService.findByCompanyId(Long.parseLong(orgs[orgs.length - 1]));
// List<LinkedHashMap<String, Object>> res = new ArrayList<>();
// for (SDepartment d : list) {
// LinkedHashMap<String, Object> dept = new LinkedHashMap<>();
// dept.put("id", d.getId());
// dept.put("key", d.getId());
// dept.put("value", d.getId());
// dept.put("state", "open");
// dept.put("type", "department");
// dept.put("orgCode", loginOrgCode+"-"+d.getDepmCode());
// dept.put("label", d.getDepartmentName());
// dept.put("title", d.getDepartmentName());
// dept.put("name", d.getDepartmentName());
// dept.put("writeable", 0);
// res.add(dept);
// }
// LinkedHashMap<String, Object> dept = new LinkedHashMap<>();
// dept.put("id", -1);
// dept.put("key", -1);
// dept.put("value", -1);
// dept.put("state", "close");
// dept.put("type", "department");
// dept.put("label", "其他");
// dept.put("title", "其他");
// dept.put("name", "其他");
// dept.put("writeable", 0);
// res.add(dept);
// return CommonResponseUtil.success(res);
ReginParams reginParams = getSelectedOrgInfo();
String dep = reginParams.getCompany().getSequenceNbr();
List<DepartmentModel> departmentModels = remoteSecurityService.listDepartmentsByCompanyId(getToken(), getProduct(), getAppKey(), dep);
List<DepartmentBo> departmentModels1=new ArrayList<>();
List<DepartmentBo> departmentBos = ModelToBo(departmentModels);
return CommonResponseUtil.success(departmentBos);
//判断当前登录用
if(reginParams.getDepartment()==null){
departmentModels1=departmentBos;
}else{
for (DepartmentBo departmentModel : departmentBos) {
if(departmentModel.getDepartmentName().equals(reginParams.getDepartment().getDepartmentName())){
departmentModels1.add(departmentModel);
}
}
}
return CommonResponseUtil.success(departmentModels1);
}
//
// /**
......
......@@ -99,6 +99,11 @@ public class InputItemController extends BaseController {
@RequestMapping(value = "/queryItem", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
public CommonResponse queryItemDetail(@ApiParam(value = "巡检项ID") @RequestParam(required = true) Long itemID) {
InputItem bo = inputItemService.queryInputItemDetail(itemID);
if("-0".equals(bo.getLevel())){
bo.setLevel(null);
}
return CommonResponseUtil.success(bo);
}
......@@ -239,7 +244,13 @@ public class InputItemController extends BaseController {
@ApiParam(value = "组合查询条件", required = false, defaultValue = "[]") @RequestBody(required = false) List<CommonRequest> queryRequests) {
// 组织数据权限过滤条件,基础数据不管roleType,全按照选择的公司orgCode过滤
ReginParams reginParams = getSelectedOrgInfo();
String loginOrgCode = getLoginOrgCode(reginParams);
//String loginOrgCode = getLoginOrgCode(reginParams);
//放在公司级别
String loginOrgCode =reginParams.getCompany().getOrgCode();
List<InputItem> list = null;
if (ObjectUtils.isEmpty(queryRequests)) {
......@@ -249,11 +260,11 @@ public class InputItemController extends BaseController {
for (CommonRequest quest : queryRequests) {
if (quest.getName().equals("level")) {
if (StringUtil.isNotEmpty(quest.getValue())) {
if (quest.getValue().toString().equals("-0")) { //如果前台传过来等级条件为-0,数据库则存储为空
level = null;
} else {
// if (quest.getValue().toString().equals("-0")) { //如果前台传过来等级条件为-0,数据库则存储为空
// level = null;
// } else {
level = quest.getValue().toString();
}
// }
}
}
......
package com.yeejoin.amos.patrol.service.business.controller;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import com.alibaba.fastjson.JSON;
import org.apache.commons.beanutils.BeanUtils;
import org.assertj.core.util.Lists;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import com.yeejoin.amos.feign.privilege.model.DepartmentModel;
//import com.yeejoin.amos.op.core.common.query.DaoCriteria;
//import com.yeejoin.amos.op.core.common.response.CommonResponse;
//import com.yeejoin.amos.op.core.util.CommonResponseUtil;
import com.yeejoin.amos.patrol.common.core.request.CommonPageable;
import com.yeejoin.amos.patrol.common.core.request.CommonRequest;
import com.yeejoin.amos.patrol.common.entity.CommonResponse;
import com.yeejoin.amos.patrol.common.entity.CommonResponseUtil;
import com.yeejoin.amos.patrol.common.entity.DaoCriteria;
import com.yeejoin.amos.patrol.common.entity.Msg;
import com.yeejoin.amos.patrol.common.entity.MsgSubscribe;
import com.yeejoin.amos.patrol.common.entity.UserModel;
import com.yeejoin.amos.patrol.common.entity.*;
import com.yeejoin.amos.patrol.common.enums.MsgSubscribeTypeEnum;
import com.yeejoin.amos.patrol.common.vo.DepartmentUserTreeWebVo;
import com.yeejoin.amos.patrol.service.business.param.MsgInfoPageParam;
import com.yeejoin.amos.patrol.service.business.param.NoticePublishParam;
import com.yeejoin.amos.patrol.service.business.param.UserMsgInitParam;
......@@ -50,12 +21,27 @@ import com.yeejoin.amos.patrol.service.constants.XJConstant;
import com.yeejoin.amos.patrol.service.framework.ReginParams;
import com.yeejoin.amos.patrol.service.quartz.IJobService;
import com.yeejoin.amos.patrol.service.remote.RemoteSecurityService;
//import com.yeejoin.amos.security.common.authorization.Authorization;
//import com.yeejoin.amos.security.common.model.UserModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.assertj.core.util.Lists;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.*;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
//import com.yeejoin.amos.op.core.common.query.DaoCriteria;
//import com.yeejoin.amos.op.core.common.response.CommonResponse;
//import com.yeejoin.amos.op.core.util.CommonResponseUtil;
//import com.yeejoin.amos.security.common.authorization.Authorization;
//import com.yeejoin.amos.security.common.model.UserModel;
/**
......@@ -78,7 +64,7 @@ public class MsgController extends BaseController {
@Autowired
private RemoteSecurityService remoteSecurityService;
@Autowired
private IJobService jobService;
......@@ -91,7 +77,7 @@ public class MsgController extends BaseController {
@ApiOperation(value = "获取用户当前所选择公司的消息订阅信息", notes = "获取用户当前所选择公司的消息订阅信息")
@GetMapping(value = "/querySubscribe", produces = "application/json;charset=UTF-8")
public CommonResponse queryMsgSetting() {
AgencyUserModel userModel = getUserInfo();
AgencyUserModel userModel = getUserInfo();
String userId = userModel.getUserId();
ReginParams reginParams = getSelectedOrgInfo();
String loginOrgCode = getLoginOrgCode(reginParams);
......@@ -107,28 +93,28 @@ public class MsgController extends BaseController {
// checkType = setupSelectItem(checkType, msgSubs); // 标记已经选择的检查类型消息 List<Map<String, Object>> checkType = CheckTypeEnum.getEnumList();
JSONObject response = new JSONObject();
for (MsgSubscribe msgSubscribe : msgSubs) {
try {
try {
/*Map<String, Object> map= objectToMap(msgSubscribe);
map.put("createDate", msgSubscribe.getCreateDate().getTime());*/
MsgSubscribeTypeEnum typeEnum = MsgSubscribeTypeEnum.getByMsgType(msgSubscribe.getMsgType());
if (typeEnum != null) {
JSONArray array = response.getJSONArray(typeEnum.getType());
if (array == null) {
array = new JSONArray();
array.add(msgSubscribe);
} else {
array.add(msgSubscribe);
}
response.put(typeEnum.getType(), array);
MsgSubscribeTypeEnum typeEnum = MsgSubscribeTypeEnum.getByMsgType(msgSubscribe.getMsgType());
if (typeEnum != null) {
JSONArray array = response.getJSONArray(typeEnum.getType());
if (array == null) {
array = new JSONArray();
array.add(msgSubscribe);
} else {
array.add(msgSubscribe);
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
response.put(typeEnum.getType(), array);
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return CommonResponseUtil.success(response);
// /**
......@@ -157,9 +143,8 @@ public class MsgController extends BaseController {
//
// }
}
public static Map<String, Object> objectToMap(Object obj) throws IllegalAccessException {
Map<String, Object> map = new HashMap<String, Object>();
Map<String, Object> map = new HashMap<String,Object>();
Class<?> clazz = obj.getClass();
for (Field field : clazz.getDeclaredFields()) {
field.setAccessible(true);
......@@ -169,11 +154,9 @@ public class MsgController extends BaseController {
}
return map;
}
public static Object nvl(Object param) {
return param != null ? param : null;
}
public static Object nvl(Object param) {
return param != null ? param : null;
}
/**
* 保存用户消息订阅信息
*/
......@@ -181,7 +164,7 @@ public class MsgController extends BaseController {
@PostMapping(value = "/saveSubscribe", produces = "application/json;charset=UTF-8")
public CommonResponse saveSubscribe(@ApiParam(value = "消息订阅信息") @RequestBody(required = false) List<MsgSubscribe> subscribe) {
try {
AgencyUserModel user = getUserInfo();
AgencyUserModel user = getUserInfo();
ReginParams reginParams = getSelectedOrgInfo();
String loginOrgCode = getLoginOrgCode(reginParams);
for (MsgSubscribe s : subscribe) {
......@@ -238,7 +221,7 @@ public class MsgController extends BaseController {
@GetMapping(value = "/unreadCount", produces = "application/json;charset=UTF-8")
public CommonResponse getUnreadCount() {
try {
AgencyUserModel user = getUserInfo();
AgencyUserModel user = getUserInfo();
int count = msgSubscribeService.getUnreadCount(user);
return CommonResponseUtil.success(count);
} catch (Exception e) {
......@@ -254,21 +237,21 @@ public class MsgController extends BaseController {
@GetMapping(value = "/MsgType", produces = "application/json;charset=UTF-8")
public CommonResponse getMsgType() {
try {
//消息类型。从数据字典获取
JSONArray list = remoteSecurityService.listDictionaryByDictCode(getToken(), getProduct(), getAppKey(), "XXLX_TYPE");
List<Map<String, String>> listdate = Lists.newArrayList();
if (list != null && list.size() > 0) {
for (int i = 0; i < list.size(); i++) {
Map<String, String> map = new HashMap<>();
map.put(list.getJSONObject(i).get("dictDataKey").toString(), list.getJSONObject(i).get("dictDataValue").toString());
listdate.add(map);
}
}
return CommonResponseUtil.success(listdate);
// return CommonResponseUtil.success(MsgSubscribeTypeEnum.getEnumList());
//消息类型。从数据字典获取
JSONArray list= remoteSecurityService.listDictionaryByDictCode(getToken(),getProduct(),getAppKey(),"XXLX_TYPE");
List<Map<String, String>> listdate = Lists.newArrayList();
if(list!=null &&list.size()>0){
for (int i = 0; i < list.size(); i++) {
Map<String, String> map=new HashMap<>();
map.put(list.getJSONObject(i).get("dictDataKey").toString(), list.getJSONObject(i).get("dictDataValue").toString());
listdate.add(map);
}
}
return CommonResponseUtil.success(listdate);
// return CommonResponseUtil.success(MsgSubscribeTypeEnum.getEnumList());
} catch (Exception e) {
return CommonResponseUtil.failure("获取消息类型失败");
}
......@@ -284,7 +267,7 @@ public class MsgController extends BaseController {
@ApiParam(value = "查询条件") @RequestBody(required = false) List<CommonRequest> queryRequests,
@ApiParam(value = "分页参数", required = true, defaultValue = "pageNumber=0&pageSize=10") CommonPageable commonPageable) {
try {
AgencyUserModel user = getUserInfo();
AgencyUserModel user = getUserInfo();
ReginParams reginParams = getSelectedOrgInfo();
String loginOrgCode = getLoginOrgCode(reginParams);
String roleTypeName = getRoleTypeName(reginParams);
......@@ -353,73 +336,72 @@ public class MsgController extends BaseController {
@PostMapping(value = "/noticePublish", produces = "application/json;charset=UTF-8")
public CommonResponse noticePublish(@ApiParam(value = "通知信息", required = true) @RequestBody NoticePublishParam msg) {
try {
AgencyUserModel user = getUserInfo();
AgencyUserModel user = getUserInfo();
msg.setCreateBy(user.getUserId());
List<Msg> msgList = iMsgService.publishNotice(getToken(), getProduct(), getAppKey(), msg);
List<Msg> msgList = iMsgService.publishNotice(getToken(),getProduct(),getAppKey(),msg);
msgList.forEach(m -> jobService.msgAddJob(m));
return CommonResponseUtil.success();
} catch (Exception e) {
return CommonResponseUtil.failure("通知发布失败!");
}
}
/**
* 告警发布
*/
//@Authorization(ingore = true)
@ApiOperation(value = "告警发布", notes = "告警发布")
@PostMapping(value = "/alarmNotification", produces = "application/json;charset=UTF-8")
public CommonResponse alarmNotification(@ApiParam(value = "通知信息", required = true) @RequestBody Map<String, Object> map) {
public CommonResponse alarmNotification(@ApiParam(value = "通知信息", required = true) @RequestBody Map<String,Object> map) {
try {
NoticePublishParam msg = new NoticePublishParam();
//设置为及时发送
msg.setIsImmediately(true);
msg.setBody(map.get("body").toString());
//获取公司code
String code = map.get("code").toString();
//获取公司单位树
List<CompanyModel> companyBoList = remoteSecurityService.listCompanyTree(getToken(), getProduct(), getAppKey(), null);
//单位id
List depid = new ArrayList();
buildUserDeptTreeForWeb(code, depid, companyBoList);
//获去单位下所有用户id
List listuserid = new ArrayList();
if (depid == null || depid.size() < 1) {
return CommonResponseUtil.failure("告警发布失败!");
}
//单位下部门
List<DepartmentModel> ld = remoteSecurityService.listDepartmentsByCompanyId(getToken(), getProduct(), getAppKey(), depid.get(0).toString());
for (int i = 0; i < ld.size(); i++) {
List<AgencyUserModel> kk = remoteSecurityService.listUserByDepartmentId(getToken(), getProduct(), getAppKey(), ld.get(i).getSequenceNbr() + "");
if (kk != null && kk.size() > 0) {
kk.forEach(demo -> {
listuserid.add(demo.getUserId());
});
}
}
msg.setUserId(listuserid);
List<Msg> msgList = iMsgService.publishNotice1(getToken(), getProduct(), getAppKey(), msg);
NoticePublishParam msg =new NoticePublishParam();
//设置为及时发送
msg.setIsImmediately(true);
msg.setBody(map.get("body").toString());
//获取公司code
String code=map.get("code").toString();
//获取公司单位树
List<CompanyModel> companyBoList = remoteSecurityService.listCompanyTree(getToken(),getProduct(),getAppKey(),null);
//单位id
List depid=new ArrayList();
buildUserDeptTreeForWeb(code,depid, companyBoList);
//获去单位下所有用户id
List listuserid=new ArrayList();
if(depid==null||depid.size()<1){
return CommonResponseUtil.failure("告警发布失败!");
}
//单位下部门
List<DepartmentModel> ld=remoteSecurityService.listDepartmentsByCompanyId(getToken(),getProduct(),getAppKey(),depid.get(0).toString());
for (int i = 0; i < ld.size(); i++) {
List<AgencyUserModel> kk= remoteSecurityService.listUserByDepartmentId(getToken(),getProduct(),getAppKey(),ld.get(i).getSequenceNbr()+"");
if(kk!=null&&kk.size()>0){
kk.forEach(demo -> {
listuserid.add(demo.getUserId());
});
}
}
msg.setUserId(listuserid);
List<Msg> msgList = iMsgService.publishNotice1(getToken(),getProduct(),getAppKey(),msg);
return CommonResponseUtil.success();
} catch (Exception e) {
e.printStackTrace();
e.printStackTrace();
return CommonResponseUtil.failure("告警发布失败!");
}
}
/**
* 添加信息
*/
@ApiOperation(value = "添加信息", notes = "添加信息")
@PostMapping(value = "/saveMsg", produces = "application/json;charset=UTF-8")
public CommonResponse saveMsg(@ApiParam(value = "添加信息", required = true) @RequestBody Map<String, Object> map) {
Msg msg = JSON.parseObject(JSON.toJSONString(map), Msg.class);
@PostMapping(value = "/pushRiskMsg", produces = "application/json;charset=UTF-8")
public CommonResponse saveMsg(@ApiParam(value = "添加信息", required = true) @RequestBody Map<String, Object> msgMap) {
try {
iMsgService.saveMsg(msg);
iMsgService.pushRiskMsg(msgMap);
return CommonResponseUtil.success("保存成功");
} catch (Exception e) {
return CommonResponseUtil.failure("保存失败");
......@@ -427,45 +409,45 @@ public class MsgController extends BaseController {
}
//获取公司depid
public void buildUserDeptTreeForWeb(String code, List<String> depid, List<CompanyModel> children) {
public void buildUserDeptTreeForWeb(String code, List<String> depid,List<CompanyModel> children) {
for (int i = 0; i < children.size(); i++) {
CompanyModel json = children.get(i);
if (code.equals(json.getOrgCode())) {
depid.add(json.getSequenceNbr().toString());
}
CompanyModel json = children.get(i);
if (code.equals(json.getOrgCode())) {
depid.add(json.getSequenceNbr().toString());
}
// else{
// List<CompanyModel> childrens = (List<CompanyModel>) children.get(i).getChildren();
// if (childrens != null && childrens.size() > 0) {
// buildUserDeptTreeForWeb(code,depid, childrens);
// }
// }
}
}
private void buildUserDeptTreeForWeb(List<String> list, JSONArray children) {
for (int i = 0; i < children.size(); i++) {
JSONObject json = children.getJSONObject(i);
if (json != null && json.size() > 0) {
if ("user".equals(json.getString("type"))) {
Map map = JSONObject.parseObject(json.getString("object"), Map.class);
Map map = JSONObject.parseObject(json.getString("object"), Map.class);
list.add(map.get("userId").toString());
} else {
Map map = JSONObject.parseObject(json.getString("object"), Map.class);
Map map = JSONObject.parseObject(json.getString("object"), Map.class);
JSONArray childrens = json.getJSONArray("children");
if (childrens != null && childrens.size() > 0) {
buildUserDeptTreeForWeb(list, childrens);
}
}
}
}
}
}
}
}
}
package com.yeejoin.amos.patrol.service.business.controller;
import com.yeejoin.amos.feign.privilege.model.DepartmentModel;
//import com.yeejoin.amos.op.core.common.response.CommonResponse;
//import com.yeejoin.amos.op.core.util.CommonResponseUtil;
import com.yeejoin.amos.patrol.common.core.request.CommonPageable;
......@@ -12,6 +13,8 @@ import com.yeejoin.amos.patrol.service.business.service.intfc.IPlanService;
import com.yeejoin.amos.patrol.service.business.util.PlanPageParamUtil;
import com.yeejoin.amos.patrol.service.constants.XJConstant;
import com.yeejoin.amos.patrol.service.framework.ReginParams;
import com.yeejoin.amos.patrol.service.remote.RemoteSecurityService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
......@@ -36,7 +39,8 @@ public class PlanController extends BaseController {
@Autowired
private IPlanService planService;
@Autowired
private RemoteSecurityService remoteSecurityService;
/**
* 巡检计划查询
*/
......@@ -70,8 +74,24 @@ public class PlanController extends BaseController {
ReginParams reginParams = getSelectedOrgInfo();
String loginOrgCode = getLoginOrgCode(reginParams);
HashMap<String, Object> map = new HashMap<String, Object>();
map.put("org_code", loginOrgCode);
String OrgCode =null;
map.put("user_id", userId);
//根据部门id 获取部门orgcode
if(param.getDeptId()!=null){
DepartmentModel departmentModel = remoteSecurityService.getDepartmentByDeptId(getToken(),getProduct(),getAppKey(), param.getDeptId());
if(departmentModel!=null){
OrgCode =departmentModel.getOrgCode();
}
}
if(OrgCode!=null){
map.put("org_code", OrgCode);
}else{
map.put("org_code", loginOrgCode);
}
map.put("param", param);
planService.addPlan(map);
return CommonResponseUtil.success();
......
......@@ -198,11 +198,14 @@ public class PlanTaskController extends BaseController {
@RequestMapping(value = "/queryOmission", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
public CommonResponse pushCarData() {
try {
log.error("定时任务开始生成巡检计划==================================");
planTaskService.taskExecution(null);
log.error("定时任务生成巡检计划成功====================================");
return CommonResponseUtil.success();
} catch (Exception e) {
e.printStackTrace();
log.error(e.getMessage(), e);
log.error("定时任务生成巡检计划失败==============================");
return CommonResponseUtil.failure();
}
}
......@@ -240,7 +243,8 @@ public class PlanTaskController extends BaseController {
try {
HashMap<String, Object> params = new HashMap<String, Object>();
ReginParams reginParams = getSelectedOrgInfo();
String loginOrgCode = getLoginOrgCode(reginParams);
//String loginOrgCode = getLoginOrgCode(reginParams);
String loginOrgCode =reginParams.getCompany().getOrgCode();
params.put("orgCode", loginOrgCode);
String pointNo = serial;
params.put("pointNo", pointNo);
......@@ -385,7 +389,16 @@ public class PlanTaskController extends BaseController {
point1.setUsuallyShot(point.getUsuallyShot()) ;
point1.setChargeDeptId(point.getChargeDeptId()) ;
point1.setChargePersonId(point.getChargePersonId()) ;
response.put("checkItem", inputItems);
List<PointClassify> catalogs = new ArrayList<>();
catalogs = pointService.queryPointClassify(pointId);
......@@ -430,7 +443,7 @@ public class PlanTaskController extends BaseController {
@ApiParam(value = "分页参数", required = false, defaultValue = "current=0&pageSize=10或pageNumber0&pageSize=10") CommonPageable pageable) {
HashMap<String, Object> params = new HashMap<String, Object>();
ReginParams reginParams = getSelectedOrgInfo();
String loginOrgCode = getLoginOrgCode( reginParams);
String loginOrgCode = getLoginOrgCode(reginParams);
String roleTypeName = getRoleTypeName(reginParams);
params = PlanTaskPageParamUtil.fillPlanTask(queryRequests, params);
......@@ -438,13 +451,11 @@ public class PlanTaskController extends BaseController {
if (XJConstant.CCPC_PERSONAL.equals(roleTypeName)) {
//一线技术,一线业务只能看自己的
params.put("userId", getUserId());
params.put("orgCode", loginOrgCode);
} else {
//二线技术
params.put("orgCode", loginOrgCode);
}
params.put("pageSize", pageable.getPageSize());
params.put("offset", pageable.getPageNumber() * pageable.getPageSize());
if (ObjectUtils.isEmpty(params.get("orderBy"))) {
......
......@@ -2,6 +2,7 @@ package com.yeejoin.amos.patrol.service.business.controller;
import com.alibaba.fastjson.JSONArray;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.DepartmentModel;
//import com.yeejoin.amos.op.core.common.query.DaoCriteria;
//import com.yeejoin.amos.op.core.common.response.CommonResponse;
//import com.yeejoin.amos.op.core.util.CommonResponseUtil;
......@@ -94,7 +95,19 @@ public class PointController extends BaseController {
try {
ReginParams reginParams = getSelectedOrgInfo();
String loginOrgCode = getLoginOrgCode(reginParams);
pointParam.getPoint().setOrgCode(loginOrgCode); //点归属于公司
//根据选择的部门获取orgcode
Point point1 = pointParam.getPoint();
DepartmentModel departmentModel = remoteSecurityService.getDepartmentByDeptId(getToken(),getProduct(),getAppKey(), point1.getChargeDeptId());
if(departmentModel!=null){
point1.setOrgCode(departmentModel.getOrgCode());
pointParam.setPoint(point1);
}else{
pointParam.getPoint().setOrgCode(loginOrgCode); //点归属于公司
}
pointParam.getPoint().setCreatorId(user.getUserId());
//默认值防止报错
pointParam.getPoint().setOriginalId("0");
......@@ -160,6 +173,16 @@ public class PointController extends BaseController {
@PutMapping(value = "/updatePoint", produces = "application/json;charset=UTF-8")
public CommonResponse updatePoint(@ApiParam(value = "巡检点", required = true) @RequestBody PointParam pointParam) {
try {
//根据选择的部门获取orgcode
Point point1 = pointParam.getPoint();
DepartmentModel departmentModel = remoteSecurityService.getDepartmentByDeptId(getToken(),getProduct(),getAppKey(), point1.getChargeDeptId());
if(departmentModel!=null){
point1.setOrgCode(departmentModel.getOrgCode());
pointParam.setPoint(point1);
}
Point point = iPointService.updatePoint(pointParam);
List<Long> ids = new ArrayList<>();
ids.add(point.getId());
......@@ -279,7 +302,10 @@ public class PointController extends BaseController {
public CommonResponse exportTemplate(HttpServletResponse response) {
String userId = getUserId();
ReginParams reginParams = getSelectedOrgInfo();
String loginOrgCode = getLoginOrgCode(reginParams);
//String loginOrgCode = getLoginOrgCode(reginParams);
//放到公司级
String loginOrgCode =reginParams.getCompany().getOrgCode();
String fileName = "巡检点导入模板"; //模板名称
String[] handers = {"点编号(必填)", "点名称(必填)", "是否为移动点", "计划外巡检是否评分", "是否允许离线巡检", "参考地址", "3维地图坐标", "3维地图楼层", "最少拍照数量", "最多拍照数量", "风险等级(必填)", "备注说明", "所属分类目录", "检查项目", "是否室内"}; //列标题
List<String[]> downData = new ArrayList();
......@@ -330,7 +356,9 @@ public class PointController extends BaseController {
HttpServletResponse response) {
String userId = getUserId();
ReginParams reginParams = getSelectedOrgInfo();
String orgCode = getLoginOrgCode(reginParams);
// String orgCode = getLoginOrgCode(reginParams);
//公司级
String orgCode =reginParams.getCompany().getOrgCode();
try {
PointImportQueryParam pointImportQueryParam = PointParamUtils.fillPointImportQuery(queryRequests);
pointImportQueryParam.setOrgCode(orgCode);
......@@ -340,7 +368,8 @@ public class PointController extends BaseController {
} else if (exportType == 1) {
FileHelper.exportQRCode(pointList, "巡检点二维码", response);
}
return CommonResponseUtil.success("导出成功");
return null;
// return CommonResponseUtil.success("导出成功");
} catch (Exception e) {
log.error(e.getMessage(), e);
return CommonResponseUtil.failure("查询巡检点信息失败");
......@@ -382,7 +411,9 @@ public class PointController extends BaseController {
@ApiParam(value = "分页参数", required = true, defaultValue = "pageNumber=0&pageSize=10") CommonPageable commonPageable) {
String userId = getUserId();
ReginParams reginParams = getSelectedOrgInfo();
String orgCode = getLoginOrgCode(reginParams);
//点放到公司下
//String orgCode = getLoginOrgCode(reginParams);
String orgCode = reginParams.getCompany().getOrgCode();
try {
CommonRequest commonRequest = new CommonRequest();
commonRequest.setName("orgCode");
......@@ -425,7 +456,9 @@ public class PointController extends BaseController {
@ApiParam(value = "巡检点名称", required = false) @RequestParam("name") String name) {
String userId = getUserId();
ReginParams reginParams = getSelectedOrgInfo();
String orgCode = getLoginOrgCode(reginParams);
//公司级别
// String orgCode = getLoginOrgCode(reginParams);
String orgCode = reginParams.getCompany().getOrgCode();
try {
List<HashMap<String, Object>> list = iPointService.findPointList(code, name, orgCode);
return CommonResponseUtil.success(list);
......@@ -565,6 +598,7 @@ public class PointController extends BaseController {
if (XJConstant.CCPC_PERSONAL.equals(roleTypeName)) {
//一线技术,一线业务只能看自己的
params.put("userId", getUserId());
params.put("orgCode", loginOrgCode);
} else {
//二线技术
......@@ -593,6 +627,7 @@ public class PointController extends BaseController {
if (XJConstant.CCPC_PERSONAL.equals(roleTypeName)) {
//一线技术,一线业务只能看自己的
params.put("userId", getUserId());
params.put("orgCode", loginOrgCode);
} else {
//二线技术
......
......@@ -305,7 +305,6 @@ public class RouteController extends BaseController {
if (XJConstant.CCPC_PERSONAL.equals(roleTypeName)) {
//一线技术,一线业务只能看自己的
userId = userModel.getUserId();
} else {
//二线技术
loginOrgCode = reginParams.getCompany().getOrgCode();
......@@ -316,6 +315,7 @@ public class RouteController extends BaseController {
List<HashMap<String, Object>> routeList = routeService.queryRouteListByOrgCode(loginOrgCode, userId, departmentId);
return CommonResponseUtil.success(routeList);
} catch (Exception e) {
e.printStackTrace();
return CommonResponseUtil.failure(e.getMessage());
}
}
......@@ -331,7 +331,9 @@ public class RouteController extends BaseController {
try {
String uid = getUserId();
ReginParams reginParams = getSelectedOrgInfo();
String loginOrgCode = getLoginOrgCode(reginParams);
//公司 级别
// String loginOrgCode = getLoginOrgCode(reginParams);
String loginOrgCode =reginParams.getCompany().getOrgCode();
HashMap<String, Object> reqParam = new HashMap<>();
reqParam.put("orgCode", loginOrgCode);
RoutePageParamUtil.fillRouteInfo(queryRequests, reqParam);
......
......@@ -380,11 +380,9 @@ public class SafetyPreCtrlController extends BaseController {
String roleTypeName = getRoleTypeName(reginParams);
HashMap<String, Object> paramMap = buildMybatisDaoCriterias(loginOrgCode, roleTypeName);
CheckPtListPageParam params = CheckPageParamUtil.fillChkPtParam(queryRequests, null, paramMap);
List<PlanRoutePointBo> checkChkExListBo = checkService.getRoutePlanPointList(params);
List<PlanRoutePointBo> checkChkExListBo = checkService.getRoutePlanPointList(params);
return CommonResponseUtil.success(checkChkExListBo);
}
......
......@@ -479,6 +479,7 @@ public class TaskController extends BaseController {
//一线技术,一线业务只能看自己的
request.put("executorId", getUserId());
request.put("publisher", getUserId());
request.put("orgCode", orgCode);
} else {
//二线技术
......@@ -536,6 +537,7 @@ public class TaskController extends BaseController {
//一线技术,一线业务只能看自己的
request.put("executorId", getUserId());
request.put("publisher", getUserId());
request.put("orgCode", orgCode);
} else {
//二线技术
......@@ -676,7 +678,7 @@ public class TaskController extends BaseController {
// }
if (XJConstant.CCPC_PERSONAL.equals(roleTypeName)) {
return CommonResponseUtil.success(resp);
}
}
if (!ObjectUtils.isEmpty(reginParams.getDepartment())) {
params.put("departmentId", departmentId);
Map<String, Object> deptResp = taskService.getTaskForAppPie(params);
......
......@@ -5,9 +5,12 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.yeejoin.amos.component.feign.config.InnerInvokException;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import com.yeejoin.amos.feign.privilege.model.DepartmentModel;
import com.yeejoin.amos.feign.privilege.model.IdPasswordAuthModel;
//import com.yeejoin.amos.op.core.common.response.CommonResponse;
//import com.yeejoin.amos.op.core.util.CommonResponseUtil;
import com.yeejoin.amos.patrol.common.core.response.bo.CompanyBo;
......@@ -19,6 +22,7 @@ import com.yeejoin.amos.patrol.common.vo.DepartmentUserTreeWebVo;
import com.yeejoin.amos.patrol.service.business.param.AppLoginUserParam;
import com.yeejoin.amos.patrol.service.business.param.SelectUserInfo;
import com.yeejoin.amos.patrol.service.business.service.intfc.IAppService;
import com.yeejoin.amos.patrol.service.business.util.DesUtil;
import com.yeejoin.amos.patrol.service.business.vo.DepartmentUserTreeAppVo;
import com.yeejoin.amos.patrol.service.framework.ReginParams;
import com.yeejoin.amos.patrol.service.jpush.AppMessagePushService;
......@@ -31,6 +35,12 @@ import io.swagger.annotations.ApiParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
......@@ -40,6 +50,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.HashMap;
......@@ -68,9 +80,18 @@ public class UserController extends BaseController {
private IAppService iAppService;
@Autowired
private AppMessagePushService appMessagePushService;
@Autowired
private com.yeejoin.amos.patrol.service.remote.feign.PushFeign PushFeign;
private static final String appType = "APP";
@Value("${security.productApp}")
private String productApp;
@Value("${security.appKeyApp}")
private String appKeyApp;
@Autowired
private RestTemplate restTemplate;
@Value("${Security.fegin.name}")
private String SecurityName;
/**
* 根据部门id查询用户信息
*
......@@ -82,47 +103,11 @@ public class UserController extends BaseController {
public CommonResponse queryDeptUser(@RequestParam(value = "deptId", required = false) String deptId) {
List<AgencyUserModel> userModels = remoteSecurityService.listUserByDepartmentId(getToken(), getProduct(), getAppKey(), deptId);
List<LinkedHashMap<String, Object>> userList = paraseData(userModels, null);
// ServletRequestAttributes sra = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
// RequestContextHolder.setRequestAttributes(sra, true);
// if (ObjectUtils.isEmpty(deptId)) { // 部门ID为空时,获取所有人员信息
// return queryAllUser();
// } else { // 根据部门ID获取人员
// CountDownLatch latch = new CountDownLatch(1);
// DeptmentServer task = new DeptmentServer(amosSecurityServer, latch, deptId);
// try {
// task.start();
// latch.await();
// } catch (InterruptedException e) {
// log.error(e.getMessage());
// }
// List<LinkedHashMap<String, Object>> userList = null;
// List<LinkedHashMap<String, Object>> upsUsers = (List<LinkedHashMap<String, Object>>) task.getResponse()
// .getDataList();
// userList = paraseData(upsUsers);
//
// return CommonResponseUtil.success(userList);
// }
return CommonResponseUtil.success(userList);
}
// private LinkedHashMap<String, Object> parseData(List<UserModel> users) {
// LinkedHashMap<String, Object> user = new LinkedHashMap<String, Object>();
// user.put("id", map.get("id"));
// user.put("key", map.get("id"));
// user.put("value", map.get("id"));
// user.put("checked", false);
// user.put("state", "open");
// user.put("label", map.get("name"));
// user.put("label", map.get("name"));
// user.put("name", map.get("name"));
// user.put("desc", null);
// user.put("writeable", 0);
// user.put("userName", map.get("userName"));
// user.put("email", map.get("email"));
// user.put("mobile", map.get("mobile"));
// user.put("telephone", map.get("telephone"));
// return user;
// }
......@@ -131,12 +116,8 @@ public class UserController extends BaseController {
@RequestMapping(value = "/queryDeptUserTree1", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
public CommonResponse queryDeptUserTree1() {
ReginParams reginParams = getSelectedOrgInfo();
//List<CompanyModel> result = remoteSecurityService.listUserByCompanyId1(getToken(),getProduct(),getAppKey(),reginParams.getCompany().getSequenceNbr());
CompanyModel companyModel = remoteSecurityService.listUserByCompanyId1(getToken(), getProduct(), getAppKey(), reginParams.getCompany().getSequenceNbr());
// JSONArray children = result.getJSONArray("children");
//JSONArray children = result.getJSONArray("dataList");
CompanyModel companyModel = remoteSecurityService.listUserByCompanyId1(getToken(), getProduct(), getAppKey(), reginParams.getCompany().getSequenceNbr());
List children = (List) companyModel.getChildren();
......@@ -160,24 +141,10 @@ public class UserController extends BaseController {
if (childrens != null && childrens.size() > 0) {
buildUserDeptTreeForWebBefore(list, childrens);
}
// if ("department".equals(json.getString("type"))) {
// Map map = JSONObject.parseObject(json.getString("object"), Map.class);
// deptTreeWeb.setType("department");
// deptTreeWeb.setKey(map.get("sequenceNbr") + "");
// deptTreeWeb.setLabel(map.get("sequenceNbr") + "");
// deptTreeWeb.setTitle(map.get("departmentName") + "");
// deptTreeWeb.setValue(map.get("sequenceNbr") + "");
// JSONArray childrens = json.getJSONArray("children");
// if (childrens != null && childrens.size() > 0) {
// buildUserDeptTreeForWeb(deptTreeWeb.getChildren(), childrens);
// }
// list.add(deptTreeWeb);
// }
}
// if (children != null && children.size() > 0) {
// buildUserDeptTreeForWeb(list, children);
// }
list = buildUserDeptTreeForWeb(list);
......@@ -259,50 +226,6 @@ public class UserController extends BaseController {
return list;
}
// private void buildUserDeptTreeForWeb(List<DepartmentUserTreeWebVo> list, JSONArray children) {
// for (int i = 0; i < children.size(); i++) {
// JSONObject json = children.getJSONObject(i);
// if (json != null && json.size() > 0) {
// if (ObjectUtils.isEmpty(json.getString("children"))) {
// JSONArray userModelList = json.getJSONArray("userModelList");
// if (ObjectUtils.isEmpty(userModelList)){
// for (int j = 0; j < userModelList.size(); j++) {
// DepartmentUserTreeWebVo userTreeWeb = new DepartmentUserTreeWebVo();
//
// JSONObject userModel = userModelList.getJSONObject(j);
// Map map = JSONObject.parseObject(String.valueOf(userModel), Map.class);
//
// userTreeWeb.setType("user");
// userTreeWeb.setKey(map.get("userId").toString());
// userTreeWeb.setLabel(map.get("userName").toString());
// userTreeWeb.setTitle(map.get("realName").toString());
// userTreeWeb.setValue(map.get("userId").toString());
// list.add(userTreeWeb);
// }
// }
// } else {
//
// DepartmentUserTreeWebVo deptTreeWeb = new DepartmentUserTreeWebVo();
//
// Map map = JSONObject.parseObject(json.getString("object"), Map.class);
// deptTreeWeb.setType("department");
// deptTreeWeb.setKey(map.get("sequenceNbr").toString());
// deptTreeWeb.setLabel(map.get("sequenceNbr").toString());
// deptTreeWeb.setTitle(map.get("departmentName").toString());
// deptTreeWeb.setValue(map.get("sequenceNbr").toString());
//
// JSONArray childrens = json.getJSONArray("children");
// if (childrens != null && childrens.size() > 0) {
// buildUserDeptTreeForWeb(deptTreeWeb.getChildren(), childrens);
//
// }
// if ("0".equals(map.get("parentId"))) {
// list.add(deptTreeWeb);
// }
// }
// }
// }
// }
private void buildUserDeptTreeForWeb(List<DepartmentUserTreeWebVo> list, JSONArray children) {
for (int i = 0; i < children.size(); i++) {
......@@ -382,10 +305,7 @@ public class UserController extends BaseController {
private void buildUserDeptTreeForWeb2(List<DepartmentUserTreeWebVo> list, JSONArray children) {
for (int i = 0; i < children.size(); i++) {
JSONObject json = children.getJSONObject(i);
//JSONArray userModelList = json.getJSONArray("children");
if (json != null && json.size() > 0) {
// for (int j = 0; j < json.size(); j++) {
// JSONObject userJson = json.getJSONObject(j);
if ("user".equals(json.getString("type"))) {
DepartmentUserTreeWebVo userTreeWeb = new DepartmentUserTreeWebVo();
userTreeWeb.setType("user");
......@@ -419,30 +339,6 @@ public class UserController extends BaseController {
public CommonResponse queryAllUser() {
ReginParams reginParams = getSelectedOrgInfo();
String loginOrgCode = getLoginOrgCode(reginParams);
// else { // 当用户登录org和所进入的公司org不相同时,获取所属公司的所有人员和上级公司用户类型为ADMIN的人员
// String[] orgs = loginOrgCode.split("\\*");
// String owerOrg = orgs[orgs.length - 1];
// String reqOrg = orgs[orgs.length - 2];
// latch = new CountDownLatch(2);
// CompanyUserFeignServer task = new CompanyUserFeignServer(amosSecurityServer, latch, owerOrg, null);
// CompanyUserFeignServer upsTask = new CompanyUserFeignServer(amosSecurityServer, latch, reqOrg,
// XJConstant.ADMIN_ORG_CODE);
// task.start();
// upsTask.start();
//
// latch.await();
// arrRes.add(task.getResponse());
// arrRes.add(upsTask.getResponse());
// }
// List<LinkedHashMap<String, Object>> content = new ArrayList<>();
// for (CommonResponse res : arrRes) {
// if (ObjectUtils.isEmpty(res.getDataList())) {
// continue;
// }
// content.addAll((Collection<? extends LinkedHashMap<String, Object>>) res.getDataList());
// }
List<AgencyUserModel> userModels = remoteSecurityService.listUserByOrgCode(getToken(), getProduct(), getAppKey(), loginOrgCode);
List<LinkedHashMap<String, Object>> userList = paraseData(userModels, null);
return CommonResponseUtil.success(userList);
......@@ -487,45 +383,11 @@ public class UserController extends BaseController {
if (!ObjectUtils.isEmpty(list)) {
for (AgencyUserModel userModel : list) {
LinkedHashMap<String, Object> user = new LinkedHashMap<>();
// List<LinkedHashMap<String, Object>> children = (List<LinkedHashMap<String, Object>>) map
// .get("children");
// List<LinkedHashMap<String, Object>> tempChildren = new ArrayList<LinkedHashMap<String, Object>>();
// if (children != null && children.size() > 0) {
// children.forEach(action -> {
// tempChildren.add(paraseData(action));
// });
// }
// if (!ObjectUtils.isEmpty(tempChildren) || "department".equals(map.get("type"))) {
// if (!ObjectUtils.isEmpty(userNmae) && map.get("label").toString().indexOf(userNmae) != -1) {
// List<LinkedHashMap<String, Object>> temp = filterUser(tempChildren, userNmae);
// user.put("children", temp);
// user.put("type", "department");
// } else {
// user.put("children", tempChildren);
// user.put("type", "department");
// }
// } else {
// user.put("type", "user");
// if (!ObjectUtils.isEmpty(userNmae) && map.get("name").toString().indexOf(userNmae) == -1) {
// continue;
// }
// }
user.put("id", userModel.getUserId());
user.put("key", userModel.getUserId());
user.put("value", userModel.getUserId());
user.put("checked", false);
user.put("state", "open");
// if (ObjectUtils.isEmpty(map.get("label"))) {
// user.put("label", map.get("name"));
// } else {
// user.put("label", map.get("label"));
// }
// if (ObjectUtils.isEmpty(map.get("label"))) {
// user.put("title", map.get("name"));
// } else {
// user.put("title", map.get("label"));
// }
user.put("name", userModel.getRealName());
user.put("desc", null);
user.put("writeable", 0);
......@@ -533,54 +395,7 @@ public class UserController extends BaseController {
user.put("mobile", userModel.getMobile());
user.put("telephone", userModel.getLandlinePhone());
user.put("departmentName", "其他");
// if (map != null && map.get("children") != null) {
// List<LinkedHashMap<String, Object>> li = (List) map.get("children");
// if (li.size() > 0) {
// for (LinkedHashMap<String, Object> linkedHashMap : li) {
// String st = linkedHashMap.get("id").toString();
// String sstr = amosSecurityServer.queryUserById(Long.parseLong(st));//根据id获取用户详细信息
// if (!StringUtil.isNotEmpty(sstr)) {
// continue;
// }
// // 将String 转化为JSON类型
// JSONObject jasonObject = JSONObject.fromObject(sstr);
// Map userInfo = (Map) jasonObject;
// // 把查询的用户详细信息添加到部门用户树中
// if (userInfo != null) {
// if (ObjectUtils.isEmpty(userInfo.get("email")) || userInfo.get("email").toString().equals("null")) {
// linkedHashMap.put("email", null);
// } else {
// linkedHashMap.put("email", userInfo.get("email").toString());
// }
// if (userInfo.get("department") != null) {
// Map dept = (Map) userInfo.get("department");
// linkedHashMap.put("departmentName", dept.get("departmentName"));
// }
// if (ObjectUtils.isEmpty(userInfo.get("mobile")) || userInfo.get("mobile").toString().equals("null")) {
// linkedHashMap.put("mobile", ObjectUtils.isEmpty(userInfo.get("telephone")) ? userInfo.get("telephone").toString() : "");
// } else {
// linkedHashMap.put("mobile", userInfo.get("mobile").toString());
// }
//
// if (ObjectUtils.isEmpty(userInfo.get("telephone")) || userInfo.get("telephone").toString().equals("null")) {
// linkedHashMap.put("telephone", ObjectUtils.isEmpty(userInfo.get("mobile")) ? userInfo.get("mobile").toString() : "");
// } else {
// linkedHashMap.put("telephone", userInfo.get("telephone").toString());
// }
//
//
// }
//
//
// }
// }
//
// user.put("children", li);
// }
userList.add(user);
userList.add(user);
}
}
......@@ -601,155 +416,13 @@ public class UserController extends BaseController {
return userList;
}
// private LinkedHashMap<String, Object> paraseData(LinkedHashMap<String, Object> map) {
//
// LinkedHashMap<String, Object> user = new LinkedHashMap<>();
//
// user.put("id", map.get("id"));
// user.put("key", map.get("id"));
// user.put("value", map.get("id"));
// user.put("checked", false);
// user.put("state", "open");
// user.put("type", "user");
// user.put("label", map.get("label"));
// user.put("title", map.get("label"));
// user.put("name", map.get("name"));
// user.put("desc", null);
// user.put("writeable", 0);
// user.put("userName", map.get("userName"));
// user.put("mobile", map.get("mobile"));
// user.put("telephone", map.get("telephone"));
//
// String sstr = amosSecurityServer.queryUserById(Long.parseLong(map.get("id").toString()));
// if (StringUtil.isNotEmpty(sstr)) {
// JSONObject jasonObject = JSONObject.fromObject(sstr);
// Map userInfo = (Map) jasonObject;
// if (userInfo != null && userInfo.get("email") != null && !userInfo.get("email").toString().equals("null")) {
// user.put("email", userInfo.get("email").toString());
// } else {
// user.put("email", null);
// }
//
// user.put("departmentName", "其他");
// if (ObjectUtils.isEmpty(userInfo.get("mobile")) || userInfo.get("mobile").toString().equals("null")) {
// user.put("mobile", userInfo.get("userName"));
// } else {
// user.put("mobile", userInfo.get("mobile").toString());
// }
// if (ObjectUtils.isEmpty(userInfo.get("telephone")) || userInfo.get("telephone").toString().equals("null")) {
// user.put("telephone", userInfo.get("userName"));
// } else {
// user.put("telephone", userInfo.get("telephone").toString());
// }
// }
// return user;
// }
//
// private void CountDownLatch() {
// // TODO Auto-generated method stub
//
// }
// /**
// * 保存登陆用户选择公司信息
// *
// * @return
// */
// @ApiOperation(value = " 保存登陆用户选择公司信息", notes = " 保存登陆用户选择公司信息")
// @RequestMapping(value = "/save/curCompany/{orgCode}", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
// public CommonResponse getCompanysInfo(
// @ApiParam(value = "当前登陆用户所选单位信息", required = true) @PathVariable String orgCode) {
// LoginUserParam param = new LoginUserParam();
// User user = getUserInfo();
// param.setLoginOrgCode(orgCode);// 当前登陆用户所选单位信息
// param.setUserOrgCode(user.getOrgCode());// 登录用户的orgCode
// param.setRoleId(user.getRole().getId().toString());// 登录用户角色
// param.setRoleTypeName(user.getRole().getRoleTypeName());
// param.setUserId(user.getId());
// CurUserCompanyCache.getInstance().putCurCompanyMap(, param);
// return CommonResponseUtil.success();
// }
// /**
// * 新增用户
// *
// * @param userDTO
// * @return
// */
// @ApiOperation(value = "新增用户", notes = "新增用户")
// @RequestMapping(value = "/save", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
// @Authorization(ingore = true)
// public CommonResponse save(@ApiParam(value = "用户名", required = true) @RequestBody UserDTO userDTO) {
// try {
// userService.save(userDTO);
// return CommonResponseUtil.success();
// } catch (Exception e) {
// log.error(e.getMessage(), e);
// return CommonResponseUtil.failure("新增用户失败!");
// }
// }
//
// /**
// * 删除用户
// *
// * @param userDTO
// * @return
// */
// @ApiOperation(value = "删除用户", notes = "删除用户")
// @RequestMapping(value = "/delete", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
// @Authorization(ingore = true)
// public CommonResponse delete(@ApiParam(value = "用户", required = true) @RequestBody List<User> user) {
// try {
// userService.delete(user);
// return CommonResponseUtil.success();
// } catch (Exception e) {
// log.error(e.getMessage(), e);
// return CommonResponseUtil.failure("删除用户失败!");
// }
// }
//
// /**
// * 查询用户及公司信息
// *
// * @return
// */
// @ApiOperation(value = "查询用户及公司信息", notes = "查询用户及公司信息")
// @RequestMapping(value = "/queryLoginUserAndCompany", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
// public CommonResponse qryUserAndCompany() {
// LoginUserParam param = getLoginUserParam();
// if (ObjectUtils.isEmpty(param)) {
// return CommonResponseUtil.failure("用户未登录或用户session过期!");
// }
// try {
// UserCompanyVo userCompanyVo = userService.qryLoginUserAndCompany(param);
// return CommonResponseUtil.success(userCompanyVo);
// } catch (Exception e) {
// log.error(e.getMessage(), e);
// return CommonResponseUtil.failure("查询用户及公司信息失败!");
// }
// }
//
// /**
// * 用户消息订阅初始化(关注路线初始设置为空)
// *
// * @return
// */
// @ApiOperation(value = "用户消息订阅初始化", notes = "用户消息订阅初始化")
// @RequestMapping(value = "/initUserMsgSubscribe", produces = "application/json;charset=UTF-8", method = RequestMethod.PUT)
// public CommonResponse initUserMsgSubscribe() {
// try {
// userService.initUserMsgSubscribe();
// return CommonResponseUtil.success();
// } catch (Exception e) {
// return CommonResponseUtil.failure("用户消息订阅初始化失败");
// }
// }
//
@ApiOperation(value = "用户登录成功之后数据初始化(<font color='blue'>手机app</font>)", notes = "用户登录成功之后数据初始化")
@RequestMapping(value = "/initData", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
public CommonResponse initUserApp() {
try {
CommonResponse secResponse = remoteSecurityService.searchPermissionTree(getToken(), getProduct(), getAppKey(), appType);
ReginParams reginParams = getSelectedOrgInfo();
CommonResponse secResponse = remoteSecurityService.searchPermissionTree(Long.valueOf(reginParams.getRole().getSequenceNbr()),getToken(), getProduct(), getAppKey(), appType);
if (!secResponse.isSuccess()) {
return CommonResponseUtil.failure("权限获取失败");
}
......@@ -762,26 +435,7 @@ public class UserController extends BaseController {
return CommonResponseUtil.failure("数据初始化失败");
}
}
//
// /**
// * 递归调用获取list中的末端节点
// *
// * @param src
// * @return
// */
// private List<LinkedHashMap<String, Object>> getLeaves(List<LinkedHashMap<String, Object>> src) {
// List<LinkedHashMap<String, Object>> dest = new ArrayList<>();
// for (LinkedHashMap<String, Object> leaves : src) {
// if (ObjectUtils.isEmpty(leaves.get("children"))) {
// dest.add(leaves);
// } else {
// List<LinkedHashMap<String, Object>> list = getLeaves((List<LinkedHashMap<String, Object>>) leaves.get("children"));
// dest.addAll(list);
// }
//
// }
// return dest;
// }
///////////////////////////////2019-11-18安全服务升级///////////////////////////////
@ApiOperation(value = "通讯录", notes = "通讯录")
......@@ -794,9 +448,25 @@ public class UserController extends BaseController {
JSONArray arr = remoteSecurityService.listDepartmentUserTree(getToken(), getProduct(), getAppKey(), companyBo.getSequenceNbr());
DepartmentUserTreeAppVo departmentUserTreeDto = new DepartmentUserTreeAppVo();
if (arr != null && arr.size() > 0) {
buildUserDeptTree(departmentUserTreeDto, arr);
}
return CommonResponseUtil.success(departmentUserTreeDto.getChildren());
DepartmentUserTreeAppVo qi=new DepartmentUserTreeAppVo();
List<DepartmentUserTreeAppVo> list= departmentUserTreeDto.getChildren();
List<DepartmentUserTreeAppVo> listdate=new ArrayList<>();
for (DepartmentUserTreeAppVo departmentUserTreeAppVo : list) {
if("其他".equals(departmentUserTreeAppVo.getName())){
qi=departmentUserTreeAppVo;
qi.setId("-0");
qi.setType("dep");
}else{
listdate.add(departmentUserTreeAppVo);
}
}
if(qi!=null){
listdate.add(qi);
}
return CommonResponseUtil.success(listdate);
} catch (Exception e) {
logger.error("通讯录异常", e);
return CommonResponseUtil.failure("系统繁忙,请稍后再试");
......@@ -809,7 +479,9 @@ public class UserController extends BaseController {
DepartmentUserTreeAppVo treeDto = new DepartmentUserTreeAppVo();
treeDto.setName(json.getString("departmentName"));
treeDto.setId(json.getString("sequenceNbr"));
treeDto.setType(json.getString("level"));
treeDto.setType(json.getString("level"));
JSONArray childrens = json.getJSONArray("children");
if (childrens != null && childrens.size() > 0) {
buildUserDeptTree(treeDto, childrens);
......@@ -819,15 +491,7 @@ public class UserController extends BaseController {
UserDeptTree( treeDto, userModelList);
}
// if (json.getString("type").equals("user")) {
// JSONObject object = json.getJSONObject("object");
// Map<String, String> user = Maps.newHashMap();
// user.put("telephone", object.getString("mobile"));
// user.put("email", json.getString("email"));
// treeDto.setObject(user);
// }
deptUser.getChildren().add(treeDto);
}
}
......@@ -840,11 +504,9 @@ public class UserController extends BaseController {
for (int i = 0; i < childs.size(); i++) {
JSONObject json = childs.getJSONObject(i);
DepartmentUserTreeAppVo treeDto = new DepartmentUserTreeAppVo();
treeDto.setName(json.getString("userName"));
treeDto.setName(json.getString("realName"));
treeDto.setId(json.getString("userId"));
//treeDto.setType(json.getString("level"));
treeDto.setType("user");
// JSONObject object = json.getJSONObject("object");
Map<String, String> user = Maps.newHashMap();
user.put("telephone", json.getString("mobile"));
user.put("email", json.getString("email"));
......@@ -865,25 +527,61 @@ public class UserController extends BaseController {
@PostMapping(value = "/mobile/login")
//@Authorization(ingore = true)
public CommonResponse mobileLogin(@ApiParam(value = "账号", required = true) @RequestBody AppLoginUserParam param) {
try {
JSONObject jsonObject =null;
// jsonObject = remoteSecurityService.loginFromApp(param.getUserName(), param.getPassword());
IdPasswordAuthModel dPasswordAuthModel=new IdPasswordAuthModel();
dPasswordAuthModel.setLoginId(param.getUserName());
dPasswordAuthModel.setPassword(DesUtil.decode(param.getPassword(), "yeejoin"));
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
headers.set("Content-Type", "application/json");
headers.set("product", productApp);
HttpEntity httpEntity = new HttpEntity<>(dPasswordAuthModel, headers);
FeignClientResult feignClientResult = restTemplate.postForObject("http://"+SecurityName+"/privilege/v1/auth/idpassword",httpEntity, FeignClientResult.class);
if (feignClientResult.getStatus() ==200 ) {
Map map = (Map) feignClientResult.getResult();
map.put("appKey", appKeyApp);
map.put("product", productApp);
String jsonStr = JSON.toJSONString(map);
jsonObject = JSONObject.parseObject(jsonStr);
}else{
return CommonResponseUtil.failure(feignClientResult.getMessage());
}
if (jsonObject != null) {
JSONObject result = new JSONObject();
result.put("token", jsonObject.getString("token"));
result.put("userId", jsonObject.getString("userId"));
result.put("appKey", jsonObject.getString("appKey"));
result.put("product", jsonObject.getString("product"));
result.put("jpushUserKey", appMessagePushService.buildJpushUserKey(jsonObject.getString("userId")));
//删除别名关联设备
CommonResponse commonResponse=PushFeign.PushDevice(appMessagePushService.buildJpushUserKey(jsonObject.getString("userId")));
return CommonResponseUtil.success(result);
}
return CommonResponseUtil.failure("登录失败");
} catch (Exception e) {
e.printStackTrace();
logger.error("APP登录异常", e);
return CommonResponseUtil.failure("系统繁忙,请稍后再试");
}
}
@ApiOperation(value = "别名关联设备", notes = "别名关联设备")
@PostMapping(value = "/PushDeviceRegistration/{registrationId}/{alias}")
public CommonResponse pushDevice(@PathVariable String registrationId,@PathVariable String alias) {
try {
JSONObject jsonObject = remoteSecurityService.loginFromApp(param.getUserName(), param.getPassword());
if (jsonObject != null) {
JSONObject result = new JSONObject();
result.put("token", jsonObject.getString("token"));
result.put("userId", jsonObject.getString("userId"));
result.put("appKey", jsonObject.getString("appKey"));
result.put("product", jsonObject.getString("product"));
result.put("jpushUserKey", appMessagePushService.buildJpushUserKey(jsonObject.getString("userId")));
return CommonResponseUtil.success(result);
}
return CommonResponseUtil.failure("登录失败");
CommonResponse commonResponse=PushFeign.PushDeviceRegistration(registrationId,alias);
if("SUCCESS".equals(commonResponse.getResult())){
return CommonResponseUtil.success("成功");
}
return CommonResponseUtil.failure("失败");
} catch (Exception e) {
e.printStackTrace();
logger.error("APP登录异常", e);
return CommonResponseUtil.failure("系统繁忙,请稍后再试");
e.printStackTrace();
return CommonResponseUtil.failure("失败");
}
}
/**
* APP登出
*/
......@@ -914,34 +612,29 @@ public class UserController extends BaseController {
if (user != null) {
List<CompanyModel> list =user.getCompanys();
Map<Long, List<DepartmentModel>> mapDepartments= user.getCompanyDepartments();
Map<String, List<Map<String, Object>>> mapdate=new HashMap<String, List<Map<String, Object>>>();
Map<String, List<Map<String, Object>>> mapdate=new HashMap<String, List<Map<String, Object>>>();
List<Map> listCompanyModel =new ArrayList();
if(list!=null&&list.size()>0){
for (CompanyModel article : list) {
Map<String, Object> map= objectToMap(article);
map.put("companySeq", map.get("companySeq")+"");
map.put("parentId", map.get("parentId")+"");
listCompanyModel.add(map);
listCompanyModel.add(map);
long key= Long.valueOf( map.get("sequenceNbr").toString());
List<DepartmentModel> listdep=mapDepartments.get(key);
List<Map<String, Object>> dep =new ArrayList();
for (DepartmentModel departmentModel : listdep) {
for (DepartmentModel departmentModel : listdep) {
if(departmentModel!=null){
Map<String, Object> mapo= objectToMap(departmentModel);
mapo.put("sequenceNbr", mapo.get("sequenceNbr").toString());
dep.add(mapo);
}
}
}
}
mapdate.put(map.get("sequenceNbr").toString(), dep);
}
}
result.put("companys", listCompanyModel);
result.put("orgRoles", user.getOrgRoles());
result.put("orgRoles", user.getOrgRoles());
result.put("companyDepartments", mapdate);
return CommonResponseUtil.success(result);
}
......@@ -956,21 +649,15 @@ public class UserController extends BaseController {
@ApiOperation(value = "部门人员树查询", notes = "部门人员树查询")
@RequestMapping(value = "/queryDeptUserTree2", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
public CommonResponse queryDeptUserTree2() {
ReginParams reginParams = getSelectedOrgInfo();
CompanyModel companyModel = remoteSecurityService.listUserByCompanyId1(getToken(), getProduct(), getAppKey(), reginParams.getCompany().getSequenceNbr());
List children = (List) companyModel.getChildren();
List<DepartmentUserTreeWebVo> list = Lists.newArrayList();
for (int i = 0; i < children.size(); i++) {
Map<String, Object> map = (LinkedHashMap) children.get(i);
JSONObject json = JSON.parseObject(JSON.toJSONString(map));
DepartmentUserTreeWebVo deptTreeWeb = new DepartmentUserTreeWebVo();
JSONArray childrens = json.getJSONArray("children");
deptTreeWeb.setType("department");
deptTreeWeb.setKey(map.get("sequenceNbr").toString());
deptTreeWeb.setLabel(map.get("sequenceNbr").toString());
......@@ -983,15 +670,10 @@ public class UserController extends BaseController {
if (childrens != null && childrens.size() > 0) {
buildUserDeptTreeForWebBefore(list, childrens);
}
}
list = buildUserDeptTreeForWeb(list);
return CommonResponseUtil.success(list);
}
}
......@@ -1049,7 +731,7 @@ public class UserController extends BaseController {
result.put("userName", user.getUserName());
result.put("email", user.getEmail());
CommonResponse secResponse = remoteSecurityService.searchPermissionTree(toke,product,appKey,appType);
CommonResponse secResponse = remoteSecurityService.searchPermissionTree(Long.valueOf(selectUserInfo.getRoleModel().getSequenceNbr()),toke,product,appKey,appType);
if (secResponse.isSuccess() && secResponse.getDataList() != null) {
JSONArray arr = JSON.parseArray(JSONArray.toJSONString(secResponse.getDataList()));
Map<String, JSONObject> map = Maps.newHashMap();
......@@ -1083,17 +765,43 @@ public class UserController extends BaseController {
@PostMapping(value = "editPassword")
public CommonResponse editPassword(@ApiParam(value = "旧密码", required = true) @RequestParam String password,
@ApiParam(value = "新密码", required = true) @RequestParam String newPassword) {
try {
AgencyUserModel userModel = getUserInfo();
if (remoteSecurityService.editPassword(getToken(), getProduct(), getAppKey(), userModel.getUserId(), password, newPassword)) {
return CommonResponseUtil.success();
} else {
return CommonResponseUtil.failure("修改密码失败");
}
} catch (Exception e) {
logger.error("修改密码异常", e);
return CommonResponseUtil.failure(e.getMessage());
}
AgencyUserModel userModel = getUserInfo();
boolean flag=false;
if(password.equals(newPassword)){
return CommonResponseUtil.failure("新密码不能跟旧密码相同!");
}
try {
//flag=remoteSecurityService.editPassword(getToken(), getProduct(), getAppKey(), userModel.getUserId(), password, newPassword);
AgencyUserModel agencyUserModel=new AgencyUserModel();
agencyUserModel.setPassword(newPassword);
agencyUserModel.setRePassword(newPassword);
agencyUserModel.setOriginalPassword(password);
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
headers.set("Content-Type", "application/json");
headers.set("product", getProduct());
headers.set("token", getToken());
headers.set("appKey", getAppKey());
HttpEntity httpEntity = new HttpEntity<>(agencyUserModel, headers);
ResponseEntity<FeignClientResult> feignClientResult = restTemplate.exchange("http://"+SecurityName+"/privilege/v1/agencyuser/"+userModel.getUserId()+"/password", HttpMethod.PUT,httpEntity, FeignClientResult.class);
if (feignClientResult.getBody().getStatus() ==200 ) {
CommonResponse dates =CommonResponseUtil.success();
dates.setMessage("修改成功!");
return dates;
}else{
return CommonResponseUtil.failure(feignClientResult.getBody().getMessage());
}
} catch (Exception e) {
logger.error("修改密码异常", e);
return CommonResponseUtil.failure(e.getMessage());
}
}
......
......@@ -9,13 +9,13 @@ import java.util.List;
@Repository("inputItemDao")
public interface IInputItemDao extends BaseDao<InputItem, Long> {
@Query(value = "select * from p_input_item where org_code = ?1 and level = ?2 and is_delete =0", nativeQuery = true)
@Query(value = "select * from p_input_item where org_code LIKE CONCAT( ?1,'%') and level = ?2 and is_delete =0", nativeQuery = true)
public List<InputItem> findByLevel(String orgCode, String level);
@Query(value = "select * from p_input_item where org_code = ?1 and level is null and is_delete =0", nativeQuery = true)
@Query(value = "select * from p_input_item where org_code LIKE CONCAT( ?1,'%') and level is null and is_delete =0", nativeQuery = true)
public List<InputItem> findByLevelNull(String orgCodel);
@Query(value = "select * from p_input_item where org_code = ?1 and is_delete =0", nativeQuery = true)
@Query(value = "select * from p_input_item where org_code LIKE CONCAT( ?1,'%') and is_delete =0", nativeQuery = true)
public List<InputItem> findAllByLevel(String orgCode);
InputItem findByOriginalId(String originalId);
......
......@@ -25,4 +25,6 @@ public interface IPointDao extends BaseDao<Point, Long> {
@Query(value = "select * from p_point where original_id in ?1 and is_delete =0", nativeQuery = true)
List<Point> listByOriginalIds(List<String> originalIds);
@Query(value = "SELECT * FROM p_point p WHERE is_delete = 0 AND p.point_no = (?1) AND p.org_code like CONCAT(?2,'%')", nativeQuery = true)
Point findByOrgCodeAndPointNo(String pointNo, String orgCode);
}
......@@ -82,7 +82,7 @@ public class AppServiceImpl implements IAppService {
|| type.equals(MsgSubscribeTypeEnum.计划漏检推送)) {
msgSub.setAttribute1("False");
msgSub.setAttribute2("10");
} else if (type.equals(MsgSubscribeTypeEnum.不合格记录推送)) {
} else if (type.equals(MsgSubscribeTypeEnum.异常记录推送)) {
msgSub.setAttribute1("True");
} else {
msgSub.setAttribute1("False");
......
......@@ -152,9 +152,7 @@ public class CatalogTreeServiceImpl implements ICatalogTreeService {
userIds = String.join(",", list1);
List<AgencyUserModel> listd = remoteSecurityService.listUserByUserIds(toke, product, appKey, userIds);
//新安全
content.forEach(s -> {
......@@ -171,9 +169,6 @@ public class CatalogTreeServiceImpl implements ICatalogTreeService {
if (s.get("createBy").toString().equals(s1.getUserId())) {
s.put("createName", s1.getUserName());
}
});
}
});
......
......@@ -59,6 +59,7 @@ import com.yeejoin.amos.patrol.service.business.util.CheckDetailInputPageParam;
import com.yeejoin.amos.patrol.service.business.vo.CheckAnalysisVo;
import com.yeejoin.amos.patrol.service.business.vo.CheckInfoVo;
import com.yeejoin.amos.patrol.service.constants.XJConstant;
import com.yeejoin.amos.patrol.service.core.async.AsyncTask;
import com.yeejoin.amos.patrol.service.core.util.DateUtil;
import com.yeejoin.amos.patrol.service.core.util.StringUtil;
import com.yeejoin.amos.patrol.service.remote.RemoteSecurityService;
......@@ -89,6 +90,8 @@ import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import static com.yeejoin.amos.patrol.service.constants.XJConstant.*;
@Service("checkService")
public class CheckServiceImpl implements ICheckService {
......@@ -125,11 +128,14 @@ public class CheckServiceImpl implements ICheckService {
@Autowired
private IPointClassifyDao iPointClassifyDao;
@Autowired
private AsyncTask asyncTask;
@Value("${upload.server.address}")
private String uploadAddress;
@Override
public Page<CheckInfoVo> getCheckInfo(String toke,String product,String appKey,CheckInfoPageParam param) {
public Page<CheckInfoVo> getCheckInfo(String toke, String product, String appKey, CheckInfoPageParam param) {
long total = checkMapper.countCheckInfoData(param);
List<CheckInfoVo> content = Lists.newArrayList();
if (total == 0) {
......@@ -142,26 +148,26 @@ public class CheckServiceImpl implements ICheckService {
Set<String> deptIds = Sets.newHashSet(Lists.transform(content, CheckInfoVo::getDepId));
deptIds.remove("");
deptIds.remove(null);
List<AgencyUserModel> userModels = remoteSecurityService.listUserByUserIds( toke, product, appKey,Joiner.on(",").join(userIds));
Map<String, String> deptMap = new HashMap<String,String>();
if(!CollectionUtils.isEmpty(deptIds)){
List<LinkedHashMap> deptList = remoteSecurityService.listDepartmentByDeptIds( toke, product, appKey,Joiner.on(",").join(deptIds));
List<AgencyUserModel> userModels = remoteSecurityService.listUserByUserIds(toke, product, appKey, Joiner.on(",").join(userIds));
Map<String, String> deptMap = new HashMap<String, String>();
if (!CollectionUtils.isEmpty(deptIds)) {
List<LinkedHashMap> deptList = remoteSecurityService.listDepartmentByDeptIds(toke, product, appKey, Joiner.on(",").join(deptIds));
//deptMap = deptList.stream().collect(Collectors.toMap(DepartmentModel::getSequenceNbr, DepartmentModel::getDepartmentName));
for (int i = 0; i < deptList.size(); i++) {
deptMap.put(deptList.get(i).get("sequenceNbr").toString(), deptList.get(i).get("departmentName").toString());
}
deptMap.put(deptList.get(i).get("sequenceNbr").toString(), deptList.get(i).get("departmentName").toString());
}
}
Map<String,String> userModelMap = userModels.stream().collect(Collectors.toMap(AgencyUserModel::getUserId,AgencyUserModel::getRealName ,(k1,k2)->k2));
Map<String, String> deptMapNew= deptMap;
Map<String, String> userModelMap = userModels.stream().collect(Collectors.toMap(AgencyUserModel::getUserId, AgencyUserModel::getRealName, (k1, k2) -> k2));
Map<String, String> deptMapNew = deptMap;
List<String> userNames = new ArrayList<>();
content.forEach(e -> {
userNames.clear();
List<String> userIds1 = Arrays.asList(e.getUserId().split(","));
for(String userId : userIds1){
for (String userId : userIds1) {
userNames.add(userModelMap.get(userId));
}
userNames.remove(null);
......@@ -191,7 +197,7 @@ public class CheckServiceImpl implements ICheckService {
if (!ObjectUtils.isEmpty(requestParam) && !ObjectUtils.isEmpty(requestParam.getPlanTaskId()) && requestParam.getPlanTaskId() > 0) {
detail = planTaskDetailMapper.findPlanTaskByTaskIdAndPointId(requestParam.getPlanTaskId(), requestParam.getPointId());
if (!ObjectUtils.isEmpty(detail)) {
planTask = planTaskDao.findById(requestParam.getPlanTaskId()).get();;
planTask = planTaskDao.findById(requestParam.getPlanTaskId()).get();
// routeParam.put("routeId", planTask.getRouteId());
// routeParam.put("pointId", requestParam.getPointId());
check.setPlanTaskDetailId(Long.parseLong(detail.get("planTaskDetailId").toString()));
......@@ -243,11 +249,16 @@ public class CheckServiceImpl implements ICheckService {
List<Map<String, Object>> unqualifiedcheckItemList = Lists.newArrayList();
String error = "";
HashMap<String, String> errorClassifyNames = new HashMap<>();
boolean isPushFlag = false;
for (CheckInputParam item : list) {
String pointClassifyName = null;
if (StringUtil.isNotEmpty(item.getClassifyIds()) && iPointClassifyDao.existsById(item.getClassifyIds())) {
PointClassify pointClassify = iPointClassifyDao.findById(item.getClassifyIds()).get();
pointClassifyName = pointClassify.getName();
if (!ObjectUtils.isEmpty(pointClassifyName) && (pointClassifyName.contains(INPUT_ITEM_DEXT) || pointClassifyName.contains(INPUT_ITEM_XEXT) ||
pointClassifyName.contains(INPUT_ITEM_WYXT) || pointClassifyName.contains(INPUT_ITEM_JWXT))) {
isPushFlag = true;
}
}
InputItem inputItem = inputItemDao.findById(item.getInputItemId()).get();
CheckInput checkInput = new CheckInput();
......@@ -268,17 +279,17 @@ public class CheckServiceImpl implements ICheckService {
String classifyName = pointClassifyName != null ? pointClassifyName + "-" : "";
error += (classifyName + inputItem.getName() + "=" + (ObjectUtils.isEmpty(item.getInputValue()) ? "" : item.getInputValue()) + ";");
errorClassifyNames.put(pointClassifyName != null ? pointClassifyName : "", "");
// checkInput.setIsOk(CheckStatusEnum.UNQUALIFIED.getCode());
// Map<String, Object> unCheckMap = Maps.newHashMap();
// unCheckMap.put("itemId", item.getInputItemId());
// unCheckMap.put("routeId", check.getRouteId());
// unCheckMap.put("pointId", requestParam.getPointId());
// unCheckMap.put("name", inputItem.getName());
// unCheckMap.put("inputValue", item.getInputValue());
// unCheckMap.put("routePointItemId", item.getRoutePointItemId());
// unqualifiedcheckItemList.add(unCheckMap);
checkInput.setIsOk(CheckStatusEnum.UNQUALIFIED.getCode());
Map<String, Object> unCheckMap = Maps.newHashMap();
unCheckMap.put("itemId", item.getInputItemId());
unCheckMap.put("routeId", check.getRouteId());
unCheckMap.put("pointId", requestParam.getPointId());
unCheckMap.put("name", inputItem.getName());
unCheckMap.put("inputValue", item.getInputValue());
unCheckMap.put("routePointItemId", item.getRoutePointItemId());
unqualifiedcheckItemList.add(unCheckMap);
// checkInput.setIsOk(CheckStatusEnum.UNQUALIFIED.getCode());
} else {
checkInput.setIsOk(CheckStatusEnum.QUALIFIED.getCode());
}
......@@ -298,6 +309,9 @@ public class CheckServiceImpl implements ICheckService {
checkInput.setPointClassifyName(pointClassifyName);
checkItemList.add(checkInput);
}
if (isPushFlag){
asyncTask.pushChartResulPaytask();//更新支付业务刷新标识
}
if (!ObjectUtils.isEmpty(error) && error.endsWith(";")) {
error.substring(0, error.length() - 1);
check.setIsOk(CheckStatusEnum.UNQUALIFIED.getCode());
......@@ -338,7 +352,7 @@ public class CheckServiceImpl implements ICheckService {
public void delCheckById(List<Long> list) {
for (Long id : list) {
//checkDao.delete(id);
checkDao.deleteById(id);
checkDao.deleteById(id);
}
}
......@@ -456,7 +470,7 @@ public class CheckServiceImpl implements ICheckService {
}
@Override
public AppPointCheckRespone queryCheckPointDetail(String toke,String product,String appKey,long checkId) {
public AppPointCheckRespone queryCheckPointDetail(String toke, String product, String appKey, long checkId) {
// List list = checkMapper.queryCheckPointInputItem(planTaskId, pointId);
List<PointCheckDetailBo> list = checkMapper.findCheckPointInputItem(checkId);
AppPointCheckRespone pointCheckRespone = new AppPointCheckRespone();
......@@ -476,16 +490,16 @@ public class CheckServiceImpl implements ICheckService {
pointCheckRespone.setPointNo(pointCheckDetailBo.getPointNo());
pointCheckRespone.setPointStatus(pointCheckDetailBo.getPointStatus());
pointCheckRespone.setPlanName(pointCheckDetailBo.getPlanName());
DepartmentModel departmentBo = remoteSecurityService.getDepartmentByDeptId(toke, product, appKey,pointCheckDetailBo.getCheckDepartmentId());
DepartmentModel departmentBo = remoteSecurityService.getDepartmentByDeptId(toke, product, appKey, pointCheckDetailBo.getCheckDepartmentId());
if (departmentBo != null) {
pointCheckRespone.setDepartmentName(departmentBo.getDepartmentName());
}
List<String> userIds = Arrays.asList(pointCheckDetailBo.getUserId().split(","));
List<AgencyUserModel> userModelList = remoteSecurityService.listUserByUserIds(toke, product, appKey,pointCheckDetailBo.getUserId());
Map<String,String> userModelMap = userModelList.stream().collect(Collectors.toMap(AgencyUserModel::getUserId, AgencyUserModel::getRealName,(k1,k2)->k2));
List<AgencyUserModel> userModelList = remoteSecurityService.listUserByUserIds(toke, product, appKey, pointCheckDetailBo.getUserId());
Map<String, String> userModelMap = userModelList.stream().collect(Collectors.toMap(AgencyUserModel::getUserId, AgencyUserModel::getRealName, (k1, k2) -> k2));
if (userModelMap != null) {
List<String> userNameList = new ArrayList<>();
for(String userId : userIds){
for (String userId : userIds) {
userNameList.add(userModelMap.get(userId));
}
userNameList.remove("");
......@@ -503,10 +517,10 @@ public class CheckServiceImpl implements ICheckService {
list.forEach(action -> {
List<String> pointInputImgUrls = new ArrayList<>();
//List<CheckShot> pointInputShot = checkShotDao.findAllByCheckIdAndCheckInputId(pointCheckDetailBo.getCheckId(), action.getCheckInputId());
List<CheckShot> pointInputShot = checkShotDao.findAllByCheckIdAndCheckInputIdAndClassifyId(pointCheckDetailBo.getCheckId(), action.getCheckInputId(), action.getClassifyId());
pointInputShot.forEach(inputShot -> {
pointInputImgUrls.add(uploadAddress + inputShot.getPhotoData());
});
......@@ -639,28 +653,28 @@ public class CheckServiceImpl implements ICheckService {
}
@Override
public List<CheckInfoVo> getCheckInfoList(String toke,String product,String appKey,CheckInfoPageParam param) {
List<CheckInfoVo> list= checkMapper.getCheckInfo(param);
public List<CheckInfoVo> getCheckInfoList(String toke, String product, String appKey, CheckInfoPageParam param) {
List<CheckInfoVo> list = checkMapper.getCheckInfo(param);
Set<String> userIds = Sets.newHashSet(Lists.transform(list, CheckInfoVo::getUserId));
Set<String> deptIds = Sets.newHashSet(Lists.transform(list, CheckInfoVo::getDepId));
deptIds.remove("");
deptIds.remove(null);
List<AgencyUserModel> userModels = remoteSecurityService.listUserByUserIds( toke, product, appKey,Joiner.on(",").join(userIds));
Map<String, String> deptMap = new HashMap<String,String>();
if(!CollectionUtils.isEmpty(deptIds)){
List<LinkedHashMap> deptList = remoteSecurityService.listDepartmentByDeptIds( toke, product, appKey,Joiner.on(",").join(deptIds));
// deptMap = deptList.stream().collect(Collectors.toMap(DepartmentModel::getSequenceNbr, DepartmentModel::getDepartmentName));
List<AgencyUserModel> userModels = remoteSecurityService.listUserByUserIds(toke, product, appKey, Joiner.on(",").join(userIds));
Map<String, String> deptMap = new HashMap<String, String>();
if (!CollectionUtils.isEmpty(deptIds)) {
List<LinkedHashMap> deptList = remoteSecurityService.listDepartmentByDeptIds(toke, product, appKey, Joiner.on(",").join(deptIds));
// deptMap = deptList.stream().collect(Collectors.toMap(DepartmentModel::getSequenceNbr, DepartmentModel::getDepartmentName));
for (int i = 0; i < deptList.size(); i++) {
deptMap.put(deptList.get(i).get("sequenceNbr").toString(), deptList.get(i).get("departmentName").toString());
}
deptMap.put(deptList.get(i).get("sequenceNbr").toString(), deptList.get(i).get("departmentName").toString());
}
}
Map<String,String> userModelMap = userModels.stream().collect(Collectors.toMap(AgencyUserModel::getUserId,AgencyUserModel::getRealName ,(k1,k2)->k2));
Map<String, String> deptMapNew= deptMap;
Map<String, String> userModelMap = userModels.stream().collect(Collectors.toMap(AgencyUserModel::getUserId, AgencyUserModel::getRealName, (k1, k2) -> k2));
Map<String, String> deptMapNew = deptMap;
List<String> userNames = new ArrayList<>();
list.forEach(e -> {
userNames.clear();
List<String> userIds1 = Arrays.asList(e.getUserId().split(","));
for(String userId : userIds1){
for (String userId : userIds1) {
userNames.add(userModelMap.get(userId));
}
userNames.remove(null);
......@@ -681,28 +695,28 @@ public class CheckServiceImpl implements ICheckService {
}
@Override
public List<CheckInfoVo> getSelectedCheckInfoList(String toke,String product,String appKey,Long[] ids) {
public List<CheckInfoVo> getSelectedCheckInfoList(String toke, String product, String appKey, Long[] ids) {
List<CheckInfoVo> list = checkMapper.getSelectedCheckInfoList(ids);
Set<String> userIds = Sets.newHashSet(Lists.transform(list, CheckInfoVo::getUserId));
Set<String> deptIds = Sets.newHashSet(Lists.transform(list, CheckInfoVo::getDepId));
deptIds.remove("");
deptIds.remove(null);
List<AgencyUserModel> userModels = remoteSecurityService.listUserByUserIds( toke, product, appKey,Joiner.on(",").join(userIds));
Map<String, String> deptMap = new HashMap<String,String>();
if(!CollectionUtils.isEmpty(deptIds)){
List<LinkedHashMap> deptList = remoteSecurityService.listDepartmentByDeptIds( toke, product, appKey,Joiner.on(",").join(deptIds));
List<AgencyUserModel> userModels = remoteSecurityService.listUserByUserIds(toke, product, appKey, Joiner.on(",").join(userIds));
Map<String, String> deptMap = new HashMap<String, String>();
if (!CollectionUtils.isEmpty(deptIds)) {
List<LinkedHashMap> deptList = remoteSecurityService.listDepartmentByDeptIds(toke, product, appKey, Joiner.on(",").join(deptIds));
//deptMap = deptList.stream().collect(Collectors.toMap(DepartmentModel::getSequenceNbr, DepartmentModel::getDepartmentName));
for (int i = 0; i < deptList.size(); i++) {
deptMap.put(deptList.get(i).get("sequenceNbr").toString(), deptList.get(i).get("departmentName").toString());
}
deptMap.put(deptList.get(i).get("sequenceNbr").toString(), deptList.get(i).get("departmentName").toString());
}
}
Map<String,String> userModelMap = userModels.stream().collect(Collectors.toMap(AgencyUserModel::getUserId,AgencyUserModel::getRealName ,(k1,k2)->k2));
Map<String, String> deptMapNew= deptMap;
Map<String, String> userModelMap = userModels.stream().collect(Collectors.toMap(AgencyUserModel::getUserId, AgencyUserModel::getRealName, (k1, k2) -> k2));
Map<String, String> deptMapNew = deptMap;
List<String> userNames = new ArrayList<>();
list.forEach(e -> {
userNames.clear();
List<String> userIds1 = Arrays.asList(e.getUserId().split(","));
for(String userId : userIds1){
for (String userId : userIds1) {
userNames.add(userModelMap.get(userId));
}
userNames.remove(null);
......@@ -736,13 +750,13 @@ public class CheckServiceImpl implements ICheckService {
@SuppressWarnings("unchecked")
@Override
public QueryCriteriaRespone getQueryCriteriaInit(String toke,String product,String appKey,String loginOrgCode, String roleTypeName, String departmentId, String companyId) {
public QueryCriteriaRespone getQueryCriteriaInit(String toke, String product, String appKey, String loginOrgCode, String roleTypeName, String departmentId, String companyId) {
QueryCriteriaRespone pointQueryCriteriaRespone = new QueryCriteriaRespone();
if (XJConstant.ROLE_NAME_SUPERADMIN.equals(roleTypeName.toUpperCase()) || XJConstant.ROLE_NAME_ADMIN.equals(roleTypeName.toUpperCase())) {
List<DepartmentModel> departmentBos = remoteSecurityService.listDepartmentsByCompanyId(toke, product, appKey,companyId);
List<DepartmentModel> departmentBos = remoteSecurityService.listDepartmentsByCompanyId(toke, product, appKey, companyId);
pointQueryCriteriaRespone.setDepartments(departmentBos);//公司下部门
} else if (XJConstant.ROLE_NAME_DEPTADMIN.equals(roleTypeName.toUpperCase())) {
DepartmentModel departmentBo = remoteSecurityService.getDepartmentByDeptId( toke, product, appKey,departmentId);
DepartmentModel departmentBo = remoteSecurityService.getDepartmentByDeptId(toke, product, appKey, departmentId);
pointQueryCriteriaRespone.setDepartments(Lists.newArrayList(departmentBo));//本公司
} else if (XJConstant.ROLE_NAME_PERSON.equals(roleTypeName.toUpperCase())) {//个人不返回
return null;
......@@ -816,10 +830,10 @@ public class CheckServiceImpl implements ICheckService {
}
@Override
public QueryCriteriaRespone findCheckSystemInit(String toke,String product,String appKey,String type, String orgCode, String roleTypeName, String departmentId, String companyId) {
public QueryCriteriaRespone findCheckSystemInit(String toke, String product, String appKey, String type, String orgCode, String roleTypeName, String departmentId, String companyId) {
QueryCriteriaRespone pointQueryCriteriaRespone = new QueryCriteriaRespone();
if ("user".equals(type)) {
List<AgencyUserModel> users = remoteSecurityService.listUserByCompanyId(toke, product, appKey,companyId);
List<AgencyUserModel> users = remoteSecurityService.listUserByCompanyId(toke, product, appKey, companyId);
pointQueryCriteriaRespone.setUsers(users);
} else if ("status".equals(type)) {
pointQueryCriteriaRespone.setStatus(PointStatusEnum.getEnumList());
......@@ -831,10 +845,10 @@ public class CheckServiceImpl implements ICheckService {
// pointQueryCriteriaRespone.setDepartments(iUserService.getGroupListByUser(user));
if (XJConstant.ROLE_NAME_SUPERADMIN.equals(roleTypeName.toUpperCase())
|| XJConstant.ROLE_NAME_ADMIN.equals(roleTypeName.toUpperCase())) {
List<DepartmentModel> departmentBoList = remoteSecurityService.listDepartmentsByCompanyId(toke, product, appKey,companyId);
List<DepartmentModel> departmentBoList = remoteSecurityService.listDepartmentsByCompanyId(toke, product, appKey, companyId);
pointQueryCriteriaRespone.setDepartments(departmentBoList);// 公司下部门
} else if (XJConstant.ROLE_NAME_DEPTADMIN.equals(roleTypeName.toUpperCase())) {
DepartmentModel departmentBo = remoteSecurityService.getDepartmentByDeptId(toke, product, appKey,departmentId);
DepartmentModel departmentBo = remoteSecurityService.getDepartmentByDeptId(toke, product, appKey, departmentId);
pointQueryCriteriaRespone.setDepartments(Lists.newArrayList(departmentBo));// 本公司
} else if (XJConstant.ROLE_NAME_PERSON.equals(roleTypeName.toUpperCase())) {// 个人不返回
return null;
......@@ -1120,10 +1134,10 @@ public class CheckServiceImpl implements ICheckService {
return checkMapper.getLivePhotos(checkID);
}
@Override
public List<String> getCheckPhotosByCheckAndInputIdAndClassifyId(int checkId, int checkInputId, int classifyId) {
return checkMapper.getCheckPhotosByCheckAndInputIdAndClassifyId(checkId, checkInputId,classifyId);
}
@Override
public List<String> getCheckPhotosByCheckAndInputIdAndClassifyId(int checkId, int checkInputId, int classifyId) {
return checkMapper.getCheckPhotosByCheckAndInputIdAndClassifyId(checkId, checkInputId, classifyId);
}
}
package com.yeejoin.amos.patrol.service.business.service.impl;
import com.alibaba.fastjson.JSON;
import com.google.common.base.Joiner;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
//import com.yeejoin.amos.op.core.util.StringUtil;
import com.yeejoin.amos.patrol.common.entity.Msg;
import com.yeejoin.amos.patrol.common.entity.PlanTask;
import com.yeejoin.amos.patrol.common.entity.StringUtil;
import com.yeejoin.amos.patrol.common.entity.Task;
import com.yeejoin.amos.patrol.common.entity.UserModel;
import com.yeejoin.amos.patrol.common.enums.CheckEmailEnum;
import com.yeejoin.amos.patrol.common.enums.CheckStatusEnum;
import com.yeejoin.amos.patrol.common.enums.JPushTypeEnum;
import com.yeejoin.amos.patrol.common.enums.MsgSubscribeTypeEnum;
import com.yeejoin.amos.patrol.common.enums.PlanTaskDetailIsFinishEnum;
import com.yeejoin.amos.patrol.common.enums.PlanTaskFinishStatusEnum;
import com.yeejoin.amos.patrol.common.enums.*;
import com.yeejoin.amos.patrol.service.business.bo.patrol.CheckMsgBo;
import com.yeejoin.amos.patrol.service.business.bo.patrol.PushTargetBo;
import com.yeejoin.amos.patrol.service.business.bo.patrol.TaskMsgBo;
import com.yeejoin.amos.patrol.service.business.dao.mapper.MsgMapper;
import com.yeejoin.amos.patrol.service.business.dao.repository.IMsgDao;
import com.yeejoin.amos.patrol.service.business.dao.repository.IPlanTaskDetailDao;
import com.yeejoin.amos.patrol.service.business.param.CatalogTreePageParam;
import com.yeejoin.amos.patrol.service.business.param.MsgInfoPageParam;
import com.yeejoin.amos.patrol.service.business.param.NoticePublishParam;
import com.yeejoin.amos.patrol.service.business.param.PushMsgParam;
......@@ -30,7 +23,6 @@ import com.yeejoin.amos.patrol.service.constants.XJConstant;
import com.yeejoin.amos.patrol.service.email.IEmailService;
import com.yeejoin.amos.patrol.service.jpush.AppMessagePushService;
import com.yeejoin.amos.patrol.service.remote.RemoteSecurityService;
//import com.yeejoin.amos.security.common.model.UserModel;
import org.assertj.core.util.Lists;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -41,16 +33,13 @@ import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import javax.transaction.Transactional;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
//import com.yeejoin.amos.op.core.util.StringUtil;
//import com.yeejoin.amos.security.common.model.UserModel;
/**
* 消息推送
......@@ -200,8 +189,8 @@ public class MessageServiceImpl implements IMessageService {
// msg.setCreateDate(new Date());
// msg.setSendTime(new Date());
// msg.setStatus(1);
msg.setTitle(typeEnum.getTitle());
msg.setBody(checkMsgBo.getSaveMsg());
msg.setMsgType(typeEnum.getMsgType());
......@@ -221,7 +210,7 @@ public class MessageServiceImpl implements IMessageService {
private MsgSubscribeTypeEnum getAppPushConfig(String checkStatus) {
if (CheckStatusEnum.UNQUALIFIED.getCode().equals(checkStatus)) {
return MsgSubscribeTypeEnum.不合格记录推送;
return MsgSubscribeTypeEnum.异常记录推送;
} else if (CheckStatusEnum.OMISSION.getCode().equals(checkStatus)) {
return MsgSubscribeTypeEnum.有漏检推送;
} else {
......@@ -241,17 +230,17 @@ public class MessageServiceImpl implements IMessageService {
}
@Override
public void pushTaskMessage(String toke,String product,String appKey,Task task) {
public void pushTaskMessage(String toke, String product, String appKey, Task task) {
//您好,您有一条名称为:my任务名称 内容为:my任务名称 说明 的任务单。要求完成时间为:2019-03-23 00:00:01 请您及时处理!任务下发人:18192060895
TaskMsgBo taskMsgBo = msgMapper.getTaskMsgBos(task.getId());
pushMsgAndSaveMsg( toke, product, appKey,taskMsgBo, MsgSubscribeTypeEnum.计划开始后推送.getTitle(), MsgSubscribeTypeEnum.计划开始后推送.getMsgType(), true);
pushMsgAndSaveMsg(toke, product, appKey, taskMsgBo, MsgSubscribeTypeEnum.计划开始后推送.getTitle(), MsgSubscribeTypeEnum.计划开始后推送.getMsgType(), true);
}
@Override
public Msg pushMsg(Msg msg) {
List<PushMsgParam> pmps = new ArrayList<>();
PushMsgParam pushMsg = new PushMsgParam();
pushMsg.setRecivers(Lists.newArrayList(msg.getUserId()));
pushMsg.setRecivers(Lists.newArrayList(msg.getUserId()));
//pushMsg.setRecivers(Arrays.asList(msg.getTargetTel()));
pushMsg.setContent(ObjectUtils.isEmpty(msg.getPushBody()) ? msg.getBody() : msg.getPushBody());
pushMsg.setSubject(msg.getTitle());
......@@ -267,11 +256,12 @@ public class MessageServiceImpl implements IMessageService {
iMsgDao.save(msg);
return msg;
}
@Override
public Msg pushMsg1(Msg msg) {
List<PushMsgParam> pmps = new ArrayList<>();
PushMsgParam pushMsg = new PushMsgParam();
pushMsg.setRecivers(Lists.newArrayList(msg.getUserId()));
pushMsg.setRecivers(Lists.newArrayList(msg.getUserId()));
//pushMsg.setRecivers(Arrays.asList(msg.getTargetTel()));
pushMsg.setContent(ObjectUtils.isEmpty(msg.getPushBody()) ? msg.getBody() : msg.getPushBody());
pushMsg.setSubject(msg.getTitle());
......@@ -289,8 +279,15 @@ public class MessageServiceImpl implements IMessageService {
}
@Override
public void saveMsg(Msg msg) {
iMsgDao.save(msg);
@Transactional
public void pushRiskMsg(Map<String, Object> msgMap) {
Msg riskMsg = JSON.parseObject(JSON.toJSONString(msgMap.get("riskMsg")), Msg.class);
PushMsgParam pushMsg = JSON.parseObject(JSON.toJSONString(msgMap.get("pushMsg")), PushMsgParam.class);
boolean flag = appMessagePushService.pushNoticeManyMethod(pushMsg);
if (flag) {
iMsgDao.save(riskMsg);
log.info(String.format("app推送成功,用户: %s", pushMsg.getRecivers()));
}
}
@Override
......@@ -303,30 +300,29 @@ public class MessageServiceImpl implements IMessageService {
@Override
@Transactional
public List<Msg> publishNotice(String toke,String product,String appKey,NoticePublishParam notice) {
public List<Msg> publishNotice(String toke, String product, String appKey, NoticePublishParam notice) {
List<String> userIds = notice.getUserId();
boolean isImmediately = notice.getIsImmediately();
List<Msg> msgList = new ArrayList<>();
List<AgencyUserModel> users = remoteSecurityService.listUserByUserIds(toke, product, appKey,Joiner.on(",").join(userIds));
List<AgencyUserModel> users = remoteSecurityService.listUserByUserIds(toke, product, appKey, Joiner.on(",").join(userIds));
for (AgencyUserModel user : users) {
String targetTel = user.getRealName();
Msg msg = new Msg();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss");
String start = sdf.format(notice.getFixedTime());
msg.setBody(notice.getBody()+"\r\n发送时间:"+start);
msg.setBody(notice.getBody() + "\r\n发送时间:" + start);
msg.setIsImmediately(isImmediately);
msg.setMsgType(MsgSubscribeTypeEnum.通知公告推送.getMsgType());
msg.setOrgCode(user.getCompanys().get(0).getOrgCode());
msg.setTargetTel(targetTel);
msg.setTargetTel(targetTel);
msg.setTitle(MsgSubscribeTypeEnum.通知公告推送.getTitle());
msg.setUserId(user.getUserId());
msg.setUserId(user.getUserId());
// msg.setUserId(user.getUserId());
msg.setReciverName(user.getRealName());
// msg.setUserId(user.getUserId());
msg.setReciverName(user.getRealName());
if (isImmediately) { //立即发送
msg = pushMsg(msg);
} else { //定时发送
......@@ -340,15 +336,14 @@ public class MessageServiceImpl implements IMessageService {
return msgList;
}
@Override
@Transactional
public List<Msg> publishNotice1(String toke,String product,String appKey,NoticePublishParam notice) {
public List<Msg> publishNotice1(String toke, String product, String appKey, NoticePublishParam notice) {
List<String> userIds = notice.getUserId();
boolean isImmediately = notice.getIsImmediately();
List<Msg> msgList = new ArrayList<>();
List<AgencyUserModel> users = remoteSecurityService.listUserByUserIds( toke, product, appKey,Joiner.on(",").join(userIds));
List<AgencyUserModel> users = remoteSecurityService.listUserByUserIds(toke, product, appKey, Joiner.on(",").join(userIds));
for (AgencyUserModel user : users) {
String targetTel = user.getRealName();
Msg msg = new Msg();
......@@ -357,13 +352,12 @@ public class MessageServiceImpl implements IMessageService {
msg.setMsgType("alarmNotification");
msg.setOrgCode(user.getCompanys().get(0).getOrgCode());
msg.setTargetTel(targetTel);
msg.setTitle("告警通知");
msg.setUserId(user.getUserId());
msg.setTitle("告警通知");
msg.setUserId(user.getUserId());
// msg.setUserId(user.getUserId());
msg.setReciverName(user.getRealName());
// msg.setUserId(user.getUserId());
msg.setReciverName(user.getRealName());
if (isImmediately) { //立即发送
msg = pushMsg(msg);
} else { //定时发送
......@@ -376,14 +370,10 @@ public class MessageServiceImpl implements IMessageService {
}
return msgList;
}
@Override
public void pushPlanTaskMessage(String toke,String product,String appKey,PlanTask planTask, String jobType) {
public void pushPlanTaskMessage(String toke, String product, String appKey, PlanTask planTask, String jobType) {
// TODO Auto-generated method stub
TaskMsgBo taskMsgBo = null;
String title = "";
......@@ -396,7 +386,7 @@ public class MessageServiceImpl implements IMessageService {
if (PlanTaskFinishStatusEnum.UNDERWAY.getValue() == planTask.getFinishStatus()) {
// List<Integer> status = new ArrayList<>();
// status.add(PlanTaskDetailIsFinishEnum.FINISHED.getValue());
int count = planTaskDetailDao.countByIsFinishAndTaskNo(PlanTaskDetailIsFinishEnum.FINISHED.getValue(),planTask.getId());
int count = planTaskDetailDao.countByIsFinishAndTaskNo(PlanTaskDetailIsFinishEnum.FINISHED.getValue(), planTask.getId());
if (count == 0) {
title = MsgSubscribeTypeEnum.计划开始后推送.getTitle();
msgType = MsgSubscribeTypeEnum.计划开始后推送.getMsgType();
......@@ -408,10 +398,10 @@ public class MessageServiceImpl implements IMessageService {
msgType = MsgSubscribeTypeEnum.计划漏检推送.getMsgType();
taskMsgBo = msgMapper.getPlanTaskEndMsgBos(planTask.getId());
}
pushMsgAndSaveMsg( toke, product, appKey,taskMsgBo, title, msgType, false);
pushMsgAndSaveMsg(toke, product, appKey, taskMsgBo, title, msgType, false);
}
private void pushMsgAndSaveMsg(String toke,String product,String appKey,TaskMsgBo taskMsgBo, String title, String msgType, Boolean isImmediately) {
private void pushMsgAndSaveMsg(String toke, String product, String appKey, TaskMsgBo taskMsgBo, String title, String msgType, Boolean isImmediately) {
if (taskMsgBo != null) {
Msg msg = new Msg();
msg.setTitle(title);
......@@ -420,15 +410,15 @@ public class MessageServiceImpl implements IMessageService {
msg.setMsgType(msgType);
msg.setRelationId(taskMsgBo.getTaskId());
msg.setUserId(taskMsgBo.getUserId());
List<AgencyUserModel> userModels = remoteSecurityService.listUserByUserIds( toke, product, appKey,taskMsgBo.getUserId());
if(userModels!=null&&userModels.size()>0){
msg.setReciverName(userModels.get(0).getRealName());
List<AgencyUserModel> userModels = remoteSecurityService.listUserByUserIds(toke, product, appKey, taskMsgBo.getUserId());
if (userModels != null && userModels.size() > 0) {
msg.setReciverName(userModels.get(0).getRealName());
}
//msg.setOrgCode(taskMsgBo.getOrgCode());
msg.setTargetTel(taskMsgBo.getReciver());
msg.setIsImmediately(isImmediately);
pushMsg(msg);
}
}
......
......@@ -390,7 +390,10 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
//2.4.删除今天可能重做生成的数据(计划重做后进行了计划的编辑)
if (iplanTaskDao.findById(plan.getPlanTaskId()) != null && plan.getFirstFlag() == XJConstant.PLAN_FIRST_STATUS_YES)
iplanTaskDao.deleteById(plan.getPlanTaskId());
if(iplanTaskDao.existsById(plan.getPlanTaskId())){
iplanTaskDao.deleteById(plan.getPlanTaskId());
}
//2.5.插入planTask及planTaskDetail
insertPlanTaskAndDet(list, plan, XJConstant.SCHED_FLAG, now);
......
......@@ -194,7 +194,17 @@ public class PointServiceImpl implements IPointService {
point.setIsScore(param.getIsScore());
// point.setLatitude(param.getLatitude());
// point.setLongitude(param.getLongitude());
point.setLevel(param.getLevel());
if(param.getLevel()!=null){
point.setLevel(param.getLevel().substring(0, 1));
}
point.setName(param.getName());
point.setOffline("1".equals(param.getOffline()) ? true : false);
point.setPointNo(param.getPointNo());
......@@ -872,22 +882,23 @@ public class PointServiceImpl implements IPointService {
@Override
public Point queryPointByPointNo(HashMap<String, Object> params) {
return iPointDao.findOne(new Specification<Point>() {
@Override
public Predicate toPredicate(Root<Point> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
List<Predicate> predicate = new ArrayList<>();
if (!ObjectUtils.isEmpty(params.get("pointNo"))) {
predicate.add(cb.equal(root.get("pointNo").as(String.class), params.get("pointNo")));
}
if (!ObjectUtils.isEmpty(params.get("orgCode"))) {
predicate.add(cb.equal(root.get("orgCode").as(String.class), params.get("orgCode").toString()));
}
Predicate[] pre = new Predicate[predicate.size()];
return query.where(predicate.toArray(pre)).getRestriction();
}
}).get();
Point point = iPointDao.findByOrgCodeAndPointNo(params.get("pointNo").toString(), params.get("orgCode").toString());
return point;
// return iPointDao.findOne(new Specification<Point>() {
//
// @Override
// public Predicate toPredicate(Root<Point> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
// List<Predicate> predicate = new ArrayList<>();
// if (!ObjectUtils.isEmpty(params.get("pointNo"))) {
// predicate.add(cb.equal(root.get("pointNo").as(String.class), params.get("pointNo")));
// }
// if (!ObjectUtils.isEmpty(params.get("orgCode"))) {
// predicate.add(cb.like(root.get("orgCode").as(String.class), params.get("orgCode").toString() + "%"));
// }
// Predicate[] pre = new Predicate[predicate.size()];
// return query.where(predicate.toArray(pre)).getRestriction();
// }
// }).get();
}
@Override
......
......@@ -128,32 +128,56 @@ public class QueryStatsServiceImpl implements IQueryStatsService {
List<Map<String, Object> > listmap=new ArrayList<Map<String, Object> >();
List<StatisticPieBo> levelBoListdate=new ArrayList<StatisticPieBo>();
if(list!=null&&list.size()>0){
for (int i = 0; i < list.size(); i++) {
for (int i = 0; i < list.size(); i++) {
Map<String, Object> map=new HashMap<>();
map.put("key", list.getJSONObject(i).get("dictDataKey"));
map.put("name", "level"+list.getJSONObject(i).get("dictDataKey"));
listmap.add(map);
StatisticPieBo dd=new StatisticPieBo();
dd.setName(list.getJSONObject(i).get("dictDataValue")+"");
dd.setPercent("0%");
dd.setTotal(0L);
dd.setValue("0");
levelBoListdate.add(dd);
}
}
List<StatisticPieBo> levelBoList = queryStatsMapper.getRiskPieDetailInfo(orgCode);
for (int i = 0; i < levelBoListdate.size(); i++) {
if(levelBoList!=null&&levelBoList.size()>0){
for (int j = 0; j < levelBoList.size(); j++) {
if(levelBoListdate.get(i).getName().equals(levelBoList.get(j).getName())){
}
}
List<StatisticPieBo> levelBoList = queryStatsMapper.getRiskPieDetailInfo(orgCode);
for (int i = 0; i < levelBoListdate.size(); i++) {
if(levelBoList!=null&&levelBoList.size()>0){
for (int j = 0; j < levelBoList.size(); j++) {
if(levelBoListdate.get(i).getName().equals(levelBoList.get(j).getName())){
levelBoListdate.get(i).setPercent(levelBoList.get(j).getPercent());
levelBoListdate.get(i).setTotal(levelBoList.get(j).getTotal());
levelBoListdate.get(i).setValue(levelBoList.get(j).getValue());
levelBoListdate.get(i).setValue(levelBoList.get(j).getValue());
continue;
}
}
}
}
}
}
}
Long total = 0l;
for (StatisticPieBo bo : levelBoListdate) {
total += Long.parseLong(bo.getValue());
......@@ -162,6 +186,8 @@ public class QueryStatsServiceImpl implements IQueryStatsService {
bo.setTotal(total);
}
detailMap.put("byRiskLevel", levelBoListdate);
List<Map<String, String>> departmentMap = queryStatsMapper.queryRiskByDepartment(orgCode,listmap);
departmentMap.forEach(d -> {
String departmentId = d.get("belongDepartmentId");
......@@ -209,6 +235,9 @@ public class QueryStatsServiceImpl implements IQueryStatsService {
}
private void getTaskworkStatistics(String toke,String product,String appKey,String orgCode, Map<String, Object> detailMap) {
JSONArray list= remoteSecurityService.listDictionaryByDictCode( toke, product, appKey,"FXDJ_TYPE");
String typesql="";
List<StatisticPieBo> levelBoListdate=new ArrayList<StatisticPieBo>();
......@@ -222,21 +251,38 @@ public class QueryStatsServiceImpl implements IQueryStatsService {
dd.setTotal(0L);
dd.setValue("0");
levelBoListdate.add(dd);
}
}
List<StatisticPieBo> levelBoList = queryStatsMapper.getPieInfoByTaskworkRiskLevel(orgCode, beginDateOfThisYear);
for (int i = 0; i < levelBoListdate.size(); i++) {
if(levelBoList!=null&&levelBoList.size()>0){
for (int j = 0; j < levelBoList.size(); j++) {
if(levelBoListdate.get(i).getName().equals(levelBoList.get(j).getName())){
}
}
List<StatisticPieBo> levelBoList = queryStatsMapper.getPieInfoByTaskworkRiskLevel(orgCode, beginDateOfThisYear);
for (int i = 0; i < levelBoListdate.size(); i++) {
if(levelBoList!=null&&levelBoList.size()>0){
for (int j = 0; j < levelBoList.size(); j++) {
if(levelBoListdate.get(i).getName().equals(levelBoList.get(j).getName())){
levelBoListdate.get(i).setPercent(levelBoList.get(j).getPercent());
levelBoListdate.get(i).setTotal(levelBoList.get(j).getTotal());
levelBoListdate.get(i).setValue(levelBoList.get(j).getValue());
levelBoListdate.get(i).setValue(levelBoList.get(j).getValue());
continue;
}
}
}
}
}
}
}
List<StatisticPieBo> statusBoList = queryStatsMapper.getPieInfoByTaskworkStatus(orgCode, beginDateOfThisYear);
List<StatisticPieBo> violateStatusBoList = queryStatsMapper.getPieInfoByTaskworkViolateStatus(orgCode, beginDateOfThisYear);
List<StatisticPieBo> typeBoList = queryStatsMapper.getPieInfoByTaskworkType(orgCode, beginDateOfThisYear);
......
......@@ -2,33 +2,11 @@
package com.yeejoin.amos.patrol.service.business.service.impl;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import com.yeejoin.amos.patrol.common.entity.CommonResponse;
import com.yeejoin.amos.patrol.service.remote.feign.AmosRiskFeign;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.patrol.common.core.request.CheckResultPushSpcRequest;
import com.yeejoin.amos.patrol.common.core.response.CheckInputResponse;
import com.yeejoin.amos.patrol.common.core.response.PatrolUserRespone;
import com.yeejoin.amos.patrol.common.core.response.PointCheckInfoBusinessRespone;
import com.yeejoin.amos.patrol.common.core.response.PointCheckInfoRespone;
import com.yeejoin.amos.patrol.common.core.response.PointInfoSyn3DRespone;
import com.yeejoin.amos.patrol.common.core.response.PointPositionInfoSyn3DRespone;
import com.yeejoin.amos.patrol.common.core.response.PointUserSyn3DRespone;
import com.yeejoin.amos.patrol.common.core.response.RouteResponse;
import com.yeejoin.amos.patrol.common.core.response.TaskInfoRespone;
import com.yeejoin.amos.patrol.common.core.response.*;
import com.yeejoin.amos.patrol.common.entity.CommonResponse;
import com.yeejoin.amos.patrol.common.entity.Point;
import com.yeejoin.amos.patrol.common.entity.UserModel;
import com.yeejoin.amos.patrol.common.enums.CheckStatusEnum;
import com.yeejoin.amos.patrol.service.business.dao.mapper.CheckMapper;
import com.yeejoin.amos.patrol.service.business.dao.mapper.PointMapper;
......@@ -39,6 +17,17 @@ import com.yeejoin.amos.patrol.service.business.service.intfc.ISafety3DDataSendS
import com.yeejoin.amos.patrol.service.core.util.DateUtil;
import com.yeejoin.amos.patrol.service.remote.RemoteSecurityService;
import com.yeejoin.amos.patrol.service.remote.RemoteSpcService;
import com.yeejoin.amos.patrol.service.remote.feign.AmosRiskFeign;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
//import com.yeejoin.amos.security.common.model.UserModel;
@Service("safety3DDataSend")
......
......@@ -11,6 +11,7 @@ import com.yeejoin.amos.patrol.service.business.vo.MsgVo;
import org.springframework.data.domain.Page;
import java.util.List;
import java.util.Map;
public interface IMessageService {
......@@ -54,9 +55,9 @@ public interface IMessageService {
public Msg pushMsg1(Msg msg);
/**
* 添加信息
* @param msg
* 风险预警推送
* @param msgMap
* @return
*/
public void saveMsg(Msg msg);
public void pushRiskMsg(Map<String, Object> msgMap);
}
......@@ -112,7 +112,9 @@ public class CheckPageParamUtil {
*/
public static CheckPtListPageParam fillChkPtParam(List<CommonRequest> queryRequests, CommonPageable commonPageable,
HashMap<String, Object> roleMap) {
CheckPtListPageParam paramMap = new CheckPtListPageParam();
paramMap.setOrgCode(roleMap.get("orgCode") == null ? null : roleMap.get("orgCode").toString());
for (int i = 0; i < queryRequests.size(); i++) {
String name = queryRequests.get(i).getName();
if ("checkType".equals(name)) {
......@@ -131,13 +133,19 @@ public class CheckPageParamUtil {
paramMap.setLevel(toString(queryRequests.get(i).getValue()));
} else if ("pointID".equals(name)) {
paramMap.setPointId(toInteger(queryRequests.get(i).getValue()));
}else if ("orgCode".equals(name)) {
paramMap.setOrgCode(queryRequests.get(i).getValue() == null ? null : queryRequests.get(i).getValue().toString());
}
}
if (null != commonPageable) {
paramMap.setPageNumber(commonPageable.getPageNumber());
paramMap.setPageSize(commonPageable.getPageSize());
}
paramMap.setOrgCode(roleMap.get("orgCode") == null ? null : roleMap.get("orgCode").toString());
// paramMap.setUserId(roleMap.get("userId") == null ? null : roleMap.get("userId").toString());
return paramMap;
}
......
......@@ -21,6 +21,8 @@ import java.net.URLEncoder;
import java.nio.ByteBuffer;
import java.nio.channels.Channel;
import java.nio.channels.FileChannel;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
......@@ -1074,6 +1076,20 @@ private static void defaultExport(List<Map<String, Object>> list, String fileNam
}
public static void downloadQRCodeZip(String baseDir, ZipOutputStream zos, List<PointVo> pointList) {
Map<String, Object> map1= new HashMap<String, Object>();
for (PointVo map : pointList) {
map1.put(map.getPointNo(), map);
}
pointList.clear();
for(String key:map1.keySet()){
pointList.add((PointVo)map1.get(key));
}
for (PointVo map : pointList) {
String pointName = map.getName();
//文件名称(带后缀)
......
package com.yeejoin.amos.patrol.service.constants;
/**
* @Author: xinglei
* @Description: 常量
* @Date: 2020/4/3 10:52
*/
public class CommonConstant {
public static String TOKEN = "TOKE";
}
......@@ -22,7 +22,7 @@ public class XJConstant {
public static final String CM_CATEGORY_DIC_CODE = "CM_CATEGORY";
public static final String CM_TYPE_DIC_CODE = "CM_TYPE";
public static final String JPUSH_USER_KEY ="BANK";
public static final String JPUSH_USER_KEY ="BANK_NEW";
/**
* 网络服务ip
*/
......@@ -401,5 +401,8 @@ public class XJConstant {
public static final String COMBINE_DATA = "2";
public static final String INPUT_ITEM_DEXT = "大额";
public static final String INPUT_ITEM_XEXT= "小额";
public static final String INPUT_ITEM_WYXT = "网银";
public static final String INPUT_ITEM_JWXT = "境外";
}
......@@ -155,8 +155,6 @@ public class AsyncTask {
*/
@Async("asyncTaskExecutor")
public Future<Boolean> pushCheckInfoTo3D(Long checkId) throws InterruptedException {
//巡检结果推送至业务
safety3DDataSend.pointCheckInfoPushToB(checkId);
//获取缓存
CacheMap cacheMap= CacheFactory.newChacheMap();
Toke toke= cacheMap.getValue(TOKE);
......@@ -165,9 +163,9 @@ public class AsyncTask {
Long times= (long) (20*24*60*60);
cacheMap.setex(TOKE, toke, times);
}
safety3DDataSend.pointCheckInfoPush( toke.getToke(),toke.getProduct(),toke.getAppKey(),checkId);
//巡检结果推送至业务
safety3DDataSend.pointCheckInfoPushToB(checkId);
safety3DDataSend.pointCheckInfoPush(toke.getToke(),toke.getProduct(),toke.getAppKey(),checkId);
return new AsyncResult<Boolean>(true);
}
......@@ -506,7 +504,7 @@ public class AsyncTask {
// }
Set<String> userIds=new HashSet<>();
//查询当前点的责任人
//查询当前点的责任人1547041
String id= "".equals(map.get("pointId")+"")?null:(map.get("pointId")+"");
Map<String, String> mapi= msgMapper.getuserid(id);
if(mapi!=null&&!mapi.isEmpty()){
......@@ -535,8 +533,8 @@ public class AsyncTask {
havaRecordBody += "点编号:" + checkPointBo.getPointNo() + TAB;
havaRecordBody += "巡检点名称:" + checkPointBo.getPointName() + TAB;
havaRecordBody += "当前状态:" +CheckStatusEnum.getEnum(checkPointBo.getState()).getName() + TAB;
if("不合格".equals(CheckStatusEnum.getEnum(checkPointBo.getState()).getName())){
havaRecordBody += "不合格项:" + checkPointBo.getErrorItem() + TAB;
if("异常".equals(CheckStatusEnum.getEnum(checkPointBo.getState()).getName())){
havaRecordBody += "异常项:" + checkPointBo.getErrorItem() + TAB;
}
......@@ -584,15 +582,15 @@ public class AsyncTask {
MsgSubscribeTypeEnum eamilMsgTypeEnum = MsgSubscribeTypeEnum.推送检查记录消息;
//不合格推送
MsgSubscribeTypeEnum noPassMsgTypeEnum = MsgSubscribeTypeEnum.不合格记录推送;
MsgSubscribeTypeEnum noPassMsgTypeEnum = MsgSubscribeTypeEnum.异常记录推送;
Set<String> noPassRecordUserIds = userIdFilter(userIds, noPassMsgTypeEnum.getMsgType());
String noPassBody = "";
noPassBody += "巡检时间:" + DateUtil.formatDatrToStr(checkPointBo.getCheckTime(), DateUtil.LONG_PATTERN) + TAB;
noPassBody += "巡检人员:" + userName + TAB;
noPassBody += "巡检点名称:" + checkPointBo.getPointName() + TAB;
noPassBody += "点编号:" + checkPointBo.getPointNo() + TAB;
noPassBody += "当前状态:不合格" + TAB;
noPassBody += "不合格项:" + checkPointBo.getErrorItem() + TAB;
noPassBody += "当前状态:异常" + TAB;
noPassBody += "异常项:" + checkPointBo.getErrorItem() + TAB;
saveAndSendMsg(checkPointBo.getOrgCode(), noPassRecordUserIds, noPassMsgTypeEnum.getTitle(), noPassBody, noPassMsgTypeEnum.getMsgType(), checkId, null);
Set<String> noPassRecordEmailAfterFilterUserIds = userIdFilter(noPassRecordUserIds, eamilMsgTypeEnum.getMsgType());
sendEmail(noPassRecordEmailAfterFilterUserIds, noPassMsgTypeEnum.getTitle(), noPassBody);
......@@ -765,6 +763,37 @@ public class AsyncTask {
sendEmail(noPassRecordEmailAfterFilterUserIds, msgTypeEnum.getTitle(), body);
}
//巡检计划状态变化推送
public void pushChartResulplantask() {
//发送数据 0:刷新
WebsocketParam param = new WebsocketParam("plantask", "planTaskRefresh");
client.sendMessage(param);
}
/**
* 巡检计划涉及支付业务推送
*/
public void pushChartResulPaytask() {
//发送数据 payRefresh:支付业务刷新
WebsocketParam param = new WebsocketParam("plantask", "payRefresh");
client.sendMessage(param);
}
public void pushChartResult() {
HashMap<String, Object> res = msgMapper.queryRouteChartResult();
if(res != null) {
......
......@@ -12,12 +12,14 @@ import cn.jpush.api.push.model.notification.Notification;
import com.fasterxml.jackson.databind.annotation.JsonAppend.Attr;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.yeejoin.amos.patrol.common.entity.CommonResponse;
import com.yeejoin.amos.patrol.common.enums.JPushTypeEnum;
import com.yeejoin.amos.patrol.service.business.param.PushMsgParam;
import com.yeejoin.amos.patrol.service.constants.XJConstant;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
......@@ -38,6 +40,11 @@ public class AppMessagePushService {
protected static final Logger log = LoggerFactory
.getLogger(AppMessagePushService.class);
@Autowired
private com.yeejoin.amos.patrol.service.remote.feign.PushFeign PushFeign;
// private static String APP_KEY;
//
// private static String MASTER_SECRET;
......@@ -79,90 +86,102 @@ public class AppMessagePushService {
public static String buildJpushUserKey(String userId) {
return XJConstant.JPUSH_USER_KEY + "_" + userId;
}
public void sendMessage(List<PushMsgParam> responses) {
try {
if (responses != null && "true".equals(isPush)) {
for (PushMsgParam response : responses) {
PushPayload payload = buildPushPayload(response);
jpushClient.sendPush(payload);
}
}
} catch (Exception e) {
log.error(e.getMessage(), e);
e.printStackTrace();
}
PushFeign.sendMessage(responses);
// try {
// if (responses != null && "true".equals(isPush)) {
// for (PushMsgParam response : responses) {
// PushPayload payload = buildPushPayload(response);
// jpushClient.sendPush(payload);
// }
// }
// } catch (Exception e) {
// log.error(e.getMessage(), e);
// e.printStackTrace();
// }
}
public PushPayload buildPushPayload(PushMsgParam response) {
CommonResponse commonResponse = PushFeign.buildPushPayload(response);
return (PushPayload)commonResponse.getDataList();
// if (JPushTypeEnum.ALL.getCode().equals(response.getType())) {
// return PushPayload.newBuilder()
// .setPlatform(Platform.android())
// .setAudience(Audience.all())
// .setNotification(Notification.android(response.getContent(), response.getSubject(), response.getExtras()))
// .build();
// } else if (JPushTypeEnum.TAG.getCode().equals(response.getType())) {
//
// List<String> recivers = response.getRecivers();
// List<String> users = Lists.newArrayList();
// recivers.forEach(e -> users.add(buildJpushUserKey(e)));
//
// return PushPayload.newBuilder().setPlatform(Platform.android())
// .setAudience(Audience.tag(users))
// .setNotification(Notification.android(response.getContent(), response.getSubject(), response.getExtras()))
// .build();
// } else {
//
// List<String> recivers = response.getRecivers();
// List<String> users = Lists.newArrayList();
// recivers.forEach(e -> users.add(buildJpushUserKey(e)));
// return PushPayload.newBuilder().setPlatform(Platform.android())
// .setAudience(Audience.alias(users)).
// setNotification(Notification.android(response.getContent(), response.getSubject(), response.getExtras()))
// .build();
// }
}
private static PushPayload buildPushPayload(PushMsgParam response) {
if (JPushTypeEnum.ALL.getCode().equals(response.getType())) {
return PushPayload.newBuilder()
.setPlatform(Platform.android())
.setAudience(Audience.all())
.setNotification(Notification.android(response.getContent(), response.getSubject(), response.getExtras()))
.build();
} else if (JPushTypeEnum.TAG.getCode().equals(response.getType())) {
List<String> recivers = response.getRecivers();
List<String> users = Lists.newArrayList();
recivers.forEach(e -> users.add(buildJpushUserKey(e)));
return PushPayload.newBuilder().setPlatform(Platform.android())
.setAudience(Audience.tag(users))
.setNotification(Notification.android(response.getContent(), response.getSubject(), response.getExtras()))
.build();
public boolean pushNoticeManyMethod(PushMsgParam response) {
CommonResponse commonResponse = PushFeign.pushNoticeMany(response);
if (commonResponse.getResult().equals("SUCCESS")){
return true;
} else {
List<String> recivers = response.getRecivers();
List<String> users = Lists.newArrayList();
recivers.forEach(e -> users.add(buildJpushUserKey(e)));
return PushPayload.newBuilder().setPlatform(Platform.android())
.setAudience(Audience.alias(users)).
setNotification(Notification.android(response.getContent(), response.getSubject(), response.getExtras()))
.build();
return false;
}
}
public void sendMessage(PushMsgParam response) {
try {
if (null != response && "true".equals(isPush)) {
PushPayload payload = PushPayload.newBuilder().setPlatform(Platform.android())
.setAudience(Audience.all())
.setNotification(Notification.android(response.getContent(), response.getSubject(), response.getExtras()))
.build();
jpushClient.sendPush(payload);
}
} catch (Exception e) {
log.error(e.getMessage(), e);
e.printStackTrace();
}
CommonResponse commonResponse = PushFeign.sendMessageone(response);
// try {
// if (null != response && "true".equals(isPush)) {
// PushPayload payload = PushPayload.newBuilder().setPlatform(Platform.android())
// .setAudience(Audience.all())
// .setNotification(Notification.android(response.getContent(), response.getSubject(), response.getExtras()))
// .build();
// jpushClient.sendPush(payload);
// }
// } catch (Exception e) {
// log.error(e.getMessage(), e);
// e.printStackTrace();
//
// }
}
/**
* ͵ָ
* ���͵�ָ������
*
* */
public static void pushNoticeMany( PushMsgParam response){
PushPayload payload = buildPushPayload(response);
try {
jpushClient.sendPush(payload);
} catch (APIConnectionException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (APIRequestException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
public void pushNoticeMany( PushMsgParam response){
CommonResponse commonResponse = PushFeign.pushNoticeMany(response);
// PushPayload payload = (PushPayload)commonResponse.getDataList();
// try {
// jpushClient.sendPush(payload);
// } catch (APIConnectionException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// } catch (APIRequestException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
}
}
......@@ -157,7 +157,10 @@ public class JobService implements IJobService {
planTaskAddJob(planTask);
} else if (beginTime.getTime() < timestamp && endTime.getTime() > timestamp) {
planTask.setFinishStatus(PlanTaskFinishStatusEnum.UNDERWAY.getValue());
iPlanTaskDao.save(planTask);
iPlanTaskDao.save(planTask);
//增加推送进行中
asyncTask.pushChartResulplantask();
planTaskAddJob(planTask);
} else if (endTime.getTime() < timestamp) {
updatePlanTaskStatus(planTask, PlanTaskFinishStatusEnum.OVERTIME.getValue());
......@@ -190,6 +193,10 @@ public class JobService implements IJobService {
private void updatePlanTaskStatus(PlanTask planTask, int status) {
planTask.setFinishStatus(status);
iPlanTaskDao.saveAndFlush(planTask);
//增建已超时,已完成,推送
asyncTask.pushChartResulplantask();
List<PlanTaskDetail> planTaskDetails = iPlanTaskDetailDao.findAllByTaskNoAndStatus(planTask.getId(), PlanTaskDetailStatusEnum.NOTSTARTED.getValue());
if (!planTaskDetails.isEmpty()) {
planTaskDetails.stream()
......@@ -226,7 +233,7 @@ public class JobService implements IJobService {
check.setOrgCode(arg.getOrgCode());
check.setUserId(arg.getUserId());
check.setPointId(arg.getPointId());
check.setUploadTime(new Date());
check.setUploadTime(arg.getEndTime());
check.setPlanId(arg.getPlanId());
check.setPlanTaskId(arg.getPlanTaskId());
check.setPlanTaskDetailId(arg.getPlanTaskDetailId());
......@@ -235,7 +242,6 @@ public class JobService implements IJobService {
check.setIsOk(CheckStatusEnum.OMISSION.getCode());
//新增加部门id
check.setDepId(arg.getDepId());
check = iCheckDao.saveAndFlush(check);
checkMap.put(arg.getPointId(), check);
......@@ -424,6 +430,8 @@ public class JobService implements IJobService {
if (PlanTaskFinishStatusEnum.NOTSTARTED.getValue() == planTask.getFinishStatus()) {
planTask.setFinishStatus(PlanTaskFinishStatusEnum.UNDERWAY.getValue());
iPlanTaskDao.saveAndFlush(planTask);
//增加推送进行中
asyncTask.pushChartResulplantask();
}
} else if (XJConstant.STATUS_MONITOR_END.equals(jobType)) {
if (PlanTaskFinishStatusEnum.UNDERWAY.getValue() == planTask.getFinishStatus()) {
......
......@@ -59,9 +59,7 @@ public class RemoteSecurityService {
private AmosBankFeign amosBankFeign;
//根据公司名称获取公司人
public List<CompanyModel> listCompanyTree(String toke,String product,String appKey,String companyName) {
// CommonResponse commonResponse = iAmosSecurityServer.listCompanyTree();
//return handleArray(commonResponse, CompanyBo.class);
RequestContext.setToken(toke);
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
List<CompanyModel> userModel=null;
......@@ -114,10 +112,7 @@ public class RemoteSecurityService {
if (deparmentId == null || deparmentId.equals("")) {
return null;
}
// CommonResponse commonResponse = iAmosSecurityServer.getDepartmentByDeptId(deparmentId);
// return handleObj(commonResponse, DepartmentBo.class);
RequestContext.setToken(toke);
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
DepartmentModel departmentModel=null;
......@@ -149,10 +144,30 @@ public class RemoteSecurityService {
e.printStackTrace();
}
return departmentModel;
//CommonResponse commonResponse = iAmosSecurityServer.listDepartmentsByCompanyId(companyId);
//return handleArray(commonResponse, DepartmentBo.class);
}
//查询指定部门数
public List<DepartmentModel> listDepartmentsByCompanyId1(String toke,String product,String appKey,String sequenceNbr) {
if (sequenceNbr == null || sequenceNbr.equals("")) {
return null;
}
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
List<DepartmentModel> departmentModel=null;
FeignClientResult feignClientResult;
try {
feignClientResult = Privilege.departmentClient.querySubAgencyTree(Long.valueOf(sequenceNbr));
departmentModel = ( List<DepartmentModel>) feignClientResult.getResult();
} catch (InnerInvokException e) {
e.printStackTrace();
}
return departmentModel;
}
// * 根据公司id查询机构用户
public List<AgencyUserModel> listUserByCompanyId(String toke,String product,String appKey,String companyId) {
if (companyId == null || companyId.equals("")) {
......@@ -171,19 +186,10 @@ public class RemoteSecurityService {
e.printStackTrace();
}
return AgencyUserModel;
//CommonResponse commonResponse = iAmosSecurityServer.listUserByCompanyId(companyId);
//return handleArray(commonResponse, UserModel.class);
}
}
/* public List<UserModel> listUserByRoleIds(String roleIds) {
CommonResponse commonResponse = iAmosSecurityServer.listUserByRoleIds(roleIds);
return handleArray(commonResponse, UserModel.class);
}*/
//用户id批量获取用户信息
public List<AgencyUserModel> listUserByUserIds(String toke,String product,String appKey,String userIds) {
// CommonResponse commonResponse = iAmosSecurityServer.listUserByUserIds(userIds);
//return handleArray(commonResponse, UserModel.class);
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
......@@ -203,9 +209,7 @@ public class RemoteSecurityService {
if (userId == null || userId.equals("")) {
return null;
}
// CommonResponse commonResponse = iAmosSecurityServer.getUserById(userId);
// return handleObj(commonResponse, UserModel.class);
RequestContext.setToken(toke);
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
AgencyUserModel agencyUserModel=null;
......@@ -238,12 +242,7 @@ public class RemoteSecurityService {
e.printStackTrace();
}
return agencyUserModel;
// CommonResponse commonResponse = iAmosSecurityServer.listUserByOrgCode(orgCode);
// return handleArray(commonResponse, UserModel.class);
}
}
// 根据部门id查询机构用户
public List<AgencyUserModel> listUserByDepartmentId(String toke,String product,String appKey,String departmentId) {
......@@ -264,12 +263,7 @@ public class RemoteSecurityService {
e.printStackTrace();
}
return agencyUserModel;
// CommonResponse commonResponse = iAmosSecurityServer.listUserByDepartmentId(departmentId);
// return handleArray(commonResponse, UserModel.class);
}
}
......@@ -292,29 +286,11 @@ public class RemoteSecurityService {
e.printStackTrace();
}
return agencyUserModel;
// CommonResponse commonResponse = iAmosSecurityServer.listUserByOrgCode(orgCode);
// return handleArray(commonResponse, UserModel.class);
}
}
/* public UserModel getUserByToken() {
CommonResponse commonResponse = iAmosSecurityServer.getUserByToken();
return handleObj(commonResponse, UserModel.class);
}*/
//* 获取子公司信息树结构
public List<CompanyModel> getCompanyTreeByCompanyId(String toke,String product,String appKey,String companyId) {
if (companyId == null || companyId.equals("")) {
......@@ -334,12 +310,7 @@ public class RemoteSecurityService {
}
return companyModel;
//CommonResponse commonResponse = iAmosSecurityServer.getCompanyTreeByCompanyId(companyId);
//return handleArray(commonResponse, CompanyBo.class);
}
}
//查询指定公司的部门树
public List<DepartmentModel> getDepartmentTreeByCompanyId(String toke,String product,String appKey,String companyId) {
if (companyId == null || companyId.equals("")) {
......@@ -359,8 +330,7 @@ public class RemoteSecurityService {
e.printStackTrace();
}
return departmentModel;
// CommonResponse commonResponse = iAmosSecurityServer.getDepartmentTreeByCompanyId(companyId);
// return handleArray(commonResponse, DepartmentBo.class);
}
//根据id批量获取部门信息
public List<LinkedHashMap> listDepartmentByDeptIds(String toke,String product,String appKey,String departmentIds) {
......@@ -379,13 +349,7 @@ public class RemoteSecurityService {
}
return departmentModel;
//CommonResponse commonResponse = iAmosSecurityServer.listDepartmentByDeptIds(departmentIds);
//return handleArray(commonResponse, DepartmentBo.class);
}
}
private <T> List<T> handleArray(CommonResponse commonResponse, Class<T> t) {
if (commonResponse != null && commonResponse.isSuccess()) {
......@@ -405,20 +369,14 @@ public class RemoteSecurityService {
/**
* 基础平台全部菜单权限树,用于平台登录前端初始化路由
*/
public CommonResponse searchPermissionTree(String toke,String product,String appKey,String appType) {
// CommonResponse commonResponse = iAmosSecurityServer.listPermissionTree(appType);
// return commonResponse;
RequestContext.setToken(toke);
public CommonResponse searchPermissionTree(long id,String toke,String product,String appKey,String appType) {
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
List<PermissionModel> dictionarieModel=null;
FeignClientResult feignClientResult;
try {
feignClientResult = Privilege.permissionClient.queryPermissionTree(appType,null,null,null);
feignClientResult = Privilege.permissionClient.treeByRole(id,appType,null,null);
dictionarieModel = (List<PermissionModel>)feignClientResult.getResult();
} catch (InnerInvokException e) {
......@@ -435,12 +393,7 @@ public class RemoteSecurityService {
}
//根据Code查询指定的字典信息.
public JSONArray listDictionaryByDictCode(String toke,String product,String appKey,String dictCode) {
/* CommonResponse commonResponse = iAmosSecurityServer.listDictionaryByDictCode(dictCode);
if (commonResponse != null && commonResponse.isSuccess()) {
String jsonStr = JSON.toJSONString(commonResponse.getDataList());
return JSONArray.parseArray(jsonStr);
}*/
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
......@@ -470,12 +423,10 @@ public class RemoteSecurityService {
if (companyId == null || companyId.equals("")) {
return null;
}
//CommonResponse commonResponse = iAmosSecurityServer.getuserTreeByCompanyId(companyId);
// String jsonStr = JSON.toJSONString(commonResponse);
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
//List<CompanyModel> companyModel=null;
CompanyModel companyModel=null;
FeignClientResult feignClientResult;
try {
......@@ -487,25 +438,13 @@ public class RemoteSecurityService {
}
return companyModel;
// return JSONObject.parseObject(jsonStr);
}
public JSONObject loginFromApp(String userName, String password) {
// JSONObject request = new JSONObject();
// request.put("password", password);
// request.put("userName", userName);
// request.put("loginType", "APP");
// request.put("secretKey", "yeejoin");
// CommonResponse commonResponse = iAmosSecurityServer.loginFromApp(request);
// if (commonResponse != null && commonResponse.isSuccess()) {
// String jsonStr = JSON.toJSONString(commonResponse.getDataList());
// return JSONObject.parseObject(jsonStr);
// }
// return null;
IdPasswordAuthModel dPasswordAuthModel=new IdPasswordAuthModel();
......@@ -514,16 +453,11 @@ public class RemoteSecurityService {
Map map=null;
FeignClientResult feignClientResult=new FeignClientResult();
RequestContext.setProduct(productApp);
Toke oked=new Toke();
try {
feignClientResult = Privilege.authClient.idpassword(dPasswordAuthModel);
map = (Map) feignClientResult.getResult();
map.put("appKey", appKeyApp);
map.put("product", productApp);
} catch (InnerInvokException e) {
e.printStackTrace();
}
Toke oked=new Toke();
feignClientResult = Privilege.authClient.idpassword(dPasswordAuthModel);
map = (Map) feignClientResult.getResult();
map.put("appKey", appKeyApp);
map.put("product", productApp);
if (map != null ) {
String jsonStr = JSON.toJSONString(map);
return JSONObject.parseObject(jsonStr);
......@@ -532,12 +466,6 @@ public class RemoteSecurityService {
}
public boolean loginOutFromApp(String toke,String product,String appKey) {
// CommonResponse commonResponse = iAmosSecurityServer.loginOutFromApp();
// if (commonResponse != null && commonResponse.isSuccess()) {
// return true;
// }
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
......@@ -576,24 +504,11 @@ public class RemoteSecurityService {
return JSONArray.parseArray(jsonStr);
}
return null;
/*CommonResponse commonResponse = iAmosSecurityServer.listDepartmentUserTree(companyId);
if (commonResponse != null && commonResponse.isSuccess()) {
String jsonStr = JSON.toJSONString(commonResponse.getDataList());
return JSONArray.parseArray(jsonStr);
}
return null;*/
}
public boolean editPassword(String toke,String product,String appKey,String userId, String oldPassword, String newPassword) {
// JSONObject request = new JSONObject();
//
//
// request.put("originalPassword", oldPassword);
// request.put("userId", userId);
// request.put("password", newPassword);
// request.put("rePassword", newPassword);
boolean flag=false;
RequestContext.setToken(toke);
RequestContext.setProduct(product);
......@@ -601,26 +516,14 @@ public class RemoteSecurityService {
AgencyUserModel agencyUserModel=new AgencyUserModel();
agencyUserModel.setPassword(newPassword);
agencyUserModel.setRePassword(newPassword);
agencyUserModel.setOriginalPassword(oldPassword);
agencyUserModel.setOriginalPassword(oldPassword);
AgencyUserModel agencyUserModel2=null;
FeignClientResult feignClientResult;
try {
feignClientResult = Privilege.agencyUserClient.modifyPassword(userId,agencyUserModel);
agencyUserModel = (AgencyUserModel)feignClientResult.getResult();
} catch (InnerInvokException e) {
throw new RuntimeException(e);
}
FeignClientResult feignClientResult;
feignClientResult = Privilege.agencyUserClient.modifyPassword(userId,agencyUserModel);
agencyUserModel = (AgencyUserModel)feignClientResult.getResult();
if(agencyUserModel2!=null){
flag=true;
}
// CommonResponse commonResponse = iAmosSecurityServer.editPassword(userId, request);
// if (commonResponse != null && commonResponse.isSuccess()) {
// return true;
// }
return false;
}
}
......
......@@ -29,8 +29,9 @@ public interface AmosBankFeign {
@RequestMapping(value = "/rtsp/listVideoByPage", method = RequestMethod.POST ,consumes="application/json")
CommonResponse getVideos( @RequestBody MultiValueMap<String, Object> param);
@RequestMapping(value = "/rtsp/listVideoByPage/{parentId}/{current}/{pageSize}", method = RequestMethod.POST)
@RequestMapping(value = "/rtsp/listVideoByPage/{orgCode}/{parentId}/{current}/{pageSize}", method = RequestMethod.POST)
CommonResponse getVideos(
@PathVariable("orgCode") String orgCode,
@PathVariable("current") Integer current,
@PathVariable("pageSize") Integer pageSize,
@PathVariable("parentId") Long parentId);
......
package com.yeejoin.amos.patrol.service.remote.feign;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.patrol.common.core.response.PointCheckInfoBusinessRespone;
import com.yeejoin.amos.patrol.common.entity.CommonResponse;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.util.MultiValueMap;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
/**
* 风险系统
......
package com.yeejoin.amos.patrol.service.remote.feign;
import feign.codec.Encoder;
import feign.form.spring.SpringFormEncoder;
import org.springframework.beans.factory.ObjectFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
......@@ -7,9 +9,6 @@ import org.springframework.cloud.openfeign.support.SpringEncoder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import feign.codec.Encoder;
import feign.form.spring.SpringFormEncoder;
/**
* @Author: xinglei
* @Description:
......@@ -25,4 +24,13 @@ public class MultipartSupportConfig {
public Encoder feignFormEncoder() {
return new SpringFormEncoder(new SpringEncoder(messageConverters));
}
/**
* 创建Feign请求拦截器,在发送请求前设置认证的token,各个微服务将token设置到环境变量中来达到通用
* @return
*/
@Bean
public RequestContextListener requestInterceptor() {
return new RequestContextListener();
}
}
package com.yeejoin.amos.patrol.service.remote.feign;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import com.yeejoin.amos.patrol.common.core.request.CheckResultPushSpcRequest;
import java.util.List;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.util.MultiValueMap;
import com.yeejoin.amos.patrol.common.entity.CommonResponse;
import com.yeejoin.amos.patrol.service.business.param.PushMsgParam;
//推送
@FeignClient(name = "${Push.fegin.name}", configuration={MultipartSupportConfig.class})
public interface PushFeign {
@RequestMapping(value = "/api/user/sendMessage", method = RequestMethod.POST)
CommonResponse sendMessage( @RequestBody List<PushMsgParam> responses);
@RequestMapping(value = "/api/user/sendMessageone", method = RequestMethod.POST)
CommonResponse sendMessageone( @RequestBody PushMsgParam responses);
@RequestMapping(value = "/api/user/pushNoticeMany", method = RequestMethod.POST)
CommonResponse pushNoticeMany( @RequestBody PushMsgParam responses);
@RequestMapping(value = "/api/user/buildPushPayload", method = RequestMethod.POST)
CommonResponse buildPushPayload( @RequestBody PushMsgParam responses);
@RequestMapping(value = "/api/user/pushDevice", method = RequestMethod.GET)
CommonResponse PushDevice( @RequestParam("alias") String alias);
@RequestMapping(value = "/api/user/PushDeviceRegistration", method = RequestMethod.GET)
CommonResponse PushDeviceRegistration( @RequestParam("registrationId") String registrationId,@RequestParam("alias") String alias);
}
package com.yeejoin.amos.patrol.service.remote.feign;
import com.yeejoin.amos.patrol.service.business.util.CacheFactory;
import com.yeejoin.amos.patrol.service.business.util.CacheMap;
import com.yeejoin.amos.patrol.service.business.util.Toke;
import feign.RequestInterceptor;
import feign.RequestTemplate;
import org.springframework.util.ObjectUtils;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.util.Enumeration;
/**
* @Author: xinglei
* @Description: Feign请求拦截器(设置请求头,传递登录信息)
* @Date: 2020/4/8 10:59
*/
public class RequestContextListener implements RequestInterceptor {
@Override
public void apply(RequestTemplate template) {
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder
.getRequestAttributes();
if (attributes != null) {
HttpServletRequest request = attributes.getRequest();
Enumeration<String> headerNames = request.getHeaderNames();
if (headerNames != null) {
while (headerNames.hasMoreElements()) {
String name = headerNames.nextElement();
String values = request.getHeader(name);
template.header(name, values);
}
}
} else {
//获取缓存
CacheMap cacheMap= CacheFactory.newChacheMap();
Toke toke= cacheMap.getValue("TOKE");
if (!ObjectUtils.isEmpty(toke)){
template.header("token", toke.getToke());
template.header("appKey", toke.getAppKey());
template.header("product", toke.getProduct());
}
}
}
}
......@@ -6,8 +6,9 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import com.yeejoin.amos.patrol.common.entity.CommonResponse;
import com.yeejoin.amos.patrol.service.remote.feign.MultipartSupportConfig;
@FeignClient(name = "AmosWebsocket",fallback=AmosWsClientFallback.class)
@FeignClient(name = "AmosWebsocket", configuration={MultipartSupportConfig.class},fallback=AmosWsClientFallback.class)
public interface AmosWsClient {
@PostMapping("/generic/sendMessage")
......
......@@ -9,14 +9,18 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.core.env.Environment;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.web.client.RestTemplate;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
/**
......@@ -43,6 +47,14 @@ public class YeeAMOSPatrolStart {
private static final Logger logger = LoggerFactory.getLogger(YeeAMOSPatrolStart.class);
@Bean
@LoadBalanced
RestTemplate initRestTemplate() {
return new RestTemplate();
}
/**
* 启动amosop-server
*/
......
#\u7aef\u53e3
server.port=9000
#springcloud\u914d\u7f6e
eureka.client.serviceUrl.defaultZone=http://172.16.10.72:10001/eureka/
eureka.client.serviceUrl.defaultZone=http://172.16.10.175:10001/eureka/
eureka.client.register-with-eureka=true
eureka.client.fetch-registry=true
eureka.client.healthcheck.enabled=true
......@@ -12,10 +11,14 @@ ribbon.ReadTimeout=60000
ribbon.OkToRetryOnAllOperations=true
ribbon.MaxAutoRetriesNextServer=2
ribbon.MaxAutoRetries=1
server.port=9001
#\u6570\u636e\u5e93\u914d\u7f6e
spring.datasource.url=jdbc:mysql://172.16.10.66:3306/amos_xian_bank?useSSL=false&&allowMultiQueries=true&serverTimezone=GMT&characterEncoding=utf8
#spring.datasource.url=jdbc:mysql://172.16.10.66:3306/amos_xian_bank?useSSL=false&&allowMultiQueries=true&serverTimezone=GMT&characterEncoding=utf8
#spring.datasource.username=root
#spring.datasource.password=root_123
spring.datasource.url=jdbc:mysql://172.16.10.101:3306/amos_xian_bank?useSSL=false&&allowMultiQueries=true&serverTimezone=GMT%2b8&characterEncoding=utf8
spring.datasource.username=root
spring.datasource.password=root_123
......@@ -39,6 +42,8 @@ security.productWeb=YH-PATROL_WEB
security.appKeyWeb=YH-PATROL
security.productApp=YH-PATROL_APP
security.appKeyApp=YH-PATROL
AmosBank.fegin.name=AmosBank-xian12238
Security.fegin.name=AMOS-API-PRIVILEGE
#redis\u914d\u7f6e
spring.redis.database=1
......@@ -74,6 +79,8 @@ spring.mail.properties.mail.smtp.starttls.required=true
spring.mail.properties.mail.smtp.ssl.enable=true
mail.fromMail.addr=amospm@yeejoin.com
management.health.mail.enabled=false
#\u6781\u5149\u63a8\u9001\u914d\u7f6e
params.isPush=true
#params.jpush.appKey=1b3f7b961200f4b236811dfe
......@@ -84,7 +91,7 @@ params.isPush=true
#\u5b89\u5168\u670d\u52a1\u540d\u79f0\uff08\u6ce8\u518c\u4e2d\u5fc3\u540d\u79f0\uff09
#security.fegin.name=AmosSecurity-xjZjt
#websocket\u670d\u52a1\u5730\u5740
params.remoteWebsocketUrl=http://47.108.89.109:10600/
params.remoteWebsocketUrl=http://172.16.10.101:10600/
#\u5de5\u4f5c\u6d41\u5730\u5740
#params.work.flow.address=
#\u4ea4\u5927\u670d\u52a1\u5730\u5740
......@@ -97,4 +104,4 @@ params.token=http://yeejoin.3322.org:3302/demo.html?token=
spring.servlet.multipart.max-file-size=10480000
spring.http.multipart.MaxRequestSize=50480000
upload.root.path=C:/upload
upload.server.address=http://172.16.11.12:9999/
\ No newline at end of file
upload.server.address=http://172.16.3.41:9999/
\ No newline at end of file
#\u7aef\u53e3
server.port=9001
server.port=9000
#springcloud\u914d\u7f6e
eureka.client.serviceUrl.defaultZone=http://172.16.10.72:10001/eureka/
eureka.client.register-with-eureka=true
......@@ -21,7 +21,7 @@ eureka.instance.metadata-map.management.context-path=/actuator
eureka.instance.status-page-url=http://172.16.11.20:${server.port}/actuator/info
#\u6570\u636e\u5e93\u914d\u7f6e
spring.datasource.url=jdbc:mysql://172.16.10.66:3306/amos_xian_bank?useSSL=false&&allowMultiQueries=true&serverTimezone=GMT&characterEncoding=utf8
spring.datasource.url=jdbc:mysql://172.16.10.66:3306/amos_xian_bank?useSSL=false&&allowMultiQueries=true&serverTimezone=GMT%2b8&characterEncoding=utf8
spring.datasource.username=root
spring.datasource.password=root_123
......@@ -41,23 +41,24 @@ mybatis.configuration.mapUnderscoreToCamelCase=true
security.password=tw123456
security.loginId=tw3
security.productWeb=YH-PATROL2_WEB
security.appKeyWeb=YH-PATROL2
security.productApp=YH-PATROL2_APP
security.appKeyApp=YH-PATROL2
security.productWeb=YH-PATROL_WEB
security.appKeyWeb=YH-PATROL
security.productApp=YH-PATROL_APP
security.appKeyApp=YH-PATROL
#redis
spring.redis.database=3
spring.redis.host=127.0.0.1
spring.redis.port=6379
spring.redis.password=1234560
spring.redis.password=
spring.redis.jedis.pool.max-active=200
spring.redis.jedis.pool.max-wait=-1
spring.redis.jedis.pool.max-idle=10
spring.redis.jedis.pool.min-idle=0
spring.redis.timeout=1000
AmosBank.fegin.name=AmosBank-xian12238
Security.fegin.name=AMOS-API-PRIVILEGE
spring.jackson.serialization.write-dates-as-timestamps=true
#liquibase
......
server.port=9000
spring.application.name=YeeAMOSPatrol-zjt9999
spring.profiles.active=dev
#spring.profiles.active = prod
spring.jackson.time-zone=GMT+8
spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
AmosBank.fegin.name=AmosBank-xian12238
AmosRisk.fegin.name=YeeAmosRiskMode-237
\ No newline at end of file
#spring.application.name=bank-api-patrol
spring.application.name=YEEAMOSPATROL-2378
#server.port=9001
#spring.profiles.active=dev
spring.profiles.active = prod
spring.jackson.dateFormat=yyyy-MM-dd HH:mm:ss
AmosRisk.fegin.name=YeeAmosRiskMode-237
Push.fegin.name=AppMessagePushService15
\ No newline at end of file
......@@ -12,7 +12,7 @@
a.route_point_item_id as routePointItemId,
a.id as checkInputId,
b.point_id as pointId,
b.route_id as route_id,
b.route_id as routeId,
c.point_classify_id as pointClassifyId,
e.evaluate_id as evaluateId
from
......
......@@ -52,7 +52,7 @@
p_catalog_tree a
<trim prefix="WHERE" prefixOverrides="AND ">
<if test="name!=null"> and a.name like concat(concat("%",#{name}),"%") </if>
<if test="parentId!=null"> and a.parentId = #{parentId} </if>
<if test="parentId!=null"> and a.parent_id = #{parentId} </if>
<if test="orgCode!=null"> and a.org_Code like concat(#{orgCode},"%")</if>
</trim>
order by a.id desc
......
......@@ -1193,7 +1193,7 @@
FROM
`p_check` a
<trim prefix="WHERE" prefixOverrides="AND ">
<if test="orgCode!=null">and a.org_code like #{orgCode}</if>
<if test="orgCode!=null">and a.org_code like concat(#{orgCode},"%")</if>
<if test="pointId!=null">and a.point_id = #{pointId}</if>
</trim>
GROUP BY
......@@ -1845,15 +1845,19 @@
<result property="pointInputitemName" column="pointInputitemName"/>
<result property="pointInputitemId" column="pointInputitemId"/>
<result property="checkInputitemId" column="checkInputitemId"/>
<result property="pointClassifyId" column="pointClassifyId"/>
</resultMap>
<select id="queryPointInputBu" resultMap="CheckInputBuMap">
SELECT
pci.is_ok inputStatus,
pii.`name` pointInputitemName,
pii.id pointInputitemId,
pci.id checkInputitemId
ppi.id pointInputitemId,
pci.id checkInputitemId,
pci.point_classify_id pointClassifyId
FROM
`p_check_input` pci
LEFT join p_check pc on pc.id = pci.check_id
LEFT JOIN p_point_inputitem ppi on ppi.point_id = pc.point_id and input_item_id = pci.input_id
LEFT JOIN p_input_item pii ON pii.id = pci.input_id
WHERE
pci.check_id = #{checkId}
......
......@@ -89,7 +89,7 @@
<if test="itemNo!=null"> and a.item_no like concat(concat("%",#{itemNo}),"%")</if>
<if test="isScore!=null"> and a.is_Score = #{isScore}</if>
<if test="itemType!=null"> and a.item_Type = #{itemType} </if>
<if test="level!=null"> and a.level = #{level} </if>
<if test="level!=null"> and a.level = #{level} </if>
<if test="orgCode!=null"> and a.org_Code like concat(#{orgCode},"%") </if>
<if test="catalogId > 0 "> and a.catalog_id = #{catalogId}</if>
<!-- <choose>
......
......@@ -749,7 +749,7 @@
LEFT JOIN p_point_classify ppc ON ppc.point_id = p.id
WHERE 1=1 and p.is_delete='0'
<if test="orgCode !=null and orgCode !=''">
and p.org_code = #{orgCode}
and p.org_code like concat(#{orgCode},"%")
</if>
<if test="pointNo !=null and pointNo !=''">
and p.point_no like concat(concat("%",#{pointNo}),"%")
......
......@@ -179,7 +179,7 @@
</delete>
<select id="queryRouteListByOrgCode" resultType="Map">
<if test="userId != null and userId != ''">
SELECT
DISTINCT
r.id,
......@@ -187,11 +187,16 @@
FROM
p_plan ppl
LEFT JOIN p_route r ON r.id = ppl.route_id
WHERE
find_in_set(#{userId}, ppl.user_id) > 0
WHERE 1=1
<if test="userId != null and userId != ''">
and find_in_set(#{userId}, ppl.user_id) > 0
</if>
AND r.is_delete = 0
</if>
<if test="(orgCode != null and orgCode != '') or (deptId != null and deptId != '')">
<if test="orgCode != null and orgCode != ''">
AND r.org_code like CONCAT(#{orgCode}, '%')
</if>
<!-- <if test="(orgCode != null and orgCode != '') or (deptId != null and deptId != '')">
<if test="userId != null and userId != ''">
UNION
</if>
......@@ -209,7 +214,7 @@
AND r.dept_id = #{deptId}
</if>
AND r.is_delete = 0
</if>
</if> -->
<!-- SELECT r.id, r.`name` FROM p_route r where 1 =1 and r.org_code like #{orgCode} and r.is_delete = 0 -->
</select>
......@@ -222,7 +227,7 @@
where 1=1
AND p.is_delete = 0
AND rp.route_id = #{routeId}
AND p.org_code = #{orgCode}
AND p.org_code like CONCAT(#{orgCode}, '%')
</select>
<select id="queryRoutePoints" resultType="Map">
SELECT
......@@ -301,7 +306,7 @@
where 1=1
AND p.is_delete = 0
AND rp.route_id = #{routeId}
AND p.org_code = #{orgCode}
AND p.org_code like CONCAT(#{orgCode}, '%')
order by rp.order_no
<if test="pointNo != null and pointNo != ''">and p.point_no like CONCAT('%', #{pointNo}, '%')</if>
<if test="name != null and name != ''">and p.name like CONCAT('%', #{name}, '%')</if>
......
......@@ -69,6 +69,14 @@
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>1.1.10</version>
</dependency>
<!-- Swagger2模块 -->
<dependency>
<groupId>io.springfox</groupId>
......@@ -359,6 +367,19 @@
<name>maven-snapshot</name>
<url>http://repo.typroject.org:8081/repository/maven-snapshots/</url>
</repository>
<!-- <repository>
<id>maven-public</id>
<name>maven-public</name>
<url>http://repo.typroject.org:8081/repository/maven-public/</url>
</repository>
<repository>
<id>maven-snapshot</id>
<name>maven-snapshot</name>
<url>http://repo.typroject.org:8081/repository/maven-snapshots/</url>
</repository> -->
</repositories>
<pluginRepositories>
<pluginRepository>
......
人民银行巡检项目。
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment