|
@@ -41,6 +41,7 @@ import java.util.regex.Matcher;
|
|
|
import java.util.regex.Pattern;
|
|
|
|
|
|
import static com.boman.common.core.utils.StringUtils.isNotEmpty;
|
|
|
+import static com.boman.common.core.utils.obj.ObjectUtils.*;
|
|
|
|
|
|
/**
|
|
|
* 疫苗信息Service业务层处理
|
|
@@ -166,7 +167,7 @@ public class VaccineInfoServiceImpl implements IVaccineInfoService {
|
|
|
PageHelper.startPage(pageNum, pageSize, orderBy);
|
|
|
}
|
|
|
|
|
|
- if (deptId != null){
|
|
|
+ if (deptId != null) {
|
|
|
List<SysDept> sysDepts = remoteDeptService.listChildrenDepts(deptId);
|
|
|
List<Long> deptIdList = new ArrayList<>();
|
|
|
if (sysDepts != null && sysDepts.size() > 0) {
|
|
@@ -915,7 +916,7 @@ public class VaccineInfoServiceImpl implements IVaccineInfoService {
|
|
|
public AjaxResult statistic() {
|
|
|
List<SysDept> allTowns = remoteDeptService.getByParentId(1L);
|
|
|
List<JSONObject> result = new ArrayList<>(allTowns.size());
|
|
|
- List<String> townNameList = ObjectUtils.map(allTowns, SysDept::getDeptName);
|
|
|
+ List<String> townNameList = map(allTowns, SysDept::getDeptName);
|
|
|
|
|
|
LOGGER.info("开始查询");
|
|
|
long l = System.currentTimeMillis();
|
|
@@ -1048,7 +1049,7 @@ public class VaccineInfoServiceImpl implements IVaccineInfoService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (deptId != null){
|
|
|
+ if (deptId != null) {
|
|
|
List<SysDept> sysDepts = remoteDeptService.listChildrenDepts(deptId);
|
|
|
List<Long> deptIdList = new ArrayList<>();
|
|
|
if (sysDepts != null && sysDepts.size() > 0) {
|
|
@@ -1063,8 +1064,7 @@ public class VaccineInfoServiceImpl implements IVaccineInfoService {
|
|
|
PageDomain pageDomain = TableSupport.buildPageRequest();
|
|
|
Integer pageNum = pageDomain.getPageNum();
|
|
|
Integer pageSize = pageDomain.getPageSize();
|
|
|
- if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize))
|
|
|
- {
|
|
|
+ if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)) {
|
|
|
String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
|
|
|
PageHelper.startPage(pageNum, pageSize, orderBy);
|
|
|
}
|
|
@@ -1090,7 +1090,7 @@ public class VaccineInfoServiceImpl implements IVaccineInfoService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public JSONObject sts() {
|
|
|
+ public JSONObject stsByApplet() {
|
|
|
Long deptId = AuthUtils.getLoginUser().getSysUser().getDeptId();
|
|
|
//判断是否是管理员
|
|
|
List<SysRole> roles = AuthUtils.getLoginUser().getSysUser().getRoles();
|
|
@@ -1135,13 +1135,85 @@ public class VaccineInfoServiceImpl implements IVaccineInfoService {
|
|
|
// 当前登陆人的deptId
|
|
|
SysUser sysUser = AuthUtils.getLoginUser().getSysUser();
|
|
|
String deptName = sysUser.getDept().getDeptName();
|
|
|
+ Long deptId = sysUser.getDeptId();
|
|
|
+ // 当前单位
|
|
|
result.put("dqdw", deptName);
|
|
|
|
|
|
- Long deptId = AuthUtils.getLoginUser().getSysUser().getDeptId();
|
|
|
-// int village = remoteDeptService.countChildrenByVillage(deptId);
|
|
|
+ List<SysRole> roles = sysUser.getRoles();
|
|
|
+ List<String> roleKeySets = map(roles, SysRole::getRoleKey);
|
|
|
+ // 市领导
|
|
|
+ if (roleKeySets.contains("city") || roleKeySets.contains("admin")) {
|
|
|
+ List<SysDept> allDepts = remoteDeptService.listChildrenDepts(1L);
|
|
|
+ List<SysDept> townsDepts = filter(allDepts, dept -> 1L == dept.getParentId());
|
|
|
+ result.put("zhen", townsDepts.size()); // 镇
|
|
|
+
|
|
|
+ List<SysDept> cunDepts = new ArrayList<>(16);
|
|
|
+ for (SysDept townsDept : townsDepts) {
|
|
|
+ for (SysDept allDept : allDepts) {
|
|
|
+ if (townsDept.getId().equals(allDept.getParentId())) {
|
|
|
+ cunDepts.add(allDept);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ result.put("cun", isEmpty(cunDepts) ? 0 : cunDepts.size());
|
|
|
|
|
|
+ List<SysDept> zuDept = new ArrayList<>(16);
|
|
|
+ for (SysDept cunDept : cunDepts) {
|
|
|
+ for (SysDept allDept : allDepts) {
|
|
|
+ if (cunDept.getId().equals(allDept.getParentId())) {
|
|
|
+ zuDept.add(allDept);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ result.put("zu", isEmpty(zuDept) ? 0 : zuDept.size());
|
|
|
+
|
|
|
+ VaccineInfoOperation condition = new VaccineInfoOperation();
|
|
|
+ condition.setStartTime(DateUtils.getTodayStart());
|
|
|
+ condition.setEndTime(DateUtils.getTodayEnd());
|
|
|
+
|
|
|
+// if (deptId == null) {
|
|
|
+// deptId = AuthUtils.getLoginUser().getSysUser().getDeptId();
|
|
|
+// //判断是否是管理员
|
|
|
+// if (isNotEmpty(roles)) {
|
|
|
+// for (SysRole role : roles) {
|
|
|
+// String roleKey = role.getRoleKey();
|
|
|
+// if ("admin".equals(roleKey) || "city".equals(roleKey)) {
|
|
|
+// deptId = null;
|
|
|
+// break;
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// List<Long> deptIdList = new ArrayList<>();
|
|
|
+// if (deptId != null) {
|
|
|
+// List<SysDept> sysDepts = remoteDeptService.listChildrenDepts(deptId);
|
|
|
+// if (sysDepts != null && sysDepts.size() > 0) {
|
|
|
+// for (SysDept sysDept : sysDepts) {
|
|
|
+// Long id = sysDept.getId();
|
|
|
+// deptIdList.add(id);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// condition.setDeptIdList(deptIdList);
|
|
|
+ List<VaccineInfoOperation> list = vaccineInfoMapper.selectVaccineInfoList(condition);
|
|
|
+
|
|
|
+ result.put("xz", 0);
|
|
|
+ result.put("js", 0);
|
|
|
+ } else if (roleKeySets.contains("sys:town")) {
|
|
|
+ // 镇领导
|
|
|
+
|
|
|
+ }
|
|
|
+// int village = remoteDeptService.countChildrenByVillage(deptId);
|
|
|
|
|
|
|
|
|
return null;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public AjaxResult deleteCzrk(VaccineInfoOperation vaccineInfoOperation) {
|
|
|
+ vaccineInfoOperation.setUpdateBy(AuthUtils.getLoginUser().getSysUser().getUserName());
|
|
|
+ int delete = vaccineInfoMapper.deleteCzrk(vaccineInfoOperation);
|
|
|
+ return delete > 0 ? AjaxResult.success() : AjaxResult.error();
|
|
|
+ }
|
|
|
}
|