金林湾修改bug

This commit is contained in:
Administrator 2023-06-20 15:06:53 +08:00
parent 4f1eed5204
commit cecc40d4fb
8 changed files with 184 additions and 16 deletions

View File

@ -6,18 +6,25 @@ import com.zhgd.annotation.OperLog;
import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.jeecg.common.mybatis.EntityMap;
import com.zhgd.redis.annotation.ApiIdempotent;
import com.zhgd.xmgl.modules.bigdevice.entity.vo.AlarmsDistinguishedNumberByAlarmType;
import com.zhgd.xmgl.modules.worker.entity.WorkerInfo;
import com.zhgd.xmgl.modules.worker.entity.vo.*;
import com.zhgd.xmgl.modules.worker.service.IWorkerInfoService;
import com.zhgd.xmgl.util.MessageUtil;
import io.swagger.annotations.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.MapUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.*;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
@ -342,6 +349,12 @@ public class WorkerInfoController {
return Result.success(workerInfoService.selectProjectWorkerTypeTotalList(map));
}
@ApiOperation(value = "统计按工种分布的人员数量", notes = "统计按工种分布的人员数量")
@GetMapping("/countWorkerNumGroupByWorkerType")
public Result<List<TypeNumVo>> countWorkerNumGroupByWorkerType(@RequestParam Map<String, Object> map) {
return Result.success(workerInfoService.countWorkerNumGroupByWorkerType(map));
}
@ApiOperation(value = "查询项目下所有企业出勤人数列表", notes = "查询项目下所有企业出勤人数列表")
@ApiImplicitParams({
@ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "query", required = true, dataType = "String"),
@ -460,13 +473,14 @@ public class WorkerInfoController {
@ApiOperation(value = "人员管理-通过项目sn以及时间区间查询员工申报年龄段", notes = "人员管理-通过项目id以及时间区间查询员工申报年龄段")
@ApiImplicitParams({
@ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "query", required = true, dataType = "String"),
@ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "query", required = false, dataType = "String"),
@ApiImplicitParam(name = "projectSns", value = "项目SNS", paramType = "query", required = false, dataType = "String"),
@ApiImplicitParam(name = "startDate", value = "开始时间,yyyy-MM-dd", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "endDate", value = "结束时间,yyyy-MM-dd", paramType = "query", dataType = "String")
})
@GetMapping(value = "/getDeclareAge")
public Result<DeclareAgeVO> getDeclareAge(String projectSn, String startDate, String endDate) {
return Result.success(workerInfoService.getDeclareAge(projectSn, startDate, endDate));
public Result<DeclareAgeVO> getDeclareAge(String projectSn, String startDate, String endDate, String projectSns) {
return Result.success(workerInfoService.getDeclareAge(projectSn, startDate, endDate, projectSns));
}
@ -562,7 +576,17 @@ public class WorkerInfoController {
@ApiImplicitParam(name = "pageNo", value = "第几页", paramType = "query", required = true, dataType = "Integer"),
@ApiImplicitParam(name = "pageSize", value = "每页显示条数", paramType = "query", required = true, dataType = "Integer"),
})
public Result<IPage<WorkerInfoDetailsVo>> getWorkerInfoDetails(Integer pageNo, Integer pageSize,String projectSn) {
return workerInfoService.getWorkerInfoDetails(pageNo, pageSize,projectSn);
public Result<IPage<WorkerInfoDetailsVo>> getWorkerInfoDetails(Integer pageNo, Integer pageSize, String projectSn) {
return workerInfoService.getWorkerInfoDetails(pageNo, pageSize, projectSn);
}
/**
* 查询工程人员在场与总人数统计
*
* @return
*/
@GetMapping("/queryThePresenceAndTotalNumberOfEngineeringPersonnel")
public Result<PresenceAndTotalNumberOfEngineeringPersonnelVo> queryThePresenceAndTotalNumberOfEngineeringPersonnel() {
return Result.success(workerInfoService.queryThePresenceAndTotalNumberOfEngineeringPersonnel());
}
}

View File

@ -0,0 +1,20 @@
package com.zhgd.xmgl.modules.worker.entity.vo;
import lombok.Data;
import java.util.List;
@Data
public class PresenceAndTotalNumberOfEngineeringPersonnelVo {
private Integer presentNum;
private Integer peopleNum;
private List<Count> countList;
@Data
public static class Count {
private String projectName;
private Integer presentNum;
private Integer peopleNum;
}
}

View File

@ -0,0 +1,9 @@
package com.zhgd.xmgl.modules.worker.entity.vo;
import lombok.Data;
@Data
public class TypeNumVo {
private String typeName;
private Integer num;
}

View File

@ -5,10 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhgd.jeecg.common.mybatis.EntityMap;
import com.zhgd.xmgl.modules.worker.entity.WorkerInfo;
import com.zhgd.xmgl.modules.worker.entity.vo.AllProjectTeamVo;
import com.zhgd.xmgl.modules.worker.entity.vo.PersonnelSituationVO;
import com.zhgd.xmgl.modules.worker.entity.vo.ProjectWorkerTypeTotalVo;
import com.zhgd.xmgl.modules.worker.entity.vo.WorkerInfoDetailsVo;
import com.zhgd.xmgl.modules.worker.entity.vo.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
@ -224,4 +221,10 @@ public interface WorkerInfoMapper extends BaseMapper<WorkerInfo> {
Long selectSceneTotal(String project);
IPage<WorkerInfoDetailsVo> getWorkerInfoDetails(Page<WorkerInfoDetailsVo> p, String projectSn);
List<PresenceAndTotalNumberOfEngineeringPersonnelVo.Count> queryPresentNum();
List<PresenceAndTotalNumberOfEngineeringPersonnelVo.Count> queryTotalNum();
List<TypeNumVo> countWorkerNumGroupByWorkerType(Map<String, Object> map);
}

View File

@ -2196,6 +2196,7 @@
<if test="endDate != null and endDate != ''">
and birthday <![CDATA[<=]]> #{endDate}
</if>
and birthday is not null and birthday != ''
</select>
<!-- <select id="getPersonnelSituation" resultType="com.zhgd.xmgl.modules.worker.entity.vo.PersonnelSituationVO">-->
<!-- select-->
@ -2263,4 +2264,30 @@
</if>
</where>
</select>
<select id="queryPresentNum"
resultType="com.zhgd.xmgl.modules.worker.entity.vo.PresenceAndTotalNumberOfEngineeringPersonnelVo$Count">
select IFNULL(sum(if(w1.inService_type = 1, 1, 0)), 0) presentNum, a.project_name, 0 peopleNum
from worker_info w1
INNER JOIN project a ON w1.project_sn = a.project_sn
INNER JOIN worker_attendance_presence p ON w1.person_sn = p.person_sn
group by w1.project_sn
</select>
<select id="queryTotalNum"
resultType="com.zhgd.xmgl.modules.worker.entity.vo.PresenceAndTotalNumberOfEngineeringPersonnelVo$Count">
select IFNULL(sum(if(w1.inService_type = 1, 1, 0)), 0) peopleNum, a.project_name, 0 presentNum
from worker_info w1
INNER JOIN project a ON w1.project_sn = a.project_sn
group by w1.project_sn
</select>
<select id="countWorkerNumGroupByWorkerType" resultType="com.zhgd.xmgl.modules.worker.entity.vo.TypeNumVo">
SELECT wt.type_name AS typeName,
count(wi.id) AS num
FROM worker_type wt
LEFT JOIN team_info ti ON wt.id = ti.worker_type_id
LEFT JOIN worker_info wi ON (ti.id = wi.team_id and wi.inService_type = 1)
GROUP BY wt.type_name
</select>
</mapper>

View File

@ -109,7 +109,11 @@ public interface IWorkerInfoService extends IService<WorkerInfo> {
PersonnelSituationVO getPersonnelSituation(String projectSn);
DeclareAgeVO getDeclareAge(String projectSn, String startDate, String endDate);
DeclareAgeVO getDeclareAge(String projectSn, String startDate, String endDate, String projectSns);
Result<IPage<WorkerInfoDetailsVo>> getWorkerInfoDetails(Integer pageNo, Integer pageSize, String projectSn);
PresenceAndTotalNumberOfEngineeringPersonnelVo queryThePresenceAndTotalNumberOfEngineeringPersonnel();
List<TypeNumVo> countWorkerNumGroupByWorkerType(Map<String, Object> map);
}

View File

@ -36,6 +36,7 @@ import com.zhgd.xmgl.util.*;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.jetbrains.annotations.NotNull;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
@ -1621,7 +1622,35 @@ public class WorkerInfoServiceImpl extends ServiceImpl<WorkerInfoMapper, WorkerI
}
@Override
public DeclareAgeVO getDeclareAge(String projectSn, String startDate, String endDate) {
public DeclareAgeVO getDeclareAge(String projectSn, String startDate, String endDate, String projectSns) {
DeclareAgeVO declareAgeVO = new DeclareAgeVO();
if (StringUtils.isBlank(projectSn)) {
List<String> snList = new ArrayList<>();
if (StringUtils.isNotBlank(projectSns)) {
String[] snArr = StringUtils.split(projectSns, ",");
Collections.addAll(snList, snArr);
} else {
//查询全部
List<Project> allProjects = projectMapper.selectList(null);
snList = allProjects.stream().map(Project::getProjectSn).collect(Collectors.toList());
}
for (String projectSn1 : snList) {
DeclareAgeVO v1 = getDeclareAgeVO(projectSn1, startDate, endDate);
declareAgeVO.setEighteenToTwentyFour(declareAgeVO.getEighteenToTwentyFour() + v1.getEighteenToTwentyFour());
declareAgeVO.setTwentyFiveToThirtyFour(declareAgeVO.getTwentyFiveToThirtyFour() + v1.getTwentyFiveToThirtyFour());
declareAgeVO.setThirtyFiveToFortyNine(declareAgeVO.getThirtyFiveToFortyNine() + v1.getThirtyFiveToFortyNine());
declareAgeVO.setFiftyToFiftyFive(declareAgeVO.getFiftyToFiftyFive() + v1.getFiftyToFiftyFive());
declareAgeVO.setNotRegistered(declareAgeVO.getNotRegistered() + v1.getNotRegistered());
}
return declareAgeVO;
} else {
return getDeclareAgeVO(projectSn, startDate, endDate);
}
}
@NotNull
private DeclareAgeVO getDeclareAgeVO(String projectSn, String startDate, String endDate) {
List<String> ageList = workerInfoMapper.getDeclareAge(projectSn, startDate, endDate);
Set<Map.Entry<Integer, List<String>>> ageSet = ageList.stream().collect(Collectors.groupingBy(DateUtil::ageOfNow)).entrySet();
DeclareAgeVO result = new DeclareAgeVO();
@ -1657,6 +1686,58 @@ public class WorkerInfoServiceImpl extends ServiceImpl<WorkerInfoMapper, WorkerI
return Result.success(page);
}
@Override
public PresenceAndTotalNumberOfEngineeringPersonnelVo queryThePresenceAndTotalNumberOfEngineeringPersonnel() {
List<PresenceAndTotalNumberOfEngineeringPersonnelVo.Count> presentCountList = workerInfoMapper.queryPresentNum();
List<PresenceAndTotalNumberOfEngineeringPersonnelVo.Count> totalCountList = workerInfoMapper.queryTotalNum();
presentCountList.addAll(totalCountList);
HashMap<String, PresenceAndTotalNumberOfEngineeringPersonnelVo.Count> map = new HashMap<>();
for (PresenceAndTotalNumberOfEngineeringPersonnelVo.Count count : presentCountList) {
String projectName = count.getProjectName();
PresenceAndTotalNumberOfEngineeringPersonnelVo.Count c = map.get(projectName);
if (c == null) {
map.put(projectName, count);
} else {
Integer prn = count.getPresentNum();
Integer pen = count.getPeopleNum();
c.setPresentNum(NumberUtil.add(prn, c.getPresentNum()).intValue());
c.setPeopleNum(NumberUtil.add(pen, c.getPeopleNum()).intValue());
}
}
PresenceAndTotalNumberOfEngineeringPersonnelVo rtVo = new PresenceAndTotalNumberOfEngineeringPersonnelVo();
ArrayList<PresenceAndTotalNumberOfEngineeringPersonnelVo.Count> list = new ArrayList<>(map.values());
int presentNum = list.stream().mapToInt(PresenceAndTotalNumberOfEngineeringPersonnelVo.Count::getPresentNum).sum();
int peopleNum = list.stream().mapToInt(PresenceAndTotalNumberOfEngineeringPersonnelVo.Count::getPeopleNum).sum();
rtVo.setCountList(list);
rtVo.setPresentNum(presentNum);
rtVo.setPeopleNum(peopleNum);
return rtVo;
}
@Override
public List<TypeNumVo> countWorkerNumGroupByWorkerType(Map<String, Object> map) {
List<TypeNumVo> voList = workerInfoMapper.countWorkerNumGroupByWorkerType(map);
voList.sort((o1, o2) -> o2.getNum().compareTo(o1.getNum()));
List<TypeNumVo> rtList = new ArrayList<>();
//其他的数量
int showNum = 10;
TypeNumVo other = new TypeNumVo();
other.setTypeName("其他");
other.setNum(0);
for (int i = 0; i < voList.size(); i++) {
TypeNumVo vo = voList.get(i);
if (i >= showNum) {
//其他数量
Integer num = vo.getNum();
other.setNum(num + other.getNum());
} else {
rtList.add(vo);
}
}
rtList.add(other);
return rtList;
}
private long getAttendanceNumber(String projectSn) {
AtomicLong number = new AtomicLong(0);
// 人员分组

View File

@ -11,8 +11,8 @@ spring.datasource.username=ENC(lRspM3gSyiQcjQf1yMyOjg==)
spring.datasource.password=ENC(QGayqFar3bfVMSThuRKFTjcaktJmSdjE)
server.port=12333
#server.port=30246
basePath=/home/zhgd/app/service/itbgpImage/
server.tomcat.basedir=/home/zhgd/app/service/tempImage/
basePath=/mnt/sdc/zhgd/itbgpImage/
server.tomcat.basedir=/mnt/sdc/zhgd/tempImage/
arcsoft.dllPath=/home/zhgd/app/service/dll
security.enable=false
isGetStandardData=false
@ -46,7 +46,7 @@ spring.file-storage.local[0].enable-access=false
# \u8BBF\u95EE\u57DF\u540D\uFF0C\u4F8B\u5982\uFF1A\u201Chttp://127.0.0.1:6023/image/\u201D\uFF0C\u6CE8\u610F\u540E\u9762\u8981\u548C path-patterns \u4FDD\u6301\u4E00\u81F4\uFF0C\u201C/\u201D\u7ED3\u5C3E\uFF0C\u672C\u5730\u5B58\u50A8\u5EFA\u8BAE\u4F7F\u7528\u76F8\u5BF9\u8DEF\u5F84\uFF0C\u65B9\u4FBF\u540E\u671F\u66F4\u6362\u57DF\u540D
spring.file-storage.local[0].domain=
# \u5B58\u50A8\u5730\u5740
spring.file-storage.local[0].base-path=/home/zhgd/app/service/itbgpImage/
spring.file-storage.local[0].base-path=/mnt/sdc/zhgd/itbgpImage/
# \u8BBF\u95EE\u8DEF\u5F84\uFF0C\u5F00\u542F enable-access \u540E\uFF0C\u901A\u8FC7\u6B64\u8DEF\u5F84\u53EF\u4EE5\u8BBF\u95EE\u5230\u4E0A\u4F20\u7684\u6587\u4EF6
spring.file-storage.local[0].path-patterns=
spring.file-storage.aliyun-oss[0].platform=aliyun-oss