dev_xds
姜玉琦 2024-04-06 17:59:18 +08:00
commit 194d6214c6
3 changed files with 30 additions and 19 deletions

View File

@ -8,6 +8,11 @@ import java.util.Map;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
/**
* Entity
@ -200,7 +205,17 @@ public class BaseEntity implements Serializable
}
public String getProType() {
return proType;
ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes)RequestContextHolder.getRequestAttributes();
if(servletRequestAttributes==null){
return "";
}
RequestContextHolder.setRequestAttributes(servletRequestAttributes,true);
HttpServletRequest request = servletRequestAttributes.getRequest();
String str= request.getHeader("proType");
if("0".equals(str)){
str="";
}
return str;
}
public void setProType(String proType) {

View File

@ -37,7 +37,7 @@ public class ProjectController extends BaseController {
private RedisCache redisCache;
@GetMapping("/findProjectByDept")
public AjaxResult findProjectByDept(Long deptId,String proType){
public AjaxResult findProjectByDept(Long deptId){
SurProject surProject=new SurProject();
if(deptId==-1){
long roleId= SecurityUtils.getRoleId();
@ -52,9 +52,6 @@ public class ProjectController extends BaseController {
if(deptId!=null && deptId.longValue()>0){
surProject.setDeptId(deptId);
}
if(StringUtils.isNotNull(proType) && !"0".equals(proType)){
surProject.setProjectType(proType);
}
return success(isurProjectService.selectSurProjectList(surProject));
}
@ -76,7 +73,7 @@ public class ProjectController extends BaseController {
* @return
*/
@GetMapping("/getProgressProjects")
public AjaxResult getProgressProjects(long deptId,String proType){
public AjaxResult getProgressProjects(long deptId){
SurProject where=new SurProject();
if(deptId<=0){
if (SecurityUtils.isUserB()) {
@ -85,15 +82,11 @@ public class ProjectController extends BaseController {
}else{
where.setDeptId(deptId);
}
String key="bgscreen_prj_getProgressProjects_"+deptId+"_"+proType+"_"+ Md5Utils.hash(where.getPrjIds());
String key="bgscreen_prj_getProgressProjects_"+deptId+"_"+ Md5Utils.hash(where.getPrjIds());
Object obj=redisCache.getCacheObject(key);
if(obj!=null){
return success(obj);
}
if(StringUtils.isNotNull(proType) && !"0".equals(proType)){
where.setProjectType(proType);
}
List<SurProject> list= isurProjectService.selectProgressProjects(where);
redisCache.setCacheObject(key, list, Constants.BIGSCREEN_QUERY_CACHE, TimeUnit.MINUTES);
return success(list);

View File

@ -59,7 +59,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql>
<select id="selectSurProjectList" parameterType="SurProject" resultMap="SurProjectResult">
select sp.id, sp.deptId, sp.projectName, sp.projectCode, sp.paretProjectName, sp.paretProjectCode, sp.simpleName, sp.projectType, sp.projiectLevel, sp.projectRegional, a.areaName as projectRegionalName, sp.projectAddress, sp.projectNature, sp.licenceNumber, sp.projectApproval, sp.projectPerson, sp.projectPhone, sp.longitude, sp.latitude, sp.projectTimeLimit, sp.totalInvestment, sp.floorArea, sp.totalOutputValue, sp.plannedCompletionTime, sp.scheduledStartTime, sp.actualOperatingTime, sp.actualCompletionTime, sp.contractAmount, sp.paidAmount, sp.onAccountAmount, sp.projectSchedule, sp.projectSummarize, sp.isDel, sp.projectStatus, sp.servicePersonnel, sp.supervisorPersonnel, sp.generalContractor, sp.create_by, sp.create_time, sp.update_by, sp.update_time, sp.remark, sp.weightType, sp.projectSort, sp.progressVisible, d.dept_name from sur_project sp
select sp.id, sp.deptId, sp.projectName, sp.projectCode, sp.paretProjectName, sp.paretProjectCode, sp.simpleName, sp.projectType, sp.projiectLevel, sp.projectRegional, a.areaName as projectRegionalName, sp.projectAddress, sp.projectNature, sp.licenceNumber, sp.projectApproval, sp.projectPerson, sp.projectPhone, sp.longitude, sp.latitude, sp.projectTimeLimit, sp.totalInvestment, sp.floorArea, sp.totalOutputValue, sp.plannedCompletionTime, sp.scheduledStartTime, sp.actualOperatingTime, sp.actualCompletionTime, sp.contractAmount, sp.paidAmount, sp.onAccountAmount, sp.projectSchedule, sp.projectSummarize, sp.isDel, sp.projectStatus, sp.servicePersonnel, sp.supervisorPersonnel, sp.generalContractor, sp.create_by, sp.create_time, sp.update_by, sp.update_time, sp.remark, sp.weightType, sp.projectSort, sp.progressVisible, d.dept_name
from sur_project sp
left join sys_dept d on d.dept_id = sp.deptId
left join china_area a on sp.projectRegional = a.id
<!--监理单位/总包公司/分包单位-->
@ -67,7 +68,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<!--普通用户查询项目人员-->
<if test='nowRole == "15" or nowRole == "16" or nowRole == "17" or nowRole == "99"'> left join sur_project_userinfo spu on spu.project_id = sp.id</if>
<where>
sp.isDel = 0
sp.isDel = 0 and sp.progressVisible=0
<if test="deptId != null "> and sp.deptId like concat('%', #{deptId}, '%')</if>
<if test="projectName != null and projectName != ''"> and sp.projectName like concat('%', #{projectName}, '%')</if>
<if test="projectCode != null and projectCode != ''"> and sp.projectCode = #{projectCode}</if>
@ -108,6 +109,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="projectDeptId != null "> and sp.deptId = #{projectDeptId}</if>
<!--子部门数据-->
<if test='nowRole == "4"'> and sp.deptId = #{nowDept}</if>
<if test='proType != null and proType !=""'> and sp.projectType = #{proType}</if>
<!--监理单位/总包公司/分包单位查询当前关联数据-->
<if test='nowRole == "5" or nowRole == "6" or nowRole == "7"'> and spui.unitId = #{nowDept}</if>
<!--普通用户查询项目人员-->
@ -284,9 +286,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
SELECT b.dict_value id,b.dict_label projectName,cnt deptId FROM (
SELECT b.dict_value, b.dict_label,sum(c.money)
cnt FROM sur_project a, sys_dict_data b,sur_project_cost_output c WHERE b.dict_type='project_category' AND a.id=c.project_id AND c.cost_type=2 and c.year=#{isDel}
AND a.projectType=b.dict_value and a.isDel=0
AND a.projectType=b.dict_value and a.isDel=0 and a.progressVisible=0
<if test="deptId>0">AND deptid=#{deptId}</if>
<if test="proType != null and proType != ''"> and projectType = #{proType}</if>
<if test="proType != null and proType != ''"> and a.projectType = #{proType}</if>
GROUP BY dict_value,dict_label
) a RIGHT JOIN sys_dict_data b ON a.dict_value=b.dict_value WHERE b.dict_type='project_category' ORDER BY cnt DESC
</if>
@ -297,7 +299,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="id==1">SUM(c.totalInvestment)</if>
<if test="id==2">COUNT(1)*10000</if>
cnt FROM sur_project a, sys_dict_data b,vw_sur_project_cost_output c WHERE b.dict_type='project_category' AND a.id=c.project_id
AND a.projectType=b.dict_value and a.isDel=0
AND a.projectType=b.dict_value and a.isDel=0 and a.progressVisible=0
<if test="deptId>0">AND deptid=#{deptId}</if>
<if test="proType != null and proType != ''"> and projectType = #{proType}</if>
GROUP BY dict_value,dict_label
@ -310,7 +312,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
SELECT b.dict_value id,b.dict_label projectName,cnt deptId FROM (
SELECT b.dict_value, b.dict_label,sum(c.money) cnt
FROM sur_project a,sys_dict_data b ,sur_project_cost_output c WHERE b.dict_type='project_level' AND a.id=c.project_id AND c.cost_type=2 and c.year=#{isDel}
AND a.projiectLevel=b.dict_value and a.isDel=0
AND a.projiectLevel=b.dict_value and a.isDel=0 and a.progressVisible=0
<if test="deptId>0">AND deptid=#{deptId}</if>
<if test="proType != null and proType != ''"> and projectType = #{proType}</if>
GROUP BY dict_value,dict_label
@ -323,7 +325,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="id==1">SUM(c.totalInvestment)</if>
cnt FROM sur_project a, sys_dict_data b ,vw_sur_project_cost_output c WHERE b.dict_type='project_level' AND a.id=c.project_id
AND a.projiectLevel=b.dict_value and a.isDel=0
AND a.projiectLevel=b.dict_value and a.isDel=0 and a.progressVisible=0
<if test="deptId>0">AND deptid=#{deptId}</if>
<if test="proType != null and proType != ''"> and projectType = #{proType}</if>
GROUP BY dict_value,dict_label
@ -367,7 +369,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectSurProjectListByBuser" parameterType="SurProject" resultMap="SurProjectResult">
select sp.id, sp.deptId, sp.projectName, sp.projectCode, sp.paretProjectName, sp.paretProjectCode, sp.simpleName, sp.projectType, sp.projiectLevel, sp.projectRegional, a.areaName as projectRegionalName, sp.projectAddress, sp.projectNature, sp.licenceNumber, sp.projectApproval, sp.projectPerson, sp.projectPhone, sp.longitude, sp.latitude, sp.projectTimeLimit, sp.totalInvestment, sp.floorArea, sp.totalOutputValue, sp.plannedCompletionTime, sp.scheduledStartTime, sp.actualOperatingTime, sp.actualCompletionTime, sp.contractAmount, sp.paidAmount, sp.onAccountAmount, sp.projectSchedule, sp.projectSummarize, sp.isDel, sp.projectStatus, sp.servicePersonnel, sp.supervisorPersonnel, sp.generalContractor, sp.create_by, sp.create_time, sp.update_by, sp.update_time, sp.remark, sp.weightType, sp.projectSort, sp.progressVisible, d.dept_name
from (
select * from sur_project sp where sp.isdel=0
select * from sur_project sp where sp.isdel=0 and sp.progressVisible=0
<if test='proType != null and proType !=""'> and sp.projectType = #{proType}</if>
<if test="id!=null and id>0">
and sp.id in (select spu.project_id from sur_project_userinfo spu where spu.user_id = #{id} and spu.is_del=0)
</if>