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 @@
<version>2.4</version>
<classifier>jdk15</classifier>
</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>
</project>
\ No newline at end of file
......@@ -4,109 +4,130 @@ import java.util.Date;
/**
* 巡检记录项Bo
* @author tianbo
*
* @author tianbo
*/
public class CheckInputBo {
/**
* 检查项名称
*/
private String inputItemName;
/**
* 检查结果
*/
private String inputValue;
/**
* 是否合格
*/
private String isOK;
/**
* 上报时间
*/
private Date uploadTime;
/**
* 巡检点ID
*/
private String pointId;
/**
* 巡检点名称
*/
private String pointName;
private String orgCode;
private String checkDate;
private String beginTime;
/**
* 开始时间字符串
*/
private String beginTimeStr;
/**
* 计划ID-状态
*/
private String idStateStr;
/**
* 检查项名称
*/
private String inputItemName;
/**
* 检查结果
*/
private String inputValue;
/**
* 是否合格
*/
private String isOK;
/**
* 上报时间
*/
private Date uploadTime;
// /**
// * 任务状态:0未完成,1已完成
// */
// private int taskStats;
/**
* 任务执行人
*/
private String executor;
/**
* 检查项评分
*/
private String inputItemScore;
/**
* 分类ID
*/
private long classifyId;
/**
* 分类名称
*/
private String classifyName;
/**
* 巡检记录检查项检查结果ID
*/
private long checkInputId;
/**
* 检查项ID
*/
private String inputId;
// 备注说明
private String remark;
private int imgCount;
public String getInputItemName() {
return inputItemName;
}
public void setInputItemName(String inputItemName) {
this.inputItemName = inputItemName;
}
public String getInputValue() {
return inputValue;
}
public void setInputValue(String inputValue) {
this.inputValue = inputValue;
}
public String getIsOK() {
return isOK;
}
public void setIsOK(String isOK) {
this.isOK = isOK;
}
public Date getUploadTime() {
return uploadTime;
}
public void setUploadTime(Date uploadTime) {
this.uploadTime = uploadTime;
}
/**
* 任务执行人
*/
private String executor;
/**
* 检查项评分
*/
private String inputItemScore;
/**
* 分类ID
*/
private long classifyId;
/**
* 分类名称
*/
private String classifyName;
/**
* 巡检记录检查项检查结果ID
*/
private long checkInputId;
/**
* 检查项ID
*/
private String inputId;
// 备注说明
private String remark;
private int imgCount;
public String getInputItemName() {
return inputItemName;
}
public void setInputItemName(String inputItemName) {
this.inputItemName = inputItemName;
}
public String getInputValue() {
return inputValue;
}
public void setInputValue(String inputValue) {
this.inputValue = inputValue;
}
public String getIsOK() {
return isOK;
}
public void setIsOK(String isOK) {
this.isOK = isOK;
}
public Date getUploadTime() {
return uploadTime;
}
public void setUploadTime(Date uploadTime) {
this.uploadTime = uploadTime;
}
// public int getTaskStats() {
// return taskStats;
......@@ -116,71 +137,126 @@ public class CheckInputBo {
// this.taskStats = taskStats;
// }
public String getExecutor() {
return executor;
}
public String getExecutor() {
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) {
this.executor = executor;
}
public String getRemark() {
return remark;
}
public String getInputItemScore() {
return inputItemScore;
}
public void setRemark(String remark) {
this.remark = remark;
}
public void setInputItemScore(String inputItemScore) {
this.inputItemScore = inputItemScore;
}
public int getImgCount() {
return imgCount;
}
public long getClassifyId() {
return classifyId;
}
public void setImgCount(int imgCount) {
this.imgCount = imgCount;
}
public void setClassifyId(long classifyId) {
this.classifyId = classifyId;
}
public String getPointId() {
return pointId;
}
public String getClassifyName() {
return classifyName;
}
public void setPointId(String pointId) {
this.pointId = pointId;
}
public void setClassifyName(String classifyName) {
this.classifyName = classifyName;
}
public String getPointName() {
return pointName;
}
public long getCheckInputId() {
return checkInputId;
}
public void setPointName(String pointName) {
this.pointName = pointName;
}
public void setCheckInputId(long checkInputId) {
this.checkInputId = checkInputId;
}
public String getOrgCode() {
return orgCode;
}
public void setOrgCode(String orgCode) {
this.orgCode = orgCode;
}
public String getInputId() {
return inputId;
}
public String getCheckDate() {
return checkDate;
}
public void setInputId(String inputId) {
this.inputId = inputId;
}
public void setCheckDate(String checkDate) {
this.checkDate = checkDate;
}
public String getBeginTime() {
return beginTime;
}
public String getRemark() {
return remark;
}
public void setBeginTime(String beginTime) {
this.beginTime = beginTime;
}
public void setRemark(String remark) {
this.remark = remark;
}
public String getBeginTimeStr() {
return beginTimeStr;
}
public int getImgCount() {
return imgCount;
}
public void setBeginTimeStr(String beginTimeStr) {
this.beginTimeStr = beginTimeStr;
}
public void setImgCount(int imgCount) {
this.imgCount = imgCount;
}
public String getIdStateStr() {
return idStateStr;
}
public void setIdStateStr(String idStateStr) {
this.idStateStr = idStateStr;
}
}
......@@ -99,7 +99,6 @@ public class ExcelExportController extends BaseController {
private void writToResponse(Map data, HttpServletResponse response, String templateFileName, String outFileName) throws Exception {
Resource resource = new ClassPathResource(templateFileName);
File file = resource.getFile();
TemplateExportParams params = new TemplateExportParams(file.getAbsolutePath(), true);
ByteArrayOutputStream bout = new ByteArrayOutputStream();
......@@ -113,6 +112,4 @@ public class ExcelExportController extends BaseController {
response.getOutputStream().flush();
response.getOutputStream().close();
}
}
......@@ -29,6 +29,10 @@ public interface CheckMapper extends BaseMapper {
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> queryCheckPointInputItem(@Param(value = "planTaskId") int planTaskId, @Param(value = "pointId") int pointId);
......@@ -227,6 +231,20 @@ public interface CheckMapper extends BaseMapper {
List<CheckAnalysisVo> getCheckStatisticalAnalysis(CheckStatisticalParam param);
/**
* 月度巡检情况(巡检点)
*
* @param param
* @return
*/
List<CheckAnalysisVo> getCheckStatisticalByCheck(CheckStatisticalParam param);
/**
* 月度巡检情况(巡检计划)
*
* @param param
* @return
*/
List<CheckAnalysisVo> getCheckStatisticalByPlanTask(CheckStatisticalParam param);
/**
* 根据orgCode查询公司累计巡检次数
*
* @param loginOrgCode
......
......@@ -41,7 +41,6 @@ public class CheckInfoPageParam extends CommonPageable {
* 点分类 0-移动 1-固定
*/
private String isFixed;
/**
* 执行情况:0-计划外完成 1-按时完成
*/
......@@ -54,7 +53,6 @@ public class CheckInfoPageParam extends CommonPageable {
* 所属计划
*/
private String planId;
/**
* 所属路线
*/
......@@ -64,25 +62,25 @@ public class CheckInfoPageParam extends CommonPageable {
* 机构
*/
private String orgCode;
/**
* 分类id
*/
private String catalogId;
private String orderBy ;
/**
* 部门id
*/
private String departmentId;
/**
* 其他部门人员id集合
*/
private List ids;
/**
* 模板类型
*/
private String statement;
public String getOrderBy() {
return orderBy;
}
......@@ -219,4 +217,11 @@ public class CheckInfoPageParam extends CommonPageable {
this.ids = ids;
}
public String getStatement() {
return statement;
}
public void setStatement(String statement) {
this.statement = statement;
}
}
......@@ -13,6 +13,7 @@ public class CheckStatisticalParam {
private String startTime;
private String endTime;
private String orgCode;
private String queryMonth;
public String getOrgCode() {
return orgCode;
......@@ -86,6 +87,12 @@ public class CheckStatisticalParam {
public void setEndTime(String 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;
import org.springframework.data.domain.Page;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
......@@ -193,7 +195,6 @@ public interface ICheckService {
* @return
*/
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 {
Page<CheckInfoBo> getCheckInfoList(CheckInfoListPageParam params);
Page<PointCheckInfoRespone> getCheckInfoList1(CheckInfoListPageParam params);
/**
* 视图模块初始化数据
*
* @return
*/
public GraphInitDataResponse getViewModuleInitData();
/**
* 巡检情况统计分析
*
......@@ -218,7 +217,13 @@ public interface ICheckService {
* @return
*/
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获取巡检累计个数
*
......@@ -226,7 +231,6 @@ public interface ICheckService {
* @return
*/
long getCumulativeCheckCountByOrgCode(String loginOrgCode);
/**
* 根据条件查询日巡检统计情况
*
......@@ -240,4 +244,6 @@ public interface ICheckService {
List<String> getLivePhotos(Long checkID);
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 {
param.setDepartmentId(toString(queryRequests.get(i).getValue()));
} else if ("planId".equals(name)) {
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) {
......
......@@ -21,6 +21,7 @@ public class CheckAnalysisVo {
private String missedRate;
@Excel(name = "不合格率%", orderNum = "8")
private String faildRate;
private String checkTime;
public String getName() {
return name;
}
......@@ -75,7 +76,12 @@ public class CheckAnalysisVo {
public void setFaildRate(String 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;
import cn.afterturn.easypoi.excel.annotation.Excel;
import java.util.List;
import java.util.Map;
public class CheckInfoVo {
private String id;
......@@ -43,6 +46,11 @@ public class CheckInfoVo {
private String error;
@Excel(name = "备注说明", orderNum = "14")
private String remark;
/**
* 检查项
*/
private Map<String, PointClassifyVo> checkInfoMap;
public String getId() {
return id;
......@@ -171,4 +179,11 @@ public class CheckInfoVo {
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 {
public static final String INPUT_ITEM_XEXT= "小额";
public static final String INPUT_ITEM_WYXT = "网银";
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;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.Period;
import java.util.Calendar;
import java.util.Date;
import java.util.TimeZone;
import java.util.*;
import com.yeejoin.amos.patrol.service.exception.YeeException;
......@@ -25,6 +23,9 @@ public class DateUtil {
public static String MID_PATTERN = "yyyy-MM-dd HH:mm";
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 ONE_DAY_MILLSEC = 86400000L;
......@@ -632,4 +633,78 @@ public class DateUtil {
Date date = new 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;
import com.yeejoin.amos.patrol.service.remote.feign.AmosBankFeign;
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 org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
......@@ -479,7 +478,6 @@ public class RemoteSecurityService {
}
public JSONArray listDepartmentUserTree(String toke,String product,String appKey,String companyId) {
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
......@@ -495,15 +493,35 @@ public class RemoteSecurityService {
if (companyModel != null ) {
String jsonStr =null;
jsonStr = JSON.toJSONString(companyModel.getChildren());
return JSONArray.parseArray(jsonStr);
}
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 {
boolean flag=false;
......
......@@ -171,6 +171,11 @@
<version>3.3.1</version>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib-nodep</artifactId>
<version>3.2.4</version>
</dependency>
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
</dependency>
......@@ -244,11 +249,6 @@
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>ooxml-schemas</artifactId>
<version>1.3</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.14</version>
</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