任务图表统计功能优化

图表统计功能新增(完成)
新增督办预警功能
This commit is contained in:
Renpc-kilig 2021-10-28 20:33:47 +08:00
parent e647a35c51
commit e9e8395519
17 changed files with 963 additions and 261 deletions

24
pom.xml
View File

@ -63,17 +63,17 @@
</dependency>
<!-- 角色模块,该模块包含权限模块、菜单模块、组织机构模块、用户模块、文件模块 -->
<!--<dependency>
<dependency>
<groupId>ink.wgink</groupId>
<artifactId>service-role</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>-->
</dependency>
<!-- 登录模块,引入该模块后,访问系统需要登录 -->
<!--<dependency>
<dependency>
<groupId>ink.wgink</groupId>
<artifactId>login-base</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>-->
</dependency>
<!-- quartz -->
<dependency>
<groupId>org.quartz-scheduler</groupId>
@ -82,7 +82,7 @@
</dependency>
<!-- quartz -->
<!-- 客户端 -->
<dependency>
<!--<dependency>
<groupId>ink.wgink</groupId>
<artifactId>login-oauth2-client</artifactId>
<version>1.0-SNAPSHOT</version>
@ -92,8 +92,20 @@
<groupId>ink.wgink</groupId>
<artifactId>module-dictionary</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependency>-->
<!-- 客户端 -->
<!-- app -->
<dependency>
<groupId>ink.wgink</groupId>
<artifactId>basic-app</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ink.wgink</groupId>
<artifactId>login-app</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<!-- app -->
</dependencies>
<build>

View File

@ -213,7 +213,7 @@ public class DistributeController extends DefaultBaseController{
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("bar-charts")
public SuccessResultData<List<ChartsDTO>> barCharts() throws ParseException {
public SuccessResultData<Map<String, Object>> barCharts() throws ParseException {
Map<String, Object> params = requestParams();
return distributeService.barCharts(params);
}

View File

@ -106,6 +106,7 @@ public class ReceiverUserAppController extends DefaultBaseController {
@GetMapping("listpagereceiveruser")
public SuccessResultList<List<ReceiverUserDTO>> listPage(@RequestHeader("token") String token, ListPage page) {
Map<String, Object> params = requestParams();
params.put("token", token);
page.setParams(params);
return receiverUserService.listPage(page);
}

View File

@ -21,6 +21,8 @@ public class ReceiverUserBO {
private String taskType;
private String checkStatus;
private String reason;
private String isWarning;
private String isSupervision;
public String getReceiverUserId() {
return receiverUserId == null ? "" : receiverUserId.trim();
@ -109,4 +111,20 @@ public class ReceiverUserBO {
public void setReason(String reason) {
this.reason = reason;
}
public String getIsWarning() {
return isWarning;
}
public void setIsWarning(String isWarning) {
this.isWarning = isWarning;
}
public String getIsSupervision() {
return isSupervision;
}
public void setIsSupervision(String isSupervision) {
this.isSupervision = isSupervision;
}
}

View File

@ -38,6 +38,10 @@ public class ReceiverUserDTO {
private String checkStatus;
@ApiModelProperty(name = "reason", value = "审核原因")
private String reason;
@ApiModelProperty(name = "isWarning", value = "是否预警")
private String isWarning;
@ApiModelProperty(name = "isSupervision", value = "是否督办")
private String isSupervision;
@ApiModelProperty(name = "distributeTitle", value = "名称")
@ -153,6 +157,22 @@ public class ReceiverUserDTO {
this.reason = reason;
}
public String getIsWarning() {
return isWarning;
}
public void setIsWarning(String isWarning) {
this.isWarning = isWarning;
}
public String getIsSupervision() {
return isSupervision;
}
public void setIsSupervision(String isSupervision) {
this.isSupervision = isSupervision;
}
public String getDistributeTitle() {
return distributeTitle;
}
@ -216,4 +236,15 @@ public class ReceiverUserDTO {
public void setFrequency(String frequency) {
this.frequency = frequency;
}
@Override
public String toString() {
return "ReceiverUserDTO{" +
"receiverUserId='" + receiverUserId + '\'' +
", receiveType='" + receiveType + '\'' +
", executeStatus='" + executeStatus + '\'' +
", taskType='" + taskType + '\'' +
", checkStatus='" + checkStatus + '\'' +
'}';
}
}

View File

@ -14,6 +14,10 @@ import io.swagger.annotations.ApiModelProperty;
@ApiModel
public class ReceiverUserPatrolDTO {
@ApiModelProperty(name = "receiverUserPatrolId", value = "上报记录ID")
private String receiverUserPatrolId;
@ApiModelProperty(name = "receiverUserId", value = "任务接收人表ID")
private String receiverUserId;
@ApiModelProperty(name = "patrolTime", value = "巡查时间")
private String patrolTime;
@ApiModelProperty(name = "patrolContent", value = "巡查内容")
@ -37,6 +41,22 @@ public class ReceiverUserPatrolDTO {
@ApiModelProperty(name = "isDelete", value = "")
private Integer isDelete;
public String getReceiverUserPatrolId() {
return receiverUserPatrolId;
}
public void setReceiverUserPatrolId(String receiverUserPatrolId) {
this.receiverUserPatrolId = receiverUserPatrolId;
}
public String getReceiverUserId() {
return receiverUserId;
}
public void setReceiverUserId(String receiverUserId) {
this.receiverUserId = receiverUserId;
}
public String getPatrolTime() {
return patrolTime == null ? "" : patrolTime.trim();
}

View File

@ -21,6 +21,8 @@ public class ReceiverUserPO {
private String taskType;
private String checkStatus;
private String reason;
private String isWarning;
private String isSupervision;
public String getReceiverUserId() {
return receiverUserId == null ? "" : receiverUserId.trim();
@ -109,4 +111,20 @@ public class ReceiverUserPO {
public void setReason(String reason) {
this.reason = reason;
}
public String getIsWarning() {
return isWarning;
}
public void setIsWarning(String isWarning) {
this.isWarning = isWarning;
}
public String getIsSupervision() {
return isSupervision;
}
public void setIsSupervision(String isSupervision) {
this.isSupervision = isSupervision;
}
}

View File

@ -40,6 +40,10 @@ public class ReceiverUserVO {
private String checkStatus;
@ApiModelProperty(name = "reason", value = "审核原因")
private String reason;
@ApiModelProperty(name = "isWarning", value = "是否预警")
private String isWarning;
@ApiModelProperty(name = "isSupervision", value = "是否督办")
private String isSupervision;
public String getDistributeId() {
return distributeId == null ? "" : distributeId.trim();
@ -128,4 +132,20 @@ public class ReceiverUserVO {
public void setReason(String reason) {
this.reason = reason;
}
public String getIsWarning() {
return isWarning;
}
public void setIsWarning(String isWarning) {
this.isWarning = isWarning;
}
public String getIsSupervision() {
return isSupervision;
}
public void setIsSupervision(String isSupervision) {
this.isSupervision = isSupervision;
}
}

View File

@ -290,5 +290,5 @@ public interface IDistributeService {
* @param params
* @return
*/
SuccessResultData<List<ChartsDTO>> barCharts(Map<String, Object> params) throws ParseException;
SuccessResultData<Map<String, Object>> barCharts(Map<String, Object> params) throws ParseException;
}

View File

@ -612,20 +612,303 @@ public class DistributeServiceImpl extends DefaultBaseService implements IDistri
}
@Override
public SuccessResultData<List<ChartsDTO>> barCharts(Map<String, Object> params) throws ParseException {
public SuccessResultData<Map<String, Object>> barCharts(Map<String, Object> params) throws ParseException {
Map<String, Object> backMap = new HashMap<>();
// 设置返回数据的输出格式为保留两位有效数字的百分比
NumberFormat fmt = NumberFormat.getPercentInstance();
fmt.setMinimumFractionDigits(2);
// 最后的结果返回集合
List<ChartsDTO> chartsDTOList = new ArrayList<>();
// 用于填充数据的集合
List<ChartsDTO> taskOverList = new ArrayList<>();
List<ChartsDTO> taskSoonOverdueList = new ArrayList<>();
List<ChartsDTO> taskOverdueList = new ArrayList<>();
List<ChartsDTO> taskBackList = new ArrayList<>();
List<ChartsDTO> taskIncompleteList = new ArrayList<>();
// 用于饼图数据
List<ChartsDTO> pieList = new ArrayList<>();
List<ReceiverUserDTO> receiverUserDTOList = receiverUserService.list(params);
// 设置纵坐标值集合
String xAxisValue = "";
if(null != receiverUserDTOList && receiverUserDTOList.size() > 0) {
// 当前月份
int dateNum = screenData(receiverUserDTOList, params);
if(dateNum > 0) {
// 任务下派数量
if (!StringHandler.isNull(params.get("startTime")) && StringHandler.isNull(params.get("endTime"))) {
Date date = df.parse(params.get("startTime").toString());
if(dateNum/12 < 1) {
xAxisValue = monthData(date, xAxisValue, dateNum, receiverUserDTOList, taskOverList, taskSoonOverdueList, taskOverdueList, taskBackList, taskIncompleteList, pieList);
}else {
int yearDifference = DateUtils.compareDate(params.get("startTime").toString(), null, 2);
xAxisValue = yearData(date, yearDifference, xAxisValue, receiverUserDTOList, taskOverList, taskSoonOverdueList, taskOverdueList, taskBackList, taskIncompleteList, pieList);
}
xAxisValue = xAxisValue.substring(0, xAxisValue.length()-1);
backMap.put("xAxisValue", xAxisValue);
} else if (!StringHandler.isNull(params.get("endTime")) && StringHandler.isNull(params.get("startTime"))) {
if(dateNum/12 < 1) {
xAxisValue = monthData(new Date(), xAxisValue, dateNum, receiverUserDTOList, taskOverList, taskSoonOverdueList, taskOverdueList, taskBackList, taskIncompleteList, pieList);
}else {
int yearDifference = DateUtils.compareDate(df.format(new Date()), params.get("endTime").toString(), 2);
xAxisValue = yearData(new Date(), yearDifference, xAxisValue, receiverUserDTOList, taskOverList, taskSoonOverdueList, taskOverdueList, taskBackList, taskIncompleteList, pieList);
}
xAxisValue = xAxisValue.substring(0, xAxisValue.length()-1);
backMap.put("xAxisValue", xAxisValue);
} else if (!StringHandler.isNull(params.get("startTime")) && !StringHandler.isNull(params.get("endTime"))) {
Date startDate = df.parse(params.get("startTime").toString());
if(dateNum/12 < 1) {
xAxisValue = monthData(startDate, xAxisValue, dateNum, receiverUserDTOList, taskOverList, taskSoonOverdueList, taskOverdueList, taskBackList, taskIncompleteList, pieList);
}else {
int yearDifference = DateUtils.compareDate(params.get("startTime").toString(), params.get("endTime").toString(), 2);
xAxisValue = yearData(startDate, yearDifference, xAxisValue, receiverUserDTOList, taskOverList, taskSoonOverdueList, taskOverdueList, taskBackList, taskIncompleteList, pieList);
}
xAxisValue = xAxisValue.substring(0, xAxisValue.length()-1);
backMap.put("xAxisValue", xAxisValue);
} else {
if(dateNum/12 < 1) {
xAxisValue = monthData(new Date(), xAxisValue, dateNum, receiverUserDTOList, taskOverList, taskSoonOverdueList, taskOverdueList, taskBackList, taskIncompleteList, pieList);
xAxisValue = xAxisValue.substring(0, xAxisValue.length()-1);
backMap.put("xAxisValue", xAxisValue);
}
}
}
setBackData(taskOverList, backMap);
setBackData(taskSoonOverdueList, backMap);
setBackData(taskOverdueList, backMap);
setBackData(taskBackList, backMap);
setBackData(taskIncompleteList, backMap);
ChartsDTO chartsDTO = new ChartsDTO();
chartsDTO.setName("任务数");
chartsDTO.setDataValue(String.valueOf(receiverUserDTOList.size()));
pieList.add(chartsDTO);
backMap.put("pieData", pieList);
return new SuccessResultData<>(backMap);
}
/**
* 按月份计算数据
* @param date
* @param xAxisValue
* @param dateNum
* @param receiverUserDTOList
* @param taskOverList
* @param taskSoonOverdueList
* @param taskOverdueList
* @param taskBackList
* @param taskIncompleteList
* @param pieList
* @return
* @throws ParseException
*/
private String monthData(Date date, String xAxisValue, int dateNum,
List<ReceiverUserDTO> receiverUserDTOList, List<ChartsDTO> taskOverList,
List<ChartsDTO> taskSoonOverdueList, List<ChartsDTO> taskOverdueList,
List<ChartsDTO> taskBackList, List<ChartsDTO> taskIncompleteList,
List<ChartsDTO> pieList) throws ParseException {
// 任务完成数量
int taskOverCountPie = 0;
// 任务即将超期数量
int taskSoonOverdueCountPie = 0;
// 任务超期数量
int taskOverdueCountPie = 0;
// 任务退回数量
int taskBackCountPie = 0;
// 任务未完成数量
int taskIncompleteCountPie = 0;
cal.setTime(date);
Date nowDate = new Date();
boolean dateEqual = DateUtils.DateEqual(nowDate, date);
// 横坐标起始日期
int yearTime = cal.get(Calendar.YEAR);
int monthTime = cal.get(Calendar.MONTH) + 1;
if(dateNum/12 < 1) {
for (int i = 1; i <= dateNum; i++) {
DateRange dateRange;
if(!dateEqual) {
if (monthTime > 12) {
yearTime += 1;
monthTime = 1;
}
xAxisValue += yearTime + "年-" + monthTime + "" + ",";
String dateTime = "";
if(monthTime < 10) {
dateTime = yearTime + "-0" + monthTime + "-01" + " 00:00:00";
}else {
dateTime = yearTime + "-" + monthTime + "-01" + " 00:00:00";
}
dateRange = DateUtils.getMonthRange(df.parse(dateTime));
monthTime++;
}else {
xAxisValue += yearTime + "年-" + i + "" + ",";
dateRange = DateUtils.getAppointMonth(i - dateNum);
}
Date startDate = dateRange.getStart();
Date endDate = dateRange.getEnd();
backData(startDate, endDate,
receiverUserDTOList, taskOverList,
taskSoonOverdueList, taskOverdueList,
taskBackList, taskIncompleteList, pieList,
taskOverCountPie, taskSoonOverdueCountPie,
taskOverdueCountPie, taskBackCountPie, taskIncompleteCountPie);
}
backPieData(pieList);
}
return xAxisValue;
}
/**
* 按年份计算数据
* @param date
* @param yearDifference
* @param xAxisValue
* @param receiverUserDTOList
* @param taskOverList
* @param taskSoonOverdueList
* @param taskOverdueList
* @param taskBackList
* @param pieList
* @throws ParseException
*/
private String yearData(Date date, int yearDifference, String xAxisValue,
List<ReceiverUserDTO> receiverUserDTOList, List<ChartsDTO> taskOverList,
List<ChartsDTO> taskSoonOverdueList, List<ChartsDTO> taskOverdueList,
List<ChartsDTO> taskBackList, List<ChartsDTO> taskIncompleteList, List<ChartsDTO> pieList) throws ParseException {
// 任务完成数量
int taskOverCountPie = 0;
// 任务即将超期数量
int taskSoonOverdueCountPie = 0;
// 任务超期数量
int taskOverdueCountPie = 0;
// 任务退回数量
int taskBackCountPie = 0;
// 任务未完成数量
int taskIncompleteCountPie = 0;
cal.setTime(date);
// 横坐标起始日期
int yearTime = cal.get(Calendar.YEAR);
if(yearDifference > 0) {
for(int i=0;i<=yearDifference;i++) {
xAxisValue += (yearTime + i) + "" + ",";
Date startDate = df.parse((yearTime + i) + "-01-01 00:00:00");
Date endDate = df.parse((yearTime + i) + "-12-31 23:59:59");
backData(startDate, endDate,
receiverUserDTOList, taskOverList,
taskSoonOverdueList, taskOverdueList,
taskBackList, taskIncompleteList, pieList,
taskOverCountPie, taskSoonOverdueCountPie,
taskOverdueCountPie, taskBackCountPie,
taskIncompleteCountPie);
}
backPieData(pieList);
}
return xAxisValue;
}
/**
* 处理饼图集合数据用作最后返回
* @param pieList
*/
private void backPieData(List<ChartsDTO> pieList) {
if(null != pieList && pieList.size() > 0) {
// 任务完成数量
int taskOverCountPie = 0;
// 任务即将超期数量
int taskSoonOverdueCountPie = 0;
// 任务超期数量
int taskOverdueCountPie = 0;
// 任务退回数量
int taskBackCountPie = 0;
// 任务未完成数量
int taskIncompleteCountPie = 0;
for(ChartsDTO chartsDTO: pieList) {
if("完成数".equals(chartsDTO.getName())) {
taskOverCountPie += Integer.valueOf(chartsDTO.getDataValue());
}
if("即将超期数".equals(chartsDTO.getName())) {
taskSoonOverdueCountPie += Integer.valueOf(chartsDTO.getDataValue());
}
if("超期数".equals(chartsDTO.getName())) {
taskOverdueCountPie += Integer.valueOf(chartsDTO.getDataValue());
}
if("退回数".equals(chartsDTO.getName())) {
taskBackCountPie += Integer.valueOf(chartsDTO.getDataValue());
}
if("未完成数".equals(chartsDTO.getName())) {
taskIncompleteCountPie += Integer.valueOf(chartsDTO.getDataValue());
}
}
pieList.clear();
setPieData(pieList, taskOverCountPie, taskSoonOverdueCountPie, taskOverdueCountPie, taskBackCountPie, taskIncompleteCountPie);
}
}
/**
* 填充饼图数据
* @param pieList
* @param taskOverCountPie
* @param taskSoonOverdueCountPie
* @param taskOverdueCountPie
* @param taskBackCountPie
* @param taskIncompleteCountPie
*/
private void setPieData(List<ChartsDTO> pieList, int taskOverCountPie, int taskSoonOverdueCountPie,
int taskOverdueCountPie, int taskBackCountPie, int taskIncompleteCountPie) {
ChartsDTO chartsDTO = new ChartsDTO();
chartsDTO.setName("完成数");
chartsDTO.setDataValue(String.valueOf(taskOverCountPie));
pieList.add(chartsDTO);
chartsDTO = new ChartsDTO();
chartsDTO.setName("即将超期数");
chartsDTO.setDataValue(String.valueOf(taskSoonOverdueCountPie));
pieList.add(chartsDTO);
chartsDTO = new ChartsDTO();
chartsDTO.setName("超期数");
chartsDTO.setDataValue(String.valueOf(taskOverdueCountPie));
pieList.add(chartsDTO);
chartsDTO = new ChartsDTO();
chartsDTO.setName("退回数");
chartsDTO.setDataValue(String.valueOf(taskBackCountPie));
pieList.add(chartsDTO);
chartsDTO = new ChartsDTO();
chartsDTO.setName("未完成数");
chartsDTO.setDataValue(String.valueOf(taskIncompleteCountPie));
pieList.add(chartsDTO);
}
/**
* 数据填充
* @param startDate
* @param endDate
* @param receiverUserDTOList
* @param taskOverList
* @param taskSoonOverdueList
* @param taskOverdueList
* @param taskBackList
* @param taskIncompleteList
* @param pieList
* @param taskOverCountPie
* @param taskSoonOverdueCountPie
* @param taskOverdueCountPie
* @param taskBackCountPie
* @param taskIncompleteCountPie
* @throws ParseException
*/
private void backData(Date startDate, Date endDate, List<ReceiverUserDTO> receiverUserDTOList,
List<ChartsDTO> taskOverList, List<ChartsDTO> taskSoonOverdueList,
List<ChartsDTO> taskOverdueList, List<ChartsDTO> taskBackList,
List<ChartsDTO> taskIncompleteList, List<ChartsDTO> pieList,
int taskOverCountPie, int taskSoonOverdueCountPie,
int taskOverdueCountPie, int taskBackCountPie,
int taskIncompleteCountPie) throws ParseException {
int taskSendCount = receiverUserDTOList.size();
for(int i=1;i<=dateNum;i++) {
// 任务完成数量
int taskOverCount = 0;
// 任务完成率
@ -642,51 +925,101 @@ public class DistributeServiceImpl extends DefaultBaseService implements IDistri
int taskBackCount = 0;
// 任务退回率
String taskBackRate;
// 任务未完成数量
int taskIncompleteCount = 0;
// 任务未完成率
String taskIncompleteRate;
DateRange dateRange = DateUtils.getAppointMonth(i - dateNum);
Date startDate = dateRange.getStart();
Date endDate = dateRange.getEnd();
for(ReceiverUserDTO receiverUserDTO: receiverUserDTOList) {
if(null != receiverUserDTOList && receiverUserDTOList.size() > 0) {
for (ReceiverUserDTO receiverUserDTO : receiverUserDTOList) {
Date nowDate = df.parse(receiverUserDTO.getDistributeDeadline());
boolean isOver = isEffectiveDate(nowDate, startDate, endDate);
if(isOver) {
if("正常".equals(receiverUserDTO.getTaskType()) && "完成".equals(receiverUserDTO.getExecuteStatus()) && "已通过".equals(receiverUserDTO.getCheckStatus())) {
if (isOver) {
if ("正常".equals(receiverUserDTO.getTaskType()) && "完成".equals(receiverUserDTO.getExecuteStatus()) && "已通过".equals(receiverUserDTO.getCheckStatus())) {
taskOverCount++;
taskOverCountPie++;
}
if("即将超期".equals(receiverUserDTO.getTaskType())) {
if ("即将超期".equals(receiverUserDTO.getTaskType())) {
taskSoonOverdueCount++;
taskSoonOverdueCountPie++;
}
if("已超期".equals(receiverUserDTO.getTaskType())) {
if ("已超期".equals(receiverUserDTO.getTaskType()) && !"已回退".equals(receiverUserDTO.getCheckStatus())) {
taskOverdueCount++;
taskOverdueCountPie++;
}
if("已回退".equals(receiverUserDTO.getTaskType())) {
if ("已回退".equals(receiverUserDTO.getCheckStatus())) {
System.out.println("-------------------");
System.out.println(receiverUserDTO.toString());
System.out.println("-------------------");
taskBackCount++;
taskBackCountPie++;
}
if ("正常".equals(receiverUserDTO.getTaskType()) && "未完成".equals(receiverUserDTO.getExecuteStatus())) {
taskIncompleteCount++;
taskIncompleteCountPie++;
}
}
}
}
ChartsDTO chartsDTO = new ChartsDTO();
chartsDTO.setName(i + "");
/*System.out.println("---------------");
System.out.println(taskOverCountPie);
System.out.println(taskSoonOverdueCountPie);
System.out.println(taskOverdueCountPie);
System.out.println(taskBackCountPie);
System.out.println("---------------");*/
setPieData(pieList, taskOverCountPie, taskSoonOverdueCountPie, taskOverdueCountPie, taskBackCountPie, taskIncompleteCountPie);
/*System.out.println("----------------");
System.out.println(i + "");
System.out.println(taskSendCount);
System.out.println(taskOverCount);
System.out.println(taskSoonOverdueCount);
System.out.println(taskOverdueCount);
System.out.println(taskBackCount);
System.out.println("----------------");*/
// 计算率
taskOverRate = fmt.format((float) taskOverCount / taskSendCount);
taskSoonOverdueRate = fmt.format((float) taskSoonOverdueCount / taskSendCount);
taskOverdueRate = fmt.format((float) taskOverdueCount / taskSendCount);
taskBackRate = fmt.format((float) taskBackCount / taskSendCount);
chartsDTO.setDataValue(taskOverRate + "," + taskSoonOverdueRate + "," + taskOverdueRate + "," + taskBackRate);
chartsDTOList.add(chartsDTO);
taskOverRate = String.format("%.2f", ((float) taskOverCount / taskSendCount * 100));
taskSoonOverdueRate = String.format("%.2f", ((float) taskSoonOverdueCount / taskSendCount * 100));
taskOverdueRate = String.format("%.2f", ((float) taskOverdueCount / taskSendCount * 100));
taskBackRate = String.format("%.2f", ((float) taskBackCount / taskSendCount * 100));
taskIncompleteRate = String.format("%.2f", ((float) taskIncompleteCount / taskSendCount * 100));
// 数据填充
ChartsDTO taskOverDTO = new ChartsDTO();
taskOverDTO.setName("完成率");
taskOverDTO.setDataValue(taskOverRate);
taskOverList.add(taskOverDTO);
ChartsDTO taskSoonOverdueDTO = new ChartsDTO();
taskSoonOverdueDTO.setName("即将超期率");
taskSoonOverdueDTO.setDataValue(taskSoonOverdueRate);
taskSoonOverdueList.add(taskSoonOverdueDTO);
ChartsDTO taskOverdueDTO = new ChartsDTO();
taskOverdueDTO.setName("超期率");
taskOverdueDTO.setDataValue(taskOverdueRate);
taskOverdueList.add(taskOverdueDTO);
ChartsDTO taskBackDTO = new ChartsDTO();
taskBackDTO.setName("退回率");
taskBackDTO.setDataValue(taskBackRate);
taskBackList.add(taskBackDTO);
ChartsDTO taskIncompleteDTO = new ChartsDTO();
taskIncompleteDTO.setName("未完成率");
taskIncompleteDTO.setDataValue(taskIncompleteRate);
taskIncompleteList.add(taskIncompleteDTO);
}
/**
* 遍历数据集合并拼接成字符串
* 主要用于图表功能
* @param chartsDTOList
* @return
*/
private void setBackData(List<ChartsDTO> chartsDTOList, Map<String, Object> params) {
if(null != chartsDTOList && chartsDTOList.size() > 0) {
String dataValue = "";
for(ChartsDTO chartsDTO: chartsDTOList) {
dataValue += chartsDTO.getDataValue() + ",";
}
dataValue = dataValue.substring(0, dataValue.length()-1);
params.put(chartsDTOList.get(0).getName(), dataValue);
}
return new SuccessResultData<>(chartsDTOList);
}
/**
@ -726,6 +1059,7 @@ public class DistributeServiceImpl extends DefaultBaseService implements IDistri
iterator.remove();
continue;
}
dateNum = DateUtils.compareDate(params.get("startTime").toString(), null, 1);
} else if (!StringHandler.isNull(params.get("endTime")) && StringHandler.isNull(params.get("startTime"))) {
Date nowTime = df.parse(receiverUserDTO.getDistributeDeadline());
Date startTime = new Date();
@ -736,7 +1070,8 @@ public class DistributeServiceImpl extends DefaultBaseService implements IDistri
iterator.remove();
continue;
}
} else if (!StringHandler.isNull(params.get("endTime")) && !StringHandler.isNull(params.get("endTime"))) {
dateNum = DateUtils.compareDate(df.format(startTime), params.get("endTime").toString(), 1);
} else if (!StringHandler.isNull(params.get("startTime")) && !StringHandler.isNull(params.get("endTime"))) {
Date nowTime = df.parse(receiverUserDTO.getDistributeDeadline());
Date startTime = df.parse(params.get("startTime").toString());
Date endTime = df.parse(params.get("endTime").toString());
@ -746,6 +1081,7 @@ public class DistributeServiceImpl extends DefaultBaseService implements IDistri
iterator.remove();
continue;
}
dateNum = DateUtils.compareDate(params.get("startTime").toString(), params.get("endTime").toString(), 1);
} else {
Date nowDate = df.parse(receiverUserDTO.getDistributeDeadline());
boolean isOver = isEffectiveDate(nowDate, startDate, endDate);

View File

@ -14,8 +14,10 @@ import cn.com.tenlion.systemtask.service.distribute.IDistributeService;
import cn.com.tenlion.systemtask.service.distributesub.IDistributeSubService;
import cn.com.tenlion.systemtask.service.receiveruser.IReceiverUserService;
import cn.com.tenlion.systemtask.service.urge.IUrgeService;
import cn.com.tenlion.systemtask.utils.StringHandler;
import ink.wgink.common.base.DefaultBaseService;
import ink.wgink.pojo.ListPage;
import ink.wgink.pojo.app.AppTokenUser;
import ink.wgink.pojo.result.SuccessResultList;
import ink.wgink.properties.ApiPathProperties;
import ink.wgink.util.date.DateUtil;
@ -169,10 +171,15 @@ public class ReceiverUserServiceImpl extends DefaultBaseService implements IRece
@Override
public List<ReceiverUserDTO> list(Map<String, Object> params) {
try{
if(!StringUtils.isEmpty(params.get("userId").toString())) {
if(!StringHandler.isNull(params.get("userId"))) {
String[] userId = params.get("userId").toString().split(",");
params.put("userIds", Arrays.asList(userId));
}
if(!StringHandler.isNull(params.get("token"))) {
String token = params.get("token").toString();
AppTokenUser appTokenUser = getAppTokenUser(token);
params.put("userId", appTokenUser.getId());
}
}catch (Exception e) {
}

View File

@ -8,7 +8,9 @@ import cn.com.tenlion.systemtask.pojo.vos.urge.UrgeVO;
import cn.com.tenlion.systemtask.service.urge.IUrgeService;
import ink.wgink.common.base.DefaultBaseService;
import ink.wgink.pojo.ListPage;
import ink.wgink.pojo.bos.UserInfoBO;
import ink.wgink.pojo.result.SuccessResultList;
import ink.wgink.util.date.DateUtil;
import ink.wgink.util.map.HashMapUtil;
import ink.wgink.util.UUIDUtil;
import com.github.pagehelper.PageHelper;
@ -52,11 +54,24 @@ public class UrgeServiceImpl extends DefaultBaseService implements IUrgeService
String urgeId = UUIDUtil.getUUID();
Map<String, Object> params = HashMapUtil.beanToMap(urgeVO);
params.put("urgeId", urgeId);
try {
if (null == securityComponent) {
if (StringUtils.isBlank(token)) {
setSaveInfo(params);
} else {
setAppSaveInfo(token, params);
}
} else {
String currentDate = DateUtil.getTime();
params.put("creator", 1);
params.put("gmtCreate", currentDate);
params.put("modifier", 1);
params.put("gmtModified", currentDate);
params.put("isDelete", 0);
}
}catch (Exception e) {
}
urgeDao.save(params);
return urgeId;
}

View File

@ -2,8 +2,11 @@ package cn.com.tenlion.systemtask.utils;
/**
* Calendar操作Date
*
* @author renpc
*/
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
@ -13,6 +16,7 @@ public class DateUtils {
/**设置初始值*/
private static Calendar cal;
private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
/**
* 根据当前系统时区定义Calendar
@ -21,6 +25,22 @@ public class DateUtils {
cal = Calendar.getInstance();
}
/**
* 比较两个日期是否相等
* @param startDate
* @param endDate
* @return
*/
public static boolean DateEqual(Date startDate, Date endDate) {
String startTime = sdf.format(startDate);
String endTime = sdf.format(endDate);
if(startTime.equals(endTime)) {
return true;
}else {
return false;
}
}
/**
* 获取date的月份的时间范围
* @param date
@ -44,7 +64,7 @@ public class DateUtils {
* 根据指定日期获取当前属于第几个季度
* @param date
*/
public static int getNowQuarter(Date date){
public static int getNowQuarter(Date date) {
cal.setTime(date);
int month = cal.get(Calendar.MONTH) + 1;
int quarter = 0;
@ -68,18 +88,18 @@ public class DateUtils {
public static DateRange returnQuarterCurrent(int year, int quarter) {
Calendar startCalendar = Calendar.getInstance();
Calendar endCalendar = Calendar.getInstance();
if(quarter == 1) {
startCalendar.set(year, 1-1, 1, 00, 00, 00);
endCalendar.set(year, 3-1,31, 23,59,59);
}else if(quarter == 2) {
startCalendar.set(year, 4-1, 1, 00, 00, 00);
endCalendar.set(year, 6-1,30, 23,59,59);
}else if(quarter == 3) {
startCalendar.set(year, 7-1, 1, 00, 00, 00);
endCalendar.set(year, 9-1,30, 23,59,59);
}else {
startCalendar.set(year, 10-1, 1, 00, 00, 00);
endCalendar.set(year, 12-1,31, 23,59,59);
if (quarter == 1) {
startCalendar.set(year, 1 - 1, 1, 00, 00, 00);
endCalendar.set(year, 3 - 1, 31, 23, 59, 59);
} else if (quarter == 2) {
startCalendar.set(year, 4 - 1, 1, 00, 00, 00);
endCalendar.set(year, 6 - 1, 30, 23, 59, 59);
} else if (quarter == 3) {
startCalendar.set(year, 7 - 1, 1, 00, 00, 00);
endCalendar.set(year, 9 - 1, 30, 23, 59, 59);
} else {
startCalendar.set(year, 10 - 1, 1, 00, 00, 00);
endCalendar.set(year, 12 - 1, 31, 23, 59, 59);
}
return new DateRange(startCalendar.getTime(), endCalendar.getTime());
}
@ -122,7 +142,7 @@ public class DateUtils {
* 获取当前月份的时间范围
* @return
*/
public static DateRange getThisMonth(){
public static DateRange getThisMonth() {
Calendar startCalendar = Calendar.getInstance();
startCalendar.set(Calendar.DAY_OF_MONTH, 1);
setMinTime(startCalendar);
@ -138,7 +158,7 @@ public class DateUtils {
* 获取上个月的时间范围
* @return
*/
public static DateRange getLastMonth(){
public static DateRange getLastMonth() {
Calendar startCalendar = Calendar.getInstance();
startCalendar.add(Calendar.MONTH, -1);
startCalendar.set(Calendar.DAY_OF_MONTH, 1);
@ -153,11 +173,11 @@ public class DateUtils {
}
/**
* 获取指定月的时间范围
* 获取指定当前年份月的时间范围
* month:-1是前一个月,-2是前二个月+1是推后一个月以此类推
* @return
*/
public static DateRange getAppointMonth(int month){
public static DateRange getAppointMonth(int month) {
Calendar startCalendar = Calendar.getInstance();
startCalendar.add(Calendar.MONTH, month);
startCalendar.set(Calendar.DAY_OF_MONTH, 1);
@ -189,14 +209,70 @@ public class DateUtils {
return new DateRange(startCalendar.getTime(), endCalendar.getTime());
}
private static void setMinTime(Calendar calendar){
/**
* @param date1 需要比较的时间 不能为空(null),需要正确的日期格式
* @param date2 被比较的时间 为空(null)则为当前时间
* @param stype 返回值类型 0为多少天1为多少个月2为多少年
* @return
*/
public static int compareDate(String date1, String date2, int stype) {
int n = 0;
String[] u = {"", "", ""};
String formatStyle = stype == 1 ? "yyyy-MM" : "yyyy-MM-dd";
date2 = date2 == null ? DateUtils.getCurrentDate() : date2;
DateFormat df = new SimpleDateFormat(formatStyle);
Calendar c1 = Calendar.getInstance();
Calendar c2 = Calendar.getInstance();
try {
c1.setTime(df.parse(date1));
c2.setTime(df.parse(date2));
} catch (Exception e3) {
System.out.println("wrong occured");
}
// 循环对比直到相等n 就是所要的结果
while (!c1.after(c2)) {
n++;
if (stype == 1) {
// 比较月份月份+1
c1.add(Calendar.MONTH, 1);
} else {
// 比较天数日期+1
c1.add(Calendar.DATE, 1);
}
}
n = n - 1;
if (stype == 2) {
n = (int) n / 365;
}
System.out.println(date1 + " -- " + date2 + " 相差多少" + u[stype] + ":" + n);
return n;
}
/**
* 得到当前日期
* @return
*/
public static String getCurrentDate() {
Calendar c = Calendar.getInstance();
Date date = c.getTime();
SimpleDateFormat simple = new SimpleDateFormat("yyyy-MM-dd");
return simple.format(date);
}
private static void setMinTime(Calendar calendar) {
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
}
private static void setMaxTime(Calendar calendar){
private static void setMaxTime(Calendar calendar) {
calendar.set(Calendar.HOUR_OF_DAY, calendar.getActualMaximum(Calendar.HOUR_OF_DAY));
calendar.set(Calendar.MINUTE, calendar.getActualMaximum(Calendar.MINUTE));
calendar.set(Calendar.SECOND, calendar.getActualMaximum(Calendar.SECOND));
@ -205,34 +281,26 @@ public class DateUtils {
public final static String DEFAULT_PATTERN = "MM/dd/yyyy HH:mm:ss";
public static String format(Date date){
public static String format(Date date) {
SimpleDateFormat sdf = new SimpleDateFormat(DEFAULT_PATTERN);
return sdf.format(date);
}
public static void main(String[] args) {
//DateRange currentQuarter = getThisQuarter();
//System.out.println("当前季度的时间范围: "+DateUtilsTemp.format(currentQuarter.getStart())+" - "+DateUtilsTemp.format(currentQuarter.getEnd()));
DateRange yesterdayRange = getYesterdayRange();
//System.out.println("昨天的时间范围: "+DateUtilsTemp.format(yesterdayRange.getStart())+" - "+DateUtilsTemp.format(yesterdayRange.getEnd()));
DateRange thisMonth = getThisMonth();
//System.out.println("当前月份的时间范围: "+DateUtilsTemp.format(thisMonth.getStart())+" - "+DateUtilsTemp.format(thisMonth.getEnd()));
DateRange lastMonth = getLastMonth();
//System.out.println("上个月的时间范围: "+DateUtilsTemp.format(lastMonth.getStart())+" - "+DateUtilsTemp.format(lastMonth.getEnd()));
DateRange lastQuarter = getLastQuarter();
//System.out.println("上个季度的时间范围: "+DateUtilsTemp.format(lastQuarter.getStart())+" - "+DateUtilsTemp.format(lastQuarter.getEnd()));
DateRange dateRange = returnQuarterCurrent(2020, 5);
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
System.out.println(df.format(dateRange.getStart()));
System.out.println(df.format(dateRange.getEnd()));
int dateNum = 10;
int monthTime = 10;
int yearTime = 2020;
String xAxisValue = "";
int j = 0;
for(int i=1;i<=dateNum;i++) {
if (monthTime > 12) {
yearTime += 1;
monthTime = 1;
}
xAxisValue += yearTime + "年-" + monthTime + "" + ",";
monthTime++;
}
System.out.println(xAxisValue);
}
}

View File

@ -22,6 +22,8 @@
<result column="days" property="days"/>
<result column="hours" property="hours"/>
<result column="reason" property="reason"/>
<result column="is_warning" property="isWarning"/>
<result column="is_supervision" property="isSupervision"/>
</resultMap>
<resultMap id="receiverUserBO" type="cn.com.tenlion.systemtask.pojo.bos.receiveruser.ReceiverUserBO">
@ -37,6 +39,8 @@
<result column="task_type" property="taskType"/>
<result column="check_status" property="checkStatus"/>
<result column="reason" property="reason"/>
<result column="is_warning" property="isWarning"/>
<result column="is_supervision" property="isSupervision"/>
</resultMap>
<resultMap id="receiverUserPO" type="cn.com.tenlion.systemtask.pojo.pos.receiveruser.ReceiverUserPO">
@ -52,6 +56,8 @@
<result column="task_type" property="taskType"/>
<result column="check_status" property="checkStatus"/>
<result column="reason" property="reason"/>
<result column="is_warning" property="isWarning"/>
<result column="is_supervision" property="isSupervision"/>
</resultMap>
<!-- 新增任务接收人 -->
@ -69,6 +75,8 @@
task_type,
check_status,
reason,
is_warning,
is_supervision,
creator,
gmt_create,
modifier,
@ -87,6 +95,8 @@
#{taskType},
#{checkStatus},
#{reason},
#{is_warning},
#{is_supervision},
#{creator},
#{gmtCreate},
#{modifier},
@ -147,6 +157,12 @@
<if test="reason != null and reason != ''">
,reason = #{reason}
</if>
<if test="isWarning != null and isWarning != ''">
,is_warning = #{isWarning}
</if>
<if test="isSupervision != null and isSupervision != ''">
,is_supervision = #{isSupervision}
</if>
WHERE
1 = 1
<if test="receiverUserIds != null and receiverUserIds.size > 0">
@ -212,6 +228,12 @@
</if>
<if test="reason != null and reason != ''">
reason = #{reason},
</if>
<if test="isWarning != null and isWarning != ''">
is_warning = #{isWarning},
</if>
<if test="isSupervision != null and isSupervision != ''">
is_supervision = #{isSupervision},
</if>
gmt_modified = #{gmtModified},
modifier = #{modifier},
@ -234,6 +256,8 @@
t1.task_type,
t1.check_status,
t1.reason,
t1.is_warning,
t1.is_supervision,
t1.receiver_user_id
FROM
task_receiver_user t1
@ -259,6 +283,8 @@
t1.task_score,
t1.task_type,
t1.check_status,
t1.is_warning,
t1.is_supervision,
t1.reason
FROM
task_receiver_user t1
@ -284,6 +310,8 @@
t1.task_score,
t1.task_type,
t1.check_status,
t1.is_warning,
t1.is_supervision,
t1.reason
FROM
task_receiver_user t1
@ -317,6 +345,8 @@
t2.distribute_deadline,
t2.days,
t2.hours,
t1.is_warning,
t1.is_supervision,
1
FROM
task_receiver_user t1 LEFT JOIN task_distribute t2 ON t1.distribute_id = t2.distribute_id AND t2.is_delete = 0
@ -331,9 +361,21 @@
OR t2.task_area4_name LIKE CONCAT('%', #{keywords}, '%')
OR t2.task_area5_name LIKE CONCAT('%', #{keywords}, '%')
OR t2.mission_location LIKE CONCAT('%', #{keywords}, '%')
OR t1.distribute_title LIKE CONCAT('%', #{keywords}, '%')
OR t2.distribute_title LIKE CONCAT('%', #{keywords}, '%')
)
</if>
<if test="userId != null and userId != ''">
AND
t1.user_id = #{userId}
</if>
<if test="isWarning != null and isWarning != ''">
AND
t1.is_warning = #{isWarning}
</if>
<if test="isSupervision != null and isSupervision != ''">
AND
t1.is_supervision = #{isSupervision}
</if>
<if test="distributeId != null and distributeId != ''">
AND
t1.distribute_id = #{distributeId}
@ -425,6 +467,8 @@
t1.task_score,
t1.task_type,
t1.check_status,
t1.is_warning,
t1.is_supervision,
t1.reason
FROM
task_receiver_user t1
@ -458,6 +502,8 @@
t1.task_score,
t1.task_type,
t1.check_status,
t1.is_warning,
t1.is_supervision,
t1.reason
FROM
task_receiver_user t1

View File

@ -3,6 +3,8 @@
<mapper namespace="cn.com.tenlion.systemtask.dao.receiveruserpatrol.IReceiverUserPatrolDao">
<resultMap id="receiverUserPatrolDTO" type="cn.com.tenlion.systemtask.pojo.dtos.receiveruserpatrol.ReceiverUserPatrolDTO">
<result column="receiver_user_patrol_id" property="receiverUserPatrolId"/>
<result column="receiver_user_id" property="receiverUserId"/>
<result column="patrol_time" property="patrolTime"/>
<result column="patrol_content" property="patrolContent"/>
<result column="patrol_result" property="patrolResult"/>

View File

@ -21,7 +21,10 @@
<input type="text" id="keywords" class="layui-input search-item" placeholder="输入关键字">
</div>
<div class="layui-inline">
<input type="text" id="distributeDeadline" class="layui-input search-item" placeholder="截止日期" readonly>
<input type="text" id="startTime" class="layui-input search-item" placeholder="开始日期" readonly>
</div>
<div class="layui-inline">
<input type="text" id="endTime" class="layui-input search-item" placeholder="截止日期" readonly>
</div>
<div class="layui-inline">
<input type="text" id="area" name="area" class="layui-input search-item" placeholder="点击选择区域" readonly>
@ -41,15 +44,16 @@
<div class="layui-inline">
<input type="text" id="reportCount" name="reportCount" class="layui-input search-item" placeholder="上报次数">
</div>
<button type="button" id="reset" class="layui-btn layui-btn-sm">
<i class="fa fa-lg fa-search"></i> 清空条件
</button>
<button type="button" id="search" class="layui-btn layui-btn-sm">
<i class="fa fa-lg fa-search"></i> 搜索
</button>
</div>
<table class="layui-hide" id="dataTable" lay-filter="dataTable"></table>
<!-- 表头按钮组 -->
<script type="text/html" id="headerToolBar">
</script>
<div id="main" style="width: 600px;height:400px;margin: 0 auto"></div>
<div id="barDiv" style="width: 1500px;height:400px;margin: 0 auto 0 -100px"></div>
<div id="main" style="width: 1000px;height:400px;margin: 30px auto"></div>
</div>
</div>
</div>
@ -75,11 +79,8 @@
var selectedAreaArray = [];
var app = {};
function charts() {
var chartDom = document.getElementById('main');
var myChart = echarts.init(chartDom);
var option;
// 柱状图
function barCharts(data) {
const posList = [
'left',
'right',
@ -164,12 +165,42 @@
align: app.config.align,
verticalAlign: app.config.verticalAlign,
rotate: app.config.rotate,
formatter: '{c} {name|{a}}',
formatter: '{b}:{c}%',
fontSize: 16,
rich: {
name: {}
}
};
var xAxisValue;
var series = [];
if(!$.isEmptyObject(data)) {
if(null != data.xAxisValue && '' != data.xAxisValue && typeof(data.xAxisValue) != 'undefined') {
xAxisValue = data.xAxisValue.split(',');
delete data.xAxisValue;
}
for(let key in data) {
if('pieData' != key) {
series.push({
name: key,
type: 'bar',
// 不同系列的柱间距离,为百分比(如 '30%',表示柱子宽度的 30%)。
// 如果想要两个系列的柱子重叠,可以设置 barGap 为 '-100%'。这在用柱子做背景的时候有用。
// 在同一坐标系上,此属性会被多个 'bar' 系列共享。此属性应设置于此坐标系中最后一个 'bar' 系列上才会生效,并且是对此坐标系中所有 'bar' 系列生效。
barGap: 0,
label: labelOption,
emphasis: {
focus: 'series'
},
data: data[key].split(',')
})
}
}
var chartDom = document.getElementById('barDiv');
var myChart = echarts.init(chartDom);
var option;
option = {
tooltip: {
trigger: 'axis',
@ -178,7 +209,7 @@
}
},
legend: {
data: ['Forest', 'Steppe', 'Desert', 'Wetland']
data: ['退回率', '未完成率', '超期率', '即将超期率', '完成率']
},
toolbox: {
show: true,
@ -197,7 +228,7 @@
{
type: 'category',
axisTick: { show: false },
data: ['2012', '2013', '2014', '2015', '2016']
data: xAxisValue
}
],
yAxis: [
@ -205,55 +236,77 @@
type: 'value'
}
],
series: series
};
option && myChart.setOption(option);
}else {
top.dialog.msg('该条件下暂无数据');
}
myChart.on('click', function (param) {
console.log(param)
});
}
// 饼图
function pieCharts(data) {
var chartDom = document.getElementById('main');
var myChart = echarts.init(chartDom);
var option;
var pieData = [];
if(!$.isEmptyObject(data)) {
var pieDataArr = data.pieData;
if(null != pieDataArr && pieDataArr.length > 0) {
for(let key in pieDataArr) {
pieData.push({
name: pieDataArr[key]['name'],
value: pieDataArr[key]['dataValue']
})
}
}
}
console.log(pieData)
option = {
title: {
text: '任务完成情况',
left: 'center'
},
tooltip: {
trigger: 'item'
},
legend: {
orient: 'vertical',
left: 'left'
},
series: [
{
name: 'Forest',
type: 'bar',
barGap: 0,
label: labelOption,
name: '任务数据',
type: 'pie',
radius: '50%',
data: pieData,
emphasis: {
focus: 'series'
},
data: [320, 332, 301, 334, 390]
},
{
name: 'Steppe',
type: 'bar',
label: labelOption,
emphasis: {
focus: 'series'
},
data: [220, 182, 191, 234, 290]
},
{
name: 'Desert',
type: 'bar',
label: labelOption,
emphasis: {
focus: 'series'
},
data: [150, 232, 201, 154, 190]
},
{
name: 'Wetland',
type: 'bar',
label: labelOption,
emphasis: {
focus: 'series'
},
data: [98, 77, 101, 99, 40]
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
}
}
]
};
option && myChart.setOption(option);
}
charts();
function initData() {
var layIndex;
top.restAjax.get(top.restAjax.path(tableUrl, ['已下派']), {}, null, function (code, data) {
console.log(data)
// reloadTable();
console.log(data.data)
barCharts(data.data);
pieCharts(data.data);
}, function (code, data) {
top.dialog.msg(data.msg);
}, function () {
@ -325,11 +378,13 @@
// 重载表格
function reloadTable(currentPage) {
table.reload('dataTable', {
url: top.restAjax.path(tableUrl, ['未下派']),
where: {
var layIndex;
top.restAjax.get(top.restAjax.path(tableUrl, ['已下派']), {
keywords: $('#keywords').val(),
distributeDeadline: $('#distributeDeadline').val(),
// distributeDeadline: $('#distributeDeadline').val(),
startTime: $('#startTime').val(),
endTime: $('#endTime').val(),
taskArea1Id: $('#areaId_1').val(),
taskArea1Id: $('#areaId_1').val(),
taskArea2Id: $('#areaId_2').val(),
taskArea3Id: $('#areaId_3').val(),
@ -338,11 +393,16 @@
userId: $('#userId').val(),
urgentLevel: $('#urgentLevel').val(),
reportCount: $('#reportCount').val(),
},
page: {
curr: currentPage
},
height: $win.height() - 90,
}, null, function (code, data) {
console.log(data.data)
barCharts(data.data);
pieCharts(data.data);
}, function (code, data) {
top.dialog.msg(data.msg);
}, function () {
layIndex = top.dialog.msg(top.dataMessage.updating, {icon: 16, time: 0, shade: 0.3});
}, function () {
top.dialog.close(layIndex);
});
}
@ -351,11 +411,11 @@
// 日期选择
laydate.render({
elem: '#startTime',
format: 'yyyy-MM-dd'
format: 'yyyy-MM-dd HH:mm:ss'
});
laydate.render({
elem: '#endTime',
format: 'yyyy-MM-dd'
format: 'yyyy-MM-dd HH:mm:ss'
});
}
@ -374,6 +434,23 @@
reloadTable(1);
});
// 事件 - 清空搜索条件
$(document).on('click', '#reset', function() {
$('#keywords').val('');
$('#startTime').val('');
$('#endTime').val('');
$('#area').val('');
$('#areaId_1').val('');
$('#areaId_2').val('');
$('#areaId_3').val('');
$('#areaId_4').val('');
$('#areaId_5').val('');
$('#receiverUser').val('');
$('#userId').val('');
$('#urgentLevel').val('');
$('#reportCount').val('');
});
});
</script>
</body>

View File

@ -454,33 +454,16 @@
return rowData;
}
},
{field: 'reassignment', fixed: 'right', width: 90, title: '转派', align:'center',
{field: '', fixed: 'right', width: 300, title: '操作', align:'center',
templet: function(row) {
var rowData = '<a class="layui-btn layui-btn-xs" lay-event="reassignment">转派</a>';
return rowData;
}
},
{field: 'check', fixed: 'right', width: 90, title: '审核', align:'center',
templet: function(row) {
var rowData = '<a class="layui-btn layui-btn-xs" lay-event="check">审核</a>';
return rowData;
}
},
{field: 'taskStatus', fixed: 'right', width: 90, title: '执行状态', align:'center',
templet: function(row) {
var rowData = '<a class="layui-btn layui-btn-xs" lay-event="taskStatus">执行状态</a>';
return rowData;
}
},
{field: 'taskPatrol', fixed: 'right', width: 90, title: '任务记录', align:'center',
templet: function(row) {
var rowData = '<a class="layui-btn layui-btn-xs" lay-event="taskPatrol">任务记录</a>';
return rowData;
}
},
{field: 'addScore', fixed: 'right', width: 90, title: '评分', align:'center',
templet: function(row) {
var rowData = '<a class="layui-btn layui-btn-xs" lay-event="addScore">评分</a>';
var rowData = '<div class="layui-btn-group">\n' +
' <a class="layui-btn layui-btn-xs" lay-event="reassignment">转派</a>\n' +
' <a class="layui-btn layui-btn-xs" lay-event="check">审核</a>\n' +
' <a class="layui-btn layui-btn-xs" lay-event="taskStatus">执行状态</a>\n' +
' <a class="layui-btn layui-btn-xs" lay-event="taskPatrol">任务记录</a>\n' +
' <a class="layui-btn layui-btn-xs" lay-event="isWarning">预警</a>\n' +
' <a class="layui-btn layui-btn-xs" lay-event="isSupervision">督办</a>\n' +
'</div>';
return rowData;
}
}
@ -729,6 +712,10 @@
addScore(data['receiverUserId']);
}else if('taskPatrol' == obj.event) {
taskPatrol(data['receiverUserId']);
}else if('isWarning' == obj.event) {
isWarning(data['receiverUserId']);
}else if('isSupervision' == obj.event) {
isSupervision(data['receiverUserId']);
}
});
@ -769,6 +756,50 @@
});
}
// 预警
function isWarning(receiverUserId) {
top.dialog.msg('确定预警?', {
time: 0,
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
shade: 0.3,
yes: function (index) {
var layIndex;
top.restAjax.delete(top.restAjax.path('api/receiveruser/back/{receiverUserId}?isWarning={isWarning}', [receiverUserId, 1]), {}, null, function (code, data) {
top.dialog.msg('预警成功', {time: 1000});
reloadTable();
}, function (code, data) {
top.dialog.msg(data.msg);
}, function () {
layIndex = top.dialog.msg(top.dataMessage.deleting, {icon: 16, time: 0, shade: 0.3});
}, function () {
top.dialog.close(layIndex);
});
}
});
}
// 督办
function isSupervision(receiverUserId) {
top.dialog.msg('确定督办?', {
time: 0,
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
shade: 0.3,
yes: function (index) {
var layIndex;
top.restAjax.delete(top.restAjax.path('api/receiveruser/back/{receiverUserId}?isSupervision={isSupervision}', [receiverUserId, 1]), {}, null, function (code, data) {
top.dialog.msg('督办成功', {time: 1000});
reloadTable();
}, function (code, data) {
top.dialog.msg(data.msg);
}, function () {
layIndex = top.dialog.msg(top.dataMessage.deleting, {icon: 16, time: 0, shade: 0.3});
}, function () {
top.dialog.close(layIndex);
});
}
});
}
// 退回
function check(receiverUserIds) {
layer.confirm('审核状态', {