Commit 5f123bd6 authored by zhangyingbin's avatar zhangyingbin

Merge branch 'developer' of http://39.98.45.134:8090/moa/amos-boot-biz into developer

parents 45d07948 58b8af11
package com.yeejoin.amos.boot.module.ugp.api.dto;
import lombok.Data;
import org.apache.poi.hpsf.Decimal;
/**
* @Author cpp
* @Description
* @Date 2022/12/14
*/
@Data
public class ProjectProcessDto {
private static final long serialVersionUID = 1L;
private String projectName;
private Double projectProcess;
}
...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; ...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.ugp.api.dto.EquipmentDto; import com.yeejoin.amos.boot.module.ugp.api.dto.EquipmentDto;
import com.yeejoin.amos.boot.module.ugp.api.dto.ProjectDto; import com.yeejoin.amos.boot.module.ugp.api.dto.ProjectDto;
import com.yeejoin.amos.boot.module.ugp.api.dto.ProjectProcessDto;
import com.yeejoin.amos.boot.module.ugp.api.entity.Equipment; import com.yeejoin.amos.boot.module.ugp.api.entity.Equipment;
import com.yeejoin.amos.boot.module.ugp.api.entity.Project; import com.yeejoin.amos.boot.module.ugp.api.entity.Project;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
...@@ -54,4 +55,6 @@ public interface ProjectMapper extends BaseMapper<Project> { ...@@ -54,4 +55,6 @@ public interface ProjectMapper extends BaseMapper<Project> {
* @return * @return
*/ */
List<Map<String,String>> getProjectComplete(@Param("projectIds") Set<Long> projectIds); List<Map<String,String>> getProjectComplete(@Param("projectIds") Set<Long> projectIds);
ProjectProcessDto getProjectProcessDto(Long sequenceNbr);
} }
...@@ -269,4 +269,15 @@ ...@@ -269,4 +269,15 @@
GROUP BY a.完成情况 GROUP BY a.完成情况
</select> </select>
<select id="getProjectProcessDto" resultType="com.yeejoin.amos.boot.module.ugp.api.dto.ProjectProcessDto">
SELECT
up.name AS projectName,
Round(ifNull((weldNum/(length/10)),0),2)
AS projectProcess
FROM tz_ugp_project AS up
LEFT JOIN (SELECT project_id,count(1) AS weldNum FROM tz_ugp_weld GROUP BY project_id) AS uw ON uw.project_id = up.sequence_nbr
where up.sequence_nbr=#{sequenceNbr}
</select>
</mapper> </mapper>
...@@ -447,7 +447,7 @@ public class ProjectController extends BaseController { ...@@ -447,7 +447,7 @@ public class ProjectController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "当前辖区的在建项目", notes = "当前辖区的在建项目") @ApiOperation(httpMethod = "GET", value = "当前辖区的在建项目", notes = "当前辖区的在建项目")
@GetMapping(value = "/projectInProgress") @GetMapping(value = "/projectInProgress")
public ResponseModel<Long> projectInProgress(){ public ResponseModel<JSONObject> projectInProgress(){
return ResponseHelper.buildResponse(projectServiceImpl.projectInProgress()); return ResponseHelper.buildResponse(projectServiceImpl.projectInProgress());
} }
......
...@@ -6,14 +6,17 @@ import com.alibaba.fastjson.JSONObject; ...@@ -6,14 +6,17 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams; import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.module.ugp.api.Enum.OrgEnum; import com.yeejoin.amos.boot.module.ugp.api.Enum.OrgEnum;
import com.yeejoin.amos.boot.module.ugp.api.Enum.ProjectInitiationEnum; import com.yeejoin.amos.boot.module.ugp.api.Enum.ProjectInitiationEnum;
import com.yeejoin.amos.boot.module.ugp.api.constants.XJConstant; import com.yeejoin.amos.boot.module.ugp.api.constants.XJConstant;
import com.yeejoin.amos.boot.module.ugp.api.dto.ProjectDto; import com.yeejoin.amos.boot.module.ugp.api.dto.ProjectDto;
import com.yeejoin.amos.boot.module.ugp.api.dto.ProjectProcessDto;
import com.yeejoin.amos.boot.module.ugp.api.entity.*; import com.yeejoin.amos.boot.module.ugp.api.entity.*;
import com.yeejoin.amos.boot.module.ugp.api.mapper.ProjectMapper; import com.yeejoin.amos.boot.module.ugp.api.mapper.ProjectMapper;
import com.yeejoin.amos.boot.module.ugp.api.mapper.ProjectResourceMapper; import com.yeejoin.amos.boot.module.ugp.api.mapper.ProjectResourceMapper;
import com.yeejoin.amos.boot.module.ugp.api.mapper.SuperviseRuleMapper;
import com.yeejoin.amos.boot.module.ugp.api.service.IProjectService; import com.yeejoin.amos.boot.module.ugp.api.service.IProjectService;
import com.yeejoin.amos.boot.module.ugp.biz.framework.BusinessIdentify; import com.yeejoin.amos.boot.module.ugp.biz.framework.BusinessIdentify;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
...@@ -22,6 +25,7 @@ import org.springframework.stereotype.Service; ...@@ -22,6 +25,7 @@ import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.math.BigDecimal;
import java.util.*; import java.util.*;
/** /**
...@@ -62,6 +66,8 @@ public class ProjectServiceImpl extends BaseService<ProjectDto, Project, Project ...@@ -62,6 +66,8 @@ public class ProjectServiceImpl extends BaseService<ProjectDto, Project, Project
@Autowired @Autowired
WeldServiceImpl weldServiceImpl; WeldServiceImpl weldServiceImpl;
@Autowired
SuperviseRuleMapper superviseRuleMapper;
/** /**
* 分页查询 * 分页查询
*/ */
...@@ -395,17 +401,49 @@ public class ProjectServiceImpl extends BaseService<ProjectDto, Project, Project ...@@ -395,17 +401,49 @@ public class ProjectServiceImpl extends BaseService<ProjectDto, Project, Project
return null; return null;
} }
public Long projectInProgress() { @BusinessIdentify
List<Map<String,String>> list = new LinkedList<>(); public JSONObject projectInProgress() {
JSONObject object = new JSONObject();
ArrayList<String> axisData = Lists.newArrayList();
ArrayList<Integer> seriesData = Lists.newArrayList();
ReginParams ReginParams = orgService.getReginParams(); ReginParams ReginParams = orgService.getReginParams();
String companyType = ReginParams.getBusinessInfo().getCompanyType(); String companyType = ReginParams.getBusinessInfo().getCompanyType();
Long companyId = ReginParams.getBusinessInfo().getCompanySequenceNbr(); Long companyId = ReginParams.getBusinessInfo().getCompanySequenceNbr();
LambdaQueryWrapper<SuperviseRule> wrapper = new LambdaQueryWrapper<>( );
LambdaQueryWrapper<Project> wrapper1 = new LambdaQueryWrapper<>();
if (OrgEnum.监察部门.getKey().equals(companyType)) { if (OrgEnum.监察部门.getKey().equals(companyType)) {
return Long.parseLong(projectMapper.projectUnderConstructionDept(companyId)); wrapper.eq(!ValidationUtil.isEmpty(companyId), SuperviseRule::getSuperviseDeptId, companyId);
} else if (OrgEnum.监检机构.getKey().equals(companyType)) { } else if (OrgEnum.监检机构.getKey().equals(companyType)) {
return Long.parseLong(projectMapper.projectUnderConstructionUnit(companyId)); wrapper.eq(!ValidationUtil.isEmpty(companyId), SuperviseRule::getInspectionUnitId, companyId);
} }
return null; if (!ValidationUtil.isEmpty(wrapper)) {
List<SuperviseRule> superviseRulesList = superviseRuleMapper.selectList(wrapper);
for (SuperviseRule superviseRule : superviseRulesList) {
wrapper1.eq(!ValidationUtil.isEmpty(superviseRule.getAdminRegionCode()), Project::getInstallRegionCode, superviseRule.getAdminRegionCode().toString());
List<Project> projectList = projectMapper.selectList(wrapper1);
for (Project project : projectList) {
ProjectProcessDto projectProcessDto = projectMapper.getProjectProcessDto(project.getSequenceNbr());
axisData.add(projectProcessDto.getProjectName());
seriesData.add(getProjectProcess(projectProcessDto));
}
}
}
object.put("axisData",axisData);
object.put("seriesData",seriesData);
return object;
}
public Integer getProjectProcess(ProjectProcessDto projectProcessDto)
{
Double projectProcess = projectProcessDto.getProjectProcess();
if (projectProcess.compareTo(1.0) == 0 || projectProcess.compareTo(1.0) == 1) {
return 100;
}
Integer pass = new BigDecimal(projectProcess).multiply (new BigDecimal (100)).intValue();
return Integer.valueOf(pass);
} }
/** /**
......
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