|
@@ -6,7 +6,6 @@ import com.boman.common.core.utils.DateUtils;
|
|
|
import com.boman.common.core.utils.SecurityUtils;
|
|
|
import com.boman.common.core.utils.StringUtils;
|
|
|
import com.boman.common.core.utils.number.NumberUtils;
|
|
|
-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;
|
|
@@ -34,8 +33,6 @@ import org.springframework.transaction.annotation.Isolation;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
-import javax.validation.constraints.NotBlank;
|
|
|
-import javax.validation.constraints.Size;
|
|
|
import java.sql.Timestamp;
|
|
|
import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
@@ -43,9 +40,11 @@ import java.util.*;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
import java.util.regex.Matcher;
|
|
|
import java.util.regex.Pattern;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
import static com.boman.common.core.utils.StringUtils.isNotEmpty;
|
|
|
-import static com.boman.common.core.utils.obj.ObjectUtils.*;
|
|
|
+import static com.boman.common.core.utils.obj.ObjectUtils.isEmpty;
|
|
|
+import static com.boman.common.core.utils.obj.ObjectUtils.map;
|
|
|
import static com.boman.common.redis.RedisKey.STS_CZRK_;
|
|
|
|
|
|
/**
|
|
@@ -1145,33 +1144,46 @@ public class VaccineInfoServiceImpl implements IVaccineInfoService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public JSONObject stsByApplet() {
|
|
|
+ public JSONObject stsByApplet(Long townId, Long villageId, String userName) {
|
|
|
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 (isEmpty(townId) && isEmpty(villageId)) {
|
|
|
+ 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);
|
|
|
+ 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);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+ } else {
|
|
|
+ // 查村
|
|
|
+ if (!isEmpty(townId) && !isEmpty(villageId)) {
|
|
|
+ List<SysDept> sysDepts = remoteDeptService.listChildrenDepts(villageId);
|
|
|
+ deptIdList = sysDepts.stream().map(SysDept::getId).collect(Collectors.toList());
|
|
|
+ } else if (!isEmpty(townId) && isEmpty(villageId)) {
|
|
|
+ // 查镇
|
|
|
+ List<SysDept> sysDepts = remoteDeptService.listChildrenDepts(townId);
|
|
|
+ deptIdList = sysDepts.stream().map(SysDept::getId).collect(Collectors.toList());
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- int yrl = vaccineInfoMapper.stsByYrl(deptIdList);
|
|
|
- int wrl = vaccineInfoMapper.stsByWrl(deptIdList);
|
|
|
+ int yrl = vaccineInfoMapper.stsByYrl(deptIdList, userName);
|
|
|
+ int wrl = vaccineInfoMapper.stsByWrl(deptIdList, userName);
|
|
|
JSONObject result = new JSONObject(3);
|
|
|
result.put("yrl", yrl);
|
|
|
result.put("wrl", wrl);
|
|
@@ -1204,45 +1216,52 @@ public class VaccineInfoServiceImpl implements IVaccineInfoService {
|
|
|
if (roleKeySets.contains("city") || roleKeySets.contains("admin") || roleKeySets.contains("yanshi")) {
|
|
|
JSONObject jsonObject = redisService.getCacheObject(packRedisKey("single:" + deptId));
|
|
|
if (isNotEmpty(jsonObject)) {
|
|
|
+ QIANSHANSHI_SINGEL = jsonObject;
|
|
|
return jsonObject;
|
|
|
}
|
|
|
-
|
|
|
- List<SysDept> allDepts = remoteDeptService.listChildrenDepts(1L);
|
|
|
- List<SysDept> townsDepts = new ArrayList<>(16);
|
|
|
- for (SysDept allDept : allDepts) {
|
|
|
- if (isEmpty(allDept.getParentId())) continue;
|
|
|
- if (allDept.getParentId() == (1L)) {
|
|
|
- townsDepts.add(allDept);
|
|
|
- }
|
|
|
- }
|
|
|
- result.put("zhen", townsDepts.size()); // 镇
|
|
|
|
|
|
- List<SysDept> cunDepts = new ArrayList<>(16);
|
|
|
- for (SysDept townsDept : townsDepts) {
|
|
|
+ ThreadPoolService.execute(() -> {
|
|
|
+ List<SysDept> allDepts = remoteDeptService.listChildrenDepts(1L);
|
|
|
+ List<SysDept> townsDepts = new ArrayList<>(16);
|
|
|
for (SysDept allDept : allDepts) {
|
|
|
if (isEmpty(allDept.getParentId())) continue;
|
|
|
- if (townsDept.getId().equals(allDept.getParentId())) {
|
|
|
- cunDepts.add(allDept);
|
|
|
+ if (allDept.getParentId() == (1L)) {
|
|
|
+ townsDepts.add(allDept);
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- result.put("cun", isEmpty(cunDepts) ? 0 : cunDepts.size());
|
|
|
+ result.put("zhen", townsDepts.size()); // 镇
|
|
|
|
|
|
- List<SysDept> zuDept = new ArrayList<>(16);
|
|
|
- for (SysDept cunDept : cunDepts) {
|
|
|
- for (SysDept allDept : allDepts) {
|
|
|
- if (cunDept.getId().equals(allDept.getParentId())) {
|
|
|
- zuDept.add(allDept);
|
|
|
+ List<SysDept> cunDepts = new ArrayList<>(16);
|
|
|
+ for (SysDept townsDept : townsDepts) {
|
|
|
+ for (SysDept allDept : allDepts) {
|
|
|
+ if (isEmpty(allDept.getParentId())) continue;
|
|
|
+ if (townsDept.getId().equals(allDept.getParentId())) {
|
|
|
+ cunDepts.add(allDept);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- result.put("zu", isEmpty(zuDept) ? 0 : zuDept.size());
|
|
|
- int xz = vaccineInfoMapper.countByXz(condition);
|
|
|
- int js = vaccineInfoMapper.countByJs(condition);
|
|
|
- result.put("xz", xz);
|
|
|
- result.put("js", js);
|
|
|
- result.put("czrk", vaccineInfoMapper.countCzrk(condition));
|
|
|
- redisService.setCacheObject(packRedisKey("single:" + deptId), result, 1L, TimeUnit.DAYS);
|
|
|
+ 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());
|
|
|
+ int xz = vaccineInfoMapper.countByXz(condition);
|
|
|
+ int js = vaccineInfoMapper.countByJs(condition);
|
|
|
+ result.put("xz", xz);
|
|
|
+ result.put("js", js);
|
|
|
+ result.put("czrk", vaccineInfoMapper.countCzrk(condition));
|
|
|
+// redisService.setCacheObject(packRedisKey("single:" + deptId), result, 1L, TimeUnit.DAYS);
|
|
|
+ setIntoRedis(packRedisKey("single:" + deptId), result);
|
|
|
+ QIANSHANSHI_SINGEL = result;
|
|
|
+ });
|
|
|
+
|
|
|
+ return QIANSHANSHI_SINGEL;
|
|
|
} else if (roleKeySets.contains("sys:town")) {
|
|
|
JSONObject jsonObject = redisService.getCacheObject(packRedisKey("town:" + deptId));
|
|
|
if (isNotEmpty(jsonObject)) {
|
|
@@ -1250,7 +1269,8 @@ public class VaccineInfoServiceImpl implements IVaccineInfoService {
|
|
|
}
|
|
|
|
|
|
townSts(result, condition, deptId, deptName, true);
|
|
|
- redisService.setCacheObject(packRedisKey("town:" + deptId), result, 1L, TimeUnit.DAYS);
|
|
|
+// redisService.setCacheObject(packRedisKey("town:" + deptId), result, 1L, TimeUnit.DAYS);
|
|
|
+ setIntoRedis(packRedisKey("town:" + deptId), result);
|
|
|
}
|
|
|
|
|
|
return result;
|
|
@@ -1341,7 +1361,9 @@ public class VaccineInfoServiceImpl implements IVaccineInfoService {
|
|
|
}
|
|
|
|
|
|
result.put("townDatas", towsDataList);
|
|
|
- redisService.setCacheObject(packRedisKey(deptId + ""), result, 1L, TimeUnit.DAYS);
|
|
|
+// redisService.setCacheObject(packRedisKey(deptId + ""), result, 1L, TimeUnit.DAYS);
|
|
|
+ setIntoRedis(packRedisKey(deptId + ""), result);
|
|
|
+ QIANSHANSHI = result;
|
|
|
});
|
|
|
|
|
|
return QIANSHANSHI;
|
|
@@ -1354,7 +1376,8 @@ public class VaccineInfoServiceImpl implements IVaccineInfoService {
|
|
|
|
|
|
ThreadPoolService.execute(() -> {
|
|
|
townSts(result, condition, deptId, deptName, true);
|
|
|
- redisService.setCacheObject(packRedisKey("town:" + deptId), result, 1L, TimeUnit.DAYS);
|
|
|
+// redisService.setCacheObject(packRedisKey("town:" + deptId), result, 1L, TimeUnit.DAYS);
|
|
|
+ setIntoRedis(packRedisKey("town:" + deptId), result);
|
|
|
});
|
|
|
|
|
|
return ZHEN;
|
|
@@ -1551,9 +1574,9 @@ public class VaccineInfoServiceImpl implements IVaccineInfoService {
|
|
|
return AjaxResult.error("该信息不存在,无法删除");
|
|
|
}
|
|
|
|
|
|
- if (isEmpty(operation.getVillageTowns())) {
|
|
|
- return AjaxResult.error("该人员为未认领人员,无法删除");
|
|
|
- }
|
|
|
+// if (isEmpty(operation.getVillageTowns())) {
|
|
|
+// return AjaxResult.error("该人员为未认领人员,无法删除");
|
|
|
+// }
|
|
|
|
|
|
vaccineInfoOperation.setUpdateBy(AuthUtils.getLoginUser().getSysUser().getUserName());
|
|
|
int delete = vaccineInfoMapper.deleteCzrk(vaccineInfoOperation);
|
|
@@ -1602,7 +1625,24 @@ public class VaccineInfoServiceImpl implements IVaccineInfoService {
|
|
|
return infoOperations;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 功能描述: 回收站的还原功能
|
|
|
+ *
|
|
|
+ * @param id id
|
|
|
+ * @return int
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public int reduction(String id) {
|
|
|
+ if (isEmpty(id)) return 0;
|
|
|
+
|
|
|
+ return vaccineInfoMapper.reduction(id);
|
|
|
+ }
|
|
|
+
|
|
|
private String packRedisKey(String deptId){
|
|
|
return STS_CZRK_ + ":" + deptId + ":" + DateUtils.getDate();
|
|
|
}
|
|
|
+
|
|
|
+ private void setIntoRedis(String key, Object result){
|
|
|
+ redisService.setCacheObject(key, result, 1L, TimeUnit.HOURS);
|
|
|
+ }
|
|
|
}
|