Merge branch 'dev-nx' of http://192.168.0.56:3000/bonus/devicesmgt into dev-nx

This commit is contained in:
BianLzhaoMin 2024-04-29 16:53:22 +08:00
commit 0f4f63b29c
18 changed files with 1635 additions and 7 deletions

View File

@ -172,7 +172,7 @@ public class TmTaskController extends BaseController {
if (StringUtils.isNull(task)) {
return AjaxResult.error("参数错误");
}
if (StringUtils.isNotNull(task.getLeaseApplyInfo().getPhone())) {
if (StringUtils.isNotBlank(task.getLeaseApplyInfo().getPhone())) {
String phone = task.getLeaseApplyInfo().getPhone();
if (!PhoneUtil.isMobile(phone)){
logger.error("手机号格式错误 :{}", phone);

View File

@ -4,9 +4,11 @@ import com.bonus.sgzb.common.core.web.controller.BaseController;
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
import com.bonus.sgzb.common.log.annotation.Log;
import com.bonus.sgzb.common.log.enums.BusinessType;
import com.bonus.sgzb.largeScreen.domain.ParamsDto;
import com.bonus.sgzb.largeScreen.domain.*;
import com.bonus.sgzb.largeScreen.service.ILargeScreenService;
import lombok.extern.slf4j.Slf4j;
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;
@ -18,6 +20,7 @@ import javax.annotation.Resource;
*/
@RestController
@RequestMapping("/largeScreen/home/")
@Slf4j
public class LargeScreenController extends BaseController {
@Resource(name = "ILargeScreenService")
@ -29,12 +32,34 @@ public class LargeScreenController extends BaseController {
return service.getMaterialReqData();
}
@Log(title = "领料数据详情", businessType = BusinessType.QUERY)
@PostMapping("getMaterialReqData/details")
public AjaxResult getMaterialReqDetailData(@RequestBody ParamsDto dto) {
try {
PageResultVo data = service.getMaterialReqDetailData(dto);
return AjaxResult.success(data);
} catch (Exception e) {
throw new RuntimeException(e.getMessage());
}
}
@Log(title = "退料数据", businessType = BusinessType.QUERY)
@PostMapping("getMaterialReturnData")
public AjaxResult getMaterialReturnData() {
return service.getMaterialReturnData();
}
@Log(title = "退料数据详情", businessType = BusinessType.QUERY)
@PostMapping("getMaterialReturnData/details")
public AjaxResult getMaterialReturnDetailData(@RequestBody ParamsDto dto) {
try {
PageResultVo data = service.getMaterialReturnDetailData(dto);
return AjaxResult.success(data);
} catch (Exception e) {
throw new RuntimeException(e.getMessage());
}
}
@Log(title = "设备分布图",businessType = BusinessType.QUERY)
@PostMapping("getEquipmentDisByMap")
public AjaxResult getEquipmentDisByMap(ParamsDto dto) {
@ -47,6 +72,17 @@ public class LargeScreenController extends BaseController {
return service.getTotalOwnership();
}
@Log(title = "施工机具/安全工器具总保有量详情",businessType = BusinessType.QUERY)
@PostMapping("getTotalOwnership/details")
public AjaxResult getTotalOwnerDetailsShip(@RequestBody ParamsDto dto) {
try {
PageResultVo data = service.getTotalOwnerDetailsShip(dto);
return AjaxResult.success(data);
} catch (Exception e) {
throw new RuntimeException(e.getMessage());
}
}
@Log(title = "各公司机具保有量",businessType = BusinessType.QUERY)
@PostMapping("getTotalOwnershipByCompany")
public AjaxResult getTotalOwnershipByCompany() {
@ -59,30 +95,91 @@ public class LargeScreenController extends BaseController {
return service.getScrapAnalysisByMonth(dto);
}
@Log(title = "当月报废分析详情", businessType = BusinessType.QUERY)
@PostMapping("getScrapAnalysisByMonth/details")
public AjaxResult getScrapAnalysisDetailByMonth(@RequestBody ParamsDto dto) {
try {
PageResultVo data = service.getScrapAnalysisDetailByMonth(dto);
return AjaxResult.success(data);
} catch (Exception e) {
throw new RuntimeException(e.getMessage());
}
}
@Log(title = "新购验收入库分析",businessType = BusinessType.QUERY)
@PostMapping("getAcceptanceStorage")
public AjaxResult getAcceptanceStorage(ParamsDto dto) {
return service.getAcceptanceStorage(dto);
}
@Log(title = "新购验收入库分析详情",businessType = BusinessType.QUERY)
@PostMapping("getAcceptanceStorage/details")
public AjaxResult getAcceptanceDetailStorage(@RequestBody ParamsDto dto) {
try {
PageResultVo data = service.getAcceptanceDetailStorage(dto);
return AjaxResult.success(data);
} catch (Exception e) {
throw new RuntimeException(e.getMessage());
}
}
@Log(title = "当月领料分析", businessType = BusinessType.QUERY)
@PostMapping("getPickingAnalysisByMonth")
public AjaxResult getPickingAnalysisByMonth(ParamsDto dto) {
return service.getPickingAnalysisByMonth(dto);
}
@Log(title = "当月领料分析详情", businessType = BusinessType.QUERY)
@PostMapping("getPickingAnalysisByMonth/details")
public AjaxResult getPickingAnalysisDetailByMonth(@RequestBody ParamsDto dto) {
try {
PageResultVo data = service.getPickingAnalysisDetailByMonth(dto);
return AjaxResult.success(data);
} catch (Exception e) {
throw new RuntimeException(e.getMessage());
}
}
@Log(title = "当月退料分析", businessType = BusinessType.QUERY)
@PostMapping("getMaterialReturnByMonth")
public AjaxResult getMaterialReturnByMonth(ParamsDto dto) {
return service.getMaterialReturnByMonth(dto);
}
@Log(title = "当月退料分析详情", businessType = BusinessType.QUERY)
@PostMapping("getMaterialReturnByMonth/details")
public AjaxResult getMaterialReturnDetailByMonth(@RequestBody ParamsDto dto) {
try {
PageResultVo data = service.getMaterialReturnDetailByMonth(dto);
return AjaxResult.success(data);
} catch (Exception e) {
throw new RuntimeException(e.getMessage());
}
}
@Log(title = "当月维修分析", businessType = BusinessType.QUERY)
@PostMapping("getMaintenanceByMonth")
public AjaxResult getMaintenanceByMonth(ParamsDto dto) {
return service.getMaintenanceByMonth(dto);
}
@Log(title = "当月维修分析详情列表", businessType = BusinessType.QUERY)
@PostMapping("getMaintenanceByMonth/chart")
public AjaxResult getMaintenanceChartByMonth(@RequestBody ParamsDto dto) {
return service.getMaintenanceChartByMonth(dto);
}
@Log(title = "当月维修分析详情", businessType = BusinessType.QUERY)
@PostMapping("getMaintenanceByMonth/details")
public AjaxResult getMaintenanceDetailByMonth(@RequestBody ParamsDto dto) {
try {
PageResultVo data = service.getMaintenanceDetailByMonth(dto);
return AjaxResult.success(data);
} catch (Exception e) {
throw new RuntimeException(e.getMessage());
}
}
@Log(title = "当月车辆使用", businessType = BusinessType.QUERY)
@PostMapping("getCarUseByMonth")
public AjaxResult getCarUseByMonth() {

View File

@ -0,0 +1,27 @@
package com.bonus.sgzb.largeScreen.domain;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 配件返回数据vo
* @Author ma_sh
* @create 2024/4/24 16:48
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class AccessVo {
@ApiModelProperty(value = "配件名称")
private String partName;
@ApiModelProperty(value = "配件数量")
private Double partNum;
/** 机具分公司名称*/
@ApiModelProperty(value = "机具分公司名称")
private String companyName;
}

View File

@ -16,5 +16,39 @@ public class CommonConstants {
/** 调试分公司*/
public static final String TS = "调试分公司";
/** 机具分公司审核通过状态*/
public static final String MACHINERY_BRANCH_APPROVE_STATUS = "1";
/** 机具分公司审核通过名称*/
public static final String MACHINERY_BRANCH_APPROVE_NAME = "机具分公司审核通过";
/** 机具分公司审批不通过状态*/
public static final String MACHINERY_BRANCH_NOAPPROVE_STATUS = "2";
/** 机具分公司审批不通过名称*/
public static final String MACHINERY_BRANCH_NOAPPROVE_NAME = "机具分公司审批不通过名称";
/** 调试分公司审批通过状态*/
public static final String DEBUG_BRANCH_APPROVE_STATUS = "3";
/** 调试分公司审批通过名称*/
public static final String DEBUG_BRANCH_APPROVE_NAME = "调试分公司审批通过名称1";
/** 调试分公司审批不通过状态*/
public static final String DEBUG_BRANCH_NOAPPROVE_STATUS = "4";
/** 调试分公司审批不通过名称*/
public static final String DEBUG_BRANCH_NOAPPROVE_NAME = "调试分公司审批不通过";
/** 出库进行中状态*/
public static final String OUTBOUNDING_STATUS = "5";
/** 出库进行中名称*/
public static final String OUTBOUNDING_NAME = "出库进行中";
/** 出库完成状态*/
public static final String OUTBOUND_COMPLETED_STATUS = "6";
/** 出库完成名称*/
public static final String OUTBOUND_COMPLETED_NAME = "出库完成";
}

View File

@ -0,0 +1,83 @@
package com.bonus.sgzb.largeScreen.domain;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 领出料返回详情vo
* @Author ma_sh
* @create 2024/4/22 13:15
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class MaterialDetailVo {
/** 领、退料申请时间*/
@ApiModelProperty(value = "领、退料申请时间")
private String materialTime;
/** 设备类型名称*/
@ApiModelProperty(value = "设备类型名称")
private String typeName;
/** 设备类型id*/
@ApiModelProperty(value = "设备类型id")
private String typeId;
/** 规格型号*/
@ApiModelProperty(value = "规格型号")
private String typeModelName;
/** 领、退料数量*/
@ApiModelProperty(value = "领、退料数量")
private Double num;
/** 实际退料数量*/
@ApiModelProperty(value = "实际退料数量")
private Double realityNum;
/** 设备负责人*/
@ApiModelProperty(value = "设备负责人")
private String userName;
/** 领、退料单号*/
@ApiModelProperty(value = "领、退料单号")
private String materialCode;
/** 单位名称*/
@ApiModelProperty(value = "单位名称")
private String unitName;
/** 单位id*/
@ApiModelProperty(value = "单位id")
private String unitId;
/** 工程名称*/
@ApiModelProperty(value = "工程名称")
private String projectName;
/** 工程id*/
@ApiModelProperty(value = "工程id")
private String projectId;
/** 机具分公司名称*/
@ApiModelProperty(value = "机具分公司名称")
private String companyName;
/** 领、退料状态*/
@ApiModelProperty(value = "领、退料状态")
private Integer auditStatus;
/** 退料状态名称
* 领料状态30 待分公司审核 31 待机具分公司审核 32 待施工部审核 33 待出库 34 出库进行中 35 完成
* 退料状态 37 待退料审核 38 退料审核通过 39 退料核查中 40 退料完成*/
@ApiModelProperty(value = "领、退料状态名称")
private String statusName;
/** 领料方式(0 编码 1 数量)*/
@ApiModelProperty(value = "管理方式(0 编码 1 数量)")
private String manageType;
}

View File

@ -0,0 +1,89 @@
package com.bonus.sgzb.largeScreen.domain;
import java.io.Serializable;
import java.util.List;
/**
* @Author ma_sh
* @create 2024/4/24 13:59
*/
public class PageResultVo<T> implements Serializable {
private static final long serialVersionUID = -3915666721968467471L;
private int pageNum;
private int pageSize;
private long total;
private int totalPageCount;
private List<T> rows;
public PageResultVo() {
}
public PageResultVo(List<T> rows, int total) {
this.rows = rows;
this.total = (long)total;
}
public PageResultVo(int pageNum, int pageSize, long total, int totalPageCount, List<T> rows) {
this.pageNum = pageNum;
this.pageSize = pageSize;
this.total = total;
this.totalPageCount = totalPageCount;
this.rows = rows;
}
public boolean getFirstPage() {
return this.getPageNum() == 1;
}
public long getPrevPage() {
return (long)Math.max(1, this.getPageNum() - 1);
}
public long getNextPage() {
return (long)(this.getPageNum() + 1);
}
public boolean getLastPage() {
return this.getPageNum() >= this.getTotalPageCount();
}
public int getPageNum() {
return this.pageNum;
}
public void setPageNum(int pageNum) {
this.pageNum = pageNum;
}
public int getPageSize() {
return this.pageSize;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
public long getTotal() {
return this.total;
}
public void setTotal(long total) {
this.total = total;
}
public int getTotalPageCount() {
return this.totalPageCount;
}
public void setTotalPageCount(int totalPageCount) {
this.totalPageCount = totalPageCount;
}
public List<T> getRows() {
return this.rows;
}
public void setRows(List<T> rows) {
this.rows = rows;
}
}

View File

@ -1,5 +1,6 @@
package com.bonus.sgzb.largeScreen.domain;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
@ -19,11 +20,47 @@ public class ParamsDto {
/** 结束日期*/
private String endDate;
/** 类型*/
/**
* 类型 验收1 入库2
* */
private String type;
/**
* 公司id
*/
private String companyId;
private int pageNum;
private int pageSize;
/** 领料单号*/
@ApiModelProperty(value = "领料单号")
private String materialCode;
@ApiModelProperty(value = "维修单号")
private String repairCode;
/** 单位id*/
@ApiModelProperty(value = "单位id")
private String unitId;
/** 工程id*/
@ApiModelProperty(value = "工程id")
private String projectId;
/** 机具类型*/
@ApiModelProperty(value = "机具类型")
private String typeId;
/** 报废单号*/
@ApiModelProperty(value = "报废单号")
private String scrapCode;
/** 报废来源 (1,退料报废 2,维修报废 3,盘点报废)*/
@ApiModelProperty(value = "报废来源")
private String scrapSource;
/** 报废状态 0进行中1已审核2驳回3待处置4已处置*/
@ApiModelProperty(value = "报废状态")
private String scrapStatus;
}

View File

@ -0,0 +1,62 @@
package com.bonus.sgzb.largeScreen.domain;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 维修返回数据vo
* @Author ma_sh
* @create 2024/4/24 16:50
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class RepairDetailVo {
@ApiModelProperty(value = "维修单号")
private String repairCode;
/** 单位id*/
@ApiModelProperty(value = "单位id")
private String unitId;
@ApiModelProperty(value = "机具分公司名称")
private String unitName;
/** 类型名称*/
@ApiModelProperty(value = "类型名称")
private String typeName;
/** 工程名称*/
@ApiModelProperty(value = "工程名称")
private String projectName;
/** 工程id*/
@ApiModelProperty(value = "工程id")
private String projectId;
@ApiModelProperty(value = "任务创建人")
private String createBy;
@ApiModelProperty(value = "创建时间")
private String createTime;
/** 领、退料单号*/
@ApiModelProperty(value = "领、退料单号")
private String materialCode;
@ApiModelProperty(value = "维修状态")
private String repairStatus;
/**
* 维修状态42 维修待进行 43 维修进行中 44 维修完成
*/
@ApiModelProperty(value = "状态名称")
private String statusName;
/** 机具分公司名称*/
@ApiModelProperty(value = "机具分公司名称")
private String companyName;
}

View File

@ -0,0 +1,27 @@
package com.bonus.sgzb.largeScreen.domain;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* 维修返回数据集合vo
* @Author ma_sh
* @create 2024/4/24 16:57
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class RepairVo {
@ApiModelProperty(value = "配件使用情况返回集合")
private List<AccessVo> accessVoList;
@ApiModelProperty(value = "维修详情返回vo")
private List<RepairDetailVo> repairDetailVoList;
}

View File

@ -0,0 +1,57 @@
package com.bonus.sgzb.largeScreen.domain;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 报废返回数据vo
* @Author ma_sh
* @create 2024/4/24 9:46
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ScrapVo {
/** 报废单号*/
@ApiModelProperty(value = "报废单号")
private String scrapCode;
/** 报废来源 (1,退料报废 2,维修报废 3,盘点报废)*/
@ApiModelProperty(value = "报废来源")
private String scrapSource;
/** 报废来源名称 (1,退料报废 2,维修报废 3,盘点报废)*/
@ApiModelProperty(value = "报废来源名称")
private String scrapSourceName;
/** 报废时间*/
@ApiModelProperty(value = "报废时间")
private String scrapTime;
/** 设备类型名称*/
@ApiModelProperty(value = "设备类型名称")
private String typeName;
/** 设备类型id*/
@ApiModelProperty(value = "设备类型id")
private String typeId;
/** 规格型号*/
@ApiModelProperty(value = "规格型号")
private String typeModelName;
/** 报废数量*/
@ApiModelProperty(value = "报废数量")
private String scrapNum;
/** 处置状态 0进行中1已审核2驳回3待处置4已处置 */
@ApiModelProperty(value = "处置状态")
private String scrapStatus;
/** 状态名称 0进行中1已审核2驳回3待处置4已处置 */
@ApiModelProperty(value = "状态名称")
private String statusName;
}

View File

@ -0,0 +1,51 @@
package com.bonus.sgzb.largeScreen.domain;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 新购验收入库分析详情返回vo
* @Author ma_sh
* @create 2024/4/23 16:37
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class StorageDetailVo {
/** 设备类型名称*/
@ApiModelProperty(value = "设备类型名称")
private String typeName;
/** 设备类型id*/
@ApiModelProperty(value = "设备类型id")
private String typeId;
/** 规格型号*/
@ApiModelProperty(value = "规格型号")
private String typeModelName;
/** 采购数量*/
@ApiModelProperty(value = "采购数量")
private int purchaseNum;
/** 验收数量*/
@ApiModelProperty(value = "验收数量")
private int checkNum;
/** 入库数量*/
@ApiModelProperty(value = "入库数量")
private int inputNum;
/** 机具分公司名称*/
@ApiModelProperty(value = "机具分公司名称")
private String companyName;
@ApiModelProperty(value = "新购时间")
private String arrivalTime;
@ApiModelProperty(value = "入库时间")
private String inputTime;
}

View File

@ -0,0 +1,84 @@
package com.bonus.sgzb.largeScreen.domain;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @Author ma_sh
* @create 2024/4/22 17:56
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class TotalOwnerVo {
/** 设备类型名称*/
@ApiModelProperty(value = "设备类型名称")
private String typeName;
/** 设备类型id*/
@ApiModelProperty(value = "设备类型id")
private String typeId;
/** 规格型号*/
@ApiModelProperty(value = "规格型号")
private String typeModelName;
/** 单位*/
@ApiModelProperty(value = "单位")
private String unitName;
/** 总保有量*/
@ApiModelProperty(value = "总保有量")
private int totalOwnershipNum;
/** 在库机具/工器具*/
@ApiModelProperty(value = "在库机具")
private int stockNum;
/** 新购待入库机具/工器具*/
@ApiModelProperty(value = "新购待入库机具")
private int purchaseNum;
/** 修饰后待入库机具/工器具*/
@ApiModelProperty(value = "修饰后待入库机具")
private int inputNum;
/** 待入库机具/工器具*/
@ApiModelProperty(value = "待入库机具")
private int storedNum;
/** 出库机具/工器具*/
@ApiModelProperty(value = "出库机具")
private int outNum;
/** 审核通过入库机具/工器具*/
@ApiModelProperty(value = "审核通过入库机具")
private int auditNum;
/** 在用机具/工器具*/
@ApiModelProperty(value = "在用机具")
private int useNum;
/** 在修机具/工器具*/
@ApiModelProperty(value = "在修机具")
private int inRepairNum;
/** 维修总量*/
@ApiModelProperty(value = "维修总量")
private int repairNum;
/** 维修合格*/
@ApiModelProperty(value = "维修合格")
private int repairedNum;
/** 维修报废数量*/
@ApiModelProperty(value = "维修报废数量")
private int scrapNum;
/** 公司名称*/
@ApiModelProperty(value = "公司名称")
private String companyName;
}

View File

@ -0,0 +1,25 @@
package com.bonus.sgzb.largeScreen.domain;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* @Author ma_sh
* @create 2024/4/23 15:40
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class TotalVo {
/** 工机具类型名称*/
@ApiModelProperty(value = "工机具类型名称")
private String companyName;
/** 类型所属集合*/
@ApiModelProperty(value = "类型所属集合")
private List<TotalOwnerVo> list;
}

View File

@ -108,4 +108,67 @@ public interface LargeScreenMapper {
* @return List<TotalOwnershipVo>
*/
List<TotalOwnershipVo> getCompany();
/**
* 领料数据详情
* @param dto
* @return
*/
List<MaterialDetailVo> getMaterialReqDetailData(ParamsDto dto);
/**
* 退料数据详情
* @param dto
* @return
*/
List<MaterialDetailVo> getMaterialReturnDetailData(ParamsDto dto);
/**
* 施工机具/安全工器具总保有量详情
* @param dto
* @return
*/
List<TotalOwnerVo> getTotalOwnerDetailsShip(ParamsDto dto);
/**
* 新购验收入库分析详情
* @param dto
* @return
*/
List<StorageDetailVo> getAcceptanceDetailStorage(ParamsDto dto);
/**
* 当月报废分析详情
* @param dto
* @return
*/
List<ScrapVo> getScrapAnalysisDetailByMonth(ParamsDto dto);
/**
* 当月领料分析详情
* @param dto
* @return
*/
List<MaterialDetailVo> getPickingAnalysisDetailByMonth(ParamsDto dto);
/**
* 当月退料分析详情
* @param dto
* @return
*/
List<MaterialDetailVo> getMaterialReturnDetailByMonth(ParamsDto dto);
/**
* 维修分析详情
* @param dto
* @return
*/
List<RepairDetailVo> getMaintenanceDetailByMonth(ParamsDto dto);
/**
* 维修配件使用情况
* @param dto
* @return
*/
List<AccessVo> getRepairList(ParamsDto dto);
}

View File

@ -1,7 +1,7 @@
package com.bonus.sgzb.largeScreen.service;
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
import com.bonus.sgzb.largeScreen.domain.ParamsDto;
import com.bonus.sgzb.largeScreen.domain.*;
/**
* @author 10488
@ -103,4 +103,67 @@ public interface ILargeScreenService {
* @return AjaxResult
*/
AjaxResult getTotalOwnershipByCompany();
/**
* 领料数据详情
* @param dto
* @return
*/
PageResultVo getMaterialReqDetailData(ParamsDto dto);
/**
* 退料数据详情
* @param dto
* @return
*/
PageResultVo getMaterialReturnDetailData(ParamsDto dto);
/**
* 施工机具/安全工器具总保有量详情
* @param dto
* @return
*/
PageResultVo getTotalOwnerDetailsShip(ParamsDto dto);
/**
* 新购验收入库分析详情
* @param dto
* @return
*/
PageResultVo getAcceptanceDetailStorage(ParamsDto dto);
/**
* 当月报废分析详情
* @param dto
* @return
*/
PageResultVo getScrapAnalysisDetailByMonth(ParamsDto dto);
/**
* 当月领料分析详情
* @param dto
* @return
*/
PageResultVo getPickingAnalysisDetailByMonth(ParamsDto dto);
/**
* 当月退料分析详情
* @param dto
* @return
*/
PageResultVo getMaterialReturnDetailByMonth(ParamsDto dto);
/**
* 当月维修分析详情
* @param dto
* @return
*/
PageResultVo getMaintenanceDetailByMonth(ParamsDto dto);
/**
* 当月维修分析详情列表
* @param dto
* @return
*/
AjaxResult getMaintenanceChartByMonth(ParamsDto dto);
}

View File

@ -6,12 +6,15 @@ import com.bonus.sgzb.largeScreen.domain.*;
import com.bonus.sgzb.largeScreen.mapper.LargeScreenMapper;
import com.bonus.sgzb.largeScreen.service.ILargeScreenService;
import com.bonus.sgzb.largeScreen.util.CommonUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author 10488
@ -92,6 +95,247 @@ public class LargeScreenServiceImpl implements ILargeScreenService {
return AjaxResult.success(list);
}
/**
* 领料数据详情
* @param dto
* @return
*/
@Override
public PageResultVo getMaterialReqDetailData(ParamsDto dto) {
extracted(dto);
// 分页
PageHelper.startPage(dto.getPageNum() == 0 ? 1 : dto.getPageNum(), dto.getPageSize());
PageResultVo pageResult = new PageResultVo();
List<MaterialDetailVo> result = mapper.getMaterialReqDetailData(dto);
// 分页信息
PageInfo<MaterialDetailVo> pageInfo = new PageInfo<>(result);
pageResult.setTotal(pageInfo.getTotal());
pageResult.setTotalPageCount(pageInfo.getPages());
pageResult.setRows(result);
pageResult.setPageNum (dto.getPageNum());
pageResult.setPageSize(dto.getPageSize());
return pageResult;
}
/**
* 退料数据详情
* @param dto
* @return
*/
@Override
public PageResultVo getMaterialReturnDetailData(ParamsDto dto) {
extracted(dto);
// 分页
PageHelper.startPage(dto.getPageNum() == 0 ? 1 : dto.getPageNum(), dto.getPageSize());
PageResultVo pageResult = new PageResultVo();
List<MaterialDetailVo> materialReturnDetailData = mapper.getMaterialReturnDetailData(dto);
// 分页信息
PageInfo<MaterialDetailVo> pageInfo = new PageInfo<>(materialReturnDetailData);
pageResult.setTotal(pageInfo.getTotal());
pageResult.setTotalPageCount(pageInfo.getPages());
pageResult.setRows(materialReturnDetailData);
pageResult.setPageNum (dto.getPageNum());
pageResult.setPageSize(dto.getPageSize());
return pageResult;
}
/**
* 施工机具/安全工器具总保有量详情
* @param dto
* @return
*/
@Override
public PageResultVo getTotalOwnerDetailsShip(ParamsDto dto) {
extracted(dto);
// 分页
PageHelper.startPage(dto.getPageNum() == 0 ? 1 : dto.getPageNum(), dto.getPageSize());
PageResultVo pageResult = new PageResultVo();
List<TotalOwnerVo> list = mapper.getTotalOwnerDetailsShip(dto);
// 分页信息
PageInfo<TotalOwnerVo> pageInfo = new PageInfo<>(list);
pageResult.setTotal(pageInfo.getTotal());
pageResult.setTotalPageCount(pageInfo.getPages());
pageResult.setRows(list);
pageResult.setPageNum (dto.getPageNum());
pageResult.setPageSize(dto.getPageSize());
return pageResult;
}
/**
* 新购验收入库分析详情
* @param dto
* @return
*/
@Override
public PageResultVo getAcceptanceDetailStorage(ParamsDto dto) {
extracted(dto);
// 分页
PageHelper.startPage(dto.getPageNum() == 0 ? 1 : dto.getPageNum(), dto.getPageSize());
PageResultVo pageResult = new PageResultVo();
List<StorageDetailVo> result;
result = mapper.getAcceptanceDetailStorage(dto);
result = result.stream()
.filter(storageDetail -> storageDetail.getPurchaseNum() != 0 ||
storageDetail.getCheckNum() != 0 ||
storageDetail.getInputNum() != 0)
.collect(Collectors.toList());
// 分页信息
PageInfo<StorageDetailVo> pageInfo = new PageInfo<>(result);
pageResult.setTotal(pageInfo.getTotal());
pageResult.setTotalPageCount(pageInfo.getPages());
pageResult.setRows(result);
pageResult.setPageNum (dto.getPageNum());
pageResult.setPageSize(dto.getPageSize());
return pageResult;
}
/**
* 方法抽取统一赋值
* @param dto
*/
private void extracted(ParamsDto dto) {
if (dto.getMaType() != null && ("1").equals(dto.getMaType())) {
dto.setMaTypeName(CommonConstants.JJ);
}
if (dto.getMaType() != null && ("2").equals(dto.getMaType())) {
dto.setMaTypeName(CommonConstants.TS);
}
}
/**
* 当月报废分析详情
* @param dto
* @return
*/
@Override
public PageResultVo getScrapAnalysisDetailByMonth(ParamsDto dto) {
extracted(dto);
Map<String, String> monthDayMap = DateTimeHelper.getNowOneMonthDay();
try {
dto.setStartDate(monthDayMap.get("beginDate"));
dto.setEndDate(monthDayMap.get("endDate"));
// 分页
PageHelper.startPage(dto.getPageNum() == 0 ? 1 : dto.getPageNum(), dto.getPageSize());
PageResultVo pageResult = new PageResultVo();
List<ScrapVo> result = mapper.getScrapAnalysisDetailByMonth(dto);
// 分页信息
PageInfo<ScrapVo> pageInfo = new PageInfo<>(result);
pageResult.setTotal(pageInfo.getTotal());
pageResult.setTotalPageCount(pageInfo.getPages());
pageResult.setRows(result);
pageResult.setPageNum (dto.getPageNum());
pageResult.setPageSize(dto.getPageSize());
return pageResult;
} catch (Exception e) {
log.error("当月报废分析详情error:{}", e.getMessage());
return null;
}
}
/**
* 当月领料分析详情
* @param dto
* @return
*/
@Override
public PageResultVo getPickingAnalysisDetailByMonth(ParamsDto dto) {
Map<String, String> monthDayMap = DateTimeHelper.getNowOneMonthDay();
extracted(dto);
try {
dto.setStartDate(monthDayMap.get("beginDate"));
dto.setEndDate(monthDayMap.get("endDate"));
// 分页
PageHelper.startPage(dto.getPageNum() == 0 ? 1 : dto.getPageNum(), dto.getPageSize());
PageResultVo pageResult = new PageResultVo();
List<MaterialDetailVo> result = mapper.getPickingAnalysisDetailByMonth(dto);
// 分页信息
PageInfo<MaterialDetailVo> pageInfo = new PageInfo<>(result);
pageResult.setTotal(pageInfo.getTotal());
pageResult.setTotalPageCount(pageInfo.getPages());
pageResult.setRows(result);
pageResult.setPageNum (dto.getPageNum());
pageResult.setPageSize(dto.getPageSize());
return pageResult;
} catch (Exception e) {
log.error("当月领料分析详情error:{}", e.getMessage());
return null;
}
}
/**
* 当月退料分析详情
* @param dto
* @return
*/
@Override
public PageResultVo getMaterialReturnDetailByMonth(ParamsDto dto) {
extracted(dto);
try {
Map<String, String> monthDayMap = DateTimeHelper.getNowOneMonthDay();
dto.setStartDate(monthDayMap.get("beginDate"));
dto.setEndDate(monthDayMap.get("endDate"));
// 分页
PageHelper.startPage(dto.getPageNum() == 0 ? 1 : dto.getPageNum(), dto.getPageSize());
PageResultVo pageResult = new PageResultVo();
List<MaterialDetailVo> result = mapper.getMaterialReturnDetailByMonth(dto);
// 分页信息
PageInfo<MaterialDetailVo> pageInfo = new PageInfo<>(result);
pageResult.setTotal(pageInfo.getTotal());
pageResult.setTotalPageCount(pageInfo.getPages());
pageResult.setRows(result);
pageResult.setPageNum (dto.getPageNum());
pageResult.setPageSize(dto.getPageSize());
return pageResult;
} catch (Exception e) {
log.error("当月退料分析详情error:{}", e.getMessage());
return null;
}
}
/**
* 当月维修分析详情
* @param dto
* @return
*/
@Override
public PageResultVo getMaintenanceDetailByMonth(ParamsDto dto) {
extracted(dto);
try {
Map<String, String> monthDayMap = DateTimeHelper.getNowOneMonthDay();
dto.setStartDate(monthDayMap.get("beginDate"));
dto.setEndDate(monthDayMap.get("endDate"));
// 分页
PageResultVo pageResult = new PageResultVo<>();
PageHelper.startPage(dto.getPageNum() == 0 ? 1 : dto.getPageNum(), dto.getPageSize());
List<RepairDetailVo> repairDetailVoList = mapper.getMaintenanceDetailByMonth(dto);
// 分页信息
PageInfo<RepairDetailVo> pageInfo = new PageInfo<>(repairDetailVoList);
pageResult.setTotal(pageInfo.getTotal());
pageResult.setTotalPageCount(pageInfo.getPages());
pageResult.setRows(repairDetailVoList);
pageResult.setPageNum (dto.getPageNum());
pageResult.setPageSize(dto.getPageSize());
return pageResult;
}catch (Exception e) {
log.error("当月维修分析详情error:{}", e.getMessage());
return null;
}
}
/**
* 当月维修分析详情列表
* @param dto
* @return
*/
@Override
public AjaxResult getMaintenanceChartByMonth(ParamsDto dto) {
HashMap<Object, Object> objectHashMap = getObjectHashMap(dto);
List<AccessVo> accessVoList = mapper.getRepairList(dto);
objectHashMap.put("accessVoList", accessVoList);
return AjaxResult.success(objectHashMap);
}
@Override
public AjaxResult getTotalOwnership() {
List<TotalOwnershipVo> list = new ArrayList<>();
@ -156,8 +400,12 @@ public class LargeScreenServiceImpl implements ILargeScreenService {
List<ScrapAnalysisVo> bfValueList = mapper.getTotalOwnership(dto);
Integer bfValue = commonUtil.setBFData(bfValueList);
vo.setScrapNum(bfValue);
// 总保有量
vo.setTotalOwnershipNum(zkValue + drkValue + useValue + zxValue);
// 修饰待入库
dto.setType("6");
List<ScrapAnalysisVo> decoratedValueList = mapper.getTotalOwnership(dto);
Integer decoratedValue = commonUtil.setDeData(decoratedValueList);
// 总保有量 = 在库+在用+在修+修试后待入库
vo.setTotalOwnershipNum(zkValue + decoratedValue + useValue + zxValue);
return vo;
}
@ -276,6 +524,16 @@ public class LargeScreenServiceImpl implements ILargeScreenService {
@Override
public AjaxResult getMaintenanceByMonth(ParamsDto dto) {
HashMap<Object, Object> map = getObjectHashMap(dto);
return AjaxResult.success(map);
}
/**
* 方法抽取
* @param dto
* @return
*/
private HashMap<Object, Object> getObjectHashMap(ParamsDto dto) {
HashMap<Object, Object> map = new HashMap<>(6);
int num = 0, num2 = 0, num3 = 0, num4 = 0;
String rate = "0%", rate2 = "0%", rate3 = "0%";
@ -302,7 +560,7 @@ public class LargeScreenServiceImpl implements ILargeScreenService {
map.put("rate", rate);
map.put("rate2", rate2);
map.put("rate3", rate3);
return AjaxResult.success(map);
return map;
}
@Override

View File

@ -366,4 +366,28 @@ public class CommonUtil {
double doubleTotalValue = totalValue.doubleValue();
return (int) Math.round(doubleTotalValue);
}
/**
* 修饰待入库
* @param list
* @return
*/
public Integer setDeData(List<ScrapAnalysisVo> list) {
if (CollectionUtils.isEmpty(list)){
return 0;
}
BigDecimal finalValue = new BigDecimal(new Double(0).toString());
BigDecimal totalValue = new BigDecimal(new Double(0).toString());
BigDecimal totalValue2 = new BigDecimal(new Double(0).toString());
for (int i = 0; i < list.size(); i++) {
ScrapAnalysisVo vo = list.get(i);
BigDecimal value = new BigDecimal(new Double(String.valueOf(vo.getNum())));
totalValue = totalValue.add(value);
BigDecimal value2 = new BigDecimal(new Double(String.valueOf(vo.getNum2())));
totalValue2 = totalValue2.add(value2);
}
finalValue = totalValue.subtract(totalValue2);
double doubleValue = finalValue.doubleValue();
return (int) Math.round(doubleValue);
}
}

View File

@ -287,6 +287,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND sd.dept_id = #{companyId}
</if>
</if>
/*修饰待入库*/
<if test="type == 6">
SELECT rid.repair_num AS num,
rid.input_num AS num2,
mt.type_name AS typeName
FROM repair_input_details rid
LEFT JOIN ma_type mt ON rid.type_id = mt.type_id AND mt.`level` = '4'
LEFT JOIN sys_dept sd ON sd.dept_id = mt.company_id
<where>
<if test="maType!=null and maType == 1">
sd.dept_name = #{maTypeName}
</if>
<if test="maType!=null and maType == 2">
AND sd.dept_name = #{maTypeName}
</if>
<if test="companyId!=null and companyId !=''">
AND sd.dept_id = #{companyId}
</if>
</where>
</if>
</select>
<!--检修预警-->
<select id="getMaintenanceWarning" resultType="com.bonus.sgzb.largeScreen.domain.MaintenanceWarningVo">
@ -315,4 +335,531 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and sd2.del_flag='0'
and sd.parent_id='0'
</select>
<select id="getMaterialReqDetailData" resultType="com.bonus.sgzb.largeScreen.domain.MaterialDetailVo">
SELECT
lod.create_time AS materialTime,
mt2.type_name AS typeName,
mt2.type_id AS typeId,
mt.type_name AS typeModelName,
lod.out_num AS num,
lai.`code` AS materialCode,
bui.unit_name AS unitName,
bai.unit_id AS unitId,
bpl.lot_id AS projectId,
su.user_name AS userName,
bpl.lot_name AS projectName,
sd.dept_name AS companyName
FROM
lease_out_details lod
LEFT JOIN ma_type mt ON lod.type_id = mt.type_id
AND mt.`level` = '4'
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
LEFT JOIN ma_type_keeper mtk ON mt.type_id = mtk.type_id
LEFT JOIN sys_user su ON mtk.user_id = su.user_id
LEFT JOIN sys_dept sd ON sd.dept_id = mt.company_id
LEFT JOIN lease_apply_info lai ON lod.parent_id = lai.id
LEFT JOIN tm_task_agreement tta ON lai.task_id = tta.task_id
LEFT JOIN bm_agreement_info bai ON tta.agreement_id = bai.agreement_id
LEFT JOIN bm_unit_info bui ON bai.unit_id = bui.unit_id
LEFT JOIN bm_project_lot bpl ON bai.project_id = bpl.lot_id
WHERE
DATE( lod.create_time ) = CURDATE()
<if test="maTypeName!=null and maTypeName != ''">
AND sd.dept_name = #{maTypeName}
</if>
<if test="materialCode!=null and materialCode != ''">
AND lai.`code` LIKE CONCAT('%',#{materialCode},'%')
</if>
<if test="unitId!=null and unitId != ''">
AND bai.unit_id = #{unitId}
</if>
<if test="projectId!=null and projectId != ''">
AND bai.project_id = #{projectId}
</if>
<if test="typeId!=null and typeId != ''">
AND mt2.type_id = #{typeId}
</if>
</select>
<select id="getMaterialReturnDetailData" resultType="com.bonus.sgzb.largeScreen.domain.MaterialDetailVo">
SELECT
bad.create_time AS materialTime,
mt2.type_name AS typeName,
mt2.type_id AS typeId,
mt.type_name AS typeModelName,
bad.audit_num AS num,
ba.`code` AS materialCode,
bui.unit_name AS unitName,
bai.unit_id AS unitId,
bpl.lot_id AS projectId,
bpl.lot_name AS projectName,
tt.task_status AS auditStatus,
CASE
tt.task_status
WHEN '37' THEN
'待退料审核'
WHEN '38' THEN
'退料审核通过'
WHEN '39' THEN
'退料核查中'
WHEN '40' THEN
'退料完成' ELSE ''
END AS statusName,
sd.dept_name AS companyName
FROM
back_apply_details bad
LEFT JOIN ma_type mt ON bad.type_id = mt.type_id
AND mt.`level` = '4'
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
LEFT JOIN sys_dept sd ON sd.dept_id = mt.company_id
LEFT JOIN back_apply_info ba ON bad.parent_id = ba.id
LEFT JOIN tm_task tt ON ba.task_id = tt.task_id
LEFT JOIN tm_task_agreement tta ON ba.task_id = tta.task_id
LEFT JOIN bm_agreement_info bai ON tta.agreement_id = bai.agreement_id
LEFT JOIN bm_unit_info bui ON bai.unit_id = bui.unit_id
LEFT JOIN bm_project_lot bpl ON bai.project_id = bpl.lot_id
WHERE
DATE( bad.create_time ) = CURDATE()
<if test="maTypeName!=null and maTypeName != ''">
AND sd.dept_name = #{maTypeName}
</if>
<if test="materialCode!=null and materialCode != ''">
AND ba.`code` LIKE CONCAT('%',#{materialCode},'%')
</if>
<if test="unitId!=null and unitId != ''">
AND bai.unit_id = #{unitId}
</if>
<if test="projectId!=null and projectId != ''">
AND bai.project_id = #{projectId}
</if>
<if test="typeId!=null and typeId != ''">
AND mt2.type_id = #{typeId}
</if>
</select>
<select id="getTotalOwnerDetailsShip" resultType="com.bonus.sgzb.largeScreen.domain.TotalOwnerVo">
SELECT
mt2.type_name AS typeName,
mt2.type_id AS typeId,
mt.type_name AS typeModelName,
mt.unit_name AS unitName,
IFNULL( mt.num, 0 ) AS stockNum,
IFNULL( subquery1.usNum, 0 ) AS useNum,
IFNULL( subquery2.repairNum, 0 ) AS inRepairNum,
IFNULL( subquery3.repairInputNum, 0 ) AS inputNum,
IFNULL( subquery4.inputNum, 0 ) AS purchaseNum,
IFNULL( mt.num, 0 ) + IFNULL( subquery1.usNum, 0 ) + IFNULL( subquery2.repairNum, 0 ) + IFNULL( subquery3.repairInputNum, 0 ) AS totalOwnershipNum,
sd.dept_name AS companyName
FROM
ma_type mt
LEFT JOIN (
SELECT
subquery1.type_id,
subquery1.typeName,
subquery1.typeModelName,
IFNULL( subquery1.outNum, 0 ) AS outNum,
IFNULL( subquery2.backNum, 0 ) AS backNum,
CASE
WHEN IFNULL( subquery1.outNum, 0 ) - IFNULL( subquery2.backNum, 0 ) > 0 THEN
IFNULL( subquery1.outNum, 0 ) - IFNULL( subquery2.backNum, 0 ) ELSE 0
END AS usNum
FROM
(
SELECT
mt.type_id,
mt2.type_name AS typeName,
mt.type_name AS typeModelName,
SUM(IFNULL( lod.out_num, 0 )) AS outNum
FROM
lease_out_details lod
LEFT JOIN ma_type mt ON mt.type_id = lod.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
GROUP BY
mt.type_id
) AS subquery1
LEFT JOIN (
SELECT
mt.type_id,
mt2.type_name AS typeName,
mt.type_name AS typeModelName,
SUM(IFNULL( bcd.back_num, 0 )) backNum
FROM
back_check_details bcd
LEFT JOIN ma_type mt ON mt.type_id = bcd.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
LEFT JOIN ma_machine mm ON mm.ma_id = bcd.ma_id
GROUP BY
mt.type_id
) AS subquery2 ON subquery1.type_id = subquery2.type_id
) AS subquery1 ON mt.type_id = subquery1.type_id
LEFT JOIN (
SELECT
mt.type_id,
mt2.type_name AS typeName,
mt.type_name AS typeModelName,
SUM(
IFNULL( rad.repair_num, 0 ) - IFNULL( rad.repaired_num, 0 ) - IFNULL( rad.scrap_num, 0 )) AS repairNum
FROM
repair_apply_details rad
LEFT JOIN ma_type mt ON mt.type_id = rad.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
WHERE
IFNULL( rad.repair_num, 0 ) - IFNULL( rad.repaired_num, 0 ) - IFNULL( rad.scrap_num, 0 ) > 0
GROUP BY
mt.type_id
) AS subquery2 ON subquery2.type_id = mt.type_id
LEFT JOIN (
SELECT
mt.type_id,
mt2.type_name AS typeName,
mt.type_name AS typeModelName,
SUM(
IFNULL( rid.repair_num, 0 ) - IFNULL( rid.input_num, 0 )) AS repairInputNum
FROM
repair_input_details rid
LEFT JOIN ma_type mt ON mt.type_id = rid.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
WHERE
IFNULL( rid.repair_num, 0 ) - IFNULL( rid.input_num, 0 ) > 0
GROUP BY
mt.type_id
) AS subquery3 ON subquery3.type_id = mt.type_id
LEFT JOIN (
SELECT
mt.type_id,
mt2.type_name AS typeName,
mt.type_name AS typeModelName,
SUM(
IFNULL( pcd.check_num, 0 ) - IFNULL( pcd.input_num, 0 )) AS inputNum
FROM
purchase_check_details pcd
LEFT JOIN ma_type mt ON mt.type_id = pcd.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
WHERE
IFNULL( pcd.check_num, 0 ) - IFNULL( pcd.input_num, 0 ) > 0
GROUP BY
mt.type_id
) AS subquery4 ON subquery4.type_id = mt.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
LEFT JOIN sys_dept sd ON sd.dept_id = mt.company_id
WHERE
mt.`level` = 4
AND mt.del_flag = '0'
<if test="maTypeName!=null and maTypeName != ''">
AND sd.dept_name = #{maTypeName}
</if>
<if test="typeId!=null and typeId != ''">
AND mt2.type_id = #{typeId}
</if>
</select>
<select id="getAcceptanceDetailStorage" resultType="com.bonus.sgzb.largeScreen.domain.StorageDetailVo">
SELECT
mt2.type_name AS typeName,
mt.type_name AS typeModelName,
mt2.type_id AS typeId,
IFNULL( subquery1.purchaseNum, 0 ) AS purchaseNum,
IFNULL( subquery1.checkNum, 0 ) AS checkNum,
IFNULL( subquery2.inputNum, 0 ) AS inputNum,
sd.dept_name AS companyName
FROM
ma_type mt
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
LEFT JOIN sys_dept sd ON sd.dept_id = mt.company_id
LEFT JOIN (
SELECT
mt.type_id,
SUM(IFNULL( pcd.purchase_num, 0 )) AS purchaseNum,
SUM(IFNULL( pcd.check_num, 0 )) AS checkNum,
pci.arrival_time AS arrivalTime
FROM
purchase_check_details pcd
LEFT JOIN ma_type mt ON mt.type_id = pcd.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
LEFT JOIN purchase_check_info pci ON pci.task_id = pcd.task_id
where
1 = 1
<if test="type == 1 and startDate != null ">
AND DATE_FORMAT(pci.arrival_time, '%Y-%m') = #{startDate}
</if>
GROUP BY
mt.type_id
) AS subquery1 ON subquery1.type_id = mt.type_id
LEFT JOIN (
SELECT
mt.type_id,
SUM(IFNULL( iad.input_num, 0 )) AS inputNum,
iad.create_time AS inputTime
FROM
input_apply_details iad
LEFT JOIN ma_type mt ON mt.type_id = iad.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
where
iad.input_type = '1'
<if test="type == 2 and startDate != null ">
AND DATE_FORMAT(iad.create_time, '%Y-%m') = #{startDate}
</if>
GROUP BY
mt.type_id
) AS subquery2 ON subquery2.type_id = mt.type_id
WHERE
mt.`level` = 4
AND mt.del_flag = '0'
<if test="maTypeName!=null and maTypeName != ''">
AND sd.dept_name = #{maTypeName}
</if>
<if test="typeId!=null and typeId != ''">
AND mt2.type_id = #{typeId}
</if>
</select>
<select id="getScrapAnalysisDetailByMonth" resultType="com.bonus.sgzb.largeScreen.domain.ScrapVo">
SELECT
tt.`code` AS scrapCode,
sad.scrap_source AS scrapSource,
CASE
sad.scrap_source
WHEN '1' THEN
'退料报废'
WHEN '2' THEN
'维修报废'
WHEN '3' THEN
'盘点报废' ELSE ''
END AS scrapSourceName,
sad.create_time AS scrapTime,
mt2.type_name AS typeName,
mt2.type_id AS typeId,
mt.type_name AS typeModelName,
scrap_num AS scrapNum,
sad.`status` AS scrapStatus,
CASE
sad.`status`
WHEN '0' THEN
'进行中'
WHEN '1' THEN
'已审核'
WHEN '2' THEN
'驳回'
WHEN '3' THEN
'待处置'
WHEN '4' THEN
'已处置' ELSE ''
END AS statusName,
sd.dept_name AS companyName
FROM
scrap_apply_details sad
LEFT JOIN ma_type mt ON sad.type_id = mt.type_id
AND mt.`level` = '4'
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
LEFT JOIN tm_task tt ON tt.task_id = sad.task_id
WHERE
sad.create_time BETWEEN CONCAT(#{startDate}, ' 00:00:00' ) AND CONCAT(#{endDate}, ' 23:59:59' )
<if test="maTypeName != null and maTypeName != ''">
AND sd.dept_name = #{maTypeName}
</if>
<if test="scrapCode!=null and scrapCode != ''">
AND tt.`code` LIKE CONCAT('%',#{scrapCode},'%')
</if>
<if test="scrapSource!=null and scrapSource != ''">
AND sad.scrap_source = #{scrapSource}
</if>
<if test="scrapStatus!=null and scrapStatus != ''">
AND sad.`status` = #{scrapStatus}
</if>
<if test="typeId!=null and typeId != ''">
AND mt2.type_id = #{typeId}
</if>
</select>
<select id="getPickingAnalysisDetailByMonth"
resultType="com.bonus.sgzb.largeScreen.domain.MaterialDetailVo">
SELECT
lai.`code` AS materialCode,
bai.unit_id AS unitId,
bui.unit_name AS unitName,
bpl.lot_id AS projectId,
bpl.lot_name AS projectName,
lod.out_num AS num,
lod.create_time AS materialTime,
tt.task_status AS auditStatus,
CASE
tt.task_status
WHEN '30' THEN
'待分公司审核'
WHEN '31' THEN
'待机具分公司审核'
WHEN '32' THEN
'待施工部审核'
WHEN '33' THEN
'待出库'
WHEN '34' THEN
'出库进行中'
WHEN '35' THEN
'完成' ELSE ''
END AS statusName,
sd.dept_name AS companyName,
mt.manage_type AS manageType
FROM
lease_out_details lod
LEFT JOIN ma_type mt ON lod.type_id = mt.type_id
AND mt.`level` = '4'
LEFT JOIN sys_dept sd ON sd.dept_id = mt.company_id
LEFT JOIN lease_apply_info lai ON lod.parent_id = lai.id
LEFT JOIN tm_task_agreement tta ON lai.task_id = tta.task_id
LEFT JOIN tm_task tt ON lai.task_id = tt.task_id
LEFT JOIN bm_agreement_info bai ON tta.agreement_id = bai.agreement_id
LEFT JOIN bm_unit_info bui ON bai.unit_id = bui.unit_id
LEFT JOIN bm_project_lot bpl ON bai.project_id = bpl.lot_id
WHERE
bpl.del_flag = '0' and
lod.create_time BETWEEN CONCAT(#{startDate}, ' 00:00:00') AND CONCAT(#{endDate}, ' 23:59:59')
<if test="maTypeName != null and maTypeName != ''">
AND sd.dept_name = #{maTypeName}
</if>
<if test="materialCode != null and materialCode != ''">
AND lai.`code` LIKE CONCAT('%',#{materialCode},'%')
</if>
<if test="unitId != null and unitId != ''">
AND bai.unit_id = #{unitId}
</if>
<if test="projectId != null and projectId != ''">
AND bai.project_id = #{projectId}
</if>
GROUP BY
materialCode
</select>
<select id="getMaterialReturnDetailByMonth"
resultType="com.bonus.sgzb.largeScreen.domain.MaterialDetailVo">
SELECT
ba.`code` AS materialCode,
bai.unit_id AS unitId,
bui.unit_name AS unitName,
bpl.lot_id AS projectId,
bpl.lot_name AS projectName,
bad.pre_num AS num,
bad.audit_num AS realityNum,
bad.create_time AS materialTime,
tt.task_status AS auditStatus,
CASE
tt.task_status
WHEN '37' THEN
'待退料审核'
WHEN '38' THEN
'退料审核通过'
WHEN '39' THEN
'退料核查中'
WHEN '40' THEN
'退料完成' ELSE ''
END AS statusName,
sd.dept_name AS companyName
FROM
back_apply_details bad
LEFT JOIN ma_type mt ON bad.type_id = mt.type_id
AND mt.`level` = '4'
LEFT JOIN sys_dept sd ON sd.dept_id = mt.company_id
LEFT JOIN back_apply_info ba ON bad.parent_id = ba.id
LEFT JOIN tm_task tt ON ba.task_id = tt.task_id
LEFT JOIN tm_task_agreement tta ON ba.task_id = tta.task_id
LEFT JOIN bm_agreement_info bai ON tta.agreement_id = bai.agreement_id
LEFT JOIN bm_unit_info bui ON bai.unit_id = bui.unit_id
LEFT JOIN bm_project_lot bpl ON bai.project_id = bpl.lot_id
WHERE
bad.create_time BETWEEN CONCAT(#{startDate}, ' 00:00:00') AND CONCAT(#{endDate}, ' 23:59:59')
<if test="maTypeName != null and maTypeName != ''">
AND sd.dept_name = #{maTypeName}
</if>
<if test="materialCode != null and materialCode != ''">
AND lai.`code` LIKE CONCAT('%',#{materialCode},'%')
</if>
<if test="unitId != null and unitId != ''">
AND bai.unit_id = #{unitId}
</if>
<if test="projectId != null and projectId != ''">
AND bai.project_id = #{projectId}
</if>
GROUP BY
materialCode
</select>
<select id="getRepairList" resultType="com.bonus.sgzb.largeScreen.domain.AccessVo">
SELECT
CASE
rar.repair_type
WHEN 1 THEN
mpt2.pa_name ELSE rar.part_name
END partName,
CASE
rar.repair_type
WHEN 1 THEN
SUM( rpd.part_num ) ELSE SUM( rar.part_num )
END partNum,
sd.dept_name AS companyName
FROM
repair_apply_record rar
LEFT JOIN ma_type mt ON rar.type_id = mt.type_id
LEFT JOIN sys_dept sd ON sd.dept_id = mt.company_id
LEFT JOIN repair_part_details rpd ON rpd.task_id = rar.task_id
AND rpd.type_id = rar.type_id
AND rar.repair_type = '1'
LEFT JOIN ma_part_type mpt ON mpt.pa_id = rpd.part_id
LEFT JOIN ma_part_type mpt2 ON mpt2.pa_id = mpt.parent_id
WHERE
rar.create_time BETWEEN CONCAT(#{startDate}, ' 00:00:00') AND CONCAT(#{endDate}, ' 23:59:59')
<if test="maTypeName != null and maTypeName != ''">
AND sd.dept_name = #{maTypeName}
</if>
GROUP BY
partName
ORDER BY
partNum DESC
</select>
<select id="getMaintenanceDetailByMonth" resultType="com.bonus.sgzb.largeScreen.domain.RepairDetailVo">
SELECT
tt.CODE AS repairCode,
bai2.unit_id AS unitId,
bui.unit_name AS unitName,
bpi.lot_id AS projectId,
bpi.lot_name AS projectName,
su.user_name AS createBy,
tt.create_time AS createTime,
bai.CODE AS materialCode,
sd.NAME AS statusName,
tt.task_status AS repairStatus,
tt.company_id AS companyId,
sdd.dept_name AS companyName,
GROUP_CONCAT( DISTINCT mt2.type_name ) AS typeName
FROM
repair_apply_details rd
LEFT JOIN ma_type mt ON rd.type_id = mt.type_id
LEFT JOIN sys_dept sdd ON sdd.dept_id = mt.company_id
LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id
LEFT JOIN tm_task tt ON rd.task_id = tt.task_id
LEFT JOIN back_apply_info bai ON rd.back_id = bai.id
LEFT JOIN tm_task_agreement tta ON bai.task_id = tta.task_id
LEFT JOIN bm_agreement_info bai2 ON tta.agreement_id = bai2.agreement_id
LEFT JOIN bm_unit_info bui ON bai2.unit_id = bui.unit_id
LEFT JOIN bm_project_lot bpi ON bai2.project_id = bpi.lot_id
AND bpi.STATUS = '0'
AND bpi.del_flag = '0'
LEFT JOIN sys_user su ON rd.create_by = su.user_id
LEFT JOIN sys_dic sd ON sd.id = tt.task_status
WHERE
tt.create_time BETWEEN CONCAT(#{startDate}, ' 00:00:00') AND CONCAT(#{endDate}, ' 23:59:59')
<if test="maTypeName != null and maTypeName != ''">
AND sdd.dept_name = #{maTypeName}
</if>
<if test="repairCode != null and repairCode != ''">
AND tt.CODE LIKE CONCAT('%',#{repairCode},'%')
</if>
<if test="unitId != null and unitId != ''">
AND bai2.unit_id = #{unitId}
</if>
<if test="projectId != null and projectId != ''">
AND bpi.lot_id = #{projectId}
</if>
GROUP BY
bui.unit_name,
bpi.lot_name,
bai.CODE,
su.user_name
ORDER BY
tt.create_time DESC
</select>
</mapper>