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

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

parent d8ac863a
package com.yeejoin.amos.boot.module.ugp.api.mapper; package com.yeejoin.amos.boot.module.ugp.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; 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.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
public interface WelderMapper extends BaseMapper { public interface WelderMapper extends BaseMapper {
List<Map> welderStatistics(String bizOrgCode); List<Map> welderStatistics(@Param("personCode") Set<String> personCode);
} }
...@@ -8,7 +8,14 @@ ...@@ -8,7 +8,14 @@
FROM FROM
cb_org_usr AS ou 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" 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 GROUP BY fi.field_value
</select> </select>
......
...@@ -258,7 +258,7 @@ public class WelderController extends BaseController { ...@@ -258,7 +258,7 @@ public class WelderController extends BaseController {
* 焊工持证项目统计 * 焊工持证项目统计
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(httpMethod = "GET", value = "焊工持证项目统计", notes = "焊工持证项目统计") @ApiOperation(httpMethod = "GET", value = "焊工持证项目统计", notes = "焊工持证项目统计")
@GetMapping(value = "/welderStatistics") @GetMapping(value = "/welderStatistics")
public ResponseModel<List<Map>> welderStatistics() { public ResponseModel<List<Map>> welderStatistics() {
......
...@@ -250,15 +250,12 @@ public class EquipmentServiceImpl extends BaseService<EquipmentDto, Equipment, E ...@@ -250,15 +250,12 @@ public class EquipmentServiceImpl extends BaseService<EquipmentDto, Equipment, E
//设备管理->信息统计 //设备管理->信息统计
@BusinessIdentify @BusinessIdentify
public List<Map<String,Long>> informationStatistics() { public List<Map<String,Long>> informationStatistics() {
// List<Map<String,Long>> D = new ArrayList<>(); Set<String> companyIds = new HashSet<>();
// Map<String,Long> w = new HashMap<>();
Set<String> strings = new HashSet<>();
Long companySequenceNbr = orgService.getReginParams().getBusinessInfo().getCompanySequenceNbr(); Long companySequenceNbr = orgService.getReginParams().getBusinessInfo().getCompanySequenceNbr();
if(companyMapper.selectById(companySequenceNbr).getType().equals(OrgEnum.安装单位.getKey())){ String companyKey = companyMapper.selectById(companySequenceNbr).getType();
LambdaQueryWrapper<Equipment> wrapper = new LambdaQueryWrapper<>(); if(companyKey.equals(OrgEnum.安装单位.getKey())){
wrapper.eq(Equipment::getSequenceNbr,companySequenceNbr); companyIds.add(String.valueOf(companySequenceNbr));
strings.add(String.valueOf(companySequenceNbr)); } else if (companyKey.equals(OrgEnum.监检机构.getKey())) {
} else if (companyMapper.selectById(companySequenceNbr).getType().equals(OrgEnum.监检机构.getKey())) {
LambdaQueryWrapper<SuperviseRule> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<SuperviseRule> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SuperviseRule::getInspectionUnitId,companySequenceNbr); wrapper.eq(SuperviseRule::getInspectionUnitId,companySequenceNbr);
List<SuperviseRule> inspectionLists = superviseRuleMapper.selectList(wrapper); List<SuperviseRule> inspectionLists = superviseRuleMapper.selectList(wrapper);
...@@ -267,11 +264,11 @@ public class EquipmentServiceImpl extends BaseService<EquipmentDto, Equipment, E ...@@ -267,11 +264,11 @@ public class EquipmentServiceImpl extends BaseService<EquipmentDto, Equipment, E
wrapper1.eq(Company::getRegionCode,inspectionList.getAdminRegionCode()); wrapper1.eq(Company::getRegionCode,inspectionList.getAdminRegionCode());
List<Company> codeLists = companyMapper.selectList(wrapper1); List<Company> codeLists = companyMapper.selectList(wrapper1);
for(Company codeList : codeLists){ 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<>(); LambdaQueryWrapper<SuperviseRule> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SuperviseRule::getSuperviseDeptId, companySequenceNbr); wrapper.eq(SuperviseRule::getSuperviseDeptId, companySequenceNbr);
List<SuperviseRule> superviseLists = superviseRuleMapper.selectList(wrapper); List<SuperviseRule> superviseLists = superviseRuleMapper.selectList(wrapper);
...@@ -280,12 +277,12 @@ public class EquipmentServiceImpl extends BaseService<EquipmentDto, Equipment, E ...@@ -280,12 +277,12 @@ public class EquipmentServiceImpl extends BaseService<EquipmentDto, Equipment, E
wrapper1.eq(Company::getRegionCode, inspectionList.getAdminRegionCode()); wrapper1.eq(Company::getRegionCode, inspectionList.getAdminRegionCode());
List<Company> codeLists = companyMapper.selectList(wrapper1); List<Company> codeLists = companyMapper.selectList(wrapper1);
for (Company codeList : codeLists) { 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; ...@@ -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.Enum.ProjectResourceEnum;
import com.yeejoin.amos.boot.module.ugp.api.entity.Project; 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.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.api.mapper.WelderMapper;
import com.yeejoin.amos.boot.module.ugp.biz.framework.BusinessIdentify; import com.yeejoin.amos.boot.module.ugp.biz.framework.BusinessIdentify;
import com.yeejoin.amos.feign.privilege.Privilege; import com.yeejoin.amos.feign.privilege.Privilege;
...@@ -47,6 +48,11 @@ public class WelderServiceImpl { ...@@ -47,6 +48,11 @@ public class WelderServiceImpl {
@Autowired @Autowired
WelderMapper welderMapper; WelderMapper welderMapper;
@Autowired
CompanyMapper companyMapper;
/** /**
* 获取当前登录所在单位下的项目中的所有焊工列表 * 获取当前登录所在单位下的项目中的所有焊工列表
* @return * @return
...@@ -167,7 +173,28 @@ public class WelderServiceImpl { ...@@ -167,7 +173,28 @@ public class WelderServiceImpl {
@BusinessIdentify @BusinessIdentify
public List<Map> welderStatistics() { public List<Map> welderStatistics() {
String bizOrgCode = orgUsrService.getById(orgService.getReginParams().getBusinessInfo().getCompanySequenceNbr()).getBizOrgCode(); Set<String> personCode = new HashSet<>();
return welderMapper.welderStatistics(bizOrgCode); 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