Commit ccb3c897 authored by DESKTOP-BQLVS7A\admin's avatar DESKTOP-BQLVS7A\admin

优化焊工弹窗统计接口(权限)

parent d8ac863a
package com.yeejoin.amos.boot.module.ugp.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.context.annotation.Bean;
import java.util.List;
import java.util.Map;
import java.util.Set;
public interface WelderMapper extends BaseMapper {
List<Map> welderStatistics(String bizOrgCode);
List<Map> welderStatistics(@Param("personCode") Set<String> personCode);
}
......@@ -8,7 +8,14 @@
FROM
cb_org_usr AS ou
LEFT JOIN cb_dynamic_form_instance AS fi ON ou.sequence_nbr = fi.instance_id and fi.field_code = "licensedProject"
WHERE ou.org_expand_attr1 = "WELDER" AND ou.biz_org_type="PERSON" AND ou.biz_org_code LIKE CONCAT("%",#{bizOrgCode},"%")
WHERE ou.org_expand_attr1 = "WELDER" AND ou.biz_org_type="PERSON"
<if test="personCode!=null and personCode.size>0">
AND (
<foreach collection="personCode" index="index" item="item" close="" open="" separator="or">
ou.biz_org_code LIKE CONCAT("%",#{item},"%")
</foreach>
)
</if>
GROUP BY fi.field_value
</select>
......
......@@ -258,7 +258,7 @@ public class WelderController extends BaseController {
* 焊工持证项目统计
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(httpMethod = "GET", value = "焊工持证项目统计", notes = "焊工持证项目统计")
@GetMapping(value = "/welderStatistics")
public ResponseModel<List<Map>> welderStatistics() {
......
......@@ -250,15 +250,12 @@ public class EquipmentServiceImpl extends BaseService<EquipmentDto, Equipment, E
//设备管理->信息统计
@BusinessIdentify
public List<Map<String,Long>> informationStatistics() {
// List<Map<String,Long>> D = new ArrayList<>();
// Map<String,Long> w = new HashMap<>();
Set<String> strings = new HashSet<>();
Set<String> companyIds = new HashSet<>();
Long companySequenceNbr = orgService.getReginParams().getBusinessInfo().getCompanySequenceNbr();
if(companyMapper.selectById(companySequenceNbr).getType().equals(OrgEnum.安装单位.getKey())){
LambdaQueryWrapper<Equipment> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(Equipment::getSequenceNbr,companySequenceNbr);
strings.add(String.valueOf(companySequenceNbr));
} else if (companyMapper.selectById(companySequenceNbr).getType().equals(OrgEnum.监检机构.getKey())) {
String companyKey = companyMapper.selectById(companySequenceNbr).getType();
if(companyKey.equals(OrgEnum.安装单位.getKey())){
companyIds.add(String.valueOf(companySequenceNbr));
} else if (companyKey.equals(OrgEnum.监检机构.getKey())) {
LambdaQueryWrapper<SuperviseRule> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SuperviseRule::getInspectionUnitId,companySequenceNbr);
List<SuperviseRule> inspectionLists = superviseRuleMapper.selectList(wrapper);
......@@ -267,11 +264,11 @@ public class EquipmentServiceImpl extends BaseService<EquipmentDto, Equipment, E
wrapper1.eq(Company::getRegionCode,inspectionList.getAdminRegionCode());
List<Company> codeLists = companyMapper.selectList(wrapper1);
for(Company codeList : codeLists){
strings.add(String.valueOf(codeList.getSequenceNbr()));
companyIds.add(String.valueOf(codeList.getSequenceNbr()));
}
}
} else if (companyMapper.selectById(companySequenceNbr).getType().equals(OrgEnum.监察部门.getKey())) {
} else if (companyKey.equals(OrgEnum.监察部门.getKey())) {
LambdaQueryWrapper<SuperviseRule> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SuperviseRule::getSuperviseDeptId, companySequenceNbr);
List<SuperviseRule> superviseLists = superviseRuleMapper.selectList(wrapper);
......@@ -280,12 +277,12 @@ public class EquipmentServiceImpl extends BaseService<EquipmentDto, Equipment, E
wrapper1.eq(Company::getRegionCode, inspectionList.getAdminRegionCode());
List<Company> codeLists = companyMapper.selectList(wrapper1);
for (Company codeList : codeLists) {
strings.add(String.valueOf(codeList.getSequenceNbr()));
companyIds.add(String.valueOf(codeList.getSequenceNbr()));
}
}
}
return equipmentMapper.informationStatistics(strings);
return equipmentMapper.informationStatistics(companyIds);
}
}
\ No newline at end of file
......@@ -12,6 +12,7 @@ import com.yeejoin.amos.boot.module.ugp.api.Enum.OrgEnum;
import com.yeejoin.amos.boot.module.ugp.api.Enum.ProjectResourceEnum;
import com.yeejoin.amos.boot.module.ugp.api.entity.Project;
import com.yeejoin.amos.boot.module.ugp.api.entity.ProjectResource;
import com.yeejoin.amos.boot.module.ugp.api.mapper.CompanyMapper;
import com.yeejoin.amos.boot.module.ugp.api.mapper.WelderMapper;
import com.yeejoin.amos.boot.module.ugp.biz.framework.BusinessIdentify;
import com.yeejoin.amos.feign.privilege.Privilege;
......@@ -47,6 +48,11 @@ public class WelderServiceImpl {
@Autowired
WelderMapper welderMapper;
@Autowired
CompanyMapper companyMapper;
/**
* 获取当前登录所在单位下的项目中的所有焊工列表
* @return
......@@ -167,7 +173,28 @@ public class WelderServiceImpl {
@BusinessIdentify
public List<Map> welderStatistics() {
String bizOrgCode = orgUsrService.getById(orgService.getReginParams().getBusinessInfo().getCompanySequenceNbr()).getBizOrgCode();
return welderMapper.welderStatistics(bizOrgCode);
Set<String> personCode = new HashSet<>();
Long companyIds = orgService.getReginParams().getBusinessInfo().getCompanySequenceNbr();
String bizOrgCode = orgUsrService.getById(companyIds).getBizOrgCode();
String companyKey = companyMapper.selectById(companyIds).getType();
if(companyKey.equals(OrgEnum.安装单位.getKey())){
personCode.add(String.valueOf(bizOrgCode));
} else if (companyKey.equals(OrgEnum.监检机构.getKey())) {
LambdaQueryWrapper<OrgUsr> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(OrgUsr::getBizOrgCode,orgUsrService.getById(companyIds).getBizOrgCode());
List<OrgUsr> selectCodes = orgUsrService.list(wrapper);
for(OrgUsr selectCode : selectCodes){
personCode.add(String.valueOf(selectCode.getBizOrgCode()));
}
} else if (companyKey.equals(OrgEnum.监察部门.getKey())) {
LambdaQueryWrapper<OrgUsr> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(OrgUsr::getSequenceNbr,orgUsrService.getById(companyIds).getParentId());
List<OrgUsr> selectCodes = orgUsrService.list(wrapper);
for(OrgUsr selectCode : selectCodes){
personCode.add(String.valueOf(selectCode.getBizOrgCode()));
}
}
return welderMapper.welderStatistics(personCode);
}
}
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