Commit 9d972b38 authored by xinglei's avatar xinglei

*) 新增月度巡检功能

parent 126bcbb1
package com.yeejoin.amos.patrol.common.entity;
import net.sf.cglib.beans.BeanGenerator;
import net.sf.cglib.beans.BeanMap;
import java.util.Map;
/**
* @Author: xinglei
* @Description:
* @Date: 2020/8/20 20:43
*/
public class DynamicBean {
private Object target;
private BeanMap beanMap;
public DynamicBean(Class superclass, Map<String, Class> propertyMap) {
this.target = generateBean(superclass, propertyMap);
this.beanMap = BeanMap.create(this.target);
}
public void setValue(String property, Object value) {
beanMap.put(property, value);
}
public Object getValue(String property) {
return beanMap.get(property);
}
public Object getTarget() {
return this.target;
}
/**
* 根据属性生成对象
*
*/
private Object generateBean(Class superclass, Map<String, Class> propertyMap) {
BeanGenerator generator = new BeanGenerator();
if (null != superclass) {
generator.setSuperclass(superclass);
}
BeanGenerator.addProperties(generator, propertyMap);
return generator.create();
}
}
package com.yeejoin.amos.patrol.common.enums;
public enum DeptEnum {
XA_JS("西安技术", "XAJS"),
XA_YW("西安业务", "XAYW"),
XY_YW("咸阳技术", "XYJS");
/**
* 名称,描述
*/
private String name;
/**
* 编码
*/
private String code;
DeptEnum(String name, String code) {
this.name = name;
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public static String getEnumCode(String name) {
String code = "";
for(DeptEnum type: DeptEnum.values()) {
if (type.getName().equals(name)) {
code = type.getCode();
break;
}
}
return code;
}
}
package com.yeejoin.amos.patrol.common.enums;
public enum ExcelEnum {
BUSINESS("business", "temp/businessExportTemplate.xls"),
TECHNOLOGY("technology", "temp/technologyExportTemplate.xls");
/**
* 名称,描述
*/
private String type;
/**
* 编码
*/
private String desc;
ExcelEnum(String type, String desc) {
this.type = type;
this.desc = desc;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public static String getEnumDesc(String type) {
String desc = "";
for(ExcelEnum label: ExcelEnum.values()) {
if (label.getType().equals(type)) {
desc = label.getDesc();
break;
}
}
return desc;
}
}
...@@ -28,18 +28,6 @@ ...@@ -28,18 +28,6 @@
<version>2.4</version> <version>2.4</version>
<classifier>jdk15</classifier> <classifier>jdk15</classifier>
</dependency> </dependency>
<!-- <dependency>
<groupId>com.netflix.feign</groupId>
<artifactId>feign-core</artifactId>
<version>8.18.0</version>
<scope>runtime</scope>
</dependency> -->
<!-- <dependency>
<groupId>com.netflix.feign</groupId>
<artifactId>feign-gson</artifactId>
<version>8.18.0</version>
<scope>runtime</scope>
</dependency> -->
</dependencies> </dependencies>
</project> </project>
\ No newline at end of file
...@@ -4,109 +4,130 @@ import java.util.Date; ...@@ -4,109 +4,130 @@ import java.util.Date;
/** /**
* 巡检记录项Bo * 巡检记录项Bo
* @author tianbo
* *
* @author tianbo
*/ */
public class CheckInputBo { public class CheckInputBo {
/** /**
* 检查项名称 * 巡检点ID
*/ */
private String inputItemName; private String pointId;
/** /**
* 检查结果 * 巡检点名称
*/ */
private String inputValue; private String pointName;
/** private String orgCode;
* 是否合格 private String checkDate;
*/ private String beginTime;
private String isOK; /**
* 开始时间字符串
/** */
* 上报时间 private String beginTimeStr;
*/ /**
private Date uploadTime; * 计划ID-状态
*/
private String idStateStr;
/**
* 检查项名称
*/
private String inputItemName;
/**
* 检查结果
*/
private String inputValue;
/**
* 是否合格
*/
private String isOK;
/**
* 上报时间
*/
private Date uploadTime;
// /** // /**
// * 任务状态:0未完成,1已完成 // * 任务状态:0未完成,1已完成
// */ // */
// private int taskStats; // private int taskStats;
/** /**
* 任务执行人 * 任务执行人
*/ */
private String executor; private String executor;
/** /**
* 检查项评分 * 检查项评分
*/ */
private String inputItemScore; private String inputItemScore;
/** /**
* 分类ID * 分类ID
*/ */
private long classifyId; private long classifyId;
/** /**
* 分类名称 * 分类名称
*/ */
private String classifyName; private String classifyName;
/** /**
* 巡检记录检查项检查结果ID * 巡检记录检查项检查结果ID
*/ */
private long checkInputId; private long checkInputId;
/** /**
* 检查项ID * 检查项ID
*/ */
private String inputId; private String inputId;
// 备注说明 // 备注说明
private String remark; private String remark;
private int imgCount; private int imgCount;
public String getInputItemName() { public String getInputItemName() {
return inputItemName; return inputItemName;
} }
public void setInputItemName(String inputItemName) { public void setInputItemName(String inputItemName) {
this.inputItemName = inputItemName; this.inputItemName = inputItemName;
} }
public String getInputValue() { public String getInputValue() {
return inputValue; return inputValue;
} }
public void setInputValue(String inputValue) { public void setInputValue(String inputValue) {
this.inputValue = inputValue; this.inputValue = inputValue;
} }
public String getIsOK() { public String getIsOK() {
return isOK; return isOK;
} }
public void setIsOK(String isOK) { public void setIsOK(String isOK) {
this.isOK = isOK; this.isOK = isOK;
} }
public Date getUploadTime() { public Date getUploadTime() {
return uploadTime; return uploadTime;
} }
public void setUploadTime(Date uploadTime) { public void setUploadTime(Date uploadTime) {
this.uploadTime = uploadTime; this.uploadTime = uploadTime;
} }
// public int getTaskStats() { // public int getTaskStats() {
// return taskStats; // return taskStats;
...@@ -116,71 +137,126 @@ public class CheckInputBo { ...@@ -116,71 +137,126 @@ public class CheckInputBo {
// this.taskStats = taskStats; // this.taskStats = taskStats;
// } // }
public String getExecutor() { public String getExecutor() {
return executor; return executor;
} }
public void setExecutor(String executor) {
this.executor = executor;
}
public String getInputItemScore() {
return inputItemScore;
}
public void setInputItemScore(String inputItemScore) {
this.inputItemScore = inputItemScore;
}
public long getClassifyId() {
return classifyId;
}
public void setClassifyId(long classifyId) {
this.classifyId = classifyId;
}
public String getClassifyName() {
return classifyName;
}
public void setClassifyName(String classifyName) {
this.classifyName = classifyName;
}
public long getCheckInputId() {
return checkInputId;
}
public void setCheckInputId(long checkInputId) {
this.checkInputId = checkInputId;
}
public String getInputId() {
return inputId;
}
public void setInputId(String inputId) {
this.inputId = inputId;
}
public void setExecutor(String executor) { public String getRemark() {
this.executor = executor; return remark;
} }
public String getInputItemScore() { public void setRemark(String remark) {
return inputItemScore; this.remark = remark;
} }
public void setInputItemScore(String inputItemScore) { public int getImgCount() {
this.inputItemScore = inputItemScore; return imgCount;
} }
public long getClassifyId() { public void setImgCount(int imgCount) {
return classifyId; this.imgCount = imgCount;
} }
public void setClassifyId(long classifyId) { public String getPointId() {
this.classifyId = classifyId; return pointId;
} }
public String getClassifyName() { public void setPointId(String pointId) {
return classifyName; this.pointId = pointId;
} }
public void setClassifyName(String classifyName) { public String getPointName() {
this.classifyName = classifyName; return pointName;
} }
public long getCheckInputId() { public void setPointName(String pointName) {
return checkInputId; this.pointName = pointName;
} }
public void setCheckInputId(long checkInputId) { public String getOrgCode() {
this.checkInputId = checkInputId; return orgCode;
} }
public void setOrgCode(String orgCode) {
this.orgCode = orgCode;
}
public String getInputId() { public String getCheckDate() {
return inputId; return checkDate;
} }
public void setInputId(String inputId) { public void setCheckDate(String checkDate) {
this.inputId = inputId; this.checkDate = checkDate;
} }
public String getBeginTime() {
return beginTime;
}
public String getRemark() { public void setBeginTime(String beginTime) {
return remark; this.beginTime = beginTime;
} }
public void setRemark(String remark) { public String getBeginTimeStr() {
this.remark = remark; return beginTimeStr;
} }
public int getImgCount() { public void setBeginTimeStr(String beginTimeStr) {
return imgCount; this.beginTimeStr = beginTimeStr;
} }
public void setImgCount(int imgCount) { public String getIdStateStr() {
this.imgCount = imgCount; return idStateStr;
} }
public void setIdStateStr(String idStateStr) {
this.idStateStr = idStateStr;
}
} }
...@@ -99,7 +99,6 @@ public class ExcelExportController extends BaseController { ...@@ -99,7 +99,6 @@ public class ExcelExportController extends BaseController {
private void writToResponse(Map data, HttpServletResponse response, String templateFileName, String outFileName) throws Exception { private void writToResponse(Map data, HttpServletResponse response, String templateFileName, String outFileName) throws Exception {
Resource resource = new ClassPathResource(templateFileName); Resource resource = new ClassPathResource(templateFileName);
File file = resource.getFile(); File file = resource.getFile();
TemplateExportParams params = new TemplateExportParams(file.getAbsolutePath(), true); TemplateExportParams params = new TemplateExportParams(file.getAbsolutePath(), true);
ByteArrayOutputStream bout = new ByteArrayOutputStream(); ByteArrayOutputStream bout = new ByteArrayOutputStream();
...@@ -113,6 +112,4 @@ public class ExcelExportController extends BaseController { ...@@ -113,6 +112,4 @@ public class ExcelExportController extends BaseController {
response.getOutputStream().flush(); response.getOutputStream().flush();
response.getOutputStream().close(); response.getOutputStream().close();
} }
} }
...@@ -29,6 +29,10 @@ public interface CheckMapper extends BaseMapper { ...@@ -29,6 +29,10 @@ public interface CheckMapper extends BaseMapper {
List<CheckInfoVo> getCheckInfo(CheckInfoPageParam param); List<CheckInfoVo> getCheckInfo(CheckInfoPageParam param);
List<CheckInputBo> getCheckInfoGroup(CheckInfoPageParam param);
List<CheckInputBo> getCheckInfoGroupCheckDate(CheckInfoPageParam param);
List<Map> queryUnqualifiedInputItem(@Param(value = "checkId") int checkId); List<Map> queryUnqualifiedInputItem(@Param(value = "checkId") int checkId);
List<Map> queryCheckPointInputItem(@Param(value = "planTaskId") int planTaskId, @Param(value = "pointId") int pointId); List<Map> queryCheckPointInputItem(@Param(value = "planTaskId") int planTaskId, @Param(value = "pointId") int pointId);
...@@ -227,6 +231,20 @@ public interface CheckMapper extends BaseMapper { ...@@ -227,6 +231,20 @@ public interface CheckMapper extends BaseMapper {
List<CheckAnalysisVo> getCheckStatisticalAnalysis(CheckStatisticalParam param); List<CheckAnalysisVo> getCheckStatisticalAnalysis(CheckStatisticalParam param);
/** /**
* 月度巡检情况(巡检点)
*
* @param param
* @return
*/
List<CheckAnalysisVo> getCheckStatisticalByCheck(CheckStatisticalParam param);
/**
* 月度巡检情况(巡检计划)
*
* @param param
* @return
*/
List<CheckAnalysisVo> getCheckStatisticalByPlanTask(CheckStatisticalParam param);
/**
* 根据orgCode查询公司累计巡检次数 * 根据orgCode查询公司累计巡检次数
* *
* @param loginOrgCode * @param loginOrgCode
......
...@@ -41,7 +41,6 @@ public class CheckInfoPageParam extends CommonPageable { ...@@ -41,7 +41,6 @@ public class CheckInfoPageParam extends CommonPageable {
* 点分类 0-移动 1-固定 * 点分类 0-移动 1-固定
*/ */
private String isFixed; private String isFixed;
/** /**
* 执行情况:0-计划外完成 1-按时完成 * 执行情况:0-计划外完成 1-按时完成
*/ */
...@@ -54,7 +53,6 @@ public class CheckInfoPageParam extends CommonPageable { ...@@ -54,7 +53,6 @@ public class CheckInfoPageParam extends CommonPageable {
* 所属计划 * 所属计划
*/ */
private String planId; private String planId;
/** /**
* 所属路线 * 所属路线
*/ */
...@@ -64,25 +62,25 @@ public class CheckInfoPageParam extends CommonPageable { ...@@ -64,25 +62,25 @@ public class CheckInfoPageParam extends CommonPageable {
* 机构 * 机构
*/ */
private String orgCode; private String orgCode;
/** /**
* 分类id * 分类id
*/ */
private String catalogId; private String catalogId;
private String orderBy ; private String orderBy ;
/** /**
* 部门id * 部门id
*/ */
private String departmentId; private String departmentId;
/** /**
* 其他部门人员id集合 * 其他部门人员id集合
*/ */
private List ids; private List ids;
/**
* 模板类型
*/
private String statement;
public String getOrderBy() { public String getOrderBy() {
return orderBy; return orderBy;
} }
...@@ -219,4 +217,11 @@ public class CheckInfoPageParam extends CommonPageable { ...@@ -219,4 +217,11 @@ public class CheckInfoPageParam extends CommonPageable {
this.ids = ids; this.ids = ids;
} }
public String getStatement() {
return statement;
}
public void setStatement(String statement) {
this.statement = statement;
}
} }
...@@ -13,6 +13,7 @@ public class CheckStatisticalParam { ...@@ -13,6 +13,7 @@ public class CheckStatisticalParam {
private String startTime; private String startTime;
private String endTime; private String endTime;
private String orgCode; private String orgCode;
private String queryMonth;
public String getOrgCode() { public String getOrgCode() {
return orgCode; return orgCode;
...@@ -86,6 +87,12 @@ public class CheckStatisticalParam { ...@@ -86,6 +87,12 @@ public class CheckStatisticalParam {
public void setEndTime(String endTime) { public void setEndTime(String endTime) {
this.endTime = endTime; this.endTime = endTime;
} }
public String getQueryMonth() {
return queryMonth;
}
public void setQueryMonth(String queryMonth) {
this.queryMonth = queryMonth;
}
} }
...@@ -28,7 +28,9 @@ import com.yeejoin.amos.patrol.service.business.vo.CheckInfoVo; ...@@ -28,7 +28,9 @@ import com.yeejoin.amos.patrol.service.business.vo.CheckInfoVo;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap; import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -193,7 +195,6 @@ public interface ICheckService { ...@@ -193,7 +195,6 @@ public interface ICheckService {
* @return * @return
*/ */
QueryCriteriaRespone findCheckSystemInit(String toke,String product,String appKey,String type, String orgCode, String roleTypeName, String departmentId, String companyId); QueryCriteriaRespone findCheckSystemInit(String toke,String product,String appKey,String type, String orgCode, String roleTypeName, String departmentId, String companyId);
/** /**
* 巡检记录查询 * 巡检记录查询
* *
...@@ -203,14 +204,12 @@ public interface ICheckService { ...@@ -203,14 +204,12 @@ public interface ICheckService {
Page<CheckInfoBo> getCheckInfoList(CheckInfoListPageParam params); Page<CheckInfoBo> getCheckInfoList(CheckInfoListPageParam params);
Page<PointCheckInfoRespone> getCheckInfoList1(CheckInfoListPageParam params); Page<PointCheckInfoRespone> getCheckInfoList1(CheckInfoListPageParam params);
/** /**
* 视图模块初始化数据 * 视图模块初始化数据
* *
* @return * @return
*/ */
public GraphInitDataResponse getViewModuleInitData(); public GraphInitDataResponse getViewModuleInitData();
/** /**
* 巡检情况统计分析 * 巡检情况统计分析
* *
...@@ -218,7 +217,13 @@ public interface ICheckService { ...@@ -218,7 +217,13 @@ public interface ICheckService {
* @return * @return
*/ */
List<CheckAnalysisVo> getCheckStatisticalAnalysis(String toke,String product,String appKey,CheckStatisticalParam queryRequests); List<CheckAnalysisVo> getCheckStatisticalAnalysis(String toke,String product,String appKey,CheckStatisticalParam queryRequests);
/**
* 月度巡检情况
*
* @param queryRequests
* @return
*/
Map<String, Object> getCheckStatisticalByMonth(String toke, String product, String appKey, CheckStatisticalParam queryRequests, String companyId);
/** /**
* 根据orgcODE获取巡检累计个数 * 根据orgcODE获取巡检累计个数
* *
...@@ -226,7 +231,6 @@ public interface ICheckService { ...@@ -226,7 +231,6 @@ public interface ICheckService {
* @return * @return
*/ */
long getCumulativeCheckCountByOrgCode(String loginOrgCode); long getCumulativeCheckCountByOrgCode(String loginOrgCode);
/** /**
* 根据条件查询日巡检统计情况 * 根据条件查询日巡检统计情况
* *
...@@ -240,4 +244,6 @@ public interface ICheckService { ...@@ -240,4 +244,6 @@ public interface ICheckService {
List<String> getLivePhotos(Long checkID); List<String> getLivePhotos(Long checkID);
List<String> getCheckPhotosByCheckAndInputIdAndClassifyId(int checkId, int checkInputId, int classifyId); List<String> getCheckPhotosByCheckAndInputIdAndClassifyId(int checkId, int checkInputId, int classifyId);
void getCheckInfoListResult(String toke,String product,String appKey,CheckInfoPageParam param, HttpServletResponse response);
} }
...@@ -52,6 +52,10 @@ public class CheckPageParamUtil { ...@@ -52,6 +52,10 @@ public class CheckPageParamUtil {
param.setDepartmentId(toString(queryRequests.get(i).getValue())); param.setDepartmentId(toString(queryRequests.get(i).getValue()));
} else if ("planId".equals(name)) { } else if ("planId".equals(name)) {
param.setPlanId(toString(queryRequests.get(i).getValue())); param.setPlanId(toString(queryRequests.get(i).getValue()));
} else if ("deptId".equals(name)) {
param.setDepartmentId(toString(queryRequests.get(i).getValue()));
} else if ("statement".equals(name)) {
param.setStatement(toString(queryRequests.get(i).getValue()));
} }
} }
if (param.getBeginDate() != null && param.getEndDate() == null) { if (param.getBeginDate() != null && param.getEndDate() == null) {
......
...@@ -21,6 +21,7 @@ public class CheckAnalysisVo { ...@@ -21,6 +21,7 @@ public class CheckAnalysisVo {
private String missedRate; private String missedRate;
@Excel(name = "不合格率%", orderNum = "8") @Excel(name = "不合格率%", orderNum = "8")
private String faildRate; private String faildRate;
private String checkTime;
public String getName() { public String getName() {
return name; return name;
} }
...@@ -75,7 +76,12 @@ public class CheckAnalysisVo { ...@@ -75,7 +76,12 @@ public class CheckAnalysisVo {
public void setFaildRate(String faildRate) { public void setFaildRate(String faildRate) {
this.faildRate = faildRate; this.faildRate = faildRate;
} }
public String getCheckTime() {
return checkTime;
}
public void setCheckTime(String checkTime) {
this.checkTime = checkTime;
}
} }
...@@ -2,6 +2,9 @@ package com.yeejoin.amos.patrol.service.business.vo; ...@@ -2,6 +2,9 @@ package com.yeejoin.amos.patrol.service.business.vo;
import cn.afterturn.easypoi.excel.annotation.Excel; import cn.afterturn.easypoi.excel.annotation.Excel;
import java.util.List;
import java.util.Map;
public class CheckInfoVo { public class CheckInfoVo {
private String id; private String id;
...@@ -43,6 +46,11 @@ public class CheckInfoVo { ...@@ -43,6 +46,11 @@ public class CheckInfoVo {
private String error; private String error;
@Excel(name = "备注说明", orderNum = "14") @Excel(name = "备注说明", orderNum = "14")
private String remark; private String remark;
/**
* 检查项
*/
private Map<String, PointClassifyVo> checkInfoMap;
public String getId() { public String getId() {
return id; return id;
...@@ -171,4 +179,11 @@ public class CheckInfoVo { ...@@ -171,4 +179,11 @@ public class CheckInfoVo {
this.depId = depId; this.depId = depId;
} }
public Map<String, PointClassifyVo> getCheckInfoMap() {
return checkInfoMap;
}
public void setCheckInfoMap(Map<String, PointClassifyVo> checkInfoMap) {
this.checkInfoMap = checkInfoMap;
}
} }
...@@ -405,4 +405,9 @@ public class XJConstant { ...@@ -405,4 +405,9 @@ public class XJConstant {
public static final String INPUT_ITEM_XEXT= "小额"; public static final String INPUT_ITEM_XEXT= "小额";
public static final String INPUT_ITEM_WYXT = "网银"; public static final String INPUT_ITEM_WYXT = "网银";
public static final String INPUT_ITEM_JWXT = "境外"; public static final String INPUT_ITEM_JWXT = "境外";
public static final String PLANTASK_COUNT = "planTaskCount";
public static final String CHECK_COUNT = "checkCount";
public static final String MISSED = "missed";
public static final String FAILD = "faild";
} }
...@@ -6,9 +6,7 @@ import java.text.ParsePosition; ...@@ -6,9 +6,7 @@ import java.text.ParsePosition;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.Period; import java.time.Period;
import java.util.Calendar; import java.util.*;
import java.util.Date;
import java.util.TimeZone;
import com.yeejoin.amos.patrol.service.exception.YeeException; import com.yeejoin.amos.patrol.service.exception.YeeException;
...@@ -25,6 +23,9 @@ public class DateUtil { ...@@ -25,6 +23,9 @@ public class DateUtil {
public static String MID_PATTERN = "yyyy-MM-dd HH:mm"; public static String MID_PATTERN = "yyyy-MM-dd HH:mm";
public static String SHORT_PATTERN = "yyyy-MM-dd"; public static String SHORT_PATTERN = "yyyy-MM-dd";
private static final SimpleDateFormat monthSdf = new SimpleDateFormat("yyyy-MM");
private static final SimpleDateFormat shortSdf = new SimpleDateFormat("yyyy-MM-dd");
private static final SimpleDateFormat longSdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
public static long THREE_DAY_MILLSEC = 259200000L; public static long THREE_DAY_MILLSEC = 259200000L;
public static long ONE_DAY_MILLSEC = 86400000L; public static long ONE_DAY_MILLSEC = 86400000L;
...@@ -632,4 +633,78 @@ public class DateUtil { ...@@ -632,4 +633,78 @@ public class DateUtil {
Date date = new Date(); Date date = new Date();
return date; return date;
} }
/**
* 获得本月的开始时间,即2012-01-01 00:00:00
*
* @return
*/
public static String getCurrentMonthStartTime(String str) {
Date now = null;
try {
Date date = monthSdf.parse(str);
Calendar c = Calendar.getInstance();
c.setTime(date);
c.set(Calendar.DATE, 1);
now = shortSdf.parse(shortSdf.format(c.getTime()) + " 00:00:00");
} catch (ParseException e) {
e.printStackTrace();
}
return longSdf.format(now);
}
/**
* 当前月的结束时间,即2012-01-31 23:59:59
*
* @return
*/
public static String getCurrentMonthEndTime(String str) {
Date now = null;
try {
Date date = monthSdf.parse(str);
Calendar c = Calendar.getInstance();
c.setTime(date);
c.set(Calendar.DATE, 1);
c.add(Calendar.MONTH, 1);
c.add(Calendar.DATE, -1);
now = longSdf.parse(shortSdf.format(c.getTime()) + " 23:59:59");
} catch (ParseException e) {
e.printStackTrace();
}
return longSdf.format(now);
}
/**
* 获取某月的日期List
*
* @return
*/
public static List<String> getDayByMonth(String startDate, String endDate) {
List list = new ArrayList();
try {
long startTime = shortSdf.parse(startDate).getTime();
long endTime = shortSdf.parse(endDate).getTime();
long day = 1000 * 60 * 60 * 24;
for (long i = startTime; i <= endTime; i += day) {
list.add(shortSdf.format(new Date(i)));
}
} catch (ParseException e) {
e.printStackTrace();
}
return list;
}
public static Date strToDateShort(String dateStr) {
try {
return monthSdf.parse(dateStr);
} catch (ParseException e) {
e.printStackTrace();
}
return null;
}
//日期返回时分秒
public static String splitDate(String Date){
return Date.substring(11, Date.length());
}
} }
package com.yeejoin.amos.patrol.service.core.util;
import com.google.common.collect.Maps;
import com.yeejoin.amos.patrol.common.entity.DynamicBean;
import org.apache.commons.beanutils.PropertyUtilsBean;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.beans.PropertyDescriptor;
import java.util.Date;
import java.util.Map;
/**
* @Author: xinglei
* @Description:
* @Date: 2020/8/20 20:10
*/
public class ReflectUtil {
private static Logger logger = LoggerFactory.getLogger(ReflectUtil.class);
public static Object getObject(Object dest, Map<String, Object> addProperties) {
PropertyUtilsBean propertyUtilsBean = new PropertyUtilsBean();
PropertyDescriptor[] descriptors = propertyUtilsBean.getPropertyDescriptors(dest);
Map<String, Class> propertyMap = Maps.newHashMap();
for (PropertyDescriptor d : descriptors) {
if (!"class".equalsIgnoreCase(d.getName())) {
propertyMap.put(d.getName(), d.getPropertyType());
}
}
addProperties.forEach((k, v) -> {
String sclass = v.getClass().toString();
if(sclass.equals("class java.util.Date")) {//对日期进行处理
propertyMap.put(k, Long.class);
}else {
propertyMap.put(k, v.getClass());
}
});
DynamicBean dynamicBean = new DynamicBean(dest.getClass(), propertyMap);
propertyMap.forEach((k, v) -> {
try {
if (!addProperties.containsKey(k)) {
dynamicBean.setValue(k, propertyUtilsBean.getNestedProperty(dest, k));
}
} catch (Exception e) {
logger.error("动态添加字段出错", e);
}
});
addProperties.forEach((k, v) -> {
try {
String sclass = v.getClass().toString();
if(sclass.equals("class java.util.Date")) {//动态添加的字段为date类型需要进行处理
Date date = (Date) v;
dynamicBean.setValue(k, date.getTime());
}else {
dynamicBean.setValue(k, v);
}
} catch (Exception e) {
logger.error("动态添加字段值出错", e);
}
});
Object obj = dynamicBean.getTarget();
return obj;
}
}
...@@ -28,7 +28,6 @@ import com.yeejoin.amos.patrol.service.business.util.Toke; ...@@ -28,7 +28,6 @@ import com.yeejoin.amos.patrol.service.business.util.Toke;
import com.yeejoin.amos.patrol.service.remote.feign.AmosBankFeign; import com.yeejoin.amos.patrol.service.remote.feign.AmosBankFeign;
import com.yeejoin.amos.patrol.service.remote.feign.IAMOSSecurityServer; import com.yeejoin.amos.patrol.service.remote.feign.IAMOSSecurityServer;
import org.apache.commons.collections4.map.LinkedMap;
//import com.yeejoin.amos.security.common.model.UserModel; //import com.yeejoin.amos.security.common.model.UserModel;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
...@@ -479,7 +478,6 @@ public class RemoteSecurityService { ...@@ -479,7 +478,6 @@ public class RemoteSecurityService {
} }
public JSONArray listDepartmentUserTree(String toke,String product,String appKey,String companyId) { public JSONArray listDepartmentUserTree(String toke,String product,String appKey,String companyId) {
RequestContext.setToken(toke); RequestContext.setToken(toke);
RequestContext.setProduct(product); RequestContext.setProduct(product);
RequestContext.setAppKey(appKey); RequestContext.setAppKey(appKey);
...@@ -495,15 +493,35 @@ public class RemoteSecurityService { ...@@ -495,15 +493,35 @@ public class RemoteSecurityService {
if (companyModel != null ) { if (companyModel != null ) {
String jsonStr =null; String jsonStr =null;
jsonStr = JSON.toJSONString(companyModel.getChildren()); jsonStr = JSON.toJSONString(companyModel.getChildren());
return JSONArray.parseArray(jsonStr); return JSONArray.parseArray(jsonStr);
} }
return null; return null;
} }
/**
* 查询公司名称
* @return
*/
public String getCompanyName(String toke,String product,String appKey,String companyId) {
String companyName = null;
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
CompanyModel companyModel=null;
FeignClientResult feignClientResult;
try {
feignClientResult = Privilege.companyClient.withDeptAndUsers(Long.valueOf(companyId));
companyModel = (CompanyModel)feignClientResult.getResult();
} catch (InnerInvokException e) {
e.printStackTrace();
}
if (companyModel != null ) {
companyName = companyModel.getCompanyName();
}
return companyName;
}
public boolean editPassword(String toke,String product,String appKey,String userId, String oldPassword, String newPassword) throws InnerInvokException { public boolean editPassword(String toke,String product,String appKey,String userId, String oldPassword, String newPassword) throws InnerInvokException {
boolean flag=false; boolean flag=false;
......
...@@ -171,6 +171,11 @@ ...@@ -171,6 +171,11 @@
<version>3.3.1</version> <version>3.3.1</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>cglib</groupId>
<artifactId>cglib-nodep</artifactId>
<version>3.2.4</version>
</dependency>
<dependency>
<groupId>com.zaxxer</groupId> <groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId> <artifactId>HikariCP</artifactId>
</dependency> </dependency>
...@@ -244,11 +249,6 @@ ...@@ -244,11 +249,6 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.poi</groupId> <groupId>org.apache.poi</groupId>
<artifactId>ooxml-schemas</artifactId>
<version>1.3</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId> <artifactId>poi-ooxml</artifactId>
<version>3.14</version> <version>3.14</version>
</dependency> </dependency>
......
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