Browse Source

取消数据权限,格式化代码

feature/yujt_vim
zhangyuan 4 years ago
parent
commit
8a9cfd7034
  1. 4
      epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/epidemic/service/impl/EpidemicReportUserInfoServiceImpl.java
  2. 8
      epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/epidemic/service/impl/EpidemicUserInfoServiceImpl.java
  3. 1
      epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/vim/excel/VaccinationInfoAllExcel.java
  4. 81
      epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/vim/service/impl/VaccinationInfoServiceImpl.java
  5. 2
      epdc-cloud-vim-yushan/src/main/resources/mapper/vim/VaccinationErrorDao.xml

4
epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/epidemic/service/impl/EpidemicReportUserInfoServiceImpl.java

@ -70,7 +70,7 @@ public class EpidemicReportUserInfoServiceImpl extends CrudServiceImpl<EpidemicR
@Override
public PageData<EpidemicReportUserInfoDTO> page(Map<String, Object> params) {
params.put("deptIdList", SecurityUser.getUser().getDeptIdList());
// params.put("deptIdList", SecurityUser.getUser().getDeptIdList());
IPage<EpidemicReportUserInfoDTO> page = getPage(params);
List<EpidemicReportUserInfoDTO> list = baseDao.getEpidemicUserInfoList(params);
for (EpidemicReportUserInfoDTO eru : list) {
@ -184,7 +184,7 @@ public class EpidemicReportUserInfoServiceImpl extends CrudServiceImpl<EpidemicR
@Override
public List<EpidemicReportUserInfoDTO> list(Map<String, Object> params) {
params.put("deptIdList", SecurityUser.getUser().getDeptIdList());
// params.put("deptIdList", SecurityUser.getUser().getDeptIdList());
List<EpidemicReportUserInfoDTO> list = baseDao.getEpidemicUserInfoList(params);
for (EpidemicReportUserInfoDTO eru : list) {
eru.setIdCard(idEncrypt(eru.getIdCard()));

8
epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/epidemic/service/impl/EpidemicUserInfoServiceImpl.java

@ -101,9 +101,9 @@ public class EpidemicUserInfoServiceImpl extends CrudServiceImpl<EpidemicUserInf
Long countryId = new Long(370124001);
//榆山街道账号可以看所有数据
if (!countryId.equals(SecurityUser.getUser().getDeptId())) {
params.put("deptIdList", SecurityUser.getUser().getDeptIdList());
}
// if (!countryId.equals(SecurityUser.getUser().getDeptId())) {
// params.put("deptIdList", SecurityUser.getUser().getDeptIdList());
// }
IPage<EpidemicRecordListDTO> page = getPage(params);
List<EpidemicRecordListDTO> list = baseDao.getEpidemicUserRecordList(params);
for (EpidemicRecordListDTO eru : list) {
@ -453,7 +453,7 @@ public class EpidemicUserInfoServiceImpl extends CrudServiceImpl<EpidemicUserInf
@Override
public List<EpidemicRecordListDTO> getList(Map<String, Object> params) {
params.put("deptIdList", SecurityUser.getUser().getDeptIdList());
// params.put("deptIdList", SecurityUser.getUser().getDeptIdList());
params.put("age",new ArrayList<>());
params.put("company",new ArrayList<>());
// for (EpidemicRecordListDTO eru : list) {

1
epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/vim/excel/VaccinationInfoAllExcel.java

@ -24,7 +24,6 @@ public class VaccinationInfoAllExcel {
private String county;
@Excel(name = "接种人街道/乡镇")
private String street;
@Excel(name = "接种人街道/乡镇ID")
private String streetId;
@Excel(name = "接种人社区/村")
private String community;

81
epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/vim/service/impl/VaccinationInfoServiceImpl.java

@ -4,6 +4,7 @@ import cn.afterturn.easypoi.excel.ExcelImportUtil;
import cn.afterturn.easypoi.excel.entity.ImportParams;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.elink.esua.epdc.commons.tools.constant.NumConstant;
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils;
import com.elink.esua.epdc.commons.tools.utils.FileUtils;
import com.elink.esua.epdc.commons.tools.utils.Result;
@ -159,11 +160,11 @@ public class VaccinationInfoServiceImpl extends BaseVimCurdServiceImpl<Vaccinati
public Result importManualScoreExcel(MultipartFile file) {
log.info("进入Excel数据导入");
File f = StreamUtils.conversionFile(file);
String checkInfo = "";
StringBuilder checkInfo = new StringBuilder();
try {
//判断上传文件类型
String originalFilename = file.getOriginalFilename();
if (!originalFilename.endsWith(StrConstant.EXCEL_SUFFIX_2003) && !originalFilename.endsWith(StrConstant.EXCEL_SUFFIX_2007)) {
if (originalFilename != null && !originalFilename.endsWith(StrConstant.EXCEL_SUFFIX_2003) && !originalFilename.endsWith(StrConstant.EXCEL_SUFFIX_2007)) {
return new Result().error("请选择.xls或者.xlsx格式文件");
}
// 判断导入文件是否为空
@ -182,7 +183,6 @@ public class VaccinationInfoServiceImpl extends BaseVimCurdServiceImpl<Vaccinati
Map<String, EpidemicUserInfoDTO> maxDoseMap = new HashMap<>();
log.info("准备进入Excel数据导入循环");
// List<VaccineDto> vaccineList = vaccineTypeService.vaccineList();
List<VaccineDto> companyList = vaccineCompanyService.compantyList();
List<VaccineDto> siteList = vaccinationSiteService.getSiteList();
List<EpidemicUserInfoEntity> allUserList = epidemicUserInfoDao.selectAllUserInfo();
@ -197,7 +197,7 @@ public class VaccinationInfoServiceImpl extends BaseVimCurdServiceImpl<Vaccinati
vaccinationInfoDTO = ConvertUtils.sourceToTarget(epidemicReportUserInfoAllExcel, VaccinationInfoDTO.class);
// 校验是否存在空单元格(校验必填)
if (checkNullCell(epidemicReportUserInfoAllExcel)) {
checkInfo += "第" + (i + 1) + "条、";
checkInfo.append("第").append(i + 1).append("条、");
epidemicReportUserInfoAllExcel.setErrorInfo("存在空单元格");
addErrorList.add(epidemicReportUserInfoAllExcel);
continue;
@ -207,7 +207,7 @@ public class VaccinationInfoServiceImpl extends BaseVimCurdServiceImpl<Vaccinati
// 人员校验
if (!allUserIdCards.contains(idCard)) {
checkInfo += "第" + (i + 1) + "条、";
checkInfo.append("第").append(i + 1).append("条、");
epidemicReportUserInfoAllExcel.setErrorInfo("查无此人");
addErrorList.add(epidemicReportUserInfoAllExcel);
continue;
@ -215,31 +215,12 @@ public class VaccinationInfoServiceImpl extends BaseVimCurdServiceImpl<Vaccinati
// 校验身份证号是否合法
if (StringUtils.isBlank(idCard) || idCard.length() != 18) {
checkInfo += "第" + (i + 1) + "条、";
checkInfo.append("第").append(i + 1).append("条、");
epidemicReportUserInfoAllExcel.setErrorInfo("身份证号不合法");
addErrorList.add(epidemicReportUserInfoAllExcel);
continue;
}
// // 校验疫苗类型
// String vaccineName = epidemicReportUserInfoAllExcel.getVaccineName();
// if (StringUtils.isNotBlank(vaccineName)) {
// List<VaccineDto> vaccine = vaccineList.stream().filter(item -> vaccineName.equals(item.getLabel())).collect(Collectors.toList());
// if (!vaccine.isEmpty()) {
// epidemicReportUserInfoAllExcel.setVaccineId(vaccine.get(0).getValue());
// } else {
// checkInfo += "第" + (i + 1) + "条、";
// epidemicReportUserInfoAllExcel.setErrorInfo("不存在的疫苗类型");
// addErrorList.add(epidemicReportUserInfoAllExcel);
// continue;
// }
// } else {
// checkInfo += "第" + (i + 1) + "条、";
// epidemicReportUserInfoAllExcel.setErrorInfo("未填写疫苗类型");
// addErrorList.add(epidemicReportUserInfoAllExcel);
// continue;
// }
// 校验疫苗生产商
String companyName = epidemicReportUserInfoAllExcel.getCompanyName();
if (StringUtils.isNotBlank(companyName)) {
@ -248,13 +229,13 @@ public class VaccinationInfoServiceImpl extends BaseVimCurdServiceImpl<Vaccinati
epidemicReportUserInfoAllExcel.setCompanyId(company.get(0).getValue());
maxDose = company.get(0).getMaxDose();
} else {
checkInfo += "第" + (i + 1) + "条、";
checkInfo.append("第").append(i + 1).append("条、");
epidemicReportUserInfoAllExcel.setErrorInfo("不存在的疫苗生产商");
addErrorList.add(epidemicReportUserInfoAllExcel);
continue;
}
} else {
checkInfo += "第" + (i + 1) + "条、";
checkInfo.append("第").append(i + 1).append("条、");
epidemicReportUserInfoAllExcel.setErrorInfo("未填写疫苗生产商");
addErrorList.add(epidemicReportUserInfoAllExcel);
continue;
@ -267,13 +248,13 @@ public class VaccinationInfoServiceImpl extends BaseVimCurdServiceImpl<Vaccinati
if (!site.isEmpty()) {
epidemicReportUserInfoAllExcel.setSiteId(site.get(0).getValue());
} else {
checkInfo += "第" + (i + 1) + "条、";
checkInfo.append("第").append(i + 1).append("条、");
epidemicReportUserInfoAllExcel.setErrorInfo("不存在的疫苗接种点");
addErrorList.add(epidemicReportUserInfoAllExcel);
continue;
}
} else {
checkInfo += "第" + (i + 1) + "条、";
checkInfo.append("第").append(i + 1).append("条、");
epidemicReportUserInfoAllExcel.setErrorInfo("未填写疫苗接种点");
addErrorList.add(epidemicReportUserInfoAllExcel);
continue;
@ -314,41 +295,31 @@ public class VaccinationInfoServiceImpl extends BaseVimCurdServiceImpl<Vaccinati
existUserList.forEach(item -> {
EpidemicUserInfoDTO updateDto = new EpidemicUserInfoDTO();
if (item.getVaccinationState() == 2) {
// 已经接种完的不需要处理
} else {
if (item.getVaccinationNum() > maxDoseMap.get(item.getIdCard()).getVaccinationNum()) {
// excel的剂次数据小于数据库时不需要处理
// 已经接种完的不需要处理,excel的剂次数据小于数据库时不需要处理,已经接种完的不需要处理
if (item.getVaccinationState() != NumConstant.TWO && item.getVaccinationNum() <= maxDoseMap.get(item.getIdCard()).getVaccinationNum()) {
updateDto.setIdCard(item.getIdCard());
updateDto.setVaccinationNum(maxDoseMap.get(item.getIdCard()).getVaccinationNum());
if (maxDoseMap.get(item.getIdCard()).getVaccinationNum().equals(maxDoseMap.get(item.getIdCard()).getMaxDose())) {
// 如果最大剂次同于excel的剂次就是接种完成,否则是接种中
updateDto.setVaccinationState(2);
} else {
updateDto.setIdCard(item.getIdCard());
updateDto.setVaccinationNum(maxDoseMap.get(item.getIdCard()).getVaccinationNum());
if (maxDoseMap.get(item.getIdCard()).getVaccinationNum().equals(maxDoseMap.get(item.getIdCard()).getMaxDose())) {
// 如果最大剂次同于excel的剂次就是接种完成,否则是接种中
updateDto.setVaccinationState(2);
} else {
updateDto.setVaccinationState(1);
}
updateList.add(updateDto);
updateDto.setVaccinationState(1);
}
updateList.add(updateDto);
}
});
}
log.info("需要更新的人员信息数量为:" + updateList.size());
// 对规范数据,根据身份证号进行逻辑删除
// 对历史数据根据身份证号进行逻辑删除
if (!deleteIdCardArr.isEmpty()) {
baseDao.deleteDistinctDose(deleteIdCardArr);
}
// 插入数据----需改为批量插入
List<VaccinationInfoEntity> insertUserList = new ArrayList<>();
VaccinationInfoEntity userEntity;
for (VaccinationInfoAllExcel vaccinationInfoAllExcel : addList) {
userEntity = ConvertUtils.sourceToTarget(vaccinationInfoAllExcel, VaccinationInfoEntity.class);
insertUserList.add(userEntity);
}
// 插入接种数据
List<VaccinationInfoEntity> insertUserList = ConvertUtils.sourceToTarget(addList, VaccinationInfoEntity.class);
insertBatch(insertUserList);
// 更新人员的接种信息
@ -380,12 +351,14 @@ public class VaccinationInfoServiceImpl extends BaseVimCurdServiceImpl<Vaccinati
/**
* 校验是否存在空单元格
* 校验必填项 (用户名身份证号接种剂次)
*
* @param infoAllExcel
* @return
* @return boolean
* @author zhy
* @date 2021/5/10 11:18
*/
private boolean checkNullCell(VaccinationInfoAllExcel infoAllExcel) {
// 校验必填项 (用户名、身份证号)
return StringUtils.isBlank(infoAllExcel.getRealName()) || StringUtils.isBlank(infoAllExcel.getIdentityNo()) || infoAllExcel.getDose() == null;
}

2
epdc-cloud-vim-yushan/src/main/resources/mapper/vim/VaccinationErrorDao.xml

@ -43,7 +43,7 @@
e.REAL_NAME,
e.IDENTITY_NO,
e.MOBILE,
e.COMMUNITY,
e.COUNTY,
e.STREET,
e.COMMUNITY,
e.GRID,

Loading…
Cancel
Save