|
@@ -5,6 +5,7 @@ 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;
|
|
@@ -321,7 +322,11 @@ public class CzrkServiceImpl implements ICzrkService {
|
|
|
if (isEmpty(id)) {
|
|
|
return null;
|
|
|
}
|
|
|
- return czrkMapper.selectCzrkById(id);
|
|
|
+
|
|
|
+ Czrk czrk = czrkMapper.selectCzrkById(id);
|
|
|
+ List<CzrkJzdz> czrkJzdzList = czrkJzdzService.listByIdCard(Collections.singletonList(czrk.getIdCard()));
|
|
|
+ czrk.setCzrkJzdzList(czrkJzdzList);
|
|
|
+ return czrk;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -338,28 +343,24 @@ public class CzrkServiceImpl implements ICzrkService {
|
|
|
}
|
|
|
|
|
|
int count = czrkMapper.countIdCard(czrk.getIdCard());
|
|
|
- if (count > 0) {
|
|
|
- return AjaxResult.error(String.format("该人员[身份证号为: %s]已存在,请勿重复添加", czrk.getIdCard()));
|
|
|
- }
|
|
|
+ if (count > 0) return AjaxResult.error(String.format("该人员[身份证号为: %s]已存在,请勿重复添加", czrk.getIdCard()));
|
|
|
|
|
|
czrk.setCreateBy(username);
|
|
|
czrk.setUpdateBy(username);
|
|
|
count = czrkMapper.insertCzrk(czrk);
|
|
|
- if (count <= 0) {
|
|
|
- return AjaxResult.error();
|
|
|
- }
|
|
|
+ if (count <= 0) return AjaxResult.error();
|
|
|
|
|
|
List<CzrkJzdz> czrkJzdzList = czrk.getCzrkJzdzList();
|
|
|
- if (isEmpty(czrkJzdzList)) {
|
|
|
- return AjaxResult.error("该人员常住地址未添加");
|
|
|
- }
|
|
|
+ if (isEmpty(czrkJzdzList)) return AjaxResult.error("该人员常住地址未添加");
|
|
|
|
|
|
int sort = 0, childCount = 0;
|
|
|
for (CzrkJzdz czrkJzdz : czrkJzdzList) {
|
|
|
czrkJzdz.setCzrkId(czrk.getId());
|
|
|
czrkJzdz.setSort(++sort);
|
|
|
- czrkJzdz.setCreateBy(SecurityUtils.getUsername());
|
|
|
- czrkJzdz.setUpdateBy(SecurityUtils.getUsername());
|
|
|
+ czrkJzdz.setUserName(czrk.getUserName());
|
|
|
+ czrkJzdz.setIdCard(czrk.getIdCard());
|
|
|
+ czrkJzdz.setCreateBy(username);
|
|
|
+ czrkJzdz.setUpdateBy(username);
|
|
|
childCount += czrkJzdzService.insertCzrkJzdz(czrkJzdz);
|
|
|
}
|
|
|
|
|
@@ -369,31 +370,32 @@ public class CzrkServiceImpl implements ICzrkService {
|
|
|
@Override
|
|
|
public AjaxResult editRlry(Czrk czrk) {
|
|
|
String username = SecurityUtils.getUsername();
|
|
|
- if (isNotEmpty(czrk.getVillageTowns())) {
|
|
|
- czrk.setRlr(SecurityUtils.getUsername());
|
|
|
- czrk.setIsRl("是");
|
|
|
- czrk.setRlTime(new Date(System.currentTimeMillis()));
|
|
|
- } else {
|
|
|
- czrk.setIsRl("否");
|
|
|
- czrk.setRlTime(null);
|
|
|
+ String isRl = czrk.getIsRl();
|
|
|
+ if ("否".equals(isRl)) {
|
|
|
+ if (isNotEmpty(czrk.getVillageTowns())) {
|
|
|
+ czrk.setRlr(username);
|
|
|
+ czrk.setIsRl("是");
|
|
|
+ czrk.setRlTime(new Date(System.currentTimeMillis()));
|
|
|
+ } else {
|
|
|
+ czrk.setIsRl("否");
|
|
|
+ czrk.setRlTime(null);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
czrk.setUpdateBy(username);
|
|
|
int count = czrkMapper.updateCzrk(czrk);
|
|
|
- if (count <= 0) {
|
|
|
- return AjaxResult.error();
|
|
|
- }
|
|
|
+ if (count <= 0) return AjaxResult.error();
|
|
|
|
|
|
List<CzrkJzdz> czrkJzdzList = czrk.getCzrkJzdzList();
|
|
|
- if (isEmpty(czrkJzdzList)) {
|
|
|
- return AjaxResult.error("该人员常住地址未添加");
|
|
|
- }
|
|
|
+ if (isEmpty(czrkJzdzList)) return AjaxResult.error("该人员常住地址未添加");
|
|
|
|
|
|
czrkJzdzService.deleteByCzrkId(czrk.getId());
|
|
|
int sort = 0, childCount = 0;
|
|
|
for (CzrkJzdz czrkJzdz : czrkJzdzList) {
|
|
|
czrkJzdz.setCzrkId(czrk.getId());
|
|
|
czrkJzdz.setSort(++sort);
|
|
|
+ czrkJzdz.setUserName(czrk.getUserName());
|
|
|
+ czrkJzdz.setIdCard(czrk.getIdCard());
|
|
|
czrkJzdz.setCreateBy(username);
|
|
|
czrkJzdz.setUpdateBy(username);
|
|
|
childCount += czrkJzdzService.insertCzrkJzdz(czrkJzdz);
|
|
@@ -403,25 +405,28 @@ public class CzrkServiceImpl implements ICzrkService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public JSONObject stsByApplet(Long townId, Long villageId, String userName) {
|
|
|
- List<Long> deptIdList = new ArrayList<>(16);
|
|
|
- // 未加搜索条件
|
|
|
- if (isEmpty(townId) && isEmpty(villageId)) {
|
|
|
- deptIdList = getDeptIdList(null);
|
|
|
- } 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());
|
|
|
- }
|
|
|
+ public JSONObject stsByApplet(Long provinceId, Long cityId, Long regionId, Long townId, Long villageId, String userName) {
|
|
|
+ Long areaId = null;
|
|
|
+ int type = 0;
|
|
|
+ if (ObjectUtils.isNotEmpty(provinceId)) {
|
|
|
+ areaId = provinceId;
|
|
|
+ type = 1;
|
|
|
+ } else if (ObjectUtils.isNotEmpty(cityId)) {
|
|
|
+ areaId = cityId;
|
|
|
+ type = 2;
|
|
|
+ } else if (ObjectUtils.isNotEmpty(regionId)) {
|
|
|
+ areaId = regionId;
|
|
|
+ type = 3;
|
|
|
+ } else if (ObjectUtils.isNotEmpty(townId)) {
|
|
|
+ areaId = townId;
|
|
|
+ type = 4;
|
|
|
+ } else if (ObjectUtils.isNotEmpty(villageId)) {
|
|
|
+ areaId = villageId;
|
|
|
+ type = 5;
|
|
|
}
|
|
|
|
|
|
- int yrl = czrkMapper.stsByYrl(deptIdList, userName);
|
|
|
- int wrl = czrkMapper.stsByWrl(deptIdList, userName);
|
|
|
+ int yrl = czrkMapper.stsByYrl(type, areaId, userName);
|
|
|
+ int wrl = czrkMapper.stsByWrl(type, areaId, userName);
|
|
|
JSONObject result = new JSONObject(3);
|
|
|
result.put("yrl", yrl);
|
|
|
result.put("wrl", wrl);
|