完善4、5级网格员考核细则更新功能
This commit is contained in:
parent
b97e0deb6a
commit
cd52b39410
@ -41,7 +41,7 @@ public class AuthClientSecurityConfig extends WebSecurityConfigurerAdapter {
|
|||||||
.and()
|
.and()
|
||||||
.logout().logoutSuccessUrl(authServer.getOauthLogout())
|
.logout().logoutSuccessUrl(authServer.getOauthLogout())
|
||||||
.and()
|
.and()
|
||||||
.authorizeRequests().antMatchers("/app/**", "/route/file/**", "/assets/**", "/api/kpi/khxz/**").permitAll()
|
.authorizeRequests().antMatchers("/app/**", "/route/file/**", "/assets/**", "/api/kpi/**").permitAll()
|
||||||
.and()
|
.and()
|
||||||
.authorizeRequests()
|
.authorizeRequests()
|
||||||
.anyRequest()
|
.anyRequest()
|
||||||
|
@ -146,6 +146,15 @@ public class KpiController extends AbstractController {
|
|||||||
return kpiService.listCommunityBossCaseDayCount(areaId, communityId, startTime, endTime, communityBossLevel);
|
return kpiService.listCommunityBossCaseDayCount(areaId, communityId, startTime, endTime, communityBossLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("list-community-boss-day-count/user-id/{userId}")
|
||||||
|
public List<CommunityBossDayCountDTO> listCommunityBossCaseDayCountByUserId(
|
||||||
|
@PathVariable("userId") String userId,
|
||||||
|
@RequestParam(name = "year", required = false) Integer year,
|
||||||
|
@RequestParam(name = "month", required = false) Integer month,
|
||||||
|
@RequestParam(name = "level") Integer level) {
|
||||||
|
return kpiService.listCommunityBossDayCountByUserId(userId, year, month, level);
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("export-community-boss-case-day-count")
|
@GetMapping("export-community-boss-case-day-count")
|
||||||
public void exportCommunityBossCaseDayCount(HttpServletResponse httpServletResponse,
|
public void exportCommunityBossCaseDayCount(HttpServletResponse httpServletResponse,
|
||||||
@RequestParam(name = "areaId", required = false) String areaId,
|
@RequestParam(name = "areaId", required = false) String areaId,
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
package com.cm.bigdata.controller.apis.kpi;
|
package com.cm.bigdata.controller.apis.kpi;
|
||||||
|
|
||||||
|
import com.cm.bigdata.monitor.KpiUpdateMonitor;
|
||||||
import com.cm.bigdata.service.kpi.IKpiKhxzService;
|
import com.cm.bigdata.service.kpi.IKpiKhxzService;
|
||||||
import com.cm.common.base.AbstractController;
|
import com.cm.common.base.AbstractController;
|
||||||
import com.cm.common.constants.ISystemConstant;
|
import com.cm.common.constants.ISystemConstant;
|
||||||
|
import com.cm.common.exception.UpdateException;
|
||||||
import com.cm.common.result.SuccessResult;
|
import com.cm.common.result.SuccessResult;
|
||||||
|
import com.cm.common.result.SuccessResultData;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
@ -19,12 +22,21 @@ public class KpiKhxzController extends AbstractController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IKpiKhxzService kpiKhxzService;
|
private IKpiKhxzService kpiKhxzService;
|
||||||
|
|
||||||
@PutMapping("update-wgy/kh-year/{khYear}/kh-month/{khMonth}/wgy-level/{wgyLevel}")
|
@PutMapping("update/kh-year/{khYear}/kh-month/{khMonth}")
|
||||||
public synchronized SuccessResult updateWgy(@PathVariable("khYear") Integer khYear, @PathVariable("khMonth") Integer khMonth, @PathVariable("wgyLevel") Integer wgyLevel) {
|
public synchronized SuccessResult update(@PathVariable("khYear") Integer khYear, @PathVariable("khMonth") Integer khMonth) {
|
||||||
kpiKhxzService.updateWgy(khYear, khMonth, wgyLevel);
|
double percent = KpiUpdateMonitor.getInstance().getPercent();
|
||||||
|
if (percent > 0 && percent < 100) {
|
||||||
|
throw new UpdateException("正在有任务运行");
|
||||||
|
}
|
||||||
|
kpiKhxzService.update(khYear, khMonth);
|
||||||
return new SuccessResult();
|
return new SuccessResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("get-update-percent")
|
||||||
|
public SuccessResultData<Double> getUpdatePercent() {
|
||||||
|
return new SuccessResultData<>(KpiUpdateMonitor.getInstance().getPercent());
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("list-wgy")
|
@GetMapping("list-wgy")
|
||||||
public List<Map<String, Object>> listWgy() {
|
public List<Map<String, Object>> listWgy() {
|
||||||
Map<String, Object> queryMap = requestParams();
|
Map<String, Object> queryMap = requestParams();
|
||||||
|
@ -35,4 +35,6 @@ public interface IKpiDao {
|
|||||||
|
|
||||||
List<NPersonDayCountPO> listNPersonDayCountPO(Map<String, Object> queryParams);
|
List<NPersonDayCountPO> listNPersonDayCountPO(Map<String, Object> queryParams);
|
||||||
|
|
||||||
|
List<CasePO> listCase(Map<String, Object> params);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,10 @@ public interface IKpiKhxzWgyDao {
|
|||||||
@MapKey("id")
|
@MapKey("id")
|
||||||
List<Map<String, Object>> listWgy(Map<String, Object> params);
|
List<Map<String, Object>> listWgy(Map<String, Object> params);
|
||||||
|
|
||||||
|
List<String> listUserId(Map<String, Object> params);
|
||||||
|
|
||||||
void updateC(Map<String, Object> updateParams);
|
void updateC(Map<String, Object> updateParams);
|
||||||
|
|
||||||
List<String> listUserId(Map<String, Object> params);
|
void updateEGIKRT(Map<String, Object> params);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
40
src/main/java/com/cm/bigdata/monitor/KpiUpdateMonitor.java
Normal file
40
src/main/java/com/cm/bigdata/monitor/KpiUpdateMonitor.java
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
package com.cm.bigdata.monitor;
|
||||||
|
|
||||||
|
import com.cm.common.exception.UpdateException;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
|
public class KpiUpdateMonitor {
|
||||||
|
private static final Logger LOG = LoggerFactory.getLogger(KpiUpdateMonitor.class);
|
||||||
|
private static KpiUpdateMonitor INSTANCE = KpiUpdateMonitorFactory.KPI_UPDATE_MONITOR;
|
||||||
|
private Integer taskCount = 0;
|
||||||
|
private AtomicInteger completeTaskCount = new AtomicInteger(0);
|
||||||
|
|
||||||
|
public static KpiUpdateMonitor getInstance() {
|
||||||
|
return INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void setTaskCount(int newValue) {
|
||||||
|
taskCount = newValue;
|
||||||
|
completeTaskCount.set(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void complete() {
|
||||||
|
completeTaskCount.getAndAdd(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getPercent() {
|
||||||
|
LOG.debug("task: {}, complete: {}", taskCount, completeTaskCount);
|
||||||
|
if (taskCount == 0) {
|
||||||
|
return 100;
|
||||||
|
}
|
||||||
|
return (double) completeTaskCount.get() / taskCount * 100D;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class KpiUpdateMonitorFactory {
|
||||||
|
public static KpiUpdateMonitor KPI_UPDATE_MONITOR = new KpiUpdateMonitor();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,113 @@
|
|||||||
|
package com.cm.bigdata.pojo.dtos.kpi;
|
||||||
|
|
||||||
|
public class CommunityBossDayCountDTO {
|
||||||
|
|
||||||
|
private Long id;
|
||||||
|
private String userId;
|
||||||
|
private String dayDate;
|
||||||
|
private Integer isSignin;
|
||||||
|
private Integer isSigninLate;
|
||||||
|
private Integer isSignout;
|
||||||
|
private Integer isSignoutEarly;
|
||||||
|
private Double workDistance;
|
||||||
|
private Integer savePopulationCount;
|
||||||
|
private Integer updatePopulationCount;
|
||||||
|
private Integer isHoliday;
|
||||||
|
private Double dayScore;
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserId() {
|
||||||
|
return userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserId(String userId) {
|
||||||
|
this.userId = userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDayDate() {
|
||||||
|
return dayDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDayDate(String dayDate) {
|
||||||
|
this.dayDate = dayDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getIsSignin() {
|
||||||
|
return isSignin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsSignin(Integer isSignin) {
|
||||||
|
this.isSignin = isSignin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getIsSigninLate() {
|
||||||
|
return isSigninLate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsSigninLate(Integer isSigninLate) {
|
||||||
|
this.isSigninLate = isSigninLate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getIsSignout() {
|
||||||
|
return isSignout;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsSignout(Integer isSignout) {
|
||||||
|
this.isSignout = isSignout;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getIsSignoutEarly() {
|
||||||
|
return isSignoutEarly;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsSignoutEarly(Integer isSignoutEarly) {
|
||||||
|
this.isSignoutEarly = isSignoutEarly;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Double getWorkDistance() {
|
||||||
|
return workDistance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWorkDistance(Double workDistance) {
|
||||||
|
this.workDistance = workDistance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getSavePopulationCount() {
|
||||||
|
return savePopulationCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSavePopulationCount(Integer savePopulationCount) {
|
||||||
|
this.savePopulationCount = savePopulationCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getUpdatePopulationCount() {
|
||||||
|
return updatePopulationCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUpdatePopulationCount(Integer updatePopulationCount) {
|
||||||
|
this.updatePopulationCount = updatePopulationCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getIsHoliday() {
|
||||||
|
return isHoliday;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsHoliday(Integer isHoliday) {
|
||||||
|
this.isHoliday = isHoliday;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Double getDayScore() {
|
||||||
|
return dayScore;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDayScore(Double dayScore) {
|
||||||
|
this.dayScore = dayScore;
|
||||||
|
}
|
||||||
|
}
|
@ -15,18 +15,18 @@ public class CasePO {
|
|||||||
private String handleEndTimeLong;
|
private String handleEndTimeLong;
|
||||||
private String handleEndTime;
|
private String handleEndTime;
|
||||||
private String gmtHandle;
|
private String gmtHandle;
|
||||||
private String isTimeout;
|
private Integer isTimeout;
|
||||||
private String gmtInspect;
|
private String gmtInspect;
|
||||||
private String isSelf;
|
private Integer isSelf;
|
||||||
private String reportUserId;
|
private String reportUserId;
|
||||||
private String handleUserId;
|
private String handleUserId;
|
||||||
private String inspectUserId;
|
private String inspectUserId;
|
||||||
private String inspectScore;
|
private String inspectScore;
|
||||||
private String isDelete;
|
private Integer isDelete;
|
||||||
private String gmtDelete;
|
private String gmtDelete;
|
||||||
private String deleteUserId;
|
private String deleteUserId;
|
||||||
private String totalUrge;
|
private Integer totalUrge;
|
||||||
private String totalBack;
|
private Integer totalBack;
|
||||||
private Integer caseStatus;
|
private Integer caseStatus;
|
||||||
private Integer caseSource;
|
private Integer caseSource;
|
||||||
private Integer isAccept;
|
private Integer isAccept;
|
||||||
@ -138,11 +138,11 @@ public class CasePO {
|
|||||||
this.gmtHandle = gmtHandle;
|
this.gmtHandle = gmtHandle;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getIsTimeout() {
|
public Integer getIsTimeout() {
|
||||||
return isTimeout;
|
return isTimeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIsTimeout(String isTimeout) {
|
public void setIsTimeout(Integer isTimeout) {
|
||||||
this.isTimeout = isTimeout;
|
this.isTimeout = isTimeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,11 +154,11 @@ public class CasePO {
|
|||||||
this.gmtInspect = gmtInspect;
|
this.gmtInspect = gmtInspect;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getIsSelf() {
|
public Integer getIsSelf() {
|
||||||
return isSelf;
|
return isSelf;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIsSelf(String isSelf) {
|
public void setIsSelf(Integer isSelf) {
|
||||||
this.isSelf = isSelf;
|
this.isSelf = isSelf;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -194,11 +194,11 @@ public class CasePO {
|
|||||||
this.inspectScore = inspectScore;
|
this.inspectScore = inspectScore;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getIsDelete() {
|
public Integer getIsDelete() {
|
||||||
return isDelete;
|
return isDelete;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIsDelete(String isDelete) {
|
public void setIsDelete(Integer isDelete) {
|
||||||
this.isDelete = isDelete;
|
this.isDelete = isDelete;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -218,19 +218,19 @@ public class CasePO {
|
|||||||
this.deleteUserId = deleteUserId;
|
this.deleteUserId = deleteUserId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTotalUrge() {
|
public Integer getTotalUrge() {
|
||||||
return totalUrge;
|
return totalUrge == null ? 0 : totalUrge;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTotalUrge(String totalUrge) {
|
public void setTotalUrge(Integer totalUrge) {
|
||||||
this.totalUrge = totalUrge;
|
this.totalUrge = totalUrge;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTotalBack() {
|
public Integer getTotalBack() {
|
||||||
return totalBack;
|
return totalBack;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTotalBack(String totalBack) {
|
public void setTotalBack(Integer totalBack) {
|
||||||
this.totalBack = totalBack;
|
this.totalBack = totalBack;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ import java.util.Map;
|
|||||||
|
|
||||||
public interface IKpiKhxzService {
|
public interface IKpiKhxzService {
|
||||||
|
|
||||||
void updateWgy(Integer khYear, Integer khMonth, Integer wgyLevel);
|
void update(Integer khYear, Integer khMonth);
|
||||||
|
|
||||||
|
|
||||||
List<Map<String, Object>> listWgy(Map<String, Object> queryMap);
|
List<Map<String, Object>> listWgy(Map<String, Object> queryMap);
|
||||||
|
@ -64,4 +64,7 @@ public interface IKpiService {
|
|||||||
|
|
||||||
void exportNPersonCaseDayCount(HttpServletResponse httpServletResponse, String departmentId, String startTime, String endTime) throws IOException;
|
void exportNPersonCaseDayCount(HttpServletResponse httpServletResponse, String departmentId, String startTime, String endTime) throws IOException;
|
||||||
|
|
||||||
|
List<CommunityBossDayCountDTO> listCommunityBossDayCountByUserId(String userId, Integer year, Integer month, Integer level);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -12,4 +12,6 @@ public interface IUserService {
|
|||||||
|
|
||||||
List<UserPO> listPO(Map<String, Object> params);
|
List<UserPO> listPO(Map<String, Object> params);
|
||||||
|
|
||||||
|
List<UserPO> listPOByKeywords(Object userName);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
package com.cm.bigdata.service.kpi.impl;
|
package com.cm.bigdata.service.kpi.impl;
|
||||||
|
|
||||||
import com.cm.bigdata.dao.kpi.IKpiKhxzDao;
|
import com.cm.bigdata.dao.kpi.IKpiKhxzDao;
|
||||||
|
import com.cm.bigdata.monitor.KpiUpdateMonitor;
|
||||||
import com.cm.bigdata.service.kpi.IKpiKhxzService;
|
import com.cm.bigdata.service.kpi.IKpiKhxzService;
|
||||||
|
import com.cm.bigdata.service.kpi.IKpiService;
|
||||||
import com.cm.bigdata.service.kpi.task.KpiKhxzWgyTask;
|
import com.cm.bigdata.service.kpi.task.KpiKhxzWgyTask;
|
||||||
import com.cm.common.base.AbstractService;
|
import com.cm.common.base.AbstractService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -9,22 +11,47 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class KpiKhxzServiceImpl extends AbstractService implements IKpiKhxzService {
|
public class KpiKhxzServiceImpl extends AbstractService implements IKpiKhxzService {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IKpiKhxzDao kpiKhxzDao;
|
private IKpiKhxzDao kpiKhxzDao;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IKpiService kpiService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private KpiKhxzWgyTask kpiKhxzWgyTask;
|
private KpiKhxzWgyTask kpiKhxzWgyTask;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateWgy(Integer khYear, Integer khMonth, Integer wgyLevel) {
|
public void update(Integer khYear, Integer khMonth) {
|
||||||
kpiKhxzWgyTask.update(khYear, khMonth, wgyLevel);
|
// 这个数要和下面的任务数之和一致
|
||||||
|
KpiUpdateMonitor.getInstance().setTaskCount(11);
|
||||||
|
// 开始更新
|
||||||
|
Executors.newSingleThreadExecutor().execute(() -> {
|
||||||
|
// 更新案件,1任务
|
||||||
|
kpiService.updateCaseCount();
|
||||||
|
KpiUpdateMonitor.getInstance().complete();
|
||||||
|
// 更新4级网格员日统计,1任务
|
||||||
|
kpiService.updateCommunityBossDayCount(khYear, khMonth, 3);
|
||||||
|
KpiUpdateMonitor.getInstance().complete();
|
||||||
|
// 更新4级网格员,4任务
|
||||||
|
kpiKhxzWgyTask.update(khYear, khMonth, 3);
|
||||||
|
// 更新5级网格员日统计,1任务
|
||||||
|
kpiService.updateCommunityBossDayCount(khYear, khMonth, 4);
|
||||||
|
KpiUpdateMonitor.getInstance().complete();
|
||||||
|
// 更新5级网格员,4个任务
|
||||||
|
kpiKhxzWgyTask.update(khYear, khMonth, 4);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Map<String, Object>> listWgy(Map<String, Object> queryMap) {
|
public List<Map<String, Object>> listWgy(Map<String, Object> queryMap) {
|
||||||
return kpiKhxzDao.listWgy(queryMap);
|
return kpiKhxzDao.listWgy(queryMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package com.cm.bigdata.service.kpi.impl;
|
|||||||
|
|
||||||
import com.cm.bigdata.dao.kpi.IKpiDao;
|
import com.cm.bigdata.dao.kpi.IKpiDao;
|
||||||
import com.cm.bigdata.dao.kpi.IKpiHolidayDao;
|
import com.cm.bigdata.dao.kpi.IKpiHolidayDao;
|
||||||
|
import com.cm.bigdata.monitor.KpiUpdateMonitor;
|
||||||
import com.cm.bigdata.pojo.dtos.kpi.*;
|
import com.cm.bigdata.pojo.dtos.kpi.*;
|
||||||
import com.cm.bigdata.pojo.pos.kpi.*;
|
import com.cm.bigdata.pojo.pos.kpi.*;
|
||||||
import com.cm.bigdata.service.kpi.*;
|
import com.cm.bigdata.service.kpi.*;
|
||||||
@ -509,6 +510,21 @@ public class KpiServiceImpl implements IKpiService {
|
|||||||
ExcelExportUtil.simple(httpServletResponse, "专管员考勤", nPersonCaseDayCountDTOS, NPersonCaseDayCountDTO.class);
|
ExcelExportUtil.simple(httpServletResponse, "专管员考勤", nPersonCaseDayCountDTOS, NPersonCaseDayCountDTO.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<CommunityBossDayCountDTO> listCommunityBossDayCountByUserId(String userId, Integer year, Integer month, Integer level) {
|
||||||
|
List<String> dates = KpiUtil.listDate(year, month);
|
||||||
|
Map<String, Object> params = new HashMap<>();
|
||||||
|
params.put("startTime", dates.get(0));
|
||||||
|
params.put("endTime", dates.get(dates.size() - 1));
|
||||||
|
params.put("level", level);
|
||||||
|
params.put("userId", userId);
|
||||||
|
return kpiDao.listCommunityBossDayCountPO(params).stream().map(communityBossDayCountPO -> {
|
||||||
|
CommunityBossDayCountDTO communityBossDayCountDTO = new CommunityBossDayCountDTO();
|
||||||
|
BeanUtils.copyProperties(communityBossDayCountPO, communityBossDayCountDTO);
|
||||||
|
return communityBossDayCountDTO;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
private Integer countCase(Map<String, Object> params) {
|
private Integer countCase(Map<String, Object> params) {
|
||||||
return kpiDao.countCase(params);
|
return kpiDao.countCase(params);
|
||||||
}
|
}
|
||||||
|
@ -35,4 +35,10 @@ public class UserServiceImpl implements IUserService {
|
|||||||
return userDao.listPO(params);
|
return userDao.listPO(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<UserPO> listPOByKeywords(Object keywords) {
|
||||||
|
Map<String, Object> params = new HashMap<>();
|
||||||
|
params.put("keywords", keywords);
|
||||||
|
return userDao.listPO(params);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,16 @@
|
|||||||
package com.cm.bigdata.service.kpi.task;
|
package com.cm.bigdata.service.kpi.task;
|
||||||
|
|
||||||
import com.cm.bigdata.dao.kpi.IKpiDao;
|
import com.cm.bigdata.dao.kpi.IKpiDao;
|
||||||
|
import com.cm.bigdata.dao.kpi.IKpiHolidayDao;
|
||||||
import com.cm.bigdata.dao.kpi.IKpiKhxzWgyDao;
|
import com.cm.bigdata.dao.kpi.IKpiKhxzWgyDao;
|
||||||
|
import com.cm.bigdata.monitor.KpiUpdateMonitor;
|
||||||
import com.cm.bigdata.pojo.dtos.kpi.CommunityBossDTO;
|
import com.cm.bigdata.pojo.dtos.kpi.CommunityBossDTO;
|
||||||
import com.cm.bigdata.pojo.pos.kpi.UserPO;
|
import com.cm.bigdata.pojo.pos.kpi.UserPO;
|
||||||
import com.cm.bigdata.service.kpi.ICommunityBossService;
|
import com.cm.bigdata.service.kpi.ICommunityBossService;
|
||||||
import com.cm.bigdata.service.kpi.IKpiService;
|
import com.cm.bigdata.service.kpi.IKpiService;
|
||||||
import com.cm.bigdata.service.kpi.IUserService;
|
import com.cm.bigdata.service.kpi.IUserService;
|
||||||
import com.cm.bigdata.service.kpi.task.sub.KpiKhxzWgyCRunnable;
|
import com.cm.bigdata.service.kpi.task.sub.KpiKhxzWgyCRunnable;
|
||||||
|
import com.cm.bigdata.service.kpi.task.sub.KpiKhxzWgyEGIKRTRunnable;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@ -17,7 +20,6 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@ -28,41 +30,36 @@ public class KpiKhxzWgyTask {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IKpiDao kpiDao;
|
private IKpiDao kpiDao;
|
||||||
@Autowired
|
@Autowired
|
||||||
|
private IKpiHolidayDao kpiHolidayDao;
|
||||||
|
@Autowired
|
||||||
private IUserService userService;
|
private IUserService userService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private ICommunityBossService communityBossService;
|
private ICommunityBossService communityBossService;
|
||||||
@Autowired
|
|
||||||
private IKpiService kpiService;
|
|
||||||
private ExecutorService executorService = Executors.newFixedThreadPool(10);
|
private ExecutorService executorService = Executors.newFixedThreadPool(10);
|
||||||
|
|
||||||
public void update(int khYear, int khMonth, int wgyLevel) {
|
public void update(int khYear, int khMonth, int wgyLevel) {
|
||||||
kpiService.updateCommunityBossDayCount(khYear, khMonth, wgyLevel);
|
deleteBaseWgy(khYear, khMonth, wgyLevel);
|
||||||
deleteBase(khYear, khMonth, wgyLevel);
|
updateBaseWgy(khYear, khMonth, wgyLevel);
|
||||||
updateBase(khYear, khMonth, wgyLevel);
|
|
||||||
List<String> userIds = listUserIds(khYear, khMonth, wgyLevel);
|
List<String> userIds = listUserIds(khYear, khMonth, wgyLevel);
|
||||||
if (userIds.isEmpty()) {
|
if (userIds.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
executorService.execute(new KpiKhxzWgyCRunnable(kpiKhxzWgyDao, kpiDao, khYear, khMonth, wgyLevel, userIds));
|
executorService.execute(new KpiKhxzWgyCRunnable(kpiKhxzWgyDao, kpiDao, khYear, khMonth, wgyLevel, userIds));
|
||||||
|
executorService.execute(new KpiKhxzWgyEGIKRTRunnable(kpiKhxzWgyDao, kpiHolidayDao, kpiDao, khYear, khMonth, wgyLevel, userIds));
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<String> listUserIds(int khYear, int khMonth, int wgyLevel) {
|
private void deleteBaseWgy(int khYear, int khMonth, int wgyLevel) {
|
||||||
Map<String, Object> params = new HashMap<>();
|
|
||||||
params.put("khYear", khYear);
|
|
||||||
params.put("khMonth", khMonth);
|
|
||||||
params.put("wgyLevel", wgyLevel);
|
|
||||||
return kpiKhxzWgyDao.listUserId(params);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void deleteBase(int khYear, int khMonth, int wgyLevel) {
|
|
||||||
Map<String, Object> params = new HashMap<>();
|
Map<String, Object> params = new HashMap<>();
|
||||||
params.put("khYear", khYear);
|
params.put("khYear", khYear);
|
||||||
params.put("khMonth", khMonth);
|
params.put("khMonth", khMonth);
|
||||||
params.put("wgyLevel", wgyLevel);
|
params.put("wgyLevel", wgyLevel);
|
||||||
kpiKhxzWgyDao.delete(params);
|
kpiKhxzWgyDao.delete(params);
|
||||||
|
KpiUpdateMonitor.getInstance().complete();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateBase(int khYear, int khMonth, int wgyLevel) {
|
private void updateBaseWgy(int khYear, int khMonth, int wgyLevel) {
|
||||||
Map<String, Object> params = new HashMap<>();
|
Map<String, Object> params = new HashMap<>();
|
||||||
params.put("communityBossLevel", wgyLevel);
|
params.put("communityBossLevel", wgyLevel);
|
||||||
// 删除
|
// 删除
|
||||||
@ -92,12 +89,22 @@ public class KpiKhxzWgyTask {
|
|||||||
saveParams.put("areaId", areaId);
|
saveParams.put("areaId", areaId);
|
||||||
saveParams.put("communityId", communityId);
|
saveParams.put("communityId", communityId);
|
||||||
saveParams.put("userId", userPO.getUserId());
|
saveParams.put("userId", userPO.getUserId());
|
||||||
|
saveParams.put("userUsername", userPO.getUserUsername());
|
||||||
saveParams.put("B", userPO.getUserName());
|
saveParams.put("B", userPO.getUserName());
|
||||||
saveParams.put("khYear", khYear);
|
saveParams.put("khYear", khYear);
|
||||||
saveParams.put("khMonth", khMonth);
|
saveParams.put("khMonth", khMonth);
|
||||||
saveParams.put("wgyLevel", wgyLevel);
|
saveParams.put("wgyLevel", wgyLevel);
|
||||||
kpiKhxzWgyDao.save(saveParams);
|
kpiKhxzWgyDao.save(saveParams);
|
||||||
});
|
});
|
||||||
|
KpiUpdateMonitor.getInstance().complete();
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<String> listUserIds(int khYear, int khMonth, int wgyLevel) {
|
||||||
|
Map<String, Object> params = new HashMap<>();
|
||||||
|
params.put("khYear", khYear);
|
||||||
|
params.put("khMonth", khMonth);
|
||||||
|
params.put("wgyLevel", wgyLevel);
|
||||||
|
return kpiKhxzWgyDao.listUserId(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package com.cm.bigdata.service.kpi.task.sub;
|
|||||||
|
|
||||||
import com.cm.bigdata.dao.kpi.IKpiDao;
|
import com.cm.bigdata.dao.kpi.IKpiDao;
|
||||||
import com.cm.bigdata.dao.kpi.IKpiKhxzWgyDao;
|
import com.cm.bigdata.dao.kpi.IKpiKhxzWgyDao;
|
||||||
|
import com.cm.bigdata.monitor.KpiUpdateMonitor;
|
||||||
import com.cm.bigdata.pojo.pos.kpi.CommunityBossDayCountPO;
|
import com.cm.bigdata.pojo.pos.kpi.CommunityBossDayCountPO;
|
||||||
import com.cm.bigdata.utils.KpiUtil;
|
import com.cm.bigdata.utils.KpiUtil;
|
||||||
|
|
||||||
@ -30,34 +31,34 @@ public class KpiKhxzWgyCRunnable implements Runnable {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
List<String> dates = KpiUtil.listDate(year, month);
|
List<String> dates = KpiUtil.listDate(year, month);
|
||||||
dates.forEach(date -> {
|
Map<String, Object> params = new HashMap<>();
|
||||||
Map<String, Object> params = new HashMap<>();
|
params.put("level", level);
|
||||||
params.put("level", level);
|
userIds.forEach(userId -> {
|
||||||
userIds.forEach(userId -> {
|
params.put("userId", userId);
|
||||||
params.put("userId", userId);
|
params.put("startTime", dates.get(0));
|
||||||
params.put("dayDate", date);
|
params.put("endTime", dates.get(dates.size() - 1));
|
||||||
List<CommunityBossDayCountPO> communityBossDayCountPOS = kpiDao.listCommunityBossDayCountPO(params);
|
List<CommunityBossDayCountPO> communityBossDayCountPOS = kpiDao.listCommunityBossDayCountPO(params);
|
||||||
int workDay = 0;
|
int workDay = 0;
|
||||||
double totalDayScore = 0D;
|
double totalDayScore = 0D;
|
||||||
for (CommunityBossDayCountPO communityBossDayCountPO : communityBossDayCountPOS) {
|
for (CommunityBossDayCountPO communityBossDayCountPO : communityBossDayCountPOS) {
|
||||||
int isHoliday = communityBossDayCountPO.getIsHoliday();
|
totalDayScore += communityBossDayCountPO.getDayScore();
|
||||||
if (isHoliday == 1) {
|
int isHoliday = communityBossDayCountPO.getIsHoliday();
|
||||||
continue;
|
if (isHoliday == 1) {
|
||||||
}
|
continue;
|
||||||
workDay++;
|
|
||||||
totalDayScore += communityBossDayCountPO.getDayScore();
|
|
||||||
}
|
}
|
||||||
double totalScore = workDay == 0 ? 0D : totalDayScore / workDay;
|
workDay++;
|
||||||
// 保存总分
|
}
|
||||||
Map<String, Object> updateParams = new HashMap<>();
|
double totalScore = workDay == 0 ? 0D : totalDayScore / workDay;
|
||||||
updateParams.put("khYear", year);
|
// 保存总分
|
||||||
updateParams.put("khMonth", month);
|
Map<String, Object> updateParams = new HashMap<>();
|
||||||
updateParams.put("wgyLevel", level);
|
updateParams.put("khYear", year);
|
||||||
updateParams.put("userId", userId);
|
updateParams.put("khMonth", month);
|
||||||
updateParams.put("C", totalScore);
|
updateParams.put("wgyLevel", level);
|
||||||
kpiKhxzWgyDao.updateC(updateParams);
|
updateParams.put("userId", userId);
|
||||||
});
|
updateParams.put("C", totalScore);
|
||||||
|
kpiKhxzWgyDao.updateC(updateParams);
|
||||||
});
|
});
|
||||||
|
KpiUpdateMonitor.getInstance().complete();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,136 +0,0 @@
|
|||||||
package com.cm.bigdata.service.kpi.task.sub;
|
|
||||||
|
|
||||||
import com.cm.bigdata.dao.kpi.IKpiHolidayDao;
|
|
||||||
import com.cm.bigdata.dao.kpi.IKpiKhxzWgyDao;
|
|
||||||
import com.cm.bigdata.pojo.pos.kpi.HolidayPO;
|
|
||||||
import com.cm.bigdata.utils.KpiUtil;
|
|
||||||
import com.cm.common.constants.ISystemConstant;
|
|
||||||
import javafx.scene.effect.InnerShadow;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.joda.time.DateTime;
|
|
||||||
import org.joda.time.format.DateTimeFormat;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class KpiKhxzWgyDRunnable implements Runnable {
|
|
||||||
|
|
||||||
private IKpiKhxzWgyDao kpiKhxzWgyDao;
|
|
||||||
private IKpiHolidayDao kpiHolidayDao;
|
|
||||||
private int year;
|
|
||||||
private int month;
|
|
||||||
private int level;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
List<HolidayPO> holidayPOS = listHoliday();
|
|
||||||
List<List<DayWeek>> dayWeeks = listDayWeekOfMonth(year, month);
|
|
||||||
int shouldReportCount = 0;
|
|
||||||
for (List<DayWeek> dws : dayWeeks) {
|
|
||||||
int holidayCount = 0;
|
|
||||||
for (DayWeek dayWeek : dws) {
|
|
||||||
boolean isHoliday = false;
|
|
||||||
for (HolidayPO holidayPO : holidayPOS) {
|
|
||||||
String holiday = String.format("%04d-%02d-%02d", holidayPO.getHolidayYear(), holidayPO.getHolidayMonth(), holidayPO.getHolidayDay());
|
|
||||||
if (StringUtils.equals(dayWeek.getDate(), holiday)) {
|
|
||||||
isHoliday = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (isHoliday) {
|
|
||||||
holidayCount++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 如果假期小于4天,就应该上报一条
|
|
||||||
if (holidayCount > 4) {
|
|
||||||
shouldReportCount++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<HolidayPO> listHoliday() {
|
|
||||||
Map<String, Object> params = new HashMap<>();
|
|
||||||
params.put("holidayYear", year);
|
|
||||||
params.put("holidayMonth", month);
|
|
||||||
return kpiHolidayDao.list(params);
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<List<DayWeek>> listDayWeekOfMonth(int year, int month) {
|
|
||||||
DateTime dateTime = DateTime.parse(String.format("%04d-%02d", year, month), DateTimeFormat.forPattern("yyyy-MM"));
|
|
||||||
DateTime.Property dayOfMonth = dateTime.dayOfMonth();
|
|
||||||
DateTime monthEndDateTime = dayOfMonth.withMaximumValue();
|
|
||||||
int monthEndDay = monthEndDateTime.getDayOfMonth();
|
|
||||||
List<List<DayWeek>> dayWeeks = new ArrayList<>();
|
|
||||||
int weekOfMonth = 1;
|
|
||||||
List<DayWeek> currentWeekDays = new ArrayList<>();
|
|
||||||
for (int i = 1; i <= monthEndDay; i++) {
|
|
||||||
DateTime dayDateTime = dateTime.withDayOfMonth(i);
|
|
||||||
String day = dayDateTime.toString(DateTimeFormat.forPattern(ISystemConstant.DATE_FORMATTER_YYYY_MM_DD));
|
|
||||||
DayWeek dayWeek = new DayWeek(day, weekOfMonth, dayDateTime.dayOfWeek().get());
|
|
||||||
currentWeekDays.add(dayWeek);
|
|
||||||
if (dayWeek.getDayOfWeek() == 7 || (i == monthEndDay - 1)) {
|
|
||||||
dayWeeks.add(currentWeekDays);
|
|
||||||
weekOfMonth++;
|
|
||||||
currentWeekDays = new ArrayList<>();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return dayWeeks;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class DayWeek {
|
|
||||||
private String date;
|
|
||||||
private int year;
|
|
||||||
private int month;
|
|
||||||
private int day;
|
|
||||||
private int weekOfMonth;
|
|
||||||
private int dayOfWeek;
|
|
||||||
|
|
||||||
public DayWeek(String date, int weekOfMonth, int dayOfWeek) {
|
|
||||||
this.date = date;
|
|
||||||
this.weekOfMonth = weekOfMonth;
|
|
||||||
this.dayOfWeek = dayOfWeek;
|
|
||||||
String[] dateArray = date.split("-");
|
|
||||||
this.year = Integer.parseInt(dateArray[0]);
|
|
||||||
this.month = Integer.parseInt(dateArray[1]);
|
|
||||||
this.day = Integer.parseInt(dateArray[2]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDate() {
|
|
||||||
return date;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getYear() {
|
|
||||||
return year;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getMonth() {
|
|
||||||
return month;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getDay() {
|
|
||||||
return day;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getWeekOfMonth() {
|
|
||||||
return weekOfMonth;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getDayOfWeek() {
|
|
||||||
return dayOfWeek;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "DayWeek{" +
|
|
||||||
"date='" + date + '\'' +
|
|
||||||
", year=" + year +
|
|
||||||
", month=" + month +
|
|
||||||
", day=" + day +
|
|
||||||
", weekOfMonth=" + weekOfMonth +
|
|
||||||
", dayOfWeek=" + dayOfWeek +
|
|
||||||
'}';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,159 @@
|
|||||||
|
package com.cm.bigdata.service.kpi.task.sub;
|
||||||
|
|
||||||
|
import com.cm.bigdata.dao.kpi.IKpiDao;
|
||||||
|
import com.cm.bigdata.dao.kpi.IKpiHolidayDao;
|
||||||
|
import com.cm.bigdata.dao.kpi.IKpiKhxzWgyDao;
|
||||||
|
import com.cm.bigdata.monitor.KpiUpdateMonitor;
|
||||||
|
import com.cm.bigdata.pojo.pos.kpi.CasePO;
|
||||||
|
import com.cm.bigdata.pojo.pos.kpi.HolidayPO;
|
||||||
|
import com.cm.bigdata.utils.KpiUtil;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class KpiKhxzWgyEGIKRTRunnable implements Runnable {
|
||||||
|
|
||||||
|
private IKpiKhxzWgyDao kpiKhxzWgyDao;
|
||||||
|
private IKpiHolidayDao kpiHolidayDao;
|
||||||
|
private IKpiDao kpiDao;
|
||||||
|
private int year;
|
||||||
|
private int month;
|
||||||
|
private int level;
|
||||||
|
private List<String> userIds;
|
||||||
|
|
||||||
|
public KpiKhxzWgyEGIKRTRunnable(IKpiKhxzWgyDao kpiKhxzWgyDao, IKpiHolidayDao kpiHolidayDao, IKpiDao kpiDao, int year, int month, int level, List<String> userIds) {
|
||||||
|
this.kpiKhxzWgyDao = kpiKhxzWgyDao;
|
||||||
|
this.kpiHolidayDao = kpiHolidayDao;
|
||||||
|
this.kpiDao = kpiDao;
|
||||||
|
this.year = year;
|
||||||
|
this.month = month;
|
||||||
|
this.level = level;
|
||||||
|
this.userIds = userIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
List<HolidayPO> holidayPOS = listHoliday();
|
||||||
|
List<List<KpiUtil.DayWeek>> dayWeeks = KpiUtil.listDayWeekOfMonth(year, month);
|
||||||
|
List<List<KpiUtil.DayWeek>> shouldReportDayWeeks = listShouldReportDayWeek(holidayPOS, dayWeeks);
|
||||||
|
updateEGIKRT(userIds, shouldReportDayWeeks);
|
||||||
|
KpiUpdateMonitor.getInstance().complete();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上报统计数组
|
||||||
|
*
|
||||||
|
* @param holidayPOS
|
||||||
|
* @param dayWeeks
|
||||||
|
* @return [应报,实报,少报,多报]
|
||||||
|
*/
|
||||||
|
public static List<List<KpiUtil.DayWeek>> listShouldReportDayWeek(List<HolidayPO> holidayPOS, List<List<KpiUtil.DayWeek>> dayWeeks) {
|
||||||
|
List<List<KpiUtil.DayWeek>> shouldReportDayWeeks = new ArrayList<>();
|
||||||
|
for (List<KpiUtil.DayWeek> dws : dayWeeks) {
|
||||||
|
int workdayCount = 0;
|
||||||
|
for (KpiUtil.DayWeek dayWeek : dws) {
|
||||||
|
boolean isHoliday = false;
|
||||||
|
for (HolidayPO holidayPO : holidayPOS) {
|
||||||
|
String holiday = String.format("%04d-%02d-%02d", holidayPO.getHolidayYear(), holidayPO.getHolidayMonth(), holidayPO.getHolidayDay());
|
||||||
|
if (StringUtils.equals(dayWeek.getDate(), holiday)) {
|
||||||
|
dayWeek.setHoliday(true);
|
||||||
|
isHoliday = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isHoliday) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
workdayCount++;
|
||||||
|
}
|
||||||
|
// 工作天数大于三天,需要上报
|
||||||
|
if (workdayCount > 3) {
|
||||||
|
shouldReportDayWeeks.add(dws);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return shouldReportDayWeeks;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateEGIKRT(List<String> userIds, List<List<KpiUtil.DayWeek>> shouldReportDayWeeks) {
|
||||||
|
int shouldCount = shouldReportDayWeeks.size();
|
||||||
|
userIds.forEach(userId -> {
|
||||||
|
// 每周上报
|
||||||
|
int weekReportCount = 0;
|
||||||
|
// 实报
|
||||||
|
int realityCount = 0;
|
||||||
|
// 少报
|
||||||
|
int lackCount = 0;
|
||||||
|
// 多报
|
||||||
|
int exceedCount = 0;
|
||||||
|
// 督办次数
|
||||||
|
int urgeCount = 0;
|
||||||
|
// 超时检查数量
|
||||||
|
int inspectTimeoutCount = 0;
|
||||||
|
for (List<KpiUtil.DayWeek> shouldReportDayWeek : shouldReportDayWeeks) {
|
||||||
|
String startTime = shouldReportDayWeek.get(0).getDate();
|
||||||
|
String endTime = shouldReportDayWeek.get(shouldReportDayWeek.size() - 1).getDate();
|
||||||
|
Map<String, Object> params = new HashMap<>();
|
||||||
|
params.put("reportUserId", userId);
|
||||||
|
params.put("startTime", startTime);
|
||||||
|
params.put("endTime", endTime);
|
||||||
|
List<CasePO> casePOS = kpiDao.listCase(params);
|
||||||
|
boolean isWeekReport = false;
|
||||||
|
for (CasePO casePO : casePOS) {
|
||||||
|
urgeCount += casePO.getTotalUrge();
|
||||||
|
// 自处理
|
||||||
|
Integer isSelf = casePO.getIsSelf();
|
||||||
|
// 不是自处理,上报就算处理
|
||||||
|
if (isSelf == 0) {
|
||||||
|
realityCount++;
|
||||||
|
isWeekReport = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// 处理时间
|
||||||
|
String gmtHandle = casePO.getGmtHandle();
|
||||||
|
if (StringUtils.isBlank(gmtHandle)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// 检查时间
|
||||||
|
String gmtInspect = casePO.getGmtInspect();
|
||||||
|
if (StringUtils.isBlank(gmtInspect)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// 处理时间和检查时间超过24小时
|
||||||
|
if (KpiUtil.isdateTimeIn24Hours(gmtHandle, gmtInspect)) {
|
||||||
|
inspectTimeoutCount++;
|
||||||
|
}
|
||||||
|
if (KpiUtil.isDateBetween(gmtInspect, startTime, endTime)) {
|
||||||
|
realityCount++;
|
||||||
|
isWeekReport = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
weekReportCount += isWeekReport ? 1 : 0;
|
||||||
|
lackCount = Math.max(shouldCount - weekReportCount, 0);
|
||||||
|
exceedCount = Math.max(realityCount - shouldCount, 0);
|
||||||
|
}
|
||||||
|
Map<String, Object> updateParams = new HashMap<>();
|
||||||
|
updateParams.put("E", shouldCount);
|
||||||
|
updateParams.put("G", weekReportCount);
|
||||||
|
updateParams.put("I", lackCount);
|
||||||
|
updateParams.put("K", exceedCount);
|
||||||
|
updateParams.put("R", urgeCount);
|
||||||
|
updateParams.put("T", inspectTimeoutCount * 0.1);
|
||||||
|
updateParams.put("khYear", year);
|
||||||
|
updateParams.put("khMonth", month);
|
||||||
|
updateParams.put("wgyLevel", level);
|
||||||
|
updateParams.put("userId", userId);
|
||||||
|
kpiKhxzWgyDao.updateEGIKRT(updateParams);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<HolidayPO> listHoliday() {
|
||||||
|
Map<String, Object> params = new HashMap<>();
|
||||||
|
params.put("holidayYear", year);
|
||||||
|
params.put("holidayMonth", month);
|
||||||
|
return kpiHolidayDao.list(params);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,6 +1,5 @@
|
|||||||
package com.cm.bigdata.utils;
|
package com.cm.bigdata.utils;
|
||||||
|
|
||||||
import com.cm.bigdata.dao.kpi.IKpiKhxzWgyDao;
|
|
||||||
import com.cm.bigdata.pojo.pos.kpi.BasePopulationInfoCountPO;
|
import com.cm.bigdata.pojo.pos.kpi.BasePopulationInfoCountPO;
|
||||||
import com.cm.bigdata.pojo.pos.kpi.UserLocationPO;
|
import com.cm.bigdata.pojo.pos.kpi.UserLocationPO;
|
||||||
import com.cm.bigdata.pojo.pos.kpi.UserSigninPO;
|
import com.cm.bigdata.pojo.pos.kpi.UserSigninPO;
|
||||||
@ -13,13 +12,38 @@ import com.cm.common.utils.point.Point;
|
|||||||
import com.cm.common.utils.point.PointUtil;
|
import com.cm.common.utils.point.PointUtil;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
|
import org.joda.time.Hours;
|
||||||
import org.joda.time.format.DateTimeFormat;
|
import org.joda.time.format.DateTimeFormat;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
public class KpiUtil {
|
public class KpiUtil {
|
||||||
|
|
||||||
|
public static boolean isdateTimeIn24Hours(String date1, DateTime date2) {
|
||||||
|
date1 = date1.split("\\.")[0];
|
||||||
|
DateTime date1DateTime = DateTime.parse(date1, DateTimeFormat.forPattern(ISystemConstant.DATE_FORMATTER_YYYY_MM_DD_HH_MM_SS));
|
||||||
|
return Hours.hoursBetween(date1DateTime, date2).getHours() < 24;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isdateTimeIn24Hours(String date1, String date2) {
|
||||||
|
date1 = date1.split("\\.")[0];
|
||||||
|
date2 = date2.split("\\.")[0];
|
||||||
|
DateTime date1DateTime = DateTime.parse(date1, DateTimeFormat.forPattern(ISystemConstant.DATE_FORMATTER_YYYY_MM_DD_HH_MM_SS));
|
||||||
|
DateTime date2DateTime = DateTime.parse(date2, DateTimeFormat.forPattern(ISystemConstant.DATE_FORMATTER_YYYY_MM_DD_HH_MM_SS));
|
||||||
|
return Hours.hoursBetween(date1DateTime, date2DateTime).getHours() < 24;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isDateBetween(String date, String startDate, String endDate) {
|
||||||
|
if (StringUtils.isBlank(date)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
date = date.split("\\.")[0];
|
||||||
|
DateTime dateTime = DateTime.parse(date, DateTimeFormat.forPattern(ISystemConstant.DATE_FORMATTER_YYYY_MM_DD_HH_MM_SS));
|
||||||
|
DateTime startDateTime = DateTime.parse(startDate, DateTimeFormat.forPattern(ISystemConstant.DATE_FORMATTER_YYYY_MM_DD));
|
||||||
|
DateTime endDateTime = DateTime.parse(endDate, DateTimeFormat.forPattern(ISystemConstant.DATE_FORMATTER_YYYY_MM_DD));
|
||||||
|
return dateTime.isAfter(startDateTime) && dateTime.isBefore(endDateTime);
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean hasValueInList(List<String> values, String checkValue) {
|
public static boolean hasValueInList(List<String> values, String checkValue) {
|
||||||
for (String value : values) {
|
for (String value : values) {
|
||||||
if (StringUtils.equals(value, checkValue)) {
|
if (StringUtils.equals(value, checkValue)) {
|
||||||
@ -145,5 +169,83 @@ public class KpiUtil {
|
|||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static List<List<DayWeek>> listDayWeekOfMonth(int year, int month) {
|
||||||
|
DateTime dateTime = DateTime.parse(String.format("%04d-%02d", year, month), DateTimeFormat.forPattern("yyyy-MM"));
|
||||||
|
DateTime.Property dayOfMonth = dateTime.dayOfMonth();
|
||||||
|
DateTime monthEndDateTime = dayOfMonth.withMaximumValue();
|
||||||
|
int monthEndDay = monthEndDateTime.getDayOfMonth();
|
||||||
|
List<List<DayWeek>> dayWeeks = new ArrayList<>();
|
||||||
|
int weekOfMonth = 1;
|
||||||
|
List<DayWeek> currentWeekDays = new ArrayList<>();
|
||||||
|
for (int i = 1; i <= monthEndDay; i++) {
|
||||||
|
DateTime dayDateTime = dateTime.withDayOfMonth(i);
|
||||||
|
String day = dayDateTime.toString(DateTimeFormat.forPattern(ISystemConstant.DATE_FORMATTER_YYYY_MM_DD));
|
||||||
|
DayWeek dayWeek = new DayWeek(day, weekOfMonth, dayDateTime.dayOfWeek().get());
|
||||||
|
currentWeekDays.add(dayWeek);
|
||||||
|
if (dayWeek.getDayOfWeek() == 7 || (i == monthEndDay - 1)) {
|
||||||
|
dayWeeks.add(currentWeekDays);
|
||||||
|
weekOfMonth++;
|
||||||
|
currentWeekDays = new ArrayList<>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return dayWeeks;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class DayWeek {
|
||||||
|
private String date;
|
||||||
|
private int year;
|
||||||
|
private int month;
|
||||||
|
private int day;
|
||||||
|
private int weekOfMonth;
|
||||||
|
private int dayOfWeek;
|
||||||
|
private boolean isHoliday = false;
|
||||||
|
|
||||||
|
public DayWeek(String date, int weekOfMonth, int dayOfWeek) {
|
||||||
|
this.date = date;
|
||||||
|
this.weekOfMonth = weekOfMonth;
|
||||||
|
this.dayOfWeek = dayOfWeek;
|
||||||
|
String[] dateArray = date.split("-");
|
||||||
|
this.year = Integer.parseInt(dateArray[0]);
|
||||||
|
this.month = Integer.parseInt(dateArray[1]);
|
||||||
|
this.day = Integer.parseInt(dateArray[2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDate() {
|
||||||
|
return date;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getYear() {
|
||||||
|
return year;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMonth() {
|
||||||
|
return month;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getDay() {
|
||||||
|
return day;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getWeekOfMonth() {
|
||||||
|
return weekOfMonth;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getDayOfWeek() {
|
||||||
|
return dayOfWeek;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isHoliday() {
|
||||||
|
return isHoliday;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHoliday(boolean holiday) {
|
||||||
|
isHoliday = holiday;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "DayWeek{" + "date='" + date + '\'' + ", year=" + year + ", month=" + month + ", day=" + day + ", weekOfMonth=" + weekOfMonth + ", dayOfWeek=" + dayOfWeek + ", isHoliday=" + isHoliday + '}';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,13 @@
|
|||||||
sys_user su
|
sys_user su
|
||||||
WHERE
|
WHERE
|
||||||
is_delete = 0
|
is_delete = 0
|
||||||
|
<if test="keywords != null and keywords != ''">
|
||||||
|
AND (
|
||||||
|
user_name LIKE CONCAT('%', #{keywords}, '%')
|
||||||
|
OR
|
||||||
|
user_username LIKE CONCAT('%', #{keywords}, '%')
|
||||||
|
)
|
||||||
|
</if>
|
||||||
<if test="userIds != null and userIds.size > 0">
|
<if test="userIds != null and userIds.size > 0">
|
||||||
AND
|
AND
|
||||||
user_id IN
|
user_id IN
|
||||||
|
@ -7,10 +7,37 @@
|
|||||||
*
|
*
|
||||||
FROM
|
FROM
|
||||||
kpi_khxz_wgy_${wgyLevel}
|
kpi_khxz_wgy_${wgyLevel}
|
||||||
WHERE
|
<where>
|
||||||
kh_year = #{khYear}
|
<if test="areaId != null and areaId != ''">
|
||||||
|
area_id = #{areaId}
|
||||||
|
</if>
|
||||||
|
<if test="communityId != null and communityId != ''">
|
||||||
AND
|
AND
|
||||||
|
community_id = #{communityId}
|
||||||
|
</if>
|
||||||
|
<if test="keywords != null and keywords != ''">
|
||||||
|
AND (
|
||||||
|
B LIKE CONCAT('%', #{keywords}, '%')
|
||||||
|
OR
|
||||||
|
user_username LIKE CONCAT('%', #{keywords}, '%')
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
<if test="khYear != null and khYear != ''">
|
||||||
|
AND
|
||||||
|
kh_year = #{khYear}
|
||||||
|
</if>
|
||||||
|
AND
|
||||||
|
<if test="khMonth != null and khMonth != ''">
|
||||||
kh_month = #{khMonth}
|
kh_month = #{khMonth}
|
||||||
|
</if>
|
||||||
|
<if test="userIds != null and userIds.size > 0">
|
||||||
|
AND
|
||||||
|
user_id IN
|
||||||
|
<foreach collection="userIds" index="index" open="(" separator="," close=")">
|
||||||
|
#{userIds[${index}]}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
@ -7,6 +7,7 @@
|
|||||||
area_id,
|
area_id,
|
||||||
community_id,
|
community_id,
|
||||||
user_id,
|
user_id,
|
||||||
|
user_username,
|
||||||
kh_year,
|
kh_year,
|
||||||
kh_month,
|
kh_month,
|
||||||
B
|
B
|
||||||
@ -14,6 +15,7 @@
|
|||||||
#{areaId},
|
#{areaId},
|
||||||
#{communityId},
|
#{communityId},
|
||||||
#{userId},
|
#{userId},
|
||||||
|
#{userUsername},
|
||||||
#{khYear},
|
#{khYear},
|
||||||
#{khMonth},
|
#{khMonth},
|
||||||
#{B}
|
#{B}
|
||||||
@ -40,6 +42,17 @@
|
|||||||
kh_month = #{khMonth}
|
kh_month = #{khMonth}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="listUserId" parameterType="map" resultType="java.lang.String">
|
||||||
|
SELECT
|
||||||
|
user_id
|
||||||
|
FROM
|
||||||
|
kpi_khxz_wgy_${wgyLevel}
|
||||||
|
WHERE
|
||||||
|
kh_year = #{khYear}
|
||||||
|
AND
|
||||||
|
kh_month = #{khMonth}
|
||||||
|
</select>
|
||||||
|
|
||||||
<update id="updateC" parameterType="map">
|
<update id="updateC" parameterType="map">
|
||||||
UPDATE
|
UPDATE
|
||||||
kpi_khxz_wgy_${wgyLevel}
|
kpi_khxz_wgy_${wgyLevel}
|
||||||
@ -53,15 +66,23 @@
|
|||||||
user_id = #{userId}
|
user_id = #{userId}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<select id="listUserId" parameterType="map" resultType="java.lang.String">
|
<update id="updateEGIKRT" parameterType="map">
|
||||||
SELECT
|
UPDATE
|
||||||
user_id
|
|
||||||
FROM
|
|
||||||
kpi_khxz_wgy_${wgyLevel}
|
kpi_khxz_wgy_${wgyLevel}
|
||||||
|
SET
|
||||||
|
E = #{E},
|
||||||
|
G = #{G},
|
||||||
|
I = #{I},
|
||||||
|
K = #{K},
|
||||||
|
R = #{R},
|
||||||
|
T = #{T}
|
||||||
WHERE
|
WHERE
|
||||||
kh_year = #{khYear}
|
kh_year = #{khYear}
|
||||||
AND
|
AND
|
||||||
kh_month = #{khMonth}
|
kh_month = #{khMonth}
|
||||||
</select>
|
AND
|
||||||
|
user_id = #{userId}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
@ -139,6 +139,82 @@
|
|||||||
day_date = #{dayDate}
|
day_date = #{dayDate}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<!-- 删除NPerson -->
|
||||||
|
<delete id="deleteNPersonDayCount" parameterType="map">
|
||||||
|
DELETE FROM
|
||||||
|
kpi_n_person
|
||||||
|
WHERE
|
||||||
|
day_date = #{dayDate}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<insert id="saveNPersonDayCount" parameterType="map">
|
||||||
|
INSERT INTO kpi_n_person(
|
||||||
|
user_id,
|
||||||
|
day_date,
|
||||||
|
is_signin,
|
||||||
|
is_signin_late,
|
||||||
|
is_signout,
|
||||||
|
is_signout_early,
|
||||||
|
is_holiday,
|
||||||
|
day_score
|
||||||
|
) VALUES (
|
||||||
|
#{userId},
|
||||||
|
#{dayDate},
|
||||||
|
#{isSignin},
|
||||||
|
#{isSigninLate},
|
||||||
|
#{isSignout},
|
||||||
|
#{isSignoutEarly},
|
||||||
|
#{isHoliday},
|
||||||
|
#{dayScore}
|
||||||
|
)
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<select id="listCommunityBossDayCountPO" parameterType="map" resultMap="communityBossDayCountPO">
|
||||||
|
SELECT
|
||||||
|
*
|
||||||
|
FROM
|
||||||
|
kpi_community_boss_${level}_day_count
|
||||||
|
<where>
|
||||||
|
<if test="userId != null and userId != ''">
|
||||||
|
AND
|
||||||
|
user_id = #{userId}
|
||||||
|
<if test="dayDate != null and dayDate != ''">
|
||||||
|
AND
|
||||||
|
day_date = #{dayDate}
|
||||||
|
</if>
|
||||||
|
</if>
|
||||||
|
<if test="startTime != null and startTime != ''">
|
||||||
|
AND
|
||||||
|
day_date <![CDATA[ >= ]]> #{startTime}
|
||||||
|
</if>
|
||||||
|
<if test="endTime != null and endTime != ''">
|
||||||
|
AND
|
||||||
|
day_date <![CDATA[ <= ]]> #{endTime}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="listNPersonDayCountPO" parameterType="map" resultMap="nPersonDayCountPO">
|
||||||
|
SELECT
|
||||||
|
*
|
||||||
|
FROM
|
||||||
|
kpi_n_person
|
||||||
|
<where>
|
||||||
|
<if test="userId != null and userId != ''">
|
||||||
|
AND
|
||||||
|
user_id = #{userId}
|
||||||
|
</if>
|
||||||
|
<if test="startTime != null and startTime != ''">
|
||||||
|
AND
|
||||||
|
day_date <![CDATA[ >= ]]> #{startTime}
|
||||||
|
</if>
|
||||||
|
<if test="endTime != null and endTime != ''">
|
||||||
|
AND
|
||||||
|
day_date <![CDATA[ <= ]]> #{endTime}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
<!-- 保存案件 -->
|
<!-- 保存案件 -->
|
||||||
<insert id="saveCase" parameterType="map">
|
<insert id="saveCase" parameterType="map">
|
||||||
INSERT INTO kpi_case(
|
INSERT INTO kpi_case(
|
||||||
@ -286,35 +362,6 @@
|
|||||||
case_id = #{caseId}
|
case_id = #{caseId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- 删除NPerson -->
|
|
||||||
<delete id="deleteNPersonDayCount" parameterType="map">
|
|
||||||
DELETE FROM
|
|
||||||
kpi_n_person
|
|
||||||
WHERE
|
|
||||||
day_date = #{dayDate}
|
|
||||||
</delete>
|
|
||||||
|
|
||||||
<insert id="saveNPersonDayCount" parameterType="map">
|
|
||||||
INSERT INTO kpi_n_person(
|
|
||||||
user_id,
|
|
||||||
day_date,
|
|
||||||
is_signin,
|
|
||||||
is_signin_late,
|
|
||||||
is_signout,
|
|
||||||
is_signout_early,
|
|
||||||
is_holiday,
|
|
||||||
day_score
|
|
||||||
) VALUES (
|
|
||||||
#{userId},
|
|
||||||
#{dayDate},
|
|
||||||
#{isSignin},
|
|
||||||
#{isSigninLate},
|
|
||||||
#{isSignout},
|
|
||||||
#{isSignoutEarly},
|
|
||||||
#{isHoliday},
|
|
||||||
#{dayScore}
|
|
||||||
)
|
|
||||||
</insert>
|
|
||||||
|
|
||||||
<select id="countCase" parameterType="map" resultType="java.lang.Integer">
|
<select id="countCase" parameterType="map" resultType="java.lang.Integer">
|
||||||
SELECT
|
SELECT
|
||||||
@ -324,88 +371,118 @@
|
|||||||
<where>
|
<where>
|
||||||
is_delete = 0
|
is_delete = 0
|
||||||
<if test="reportUserId != null and reportUserId != ''">
|
<if test="reportUserId != null and reportUserId != ''">
|
||||||
AND
|
AND
|
||||||
report_user_id = #{reportUserId}
|
report_user_id = #{reportUserId}
|
||||||
</if>
|
</if>
|
||||||
<if test="handleUserId != null and handleUserId != ''">
|
<if test="handleUserId != null and handleUserId != ''">
|
||||||
AND
|
AND
|
||||||
handle_user_id = #{handleUserId}
|
handle_user_id = #{handleUserId}
|
||||||
</if>
|
</if>
|
||||||
<if test="areaId != null and areaId != ''">
|
<if test="areaId != null and areaId != ''">
|
||||||
AND
|
AND
|
||||||
area_id = #{areaId}
|
area_id = #{areaId}
|
||||||
</if>
|
</if>
|
||||||
<if test="communityId != null and communityId != ''">
|
<if test="communityId != null and communityId != ''">
|
||||||
AND
|
AND
|
||||||
community_id = #{communityId}
|
community_id = #{communityId}
|
||||||
</if>
|
</if>
|
||||||
<if test="isAccept != null">
|
<if test="isAccept != null">
|
||||||
AND
|
AND
|
||||||
is_accept = #{isAccept}
|
is_accept = #{isAccept}
|
||||||
</if>
|
</if>
|
||||||
<if test="isHandle != null">
|
<if test="isHandle != null">
|
||||||
AND
|
AND
|
||||||
is_handle = #{isHandle}
|
is_handle = #{isHandle}
|
||||||
</if>
|
</if>
|
||||||
<if test="isInspect != null">
|
<if test="isInspect != null">
|
||||||
AND
|
AND
|
||||||
|
is_inspect = #{isInspect}
|
||||||
|
</if>
|
||||||
|
<if test="startTime != null and startTime != ''">
|
||||||
|
AND
|
||||||
|
gmt_report <![CDATA[ >= ]]> #{startTime}
|
||||||
|
</if>
|
||||||
|
<if test="endTime != null and endTime != ''">
|
||||||
|
AND
|
||||||
|
gmt_report <![CDATA[ <= ]]> #{endTime}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="listCase" parameterType="map" resultMap="casePO">
|
||||||
|
SELECT
|
||||||
|
case_id,
|
||||||
|
area_id,
|
||||||
|
area_name,
|
||||||
|
community_id,
|
||||||
|
community_name,
|
||||||
|
case_type_id,
|
||||||
|
case_type_name,
|
||||||
|
gmt_report,
|
||||||
|
gmt_accept,
|
||||||
|
gmt_assign,
|
||||||
|
handle_end_time_long,
|
||||||
|
handle_end_time,
|
||||||
|
gmt_handle,
|
||||||
|
is_timeout,
|
||||||
|
gmt_inspect,
|
||||||
|
is_self,
|
||||||
|
report_user_id,
|
||||||
|
handle_user_id,
|
||||||
|
inspect_user_id,
|
||||||
|
inspect_score,
|
||||||
|
is_delete,
|
||||||
|
gmt_delete,
|
||||||
|
delete_user_id,
|
||||||
|
total_urge,
|
||||||
|
total_back,
|
||||||
|
case_status,
|
||||||
|
case_source,
|
||||||
|
is_accept,
|
||||||
|
is_assign,
|
||||||
|
is_handle,
|
||||||
|
is_inspect
|
||||||
|
FROM
|
||||||
|
kpi_case
|
||||||
|
<where>
|
||||||
|
is_delete = 0
|
||||||
|
<if test="reportUserId != null and reportUserId != ''">
|
||||||
|
AND
|
||||||
|
report_user_id = #{reportUserId}
|
||||||
|
</if>
|
||||||
|
<if test="handleUserId != null and handleUserId != ''">
|
||||||
|
AND
|
||||||
|
handle_user_id = #{handleUserId}
|
||||||
|
</if>
|
||||||
|
<if test="areaId != null and areaId != ''">
|
||||||
|
AND
|
||||||
|
area_id = #{areaId}
|
||||||
|
</if>
|
||||||
|
<if test="communityId != null and communityId != ''">
|
||||||
|
AND
|
||||||
|
community_id = #{communityId}
|
||||||
|
</if>
|
||||||
|
<if test="isAccept != null">
|
||||||
|
AND
|
||||||
|
is_accept = #{isAccept}
|
||||||
|
</if>
|
||||||
|
<if test="isHandle != null">
|
||||||
|
AND
|
||||||
|
is_handle = #{isHandle}
|
||||||
|
</if>
|
||||||
|
<if test="isInspect != null">
|
||||||
|
AND
|
||||||
is_inspect = #{isInspect}
|
is_inspect = #{isInspect}
|
||||||
</if>
|
</if>
|
||||||
<if test="startTime != null and startTime != ''">
|
<if test="startTime != null and startTime != ''">
|
||||||
AND
|
AND
|
||||||
gmt_report <![CDATA[ >= ]]> #{startTime}
|
gmt_report <![CDATA[ >= ]]> #{startTime}
|
||||||
</if>
|
</if>
|
||||||
<if test="endTime != null and endTime != ''">
|
<if test="endTime != null and endTime != ''">
|
||||||
AND
|
AND
|
||||||
gmt_report <![CDATA[ <= ]]> #{endTime}
|
gmt_report <![CDATA[ <= ]]> #{endTime}
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="listCommunityBossDayCountPO" parameterType="map" resultMap="communityBossDayCountPO">
|
|
||||||
SELECT
|
|
||||||
*
|
|
||||||
FROM
|
|
||||||
kpi_community_boss_${level}_day_count
|
|
||||||
<where>
|
|
||||||
<if test="userId != null and userId != ''">
|
|
||||||
AND
|
|
||||||
user_id = #{userId}
|
|
||||||
<if test="dayDate != null and dayDate != ''">
|
|
||||||
AND
|
|
||||||
day_date = #{dayDate}
|
|
||||||
</if>
|
|
||||||
</if>
|
|
||||||
<if test="startTime != null and startTime != ''">
|
|
||||||
AND
|
|
||||||
day_date <![CDATA[ >= ]]> #{startTime}
|
|
||||||
</if>
|
|
||||||
<if test="endTime != null and endTime != ''">
|
|
||||||
AND
|
|
||||||
day_date <![CDATA[ <= ]]> #{endTime}
|
|
||||||
</if>
|
|
||||||
</where>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="listNPersonDayCountPO" parameterType="map" resultMap="nPersonDayCountPO">
|
|
||||||
SELECT
|
|
||||||
*
|
|
||||||
FROM
|
|
||||||
kpi_n_person
|
|
||||||
<where>
|
|
||||||
<if test="userId != null and userId != ''">
|
|
||||||
AND
|
|
||||||
user_id = #{userId}
|
|
||||||
</if>
|
|
||||||
<if test="startTime != null and startTime != ''">
|
|
||||||
AND
|
|
||||||
day_date <![CDATA[ >= ]]> #{startTime}
|
|
||||||
</if>
|
|
||||||
<if test="endTime != null and endTime != ''">
|
|
||||||
AND
|
|
||||||
day_date <![CDATA[ <= ]]> #{endTime}
|
|
||||||
</if>
|
|
||||||
</where>
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
Loading…
Reference in New Issue
Block a user