|
@@ -10,13 +10,10 @@ import com.boman.common.core.utils.obj.ObjectUtils;
|
|
|
import com.boman.common.core.utils.sql.SqlUtil;
|
|
|
import com.boman.common.core.web.page.PageDomain;
|
|
|
import com.boman.common.core.web.page.TableSupport;
|
|
|
-import com.boman.domain.SysDept;
|
|
|
-import com.boman.domain.SysRole;
|
|
|
+import com.boman.domain.*;
|
|
|
import com.boman.domain.dto.AjaxResult;
|
|
|
import com.boman.system.api.RemoteDeptService;
|
|
|
import com.boman.system.api.RemoteDictDataService;
|
|
|
-import com.boman.domain.VaccineInfoOperation;
|
|
|
-import com.boman.domain.VaccineInfoUser;
|
|
|
import com.boman.web.core.mapper.StandardlyMapper;
|
|
|
import com.boman.web.core.mapper.VaccineInfoMapper;
|
|
|
import com.boman.web.core.mapper.VaccineInfoOperationMapper;
|
|
@@ -44,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业务层处理
|
|
@@ -169,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) {
|
|
@@ -918,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();
|
|
@@ -1051,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) {
|
|
@@ -1066,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);
|
|
|
}
|
|
@@ -1091,4 +1088,132 @@ public class VaccineInfoServiceImpl implements IVaccineInfoService {
|
|
|
public VaccineInfoOperation getById(Long id) {
|
|
|
return vaccineInfoMapper.selectVaccineInfoById(id);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public JSONObject stsByApplet() {
|
|
|
+ Long deptId = AuthUtils.getLoginUser().getSysUser().getDeptId();
|
|
|
+ //判断是否是管理员
|
|
|
+ List<SysRole> roles = AuthUtils.getLoginUser().getSysUser().getRoles();
|
|
|
+ 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<>(16);
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ int yrl = vaccineInfoMapper.stsByYrl(deptIdList);
|
|
|
+ int wrl = vaccineInfoMapper.stsByWrl(deptIdList);
|
|
|
+ JSONObject result = new JSONObject(3);
|
|
|
+ result.put("yrl", yrl);
|
|
|
+ result.put("wrl", wrl);
|
|
|
+ result.put("total", wrl + yrl);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 功能描述: 当前单位:镇,村:7个,组:300个,常住人口:5000人,新增 2人 减少 2人
|
|
|
+ *
|
|
|
+ * @return com.alibaba.fastjson.JSONObject
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public JSONObject stsByCzrk() {
|
|
|
+ JSONObject result = new JSONObject(6);
|
|
|
+ // 当前登陆人的deptId
|
|
|
+ SysUser sysUser = AuthUtils.getLoginUser().getSysUser();
|
|
|
+ String deptName = sysUser.getDept().getDeptName();
|
|
|
+ Long deptId = sysUser.getDeptId();
|
|
|
+ // 当前单位
|
|
|
+ result.put("dqdw", deptName);
|
|
|
+
|
|
|
+ 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();
|
|
|
+ }
|
|
|
}
|