工人效率分析

This commit is contained in:
cwchen 2025-07-23 23:37:10 +08:00
parent 01ee13002e
commit d869314530
8 changed files with 214 additions and 0 deletions

View File

@ -26,4 +26,8 @@ public class ScreenParamDto extends ScreenDto{
private String type; private String type;
private String userName;
private String teamName;
} }

View File

@ -0,0 +1,28 @@
package com.securitycontrol.entity.screen.vo;
import lombok.Data;
/**
* @className:WorkerEfficiencyVo
* @author:cwchen
* @date:2025-07-23-20:13
* @version:1.0
* @description:工人效率分析-vo
*/
@Data
public class WorkerEfficiencyVo {
private Long id;
private String bidCode;
private String proName;
private String userName;
private String teamName;
private String postName;
private int attDay;
private String sgType;
private String completeWorkload;
private double unitTimeOutput;
private String standardTimeOutput;
private String unit;
private String unitTimeOutputUnit;
}

View File

@ -62,6 +62,9 @@ public class ParamSecureHandler implements AsyncHandlerInterceptor {
"/sys/sysLog/addLogs", "/sys/sysLog/addLogs",
"/largeScreen/constrDisplay/pushImageData", "/largeScreen/constrDisplay/pushImageData",
"/largeScreen/tb_project_new/list", "/largeScreen/tb_project_new/list",
"/largeScreen/workerEfficiency/getList",
"/largeScreen/tb_project_new/list",
"/largeScreen/tb_project_progress_new/list",
"/largeScreen/environment/getEnvironmentList", "/largeScreen/environment/getEnvironmentList",
"/largeScreen/tb_project_progress_new/list", "/largeScreen/tb_project_progress_new/list",
"/largeScreen/tb_project_progress_new/list4chart", "/largeScreen/tb_project_progress_new/list4chart",

View File

@ -0,0 +1,46 @@
package com.securitycontrol.screen.controller;
import com.securitycontrol.common.core.web.controller.BaseController;
import com.securitycontrol.common.core.web.page.TableDataInfo;
import com.securitycontrol.entity.screen.dto.ScreenParamDto;
import com.securitycontrol.entity.screen.vo.DataAnalysisDetailVo;
import com.securitycontrol.entity.screen.vo.WorkerEfficiencyVo;
import com.securitycontrol.screen.service.IWorkerEfficiencyService;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
/**
* @className:WorkerEfficiencyController
* @author:cwchen
* @date:2025-07-23-19:55
* @version:1.0
* @description:工人效率分析
*/
@RestController
@RequestMapping("/largeScreen/workerEfficiency/")
@Slf4j
public class WorkerEfficiencyController extends BaseController {
@Resource(name = "IWorkerEfficiencyService")
private IWorkerEfficiencyService service;
@ApiOperation(value = "工人效率分析")
@GetMapping("getList")
public TableDataInfo getList(ScreenParamDto dto) {
try{
startLayPage();
List<WorkerEfficiencyVo> list = service.getList(dto);
return getDataTableLayui(list);
}catch (Exception e){
log.error(e.toString(),e);
return getDataTableBadLayui(new ArrayList<>(),"请求出错了");
}
}
}

View File

@ -0,0 +1,26 @@
package com.securitycontrol.screen.mapper;
import com.securitycontrol.entity.screen.dto.ScreenParamDto;
import com.securitycontrol.entity.screen.vo.WorkerEfficiencyVo;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @className:IWorkerEfficiencyMapper
* @author:cwchen
* @date:2025-07-23-19:58
* @version:1.0
* @description:工人效率分析-数据层
*/
@Repository(value = "IWorkerEfficiencyMapper")
public interface IWorkerEfficiencyMapper {
/**
* 工人效率分析
* @param dto
* @return List<WorkerEfficiencyVo>
* @author cwchen
* @date 2025/7/23 20:26
*/
List<WorkerEfficiencyVo> getList(ScreenParamDto dto);
}

View File

@ -0,0 +1,24 @@
package com.securitycontrol.screen.service;
import com.securitycontrol.entity.screen.dto.ScreenParamDto;
import com.securitycontrol.entity.screen.vo.WorkerEfficiencyVo;
import java.util.List;
/**
* @className:IWorkerEfficiencyService
* @author:cwchen
* @date:2025-07-23-19:56
* @version:1.0
* @description:工人效率分析
*/
public interface IWorkerEfficiencyService {
/**
* 工人效率分析
* @param dto
* @return List<WorkerEfficiencyVo>
* @author cwchen
* @date 2025/7/23 20:23
*/
List<WorkerEfficiencyVo> getList(ScreenParamDto dto);
}

View File

@ -0,0 +1,51 @@
package com.securitycontrol.screen.service.impl;
import com.securitycontrol.entity.screen.dto.ScreenParamDto;
import com.securitycontrol.entity.screen.vo.WorkerEfficiencyVo;
import com.securitycontrol.screen.mapper.IWorkerEfficiencyMapper;
import com.securitycontrol.screen.service.IWorkerEfficiencyService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
/**
* @className:WorkerEfficiencyServiceImpl
* @author:cwchen
* @date:2025-07-23-19:57
* @version:1.0
* @description:工人效率分析-业务逻辑层
*/
@Service(value = "IWorkerEfficiencyService")
@Slf4j
public class WorkerEfficiencyServiceImpl implements IWorkerEfficiencyService {
@Resource(name = "IWorkerEfficiencyMapper")
private IWorkerEfficiencyMapper mapper;
@Override
public List<WorkerEfficiencyVo> getList(ScreenParamDto dto) {
try {
List<WorkerEfficiencyVo> list = Optional.ofNullable(mapper.getList(dto)).orElse(new ArrayList<>());
for (WorkerEfficiencyVo vo : list) {
if(StringUtils.isNotBlank(vo.getCompleteWorkload())){
BigDecimal a = new BigDecimal(vo.getCompleteWorkload());
BigDecimal b = new BigDecimal(vo.getAttDay());
BigDecimal result = a.divide(b, 3, RoundingMode.HALF_UP);
vo.setUnitTimeOutput(result.doubleValue());
}
}
return list;
} catch (Exception e) {
log.info(e.toString(), e);
return new ArrayList<>();
}
}
}

View File

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.securitycontrol.screen.mapper.IWorkerEfficiencyMapper">
<!--工人效率分析-->
<select id="getList" resultType="com.securitycontrol.entity.screen.vo.WorkerEfficiencyVo">
SELECT id,
bid_code AS bidCode,
pro_name AS proName,
user_name AS userName,
team_name AS teamName,
post_name AS postName,
att_day AS attDay,
sg_type AS sgType,
complete_workload AS completeWorkload,
standard_time_output AS standardTimeOutput,
unit,
unit_time_output_unit AS unitTimeOutputUnit
FROM tb_worker_efficiency
<where>
<if test="userName != null and userName != ''">
AND user_name = #{userName}
</if>
<if test="teamName != null and teamName != ''">
AND team_name = #{teamName}
</if>
AND bid_code = #{bidCode}
ORDER BY id
</where>
</select>
</mapper>