Commit 801ef378 by wangchunyang

1 超期没评分的,可以提交评分,记录实际评分时间。

2 评分的时候,如果状态是有的需要显示多加一行备注,必填。下面也需要多一个参会人员,和评分时间,手动维护。
3 重点人员导入功能(刑满释放/严重精神/重点未成年人)
4 双属地功能,相关统计页面统计及评价操作,原属地可见(可编辑,不可评价)新属地(不可编辑,可评价)
5 页面a.b.c要有红黄绿颜色
parent 6a16dbce
...@@ -88,6 +88,13 @@ public class KeyPerson { ...@@ -88,6 +88,13 @@ public class KeyPerson {
private String todoCount; private String todoCount;
private String doneCount; private String doneCount;
//双属地,有双属地且为原属地标识 1原属地,用于屏蔽评价按钮
private String dualPersonBelong;
//双属地,当前所在属地标识,1当前所属(非原属地) ,用于常规操作按钮判断
private String dualPerson;
private String scopeGrade;
private String scopeAreaId;
public String getDistCard() { public String getDistCard() {
return distCard; return distCard;
} }
...@@ -583,4 +590,20 @@ public class KeyPerson { ...@@ -583,4 +590,20 @@ public class KeyPerson {
public void setDoneCount(String doneCount) { public void setDoneCount(String doneCount) {
this.doneCount = doneCount; this.doneCount = doneCount;
} }
public String getDualPersonBelong() { return dualPersonBelong; }
public void setDualPersonBelong(String dualPersonBelong) { this.dualPersonBelong = dualPersonBelong; }
public String getDualPerson() { return dualPerson; }
public void setDualPerson(String dualPerson) { this.dualPerson = dualPerson; }
public String getScopeAreaId() { return scopeAreaId; }
public void setScopeAreaId(String scopeAreaId) { this.scopeAreaId = scopeAreaId; }
public String getScopeGrade() { return scopeGrade; }
public void setScopeGrade(String scopeGrade) { this.scopeGrade = scopeGrade; }
} }
package com.scpyun.platform.jilinsscgsdp.bean.entity;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
/**
* 终端人员
*/
@Data
public class KeyPersonImp {
private String id;
private String sysType;
@ExcelProperty(value = "姓名", index = 0)
private String name;
@ExcelProperty(value = "性别", index = 1)
private String sex;
@ExcelProperty(value = "民族", index = 2)
private String folk;
@ExcelProperty(value = "身份证号", index = 3)
private String cardNo;
@ExcelProperty(value = "本人联系方式", index = 4)
private String phone;
@ExcelProperty(value = "户籍地址", index = 5)
private String registeredResidence;
private String cityId;
private String areaId;
private String streetId;
private String communityId;
private String cityName;
@ExcelProperty(value = "现住址(区县)", index = 6)
private String areaName;
@ExcelProperty(value = "现住址(街道)", index = 7)
private String streetName;
@ExcelProperty(value = "现住址(社区)", index = 8)
private String communityName;
@ExcelProperty(value = "现住址(详细地址)", index = 9)
private String address;
@ExcelProperty(value = "是否涉及矛盾纠纷", index = 10)
private String involvingConflictsDisputes;
@ExcelProperty(value = "矛盾纠纷风险等级", index = 11)
private String riskLevel;
@ExcelProperty(value = {"高度关注情形", "重新犯罪"}, index = 12)
private String criminalTendency;
@ExcelProperty(value = {"高度关注情形", "黑恶"}, index = 13)
private String evil;
@ExcelProperty(value = {"高度关注情形", "恶性犯罪"}, index = 14)
private String heinousCrime;
@ExcelProperty(value = {"高度关注情形", "邪教"}, index = 15)
private String cult;
@ExcelProperty(value = {"高度关注情形", "三无人员"}, index = 16)
private String threeNoesPerson;
@ExcelProperty(value = "安置帮教责任单位", index = 17)
private String responsibleCompanyByAssistance;
@ExcelProperty(value = "安置帮办责任人", index = 18)
private String responsiblePersonByAssistance;
@ExcelProperty(value = "重点人责任单位", index = 19)
private String responsibleCompanyByKeyPersonnel;
@ExcelProperty(value = "重点人员责任人", index = 20)
private String responsiblePersonKeyPersonnel;
private String ratingScore;
private String hazardAssessmentLevel;
private String responsiblePerson;
private String responsibleCompany;
private String criminalTendencySituation;
private String lettersVisitsType;
private String relatedPersonRelation;
private String relatedPersonPhone;
private String relatedPersonName;
private String relatedPersonAddress;
private String controlCompanySupervisor;
private String controlCompanySupervisorPerson;
private String createDate;
private String updateDate;
private String createUser;
private String updateUser;
private String region;
private String remarks;
private String count;
private String highly_concerned_situation;
}
...@@ -21,6 +21,7 @@ public class KeyPersonRatingHistory { ...@@ -21,6 +21,7 @@ public class KeyPersonRatingHistory {
private String summaryId; private String summaryId;
private String ratingPersonnel; private String ratingPersonnel;
private String ratingCompany; private String ratingCompany;
private String dualMark;
public String getId() { public String getId() {
return id; return id;
} }
...@@ -180,4 +181,8 @@ public class KeyPersonRatingHistory { ...@@ -180,4 +181,8 @@ public class KeyPersonRatingHistory {
public void setRatingCompany(String ratingCompany) { public void setRatingCompany(String ratingCompany) {
this.ratingCompany = ratingCompany; this.ratingCompany = ratingCompany;
} }
public String getDualMark() { return dualMark; }
public void setDualMark(String dualMark) { this.dualMark = dualMark; }
} }
package com.scpyun.platform.jilinsscgsdp.service.impl; package com.scpyun.platform.jilinsscgsdp.service.impl;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.read.builder.ExcelReaderBuilder;
import com.alibaba.excel.support.ExcelTypeEnum;
import com.alibaba.fastjson.JSON;
import com.obs.services.model.ObsObject;
import com.scpyun.base.bean.Page; import com.scpyun.base.bean.Page;
import com.scpyun.base.core.annotation.Api; import com.scpyun.base.core.annotation.Api;
import com.scpyun.base.core.annotation.ApiOperation; import com.scpyun.base.core.annotation.ApiOperation;
...@@ -7,11 +13,29 @@ import com.scpyun.base.core.exception.CustomException; ...@@ -7,11 +13,29 @@ import com.scpyun.base.core.exception.CustomException;
import com.scpyun.base.core.utils.StringUtils; import com.scpyun.base.core.utils.StringUtils;
import com.scpyun.base.db.service.CommonService; import com.scpyun.base.db.service.CommonService;
import com.scpyun.platform.jilinsscgsdp.bean.entity.KeyPerson; import com.scpyun.platform.jilinsscgsdp.bean.entity.KeyPerson;
import com.scpyun.platform.jilinsscgsdp.bean.entity.KeyPersonImp;
import com.scpyun.platform.jilinsscgsdp.bean.entity.KeyPersonRatingHistory; import com.scpyun.platform.jilinsscgsdp.bean.entity.KeyPersonRatingHistory;
import com.scpyun.platform.jilinsscgsdp.utils.DataScopeUtil;
import com.scpyun.platform.jilinsscgsdp.utils.FileDataListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayOutputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.net.URLEncoder;
import java.util.Date;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -29,13 +53,55 @@ public class KeyPersonRatingHistoryServiceImpl { ...@@ -29,13 +53,55 @@ public class KeyPersonRatingHistoryServiceImpl {
@Autowired @Autowired
CommonService commonService; CommonService commonService;
private static final Logger log = LoggerFactory.getLogger(KeyPersonRatingHistoryServiceImpl.class);
private final String SUCCESS = "success"; private final String SUCCESS = "success";
private String namespace = "com.scpyun.platform.standard.jilinsscgsdp.keyPersonRatingHistory."; private String namespace = "com.scpyun.platform.standard.jilinsscgsdp.keyPersonRatingHistory.";
@ApiOperation(value = "查询评分历史列表", desc = "查询评分历史列表") @ApiOperation(value = "查询评分历史列表", desc = "查询评分历史列表")
public Page<KeyPersonRatingHistory> selectRatingHistoryList(Page<KeyPersonRatingHistory> page) { public Page<KeyPersonRatingHistory> selectRatingHistoryList(Page<KeyPersonRatingHistory> page) {
Map<String, Object> user = (Map<String, Object>) page.getParams().get("_user");
if (user != null) {
Map<String, String> pos = DataScopeUtil.getPosition(user);
Map<String, Object> setMap = new HashMap<>();
setMap.put("scope_grade", pos.get("grade"));
setMap.put("scope_area_id", pos.get("area_id"));
page.getParams().put("_scope", setMap);
}
Page<KeyPersonRatingHistory> keyPersonRatingHistoryPageList = commonService.findPage(namespace + "selectRatingHistoryList", page); Page<KeyPersonRatingHistory> keyPersonRatingHistoryPageList = commonService.findPage(namespace + "selectRatingHistoryList", page);
return keyPersonRatingHistoryPageList; return keyPersonRatingHistoryPageList;
} }
@ApiOperation(value = "导入人员信息", desc = "导入人员信息")
public Map<String, Object> importExcel(Map<String, Object> map, MultipartFile file) {
FileDataListener listener = new FileDataListener(commonService, namespace, map);
try {
EasyExcel.read(file.getInputStream(), KeyPersonImp.class, listener).sheet().headRowNumber(2).doRead();
} catch (IOException e) {
throw new CustomException("导入失败");
}
return listener.getResult();
}
@ApiOperation(value = "导入模板下载", desc = "导入模板下载")
public void templateDownload(Map<String, Object> map, HttpServletResponse response) {
response.setContentType("application/application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.setCharacterEncoding("utf-8");
try {
String fileName = URLEncoder.encode("未成年人导入模板", "UTF-8").replaceAll("\\+", "%20");
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");
response.setHeader("filename", fileName + ".xlsx");
response.setHeader("Access-Control-Expose-Headers", "filename,Content-Disposition");
String pdfFilePath = "keyPersonImp.xlsx";
Resource resource = new ClassPathResource(pdfFilePath);
InputStream is = resource.getInputStream();
ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream()).withTemplate(is).excelType(ExcelTypeEnum.XLSX).build();
excelWriter.finish();
} catch (Exception e) {
log.error("下载模版异常", e);
}
}
} }
...@@ -11,10 +11,12 @@ import com.scpyun.base.db.service.CommonService; ...@@ -11,10 +11,12 @@ import com.scpyun.base.db.service.CommonService;
import com.scpyun.platform.jilinsscgsdp.bean.entity.KeyPersonRatingHistory; import com.scpyun.platform.jilinsscgsdp.bean.entity.KeyPersonRatingHistory;
import com.scpyun.platform.jilinsscgsdp.enums.ScoreCategoryEnum; import com.scpyun.platform.jilinsscgsdp.enums.ScoreCategoryEnum;
import com.scpyun.platform.jilinsscgsdp.utils.DataScopeUtil; import com.scpyun.platform.jilinsscgsdp.utils.DataScopeUtil;
import com.scpyun.platform.jilinsscgsdp.utils.DateUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.ParseException;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.ZoneId; import java.time.ZoneId;
import java.util.*; import java.util.*;
...@@ -154,6 +156,18 @@ public class KeyPersonRatingServiceImpl { ...@@ -154,6 +156,18 @@ public class KeyPersonRatingServiceImpl {
} }
} else { } else {
historyId = map.get("historyId").toString(); historyId = map.get("historyId").toString();
//可能存在超期评分,未超期评分,状态为1,超期评分后,状态为3;根据当前时间和计划结束时间进行对比
String do_status = "1";
Map<String, Object> _map = new HashMap<>();
_map.put("id", historyId);
Map<String, Object> historyObj = commonService.getObject(namespace + "selectRatingHistoryById", _map);
do_status = historyObj.get("do_status").toString();
Date endData = (Date)historyObj.get("plan_end_data");
if("2".equals(historyObj.get("do_status")) && new Date().compareTo(endData) > 0) {
do_status = "3";
}
//需要更新,jl_key_person_rating_summary表数据 //需要更新,jl_key_person_rating_summary表数据
Map<String, Object> updateSummaryMap = new HashMap<>(); Map<String, Object> updateSummaryMap = new HashMap<>();
updateSummaryMap.put("rating_dict_type", map.get("ratingDictType")); updateSummaryMap.put("rating_dict_type", map.get("ratingDictType"));
...@@ -166,6 +180,8 @@ public class KeyPersonRatingServiceImpl { ...@@ -166,6 +180,8 @@ public class KeyPersonRatingServiceImpl {
updateHistoryMap.put("rating_dict_type", map.get("ratingDictType")); updateHistoryMap.put("rating_dict_type", map.get("ratingDictType"));
updateHistoryMap.put("key_person_id", map.get("id")); updateHistoryMap.put("key_person_id", map.get("id"));
updateHistoryMap.put("_user", map.get("_user")); updateHistoryMap.put("_user", map.get("_user"));
updateHistoryMap.put("id", historyId);
updateHistoryMap.put("do_status", do_status);
commonService.update(namespace + "updateHistory", updateHistoryMap); commonService.update(namespace + "updateHistory", updateHistoryMap);
} }
...@@ -189,6 +205,7 @@ public class KeyPersonRatingServiceImpl { ...@@ -189,6 +205,7 @@ public class KeyPersonRatingServiceImpl {
sub.put("rating_history_id", historyId); sub.put("rating_history_id", historyId);
sub.put("key_person_rating_summary_id",summaryId); sub.put("key_person_rating_summary_id",summaryId);
sub.put("sort",sub.get("sort")); sub.put("sort",sub.get("sort"));
sub.put("remarks",sub.get("remarks"));
if (commonService.insert(namespace + "insertRatingDetails", sub) != 1) { if (commonService.insert(namespace + "insertRatingDetails", sub) != 1) {
throw new CustomException("添加失败"); throw new CustomException("添加失败");
} }
...@@ -225,6 +242,15 @@ public class KeyPersonRatingServiceImpl { ...@@ -225,6 +242,15 @@ public class KeyPersonRatingServiceImpl {
summaryMap.put("is_history", 1);//最新数据 summaryMap.put("is_history", 1);//最新数据
summaryMap.put("_user", map.get("_user")); summaryMap.put("_user", map.get("_user"));
summaryMap.put("rating_users", map.get("ratingUsers"));
summaryMap.put("rating_custom_time", map.get("ratingTime").toString().replace("T", " ").substring(0,19));
// try {
// summaryMap.put("rating_custom_time", DateUtil.parseTime(map.get("ratingTime").toString().replace("T", " ").substring(0,19)));
// } catch (ParseException e) {
// summaryMap.put("rating_custom_time", DateUtil.getCurrentTime());
// }
if (commonService.insert(namespace + "insertPersonRatingSummary", summaryMap) != 1) { if (commonService.insert(namespace + "insertPersonRatingSummary", summaryMap) != 1) {
throw new CustomException("添加失败"); throw new CustomException("添加失败");
} }
......
...@@ -27,12 +27,18 @@ public class KeyPersonStatisticsImpl { ...@@ -27,12 +27,18 @@ public class KeyPersonStatisticsImpl {
*/ */
@ApiOperation(value = "评分统计数据", desc = "评分统计数据") @ApiOperation(value = "评分统计数据", desc = "评分统计数据")
public Map<String, Object> getScoreStatistics(Map<String, Object> map) { public Map<String, Object> getScoreStatistics(Map<String, Object> map) {
Object _user = map.get("_user");
if (_user != null) {
Map<String, String> pos = DataScopeUtil.getPosition(_user);
map.put("scope_grade", pos.get("grade"));
map.put("scope_area_id", pos.get("area_id"));
}
// 获取重点人员总数 // 获取重点人员总数
Map<String, Object> peopleCountMap = commonService.getObject(namespace + "selectPeopleCount", new HashMap<>()); Map<String, Object> peopleCountMap = commonService.getObject(namespace + "selectPeopleCount", map);
Map<String, Object> mentalPatient = commonService.getObject(namespace + "selectMentalPatientRatingCount", new HashMap<>()); Map<String, Object> mentalPatient = commonService.getObject(namespace + "selectMentalPatientRatingCount", map);
Map<String, Object> minors = commonService.getObject(namespace + "selectMinorsRatingCount", new HashMap<>()); Map<String, Object> minors = commonService.getObject(namespace + "selectMinorsRatingCount", map);
Map<String, Object> released = commonService.getObject(namespace + "selectReleasedRatingCount", new HashMap<>()); Map<String, Object> released = commonService.getObject(namespace + "selectReleasedRatingCount", map);
// 构建返回结果 // 构建返回结果
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
...@@ -237,24 +243,28 @@ public class KeyPersonStatisticsImpl { ...@@ -237,24 +243,28 @@ public class KeyPersonStatisticsImpl {
int mentalUncompleted = getIntValue(mentalPatientMap, "total_pending"); int mentalUncompleted = getIntValue(mentalPatientMap, "total_pending");
int mentalNearOverdue = getIntValue(mentalPatientMap, "total_overdue_pending"); int mentalNearOverdue = getIntValue(mentalPatientMap, "total_overdue_pending");
int mentalOverdue = getIntValue(mentalPatientMap, "total_overdue"); int mentalOverdue = getIntValue(mentalPatientMap, "total_overdue");
int mentalOverdueDone = getIntValue(mentalPatientMap, "total_overdue_done");
// 未成年人统计 // 未成年人统计
int minorsCompleted = getIntValue(minorsMap, "total_done"); int minorsCompleted = getIntValue(minorsMap, "total_done");
int minorsUncompleted = getIntValue(minorsMap, "total_pending"); int minorsUncompleted = getIntValue(minorsMap, "total_pending");
int minorsNearOverdue = getIntValue(minorsMap, "total_overdue_pending"); int minorsNearOverdue = getIntValue(minorsMap, "total_overdue_pending");
int minorsOverdue = getIntValue(minorsMap, "total_overdue"); int minorsOverdue = getIntValue(minorsMap, "total_overdue");
int minorsOverdueDone = getIntValue(minorsMap, "total_overdue_done");
// 刑满释放人员统计 // 刑满释放人员统计
int releasedCompleted = getIntValue(releasedMap, "total_done"); int releasedCompleted = getIntValue(releasedMap, "total_done");
int releasedUncompleted = getIntValue(releasedMap, "total_pending"); int releasedUncompleted = getIntValue(releasedMap, "total_pending");
int releasedNearOverdue = getIntValue(releasedMap, "total_overdue_pending"); int releasedNearOverdue = getIntValue(releasedMap, "total_overdue_pending");
int releasedOverdue = getIntValue(releasedMap, "total_overdue"); int releasedOverdue = getIntValue(releasedMap, "total_overdue");
int releasedOverdueDone = getIntValue(releasedMap, "total_overdue_done");
// 计算汇总数据 // 计算汇总数据
int summaryCompleted = mentalCompleted + minorsCompleted + releasedCompleted; int summaryCompleted = mentalCompleted + minorsCompleted + releasedCompleted;
int summaryUncompleted = mentalUncompleted + minorsUncompleted + releasedUncompleted; int summaryUncompleted = mentalUncompleted + minorsUncompleted + releasedUncompleted;
int summaryNearOverdue = mentalNearOverdue + minorsNearOverdue + releasedNearOverdue; int summaryNearOverdue = mentalNearOverdue + minorsNearOverdue + releasedNearOverdue;
int summaryOverdue = mentalOverdue + minorsOverdue + releasedOverdue; int summaryOverdue = mentalOverdue + minorsOverdue + releasedOverdue;
int summaryOverdueDone = mentalOverdueDone + minorsOverdueDone + releasedOverdueDone;
int summaryTotal = summaryCompleted + summaryUncompleted + summaryNearOverdue + summaryOverdue; int summaryTotal = summaryCompleted + summaryUncompleted + summaryNearOverdue + summaryOverdue;
// 构建汇总数据 // 构建汇总数据
...@@ -264,6 +274,7 @@ public class KeyPersonStatisticsImpl { ...@@ -264,6 +274,7 @@ public class KeyPersonStatisticsImpl {
summary.put("uncompleted", summaryUncompleted); summary.put("uncompleted", summaryUncompleted);
summary.put("nearOverdue", summaryNearOverdue); summary.put("nearOverdue", summaryNearOverdue);
summary.put("overdue", summaryOverdue); summary.put("overdue", summaryOverdue);
summary.put("overdueDone", summaryOverdueDone);
result.put("summary", summary); result.put("summary", summary);
// 构建精神病患者数据 // 构建精神病患者数据
...@@ -273,6 +284,7 @@ public class KeyPersonStatisticsImpl { ...@@ -273,6 +284,7 @@ public class KeyPersonStatisticsImpl {
mentalPatient.put("uncompleted", mentalUncompleted); mentalPatient.put("uncompleted", mentalUncompleted);
mentalPatient.put("nearOverdue", mentalNearOverdue); mentalPatient.put("nearOverdue", mentalNearOverdue);
mentalPatient.put("overdue", mentalOverdue); mentalPatient.put("overdue", mentalOverdue);
mentalPatient.put("overdueDone", mentalOverdue);
result.put("mentalPatient", mentalPatient); result.put("mentalPatient", mentalPatient);
// 构建刑满释放人员数据 // 构建刑满释放人员数据
...@@ -282,6 +294,7 @@ public class KeyPersonStatisticsImpl { ...@@ -282,6 +294,7 @@ public class KeyPersonStatisticsImpl {
released.put("uncompleted", releasedUncompleted); released.put("uncompleted", releasedUncompleted);
released.put("nearOverdue", releasedNearOverdue); released.put("nearOverdue", releasedNearOverdue);
released.put("overdue", releasedOverdue); released.put("overdue", releasedOverdue);
released.put("overdueDone", minorsOverdueDone);
result.put("released", released); result.put("released", released);
// 构建未成年人数据 // 构建未成年人数据
...@@ -291,6 +304,7 @@ public class KeyPersonStatisticsImpl { ...@@ -291,6 +304,7 @@ public class KeyPersonStatisticsImpl {
minors.put("uncompleted", minorsUncompleted); minors.put("uncompleted", minorsUncompleted);
minors.put("nearOverdue", minorsNearOverdue); minors.put("nearOverdue", minorsNearOverdue);
minors.put("overdue", minorsOverdue); minors.put("overdue", minorsOverdue);
minors.put("overdueDone", releasedOverdueDone);
result.put("minors", minors); result.put("minors", minors);
return result; return result;
......
...@@ -10,6 +10,7 @@ import com.alibaba.excel.write.metadata.WriteSheet; ...@@ -10,6 +10,7 @@ import com.alibaba.excel.write.metadata.WriteSheet;
import com.alibaba.excel.write.metadata.fill.FillConfig; import com.alibaba.excel.write.metadata.fill.FillConfig;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.scpyun.base.bean.Page; import com.scpyun.base.bean.Page;
import com.scpyun.base.bean.User;
import com.scpyun.base.core.annotation.Api; import com.scpyun.base.core.annotation.Api;
import com.scpyun.base.core.annotation.ApiOperation; import com.scpyun.base.core.annotation.ApiOperation;
import com.scpyun.base.core.exception.CustomException; import com.scpyun.base.core.exception.CustomException;
...@@ -28,6 +29,8 @@ import com.scpyun.platform.jilinsscgsdp.utils.DateUtil; ...@@ -28,6 +29,8 @@ import com.scpyun.platform.jilinsscgsdp.utils.DateUtil;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanWrapper;
import org.springframework.beans.BeanWrapperImpl;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource; import org.springframework.core.io.Resource;
...@@ -143,7 +146,8 @@ public class MurderManagementServiceImpl { ...@@ -143,7 +146,8 @@ public class MurderManagementServiceImpl {
@ApiOperation(value = "高度关注情形按类别统计,分别按类别统计", desc = "") @ApiOperation(value = "高度关注情形按类别统计,分别按类别统计", desc = "")
public List<KeyPerson> findKeyPersonStatistics(KeyPerson keyPerson) { public List<KeyPerson> findKeyPersonStatistics(KeyPerson keyPerson) {
return commonService.findList(nameSpace + "findKeyPersonStatistics", keyPerson); String changchunMark = DataScopeUtil.isChanChun(keyPerson.get_user()) ? "_changchun" : "";
return commonService.findList(nameSpace + "findKeyPersonStatistics" + changchunMark, keyPerson);
} }
@ApiOperation(value = "新增重点人员信息", desc = "") @ApiOperation(value = "新增重点人员信息", desc = "")
...@@ -155,6 +159,7 @@ public class MurderManagementServiceImpl { ...@@ -155,6 +159,7 @@ public class MurderManagementServiceImpl {
keyPerson.setId(UUIDUtil.getUUID()); keyPerson.setId(UUIDUtil.getUUID());
String communityId = keyPerson.getCommunityId(); String communityId = keyPerson.getCommunityId();
if(StrUtil.isNotBlank(communityId)){ if(StrUtil.isNotBlank(communityId)){
keyPerson.setRegion("1");//地区:1 省内(默认),2 省外,3 国外
List<KeyPerson> list = commonService.findList(nameSpace + "checkCardNoRepeatList", keyPerson); List<KeyPerson> list = commonService.findList(nameSpace + "checkCardNoRepeatList", keyPerson);
if (list.size()>0){ if (list.size()>0){
throw new CustomException("社区和身份证重复无法新增!"); throw new CustomException("社区和身份证重复无法新增!");
...@@ -262,31 +267,52 @@ public class MurderManagementServiceImpl { ...@@ -262,31 +267,52 @@ public class MurderManagementServiceImpl {
@ApiOperation(value = "重点人员统计", desc = "") @ApiOperation(value = "重点人员统计", desc = "")
public List<KeyPerson> findKeyPersonStatisticsForType(KeyPerson keyPerson) { public List<KeyPerson> findKeyPersonStatisticsForType(KeyPerson keyPerson) {
return commonService.findList(nameSpace + "findKeyPersonStatisticsForType", keyPerson); String changchunMark = DataScopeUtil.isChanChun(keyPerson.get_user()) ? "_changchun" : "";
User _user = keyPerson.get_user();
if (_user != null) {
Map<String, String> pos = DataScopeUtil.getPosition(_user);
keyPerson.setScopeAreaId(pos.get("grade"));
keyPerson.setScopeAreaId(pos.get("area_id"));
}
return commonService.findList(nameSpace + "findKeyPersonStatisticsForType" + changchunMark, keyPerson);
} }
@ApiOperation(value = "重点人员统计CountAll", desc = "") @ApiOperation(value = "重点人员统计CountAll", desc = "")
public KeyPerson keyPersonStatisticsForTypeAll(KeyPerson keyPerson) { public KeyPerson keyPersonStatisticsForTypeAll(KeyPerson keyPerson) {
return commonService.getObject(nameSpace + "keyPersonStatisticsForTypeAll", keyPerson); String changchunMark = DataScopeUtil.isChanChun(keyPerson.get_user()) ? "_changchun" : "";
User _user = keyPerson.get_user();
if (_user != null) {
Map<String, String> pos = DataScopeUtil.getPosition(_user);
keyPerson.setScopeAreaId(pos.get("grade"));
keyPerson.setScopeAreaId(pos.get("area_id"));
}
return commonService.getObject(nameSpace + "keyPersonStatisticsForTypeAll" + changchunMark, keyPerson);
} }
@ApiOperation(value = "按照城市、区、街道、社区(分角色展示内容)统计重点人员数量", desc = "") @ApiOperation(value = "按照城市、区、街道、社区(分角色展示内容)统计重点人员数量", desc = "")
public List<KeyPerson> keyPersonStatisticsForChunk(KeyPerson keyPerson) { public List<KeyPerson> keyPersonStatisticsForChunk(KeyPerson keyPerson) {
String changchunMark = DataScopeUtil.isChanChun(keyPerson.get_user()) ? "_changchun" : "";
User _user = keyPerson.get_user();
if (_user != null) {
Map<String, String> pos = DataScopeUtil.getPosition(_user);
keyPerson.setScopeAreaId(pos.get("grade"));
keyPerson.setScopeAreaId(pos.get("area_id"));
}
if (keyPerson.get_user().getCompany_grade().equals("3")) { if (keyPerson.get_user().getCompany_grade().equals("3")) {
// city // city
return commonService.findList(nameSpace + "keyPersonStatisticsForCity", keyPerson); return commonService.findList(nameSpace + "keyPersonStatisticsForCity" + changchunMark, keyPerson);
} else if (keyPerson.get_user().getCompany_grade().equals("4")) { } else if (keyPerson.get_user().getCompany_grade().equals("4")) {
// area // area
return commonService.findList(nameSpace + "keyPersonStatisticsForArea", keyPerson); return commonService.findList(nameSpace + "keyPersonStatisticsForArea" + changchunMark, keyPerson);
} else if (keyPerson.get_user().getCompany_grade().equals("5")) { } else if (keyPerson.get_user().getCompany_grade().equals("5")) {
// street // street
return commonService.findList(nameSpace + "keyPersonStatisticsForStreet", keyPerson); return commonService.findList(nameSpace + "keyPersonStatisticsForStreet" + changchunMark, keyPerson);
} else if (keyPerson.get_user().getCompany_grade().equals("6")) { } else if (keyPerson.get_user().getCompany_grade().equals("6")) {
// community // community
return commonService.findList(nameSpace + "keyPersonStatisticsForCommunity", keyPerson); return commonService.findList(nameSpace + "keyPersonStatisticsForCommunity" + changchunMark, keyPerson);
} else if (keyPerson.get_user().getCompany_grade().equals("2")) { } else if (keyPerson.get_user().getCompany_grade().equals("2")) {
// province // province
return commonService.findList(nameSpace + "keyPersonStatisticsForProvince", keyPerson); return commonService.findList(nameSpace + "keyPersonStatisticsForProvince" + changchunMark, keyPerson);
} else { } else {
return null; return null;
} }
...@@ -395,7 +421,14 @@ public class MurderManagementServiceImpl { ...@@ -395,7 +421,14 @@ public class MurderManagementServiceImpl {
@ApiOperation(value = "按照矛盾等级统计重点人员数量", desc = "") @ApiOperation(value = "按照矛盾等级统计重点人员数量", desc = "")
public Map<String, Object> keyPersonStatisticsForRiskLevel(KeyPerson keyPerson) { public Map<String, Object> keyPersonStatisticsForRiskLevel(KeyPerson keyPerson) {
List<KeyPerson> list = commonService.findList(nameSpace + "keyPersonStatisticsForRiskLevel", keyPerson); String changchunMark = DataScopeUtil.isChanChun(keyPerson.get_user()) ? "_changchun" : "";
User _user = keyPerson.get_user();
if (_user != null) {
Map<String, String> pos = DataScopeUtil.getPosition(_user);
keyPerson.setScopeAreaId(pos.get("grade"));
keyPerson.setScopeAreaId(pos.get("area_id"));
}
List<KeyPerson> list = commonService.findList(nameSpace + "keyPersonStatisticsForRiskLevel" + changchunMark, keyPerson);
Map<String, Integer> map = new HashMap<>(); Map<String, Integer> map = new HashMap<>();
map.put("1", 0); map.put("1", 0);
map.put("2", 0); map.put("2", 0);
......
...@@ -82,9 +82,9 @@ public class keyPersonMinorServiceImpl { ...@@ -82,9 +82,9 @@ public class keyPersonMinorServiceImpl {
page.getParams().put("_scope", setMap); page.getParams().put("_scope", setMap);
} }
Page<KeyPerson> keyPersonList = commonService.findPage(nameSpace + "findKeyPersonList", page); Page<KeyPerson> keyPersonList = commonService.findPage(nameSpace + "findKeyPersonList", page);
// for (KeyPerson keyPerson : keyPersonList.getResults()) { for (KeyPerson keyPerson : keyPersonList.getResults()) {
// keyPerson.setKeyPersonHighlyConcernedRel(commonService.findList(nameSpace + "findKeyPersonHighlyConcernedRelListByKeyPersonId", keyPerson)); keyPerson.setKeyPersonHighlyConcernedRel(commonService.findList(nameSpace + "findKeyPersonHighlyConcernedRelListByKeyPersonId", keyPerson));
// } }
return keyPersonList; return keyPersonList;
} }
...@@ -164,15 +164,15 @@ public class keyPersonMinorServiceImpl { ...@@ -164,15 +164,15 @@ public class keyPersonMinorServiceImpl {
if (commonService.insert(nameSpace + "insertKeyPersonById", keyPerson) == 0) { if (commonService.insert(nameSpace + "insertKeyPersonById", keyPerson) == 0) {
throw new CustomException("操作失败!"); throw new CustomException("操作失败!");
} }
// keyPerson.getKeyPersonHighlyConcernedRel().forEach(keyPersonHighlyConcernedRel -> { keyPerson.getKeyPersonHighlyConcernedRel().forEach(keyPersonHighlyConcernedRel -> {
// keyPersonHighlyConcernedRel.setKeyPersonId(keyPerson.getId()); keyPersonHighlyConcernedRel.setKeyPersonId(keyPerson.getId());
// keyPersonHighlyConcernedRel.setCardNo(keyPerson.getCardNo()); keyPersonHighlyConcernedRel.setCardNo(keyPerson.getCardNo());
// keyPersonHighlyConcernedRel.setId(UUIDUtil.getUUID()); keyPersonHighlyConcernedRel.setId(UUIDUtil.getUUID());
// keyPersonHighlyConcernedRel.set_user(keyPerson.get_user()); keyPersonHighlyConcernedRel.set_user(keyPerson.get_user());
// if (commonService.insert(nameSpace + "insertKeyPersonHighlyConcernedRel", keyPersonHighlyConcernedRel) == 0) { if (commonService.insert(nameSpace + "insertKeyPersonHighlyConcernedRel", keyPersonHighlyConcernedRel) == 0) {
// throw new CustomException("操作失败!"); throw new CustomException("操作失败!");
// } }
// }); });
return "success"; return "success";
} }
void checkFied(KeyPerson keyPerson){ void checkFied(KeyPerson keyPerson){
...@@ -248,16 +248,16 @@ public class keyPersonMinorServiceImpl { ...@@ -248,16 +248,16 @@ public class keyPersonMinorServiceImpl {
}); });
} }
} }
// commonService.delete(nameSpace + "deleteKeyPersonHighlyConcernedRelByPersonId", keyPerson); commonService.delete(nameSpace + "deleteKeyPersonHighlyConcernedRelByPersonId", keyPerson);
// keyPerson.getKeyPersonHighlyConcernedRel().forEach(keyPersonHighlyConcernedRel -> { keyPerson.getKeyPersonHighlyConcernedRel().forEach(keyPersonHighlyConcernedRel -> {
// keyPersonHighlyConcernedRel.setKeyPersonId(keyPerson.getId()); keyPersonHighlyConcernedRel.setKeyPersonId(keyPerson.getId());
// keyPersonHighlyConcernedRel.setCardNo(keyPerson.getCardNo()); keyPersonHighlyConcernedRel.setCardNo(keyPerson.getCardNo());
// keyPersonHighlyConcernedRel.setId(UUIDUtil.getUUID()); keyPersonHighlyConcernedRel.setId(UUIDUtil.getUUID());
// keyPersonHighlyConcernedRel.set_user(keyPerson.get_user()); keyPersonHighlyConcernedRel.set_user(keyPerson.get_user());
// if (commonService.insert(nameSpace + "insertKeyPersonHighlyConcernedRel", keyPersonHighlyConcernedRel) == 0) { if (commonService.insert(nameSpace + "insertKeyPersonHighlyConcernedRel", keyPersonHighlyConcernedRel) == 0) {
// throw new CustomException("操作失败!"); throw new CustomException("操作失败!");
// } }
// }); });
return "success"; return "success";
} }
......
package com.scpyun.platform.jilinsscgsdp.utils; package com.scpyun.platform.jilinsscgsdp.utils;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.scpyun.base.bean.User;
import com.scpyun.base.db.service.CommonService; import com.scpyun.base.db.service.CommonService;
import org.springframework.beans.BeanWrapper;
import org.springframework.beans.BeanWrapperImpl;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -142,6 +145,29 @@ public class DataScopeUtil { ...@@ -142,6 +145,29 @@ public class DataScopeUtil {
} }
} }
/**
* 是否是长春
* @param _user
* @return true:是 false:否
*/
public static Boolean isChanChun(User _user) {
Map<String, Object> map = new HashMap<>();
BeanWrapper beanWrapper = new BeanWrapperImpl(_user);
for (java.beans.PropertyDescriptor pd : beanWrapper.getPropertyDescriptors()) {
String propertyName = pd.getName();
// 跳过class属性
if (!"class".equals(propertyName)) {
Object propertyValue = beanWrapper.getPropertyValue(propertyName);
map.put(propertyName, propertyValue);
}
}
if(map.get("company_id") == null) {
return false;
}else{
return isChanChun(map);
}
}
public static Map<String, Object> resetUser(Map<String, Object> map) { public static Map<String, Object> resetUser(Map<String, Object> map) {
Object _user = map.get("_user"); Object _user = map.get("_user");
Map<String, Object> queryMap = new HashMap<>(); Map<String, Object> queryMap = new HashMap<>();
......
package com.scpyun.platform.jilinsscgsdp.utils;
import cn.hutool.core.util.IdUtil;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.scpyun.base.core.utils.UUIDUtil;
import com.scpyun.base.db.service.CommonService;
import com.scpyun.platform.jilinsscgsdp.bean.entity.KeyPersonImp;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanWrapper;
import org.springframework.beans.BeanWrapperImpl;
import java.beans.PropertyDescriptor;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
public class FileDataListener extends AnalysisEventListener<KeyPersonImp> {
/**
* 日志
*/
private static final Logger log = LoggerFactory.getLogger(FileDataListener.class);
/**
* 批量处理阈值,每读取100条数据处理一次
*/
private static final int BATCH_COUNT = 200;
/**
* 缓存读取到的数据
*/
private List<KeyPersonImp> cachedDataList = new ArrayList<>(BATCH_COUNT);
/**
* 成功插入的数据计数
*/
private AtomicInteger insertCount = new AtomicInteger(0);
/**
* 成功更新的数据计数
*/
private AtomicInteger updateCount = new AtomicInteger(0);
/**
* 解析失败的数据计数
*/
private AtomicInteger errorCount = new AtomicInteger(0);
//临时变量
private Map<String, KeyPersonImp> personMap = new HashMap<>();
private Map<String, String> cityMap = new HashMap<>();
private Map<String, Map<String, String>> areaMap = new HashMap<>();
private Map<String, Map<String, String>> streetMap = new HashMap<>();
private Map<String, Map<String, String>> communityMap = new HashMap<>();
private Map<String, String> mzMap = new HashMap<>();//民族信息
//参数变量,登录人相关
private Map<String, Object> paraMap;
private String userCode = "";
private String companyId = "";
private String parentIds = "";
private String grade = "";
private String area_id = "";
private String sysType = "";
//所属位置
private String cityId = "";
private String areaId = "";
private String streetId = "";
private String communityId = "";
private StringBuffer errMsg = new StringBuffer();
/**
* 服务参数
*/
private CommonService commonService;
private String namespace;
private final String nameSpaceSys = "com.scpyun.platform.standard.jilinsscgsdp.sys.";
private final String nameSpacePeople = "com.scpyun.platform.standard.jilinsscgsdp.peopleInfo.";
// 如果监听器需要被Spring管理
public FileDataListener(CommonService commonService, String namespace, Map<String, Object> map) {
this.commonService = commonService;
this.namespace = namespace;
paraMap = map;
sysType = String.valueOf(map.get("sysType"));//类型 2 3 6
Map<String, Object> user = (Map<String, Object>) map.get("_user");
Map<String, String> pos = DataScopeUtil.getPosition(user);
grade = pos.get("grade");
area_id = pos.get("area_id");
try {
userCode = user.get("id").toString();
companyId = user.get("company_id").toString();
parentIds = user.get("parent_ids").toString();
}catch (Exception e){}
if("3".equals(grade)){//city
cityId = companyId;
}else if("4".equals(grade)){//area
String[] ids = parentIds.split(",");
cityId = ids[ids.length-1];
areaId = area_id;
}else if("5".equals(grade)){//street
String[] ids = parentIds.split(",");
cityId = ids[ids.length-2];
areaId = ids[ids.length-1];
streetId = area_id;
}else if ("6".equals(grade)){//community
String[] ids = parentIds.split(",");
cityId = ids[ids.length-3];
areaId = ids[ids.length-2];
streetId = ids[ids.length-1];
communityId = area_id;
}
initData();
}
//初始化数据
private void initData() {
String methodName = "getAllPersons_new";
if(!"6".equals(sysType)){
methodName = "getAllPersons";
}
//加载已有的用户
Map<String, String> _map = new HashMap<>();
_map.put("sysType", sysType);
_map.put("parent_id", String.valueOf(paraMap.get("cityId")));
List<KeyPersonImp> personList = commonService.findList(namespace + methodName, _map);
for (int i = 0,il=personList.size(); i < il; i++) {
KeyPersonImp obj = personList.get(i);
String cardNo = obj.getCardNo();
personMap.put(cardNo, obj);
}
List<Map<String, Object>> mzlist = commonService.findList(nameSpacePeople + "findMZList", _map);
for (int i = 0,il=mzlist.size(); i < il; i++) {
Map<String, Object> obj = mzlist.get(i);
mzMap.put(obj.get("mzname").toString(), obj.get("mzcode").toString());
}
// List<Map<String, Object>> cityList = commonService.findList(nameSpaceSys + "selectCityList", _map);
// for (int i = 0,il=cityList.size(); i < il; i++) {
// Map<String, Object> obj = cityList.get(i);
// cityMap.put(String.valueOf(obj.get("name")), String.valueOf(obj.get("parent_id")));
// }
_map = null;
}
// 累积一批数据后处理,例如每100条入库一次
@Override
public void invoke(KeyPersonImp person, AnalysisContext context) {
// 处理单行数据
try {
// log.info("解析到一条数据: {}", JSON.toJSONString(person));
// 这里可以添加数据校验逻辑
if (isValidProduct(person)) {
cachedDataList.add(person);
} else {
errorCount.incrementAndGet(); // 失败计数增加
// log.warn("数据校验失败: {}", JSON.toJSONString(person));
}
// 达到BATCH_COUNT时,执行一次批量插入,清空缓存[citation:4]
if (cachedDataList.size() >= BATCH_COUNT) {
saveData();
cachedDataList.clear();
}
} catch (Exception e) {
errorCount.incrementAndGet();
// log.error("处理数据时发生异常: {}", e.getMessage());
// 注意:抛出异常会停止读取,如不想停止,可捕获异常
}
}
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
// 所有数据解析完成后的操作
// 确保最后一批数据也被保存[citation:4]
if (!cachedDataList.isEmpty()) {
saveData();
cachedDataList.clear();
}
// 输出最终统计结果
// int total = insertCount.get() + updateCount.get() + errorCount.get();
// log.info("所有数据解析完成!成功解析: {} 条,失败: {} 条,总计: {} 条",
// successCount.get(), errorCount.get(), total);
}
/**
* 保存数据到数据库[citation:4]
*/
private void saveData() {
if (cachedDataList.isEmpty()) {
return;
}
List<KeyPersonImp> addList = new ArrayList<>();
List<KeyPersonImp> updList = new ArrayList<>();
//这里需要根据身份证号读取数据数据做对比,无数据进行插入,有数据进行更新,需要调整批量处理数量
for (int i = 0,il=cachedDataList.size(); i < il; i++) {
KeyPersonImp person = cachedDataList.get(i);
person.setSysType(sysType);
String cardNo = person.getCardNo();
if(personMap.containsKey(cardNo)){
enc(person, false);//更新时不做所在位置更新处理
updList.add(trans(person, personMap.get(cardNo)));
updateCount.incrementAndGet();
}else{
String errMark = enc(person, true);//社区使用,核对有效社区即可
if(errMark == null){
person.setId(IdUtil.simpleUUID());
person.setSysType(sysType);
person.setCreateUser(userCode);
addList.add(person);
insertCount.incrementAndGet();
}else{
errMsg.append(",");
errMsg.append(errMark);
}
}
}
// 实际开发中,这里调用service或dao进行数据持久化
if(addList.size()>0){
String methodName = "keyPersonInsertBatch_new";
if(!"6".equals(sysType)){
methodName = "keyPersonInsertBatch";
}
Map<String, Object> _map = new HashMap<>();
_map.put("list", addList);
commonService.insert(namespace + methodName, _map);
//关注情形
insertHighData(addList, false);
}
if(updList.size()>0){
String methodName = "keyPersonUpdateBatch_new";
if(!"6".equals(sysType)){
methodName = "keyPersonUpdateBatch";
}
// Map<String, Object> _map = new HashMap<>();
// _map.put("list", updList);
// commonService.update(namespace + methodName, _map);
for (int i = 0,il=updList.size(); i < il; i++) {
KeyPersonImp person = updList.get(i);
commonService.update(namespace + methodName, person);
}
//关注情形
insertHighData(updList, true);
}
// log.info("批量保存完成");
addList = null;
updList = null;
}
/**
* 人员关注情形信息处理
* @param list
* @param delFlag
*/
private void insertHighData(List<KeyPersonImp> list, Boolean delFlag) {
Map<String, Object> _map = new HashMap<>();
List<Map<String, Object>> highList = new ArrayList<>();
for (int i = 0,il=list.size(); i < il; i++) {
KeyPersonImp obj = list.get(i);
List<String> tlist = new ArrayList<>();
if(StringUtils.isNotEmpty(obj.getCriminalTendency())) {
tlist.add("重新犯罪");
}
if(StringUtils.isNotEmpty(obj.getEvil())) {
tlist.add("黑恶");
}
if(StringUtils.isNotEmpty(obj.getHeinousCrime())) {
tlist.add("恶性犯罪");
}
if(StringUtils.isNotEmpty(obj.getCult())) {
tlist.add("邪教");
}
if(StringUtils.isNotEmpty(obj.getThreeNoesPerson())) {
tlist.add("三无人员");
}
for (int j = 0,jl=tlist.size(); j < jl; j++) {
Map<String, Object> tmap = new HashMap<>();
tmap.put("id", UUIDUtil.getUUID());
tmap.put("keyPersonId", obj.getId());
tmap.put("cardNo", obj.getCardNo());
tmap.put("highly", tlist.get(j));
tmap.put("userId", userCode);
highList.add(tmap);
}
}
if(delFlag) {
String methodName = "deletekeyPersonHighlyByIds_new";
if(!"6".equals(sysType)){
methodName = "deletekeyPersonHighlyByIds";
}
List<String> cardList = list.stream().map(KeyPersonImp::getCardNo).collect(Collectors.toList());
_map.clear();
_map.put("list", cardList);
commonService.delete(namespace + methodName, _map);
}
if(highList.size()>0){
String methodName = "keyPersonHighlyInsertBatch_new";
if(!"6".equals(sysType)){
methodName = "keyPersonHighlyInsertBatch";
}
_map.clear();
_map.put("list", highList);
commonService.insert(namespace + methodName, _map);
}
}
//excel解析内容转换及位置处理判断
private String enc(KeyPersonImp person, Boolean judge) {
if(person.getFolk()!=null && !person.getFolk().equals("")){
String mz = null;
for(String key : mzMap.keySet()){
if(key.indexOf(person.getFolk())!=-1) {
mz = mzMap.get(key);
break;
}
}
person.setFolk(mz);
}
person.setSex("女".equals(person.getSex().trim())?"2":"1");
if(person.getInvolvingConflictsDisputes()!=null && ("1".equals(person.getInvolvingConflictsDisputes().trim())
|| "是".equals(person.getInvolvingConflictsDisputes().trim())
|| "有".equals(person.getInvolvingConflictsDisputes().trim()))) {
person.setInvolvingConflictsDisputes("1");
String level = person.getRiskLevel();
if(level!=null) {
if("1".equals(level)) {
person.setRiskLevel("1");
}else if("2".equals(level)) {
person.setRiskLevel("2");
}else if("3".equals(level)) {
person.setRiskLevel("3");
}
}
}else{
person.setInvolvingConflictsDisputes("2");
}
//需要做机构判断
if(judge) {
if("3".equals(grade)){//city
person.setCityId(cityId);
setArea(person);
setStreet(person);
setCommunity(person);
}else if("4".equals(grade)){//area
person.setCityId(cityId);
person.setAreaId(areaId);
setStreet(person);
setCommunity(person);
}else if("5".equals(grade)){//street
person.setCityId(cityId);
person.setAreaId(areaId);
person.setStreetId(streetId);
setCommunity(person);
}else if ("6".equals(grade)){//community
person.setCityId(cityId);
person.setAreaId(areaId);
person.setStreetId(streetId);
if(person.getCommunityName()==null || person.getCommunityName().trim().length()==0) {
person.setCommunityId(communityId);
}else{
setCommunity(person);
}
}else{//管理员
person.setCityId("220100000000");
setArea(person);
setStreet(person);
setCommunity(person);
}
if(person.getCommunityId()==null) {
return person.getName();
}
}else{
person.setCityId(null);
person.setAreaId(null);
person.setStreetId(null);
person.setCommunityId(null);
}
return null;
}
private void setArea(KeyPersonImp person) {
if(person.getCityId()!=null && !"".equals(person.getCityId().trim()) &&
person.getAreaName()!=null && !"".equals(person.getAreaName().trim())){
Map<String, String> _map = areaMap.get(person.getCityId());
if(_map==null){
_map = new HashMap<>();
encMap(_map, person.getCityId());
areaMap.put(person.getCityId(), _map);
}
for(String key : _map.keySet()){
if(key.indexOf(person.getAreaName())!=-1){
person.setAreaId(_map.get(key));
break;
}
}
}
}
private void setStreet(KeyPersonImp person) {
if(person.getAreaId()!=null && !"".equals(person.getAreaId().trim()) &&
person.getStreetName()!=null && !"".equals(person.getStreetName().trim())){
Map<String, String> _map = streetMap.get(person.getAreaId());
if(_map==null){
_map = new HashMap<>();
encMap(_map, person.getAreaId());
streetMap.put(person.getAreaId(), _map);
}
for(String key : _map.keySet()){
if(key.indexOf(person.getStreetName())!=-1){
person.setStreetId(_map.get(key));
break;
}
}
}
}
private void setCommunity(KeyPersonImp person) {
if(person.getStreetId()!=null && !"".equals(person.getStreetId().trim()) &&
person.getCommunityName()!=null && !"".equals(person.getCommunityName().trim())){
Map<String, String> _map = communityMap.get(person.getStreetId());
if(_map==null){
_map = new HashMap<>();
encMap(_map, person.getStreetId());
communityMap.put(person.getStreetId(), _map);
}
for(String key : _map.keySet()){
if(key.indexOf(person.getCommunityName())!=-1){
person.setCommunityId(_map.get(key));
break;
}
}
}
}
private void encMap(Map map, String parentId) {
Map<String, Object> _map = new HashMap<>();
_map.put("parent_id", parentId);
List<Map<String, Object>> list = commonService.findList(nameSpaceSys + "selectCityList", _map);
for (int i = 0,il=list.size(); i < il; i++) {
Map<String, Object> obj = list.get(i);
map.put(String.valueOf(obj.get("name")), String.valueOf(obj.get("parent_id")));
}
}
//传入数据赋值给原数据,null不复制
private KeyPersonImp trans(KeyPersonImp person, KeyPersonImp oldPerson) {
BeanUtils.copyProperties(person, oldPerson, getNullPropertyNames(person));
oldPerson.setUpdateUser(userCode);
return oldPerson;
}
/**
* 获取对象中为null的属性名数组
* @param source 源对象
* @return 为null的属性名数组
*/
private static String[] getNullPropertyNames(Object source) {
final BeanWrapper src = new BeanWrapperImpl(source);
PropertyDescriptor[] pds = src.getPropertyDescriptors();
Set<String> emptyNames = new HashSet<>();
for (PropertyDescriptor pd : pds) {
Object srcValue = src.getPropertyValue(pd.getName());
if (srcValue == null) {
emptyNames.add(pd.getName());
}
}
String[] result = new String[emptyNames.size()];
return emptyNames.toArray(result);
}
/**
* 数据校验方法
*/
private boolean isValidProduct(KeyPersonImp person) {
//身份证号、姓名、电话、性别
return person.getCardNo() != null &&
!person.getCardNo().trim().isEmpty() &&
person.getName() != null &&
!person.getName().trim().isEmpty() &&
person.getSex() != null &&
!person.getSex().trim().isEmpty() &&
person.getPhone() != null &&
!person.getPhone().trim().isEmpty();
}
/**
* 返回结果
* @return
*/
public Map<String, Object> getResult() {
String errInfo = null;
if(errMsg.length() > 0) {
errInfo = errMsg.substring(1);
}
Map<String, Object> rmap = new HashMap<>();
rmap.put("insert", insertCount.get());
rmap.put("update", updateCount.get());
rmap.put("error", errorCount.get());
rmap.put("errInfo", errInfo);
return rmap;
}
// // 存储表头信息,key为列索引,value为表头内容
// private Map<Integer, String> headMap = new HashMap<>();
//
// @Override
// public void invokeHeadMap(Map<Integer, String> headMap, AnalysisContext context) {
// // 此方法在读取到表头时调用,可以获取多级表头信息[citation:3]
// headMap.putAll(headMap);
// System.out.println("解析到的表头:" + headMap);
// }
}
...@@ -277,7 +277,7 @@ ...@@ -277,7 +277,7 @@
select a.* select a.*
from (select jl_key_person_minor.id as id, from (select jl_key_person_minor.id as id,
jl_key_person_minor.name as name, jl_key_person_minor.name as name,
sys_type as sysType, jl_key_person_minor.sys_type as sysType,
<!--card_no cardNo,--> <!--card_no cardNo,-->
cast(AES_DECRYPT(FROM_BASE64(card_no),'*#id#') as char) cardNo, cast(AES_DECRYPT(FROM_BASE64(card_no),'*#id#') as char) cardNo,
registered_residence as registeredResidence, registered_residence as registeredResidence,
...@@ -295,11 +295,11 @@ ...@@ -295,11 +295,11 @@
letters_visits_type lettersVisitsType, letters_visits_type lettersVisitsType,
folk, folk,
involving_conflicts_disputes as involvingConflictsDisputes, involving_conflicts_disputes as involvingConflictsDisputes,
region as region, jl_key_person_minor.region as region,
city_id as cityId, jl_key_person_minor.city_id as cityId,
area_id as areaId, jl_key_person_minor.area_id as areaId,
street_id as streetId, jl_key_person_minor.street_id as streetId,
community_id as communityId, jl_key_person_minor.community_id as communityId,
community.name communityName, community.name communityName,
jl_key_person_minor.remarks as remarks, jl_key_person_minor.remarks as remarks,
hazard_assessment_level as hazardAssessmentLevel, hazard_assessment_level as hazardAssessmentLevel,
...@@ -341,7 +341,45 @@ ...@@ -341,7 +341,45 @@
WHEN DATEDIFF(history.plan_end_data, CURDATE()) &lt; 0 THEN 0 WHEN DATEDIFF(history.plan_end_data, CURDATE()) &lt; 0 THEN 0
ELSE DATEDIFF(history.plan_end_data, CURDATE()) ELSE DATEDIFF(history.plan_end_data, CURDATE())
END AS remainDays, END AS remainDays,
history.is_overdue as isOverdue history.is_overdue as isOverdue,
<choose>
<when test="params._scope.scope_grade == '3'.toString()">
case when jl_key_person_rating_dual_person.id is not null and jl_key_person_minor.city_id = #{params._scope.scope_area_id}
and jl_key_person_minor.city_id != jl_key_person_rating_dual_person.city_id then '1' else '0' end as dualPersonBelong,
</when>
<when test="params._scope.scope_grade == '4'.toString()">
case when jl_key_person_rating_dual_person.id is not null and jl_key_person_minor.area_id = #{params._scope.scope_area_id}
and jl_key_person_minor.area_id != jl_key_person_rating_dual_person.area_id then '1' else '0' end as dualPersonBelong,
</when>
<when test="params._scope.scope_grade == '5'.toString()">
case when jl_key_person_rating_dual_person.id is not null and jl_key_person_minor.street_id = #{params._scope.scope_area_id}
and jl_key_person_minor.street_id != jl_key_person_rating_dual_person.street_id then '1' else '0' end as dualPersonBelong,
</when>
<when test="params._scope.scope_grade == '6'.toString()">
case when jl_key_person_rating_dual_person.id is not null and jl_key_person_minor.community_id = #{params._scope.scope_area_id}
and jl_key_person_minor.community_id != jl_key_person_rating_dual_person.community_id then '1' else '0' end as dualPersonBelong,
</when>
<otherwise>
'0' as dualPersonBelong,
</otherwise>
</choose>
<choose>
<when test="params._scope.scope_grade == '3'.toString()">
case when jl_key_person_rating_dual_person.city_id = #{params._scope.scope_area_id} then '1' else '0' end as dualPerson
</when>
<when test="params._scope.scope_grade == '4'.toString()">
case when jl_key_person_rating_dual_person.area_id = #{params._scope.scope_area_id} then '1' else '0' end as dualPerson
</when>
<when test="params._scope.scope_grade == '5'.toString()">
case when jl_key_person_rating_dual_person.street_id = #{params._scope.scope_area_id} then '1' else '0' end as dualPerson
</when>
<when test="params._scope.scope_grade == '6'.toString()">
case when jl_key_person_rating_dual_person.community_id = #{params._scope.scope_area_id} then '1' else '0' end as dualPerson
</when>
<otherwise>
'0' as dualPerson
</otherwise>
</choose>
from jl_key_person_minor from jl_key_person_minor
left join sys_area city on jl_key_person_minor.city_id = city.code left join sys_area city on jl_key_person_minor.city_id = city.code
left join sys_area area on jl_key_person_minor.area_id = area.code left join sys_area area on jl_key_person_minor.area_id = area.code
...@@ -350,6 +388,7 @@ ...@@ -350,6 +388,7 @@
left join jl_key_person_rating_history history on jl_key_person_minor.id = history.key_person_id and history.rating_dict_type = #{params.sysType} and history.is_history = '1' left join jl_key_person_rating_history history on jl_key_person_minor.id = history.key_person_id and history.rating_dict_type = #{params.sysType} and history.is_history = '1'
left join jl_key_person_rating_summary summary on jl_key_person_minor.id = summary.key_person_id and summary.rating_dict_type = #{params.sysType} and summary.is_history = '1' left join jl_key_person_rating_summary summary on jl_key_person_minor.id = summary.key_person_id and summary.rating_dict_type = #{params.sysType} and summary.is_history = '1'
left join sys_dict rating_dict on rating_dict.type = 'rating_level' and rating_dict.del_flag = '0' and rating_dict.value = summary.rating_type left join sys_dict rating_dict on rating_dict.type = 'rating_level' and rating_dict.del_flag = '0' and rating_dict.value = summary.rating_type
left join jl_key_person_rating_dual_person on jl_key_person_minor.id = jl_key_person_rating_dual_person.key_person_id
<where> 1=1 <where> 1=1
<if test="params.involvingConflictsDisputes != null and params.involvingConflictsDisputes != ''"> <if test="params.involvingConflictsDisputes != null and params.involvingConflictsDisputes != ''">
and involving_conflicts_disputes like concat('%',#{params.involvingConflictsDisputes},'%') and involving_conflicts_disputes like concat('%',#{params.involvingConflictsDisputes},'%')
...@@ -375,7 +414,7 @@ ...@@ -375,7 +414,7 @@
and jl_key_person_minor.name like concat('%',#{params.name},'%') and jl_key_person_minor.name like concat('%',#{params.name},'%')
</if> </if>
<if test="params.sysType != null and params.sysType != ''"> <if test="params.sysType != null and params.sysType != ''">
and sys_type = #{params.sysType} and jl_key_person_minor.sys_type = #{params.sysType}
</if> </if>
<if test="params.cardNo != null and params.cardNo != ''"> <if test="params.cardNo != null and params.cardNo != ''">
<!--and card_no like concat('%',#{params.cardNo},'%')--> <!--and card_no like concat('%',#{params.cardNo},'%')-->
...@@ -471,16 +510,16 @@ ...@@ -471,16 +510,16 @@
<!-- </if>--> <!-- </if>-->
<if test="params.cityId!=null and params.cityId!=''"> <if test="params.cityId!=null and params.cityId!=''">
AND city_id = #{params.cityId} AND jl_key_person_minor.city_id = #{params.cityId}
</if> </if>
<if test="params.areaId!=null and params.areaId!=''"> <if test="params.areaId!=null and params.areaId!=''">
AND area_id = #{params.areaId} AND jl_key_person_minor.area_id = #{params.areaId}
</if> </if>
<if test="params.streetId!=null and params.streetId!=''"> <if test="params.streetId!=null and params.streetId!=''">
AND street_id = #{params.streetId} AND jl_key_person_minor.street_id = #{params.streetId}
</if> </if>
<if test="params.communityId!=null and params.communityId!=''"> <if test="params.communityId!=null and params.communityId!=''">
AND community_id = #{params.communityId} AND jl_key_person_minor.community_id = #{params.communityId}
</if> </if>
<if test="params.distCard != null and params.distCard !=''"> <if test="params.distCard != null and params.distCard !=''">
AND card_no IN (SELECT card_no FROM jl_key_person_minor AND card_no IN (SELECT card_no FROM jl_key_person_minor
...@@ -497,16 +536,20 @@ ...@@ -497,16 +536,20 @@
<where> <where>
<choose> <choose>
<when test="params._scope.scope_grade == '3'.toString()"> <when test="params._scope.scope_grade == '3'.toString()">
AND jl_key_person_minor.city_id = #{params._scope.scope_area_id} AND (jl_key_person_minor.city_id = #{params._scope.scope_area_id}
OR exists(select id from jl_key_person_rating_dual_person where city_id = #{params._scope.scope_area_id} AND key_person_id=jl_key_person_minor.id))
</when> </when>
<when test="params._scope.scope_grade == '4'.toString()"> <when test="params._scope.scope_grade == '4'.toString()">
AND jl_key_person_minor.area_id = #{params._scope.scope_area_id} AND (jl_key_person_minor.area_id = #{params._scope.scope_area_id}
OR exists(select id from jl_key_person_rating_dual_person where area_id = #{params._scope.scope_area_id} AND key_person_id=jl_key_person_minor.id))
</when> </when>
<when test="params._scope.scope_grade == '5'.toString()"> <when test="params._scope.scope_grade == '5'.toString()">
AND jl_key_person_minor.street_id = #{params._scope.scope_area_id} AND (jl_key_person_minor.street_id = #{params._scope.scope_area_id}
OR exists(select id from jl_key_person_rating_dual_person where street_id = #{params._scope.scope_area_id} AND key_person_id=jl_key_person_minor.id))
</when> </when>
<when test="params._scope.scope_grade == '6'.toString()"> <when test="params._scope.scope_grade == '6'.toString()">
AND jl_key_person_minor.community_id = #{params._scope.scope_area_id} AND (jl_key_person_minor.community_id = #{params._scope.scope_area_id}
OR exists(select id from jl_key_person_rating_dual_person where community_id = #{params._scope.scope_area_id} AND key_person_id=jl_key_person_minor.id))
</when> </when>
</choose> </choose>
</where> </where>
...@@ -515,16 +558,20 @@ ...@@ -515,16 +558,20 @@
<!-- 数据范围 --> <!-- 数据范围 -->
<choose> <choose>
<when test="params._scope.scope_grade == '3'.toString()"> <when test="params._scope.scope_grade == '3'.toString()">
AND jl_key_person_minor.city_id = #{params._scope.scope_area_id} AND (jl_key_person_minor.city_id = #{params._scope.scope_area_id}
OR exists(select id from jl_key_person_rating_dual_person where city_id = #{params._scope.scope_area_id} AND key_person_id=jl_key_person_minor.id))
</when> </when>
<when test="params._scope.scope_grade == '4'.toString()"> <when test="params._scope.scope_grade == '4'.toString()">
AND jl_key_person_minor.area_id = #{params._scope.scope_area_id} AND (jl_key_person_minor.area_id = #{params._scope.scope_area_id}
OR exists(select id from jl_key_person_rating_dual_person where area_id = #{params._scope.scope_area_id} AND key_person_id=jl_key_person_minor.id))
</when> </when>
<when test="params._scope.scope_grade == '5'.toString()"> <when test="params._scope.scope_grade == '5'.toString()">
AND jl_key_person_minor.street_id = #{params._scope.scope_area_id} AND (jl_key_person_minor.street_id = #{params._scope.scope_area_id}
OR exists(select id from jl_key_person_rating_dual_person where street_id = #{params._scope.scope_area_id} AND key_person_id=jl_key_person_minor.id))
</when> </when>
<when test="params._scope.scope_grade == '6'.toString()"> <when test="params._scope.scope_grade == '6'.toString()">
AND jl_key_person_minor.community_id = #{params._scope.scope_area_id} AND (jl_key_person_minor.community_id = #{params._scope.scope_area_id}
OR exists(select id from jl_key_person_rating_dual_person where community_id = #{params._scope.scope_area_id} AND key_person_id=jl_key_person_minor.id))
</when> </when>
</choose> </choose>
</where> </where>
...@@ -560,7 +607,7 @@ ...@@ -560,7 +607,7 @@
address, address,
<!--criminal_tendency as criminalTendency,--> <!--criminal_tendency as criminalTendency,-->
case criminal_tendency when '1' then '有' when '2' then '无' end as criminalTendency, case criminal_tendency when '1' then '有' when '2' then '无' end as criminalTendency,
<!-- (select group_concat(highly_concerned_situation) from jl_key_person_minor_highly_concerned_rel where key_person_id=jl_key_person_minor.id) as highly_concerned_situation,--> (select group_concat(highly_concerned_situation) from jl_key_person_minor_highly_concerned_rel where key_person_id=jl_key_person_minor.id) as highly_concerned_situation,
criminal_tendency_situation as criminalTendencySituation, criminal_tendency_situation as criminalTendencySituation,
letters_visits_type lettersVisitsType, letters_visits_type lettersVisitsType,
folk, folk,
...@@ -2266,4 +2313,129 @@ ...@@ -2266,4 +2313,129 @@
</if> </if>
order by update_date desc order by update_date desc
</select> </select>
<!-- 长春独立统计 -->
<select id="keyPersonStatisticsForTypeAll_changchun" parameterType="com.scpyun.platform.jilinsscgsdp.bean.entity.KeyPerson"
resultType="com.scpyun.platform.jilinsscgsdp.bean.entity.KeyPerson">
select count(distinct card_no) as count
from
jl_key_person
<where>
<if test="_user.company_grade == '3'.toString()">
AND (city_id = #{_user.company_id} OR exists(select id from jl_key_person_rating_dual_person where city_id = #{_user.company_id} AND key_person_id=jl_key_person.id))
</if>
<if test="_user.company_grade == '4'.toString()">
AND (area_id = #{_user.company_id} OR exists(select id from jl_key_person_rating_dual_person where area_id = #{_user.company_id} AND key_person_id=jl_key_person.id))
</if>
<if test="_user.company_grade == '5'.toString()">
AND (street_id = #{_user.company_id} OR exists(select id from jl_key_person_rating_dual_person where street_id = #{_user.company_id} AND key_person_id=jl_key_person.id))
</if>
<if test="_user.company_grade == '6'.toString()">
AND (community_id = #{_user.company_id} OR exists(select id from jl_key_person_rating_dual_person where community_id = #{_user.company_id} AND key_person_id=jl_key_person.id))
</if>
</where>
</select>
<select id="findKeyPersonStatisticsForType_changchun" parameterType="com.scpyun.platform.jilinsscgsdp.bean.entity.KeyPerson"
resultType="com.scpyun.platform.jilinsscgsdp.bean.entity.KeyPerson">
select
count(distinct card_no) as count,
sys_type as sysType
from
jl_key_person
<where>
<if test="_user.company_grade == '3'.toString()">
AND (city_id = #{_user.company_id} OR exists(select id from jl_key_person_rating_dual_person where city_id = #{_user.company_id} AND key_person_id=jl_key_person.id))
</if>
<if test="_user.company_grade == '4'.toString()">
AND (area_id = #{_user.company_id} OR exists(select id from jl_key_person_rating_dual_person where area_id = #{_user.company_id} AND key_person_id=jl_key_person.id))
</if>
<if test="_user.company_grade == '5'.toString()">
AND (street_id = #{_user.company_id} OR exists(select id from jl_key_person_rating_dual_person where street_id = #{_user.company_id} AND key_person_id=jl_key_person.id))
</if>
<if test="_user.company_grade == '6'.toString()">
AND (community_id = #{_user.company_id} OR exists(select id from jl_key_person_rating_dual_person where community_id = #{_user.company_id} AND key_person_id=jl_key_person.id))
</if>
</where>
group by
sys_type
</select>
<select id="keyPersonStatisticsForRiskLevel_changchun"
parameterType="com.scpyun.platform.jilinsscgsdp.bean.entity.KeyPerson"
resultType="com.scpyun.platform.jilinsscgsdp.bean.entity.KeyPerson">
select risk_level as riskLevel, count(card_no) as count
from (select distinct card_no, risk_level
from jl_key_person
<where>
<if test="_user.company_grade == '3'.toString()">
AND (jl_key_person.create_user in (
select id from sys_user where company_id in (
select id from sys_office where ( parent_ids LIKE CONCAT('%', #{_user.company_id}, '%') OR id = #{_user.company_id} )and del_flag='0'
) and del_flag='0'
) OR exists(select id from jl_key_person_rating_dual_person where city_id = #{_user.company_id} AND key_person_id=jl_key_person.id))
</if>
<if test="_user.company_grade == '4'.toString()">
AND (jl_key_person.create_user in (
select id from sys_user where company_id in (
select id from sys_office where ( parent_ids LIKE CONCAT('%', #{_user.company_id}, '%') OR id = #{_user.company_id} ) and del_flag='0'
) and del_flag='0'
) OR exists(select id from jl_key_person_rating_dual_person where area_id = #{_user.company_id} AND key_person_id=jl_key_person.id))
</if>
<if test="_user.company_grade == '5'.toString()">
AND (jl_key_person.create_user in (
select id from sys_user where company_id in (
select id from sys_office where ( parent_ids LIKE CONCAT('%', #{_user.company_id}, '%') OR id = #{_user.company_id} ) and del_flag='0'
) and del_flag='0'
) OR exists(select id from jl_key_person_rating_dual_person where street_id = #{_user.company_id} AND key_person_id=jl_key_person.id))
</if>
<if test="_user.company_grade == '6'.toString()">
AND ((select company_id from sys_user where id = create_user) = #{_user.company_id}
OR exists(select id from jl_key_person_rating_dual_person where community_id = #{_user.company_id} AND key_person_id=jl_key_person.id))
</if>
</where>
) a
group by risk_level
</select>
<select id="findKeyPersonStatistics_changchun" resultType="com.scpyun.platform.jilinsscgsdp.bean.entity.KeyPerson">
select count(a.card_no) as count, sys_type
from (select distinct rel.card_no, sys_type
from jl_key_person_highly_concerned_rel rel
left join jl_key_person jkp on jkp.id = rel.key_person_id
<where>
<if test="_user.company_grade == '3'.toString()">
AND (jkp.create_user in (
select id from sys_user where company_id in (
select id from sys_office where ( parent_ids LIKE CONCAT('%', #{_user.company_id}, '%') OR id = #{_user.company_id} ) and del_flag='0'
) and del_flag='0'
)
OR exists(select id from jl_key_person_rating_dual_person where city_id = #{_user.company_id} AND key_person_id=jkp.id))
</if>
<if test="_user.company_grade == '4'.toString()">
AND (jkp.create_user in (
select id from sys_user where company_id in (
select id from sys_office where ( parent_ids LIKE CONCAT('%', #{_user.company_id}, '%') OR id = #{_user.company_id} ) and del_flag='0'
) and del_flag='0'
)
OR exists(select id from jl_key_person_rating_dual_person where area_id = #{_user.company_id} AND key_person_id=jkp.id))
</if>
<if test="_user.company_grade == '5'.toString()">
AND (jkp.create_user in (
select id from sys_user where company_id in (
select id from sys_office where ( parent_ids LIKE CONCAT('%', #{_user.company_id}, '%') OR id = #{_user.company_id} ) and del_flag='0'
) and del_flag='0'
)
OR exists(select id from jl_key_person_rating_dual_person where street_id = #{_user.company_id} AND key_person_id=jkp.id))
</if>
<if test="_user.company_grade == '6'.toString()">
AND ((select company_id from sys_user where id = jkp.create_user) = #{_user.company_id}
OR exists(select id from jl_key_person_rating_dual_person where community_id = #{_user.company_id} AND key_person_id=jkp.id))
</if>
</where>
) a
group by a.sys_type
</select>
</mapper> </mapper>
...@@ -141,7 +141,8 @@ ...@@ -141,7 +141,8 @@
rating_description, rating_description,
company_code, company_code,
create_by, create_by,
create_time create_time,
rating_remarks
) VALUES ( ) VALUES (
#{id}, #{id},
#{rating_dict_type}, #{rating_dict_type},
...@@ -156,7 +157,8 @@ ...@@ -156,7 +157,8 @@
#{rating_description}, #{rating_description},
#{_user.company_code}, #{_user.company_code},
#{_user.id}, #{_user.id},
NOW() NOW(),
#{remarks}
) )
</insert> </insert>
...@@ -187,7 +189,9 @@ ...@@ -187,7 +189,9 @@
rating, rating,
is_history, is_history,
create_by, create_by,
create_time create_time,
rating_users,
rating_custom_time
) VALUES ( ) VALUES (
#{id}, #{id},
#{rating_dict_type}, #{rating_dict_type},
...@@ -200,7 +204,9 @@ ...@@ -200,7 +204,9 @@
#{rating}, #{rating},
#{is_history}, #{is_history},
#{_user.id}, #{_user.id},
NOW() NOW(),
#{rating_users},
STR_TO_DATE(#{rating_custom_time}, '%Y-%m-%d %H:%i:%s')
) )
<!--<selectKey keyProperty="count" resultType="int" order="BEFORE"> <!--<selectKey keyProperty="count" resultType="int" order="BEFORE">
SELECT COUNT(1) FROM jl_key_person_rating_summary WHERE id = #{key_person_rating_summary_id} SELECT COUNT(1) FROM jl_key_person_rating_summary WHERE id = #{key_person_rating_summary_id}
...@@ -274,9 +280,11 @@ ...@@ -274,9 +280,11 @@
kprs.key_person_id, kprs.key_person_id,
su.name rating_personnel, su.name rating_personnel,
so.name rating_company, so.name rating_company,
DATE_FORMAT(kprs.rating_time,'%Y-%m-%d %T') rating_time, DATE_FORMAT(case when kprs.rating_custom_time is not null then kprs.rating_custom_time else kprs.rating_time end,'%Y-%m-%d %T') rating_time,
kprs.rating_type, kprs.rating_type,
kprs.rating kprs.rating,
DATE_FORMAT(kprs.rating_custom_time,'%Y-%m-%d %T') rating_custom_time,
kprs.rating_users
from from
jl_key_person_rating_summary kprs jl_key_person_rating_summary kprs
LEFT JOIN sys_user su ON kprs.rating_personnel = su.id LEFT JOIN sys_user su ON kprs.rating_personnel = su.id
...@@ -300,7 +308,8 @@ ...@@ -300,7 +308,8 @@
scoring_project, scoring_project,
IF(is_whether = '1','有','无') is_whether, IF(is_whether = '1','有','无') is_whether,
details, details,
company_code company_code,
rating_remarks
FROM FROM
jl_key_person_rating_details jl_key_person_rating_details
WHERE WHERE
...@@ -357,15 +366,38 @@ ...@@ -357,15 +366,38 @@
UPDATE UPDATE
jl_key_person_rating_history jl_key_person_rating_history
SET SET
do_status = '1', do_status = #{do_status},
update_by = #{_user.id}, update_by = #{_user.id},
update_time = NOW() update_time = NOW()
WHERE WHERE
key_person_id = #{key_person_id} key_person_id = #{key_person_id}
AND rating_dict_type = #{rating_dict_type} AND rating_dict_type = #{rating_dict_type}
AND is_history = '1' AND id = #{id}
</update> </update>
<select id="selectRatingHistoryById" parameterType="map" resultType="map">
SELECT
id,
rating_dict_type,
key_person_id,
plan_start_data,
plan_end_data,
overdue_date,
is_history,
do_status,
is_overdue,
batch_id,
create_by,
create_time,
update_by,
update_time
FROM
jl_key_person_rating_history
WHERE
id = #{id}
</select>
<select id="findKeyPersonMinorList" parameterType="page" resultType="map"> <select id="findKeyPersonMinorList" parameterType="page" resultType="map">
SELECT SELECT
id, id,
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
DATE_FORMAT(history.plan_start_data,'%Y-%m-%d') planStartData, DATE_FORMAT(history.plan_start_data,'%Y-%m-%d') planStartData,
DATE_FORMAT(history.plan_end_data,'%Y-%m-%d') planEndData, DATE_FORMAT(history.plan_end_data,'%Y-%m-%d') planEndData,
DATE_FORMAT(history.overdue_date,'%Y-%m-%d') overdueDate, DATE_FORMAT(history.overdue_date,'%Y-%m-%d') overdueDate,
DATE_FORMAT(summary_latest.rating_time,'%Y-%m-%d %T') ratingTime, DATE_FORMAT(case when summary_latest.rating_custom_time is not null then summary_latest.rating_custom_time else summary_latest.rating_time end,'%Y-%m-%d %T') ratingTime,
case case
when history.id is null then 1 when history.id is null then 1
when curdate() &gt;= history.plan_start_data and curdate() &lt;= history.plan_end_data when curdate() &gt;= history.plan_start_data and curdate() &lt;= history.plan_end_data
...@@ -35,10 +35,33 @@ ...@@ -35,10 +35,33 @@
case case
when history.do_status = '1' then 1 when history.do_status = '1' then 1
when history.do_status = '2' then 2 when history.do_status = '2' then 2
when history.do_status = '3' then 3
else '0' else '0'
end as doStatus, end as doStatus,
su.name as ratingPersonnel, su.name as ratingPersonnel,
so.name as ratingCompany so.name as ratingCompany,
summary_latest.rating_users,
<choose>
<when test="params._scope.scope_grade == '3'.toString()">
case when dualPerson.id is not null and keyPerson.city_id = #{params._scope.scope_area_id}
and keyPerson.city_id != dualPerson.city_id then '1' else '0' end as dualMark
</when>
<when test="params._scope.scope_grade == '4'.toString()">
case when dualPerson.id is not null and keyPerson.area_id = #{params._scope.scope_area_id}
and keyPerson.area_id != dualPerson.area_id then '1' else '0' end as dualMark
</when>
<when test="params._scope.scope_grade == '5'.toString()">
case when dualPerson.id is not null and keyPerson.street_id = #{params._scope.scope_area_id}
and keyPerson.street_id != dualPerson.street_id then '1' else '0' end as dualMark
</when>
<when test="params._scope.scope_grade == '6'.toString()">
case when dualPerson.id is not null and keyPerson.community_id = #{params._scope.scope_area_id}
and keyPerson.community_id != dualPerson.community_id then '1' else '0' end as dualMark
</when>
<otherwise>
'0' as dualMark
</otherwise>
</choose>
FROM jl_key_person_rating_history history FROM jl_key_person_rating_history history
LEFT JOIN ( LEFT JOIN (
SELECT SELECT
...@@ -60,6 +83,9 @@ ...@@ -60,6 +83,9 @@
AND summary_group.latest_rating_time = summary_latest.rating_time AND summary_group.latest_rating_time = summary_latest.rating_time
LEFT JOIN sys_user su ON summary_latest.rating_personnel = su.id LEFT JOIN sys_user su ON summary_latest.rating_personnel = su.id
LEFT JOIN sys_office so ON summary_latest.rating_company = so.code LEFT JOIN sys_office so ON summary_latest.rating_company = so.code
LEFT JOIN (select id,city_id,area_id,street_id,community_id from jl_key_person
union all select id,city_id,area_id,street_id,community_id from jl_key_person_minor) AS keyPerson ON keyPerson.id=history.key_person_id
LEFT JOIN jl_key_person_rating_dual_person dualPerson on dualPerson.key_person_id=keyPerson.id
<where> 1=1 <where> 1=1
<if test="params.ratingDictType != null and params.ratingDictType != ''"> <if test="params.ratingDictType != null and params.ratingDictType != ''">
and history.rating_dict_type like concat('%',#{params.ratingDictType},'%') and history.rating_dict_type like concat('%',#{params.ratingDictType},'%')
...@@ -114,4 +140,263 @@ ...@@ -114,4 +140,263 @@
) )
</insert> </insert>
<!--批量导入重点人员信息-->
<!--原表-->
<select id="getAllPersons" parameterType="map" resultType="com.scpyun.platform.jilinsscgsdp.bean.entity.KeyPersonImp">
SELECT
id, name, sex, folk,
cast(AES_DECRYPT(FROM_BASE64(card_no),'*#id#') as char) as cardNo,
phone,
registered_residence as registeredResidence,
city_id as cityId, area_id as areaId, street_id as streetId, community_id as communityId,
address,
involving_conflicts_disputes as involvingConflictsDisputes,
risk_level as riskLevel,
responsible_company_by_assistance as responsibleCompanyByAssistance,
responsible_person_by_assistance as responsiblePersonByAssistance,
responsible_company_by_key_personnel as responsibleCompanyByKeyPersonnel,
responsible_person_key_personnel as responsiblePersonKeyPersonnel,
hazard_assessment_level as hazardAssessmentLevel
FROM
jl_key_person
WHERE sys_type = #{sysType}
</select>
<insert id="keyPersonInsertBatch" parameterType="map">
INSERT INTO jl_key_person(id, sys_type, name, sex, folk, card_no, phone,
registered_residence, city_id, area_id, street_id, community_id, address,
involving_conflicts_disputes, risk_level,
responsible_company_by_assistance,
responsible_person_by_assistance,
responsible_company_by_key_personnel,
responsible_person_key_personnel,
hazard_assessment_level, create_user) VALUES
<foreach collection="list" item="person" index="index" separator=",">
(#{person.id}, #{person.sysType}, #{person.name}, #{person.sex}, #{person.folk},
TO_BASE64(AES_ENCRYPT(#{person.cardNo},'*#id#')),
#{person.phone},
#{person.registeredResidence}, #{person.cityId}, #{person.areaId}, #{person.streetId}, #{person.communityId},
#{person.address}, #{person.involvingConflictsDisputes}, #{person.riskLevel},
#{person.responsibleCompanyByAssistance}, #{person.responsiblePersonByAssistance},
#{person.responsibleCompanyByKeyPersonnel}, #{person.responsiblePersonKeyPersonnel},
#{person.hazardAssessmentLevel}, #{person.createUser})
</foreach>
</insert>
<insert id="keyPersonHighlyInsertBatch" parameterType="map">
INSERT INTO jl_key_person_highly_concerned_rel(id,
key_person_id,
card_no,
highly_concerned_situation,
create_date,
update_date,
create_user,
update_user) VALUES
<foreach collection="list" item="obj" index="index" separator=",">
(#{obj.id}, #{obj.keyPersonId}, #{obj.cardNo}, #{obj.highly}, NOW(), NOW(), #{obj.userId}, #{obj.userId})
</foreach>
</insert>
<update id="keyPersonUpdateBatch" parameterType="map">
UPDATE jl_key_person
<set>
<if test="name != null and name != ''">
name = #{name},
</if>
<if test="sex != null and sex != ''">
sex = #{sex},
</if>
<if test="folk != null and folk != ''">
folk = #{folk},
</if>
<if test="phone != null and phone != ''">
phone = #{phone},
</if>
<if test="registeredResidence != null and registeredResidence != ''">
registered_residence = #{registeredResidence},
</if>
<if test="cityId != null and cityId != ''">
`city_id` = #{cityId}
</if>
<if test="areaId != null and areaId != ''">
`area_id` = #{areaId}
</if>
<if test="streetId != null and streetId != ''">
`street_id` = #{streetId}
</if>
<if test="communityId != null and communityId != ''">
`community_id` = #{communityId},
</if>
<if test="address != null and address != ''">
address = #{address},
</if>
<if test="involvingConflictsDisputes != null and involvingConflictsDisputes != ''">
involving_conflicts_disputes = #{involvingConflictsDisputes},
</if>
<if test="riskLevel != null and riskLevel != ''">
risk_level = #{riskLevel},
</if>
<if test="responsibleCompanyByAssistance != null and responsibleCompanyByAssistance != ''">
responsible_company_by_assistance = #{responsibleCompanyByAssistance},
</if>
<if test="responsiblePersonByAssistance != null and responsiblePersonByAssistance != ''">
responsible_person_by_assistance = #{responsiblePersonByAssistance},
</if>
<if test="responsibleCompanyByKeyPersonnel != null and responsibleCompanyByKeyPersonnel != ''">
responsible_company_by_key_personnel = #{responsibleCompanyByKeyPersonnel},
</if>
<if test="responsiblePersonKeyPersonnel != null and responsiblePersonKeyPersonnel != ''">
responsible_person_key_personnel = #{responsiblePersonKeyPersonnel},
</if>
<if test="hazardAssessmentLevel != null and hazardAssessmentLevel != ''">
hazard_assessment_level = #{hazardAssessmentLevel},
</if>
`update_user` = #{updateUser},
`update_date` = NOW()
</set>
where card_no = TO_BASE64(AES_ENCRYPT(#{cardNo},'*#id#')) and sys_type = #{sysType}
</update>
<delete id="deletekeyPersonHighlyByIds" parameterType="map">
DELETE FROM jl_key_person_highly_concerned_rel
WHERE highly_concerned_situation in ('重新犯罪','黑恶','恶性犯罪','邪教','三无人员') and card_no IN
<foreach collection="list" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<!--重点未成年人表-->
<select id="getAllPersons_new" parameterType="map" resultType="com.scpyun.platform.jilinsscgsdp.bean.entity.KeyPersonImp">
SELECT
id, name, sex, folk,
cast(AES_DECRYPT(FROM_BASE64(card_no),'*#id#') as char) as cardNo,
phone,
registered_residence as registeredResidence,
city_id as cityId, area_id as areaId, street_id as streetId, community_id as communityId,
address,
involving_conflicts_disputes as involvingConflictsDisputes,
risk_level as riskLevel,
responsible_company_by_assistance as responsibleCompanyByAssistance,
responsible_person_by_assistance as responsiblePersonByAssistance,
responsible_company_by_key_personnel as responsibleCompanyByKeyPersonnel,
responsible_person_key_personnel as responsiblePersonKeyPersonnel,
hazard_assessment_level as hazardAssessmentLevel
FROM
jl_key_person_minor
WHERE sys_type = #{sysType}
</select>
<insert id="keyPersonInsertBatch_new" parameterType="map">
INSERT INTO jl_key_person_minor(id, sys_type, name, sex, folk, card_no, phone,
registered_residence, city_id, area_id, street_id, community_id, address,
involving_conflicts_disputes, risk_level,
responsible_company_by_assistance,
responsible_person_by_assistance,
responsible_company_by_key_personnel,
responsible_person_key_personnel,
hazard_assessment_level, create_user, region) VALUES
<foreach collection="list" item="person" index="index" separator=",">
(#{person.id}, #{person.sysType}, #{person.name}, #{person.sex}, #{person.folk},
TO_BASE64(AES_ENCRYPT(#{person.cardNo},'*#id#')),
#{person.phone},
#{person.registeredResidence}, #{person.cityId}, #{person.areaId}, #{person.streetId}, #{person.communityId},
#{person.address}, #{person.involvingConflictsDisputes}, #{person.riskLevel},
#{person.responsibleCompanyByAssistance}, #{person.responsiblePersonByAssistance},
#{person.responsibleCompanyByKeyPersonnel}, #{person.responsiblePersonKeyPersonnel},
#{person.hazardAssessmentLevel}, #{person.createUser}, '1')
</foreach>
</insert>
<insert id="keyPersonHighlyInsertBatch_new" parameterType="map">
INSERT INTO jl_key_person_minor_highly_concerned_rel(id,
key_person_id,
card_no,
highly_concerned_situation,
create_date,
update_date,
create_user,
update_user) VALUES
<foreach collection="list" item="obj" index="index" separator=",">
(#{obj.id}, #{obj.keyPersonId}, #{obj.cardNo}, #{obj.highly}, NOW(), NOW(), #{obj.userId}, #{obj.userId})
</foreach>
</insert>
<update id="keyPersonUpdateBatch_new" parameterType="map">
UPDATE jl_key_person_minor
<set>
<if test="name != null and name != ''">
name = #{name},
</if>
<if test="sex != null and sex != ''">
sex = #{sex},
</if>
<if test="folk != null and folk != ''">
folk = #{folk},
</if>
<if test="phone != null and phone != ''">
phone = #{phone},
</if>
<if test="registeredResidence != null and registeredResidence != ''">
registered_residence = #{registeredResidence},
</if>
<if test="cityId != null and cityId != ''">
`city_id` = #{cityId}
</if>
<if test="areaId != null and areaId != ''">
`area_id` = #{areaId}
</if>
<if test="streetId != null and streetId != ''">
`street_id` = #{streetId}
</if>
<if test="communityId != null and communityId != ''">
`community_id` = #{communityId},
</if>
<if test="address != null and address != ''">
address = #{address},
</if>
<if test="involvingConflictsDisputes != null and involvingConflictsDisputes != ''">
involving_conflicts_disputes = #{involvingConflictsDisputes},
</if>
<if test="riskLevel != null and riskLevel != ''">
risk_level = #{riskLevel},
</if>
<if test="responsibleCompanyByAssistance != null and responsibleCompanyByAssistance != ''">
responsible_company_by_assistance = #{responsibleCompanyByAssistance},
</if>
<if test="responsiblePersonByAssistance != null and responsiblePersonByAssistance != ''">
responsible_person_by_assistance = #{responsiblePersonByAssistance},
</if>
<if test="responsibleCompanyByKeyPersonnel != null and responsibleCompanyByKeyPersonnel != ''">
responsible_company_by_key_personnel = #{responsibleCompanyByKeyPersonnel},
</if>
<if test="responsiblePersonKeyPersonnel != null and responsiblePersonKeyPersonnel != ''">
responsible_person_key_personnel = #{responsiblePersonKeyPersonnel},
</if>
<if test="hazardAssessmentLevel != null and hazardAssessmentLevel != ''">
hazard_assessment_level = #{hazardAssessmentLevel},
</if>
`update_user` = #{updateUser},
`update_date` = NOW()
</set>
where card_no = TO_BASE64(AES_ENCRYPT(#{cardNo},'*#id#')) and sys_type = #{sysType}
</update>
<!--<update id="keyPersonUpdateBatch_new" parameterType="map">
<foreach collection="list" item="person" separator=";">
UPDATE jl_key_person_minor
SET `name` = #{person.name}, `sex` = #{person.sex}, `folk` = #{person.folk}, `phone` = #{person.phone},
`registered_residence` = #{person.registeredResidence},
`city_id` = #{person.cityId}, `area_id` = #{person.areaId}, `street_id` = #{person.streetId}, `community_id` = #{person.communityId},
`address` = #{person.address}, `involving_conflicts_disputes` = #{person.involvingConflictsDisputes},
`risk_level` = #{person.riskLevel},
`responsible_company_by_assistance` = #{person.responsibleCompanyByAssistance},
`responsible_person_by_assistance` = #{person.responsiblePersonByAssistance},
`responsible_company_by_key_personnel` = #{person.responsibleCompanyByKeyPersonnel},
`responsible_person_key_personnel` = #{person.responsiblePersonKeyPersonnel},
hazard_assessment_level = #{person.hazardAssessmentLevel},
`update_user` = #{person.updateUser},
`update_date` = NOW()
WHERE `id` = #{person.id}
</foreach>
</update>-->
<delete id="deletekeyPersonHighlyByIds_new" parameterType="map">
DELETE FROM jl_key_person_minor_highly_concerned_rel
WHERE highly_concerned_situation in ('重新犯罪','黑恶','恶性犯罪','邪教','三无人员') and card_no IN
<foreach collection="list" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper> </mapper>
...@@ -41,16 +41,20 @@ ...@@ -41,16 +41,20 @@
and jkprs.is_history = '1' and jkprs.is_history = '1'
<choose> <choose>
<when test="scope_grade == '3'"> <when test="scope_grade == '3'">
AND jkpm.city_id = #{scope_area_id} AND ((jkpm.city_id = #{scope_area_id} and jkpm.city_id not in (select city_id from jl_key_person_rating_dual_person where key_person_id=jkpm.id))
OR exists(select id from jl_key_person_rating_dual_person where city_id = #{_user.company_id} AND key_person_id=jkpm.id))
</when> </when>
<when test="scope_grade == '4'"> <when test="scope_grade == '4'">
AND jkpm.area_id = #{scope_area_id} AND ((jkpm.area_id = #{scope_area_id} and jkpm.area_id not in (select area_id from jl_key_person_rating_dual_person where key_person_id=jkpm.id))
OR exists(select id from jl_key_person_rating_dual_person where area_id = #{_user.company_id} AND key_person_id=jkpm.id))
</when> </when>
<when test="scope_grade == '5'"> <when test="scope_grade == '5'">
AND jkpm.street_id = #{scope_area_id} AND ((jkpm.street_id = #{scope_area_id} and jkpm.street_id not in (select street_id from jl_key_person_rating_dual_person where key_person_id=jkpm.id))
OR exists(select id from jl_key_person_rating_dual_person where street_id = #{_user.company_id} AND key_person_id=jkpm.id))
</when> </when>
<when test="scope_grade == '6'"> <when test="scope_grade == '6'">
AND jkpm.community_id = #{scope_area_id} AND ((jkpm.community_id = #{scope_area_id} and jkpm.community_id not in (select community_id from jl_key_person_rating_dual_person where key_person_id=jkpm.id))
OR exists(select id from jl_key_person_rating_dual_person where community_id = #{_user.company_id} AND key_person_id=jkpm.id))
</when> </when>
</choose> </choose>
</where> </where>
...@@ -94,17 +98,21 @@ ...@@ -94,17 +98,21 @@
<where> <where>
and sys_type = '3' and sys_type = '3'
<choose> <choose>
<when test="scope_grade == '3'"> <when test="scope_grade == '3'.toString()">
AND city_id = #{scope_area_id} AND ((city_id = #{scope_area_id} and city_id not in (select city_id from jl_key_person_rating_dual_person where key_person_id=jl_key_person.id))
OR exists(select id from jl_key_person_rating_dual_person where city_id = #{scope_area_id} AND key_person_id=jl_key_person.id))
</when> </when>
<when test="scope_grade == '4'"> <when test="scope_grade == '4'.toString()">
AND area_id = #{scope_area_id} AND ((area_id = #{scope_area_id} and area_id not in (select area_id from jl_key_person_rating_dual_person where key_person_id=jl_key_person.id))
OR exists(select id from jl_key_person_rating_dual_person where area_id = #{scope_area_id} AND key_person_id=jl_key_person.id))
</when> </when>
<when test="scope_grade == '5'"> <when test="scope_grade == '5'.toString()">
AND street_id = #{scope_area_id} AND ((street_id = #{scope_area_id} and street_id not in (select street_id from jl_key_person_rating_dual_person where key_person_id=jl_key_person.id))
OR exists(select id from jl_key_person_rating_dual_person where street_id = #{scope_area_id} AND key_person_id=jl_key_person.id))
</when> </when>
<when test="scope_grade == '6'"> <when test="scope_grade == '6'.toString()">
AND community_id = #{scope_area_id} AND ((community_id = #{scope_area_id} and community_id not in (select community_id from jl_key_person_rating_dual_person where key_person_id=jl_key_person.id))
OR exists(select id from jl_key_person_rating_dual_person where community_id = #{scope_area_id} AND key_person_id=jl_key_person.id))
</when> </when>
</choose> </choose>
</where> </where>
...@@ -114,17 +122,21 @@ ...@@ -114,17 +122,21 @@
<where> <where>
and sys_type = '6' and sys_type = '6'
<choose> <choose>
<when test="scope_grade == '3'"> <when test="scope_grade == '3'.toString()">
AND city_id = #{scope_area_id} AND ((city_id = #{scope_area_id} and city_id not in (select city_id from jl_key_person_rating_dual_person where key_person_id=jl_key_person_minor.id))
OR exists(select id from jl_key_person_rating_dual_person where city_id = #{scope_area_id} AND key_person_id=jl_key_person_minor.id))
</when> </when>
<when test="scope_grade == '4'"> <when test="scope_grade == '4'.toString()">
AND area_id = #{scope_area_id} AND ((area_id = #{scope_area_id} and area_id not in (select area_id from jl_key_person_rating_dual_person where key_person_id=jl_key_person_minor.id))
OR exists(select id from jl_key_person_rating_dual_person where area_id = #{scope_area_id} AND key_person_id=jl_key_person_minor.id))
</when> </when>
<when test="scope_grade == '5'"> <when test="scope_grade == '5'.toString()">
AND street_id = #{scope_area_id} AND ((street_id = #{scope_area_id} and street_id not in (select street_id from jl_key_person_rating_dual_person where key_person_id=jl_key_person_minor.id))
OR exists(select id from jl_key_person_rating_dual_person where street_id = #{scope_area_id} AND key_person_id=jl_key_person_minor.id))
</when> </when>
<when test="scope_grade == '6'"> <when test="scope_grade == '6'.toString()">
AND community_id = #{scope_area_id} AND ((community_id = #{scope_area_id} and community_id not in (select community_id from jl_key_person_rating_dual_person where key_person_id=jl_key_person_minor.id))
OR exists(select id from jl_key_person_rating_dual_person where community_id = #{scope_area_id} AND key_person_id=jl_key_person_minor.id))
</when> </when>
</choose> </choose>
</where> </where>
...@@ -135,16 +147,20 @@ ...@@ -135,16 +147,20 @@
and sys_type = '2' and sys_type = '2'
<choose> <choose>
<when test="scope_grade == '3'"> <when test="scope_grade == '3'">
AND city_id = #{scope_area_id} AND ((city_id = #{scope_area_id} and city_id not in (select city_id from jl_key_person_rating_dual_person where key_person_id=jl_key_person.id))
OR exists(select id from jl_key_person_rating_dual_person where city_id = #{scope_area_id} AND key_person_id=jl_key_person.id))
</when> </when>
<when test="scope_grade == '4'"> <when test="scope_grade == '4'.toString()">
AND area_id = #{scope_area_id} AND ((area_id = #{scope_area_id} and area_id not in (select area_id from jl_key_person_rating_dual_person where key_person_id=jl_key_person.id))
OR exists(select id from jl_key_person_rating_dual_person where area_id = #{scope_area_id} AND key_person_id=jl_key_person.id))
</when> </when>
<when test="scope_grade == '5'"> <when test="scope_grade == '5'.toString()">
AND street_id = #{scope_area_id} AND ((street_id = #{scope_area_id} and street_id not in (select street_id from jl_key_person_rating_dual_person where key_person_id=jl_key_person.id))
OR exists(select id from jl_key_person_rating_dual_person where street_id = #{scope_area_id} AND key_person_id=jl_key_person.id))
</when> </when>
<when test="scope_grade == '6'"> <when test="scope_grade == '6'.toString()">
AND community_id = #{scope_area_id} AND ((community_id = #{scope_area_id} and community_id not in (select community_id from jl_key_person_rating_dual_person where key_person_id=jl_key_person.id))
OR exists(select id from jl_key_person_rating_dual_person where community_id = #{scope_area_id} AND key_person_id=jl_key_person.id))
</when> </when>
</choose> </choose>
</where> </where>
...@@ -287,28 +303,115 @@ ...@@ -287,28 +303,115 @@
<select id="selectMentalPatientOverdueWarningCount" parameterType="map" resultType="map">
select
coalesce(sum(case when jkpvr.do_status = '0' and jkpvr.is_overdue = '0' then 1 else 0 end), 0) as total_pending,
coalesce(sum(case when jkpvr.do_status = '1' then 1 else 0 end), 0) as total_done,
coalesce(sum(case when jkpvr.do_status = '2' then 1 else 0 end), 0) as total_overdue,
coalesce(sum(case when jkpvr.do_status = '0' and jkpvr.is_overdue = '1' then 1 else 0 end), 0) as total_overdue_pending
from jl_key_person_visit_record jkpvr
left join jl_key_person jkp on jkp.sys_type = '3' and jkp.id = jkpvr.key_person_id
<where>
and jkp.id is not null
<choose>
<when test="scope_grade == '3'">
AND (jkp.city_id = #{scope_area_id} OR exists(select id from jl_key_person_rating_dual_person where city_id = #{_user.company_id} AND key_person_id=jkp.id))
</when>
<when test="scope_grade == '4'">
AND (jkp.area_id = #{scope_area_id} OR exists(select id from jl_key_person_rating_dual_person where area_id = #{_user.company_id} AND key_person_id=jkp.id))
</when>
<when test="scope_grade == '5'">
AND (jkp.street_id = #{scope_area_id} OR exists(select id from jl_key_person_rating_dual_person where street_id = #{_user.company_id} AND key_person_id=jkp.id))
</when>
<when test="scope_grade == '6'">
AND (jkp.community_id = #{scope_area_id} OR exists(select id from jl_key_person_rating_dual_person where community_id = #{_user.company_id} AND key_person_id=jkp.id))
</when>
</choose>
</where>
</select>
<select id="selectMinorsOverdueWarningCount" parameterType="map" resultType="map">
select
coalesce(sum(case when jkpvr.do_status = '0' and jkpvr.is_overdue = '0' then 1 else 0 end), 0) as total_pending,
coalesce(sum(case when jkpvr.do_status = '1' then 1 else 0 end), 0) as total_done,
coalesce(sum(case when jkpvr.do_status = '2' then 1 else 0 end), 0) as total_overdue,
coalesce(sum(case when jkpvr.do_status = '0' and jkpvr.is_overdue = '1' then 1 else 0 end), 0) as total_overdue_pending
from jl_key_person_visit_record jkpvr
left join jl_key_person_minor jkpm on jkpm.sys_type = '6' and jkpm.id = jkpvr.key_person_id
<where>
and jkpm.id is not null
<choose>
<when test="scope_grade == '3'">
AND (jkpm.city_id = #{scope_area_id} OR exists(select id from jl_key_person_rating_dual_person where city_id = #{_user.company_id} AND key_person_id=jkpm.id))
</when>
<when test="scope_grade == '4'">
AND (jkpm.area_id = #{scope_area_id} OR exists(select id from jl_key_person_rating_dual_person where area_id = #{_user.company_id} AND key_person_id=jkpm.id))
</when>
<when test="scope_grade == '5'">
AND (jkpm.street_id = #{scope_area_id} OR exists(select id from jl_key_person_rating_dual_person where street_id = #{_user.company_id} AND key_person_id=jkpm.id))
</when>
<when test="scope_grade == '6'">
AND (jkpm.community_id = #{scope_area_id} OR exists(select id from jl_key_person_rating_dual_person where community_id = #{_user.company_id} AND key_person_id=jkpm.id))
</when>
</choose>
</where>
</select>
<select id="selectReleasedOverdueWarningCount" parameterType="map" resultType="map">
select
coalesce(sum(case when jkpvr.do_status = '0' and jkpvr.is_overdue = '0' then 1 else 0 end), 0) as total_pending,
coalesce(sum(case when jkpvr.do_status = '1' then 1 else 0 end), 0) as total_done,
coalesce(sum(case when jkpvr.do_status = '2' then 1 else 0 end), 0) as total_overdue,
coalesce(sum(case when jkpvr.do_status = '0' and jkpvr.is_overdue = '1' then 1 else 0 end), 0) as total_overdue_pending
from jl_key_person_visit_record jkpvr
left join jl_key_person jkp on jkp.sys_type = '2' and jkp.id = jkpvr.key_person_id
<where>
and jkp.id is not null
<choose>
<when test="scope_grade == '3'">
AND (jkp.city_id = #{scope_area_id} OR exists(select id from jl_key_person_rating_dual_person where city_id = #{_user.company_id} AND key_person_id=jkp.id))
</when>
<when test="scope_grade == '4'">
AND (jkp.area_id = #{scope_area_id} OR exists(select id from jl_key_person_rating_dual_person where area_id = #{_user.company_id} AND key_person_id=jkp.id))
</when>
<when test="scope_grade == '5'">
AND (jkp.street_id = #{scope_area_id} OR exists(select id from jl_key_person_rating_dual_person where street_id = #{_user.company_id} AND key_person_id=jkp.id))
</when>
<when test="scope_grade == '6'">
AND (jkp.community_id = #{scope_area_id} OR exists(select id from jl_key_person_rating_dual_person where community_id = #{_user.company_id} AND key_person_id=jkp.id))
</when>
</choose>
</where>
</select>
<select id="selectMentalPatientRatingCount1" parameterType="map" resultType="map"> <select id="selectMentalPatientRatingCount1" parameterType="map" resultType="map">
select select
coalesce(sum(case when jkprh.do_status = '0' and jkprh.is_overdue = '0' then 1 else 0 end), 0) as total_pending, coalesce(sum(case when jkprh.do_status = '0' and jkprh.is_overdue = '0' then 1 else 0 end), 0) as total_pending,
coalesce(sum(case when jkprh.do_status = '1' then 1 else 0 end), 0) as total_done, coalesce(sum(case when jkprh.do_status in ('1','3') then 1 else 0 end), 0) as total_done,
coalesce(sum(case when jkprh.do_status = '2' then 1 else 0 end), 0) as total_overdue, coalesce(sum(case when jkprh.do_status = '2' then 1 else 0 end), 0) as total_overdue,
coalesce(sum(case when jkprh.do_status = '0' and jkprh.is_overdue = '1' then 1 else 0 end), 0) as total_overdue_pending coalesce(sum(case when jkprh.do_status = '0' and jkprh.is_overdue = '1' then 1 else 0 end), 0) as total_overdue_pending,
coalesce(sum(case when jkprh.do_status = '3' then 1 else 0 end), 0) as total_overdue_done
from jl_key_person_rating_history jkprh from jl_key_person_rating_history jkprh
left join jl_key_person jkp on jkp.sys_type = '3' and jkp.id = jkprh.key_person_id left join jl_key_person jkp on jkp.sys_type = '3' and jkp.id = jkprh.key_person_id
<where> <where>
and jkp.id is not null and jkp.id is not null
<choose> <choose>
<when test="scope_grade == '3'"> <when test="scope_grade == '3'">
AND jkp.city_id = #{scope_area_id} AND ((jkp.city_id = #{scope_area_id} and jkp.city_id not in (select city_id from jl_key_person_rating_dual_person where key_person_id=jkp.id))
OR exists(select id from jl_key_person_rating_dual_person where city_id = #{scope_area_id} AND key_person_id=jkp.id))
</when> </when>
<when test="scope_grade == '4'"> <when test="scope_grade == '4'">
AND jkp.area_id = #{scope_area_id} AND ((jkp.area_id = #{scope_area_id} and jkp.area_id not in (select area_id from jl_key_person_rating_dual_person where key_person_id=jkp.id))
OR exists(select id from jl_key_person_rating_dual_person where area_id = #{scope_area_id} AND key_person_id=jkp.id))
</when> </when>
<when test="scope_grade == '5'"> <when test="scope_grade == '5'">
AND jkp.street_id = #{scope_area_id} AND ((jkp.street_id = #{scope_area_id} and jkp.street_id not in (select street_id from jl_key_person_rating_dual_person where key_person_id=jkp.id))
OR exists(select id from jl_key_person_rating_dual_person where street_id = #{scope_area_id} AND key_person_id=jkp.id))
</when> </when>
<when test="scope_grade == '6'"> <when test="scope_grade == '6'">
AND jkp.community_id = #{scope_area_id} AND ((jkp.community_id = #{scope_area_id} and jkp.community_id not in (select community_id from jl_key_person_rating_dual_person where key_person_id=jkp.id))
OR exists(select id from jl_key_person_rating_dual_person where community_id = #{scope_area_id} AND key_person_id=jkp.id))
</when> </when>
</choose> </choose>
</where> </where>
...@@ -317,25 +420,30 @@ ...@@ -317,25 +420,30 @@
<select id="selectMinorsRatingCount1" parameterType="map" resultType="map"> <select id="selectMinorsRatingCount1" parameterType="map" resultType="map">
select select
coalesce(sum(case when jkprh.do_status = '0' and jkprh.is_overdue = '0' then 1 else 0 end), 0) as total_pending, coalesce(sum(case when jkprh.do_status = '0' and jkprh.is_overdue = '0' then 1 else 0 end), 0) as total_pending,
coalesce(sum(case when jkprh.do_status = '1' then 1 else 0 end), 0) as total_done, coalesce(sum(case when jkprh.do_status in ('1','3') then 1 else 0 end), 0) as total_done,
coalesce(sum(case when jkprh.do_status = '2' then 1 else 0 end), 0) as total_overdue, coalesce(sum(case when jkprh.do_status = '2' then 1 else 0 end), 0) as total_overdue,
coalesce(sum(case when jkprh.do_status = '0' and jkprh.is_overdue = '1' then 1 else 0 end), 0) as total_overdue_pending coalesce(sum(case when jkprh.do_status = '0' and jkprh.is_overdue = '1' then 1 else 0 end), 0) as total_overdue_pending,
coalesce(sum(case when jkprh.do_status = '3' then 1 else 0 end), 0) as total_overdue_done
from jl_key_person_rating_history jkprh from jl_key_person_rating_history jkprh
left join jl_key_person_minor jkpm on jkpm.sys_type = '6' and jkpm.id = jkprh.key_person_id left join jl_key_person_minor jkpm on jkpm.sys_type = '6' and jkpm.id = jkprh.key_person_id
<where> <where>
and jkpm.id is not null and jkpm.id is not null
<choose> <choose>
<when test="scope_grade == '3'"> <when test="scope_grade == '3'">
AND jkpm.city_id = #{scope_area_id} AND ((jkpm.city_id = #{scope_area_id} and jkpm.city_id not in (select city_id from jl_key_person_rating_dual_person where key_person_id=jkpm.id))
OR exists(select id from jl_key_person_rating_dual_person where city_id = #{scope_area_id} AND key_person_id=jkpm.id))
</when> </when>
<when test="scope_grade == '4'"> <when test="scope_grade == '4'">
AND jkpm.area_id = #{scope_area_id} AND (jkpm.area_id = #{scope_area_id} and jkpm.area_id not in (select area_id from jl_key_person_rating_dual_person where key_person_id=jkpm.id))
OR exists(select id from jl_key_person_rating_dual_person where area_id = #{scope_area_id} AND key_person_id=jkpm.id))
</when> </when>
<when test="scope_grade == '5'"> <when test="scope_grade == '5'">
AND jkpm.street_id = #{scope_area_id} AND (jkpm.street_id = #{scope_area_id} and jkpm.street_id not in (select street_id from jl_key_person_rating_dual_person where key_person_id=jkpm.id))
OR exists(select id from jl_key_person_rating_dual_person where street_id = #{scope_area_id} AND key_person_id=jkpm.id))
</when> </when>
<when test="scope_grade == '6'"> <when test="scope_grade == '6'">
AND jkpm.community_id = #{scope_area_id} AND (jkpm.community_id = #{scope_area_id} and jkpm.community_id not in (select community_id from jl_key_person_rating_dual_person where key_person_id=jkpm.id))
OR exists(select id from jl_key_person_rating_dual_person where community_id = #{scope_area_id} AND key_person_id=jkpm.id))
</when> </when>
</choose> </choose>
</where> </where>
...@@ -344,25 +452,30 @@ ...@@ -344,25 +452,30 @@
<select id="selectReleasedRatingCount1" parameterType="map" resultType="map"> <select id="selectReleasedRatingCount1" parameterType="map" resultType="map">
select select
coalesce(sum(case when jkprh.do_status = '0' and jkprh.is_overdue = '0' then 1 else 0 end), 0) as total_pending, coalesce(sum(case when jkprh.do_status = '0' and jkprh.is_overdue = '0' then 1 else 0 end), 0) as total_pending,
coalesce(sum(case when jkprh.do_status = '1' then 1 else 0 end), 0) as total_done, coalesce(sum(case when jkprh.do_status in ('1','3') then 1 else 0 end), 0) as total_done,
coalesce(sum(case when jkprh.do_status = '2' then 1 else 0 end), 0) as total_overdue, coalesce(sum(case when jkprh.do_status = '2' then 1 else 0 end), 0) as total_overdue,
coalesce(sum(case when jkprh.do_status = '0' and jkprh.is_overdue = '1' then 1 else 0 end), 0) as total_overdue_pending coalesce(sum(case when jkprh.do_status = '0' and jkprh.is_overdue = '1' then 1 else 0 end), 0) as total_overdue_pending,
coalesce(sum(case when jkprh.do_status = '3' then 1 else 0 end), 0) as total_overdue_done
from jl_key_person_rating_history jkprh from jl_key_person_rating_history jkprh
left join jl_key_person jkp on jkp.sys_type = '2' and jkp.id = jkprh.key_person_id left join jl_key_person jkp on jkp.sys_type = '2' and jkp.id = jkprh.key_person_id
<where> <where>
and jkp.id is not null and jkp.id is not null
<choose> <choose>
<when test="scope_grade == '3'"> <when test="scope_grade == '3'">
AND jkp.city_id = #{scope_area_id} AND ((jkp.city_id = #{scope_area_id} and jkp.city_id not in (select city_id from jl_key_person_rating_dual_person where key_person_id=jkp.id))
OR exists(select id from jl_key_person_rating_dual_person where city_id = #{scope_area_id} AND key_person_id=jkp.id))
</when> </when>
<when test="scope_grade == '4'"> <when test="scope_grade == '4'">
AND jkp.area_id = #{scope_area_id} AND ((jkp.area_id = #{scope_area_id} and jkp.area_id not in (select area_id from jl_key_person_rating_dual_person where key_person_id=jkp.id))
OR exists(select id from jl_key_person_rating_dual_person where area_id = #{scope_area_id} AND key_person_id=jkp.id))
</when> </when>
<when test="scope_grade == '5'"> <when test="scope_grade == '5'">
AND jkp.street_id = #{scope_area_id} AND ((jkp.street_id = #{scope_area_id} and jkp.street_id not in (select street_id from jl_key_person_rating_dual_person where key_person_id=jkp.id))
OR exists(select id from jl_key_person_rating_dual_person where street_id = #{scope_area_id} AND key_person_id=jkp.id))
</when> </when>
<when test="scope_grade == '6'"> <when test="scope_grade == '6'">
AND jkp.community_id = #{scope_area_id} AND ((jkp.community_id = #{scope_area_id} and jkp.community_id not in (select community_id from jl_key_person_rating_dual_person where key_person_id=jkp.id))
OR exists(select id from jl_key_person_rating_dual_person where community_id = #{scope_area_id} AND key_person_id=jkp.id))
</when> </when>
</choose> </choose>
</where> </where>
......
...@@ -277,7 +277,7 @@ ...@@ -277,7 +277,7 @@
select a.* select a.*
from (select jl_key_person.id as id, from (select jl_key_person.id as id,
jl_key_person.name as name, jl_key_person.name as name,
sys_type as sysType, jl_key_person.sys_type as sysType,
cast(AES_DECRYPT(FROM_BASE64(card_no),'*#id#') as char) cardNo, cast(AES_DECRYPT(FROM_BASE64(card_no),'*#id#') as char) cardNo,
registered_residence as registeredResidence, registered_residence as registeredResidence,
phone, phone,
...@@ -294,11 +294,11 @@ ...@@ -294,11 +294,11 @@
letters_visits_type lettersVisitsType, letters_visits_type lettersVisitsType,
folk, folk,
involving_conflicts_disputes as involvingConflictsDisputes, involving_conflicts_disputes as involvingConflictsDisputes,
region as region, jl_key_person.region as region,
city_id as cityId, jl_key_person.city_id as cityId,
area_id as areaId, jl_key_person.area_id as areaId,
street_id as streetId, jl_key_person.street_id as streetId,
community_id as communityId, jl_key_person.community_id as communityId,
community.name communityName, community.name communityName,
jl_key_person.remarks as remarks, jl_key_person.remarks as remarks,
hazard_assessment_level as hazardAssessmentLevel, hazard_assessment_level as hazardAssessmentLevel,
...@@ -340,7 +340,45 @@ ...@@ -340,7 +340,45 @@
WHEN DATEDIFF(history.plan_end_data, CURDATE()) &lt; 0 THEN 0 WHEN DATEDIFF(history.plan_end_data, CURDATE()) &lt; 0 THEN 0
ELSE DATEDIFF(history.plan_end_data, CURDATE()) ELSE DATEDIFF(history.plan_end_data, CURDATE())
END AS remainDays, END AS remainDays,
history.is_overdue as isOverdue history.is_overdue as isOverdue,
<choose>
<when test="params._scope.scope_grade == '3'.toString()">
case when jl_key_person_rating_dual_person.id is not null and jl_key_person.city_id = #{params._scope.scope_area_id}
and jl_key_person.city_id != jl_key_person_rating_dual_person.city_id then '1' else '0' end as dualPersonBelong,
</when>
<when test="params._scope.scope_grade == '4'.toString()">
case when jl_key_person_rating_dual_person.id is not null and jl_key_person.area_id = #{params._scope.scope_area_id}
and jl_key_person.area_id != jl_key_person_rating_dual_person.area_id then '1' else '0' end as dualPersonBelong,
</when>
<when test="params._scope.scope_grade == '5'.toString()">
case when jl_key_person_rating_dual_person.id is not null and jl_key_person.street_id = #{params._scope.scope_area_id}
and jl_key_person.street_id != jl_key_person_rating_dual_person.street_id then '1' else '0' end as dualPersonBelong,
</when>
<when test="params._scope.scope_grade == '6'.toString()">
case when jl_key_person_rating_dual_person.id is not null and jl_key_person.community_id = #{params._scope.scope_area_id}
and jl_key_person.community_id != jl_key_person_rating_dual_person.community_id then '1' else '0' end as dualPersonBelong,
</when>
<otherwise>
'0' as dualPersonBelong,
</otherwise>
</choose>
<choose>
<when test="params._scope.scope_grade == '3'.toString()">
case when jl_key_person_rating_dual_person.city_id = #{params._scope.scope_area_id} then '1' else '0' end as dualPerson
</when>
<when test="params._scope.scope_grade == '4'.toString()">
case when jl_key_person_rating_dual_person.area_id = #{params._scope.scope_area_id} then '1' else '0' end as dualPerson
</when>
<when test="params._scope.scope_grade == '5'.toString()">
case when jl_key_person_rating_dual_person.street_id = #{params._scope.scope_area_id} then '1' else '0' end as dualPerson
</when>
<when test="params._scope.scope_grade == '6'.toString()">
case when jl_key_person_rating_dual_person.community_id = #{params._scope.scope_area_id} then '1' else '0' end as dualPerson
</when>
<otherwise>
'0' as dualPerson
</otherwise>
</choose>
from jl_key_person from jl_key_person
left join sys_area city on jl_key_person.city_id = city.code left join sys_area city on jl_key_person.city_id = city.code
left join sys_area area on jl_key_person.area_id = area.code left join sys_area area on jl_key_person.area_id = area.code
...@@ -349,6 +387,7 @@ ...@@ -349,6 +387,7 @@
left join jl_key_person_rating_history history on jl_key_person.id = history.key_person_id and history.rating_dict_type = #{params.sysType} and history.is_history = '1' left join jl_key_person_rating_history history on jl_key_person.id = history.key_person_id and history.rating_dict_type = #{params.sysType} and history.is_history = '1'
left join jl_key_person_rating_summary summary on jl_key_person.id = summary.key_person_id and summary.rating_dict_type = #{params.sysType} and summary.is_history = '1' left join jl_key_person_rating_summary summary on jl_key_person.id = summary.key_person_id and summary.rating_dict_type = #{params.sysType} and summary.is_history = '1'
left join sys_dict rating_dict on rating_dict.type = 'rating_level' and rating_dict.del_flag = '0' and rating_dict.value = summary.rating_type left join sys_dict rating_dict on rating_dict.type = 'rating_level' and rating_dict.del_flag = '0' and rating_dict.value = summary.rating_type
left join jl_key_person_rating_dual_person on jl_key_person.id = jl_key_person_rating_dual_person.key_person_id
<where> 1=1 <where> 1=1
<if test="params.involvingConflictsDisputes != null and params.involvingConflictsDisputes != ''"> <if test="params.involvingConflictsDisputes != null and params.involvingConflictsDisputes != ''">
and involving_conflicts_disputes like concat('%',#{params.involvingConflictsDisputes},'%') and involving_conflicts_disputes like concat('%',#{params.involvingConflictsDisputes},'%')
...@@ -374,7 +413,7 @@ ...@@ -374,7 +413,7 @@
and jl_key_person.name like concat('%',#{params.name},'%') and jl_key_person.name like concat('%',#{params.name},'%')
</if> </if>
<if test="params.sysType != null and params.sysType != ''"> <if test="params.sysType != null and params.sysType != ''">
and sys_type = #{params.sysType} and jl_key_person.sys_type = #{params.sysType}
</if> </if>
<if test="params.cardNo != null and params.cardNo != ''"> <if test="params.cardNo != null and params.cardNo != ''">
<!--and card_no like concat('%',#{params.cardNo},'%')--> <!--and card_no like concat('%',#{params.cardNo},'%')-->
...@@ -508,16 +547,20 @@ ...@@ -508,16 +547,20 @@
<!-- 数据范围 --> <!-- 数据范围 -->
<choose> <choose>
<when test="params._scope.scope_grade == '3'.toString()"> <when test="params._scope.scope_grade == '3'.toString()">
AND jl_key_person.city_id = #{params._scope.scope_area_id} AND (jl_key_person.city_id = #{params._scope.scope_area_id}
OR exists(select id from jl_key_person_rating_dual_person where city_id = #{params._scope.scope_area_id} AND key_person_id=jl_key_person.id))
</when> </when>
<when test="params._scope.scope_grade == '4'.toString()"> <when test="params._scope.scope_grade == '4'.toString()">
AND jl_key_person.area_id = #{params._scope.scope_area_id} AND (jl_key_person.area_id = #{params._scope.scope_area_id}
OR exists(select id from jl_key_person_rating_dual_person where area_id = #{params._scope.scope_area_id} AND key_person_id=jl_key_person.id))
</when> </when>
<when test="params._scope.scope_grade == '5'.toString()"> <when test="params._scope.scope_grade == '5'.toString()">
AND jl_key_person.street_id = #{params._scope.scope_area_id} AND (jl_key_person.street_id = #{params._scope.scope_area_id}
OR exists(select id from jl_key_person_rating_dual_person where street_id = #{params._scope.scope_area_id} AND key_person_id=jl_key_person.id))
</when> </when>
<when test="params._scope.scope_grade == '6'.toString()"> <when test="params._scope.scope_grade == '6'.toString()">
AND jl_key_person.community_id = #{params._scope.scope_area_id} AND (jl_key_person.community_id = #{params._scope.scope_area_id}
OR exists(select id from jl_key_person_rating_dual_person where community_id = #{params._scope.scope_area_id} AND key_person_id=jl_key_person.id))
</when> </when>
</choose> </choose>
</if> </if>
...@@ -530,6 +573,9 @@ ...@@ -530,6 +573,9 @@
select id from sys_office where parent_ids LIKE CONCAT('%', #{params._user.company_id}, '%') and del_flag='0' select id from sys_office where parent_ids LIKE CONCAT('%', #{params._user.company_id}, '%') and del_flag='0'
) and del_flag='0' ) and del_flag='0'
) )
or jl_key_person.id in (select key_person_id from jl_key_person_rating_dual_person
where city_id = #{params._scope.scope_area_id} or area_id = #{params._scope.scope_area_id}
or street_id = #{params._scope.scope_area_id} or community_id = #{params._scope.scope_area_id})
) )
</if> </if>
</if> </if>
...@@ -2314,4 +2360,228 @@ ...@@ -2314,4 +2360,228 @@
AND sc.type = '1' AND sc.type = '1'
AND su.no = #{no} AND su.no = #{no}
</select> </select>
<!-- 长春独立统计 -->
<select id="keyPersonStatisticsForTypeAll_changchun" parameterType="com.scpyun.platform.jilinsscgsdp.bean.entity.KeyPerson"
resultType="com.scpyun.platform.jilinsscgsdp.bean.entity.KeyPerson">
select count(distinct card_no) as count
from
jl_key_person
<where>
<if test="_user.company_grade == '3'.toString()">
AND ((city_id = #{scoptAreaId} and city_id not in (select city_id from jl_key_person_rating_dual_person where key_person_id=jl_key_person.id))
OR exists(select id from jl_key_person_rating_dual_person where city_id = #{scopeAreaId} AND key_person_id=jl_key_person.id))
</if>
<if test="_user.company_grade == '4'.toString()">
AND ((area_id = #{scopeAreaId} and area_id not in (select area_id from jl_key_person_rating_dual_person where key_person_id=jl_key_person.id))
OR exists(select id from jl_key_person_rating_dual_person where area_id = #{scopeAreaId} AND key_person_id=jl_key_person.id))
</if>
<if test="_user.company_grade == '5'.toString()">
AND ((street_id = #{scopeAreaId} and street_id not in (select street_id from jl_key_person_rating_dual_person where key_person_id=jl_key_person.id))
OR exists(select id from jl_key_person_rating_dual_person where street_id = #{scopeAreaId} AND key_person_id=jl_key_person.id))
</if>
<if test="_user.company_grade == '6'.toString()">
AND ((community_id = #{scopeAreaId} and community_id not in (select community_id from jl_key_person_rating_dual_person where key_person_id=jl_key_person.id))
OR exists(select id from jl_key_person_rating_dual_person where community_id = #{scopeAreaId} AND key_person_id=jl_key_person.id))
</if>
</where>
</select>
<select id="findKeyPersonStatisticsForType_changchun" parameterType="com.scpyun.platform.jilinsscgsdp.bean.entity.KeyPerson"
resultType="com.scpyun.platform.jilinsscgsdp.bean.entity.KeyPerson">
select
count(distinct card_no) as count,
sys_type as sysType
from
jl_key_person
<where>
<if test="_user.company_grade == '3'.toString()">
AND ((city_id = #{scopeAreaId} and city_id not in (select city_id from jl_key_person_rating_dual_person where key_person_id=jl_key_person.id))
OR exists(select id from jl_key_person_rating_dual_person where city_id = #{scopeAreaId} AND key_person_id=jl_key_person.id))
</if>
<if test="_user.company_grade == '4'.toString()">
AND ((area_id = #{scopeAreaId} and area_id not in (select area_id from jl_key_person_rating_dual_person where key_person_id=jl_key_person.id))
OR exists(select id from jl_key_person_rating_dual_person where area_id = #{scopeAreaId} AND key_person_id=jl_key_person.id))
</if>
<if test="_user.company_grade == '5'.toString()">
AND ((street_id = #{scopeAreaId} and street_id not in (select street_id from jl_key_person_rating_dual_person where key_person_id=jl_key_person.id))
OR exists(select id from jl_key_person_rating_dual_person where street_id = #{scopeAreaId} AND key_person_id=jl_key_person.id))
</if>
<if test="_user.company_grade == '6'.toString()">
AND ((community_id = #{scopeAreaId} and community_id not in (select community_id from jl_key_person_rating_dual_person where key_person_id=jl_key_person.id))
OR exists(select id from jl_key_person_rating_dual_person where community_id = #{scopeAreaId} AND key_person_id=jl_key_person.id))
</if>
</where>
group by
sys_type
</select>
<select id="keyPersonStatisticsForRiskLevel_changchun"
parameterType="com.scpyun.platform.jilinsscgsdp.bean.entity.KeyPerson"
resultType="com.scpyun.platform.jilinsscgsdp.bean.entity.KeyPerson">
select risk_level as riskLevel, count(card_no) as count
from (select distinct card_no, risk_level
from jl_key_person
<where>
<if test="_user.company_grade == '3'.toString()">
AND ((jl_key_person.create_user in (
select id from sys_user where company_id in (
select id from sys_office where ( parent_ids LIKE CONCAT('%', #{scopeAreaId}, '%') OR id = #{scopeAreaId} )and del_flag='0'
) and del_flag='0'
) and city_id not in (select city_id from jl_key_person_rating_dual_person where key_person_id=jl_key_person.id))
OR exists(select id from jl_key_person_rating_dual_person where city_id = #{scopeAreaId} AND key_person_id=jl_key_person.id))
</if>
<if test="_user.company_grade == '4'.toString()">
AND ((jl_key_person.create_user in (
select id from sys_user where company_id in (
select id from sys_office where ( parent_ids LIKE CONCAT('%', #{scopeAreaId}, '%') OR id = #{scopeAreaId} ) and del_flag='0'
) and del_flag='0'
) and area_id not in (select city_id from jl_key_person_rating_dual_person where key_person_id=jl_key_person.id))
OR exists(select id from jl_key_person_rating_dual_person where area_id = #{scopeAreaId} AND key_person_id=jl_key_person.id))
</if>
<if test="_user.company_grade == '5'.toString()">
AND (jl_key_person.create_user in (
select id from sys_user where company_id in (
select id from sys_office where ( parent_ids LIKE CONCAT('%', #{scopeAreaId}, '%') OR id = #{scopeAreaId} ) and del_flag='0'
) and del_flag='0'
) and street_id not in (select city_id from jl_key_person_rating_dual_person where key_person_id=jl_key_person.id))
OR exists(select id from jl_key_person_rating_dual_person where street_id = #{scopeAreaId} AND key_person_id=jl_key_person.id))
</if>
<if test="_user.company_grade == '6'.toString()">
AND (((select company_id from sys_user where id = create_user) = #{scopeAreaId}
and community_id not in (select city_id from jl_key_person_rating_dual_person where key_person_id=jl_key_person.id))
OR exists(select id from jl_key_person_rating_dual_person where community_id = #{scopeAreaId} AND key_person_id=jl_key_person.id))
</if>
</where>
) a
group by risk_level
</select>
<select id="findKeyPersonStatistics_changchun" resultType="com.scpyun.platform.jilinsscgsdp.bean.entity.KeyPerson">
select count(a.card_no) as count, sys_type
from (select distinct rel.card_no, sys_type
from jl_key_person_highly_concerned_rel rel
left join jl_key_person jkp on jkp.id = rel.key_person_id
<where>
<if test="_user.company_grade == '3'.toString()">
AND ((jkp.create_user in (
select id from sys_user where company_id in (
select id from sys_office where ( parent_ids LIKE CONCAT('%', #{scopeAreaId}, '%') OR id = #{scopeAreaId} ) and del_flag='0'
) and del_flag='0'
)
and city_id not in (select city_id from jl_key_person_rating_dual_person where key_person_id=jkp.id))
OR exists(select id from jl_key_person_rating_dual_person where city_id = #{scopeAreaId} AND key_person_id=jkp.id))
</if>
<if test="_user.company_grade == '4'.toString()">
AND ((jkp.create_user in (
select id from sys_user where company_id in (
select id from sys_office where ( parent_ids LIKE CONCAT('%', #{scopeAreaId}, '%') OR id = #{scopeAreaId} ) and del_flag='0'
) and del_flag='0'
)
and area_id not in (select city_id from jl_key_person_rating_dual_person where key_person_id=jkp.id))
OR exists(select id from jl_key_person_rating_dual_person where area_id = #{scopeAreaId} AND key_person_id=jkp.id))
</if>
<if test="_user.company_grade == '5'.toString()">
AND ((jkp.create_user in (
select id from sys_user where company_id in (
select id from sys_office where ( parent_ids LIKE CONCAT('%', #{scopeAreaId}, '%') OR id = #{scopeAreaId} ) and del_flag='0'
) and del_flag='0'
)
and street_id not in (select city_id from jl_key_person_rating_dual_person where key_person_id=jkp.id))
OR exists(select id from jl_key_person_rating_dual_person where street_id = #{scopeAreaId} AND key_person_id=jkp.id))
</if>
<if test="_user.company_grade == '6'.toString()">
AND (((select company_id from sys_user where id = jkp.create_user) = #{scopeAreaId}
and community_id not in (select city_id from jl_key_person_rating_dual_person where key_person_id=jkp.id))
OR exists(select id from jl_key_person_rating_dual_person where community_id = #{scopeAreaId} AND key_person_id=jkp.id))
</if>
</where>
) a
group by a.sys_type
</select>
<select id="keyPersonStatisticsForCity_changchun"
parameterType="com.scpyun.platform.jilinsscgsdp.bean.entity.KeyPerson"
resultType="com.scpyun.platform.jilinsscgsdp.bean.entity.KeyPerson">
select if(sys_office.grade = '3',uc_gov_region_info.region_name,uc_gov_region_info.county) as cityName, count(distinct card_no) as count
from jl_key_person
left join sys_user on jl_key_person.create_user = sys_user.id
left join sys_office on sys_office.id = sys_user.company_id
left join sys_area on sys_office.area_id = sys_area.id
left join uc_gov_region_info on uc_gov_region_info.region_code = sys_area.id
where (sysscopeAreaId in (SELECT area_id FROM sys_office where find_in_set(#{scopeAreaId},parent_ids))
OR exists(select id from jl_key_person_rating_dual_person where city_id = #{scopeAreaId} AND key_person_id=jl_key_person.id))
<if test="sysType != null and sysType != ''">
and jl_key_person.sys_type = #{sysType}
</if>
group by uc_gov_region_info.county order by uc_gov_region_info.region_req
</select>
<select id="keyPersonStatisticsForArea_changchun"
parameterType="com.scpyun.platform.jilinsscgsdp.bean.entity.KeyPerson"
resultType="com.scpyun.platform.jilinsscgsdp.bean.entity.KeyPerson">
select if(sys_office.grade = '4',uc_gov_region_info.region_name,uc_gov_region_info.town) as cityName, count(distinct card_no) as count
from jl_key_person
left join sys_user on jl_key_person.create_user = sys_user.id
left join sys_office on sys_office.id = sys_user.company_id
left join sys_area on sys_office.area_id = sys_area.id
left join uc_gov_region_info on uc_gov_region_info.region_code = sys_area.id
where (sys_user.company_id in (SELECT area_id FROM sys_office where find_in_set(#{scopeAreaId},parent_ids))
OR exists(select id from jl_key_person_rating_dual_person where area_id = #{scopeAreaId} AND key_person_id=jl_key_person.id))
<if test="sysType != null and sysType != ''">
and jl_key_person.sys_type = #{sysType}
</if>
group by uc_gov_region_info.town order by uc_gov_region_info.region_req
</select>
<select id="keyPersonStatisticsForStreet_changchun"
parameterType="com.scpyun.platform.jilinsscgsdp.bean.entity.KeyPerson"
resultType="com.scpyun.platform.jilinsscgsdp.bean.entity.KeyPerson">
select if(sys_office.grade = '5',uc_gov_region_info.region_name,uc_gov_region_info.village) as cityName, count(distinct card_no) as count
from jl_key_person
left join sys_user on jl_key_person.create_user = sys_user.id
left join sys_office on sys_office.id = sys_user.company_id
left join sys_area on sys_office.area_id = sys_area.id
left join uc_gov_region_info on uc_gov_region_info.region_code = sys_area.id
where (sys_user.company_id in (SELECT area_id FROM sys_office where find_in_set(#{scopeAreaId},parent_ids))
OR exists(select id from jl_key_person_rating_dual_person where street_id = #{scopeAreaId} AND key_person_id=jl_key_person.id))
<if test="sysType != null and sysType != ''">
and jl_key_person.sys_type = #{sysType}
</if>
group by uc_gov_region_info.village order by uc_gov_region_info.region_req
</select>
<select id="keyPersonStatisticsForCommunity_changchun"
parameterType="com.scpyun.platform.jilinsscgsdp.bean.entity.KeyPerson"
resultType="com.scpyun.platform.jilinsscgsdp.bean.entity.KeyPerson">
select if(sys_office.grade = '6',uc_gov_region_info.region_name,uc_gov_region_info.village) as cityName, count(distinct card_no) as count
from jl_key_person
left join sys_user on jl_key_person.create_user = sys_user.id
left join sys_office on sys_office.id = sys_user.company_id
left join sys_area on sys_office.area_id = sys_area.id
left join uc_gov_region_info on uc_gov_region_info.region_code = sys_area.id
where (sys_user.company_id = #{scopeAreaId}
OR exists(select id from jl_key_person_rating_dual_person where community_id = #{scopeAreaId} AND key_person_id=jl_key_person.id))
<if test="sysType != null and sysType != ''">
and jl_key_person.sys_type = #{sysType}
</if>
group by uc_gov_region_info.village order by uc_gov_region_info.region_req
</select>
<select id="keyPersonStatisticsForProvince_changchun"
parameterType="com.scpyun.platform.jilinsscgsdp.bean.entity.KeyPerson"
resultType="com.scpyun.platform.jilinsscgsdp.bean.entity.KeyPerson">
select sys_area.name as cityName, count(distinct card_no) as count
from jl_key_person
left join sys_area on jl_key_person.city_id = sys_area.id
WHERE
city_id is not null AND city_id != ''
<!-- group by jl_key_person.city_id order by jl_key_person.city_id-->
<where>
<if test="sysType != null and sysType != ''">
and sys_type = #{sysType}
</if>
</where>
group by jl_key_person.city_id order by jl_key_person.city_id
</select>
</mapper> </mapper>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论