|
@@ -16,8 +16,10 @@ import com.ruoyi.system.api.enums.DataStatus;
|
|
|
import com.ruoyi.system.api.enums.ExamineStatus;
|
|
|
import com.ruoyi.system.api.enums.WhetherStatus;
|
|
|
import com.ruoyi.system.api.enums.XmsbStatus;
|
|
|
-;import com.ruoyi.system.mapper.SysDeptJlMapper;
|
|
|
+;import com.ruoyi.system.domain.SysDeptJl;
|
|
|
+import com.ruoyi.system.mapper.SysDeptJlMapper;
|
|
|
import com.ruoyi.common.security.utils.SysDeptJlUtils;
|
|
|
+import com.ruoyi.system.utils.SubCodeUtil;
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -122,8 +124,11 @@ public class ZwywXmsbCommonServiceImpl implements IZwywXmsbCommonService
|
|
|
@Override
|
|
|
public List<ZwywXmsbCommon> selectZwywXmsbCommonList(ZwywXmsbCommon zwywXmsbCommon)
|
|
|
{
|
|
|
- List<String> deptLevel = Arrays.stream(SecurityUtils.getLoginUser().getSysUser().getDept().getAncestors()
|
|
|
- .split(",")).collect(Collectors.toList());
|
|
|
+ Map<String,String> map = SubCodeUtil.getSubCode(SecurityUtils.getAreaCode());
|
|
|
+ int level = Integer.parseInt(map.get("level"));
|
|
|
+
|
|
|
+// List<String> deptLevel = Arrays.stream(SecurityUtils.getLoginUser().getSysUser().getDept().getAncestors()
|
|
|
+// .split(",")).collect(Collectors.toList());
|
|
|
LambdaQueryWrapper<ZwywXmsbCommon> lqw = new LambdaQueryWrapper<ZwywXmsbCommon>()
|
|
|
.like(StringUtils.isNotEmpty(zwywXmsbCommon.getXmmc()), ZwywXmsbCommon::getXmmc,
|
|
|
zwywXmsbCommon.getXmmc())
|
|
@@ -144,18 +149,20 @@ public class ZwywXmsbCommonServiceImpl implements IZwywXmsbCommonService
|
|
|
zwywXmsbCommon.getSzdq());
|
|
|
}
|
|
|
} else {
|
|
|
- lqw.apply("create_unit IN (SELECT dept_id FROM sys_dept WHERE dept_id = " +
|
|
|
- SecurityUtils.getUserUnitId() + " OR find_in_set(" + SecurityUtils.getUserUnitId() + ", ancestors))");
|
|
|
+// lqw.apply("create_unit IN (SELECT dept_id FROM sys_dept WHERE dept_id = " +
|
|
|
+// SecurityUtils.getUserUnitId() + " OR find_in_set(" + SecurityUtils.getUserUnitId() + ", ancestors))");
|
|
|
+ lqw.apply("create_area_code IN (SELECT code FROM sys_dept_jl WHERE code = " +
|
|
|
+ SecurityUtils.getAreaCode() + " OR find_in_set(" + SecurityUtils.getAreaCode() + ", ancestors))");
|
|
|
}
|
|
|
- if (StringUtils.isEmpty(deptLevel.get(0))) {
|
|
|
+ if (level == 1) {
|
|
|
// 省级
|
|
|
// 待省审核/审核通过/自己创建
|
|
|
List<String> statusList = new ArrayList<>();
|
|
|
statusList.add(XmsbStatus.SSH.getCode());
|
|
|
statusList.add(XmsbStatus.SHTG.getCode());
|
|
|
lqw.and(wq -> wq.in(ZwywXmsbCommon::getSbzt, statusList)
|
|
|
- .or().eq(ZwywXmsbCommon::getCreateUnit, SecurityUtils.getUserUnitId()));
|
|
|
- } else if (StringUtils.isNotEmpty(deptLevel.get(0))) {
|
|
|
+ .or().eq(ZwywXmsbCommon::getCreateAreaCode, SecurityUtils.getAreaCode()));
|
|
|
+ } else if (level == 2) {
|
|
|
// 市级
|
|
|
// 待市审核/待省审核/省退回/审核通过/自己创建
|
|
|
List<String> statusList = new ArrayList<>();
|
|
@@ -164,58 +171,62 @@ public class ZwywXmsbCommonServiceImpl implements IZwywXmsbCommonService
|
|
|
statusList.add(XmsbStatus.SHTG.getCode());
|
|
|
statusList.add(XmsbStatus.SHBTG.getCode());
|
|
|
lqw.and(wq -> wq.in(ZwywXmsbCommon::getSbzt, statusList)
|
|
|
- .or().eq(ZwywXmsbCommon::getCreateUnit, SecurityUtils.getUserUnitId()));
|
|
|
- } else if (deptLevel.size() == 2) {
|
|
|
+ .or().eq(ZwywXmsbCommon::getCreateAreaCode, SecurityUtils.getAreaCode()));
|
|
|
+ } else if (level == 3) {
|
|
|
// 区县
|
|
|
// 自己创建
|
|
|
- lqw.eq(ZwywXmsbCommon::getCreateUnit, SecurityUtils.getUserUnitId());
|
|
|
+ lqw.eq(ZwywXmsbCommon::getCreateAreaCode, SecurityUtils.getAreaCode());
|
|
|
}
|
|
|
List<ZwywXmsbCommon> res = zwywXmsbCommonMapper.selectList(lqw);
|
|
|
Map<String, Object> hzxx = new HashMap<>();
|
|
|
for (ZwywXmsbCommon r: res) {
|
|
|
- if (StringUtils.isEmpty(deptLevel.get(0))) {
|
|
|
+ if (level == 1) {
|
|
|
// 省级是否可以审核
|
|
|
if (StringUtils.equals(r.getSbzt(), XmsbStatus.SSH.getCode())) {
|
|
|
r.setShFlg(ExamineStatus.SNO.getCode());
|
|
|
}
|
|
|
// 省级是否可以修改申请
|
|
|
- if (StringUtils.equals(r.getCreateUnit(), SecurityUtils.getUserUnitId())) {
|
|
|
+ if (StringUtils.equals(r.getCreateAreaCode(), SecurityUtils.getAreaCode())) {
|
|
|
r.setOwnFlg(ExamineStatus.SNO.getCode());
|
|
|
if (StringUtils.equals(r.getSbzt(), XmsbStatus.CG.getCode())
|
|
|
|| StringUtils.equals(r.getSbzt(), XmsbStatus.SHBTG.getCode())) {
|
|
|
r.setTjFlg(ExamineStatus.SNO.getCode());
|
|
|
}
|
|
|
}
|
|
|
- } else if (deptLevel.size() == 1) {
|
|
|
- if (StringUtils.isNotEmpty(deptLevel.get(0))) {
|
|
|
+ } else if (level == 2) {
|
|
|
// 市级是否可以审核
|
|
|
if (StringUtils.equals(r.getSbzt(), XmsbStatus.CSH.getCode())) {
|
|
|
// 待市审核
|
|
|
r.setShFlg(ExamineStatus.SNO.getCode());
|
|
|
} else if (StringUtils.equals(r.getSbzt(), XmsbStatus.SHBTG.getCode())) {
|
|
|
// 省退回且在本市以下区提交的数据
|
|
|
- if (!StringUtils.equals(r.getCreateUnit(), SecurityUtils.getUserUnitId())) {
|
|
|
+ if (!StringUtils.equals(r.getCreateAreaCode(), SecurityUtils.getAreaCode())) {
|
|
|
List<ZwywXmsbBaxx> baxxList = zwywXmsbBaxxMapper.selectList(
|
|
|
new LambdaQueryWrapper<ZwywXmsbBaxx>().eq(ZwywXmsbBaxx::getSbId, r.getId()));
|
|
|
- long baxxCount = baxxList.stream().filter(b -> StringUtils.equals(b.getCreateUnit(),
|
|
|
- String.valueOf(SecurityUtils.getLoginUser().getSysUser().getDept().getParentId())))
|
|
|
- .filter(v -> StringUtils.equals(v.getBazt(), "3")).count();
|
|
|
+ long baxxCount = baxxList.stream().filter(b -> {
|
|
|
+ SysDeptJl deptJl = sysDeptJlMapper.selectSysDeptJlByCode(SecurityUtils.getAreaCode());
|
|
|
+ if (ObjectUtils.isNotEmpty(deptJl)) {
|
|
|
+ if (StringUtils.equals(sysDeptJlMapper.id2code(deptJl.getParentId()), b.getCreateAreaCode())) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }).filter(v -> StringUtils.equals(v.getBazt(), "3")).count();
|
|
|
if (baxxCount <= 1) {
|
|
|
r.setShFlg(ExamineStatus.SNO.getCode());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
// 市级是否可以修改申请
|
|
|
- if (StringUtils.equals(r.getCreateUnit(), SecurityUtils.getUserUnitId())) {
|
|
|
+ if (StringUtils.equals(r.getCreateAreaCode(), SecurityUtils.getAreaCode())) {
|
|
|
r.setOwnFlg(ExamineStatus.SNO.getCode());
|
|
|
if (StringUtils.equals(r.getSbzt(), XmsbStatus.SHBTG.getCode())) {
|
|
|
r.setTjFlg(ExamineStatus.SNO.getCode());
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
} else {
|
|
|
// 区县级是否可以修改申请
|
|
|
- if (StringUtils.equals(r.getCreateUnit(), SecurityUtils.getUserUnitId())) {
|
|
|
+ if (StringUtils.equals(r.getCreateAreaCode(), SecurityUtils.getAreaCode())) {
|
|
|
r.setOwnFlg(ExamineStatus.SNO.getCode());
|
|
|
if (StringUtils.equals(r.getSbzt(), XmsbStatus.SHBTG.getCode())
|
|
|
|| StringUtils.equals(r.getSbzt(), XmsbStatus.CHBTG.getCode())) {
|
|
@@ -233,8 +244,8 @@ public class ZwywXmsbCommonServiceImpl implements IZwywXmsbCommonService
|
|
|
zwywXmsbCommon.setSzdq(SecurityUtils.getAreaCode());
|
|
|
}
|
|
|
if (StringUtils.isNotEmpty(zwywXmsbCommon.getIsPresent())) {
|
|
|
- if (StringUtils.isEmpty(deptLevel.get(0))) {
|
|
|
- zwywXmsbCommon.setCreateUnit(SecurityUtils.getUserUnitId());
|
|
|
+ if (level == 1) {
|
|
|
+ zwywXmsbCommon.setCreateAreaCode(SecurityUtils.getAreaCode());
|
|
|
}
|
|
|
Map<String, Object> zhz = zwywXmsbCommonMapper.selectXmsbHz(zwywXmsbCommon);
|
|
|
if (ObjectUtils.isNotEmpty(zhz)) {
|
|
@@ -320,19 +331,26 @@ public class ZwywXmsbCommonServiceImpl implements IZwywXmsbCommonService
|
|
|
@Override
|
|
|
public int updateZwywXmsbCommonTj(ZwywXmsbCommon zwywXmsbCommon)
|
|
|
{
|
|
|
- List<String> deptLevel = Arrays.stream(SecurityUtils.getLoginUser().getSysUser().getDept().getAncestors()
|
|
|
- .split(",")).collect(Collectors.toList());
|
|
|
- if (deptLevel.size() == 1) {
|
|
|
+
|
|
|
+ Map<String,String> map = SubCodeUtil.getSubCode(SecurityUtils.getAreaCode());
|
|
|
+ int level = Integer.parseInt(map.get("level"));
|
|
|
+ if (level < 3 ) {
|
|
|
// 省自己提交/市提交
|
|
|
zwywXmsbCommon.setSbzt(XmsbStatus.SSH.getCode());
|
|
|
- } else if (deptLevel.size() == 2) {
|
|
|
+ } else {
|
|
|
// 区县提交 区为市审核/县,市为省审核----破弃
|
|
|
// 区县提交,被市退回两次后,直接提交至省级
|
|
|
List<ZwywXmsbBaxx> baxxList = zwywXmsbBaxxMapper.selectList(new LambdaQueryWrapper<ZwywXmsbBaxx>()
|
|
|
.eq(ZwywXmsbBaxx::getSbId, zwywXmsbCommon.getId()));
|
|
|
- long baxxCount = baxxList.stream().filter(b -> StringUtils.equals(b.getCreateUnit(),
|
|
|
- String.valueOf(SecurityUtils.getLoginUser().getSysUser().getDept().getParentId())))
|
|
|
- .filter(v -> StringUtils.equals(v.getBazt(), "3")).count();
|
|
|
+ long baxxCount = baxxList.stream().filter(b -> {
|
|
|
+ SysDeptJl deptJl = sysDeptJlMapper.selectSysDeptJlByCode(SecurityUtils.getAreaCode());
|
|
|
+ if (ObjectUtils.isNotEmpty(deptJl)) {
|
|
|
+ if (StringUtils.equals(sysDeptJlMapper.id2code(deptJl.getParentId()), b.getCreateAreaCode())) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }).filter(v -> StringUtils.equals(v.getBazt(), "3")).count();
|
|
|
// SysDeptJl dept = sysDeptJlMapper.selectSysDeptJlByCode(SecurityUtils.getAreaCode());
|
|
|
if (baxxCount > 1) {
|
|
|
zwywXmsbCommon.setSbzt(XmsbStatus.SSH.getCode());
|
|
@@ -340,6 +358,26 @@ public class ZwywXmsbCommonServiceImpl implements IZwywXmsbCommonService
|
|
|
zwywXmsbCommon.setSbzt(XmsbStatus.CSH.getCode());
|
|
|
}
|
|
|
}
|
|
|
+// List<String> deptLevel = Arrays.stream(SecurityUtils.getLoginUser().getSysUser().getDept().getAncestors()
|
|
|
+// .split(",")).collect(Collectors.toList());
|
|
|
+// if (deptLevel.size() == 1) {
|
|
|
+// // 省自己提交/市提交
|
|
|
+// zwywXmsbCommon.setSbzt(XmsbStatus.SSH.getCode());
|
|
|
+// } else if (deptLevel.size() == 2) {
|
|
|
+// // 区县提交 区为市审核/县,市为省审核----破弃
|
|
|
+// // 区县提交,被市退回两次后,直接提交至省级
|
|
|
+// List<ZwywXmsbBaxx> baxxList = zwywXmsbBaxxMapper.selectList(new LambdaQueryWrapper<ZwywXmsbBaxx>()
|
|
|
+// .eq(ZwywXmsbBaxx::getSbId, zwywXmsbCommon.getId()));
|
|
|
+// long baxxCount = baxxList.stream().filter(b -> StringUtils.equals(b.getCreateAreaCode(),
|
|
|
+// String.valueOf(SecurityUtils.getLoginUser().getSysUser().getDept().getParentId())))
|
|
|
+// .filter(v -> StringUtils.equals(v.getBazt(), "3")).count();
|
|
|
+//// SysDeptJl dept = sysDeptJlMapper.selectSysDeptJlByCode(SecurityUtils.getAreaCode());
|
|
|
+// if (baxxCount > 1) {
|
|
|
+// zwywXmsbCommon.setSbzt(XmsbStatus.SSH.getCode());
|
|
|
+// } else {
|
|
|
+// zwywXmsbCommon.setSbzt(XmsbStatus.CSH.getCode());
|
|
|
+// }
|
|
|
+// }
|
|
|
return zwywXmsbCommonMapper.updateById(zwywXmsbCommon);
|
|
|
}
|
|
|
|