|
|
|
@ -17,9 +17,12 @@ import cn.hutool.core.convert.Convert; |
|
|
|
import cn.hutool.core.util.IdUtil; |
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.zdxt.auth.dto.DeptBean; |
|
|
|
import com.zdxt.auth.dto.RoleBean; |
|
|
|
import com.zdxt.auth.dto.UserBean; |
|
|
|
import com.zdxt.auth.feign.FileUploadApi; |
|
|
|
import com.zdxt.auth.feign.UserApi; |
|
|
|
import com.zdxt.auth.project.system.dept.mapper.DeptMapper; |
|
|
|
import com.zdxt.auth.project.system.dict.mapper.DictDataMapper; |
|
|
|
import com.zdxt.code.domain.*; |
|
|
|
import com.zdxt.code.service.IEnterpriseMerchantAuthorizationService; |
|
|
|
@ -28,11 +31,17 @@ import com.zdxt.code.service.ISsztJbxx110497Service; |
|
|
|
import com.zdxt.code.utils.CrawlerUtil; |
|
|
|
import com.zdxt.code.utils.PasswordTools; |
|
|
|
import com.zdxt.code.utils.QRCodeUtil; |
|
|
|
import com.zdxt.common.annotation.DataScope; |
|
|
|
import com.zdxt.common.util.DateUtils; |
|
|
|
import com.zdxt.common.util.StringUtils; |
|
|
|
import com.zdxt.domain.auth.Dept; |
|
|
|
import com.zdxt.domain.auth.DictData; |
|
|
|
import com.zdxt.domain.auth.Role; |
|
|
|
import io.swagger.models.auth.In; |
|
|
|
import org.apache.commons.collections.CollectionUtils; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
import org.springframework.beans.BeanUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
@ -79,6 +88,9 @@ public class EnterpriseInformationServiceImpl implements IEnterpriseInformationS |
|
|
|
@Autowired |
|
|
|
private DictDataMapper dictDataMapper; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private DeptMapper deptMapper; |
|
|
|
|
|
|
|
/** |
|
|
|
* 查询企业信息登记 |
|
|
|
* |
|
|
|
@ -134,6 +146,109 @@ public class EnterpriseInformationServiceImpl implements IEnterpriseInformationS |
|
|
|
return enterpriseInformationMapper.selectEnterpriseInformationList1(enterpriseInformation); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Map selectEnterpriseInformationList2(EnterpriseInformation enterpriseInformation) { |
|
|
|
List<StatisticsIndicator> statisticsIndicatorList = new ArrayList<>(); |
|
|
|
Map<String,Integer> map= new HashMap<>(); |
|
|
|
int allCompany = 0; |
|
|
|
int exCompany = 0; |
|
|
|
int loCompany = 0; |
|
|
|
List<EnterpriseInformation> enterpriseInformationList = |
|
|
|
enterpriseInformationMapper.selectEnterpriseInformationList1(enterpriseInformation); |
|
|
|
List<String> qyNameList = new ArrayList<>(); |
|
|
|
List<DictData> dictDataListQY = dictDataMapper.selectDictDataByType("address_type"); |
|
|
|
for (DictData dictData : dictDataListQY) { |
|
|
|
qyNameList.add(dictData.getDictLabel()); |
|
|
|
} |
|
|
|
List<DeptBean> checkDept = check(enterpriseInformation); |
|
|
|
for (int i=0;i< qyNameList.size();i++) { |
|
|
|
String qy= qyNameList.get(i); |
|
|
|
StatisticsIndicator s = new StatisticsIndicator(); |
|
|
|
System.out.println(qy.substring(0, qy.indexOf("区"))); |
|
|
|
List<EnterpriseInformation> qyList = enterpriseInformationList.stream().filter(item -> item.getEnterpriseAddress().startsWith("深圳市" + qy.substring(0, qy.indexOf("区")) + "区") || item.getEnterpriseAddress().startsWith("深圳市" + qy.substring(0, qy.indexOf("区")) + "新区")).collect(Collectors.toList()); |
|
|
|
List<EnterpriseInformation> existList = qyList.stream().filter(item -> item.getIsUnsubscribe() == 0).collect(Collectors.toList()); |
|
|
|
List<EnterpriseInformation> logoutList = qyList.stream().filter(item -> item.getIsUnsubscribe() == 1).collect(Collectors.toList()); |
|
|
|
s.setName(qy); |
|
|
|
s.setSort(i); |
|
|
|
s.setTotalNumber(qyList.size()); |
|
|
|
s.setNumInt(existList.size()); |
|
|
|
s.setValue(logoutList.size()); |
|
|
|
if (checkDept == null){ |
|
|
|
allCompany = allCompany + qyList.size(); |
|
|
|
exCompany = exCompany + existList.size(); |
|
|
|
loCompany = loCompany + logoutList.size(); |
|
|
|
statisticsIndicatorList.add(s); |
|
|
|
}else if (checkDept.size()!=0 && checkDept.stream().anyMatch(e -> e.getDeptName().equals(qy))) { |
|
|
|
allCompany = allCompany + qyList.size(); |
|
|
|
exCompany = exCompany + existList.size(); |
|
|
|
loCompany = loCompany + logoutList.size(); |
|
|
|
statisticsIndicatorList.add(s); |
|
|
|
} |
|
|
|
enterpriseInformationList = enterpriseInformationList.stream().filter(item -> !item.getEnterpriseAddress().startsWith("深圳市" + qy.substring(0, qy.indexOf("区")) + "区") && !item.getEnterpriseAddress().startsWith("深圳市" + qy.substring(0, qy.indexOf("区")) + "新区")).collect(Collectors.toList()); |
|
|
|
} |
|
|
|
//其他
|
|
|
|
if (enterpriseInformationList.size()>0) { |
|
|
|
List<EnterpriseInformation> existList = enterpriseInformationList.stream().filter(item -> item.getIsUnsubscribe() == 0).collect(Collectors.toList()); |
|
|
|
List<EnterpriseInformation> logoutList = enterpriseInformationList.stream().filter(item -> item.getIsUnsubscribe() == 1).collect(Collectors.toList()); |
|
|
|
allCompany = allCompany + enterpriseInformationList.size(); |
|
|
|
exCompany = exCompany + existList.size(); |
|
|
|
loCompany = loCompany + logoutList.size(); |
|
|
|
} |
|
|
|
map.put("all",allCompany); |
|
|
|
map.put("ex",exCompany); |
|
|
|
map.put("lo",loCompany); |
|
|
|
return map; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public List<DeptBean> check(EnterpriseInformation enterpriseInformation) { |
|
|
|
UserBean currentUser = userApi.getCurrentUser(); |
|
|
|
List<DeptBean> deptBeans = new ArrayList<>(); |
|
|
|
if (currentUser.isAdmin()){ |
|
|
|
return null; |
|
|
|
} |
|
|
|
for (RoleBean role : currentUser.getRoles()) { |
|
|
|
String dataScope = role.getDataScope(); |
|
|
|
if ("1".equals(dataScope)) { |
|
|
|
//全部可见
|
|
|
|
return null; |
|
|
|
}else if ("2".equals(dataScope)) { |
|
|
|
//自定义权限 SELECT dept_id, dept_name FROM sys_role_dept WHERE role_id = {}
|
|
|
|
List<Dept> depts = deptMapper.selectDeptByRoleId(role.getRoleId()); |
|
|
|
if (CollectionUtils.isNotEmpty(depts)){ |
|
|
|
for (Dept dept : depts) { |
|
|
|
DeptBean deptBean = new DeptBean(); |
|
|
|
BeanUtils.copyProperties(dept,deptBean); |
|
|
|
deptBeans.add(deptBean); |
|
|
|
} |
|
|
|
} |
|
|
|
} else if ("3".equals(dataScope)) { |
|
|
|
//部门数据权限 SELECT dept_id, dept_name FROM sys_dept WHERE dept_id = {}
|
|
|
|
Dept dept = deptMapper.selectDeptById(currentUser.getDeptId()); |
|
|
|
if (Objects.nonNull(dept)){ |
|
|
|
DeptBean deptBean = new DeptBean(); |
|
|
|
BeanUtils.copyProperties(dept,deptBean); |
|
|
|
deptBeans.add(deptBean); |
|
|
|
} |
|
|
|
} else if ("4".equals(dataScope)) { |
|
|
|
//部门及以下数据权限 SELECT dept_id FROM sys_dept WHERE dept_id = '{}' or find_in_set( '{}' , ancestors ) <> 0
|
|
|
|
List<Dept> depts = deptMapper.selectSelfAndChildrenById(currentUser.getDeptId()); |
|
|
|
if (CollectionUtils.isNotEmpty(depts)){ |
|
|
|
for (Dept dept : depts) { |
|
|
|
DeptBean deptBean = new DeptBean(); |
|
|
|
BeanUtils.copyProperties(dept,deptBean); |
|
|
|
deptBeans.add(deptBean); |
|
|
|
} |
|
|
|
} |
|
|
|
} else if ("5".equals(dataScope)) { |
|
|
|
//仅本人数据权限 不给看
|
|
|
|
return deptBeans; |
|
|
|
} |
|
|
|
} |
|
|
|
return deptBeans; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<EnterpriseInformation> selectEnterpriseInformationAndQrInfo(EnterpriseInformation enterpriseInformation) { |
|
|
|
return enterpriseInformationMapper.selectEnterpriseInformationAndQrInfo(enterpriseInformation); |
|
|
|
@ -584,11 +699,12 @@ public class EnterpriseInformationServiceImpl implements IEnterpriseInformationS |
|
|
|
if(searchType.getEnterpriseAddress()!=null&&!searchType.getEnterpriseAddress().equals("")){ |
|
|
|
enterpriseInformation.setEnterpriseAddress(searchType.getEnterpriseAddress()); |
|
|
|
} |
|
|
|
List<EnterpriseInformation> enterpriseInformationList = enterpriseInformationMapper.selectEnterpriseInformationList1(enterpriseInformation); |
|
|
|
List<EnterpriseInformation> enterpriseInformationList = this.selectEnterpriseInformationList1(enterpriseInformation); |
|
|
|
if(searchType.getCompanyOrgType()!=null&&!searchType.getCompanyOrgType().equals("")){ |
|
|
|
String companyOrgType=dictDataMapper.selectDictLabel("enterpriseType",searchType.getCompanyOrgType()); |
|
|
|
enterpriseInformationList=enterpriseInformationList.stream().filter(item->item.getCompanyOrgType().contains(companyOrgType)).collect(Collectors.toList()); |
|
|
|
} |
|
|
|
List<DeptBean> checkDept = check(enterpriseInformation); |
|
|
|
for (int i=0;i< qyNameList.size();i++) { |
|
|
|
String qy= qyNameList.get(i); |
|
|
|
StatisticsIndicator s = new StatisticsIndicator(); |
|
|
|
@ -601,7 +717,11 @@ public class EnterpriseInformationServiceImpl implements IEnterpriseInformationS |
|
|
|
s.setTotalNumber(qyList.size()); |
|
|
|
s.setNumInt(existList.size()); |
|
|
|
s.setValue(logoutList.size()); |
|
|
|
statisticsIndicatorList.add(s); |
|
|
|
if (checkDept == null){ |
|
|
|
statisticsIndicatorList.add(s); |
|
|
|
}else if (checkDept.size()!=0 && checkDept.stream().anyMatch(e -> e.getDeptName().equals(qy))) { |
|
|
|
statisticsIndicatorList.add(s); |
|
|
|
} |
|
|
|
enterpriseInformationList = enterpriseInformationList.stream().filter(item -> !item.getEnterpriseAddress().startsWith("深圳市" + qy.substring(0, qy.indexOf("区")) + "区") && !item.getEnterpriseAddress().startsWith("深圳市" + qy.substring(0, qy.indexOf("区")) + "新区")).collect(Collectors.toList()); |
|
|
|
} |
|
|
|
if (enterpriseInformationList.size() > 0) { |
|
|
|
@ -637,6 +757,7 @@ public class EnterpriseInformationServiceImpl implements IEnterpriseInformationS |
|
|
|
String companyOrgType=dictDataMapper.selectDictLabel("enterpriseType",searchType.getCompanyOrgType()); |
|
|
|
enterpriseInformationList=enterpriseInformationList.stream().filter(item->item.getCompanyOrgType().contains(companyOrgType)).collect(Collectors.toList()); |
|
|
|
} |
|
|
|
List<DeptBean> checkDept = check(enterpriseInformation); |
|
|
|
String qyName = searchType.getName(); |
|
|
|
DictData dictData = new DictData(); |
|
|
|
dictData.setDictType("address_type"); |
|
|
|
@ -655,7 +776,12 @@ public class EnterpriseInformationServiceImpl implements IEnterpriseInformationS |
|
|
|
s.setTotalNumber(jdList.size()); |
|
|
|
s.setNumInt(existList.size()); |
|
|
|
s.setValue(logoutList.size()); |
|
|
|
statisticsIndicatorList.add(s); |
|
|
|
if (checkDept == null){ |
|
|
|
statisticsIndicatorList.add(s); |
|
|
|
}else if (checkDept.size()!=0 && checkDept.stream().anyMatch(e -> e.getDeptName().equals(jdName))) { |
|
|
|
statisticsIndicatorList.add(s); |
|
|
|
} |
|
|
|
// statisticsIndicatorList.add(s);
|
|
|
|
enterpriseInformationList = enterpriseInformationList.stream().filter(item -> !item.getEnterpriseAddress().startsWith("深圳市" + qyName.substring(0, qyName.indexOf("区")) + "区" + jdName) && !item.getEnterpriseAddress().startsWith("深圳市" + qyName.substring(0, qyName.indexOf("区")) + "新区" + jdName)).collect(Collectors.toList()); |
|
|
|
} |
|
|
|
if (enterpriseInformationList.size() > 0) { |
|
|
|
|