Commit 28d4748f authored by fangxinjiang's avatar fangxinjiang

权限配置页面

parent ab491d0b
...@@ -23,6 +23,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; ...@@ -23,6 +23,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysArea; import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysArea;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysUser; import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysUser;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.AllUserNaVo; import com.yifu.cloud.plus.v1.yifu.admin.api.vo.AllUserNaVo;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.AreaMap;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.AreaVo; import com.yifu.cloud.plus.v1.yifu.admin.api.vo.AreaVo;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.SysUserListVo; import com.yifu.cloud.plus.v1.yifu.admin.api.vo.SysUserListVo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TCutsomerDataPermisson; import com.yifu.cloud.plus.v1.yifu.archives.entity.TCutsomerDataPermisson;
...@@ -49,7 +50,9 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -49,7 +50,9 @@ import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -140,49 +143,50 @@ public class TSettleDomainServiceImpl extends ServiceImpl<TSettleDomainMapper, T ...@@ -140,49 +143,50 @@ public class TSettleDomainServiceImpl extends ServiceImpl<TSettleDomainMapper, T
@Override @Override
public R updateProjectInfo(List<TSettleDomain> list) { public R updateProjectInfo(List<TSettleDomain> list) {
if (Common.isNotNull(list)) { if (Common.isNotNull(list)) {
R<AreaVo> areaListR; R<AreaMap> areaListR;
TSettleDomain tSettleDomainInfo; TSettleDomain tSettleDomainInfo;
areaListR = upmsDaprUtils.getAreaListR(); areaListR = upmsDaprUtils.getAreaMapR();
if (null == areaListR || areaListR.getCode() != CommonConstants.SUCCESS) { if (null == areaListR
|| areaListR.getCode() != CommonConstants.SUCCESS
|| Common.isEmpty(areaListR.getData())) {
return R.failed("获取区域数据失败!"); return R.failed("获取区域数据失败!");
} }
AreaVo areaList = areaListR.getData(); Map<String,String> areaMap = areaListR.getData().getLabelIdMap();
for (TSettleDomain tSettleDomain:list) { R<SysUserListVo> res;
if (null != areaList && !areaList.getSysAreaList().isEmpty()) { String errorStr;
for (SysArea area : areaList.getSysAreaList()) { for (TSettleDomain domain:list) {
if (Common.isNotNull(tSettleDomain.getEProvince()) && area.getAreaName().equals(tSettleDomain.getEProvince())) { // 校验必填项
tSettleDomain.setProvince(area.getId()); errorStr = checkInfo(domain);
} if (Common.isNotNull(errorStr)){
if (Common.isNotNull(tSettleDomain.getECity()) && area.getAreaName().equals(tSettleDomain.getECity())) { return R.failed(errorStr);
tSettleDomain.setCity(area.getId()); }
} // 初始化区域数据
if (Common.isNotNull(tSettleDomain.getETown()) && area.getAreaName().equals(tSettleDomain.getETown())) { R<Object> tSettleDomain1 = initAreaInfo(areaMap, domain);
tSettleDomain.setTown(area.getId()); if (tSettleDomain1 != null){
} return tSettleDomain1;
}
} }
tSettleDomainInfo = baseMapper.selectOne(Wrappers.<TSettleDomain>query().lambda() tSettleDomainInfo = baseMapper.selectOne(Wrappers.<TSettleDomain>query().lambda()
.eq(TSettleDomain::getDepartNo,tSettleDomain.getDepartNo()) .eq(TSettleDomain::getDepartNo,domain.getDepartNo())
.orderByDesc(BaseEntity::getCreateTime) .orderByDesc(BaseEntity::getCreateTime)
.last(CommonConstants.LAST_ONE_SQL)); .last(CommonConstants.LAST_ONE_SQL));
if (Common.isNotNull(tSettleDomainInfo)) { if (Common.isNotNull(tSettleDomainInfo)) {
tSettleDomain.setId(tSettleDomainInfo.getId()); domain.setId(tSettleDomainInfo.getId());
} }
// 处理服务团队数据权限 2022-09-19 fxj // 处理服务团队数据权限 2022-09-19 fxj
if (Common.isNotNull(tSettleDomain.getServiceTeam())){ if (Common.isNotNull(domain.getServiceTeam())){
R<SysUserListVo> res = upmsDaprUtils.getUserIdsByUserNames(tSettleDomain.getServiceTeam()); res = upmsDaprUtils.getUserIdsByUserNames(domain.getServiceTeam());
if (Common.isNotNull(res) && Common.isNotNull(res.getData()) && Common.isNotNull(res.getData().getUserList())){ if (Common.isNotNull(res) && Common.isNotNull(res.getData()) && Common.isNotNull(res.getData().getUserList())){
// 先清理缓存 // 先清理缓存
this.removeSettleCache(null,res.getData().getUserIds()); this.removeSettleCache(null,res.getData().getUserIds());
saveForEkp(res.getData().getUserList(), tSettleDomain); saveForEkp(res.getData().getUserList(), domain);
} }
} }
tSettleDomain.setDeleteFlag(CommonConstants.ZERO_STRING); domain.setDeleteFlag(CommonConstants.ZERO_STRING);
if (Common.isNotNull(tSettleDomainInfo)) { if (Common.isNotNull(tSettleDomainInfo)) {
baseMapper.updateById(tSettleDomain); baseMapper.updateById(domain);
} else { } else {
baseMapper.insert(tSettleDomain); baseMapper.insert(domain);
} }
} }
return R.ok(); return R.ok();
...@@ -191,6 +195,117 @@ public class TSettleDomainServiceImpl extends ServiceImpl<TSettleDomainMapper, T ...@@ -191,6 +195,117 @@ public class TSettleDomainServiceImpl extends ServiceImpl<TSettleDomainMapper, T
} }
} }
private String checkInfo(TSettleDomain domain) {
if (Common.isEmpty(domain.getMId())){
return "id 不可为空";
}
if (Common.isEmpty(domain.getDepartName())|| Common.isEmpty(domain.getDepartNo())){
return "项目编码及名称不可为空";
}
if (Common.isEmpty(domain.getCustomerName())
|| Common.isEmpty(domain.getCustomerId())
|| Common.isEmpty(domain.getCustomerNo())){
return "客户名称、客户编码、客户ID不可为空";
}
if (Common.isEmpty(domain.getBpoFlag())){
return "是否BPO业务不可为空";
}
if (Common.isEmpty(domain.getServerItem())){
return "服务项目不可为空";
}
if (Common.isEmpty(domain.getECity())
|| Common.isEmpty(domain.getEProvince())){
return "省市不可为空";
}
if ( Common.isEmpty(domain.getCreateType())){
return "创建类型不可为空";
}
if (Common.isEmpty(domain.getBusinessPrimaryType())
|| Common.isEmpty(domain.getBusinessSecondType())
|| Common.isEmpty(domain.getBusinessThirdType())){
return "业务类型、业务类型二级分类、业务类型三级分类不可为空";
}
if (Common.isEmpty(domain.getStopFlag())){
return "服务状态不可为空";
}
/*
我司到款单位名称 条件:当服务项目中有社保或公积金时必填
封面抬头-薪资 条件:当服务项目中有薪资时必填
封面抬头-商险 条件:当服务项目中有商险时必填 */
if (Common.isEmpty(domain.getServerItem())){
if (domain.getServerItem().indexOf("社保") != CommonConstants.ONE_INT_NEGATE){
if (Common.isEmpty(domain.getSocialType())){
return "社保结算类型不可为空";
}
if (Common.isEmpty(domain.getUnitOfOurCompany())){
return "我司到款单位不可为空";
}
}
if (domain.getServerItem().indexOf("公积金") != CommonConstants.ONE_INT_NEGATE){
if (Common.isEmpty(domain.getFundType())){
return "公积金结算类型不可为空";
}
if (Common.isEmpty(domain.getUnitOfOurCompany())){
return "我司到款单位不可为空";
}
}
if (domain.getServerItem().indexOf("商险") != CommonConstants.ONE_INT_NEGATE){
if (Common.isEmpty(domain.getInsuranceSettleType())){
return "商险结算类型不可为空";
}
if (Common.isEmpty(domain.getInvoiceTitleInsurance())){
return "封面台头-商险不可为空";
}
}
}
if (Common.isEmpty(domain.getManagementTag()) || Common.isEmpty(domain.getRiskFundTag())){
return "'管理费是否收费'及'风险金是否收取'不可为空";
}
if (CommonConstants.ZERO_STRING.equals(domain.getManagementTag())
&& Common.isEmpty(domain.getManageServerItem())){
return "管理费是否收费为是,管理费服务项目不可为空";
}
if (CommonConstants.ZERO_STRING.equals(domain.getRiskFundTag())
&& Common.isEmpty(domain.getRiskServerItem())){
return "风险金是否收取为是,风险金服务项目不可为空";
}
if (Common.isEmpty(domain.getMrSettleType())){
return "结算方式(管理费、风险金)不可为空";
}
return null;
}
private R<Object> initAreaInfo(Map<String, String> areaMap, TSettleDomain tSettleDomain) {
String areaId;
if (Common.isNotNull(areaMap)) {
if (Common.isNotNull(tSettleDomain.getEProvince())){
areaId = areaMap.get(tSettleDomain.getEProvince());
if (Common.isNotNull(areaId)){
tSettleDomain.setProvince(Integer.parseInt(areaId));
}else {
return R.failed("获取区域数据失败:" + tSettleDomain.getEProvince());
}
}
if (Common.isNotNull(tSettleDomain.getECity())){
areaId = areaMap.get(tSettleDomain.getECity());
if (Common.isNotNull(areaId)){
tSettleDomain.setCity(Integer.parseInt(areaId));
}else {
return R.failed("获取区域数据失败:" + tSettleDomain.getECity());
}
}
if (Common.isNotNull(tSettleDomain.getETown())){
areaId = areaMap.get(tSettleDomain.getETown());
if (Common.isNotNull(areaId)){
tSettleDomain.setTown(Integer.parseInt(areaId));
}else {
return R.failed("获取区域数据失败:" + tSettleDomain.getETown());
}
}
}
return null;
}
@Override @Override
public SetInfoVo getSetInfoByCodes(List<String> codes) { public SetInfoVo getSetInfoByCodes(List<String> codes) {
List<ProjectSetInfoVo> voList = baseMapper.getSetInfoByCodes(codes); List<ProjectSetInfoVo> voList = baseMapper.getSetInfoByCodes(codes);
......
package com.yifu.cloud.plus.v1.yifu.common.dapr.util; package com.yifu.cloud.plus.v1.yifu.common.dapr.util;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.AllUserNaVo; import com.yifu.cloud.plus.v1.yifu.admin.api.vo.AllUserNaVo;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.AreaMap;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.AreaVo; import com.yifu.cloud.plus.v1.yifu.admin.api.vo.AreaVo;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.SysUserListVo; import com.yifu.cloud.plus.v1.yifu.admin.api.vo.SysUserListVo;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants; import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants;
...@@ -37,6 +38,19 @@ public class UpmsDaprUtils { ...@@ -37,6 +38,19 @@ public class UpmsDaprUtils {
} }
return areaListR; return areaListR;
} }
/**
* 获取所有区域数据
* @Author huyc
* @Date 2022-07-18
* @return
**/
public R<AreaMap> getAreaMapR() {
R<AreaMap> areaListR = HttpDaprUtil.invokeMethodPost(daprUpmsProperties.getAppUrl(),daprUpmsProperties.getAppId(),"/area/inner/getAreaMap","", AreaMap.class, SecurityConstants.FROM_IN);
if (Common.isEmpty(areaListR)){
return R.failed("获取所有区域数据失败!");
}
return areaListR;
}
/** /**
* @Author fxj * @Author fxj
......
...@@ -3,7 +3,6 @@ package com.yifu.cloud.plus.v1.yifu.admin.api.vo; ...@@ -3,7 +3,6 @@ package com.yifu.cloud.plus.v1.yifu.admin.api.vo;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysArea; import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysArea;
import lombok.Data; import lombok.Data;
import java.util.HashMap;
import java.util.Map; import java.util.Map;
/** /**
...@@ -14,7 +13,7 @@ import java.util.Map; ...@@ -14,7 +13,7 @@ import java.util.Map;
*/ */
@Data @Data
public class AreaMap { public class AreaMap {
private Map<String, SysArea> idLabelMap; private Map<String, String> idLabelMap;
private Map<String, SysArea> labelIdMap; private Map<String, String> labelIdMap;
} }
...@@ -115,17 +115,17 @@ public class AreaController { ...@@ -115,17 +115,17 @@ public class AreaController {
* @Author: hyc * @Author: hyc
* @Date: 2022-7-21 19:45:24 * @Date: 2022-7-21 19:45:24
**/ **/
//@Inner @Inner
@PostMapping("/getAreaMap") @PostMapping("/inner/getAreaMap")
public AreaMap getAreaMap() { public AreaMap getAreaMap() {
Map<String, SysArea> idLabelMap = (Map<String, SysArea>) redisUtil.get(CacheConstants.AREA_LABEL_GROUP); Map<String, String> idLabelMap = (Map<String, String>) redisUtil.get(CacheConstants.AREA_LABEL_GROUP);
Map<String, SysArea> labelIdMap = (Map<String, SysArea>) redisUtil.get(CacheConstants.AREA_VALUE_GROUP); Map<String, String> labelIdMap = (Map<String, String>) redisUtil.get(CacheConstants.AREA_VALUE_GROUP);
if (Common.isEmpty(idLabelMap) || Common.isEmpty(labelIdMap)){ if (Common.isEmpty(idLabelMap) || Common.isEmpty(labelIdMap)){
initAreaRedis(); initAreaRedis();
} }
AreaMap map = new AreaMap(); AreaMap map = new AreaMap();
idLabelMap = (Map<String, SysArea>) redisUtil.get(CacheConstants.AREA_LABEL_GROUP); idLabelMap = (Map<String, String>) redisUtil.get(CacheConstants.AREA_LABEL_GROUP);
labelIdMap = (Map<String, SysArea>) redisUtil.get(CacheConstants.AREA_VALUE_GROUP); labelIdMap = (Map<String, String>) redisUtil.get(CacheConstants.AREA_VALUE_GROUP);
map.setIdLabelMap(idLabelMap); map.setIdLabelMap(idLabelMap);
map.setLabelIdMap(labelIdMap); map.setLabelIdMap(labelIdMap);
return map; return map;
...@@ -135,24 +135,26 @@ public class AreaController { ...@@ -135,24 +135,26 @@ public class AreaController {
List<SysArea> allAreas = sysAreaService.getAllArea(); List<SysArea> allAreas = sysAreaService.getAllArea();
if (Common.isNotNull(allAreas)) { if (Common.isNotNull(allAreas)) {
Map<String, SysArea> areaMap = new HashMap<>(); Map<String, SysArea> areaMap = new HashMap<>();
Map<String, String> idLabelMap = new HashMap<>();
for (SysArea area : allAreas) { for (SysArea area : allAreas) {
redisUtil.set(CacheConstants.AREA_LABEL
+ area.getId(), area.getAreaName());
areaMap.put(area.getId().toString(), area); areaMap.put(area.getId().toString(), area);
idLabelMap.put(area.getId().toString(), area.getAreaName());
} }
redisUtil.set(CacheConstants.AREA_LABEL_GROUP,idLabelMap);
SysArea temp; SysArea temp;
Map<String, String> labelIdMap = new HashMap<>();
for (SysArea area : allAreas) { for (SysArea area : allAreas) {
if (Common.isNotNull(area.getParentId()) && area.getParentId().intValue() > 0) { if (Common.isNotNull(area.getParentId()) && area.getParentId().intValue() > 0) {
temp = areaMap.get(area.getParentId().toString()); temp = areaMap.get(area.getParentId().toString());
redisUtil.set(CacheConstants.AREA_VALUE labelIdMap.put(area.getAreaName()
+ area.getAreaName()
+ CommonConstants.DOWN_LINE_STRING + CommonConstants.DOWN_LINE_STRING
+ (Common.isNotNull(temp) ? temp.getAreaName() : ""), area.getId()); + (Common.isNotNull(temp) ? temp.getAreaName() : ""), area.getId().toString());
} else { } else {
redisUtil.set(CacheConstants.AREA_VALUE labelIdMap.put(CacheConstants.AREA_VALUE
+ area.getAreaName(), area.getId()); + area.getAreaName(), area.getId().toString());
} }
} }
redisUtil.set(CacheConstants.AREA_VALUE_GROUP,labelIdMap);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment