Ver Fonte

工时管理

yejian016332 há 3 anos atrás
pai
commit
7e54d0e6d2

+ 27 - 0
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/statisticalAnalysis/ProductLinePerformanceService.java

@@ -0,0 +1,27 @@
+package com.github.zuihou.business.statisticalAnalysis;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.github.zuihou.base.service.SuperCacheService;
+import com.github.zuihou.business.externalApi.entity.AgvHikOrderDetailInfo;
+import com.github.zuihou.business.operationManagementCenter.entity.TaskNode;
+import com.github.zuihou.database.mybatis.conditions.query.LbqWrapper;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 业务接口
+ * 工时管理
+ * </p>
+ *
+ * @author imcs
+ * @date 2021-12-29
+ */
+public interface ProductLinePerformanceService extends SuperCacheService<TaskNode> {
+
+    IPage<TaskNode> pageList(IPage page, LbqWrapper<TaskNode> wrapper);
+
+    List<TaskNode> queryOperatorDetailPerformance(TaskNode taskNode);
+
+    List<TaskNode> queryOperatorDetailsPerformance(TaskNode params);
+}

+ 38 - 0
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/statisticalAnalysis/dao/ProductLinePerformanceMapper.java

@@ -0,0 +1,38 @@
+package com.github.zuihou.business.statisticalAnalysis.dao;
+
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Constants;
+import com.github.zuihou.base.mapper.SuperMapper;
+import com.github.zuihou.business.externalApi.entity.AgvHikOrderDetailInfo;
+import com.github.zuihou.business.operationManagementCenter.entity.TaskNode;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+/**
+ * <p>
+ * Mapper 接口
+ * 工时管理
+ * </p>
+ *
+ * @author imcs
+ * @date 2021-12-29
+ */
+@Repository
+public interface ProductLinePerformanceMapper extends SuperMapper<TaskNode> {
+    /**
+     * 分页
+     */
+    IPage<TaskNode> pageList(IPage page, @Param(Constants.WRAPPER) Wrapper<TaskNode> queryWrapper);
+
+    /**
+     *
+     * @param taskNode
+     * @return
+     */
+    List<TaskNode> queryOperatorDetailPerformance(TaskNode taskNode);
+
+    List<TaskNode> queryOperatorDetailsPerformance(TaskNode taskNode);
+}

+ 58 - 0
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/statisticalAnalysis/impl/ProductLinePerformanceServiceImpl.java

@@ -0,0 +1,58 @@
+package com.github.zuihou.business.statisticalAnalysis.impl;
+
+import cn.hutool.core.bean.BeanUtil;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.github.zuihou.base.service.SuperCacheServiceImpl;
+import com.github.zuihou.business.externalApi.dao.AgvHikOrderDetailInfoMapper;
+import com.github.zuihou.business.externalApi.entity.AgvHikOrderDetailInfo;
+import com.github.zuihou.business.externalApi.service.AgvHikOrderDetailInfoService;
+import com.github.zuihou.business.operationManagementCenter.entity.TaskNode;
+import com.github.zuihou.business.statisticalAnalysis.ProductLinePerformanceService;
+import com.github.zuihou.business.statisticalAnalysis.dao.ProductLinePerformanceMapper;
+import com.github.zuihou.common.constant.CacheKey;
+import com.github.zuihou.database.mybatis.conditions.query.LbqWrapper;
+import com.github.zuihou.injection.annonation.InjectionResult;
+import com.github.zuihou.utils.BeanPlusUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 业务实现类
+ * 工时管理
+ * </p>
+ *
+ * @author imcs
+ * @date 2021-12-29
+ */
+@Slf4j
+@Service
+
+public class ProductLinePerformanceServiceImpl extends SuperCacheServiceImpl<ProductLinePerformanceMapper, TaskNode> implements ProductLinePerformanceService {
+
+    @Override
+    protected String getRegion() {
+        return CacheKey.USER;
+    }
+
+    @Override
+    @InjectionResult
+    public IPage<TaskNode> pageList(IPage page, LbqWrapper<TaskNode> wrapper) {
+        return baseMapper.pageList(page, wrapper);
+    }
+
+    @Override
+    public List<TaskNode> queryOperatorDetailPerformance(TaskNode taskNode){
+        return baseMapper.queryOperatorDetailPerformance(taskNode);
+    }
+
+    @Override
+    public List<TaskNode> queryOperatorDetailsPerformance(TaskNode taskNode) {
+        return baseMapper.queryOperatorDetailsPerformance(taskNode);
+    }
+
+
+}

+ 67 - 0
imcs-admin-boot/imcs-business-biz/src/main/resources/mapper_business/base/statisticalAnalysis/ProductLinePerformanceMapper.xml

@@ -0,0 +1,67 @@
+<?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.github.zuihou.business.statisticalAnalysis.dao.ProductLinePerformanceMapper">
+    <!-- 分页 -->
+    <select id="pageList" resultType="com.github.zuihou.business.operationManagementCenter.entity.TaskNode">
+        SELECT tmp1.productionlineId,tmp1.productionlineName,tmp1.statisticalDate,SUM(TIMESTAMPDIFF(MINUTE, tmp1.start_time, tmp1.end_time) / 60) AS statisticalHours FROM
+        (SELECT
+          a.id AS productionlineId,
+          a.name AS productionlineName,
+          date_format(d.start_time,'%Y-%m') AS statisticalDate,
+          d.start_time,
+          d.end_time,
+          SUM(TIMESTAMPDIFF(MINUTE, d.start_time,d.end_time) / 60) AS statisticalHours
+        FROM zuihou_base_yj_0000.imcs_tenant_productionline a,
+             zuihou_base_yj_0000.imcs_tenant_productionresource b,
+             zuihou_base_yj_0000.imcs_t_task c,
+             zuihou_base_yj_0000.imcs_t_task_node d,
+             zuihou_base_yj_0000.c_auth_user e
+      WHERE a.id = b.productionline_id
+        AND b.id = c.resource_id
+        AND c.id = d.task_id
+        AND d.loading_user_id = e.id
+        AND d.exe_status = '3'
+        AND d.loading_user_id IS NOT NULL) tmp1 ${ew.customSqlSegment} GROUP BY tmp1.statisticalDate,tmp1.productionlineId ORDER BY tmp1.statisticalDate,tmp1.productionlineId
+    </select>
+
+    <select id="queryOperatorDetailPerformance" parameterType="com.github.zuihou.business.operationManagementCenter.entity.TaskNode"  resultType="com.github.zuihou.business.operationManagementCenter.entity.TaskNode">
+        SELECT
+          d.loading_user_id AS loadingUserId,
+          e.name,
+          (select f.label from c_core_org f where e.org_id = f.id) as orgName,
+          date_format(d.start_time,'%Y-%m') AS statisticalDate,
+          SUM(TIMESTAMPDIFF(MINUTE, d.start_time,d.end_time) / 60) AS statisticalHours
+        FROM zuihou_base_yj_0000.imcs_tenant_productionline a,
+             zuihou_base_yj_0000.imcs_tenant_productionresource b,
+             zuihou_base_yj_0000.imcs_t_task c,
+             zuihou_base_yj_0000.imcs_t_task_node d,
+             zuihou_base_yj_0000.c_auth_user e
+      WHERE a.id = b.productionline_id
+        AND b.id = c.resource_id
+        AND c.id = d.task_id
+        AND d.loading_user_id = e.id
+        AND d.exe_status = '3'
+        AND d.loading_user_id IS NOT NULL and a.id = #{productionlineId} and date_format(d.start_time,'%Y-%m') = #{statisticalDate} GROUP BY statisticalDate,d.loading_user_id order by e.name
+    </select>
+
+    <select id="queryOperatorDetailsPerformance" parameterType="com.github.zuihou.business.operationManagementCenter.entity.TaskNode" resultType="com.github.zuihou.business.operationManagementCenter.entity.TaskNode">
+        SELECT
+          d.loading_user_id AS loadingUserId,
+          e.name,
+          (select f.label from c_core_org f where e.org_id = f.id) as orgName,
+          date_format(d.start_time,'%Y-%m-%d') AS statisticalDate,
+          SUM(TIMESTAMPDIFF(MINUTE, d.start_time,d.end_time) / 60) AS statisticalHours
+        FROM zuihou_base_yj_0000.imcs_tenant_productionline a,
+             zuihou_base_yj_0000.imcs_tenant_productionresource b,
+             zuihou_base_yj_0000.imcs_t_task c,
+             zuihou_base_yj_0000.imcs_t_task_node d,
+             zuihou_base_yj_0000.c_auth_user e
+      WHERE a.id = b.productionline_id
+        AND b.id = c.resource_id
+        AND c.id = d.task_id
+        AND d.loading_user_id = e.id
+        AND d.exe_status = '3'
+        AND d.loading_user_id IS NOT NULL and d.loading_user_id = #{loadingId} and date_format(d.start_time,'%Y-%m') = #{loadingDate} GROUP BY statisticalDate order by statisticalDate desc
+
+    </select>
+</mapper>

+ 86 - 0
imcs-admin-boot/imcs-business-controller/src/main/java/com/github/zuihou/business/controller/statisticalAnalysis/ProductLinePerformanceController.java

@@ -0,0 +1,86 @@
+package com.github.zuihou.business.controller.statisticalAnalysis;
+
+import cn.hutool.core.bean.BeanUtil;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.github.zuihou.base.R;
+import com.github.zuihou.base.controller.SuperController;
+import com.github.zuihou.base.request.PageParams;
+import com.github.zuihou.business.externalApi.dto.AgvHikOrderDetailInfoPageDTO;
+import com.github.zuihou.business.externalApi.dto.AgvHikOrderDetailInfoSaveDTO;
+import com.github.zuihou.business.externalApi.dto.AgvHikOrderDetailInfoUpdateDTO;
+import com.github.zuihou.business.externalApi.entity.AgvHikOrderDetailInfo;
+import com.github.zuihou.business.externalApi.service.AgvHikOrderDetailInfoService;
+import com.github.zuihou.business.operationManagementCenter.dto.TaskNodePageDTO;
+import com.github.zuihou.business.operationManagementCenter.dto.TaskNodeSaveDTO;
+import com.github.zuihou.business.operationManagementCenter.dto.TaskNodeUpdateDTO;
+import com.github.zuihou.business.operationManagementCenter.entity.TaskNode;
+import com.github.zuihou.business.productionReadyCenter.entity.MToolClamp;
+import com.github.zuihou.business.statisticalAnalysis.ProductLinePerformanceService;
+import com.github.zuihou.database.mybatis.conditions.query.LbqWrapper;
+import com.github.zuihou.database.mybatis.conditions.query.QueryWrap;
+import com.github.zuihou.log.annotation.SysLog;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+
+
+/**
+ * <p>
+ * 前端控制器
+ * 工时管理
+ * </p>
+ *
+ * @author imcs
+ * @date 2021-12-29
+ */
+@Slf4j
+@Validated
+@RestController
+@RequestMapping("/productLinePerformance")
+@Api(value = "productLinePerformance", tags = "工时管理")
+@SysLog(enabled = true)
+public class ProductLinePerformanceController extends SuperController<ProductLinePerformanceService, Long, TaskNode, TaskNodePageDTO, TaskNodeSaveDTO, TaskNodeUpdateDTO> {
+    @Override
+    public void query(PageParams<TaskNodePageDTO> params, IPage<TaskNode> page, Long defSize) {
+        TaskNodePageDTO data = params.getModel();
+        QueryWrap<TaskNode> wrap = handlerWrapper(null, params);
+        LbqWrapper<TaskNode> wrapper = wrap.lambda();
+        String statisticalBeginDate;
+        String statisticalEndDate;
+        if(null == data.getStatisticalDate()){
+            Calendar now = Calendar.getInstance();
+            now.add(Calendar.MONTH,-3);
+            statisticalBeginDate = com.github.zuihou.common.util.DateUtil.beginMonthTime(now.getTime());
+            statisticalEndDate = com.github.zuihou.common.util.DateUtil.endMonthTime(new Date());
+        }else{
+            Date SearchDate = com.github.zuihou.common.util.DateUtil.stringToDate0(data.getStatisticalDate(),"yyyy-MM");
+            statisticalBeginDate = com.github.zuihou.common.util.DateUtil.beginMonthTime(SearchDate);
+            statisticalEndDate = com.github.zuihou.common.util.DateUtil.endMonthTime(SearchDate);
+        }
+        wrapper.between(TaskNode::getStartTime,statisticalBeginDate,statisticalEndDate).between(TaskNode::getEndTime,statisticalBeginDate,statisticalEndDate);
+        page.orders().remove(0);
+        baseService.pageList(page, wrapper);
+    }
+
+    @ApiOperation(value = "查询产线月份人员工时管理", notes = "查询产线月份人员工时管理")
+    @PostMapping("/queryOperatorDetailPerformance")
+    public R<List<TaskNode>> queryOperatorDetailPerformance(@RequestBody(required = true) TaskNode params) {
+        return success(baseService.queryOperatorDetailPerformance(params));
+    }
+
+    @ApiOperation(value = "查询产线月份人员日工时管理", notes = "查询产线月份人员日工时管理")
+    @PostMapping("/queryOperatorDetailsPerformance")
+    public R<List<TaskNode>> queryOperatorDetailsPerformance(@RequestBody(required = true) TaskNode params) {
+        return success(baseService.queryOperatorDetailsPerformance(params));
+    }
+}

+ 40 - 16
imcs-admin-boot/imcs-business-entity/src/main/java/com/github/zuihou/business/operationManagementCenter/entity/TaskNode.java

@@ -343,22 +343,6 @@ public class TaskNode extends Entity<Long> {
     @Excel(name = "推迟(1-是0-否)")
     private String delayFlag;
 
-    /**
-     * 产线名称
-     */
-    @TableField(exist = false)
-    private String productionlineName;
-
-    /**
-     * 生产工时汇总(小时)
-     */
-    @TableField(exist = false)
-    private String statisticalHours;
-
-    @ApiModelProperty(value="统计月")
-    @TableField(exist = false)
-    private String statisticalDate;
-
     /**
      * 上料类型判断
      * @return
@@ -401,4 +385,44 @@ public class TaskNode extends Entity<Long> {
     @TableField(exist = false)
     private List<AutoNode> childrenNode;
 
+    /**
+     * 产线id
+     */
+    @TableField(exist = false)
+    private String productionlineId;
+
+    /**
+     * 产线名称
+     */
+    @TableField(exist = false)
+    private String productionlineName;
+
+    /**
+     * 生产工时汇总(小时)
+     */
+    @TableField(exist = false)
+    private String statisticalHours;
+
+    @ApiModelProperty(value="统计月")
+    @TableField(exist = false)
+    private String statisticalDate;
+
+    @ApiModelProperty(value="用户姓名")
+    @TableField(exist = false)
+    private String name;
+
+    @ApiModelProperty(value="机构")
+    @TableField(exist = false)
+    private String orgName;
+
+    @ApiModelProperty(value="操作人")
+    @TableField(exist = false)
+    private String loadingId;
+
+    @ApiModelProperty(value="操作日期")
+    @TableField(exist = false)
+    private String loadingDate;
+
+
+
 }