领料管理
This commit is contained in:
parent
838cd2ae71
commit
adf91681f5
|
|
@ -204,6 +204,15 @@ public class LeaseApplyInfo extends BaseEntity{
|
|||
@ApiModelProperty(value = "工程名称")
|
||||
private String projectName;
|
||||
|
||||
@ApiModelProperty(value = "班组id")
|
||||
private Long teamId;
|
||||
|
||||
@ApiModelProperty(value = "班组名称")
|
||||
private String teamName;
|
||||
|
||||
@ApiModelProperty(value = "领料方式(0 材料领料,1 工器具领料,2 系统推送)")
|
||||
private String leaseStyle;
|
||||
|
||||
/**
|
||||
* 预领料合计数
|
||||
*/
|
||||
|
|
@ -290,4 +299,18 @@ public class LeaseApplyInfo extends BaseEntity{
|
|||
|
||||
@ApiModelProperty(value = "发布批次")
|
||||
private String publishTask;
|
||||
|
||||
@ApiModelProperty(value = "领料时间")
|
||||
private String leaseTime;
|
||||
|
||||
/** 类型编号 */
|
||||
@ApiModelProperty(value = "类型编号")
|
||||
private String typeCode;
|
||||
|
||||
/** 规格编号 */
|
||||
@ApiModelProperty(value = "规格编号")
|
||||
private String modelCode;
|
||||
|
||||
@ApiModelProperty(value = "计量单位")
|
||||
private String unitNames;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ public enum LeaseTaskStatusEnum {
|
|||
//0-领用申请任务待审核,其余为领料申请流程状态
|
||||
LEASE_TASK_ZERO(0, "待审核"),
|
||||
LEASE_TASK_SUBMIT(5, "待提交"),
|
||||
LEASE_TASK_TO_PUBLISHED(1, "待发布"),
|
||||
LEASE_TASK_TO_PUBLISHED(1, "待出库"),
|
||||
LEASE_TASK_TO_AUDIT(2, "已终止"),
|
||||
LEASE_TASK_IN_PROGRESS(3, "出库进行中"),
|
||||
LEASE_TASK_FINISHED(4, "出库已完成"),
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import javax.validation.constraints.NotNull;
|
|||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import com.bonus.common.biz.config.ListPagingUtil;
|
||||
import com.bonus.common.biz.domain.lease.LeaseApplyInfo;
|
||||
import com.bonus.common.core.utils.ServletUtils;
|
||||
import com.bonus.common.log.enums.OperaType;
|
||||
import com.bonus.material.back.domain.BackApplyDetails;
|
||||
|
|
@ -56,6 +57,33 @@ public class BackApplyInfoController extends BaseController {
|
|||
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询总站点退料记录数据
|
||||
* @param backApplyInfo
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "查询总站点退料记录数据")
|
||||
@GetMapping("/getTotalList")
|
||||
public AjaxResult getTotalList(BackApplyInfo backApplyInfo) {
|
||||
Integer pageIndex = Convert.toInt(ServletUtils.getParameter("pageNum"), 1);
|
||||
Integer pageSize = Convert.toInt(ServletUtils.getParameter("pageSize"), 10);
|
||||
List<BackApplyInfo> list = backApplyInfoService.getTotalList(backApplyInfo);
|
||||
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询站点退料详情数据
|
||||
* @param backApplyInfo
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "查询总站点退料详情数据")
|
||||
@GetMapping("/getDetailsList")
|
||||
public AjaxResult getDetailsList(BackApplyInfo backApplyInfo) {
|
||||
startPage();
|
||||
List<LeaseApplyInfo> list = backApplyInfoService.getDetailsList(backApplyInfo);
|
||||
return AjaxResult.success(getDataTable(list));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询修试查询-退料查询列表
|
||||
* @param dto
|
||||
|
|
|
|||
|
|
@ -174,4 +174,15 @@ public class BackApplyInfo implements Serializable {
|
|||
private Integer appTaskStatus;
|
||||
|
||||
private String maStatus;
|
||||
|
||||
/** 类型编号 */
|
||||
@ApiModelProperty(value = "类型编号")
|
||||
private String typeCode;
|
||||
|
||||
/** 规格编号 */
|
||||
@ApiModelProperty(value = "规格编号")
|
||||
private String modelCode;
|
||||
|
||||
@ApiModelProperty(value = "计量单位")
|
||||
private String unitNames;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.bonus.material.back.mapper;
|
|||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.bonus.common.biz.domain.lease.LeaseApplyInfo;
|
||||
import com.bonus.material.back.domain.BackApplyDetails;
|
||||
import com.bonus.material.back.domain.BackApplyInfo;
|
||||
import com.bonus.material.back.domain.MaCodeDto;
|
||||
|
|
@ -358,4 +359,18 @@ public interface BackApplyInfoMapper {
|
|||
BackApplyInfoVo selectIdList(BackApplyInfoVo dto);
|
||||
|
||||
BackApplyInfoVo selectDetails(BackApplyInfoVo dto);
|
||||
|
||||
/**
|
||||
* 查询总站点退料记录数据
|
||||
* @param backApplyInfo
|
||||
* @return
|
||||
*/
|
||||
List<BackApplyInfo> getTotalList(BackApplyInfo backApplyInfo);
|
||||
|
||||
/**
|
||||
* 查询站点退料详情数据
|
||||
* @param backApplyInfo
|
||||
* @return
|
||||
*/
|
||||
List<LeaseApplyInfo> getDetailsList(BackApplyInfo backApplyInfo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.bonus.material.back.service;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import com.bonus.common.biz.domain.lease.LeaseApplyInfo;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.material.back.domain.BackApplyDetails;
|
||||
import com.bonus.material.back.domain.BackApplyInfo;
|
||||
|
|
@ -151,5 +152,19 @@ public interface IBackApplyInfoService {
|
|||
* @return
|
||||
*/
|
||||
BackApplyInfoVo selectSecondList(BackApplyInfoVo dto);
|
||||
|
||||
/**
|
||||
* 查询总站点退料记录数据
|
||||
* @param backApplyInfo
|
||||
* @return
|
||||
*/
|
||||
List<BackApplyInfo> getTotalList(BackApplyInfo backApplyInfo);
|
||||
|
||||
/**
|
||||
* 查询站点退料详情数据
|
||||
* @param backApplyInfo
|
||||
* @return
|
||||
*/
|
||||
List<LeaseApplyInfo> getDetailsList(BackApplyInfo backApplyInfo);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import cn.hutool.core.util.PhoneUtil;
|
|||
import com.alibaba.nacos.common.utils.CollectionUtils;
|
||||
import com.bonus.common.biz.constant.MaterialConstants;
|
||||
import com.bonus.common.biz.domain.TypeTreeNode;
|
||||
import com.bonus.common.biz.domain.lease.LeaseApplyInfo;
|
||||
import com.bonus.common.biz.domain.lease.LeaseOutDetails;
|
||||
import com.bonus.common.biz.enums.*;
|
||||
import com.bonus.common.core.exception.ServiceException;
|
||||
|
|
@ -1412,6 +1413,49 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
|
|||
return vo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询总站点退料记录数据
|
||||
* @param backApplyInfo
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<BackApplyInfo> getTotalList(BackApplyInfo backApplyInfo) {
|
||||
List<BackApplyInfo> list = backApplyInfoMapper.getTotalList(backApplyInfo);
|
||||
if (!org.springframework.util.CollectionUtils.isEmpty(list)) {
|
||||
// 如果关键字不为空,进行过滤
|
||||
if (!StringUtils.isBlank(backApplyInfo.getKeyWord())) {
|
||||
list = list.stream()
|
||||
.filter(item -> containsTotalKeyword(item, backApplyInfo.getKeyWord()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询站点退料详情数据
|
||||
* @param backApplyInfo
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<LeaseApplyInfo> getDetailsList(BackApplyInfo backApplyInfo) {
|
||||
return backApplyInfoMapper.getDetailsList(backApplyInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 总站点关键字搜索
|
||||
* @param item
|
||||
* @param keyWord
|
||||
* @return
|
||||
*/
|
||||
private boolean containsTotalKeyword(BackApplyInfo item, String keyWord) {
|
||||
return (item.getTypeName() != null && item.getTypeName().contains(keyWord)) ||
|
||||
(item.getUnitName() != null && item.getUnitName().contains(keyWord)) ||
|
||||
(item.getProName() != null && item.getProName().contains(keyWord)) ||
|
||||
(item.getBackPerson() != null && item.getBackPerson().contains(keyWord)) ||
|
||||
(item.getCode() != null && item.getCode().contains(keyWord));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 关键字搜索
|
||||
|
|
|
|||
|
|
@ -47,6 +47,9 @@ public class BmAgreementInfo extends BaseEntity
|
|||
@NotNull(message = "往来单位id不能为空")
|
||||
private Long unitId;
|
||||
|
||||
@ApiModelProperty(value = "班组id")
|
||||
private Long teamId;
|
||||
|
||||
/**
|
||||
* 往来单位
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -72,4 +72,11 @@ public interface BmAgreementInfoMapper
|
|||
int selectByagreementId(Long agreementId);
|
||||
|
||||
String getDictLabel(int id);
|
||||
|
||||
/**
|
||||
* 根据班组id和标段id查询协议信息
|
||||
* @param bmAgreementInfo
|
||||
* @return
|
||||
*/
|
||||
BmAgreementInfo queryByTeamIdAndProjectId(BmAgreementInfo bmAgreementInfo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.bonus.material.lease.controller;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import com.alibaba.nacos.common.utils.CollectionUtils;
|
||||
import com.bonus.common.biz.annotation.StoreLog;
|
||||
import com.bonus.common.biz.config.ListPagingUtil;
|
||||
import com.bonus.common.biz.domain.lease.LeaseOutDetails;
|
||||
|
|
@ -11,9 +12,11 @@ import com.bonus.common.core.web.domain.AjaxResult;
|
|||
import com.bonus.common.log.annotation.SysLog;
|
||||
import com.bonus.common.log.enums.OperaType;
|
||||
import com.bonus.material.basic.domain.BmQrcodeInfo;
|
||||
import com.bonus.material.basic.domain.RetainedEquipmentInfo;
|
||||
import com.bonus.material.common.annotation.PreventRepeatSubmit;
|
||||
import com.bonus.common.biz.domain.lease.LeaseApplyInfo;
|
||||
import com.bonus.material.lease.domain.LeaseApplyDetails;
|
||||
import com.bonus.material.lease.domain.LeaseApplyDetailsInfo;
|
||||
import com.bonus.material.lease.domain.vo.LeaseApplyRequestVo;
|
||||
import com.bonus.common.biz.domain.lease.LeaseOutRequestVo;
|
||||
import com.bonus.material.lease.service.ILeaseApplyInfoService;
|
||||
|
|
@ -52,6 +55,33 @@ public class LeaseApplyInfoController extends BaseController {
|
|||
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询总站点领料记录数据
|
||||
* @param leaseApplyInfo
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "查询总站点领料记录数据")
|
||||
@GetMapping("/getTotalList")
|
||||
public AjaxResult getTotalList(LeaseApplyInfo leaseApplyInfo) {
|
||||
Integer pageIndex = Convert.toInt(ServletUtils.getParameter("pageNum"), 1);
|
||||
Integer pageSize = Convert.toInt(ServletUtils.getParameter("pageSize"), 10);
|
||||
List<LeaseApplyInfo> list = leaseApplyInfoService.getTotalList(leaseApplyInfo);
|
||||
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询总站点领料详情数据
|
||||
* @param leaseApplyInfo
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "查询总站点领料详情数据")
|
||||
@GetMapping("/getDetailsList")
|
||||
public AjaxResult getDetailsList(LeaseApplyInfo leaseApplyInfo) {
|
||||
startPage();
|
||||
List<LeaseApplyInfo> list = leaseApplyInfoService.getDetailsList(leaseApplyInfo);
|
||||
return AjaxResult.success(getDataTable(list));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出领料任务列表
|
||||
*/
|
||||
|
|
@ -90,6 +120,53 @@ public class LeaseApplyInfoController extends BaseController {
|
|||
return success(leaseApplyInfoService.getInnerById(leaseApplyDetails));
|
||||
}
|
||||
|
||||
/**
|
||||
* 工器具领料数据
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "工器具领料数据")
|
||||
@GetMapping(value = "/getLeaseInfo")
|
||||
public AjaxResult getLeaseInfo(LeaseApplyDetailsInfo dto) {
|
||||
dto.setIsExport(1);
|
||||
Integer pageIndex = Convert.toInt(ServletUtils.getParameter("pageNum"), 1);
|
||||
Integer pageSize = Convert.toInt(ServletUtils.getParameter("pageSize"), 10);
|
||||
List<LeaseApplyDetailsInfo> list = leaseApplyInfoService.getLeaseInfo(dto);
|
||||
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list));
|
||||
}
|
||||
|
||||
/**
|
||||
* 工器具领料数据查询不带分页
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "工器具领料数据查询不带分页")
|
||||
@GetMapping("/getLeaseInfoNoPage")
|
||||
public AjaxResult getLeaseInfoNoPage(LeaseApplyDetailsInfo dto) {
|
||||
dto.setIsExport(0);
|
||||
List<LeaseApplyDetailsInfo> list = leaseApplyInfoService.getLeaseInfo(dto);
|
||||
LeaseApplyDetailsInfo info = new LeaseApplyDetailsInfo();
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
info = list.get(0);
|
||||
}
|
||||
return AjaxResult.success(info);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出工器具领料数据查询
|
||||
* @param response
|
||||
* @param dto
|
||||
*/
|
||||
@ApiOperation("导出工器具领料数据查询")
|
||||
@PostMapping("/exportRetainedEquipmentList")
|
||||
public void exportRetainedEquipmentList(HttpServletResponse response, LeaseApplyDetailsInfo dto)
|
||||
{
|
||||
dto.setIsExport(0);
|
||||
List<LeaseApplyDetailsInfo> list = leaseApplyInfoService.getLeaseInfo(dto);
|
||||
ExcelUtil<LeaseApplyDetailsInfo> util = new ExcelUtil<>(LeaseApplyDetailsInfo.class);
|
||||
util.exportExcel(response, list, "工器具领料数据查询");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取领料出库内部详细信息
|
||||
* @param leaseApplyDetails
|
||||
|
|
|
|||
|
|
@ -0,0 +1,154 @@
|
|||
package com.bonus.material.lease.domain;
|
||||
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import com.bonus.common.core.web.domain.BaseEntity;
|
||||
import com.bonus.material.back.domain.vo.MaCodeVo;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 领料任务详细对象 lease_apply_details
|
||||
*
|
||||
* @author xsheng
|
||||
* @date 2024-10-16
|
||||
*/
|
||||
@Data
|
||||
@ToString
|
||||
public class LeaseApplyDetailsInfo extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "是否导出 0 是,1 否")
|
||||
private Integer isExport;
|
||||
|
||||
/** ID */
|
||||
private Long id;
|
||||
|
||||
/** 任务ID */
|
||||
@ApiModelProperty(value = "任务ID")
|
||||
private Long parentId;
|
||||
|
||||
@ApiModelProperty(value = "机具ID")
|
||||
private Long maId;
|
||||
|
||||
/** 物资类型 */
|
||||
@ApiModelProperty(value = "物资类型名称")
|
||||
@Excel(name = "工器具名称")
|
||||
private String maTypeName;
|
||||
|
||||
@ApiModelProperty(value = "规格型号")
|
||||
@Excel(name = "规格型号")
|
||||
private String typeName;
|
||||
|
||||
/** 规格型号id */
|
||||
@ApiModelProperty(value = "规格型号id")
|
||||
private Long typeId;
|
||||
|
||||
@ApiModelProperty(value = "规格型号id")
|
||||
private Long newTypeId;
|
||||
|
||||
@ApiModelProperty(value = "三级id")
|
||||
private Long thirdTypeId;
|
||||
|
||||
@ApiModelProperty(value = "规格型号id")
|
||||
private Long taskId;
|
||||
|
||||
@ApiModelProperty(value = "机具编码")
|
||||
private String maCode;
|
||||
|
||||
/** 计量单位 */
|
||||
@ApiModelProperty(value = "计量单位")
|
||||
@Excel(name = "计量单位")
|
||||
private String unitName;
|
||||
|
||||
/** 计量单位数值 */
|
||||
@ApiModelProperty(value = "计量单位数值")
|
||||
private String unitValue;
|
||||
|
||||
@ApiModelProperty(value = "已发布数量")
|
||||
private BigDecimal publishNum;
|
||||
|
||||
@ApiModelProperty(value = "待发布数量")
|
||||
private BigDecimal pendingNum;
|
||||
|
||||
@ApiModelProperty(value = "本次发布数量")
|
||||
private BigDecimal num;
|
||||
|
||||
/** 预领料数 */
|
||||
@Excel(name = "领料数量")
|
||||
@ApiModelProperty(value = "预领料数")
|
||||
private BigDecimal preNum;
|
||||
|
||||
/** 审批数量 */
|
||||
@ApiModelProperty(value = "审批数量")
|
||||
private BigDecimal auditNum;
|
||||
|
||||
/** 已领数量 */
|
||||
@ApiModelProperty(value = "已领数量")
|
||||
@Excel(name = "出库数量")
|
||||
private BigDecimal alNum;
|
||||
|
||||
/**
|
||||
* 此数量是剩余需要出库的数量(preNum - alNum)
|
||||
*/
|
||||
@ApiModelProperty(value = "剩余最大出库数量")
|
||||
@Excel(name = "待出库数量")
|
||||
private BigDecimal outNum;
|
||||
|
||||
@ApiModelProperty(value = "领料日期")
|
||||
@Excel(name = "领料日期")
|
||||
private String leaseDate;
|
||||
|
||||
@ApiModelProperty(value = "出库日期")
|
||||
@Excel(name = "出库日期")
|
||||
private String outDate;
|
||||
|
||||
@ApiModelProperty(value = "班组名称")
|
||||
@Excel(name = "领料班组")
|
||||
private String teamName;
|
||||
|
||||
@ApiModelProperty(value = "工程名称")
|
||||
@Excel(name = "领料工程")
|
||||
private String projectName;
|
||||
|
||||
/** 备注 */
|
||||
@ApiModelProperty(value = "领料人")
|
||||
@Excel(name = "领料人")
|
||||
private String leasePerson;
|
||||
|
||||
@ApiModelProperty(value = "出库人")
|
||||
@Excel(name = "出库人")
|
||||
private String outPerson;
|
||||
|
||||
@ApiModelProperty(value = "领料单号")
|
||||
@Excel(name = "领料单号")
|
||||
private String leaseCode;
|
||||
|
||||
/**
|
||||
* 装备管理方式(0编号 1计数)
|
||||
*/
|
||||
@ApiModelProperty(name = "装备管理方式")
|
||||
private int manageType;
|
||||
|
||||
/** 状态(0待审批,1进行中,2已出库) */
|
||||
private String status;
|
||||
|
||||
/** 数据所属组织 */
|
||||
@ApiModelProperty(value = "数据所属组织")
|
||||
private Long companyId;
|
||||
|
||||
private String keyWord;
|
||||
|
||||
@ApiModelProperty(value = "用户ID")
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty(value = "开始时间")
|
||||
private String startTime;
|
||||
|
||||
@ApiModelProperty(value = "结束时间")
|
||||
private String endTime;
|
||||
}
|
||||
|
|
@ -6,6 +6,7 @@ import com.bonus.material.back.domain.vo.MaCodeVo;
|
|||
import com.bonus.material.basic.domain.BmQrcodeInfo;
|
||||
import com.bonus.material.lease.domain.LeaseApplyDetails;
|
||||
import com.bonus.common.biz.domain.lease.LeaseOutDetails;
|
||||
import com.bonus.material.lease.domain.LeaseApplyDetailsInfo;
|
||||
import com.bonus.material.lease.domain.vo.LeaseOutVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
|
|
@ -162,4 +163,11 @@ public interface LeaseApplyDetailsMapper {
|
|||
* @return
|
||||
*/
|
||||
int deletePublishTask(LeaseOutDetails leaseOutDetails);
|
||||
|
||||
/**
|
||||
* 工器具领料数据
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
List<LeaseApplyDetailsInfo> getLeaseInfo(LeaseApplyDetailsInfo dto);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,4 +80,18 @@ public interface LeaseApplyInfoMapper {
|
|||
* @return
|
||||
*/
|
||||
List<LeaseApplyInfo> selectPublishList(LeaseApplyInfo leaseApplyInfo);
|
||||
|
||||
/**
|
||||
* 查询总站点领料记录数据
|
||||
* @param leaseApplyInfo
|
||||
* @return
|
||||
*/
|
||||
List<LeaseApplyInfo> getTotalList(LeaseApplyInfo leaseApplyInfo);
|
||||
|
||||
/**
|
||||
* 查询总站点领料详情数据
|
||||
* @param leaseApplyInfo
|
||||
* @return
|
||||
*/
|
||||
List<LeaseApplyInfo> getDetailsList(LeaseApplyInfo leaseApplyInfo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import com.bonus.common.core.web.domain.AjaxResult;
|
|||
import com.bonus.common.biz.domain.lease.LeaseApplyInfo;
|
||||
import com.bonus.material.basic.domain.BmQrcodeInfo;
|
||||
import com.bonus.material.lease.domain.LeaseApplyDetails;
|
||||
import com.bonus.material.lease.domain.LeaseApplyDetailsInfo;
|
||||
import com.bonus.material.lease.domain.vo.LeaseApplyRequestVo;
|
||||
import com.bonus.common.biz.domain.lease.LeaseOutRequestVo;
|
||||
|
||||
|
|
@ -144,4 +145,25 @@ public interface ILeaseApplyInfoService {
|
|||
* @return
|
||||
*/
|
||||
AjaxResult useExamine(LeaseApplyInfo leaseApplyInfo);
|
||||
|
||||
/**
|
||||
* 工器具领料数据
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
List<LeaseApplyDetailsInfo> getLeaseInfo(LeaseApplyDetailsInfo dto);
|
||||
|
||||
/**
|
||||
* 查询总站点领料记录数据
|
||||
* @param leaseApplyInfo
|
||||
* @return
|
||||
*/
|
||||
List<LeaseApplyInfo> getTotalList(LeaseApplyInfo leaseApplyInfo);
|
||||
|
||||
/**
|
||||
* 查询总站点领料详情数据
|
||||
* @param leaseApplyInfo
|
||||
* @return
|
||||
*/
|
||||
List<LeaseApplyInfo> getDetailsList(LeaseApplyInfo leaseApplyInfo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
package com.bonus.material.lease.service.impl;
|
||||
|
||||
import java.io.OutputStream;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.net.URLEncoder;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
|
@ -20,10 +22,14 @@ import com.bonus.common.core.utils.StringUtils;
|
|||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import com.bonus.material.back.domain.vo.MaCodeVo;
|
||||
import com.bonus.material.basic.domain.BmAgreementInfo;
|
||||
import com.bonus.material.basic.domain.BmQrcodeInfo;
|
||||
import com.bonus.material.basic.domain.RetainedEquipmentInfo;
|
||||
import com.bonus.material.basic.mapper.BmAgreementInfoMapper;
|
||||
import com.bonus.material.basic.mapper.BmFileInfoMapper;
|
||||
import com.bonus.material.lease.domain.LeaseApplyDetails;
|
||||
import com.bonus.common.biz.domain.lease.LeaseOutDetails;
|
||||
import com.bonus.material.lease.domain.LeaseApplyDetailsInfo;
|
||||
import com.bonus.material.lease.domain.vo.LeaseApplyRequestVo;
|
||||
import com.bonus.common.biz.domain.lease.LeaseOutRequestVo;
|
||||
import com.bonus.material.lease.domain.vo.LeaseOutVo;
|
||||
|
|
@ -35,6 +41,7 @@ import com.bonus.material.task.mapper.TmTaskAgreementMapper;
|
|||
import com.bonus.material.task.mapper.TmTaskMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.bonus.material.lease.mapper.LeaseApplyInfoMapper;
|
||||
|
|
@ -73,6 +80,9 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
|
|||
@Resource
|
||||
private BmFileInfoMapper bmFileInfoMapper;
|
||||
|
||||
@Resource
|
||||
private BmAgreementInfoMapper bmAgreementInfoMapper;
|
||||
|
||||
/**
|
||||
* 查询领料任务
|
||||
*
|
||||
|
|
@ -177,7 +187,7 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
|
|||
public List<LeaseApplyInfo> selectLeaseApplyInfoList(LeaseApplyInfo leaseApplyInfo) {
|
||||
leaseApplyInfo.setUserId(SecurityUtils.getUserId());
|
||||
List<LeaseApplyInfo> list = leaseApplyInfoMapper.selectLeaseApplyInfoList(leaseApplyInfo);
|
||||
// 如果statusList包含3、4、5,则为领料出库查询,需查询领用出库数据,进行拼接
|
||||
/*// 如果statusList包含3、4、5,则为领料出库查询,需查询领用出库数据,进行拼接
|
||||
if (!CollectionUtils.isEmpty(leaseApplyInfo.getStatusList())) {
|
||||
if (leaseApplyInfo.getStatusList().contains(3) || leaseApplyInfo.getStatusList().contains(4) || leaseApplyInfo.getStatusList().contains(5)) {
|
||||
// 查询领用出库数据
|
||||
|
|
@ -195,7 +205,7 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
|
|||
list.addAll(leaseApplyOutList);
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
// 使用 Stream API 进行降序排序
|
||||
List<LeaseApplyInfo> sortedList = list.stream()
|
||||
.sorted(Comparator.comparing(LeaseApplyInfo::getCreateTime).reversed())
|
||||
|
|
@ -227,7 +237,7 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
|
|||
*/
|
||||
private boolean containsKeyword(LeaseApplyInfo item, String keyWord) {
|
||||
return (item.getMaTypeNames() != null && item.getMaTypeNames().contains(keyWord)) ||
|
||||
(item.getUnitName() != null && item.getUnitName().contains(keyWord)) ||
|
||||
(item.getTeamName() != null && item.getTeamName().contains(keyWord)) ||
|
||||
(item.getProjectName() != null && item.getProjectName().contains(keyWord)) ||
|
||||
(item.getCode() != null && item.getCode().contains(keyWord)) ||
|
||||
(item.getCreateBy() != null && item.getCreateBy().contains(keyWord)) ||
|
||||
|
|
@ -245,59 +255,6 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
|
|||
*/
|
||||
@Override
|
||||
public AjaxResult insertLeaseApplyInfo(LeaseApplyRequestVo leaseApplyRequestVo) {
|
||||
/*int result = 0;
|
||||
if (null == leaseApplyRequestVo.getLeaseApplyInfo()) {
|
||||
return AjaxResult.error("请先填写领料任务信息");
|
||||
}
|
||||
if (CollectionUtil.isEmpty(leaseApplyRequestVo.getLeaseApplyDetailsList())) {
|
||||
return AjaxResult.error("请先添加领料任务物资明细");
|
||||
}
|
||||
leaseApplyRequestVo.getLeaseApplyInfo().setCreateTime(DateUtils.getNowDate());
|
||||
leaseApplyRequestVo.getLeaseApplyInfo().setCreateBy(SecurityUtils.getUsername());
|
||||
try {
|
||||
// 获取 LeaseApplyDetails 列表
|
||||
List<LeaseApplyDetails> leaseApplyDetailsList = leaseApplyRequestVo.getLeaseApplyDetailsList();
|
||||
for (LeaseApplyDetails applyDetails : leaseApplyDetailsList) {
|
||||
if (applyDetails.getCompanyId() == null) {
|
||||
throw new RuntimeException("未知所属公司领料任务,无法操作!");
|
||||
}
|
||||
}
|
||||
// 按 companyId 进行分组
|
||||
Map<Long, List<LeaseApplyDetails>> groupedByCompanyId = leaseApplyDetailsList.stream()
|
||||
.collect(Collectors.groupingBy(LeaseApplyDetails::getCompanyId));
|
||||
for (Map.Entry<Long, List<LeaseApplyDetails>> entry : groupedByCompanyId.entrySet()) {
|
||||
Long key = entry.getKey();
|
||||
List<LeaseApplyDetails> details = entry.getValue();
|
||||
TmTaskTypeEnum splitType = null;
|
||||
String taskTypeLabel = null;
|
||||
// 机具领料任务
|
||||
if (key == 101) {
|
||||
splitType = TmTaskTypeEnum.TM_TASK_JJ_LEASE;
|
||||
taskTypeLabel = MaterialConstants.JJ_LEASE_TASK_TYPE_LABEL;
|
||||
// 安全工器具领料任务
|
||||
} else if (key == 102) {
|
||||
splitType = TmTaskTypeEnum.TM_TASK_SAFE_LEASE;
|
||||
taskTypeLabel = MaterialConstants.AQ_LEASE_TASK_TYPE_LABEL;
|
||||
// 宏源领料任务
|
||||
} else if (key == 309) {
|
||||
splitType = TmTaskTypeEnum.TM_TASK_HY_LEASE;
|
||||
taskTypeLabel = MaterialConstants.HY_LEASE_TASK_TYPE_LABEL;
|
||||
} else {
|
||||
throw new RuntimeException("未知所属公司领料任务,无法操作!");
|
||||
}
|
||||
result += processLeaseTask(leaseApplyRequestVo, splitType, taskTypeLabel);
|
||||
if (result > 0) {
|
||||
return insertPurchaseCheckDetails(details, leaseApplyRequestVo.getLeaseApplyInfo().getId());
|
||||
} else {
|
||||
return AjaxResult.error("新增任务失败,lease_apply_info表插入0条");
|
||||
}
|
||||
}
|
||||
} catch (DataAccessException e) {
|
||||
throw new RuntimeException("数据库操作失败:" + e.getMessage());
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("新增任务失败:" + e.getMessage());
|
||||
}
|
||||
return AjaxResult.error("新增任务失败");*/
|
||||
if (null == leaseApplyRequestVo.getLeaseApplyInfo()) {
|
||||
return AjaxResult.error("请先填写领料任务信息");
|
||||
}
|
||||
|
|
@ -315,6 +272,21 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
|
|||
tmTask.setCreateTime(DateUtils.getNowDate());
|
||||
tmTask.setCreateBy(SecurityUtils.getUsername());
|
||||
tmTaskMapper.insertTmTask(tmTask);
|
||||
BmAgreementInfo bmAgreementInfo = new BmAgreementInfo();
|
||||
bmAgreementInfo.setProjectId(leaseApplyRequestVo.getLeaseApplyInfo().getProjectId());
|
||||
bmAgreementInfo.setTeamId(leaseApplyRequestVo.getLeaseApplyInfo().getTeamId());
|
||||
// 先根据班组和工程id查询,若存在则直接返回,不存在则新增
|
||||
BmAgreementInfo info = bmAgreementInfoMapper.queryByTeamIdAndProjectId(bmAgreementInfo);
|
||||
if (info != null) {
|
||||
leaseApplyRequestVo.getLeaseApplyInfo().setAgreementId(info.getAgreementId());
|
||||
} else {
|
||||
int count = bmAgreementInfoMapper.insertBmAgreementInfo(bmAgreementInfo);
|
||||
if (count > 0) {
|
||||
leaseApplyRequestVo.getLeaseApplyInfo().setAgreementId(bmAgreementInfo.getAgreementId());
|
||||
} else {
|
||||
return AjaxResult.error("新增bm_agreement_info表失败");
|
||||
}
|
||||
}
|
||||
TmTaskAgreement tmTaskAgreement = new TmTaskAgreement(tmTask.getTaskId(), leaseApplyRequestVo.getLeaseApplyInfo().getAgreementId());
|
||||
tmTaskAgreement.setCreateTime(DateUtils.getNowDate());
|
||||
tmTaskAgreement.setCreateBy(SecurityUtils.getUsername());
|
||||
|
|
@ -327,6 +299,8 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
|
|||
leaseApplyRequestVo.getLeaseApplyInfo().setDirectAuditBy(peopleId);
|
||||
/** 设置审批人为默认的董班长 --防止代码冲突 **/
|
||||
|
||||
// 领料任务类型为1 工器具领料
|
||||
leaseApplyRequestVo.getLeaseApplyInfo().setLeaseStyle("1");
|
||||
int count = leaseApplyInfoMapper.insertLeaseApplyInfo(leaseApplyRequestVo.getLeaseApplyInfo());
|
||||
if (!CollectionUtils.isEmpty(leaseApplyRequestVo.getLeaseApplyInfo().getBmFileInfos())) {
|
||||
leaseApplyRequestVo.getLeaseApplyInfo().getBmFileInfos().forEach(bmFileInfo -> {
|
||||
|
|
@ -464,6 +438,101 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 工器具领料数据
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<LeaseApplyDetailsInfo> getLeaseInfo(LeaseApplyDetailsInfo dto) {
|
||||
BigDecimal preNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP);
|
||||
BigDecimal alNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP);
|
||||
BigDecimal outNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP);
|
||||
List<LeaseApplyDetailsInfo> list = leaseApplyDetailsMapper.getLeaseInfo(dto);
|
||||
if (!CollectionUtils.isEmpty(list)) {
|
||||
String keyWord = dto.getKeyWord();
|
||||
// 如果关键字不为空,进行过滤
|
||||
if (!StringUtils.isBlank(keyWord)) {
|
||||
list = list.stream()
|
||||
.filter(item -> containsLeaseKeyword(item, keyWord))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
for (LeaseApplyDetailsInfo leaseApplyDetailsInfo : list) {
|
||||
preNum = preNum.add(leaseApplyDetailsInfo.getPreNum());
|
||||
alNum = alNum.add(leaseApplyDetailsInfo.getAlNum());
|
||||
outNum = outNum.add(leaseApplyDetailsInfo.getOutNum());
|
||||
}
|
||||
if (dto.getIsExport() == 0) {
|
||||
LeaseApplyDetailsInfo info = new LeaseApplyDetailsInfo();
|
||||
info.setPreNum(preNum);
|
||||
info.setAlNum(alNum);
|
||||
info.setOutNum(outNum);
|
||||
info.setUnitName("合计");
|
||||
list.add(0, info);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询总站点领料记录数据
|
||||
* @param leaseApplyInfo
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<LeaseApplyInfo> getTotalList(LeaseApplyInfo leaseApplyInfo) {
|
||||
List<LeaseApplyInfo> list = leaseApplyInfoMapper.getTotalList(leaseApplyInfo);
|
||||
if (!CollectionUtils.isEmpty(list)) {
|
||||
// 如果关键字不为空,进行过滤
|
||||
if (!StringUtils.isBlank(leaseApplyInfo.getKeyWord())) {
|
||||
list = list.stream()
|
||||
.filter(item -> containsTotalKeyword(item, leaseApplyInfo.getKeyWord()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询总站点领料详情数据
|
||||
* @param leaseApplyInfo
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<LeaseApplyInfo> getDetailsList(LeaseApplyInfo leaseApplyInfo) {
|
||||
return leaseApplyInfoMapper.getDetailsList(leaseApplyInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 总站点领料记录数据过滤
|
||||
* @param item
|
||||
* @param keyWord
|
||||
* @return
|
||||
*/
|
||||
private boolean containsTotalKeyword(LeaseApplyInfo item, String keyWord) {
|
||||
return (item.getMaTypeNames() != null && item.getMaTypeNames().contains(keyWord)) ||
|
||||
(item.getLeaseUnit() != null && item.getLeaseUnit().contains(keyWord)) ||
|
||||
(item.getLeaseProject() != null && item.getLeaseProject().contains(keyWord)) ||
|
||||
(item.getLeasePerson() != null && item.getLeasePerson().contains(keyWord)) ||
|
||||
(item.getCode() != null && item.getCode().contains(keyWord));
|
||||
}
|
||||
|
||||
/**
|
||||
* 工器具领料数据过滤
|
||||
* @param item
|
||||
* @param keyWord
|
||||
* @return
|
||||
*/
|
||||
private boolean containsLeaseKeyword(LeaseApplyDetailsInfo item, String keyWord) {
|
||||
return (item.getMaTypeName() != null && item.getMaTypeName().contains(keyWord)) ||
|
||||
(item.getTeamName() != null && item.getTeamName().contains(keyWord)) ||
|
||||
(item.getProjectName() != null && item.getProjectName().contains(keyWord)) ||
|
||||
(item.getTypeName() != null && item.getTypeName().contains(keyWord)) ||
|
||||
(item.getLeasePerson() != null && item.getLeasePerson().contains(keyWord)) ||
|
||||
(item.getOutPerson() != null && item.getOutPerson().contains(keyWord)) ||
|
||||
(item.getLeaseCode() != null && item.getLeaseCode().contains(keyWord));
|
||||
}
|
||||
|
||||
/**
|
||||
* 插入领料任务详情数据
|
||||
* @param leaseApplyDetailsList
|
||||
|
|
|
|||
|
|
@ -254,4 +254,18 @@ public class MachineController extends BaseController {
|
|||
{
|
||||
return machineService.synchReport(machine);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取机具追溯管理数据
|
||||
* @param machine
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "获取机具追溯管理数据")
|
||||
@GetMapping(value = "/getMachineInfo")
|
||||
public AjaxResult getMachineInfo(Machine machine) {
|
||||
startPage();
|
||||
List<Machine> list = machineService.getMachineInfo(machine);
|
||||
return AjaxResult.success(getDataTable(list));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -318,4 +318,10 @@ public class TypeController extends BaseController {
|
|||
}
|
||||
return null;
|
||||
}*/
|
||||
|
||||
@ApiOperation(value = "查询一级列表")
|
||||
@GetMapping("/getPushDetailsInfo")
|
||||
public AjaxResult getPushDetailsInfo() {
|
||||
return typeService.getPushDetailsInfo();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -210,4 +210,22 @@ public class Machine extends BaseEntity
|
|||
|
||||
@ApiModelProperty(value = "集合")
|
||||
private List<SampleSync> samples;
|
||||
|
||||
@ApiModelProperty(value = "入库时间")
|
||||
private String inputTime;
|
||||
|
||||
@ApiModelProperty(value = "类型名称")
|
||||
private String typeName;
|
||||
|
||||
/** 类型编号 */
|
||||
@ApiModelProperty(value = "类型编号")
|
||||
private String typeCode;
|
||||
|
||||
/** 规格编号 */
|
||||
@ApiModelProperty(value = "规格编号")
|
||||
private String modelCode;
|
||||
|
||||
@ApiModelProperty(value = "推送时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private String pushTime;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,6 +33,9 @@ public class Type extends BaseEntity {
|
|||
@ApiModelProperty(value = "任务ID")
|
||||
private Long taskId;
|
||||
|
||||
@ApiModelProperty(value = "物资类型")
|
||||
private String materialName;
|
||||
|
||||
/** 类型名称 */
|
||||
@Excel(name = "规格型号", sort = 5)
|
||||
@ApiModelProperty(value = "类型名称")
|
||||
|
|
@ -232,4 +235,8 @@ public class Type extends BaseEntity {
|
|||
@ApiModelProperty(value = "抽检比例")
|
||||
private String samplingRatio;
|
||||
|
||||
@ApiModelProperty(value = "推送时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private String pushTime;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -141,4 +141,18 @@ public interface MachineMapper
|
|||
* 同步检验报告
|
||||
*/
|
||||
int updateSynchReport(SampleSync sampleSync);
|
||||
|
||||
/**
|
||||
* 根据主键查询机具信息
|
||||
* @param machine
|
||||
* @return
|
||||
*/
|
||||
Machine getMachineById(Machine machine);
|
||||
|
||||
/**
|
||||
* 获取机具追溯管理数据
|
||||
* @param machine
|
||||
* @return
|
||||
*/
|
||||
List<Machine> getMachineInfo(Machine machine);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import java.util.List;
|
|||
|
||||
import com.bonus.common.biz.domain.lease.LeaseOutDetails;
|
||||
import com.bonus.material.ma.domain.MaTypeHistory;
|
||||
import com.bonus.material.ma.domain.Machine;
|
||||
import com.bonus.material.ma.domain.Type;
|
||||
import com.bonus.material.ma.domain.vo.MaTypeConfigVo;
|
||||
import com.bonus.material.ma.domain.vo.MaTypeVo;
|
||||
|
|
@ -196,4 +197,20 @@ public interface TypeMapper {
|
|||
* @return
|
||||
*/
|
||||
List<MaTypeVo> getListLevel(MaTypeVo maTypeVo);
|
||||
|
||||
/**
|
||||
* 首先查询当天ma_station_push表推送的数据
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
List<Type> getPushDetailsInfo(Type type);
|
||||
|
||||
int updateNum(Type type3);
|
||||
|
||||
/**
|
||||
* 查询机具详情
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
List<Machine> getMaTypeDetails(Type dto);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -107,4 +107,11 @@ public interface IMachineService
|
|||
* @return 结果
|
||||
*/
|
||||
public AjaxResult synchReport(Machine machine);
|
||||
|
||||
/**
|
||||
* 获取机具追溯管理数据
|
||||
* @param machine
|
||||
* @return
|
||||
*/
|
||||
List<Machine> getMachineInfo(Machine machine);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -137,4 +137,7 @@ public interface ITypeService {
|
|||
* @return
|
||||
*/
|
||||
AjaxResult getListLevel(MaTypeVo maTypeVo);
|
||||
|
||||
AjaxResult getPushDetailsInfo();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -302,4 +302,14 @@ public class MachineServiceImpl implements IMachineService
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取机具追溯管理数据
|
||||
* @param machine
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<Machine> getMachineInfo(Machine machine) {
|
||||
return machineMapper.getMachineInfo(machine);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -194,6 +194,19 @@ public class TypeServiceImpl implements ITypeService {
|
|||
return AjaxResult.success(maTypeVos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult getPushDetailsInfo() {
|
||||
Type type = new Type();
|
||||
List<Type> list = typeMapper.getPushDetailsInfo(type);
|
||||
// 根据materialName,typeName,typeCode将list数据进行分组
|
||||
Map<String, List<Type>> simplifiedGroupedData = list.stream()
|
||||
.collect(Collectors.groupingBy(
|
||||
item -> item.getMaterialName() + "|" + item.getTypeName() + "|" + item.getTypeCode(),
|
||||
Collectors.toList()
|
||||
));
|
||||
return AjaxResult.success(simplifiedGroupedData);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<MaTypeSelectVo> selectMaTypeListByHouseId(Long houseId) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,175 @@
|
|||
package com.bonus.material.warning;
|
||||
|
||||
import com.alibaba.nacos.common.utils.CollectionUtils;
|
||||
import com.bonus.common.core.utils.DateUtils;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import com.bonus.material.ma.domain.Machine;
|
||||
import com.bonus.material.ma.domain.Type;
|
||||
import com.bonus.material.ma.mapper.MachineMapper;
|
||||
import com.bonus.material.ma.mapper.TypeMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 机具推送数据处理定时任务
|
||||
* @Author ma_sh
|
||||
* @create 2025/5/13 15:40
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class StatisticTask {
|
||||
|
||||
@Resource
|
||||
private TypeMapper typeMapper;
|
||||
|
||||
@Resource
|
||||
private MachineMapper machineMapper;
|
||||
|
||||
/**
|
||||
* 每日凌晨1点统计数据
|
||||
*/
|
||||
@Scheduled(cron = "0 30 0 * * ?")
|
||||
public void setTypeInfoToMaType() {
|
||||
// 首先查询当天ma_station_push表推送的数据
|
||||
LocalDate today = LocalDate.now();
|
||||
String formDate = today.format(DateTimeFormatter.ISO_LOCAL_DATE);
|
||||
Type type = new Type();
|
||||
type.setPushTime(formDate);
|
||||
List<Type> list = typeMapper.getPushDetailsInfo(type);
|
||||
// 根据materialName,typeName,typeCode将list数据进行分组
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
Map<String, List<Type>> groupedData = list.stream()
|
||||
.collect(Collectors.groupingBy(
|
||||
item -> item.getMaterialName() + "|" + item.getTypeName() + "|" + item.getTypeCode(),
|
||||
Collectors.toList()
|
||||
));
|
||||
|
||||
for (Map.Entry<String, List<Type>> entry : groupedData.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
List<Type> valueList = entry.getValue();
|
||||
String[] keys = key.split("\\|");
|
||||
|
||||
if (keys.length != 3) {
|
||||
log.warn("Invalid key format: {}", key);
|
||||
continue;
|
||||
}
|
||||
|
||||
try {
|
||||
// 创建或获取一级分类
|
||||
Long parentId = createOrGetCategory(keys[0], 0L, "1", type);
|
||||
|
||||
// 创建或获取二级分类
|
||||
Long level2Id = createOrGetCategory(keys[1], parentId, "2", type);
|
||||
|
||||
// 创建或获取三级分类
|
||||
Long level3Id = createOrGetCategory(keys[2], level2Id, "3", type);
|
||||
|
||||
// 处理四级分类和机具信息
|
||||
processLevel4Items(formDate, valueList, level3Id, keys, typeMapper, machineMapper);
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("Failed to process category: {}", key, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建或获取分类
|
||||
* @param name
|
||||
* @param parentId
|
||||
* @param level
|
||||
* @param typeTemplate
|
||||
* @return
|
||||
*/
|
||||
private Long createOrGetCategory(String name, Long parentId, String level, Type typeTemplate) {
|
||||
Type existing = typeMapper.queryByNameAndParentId(name, parentId);
|
||||
|
||||
if (existing != null) {
|
||||
return existing.getTypeId();
|
||||
}
|
||||
|
||||
Type newType = new Type();
|
||||
// 复制通用属性
|
||||
BeanUtils.copyProperties(typeTemplate, newType);
|
||||
|
||||
newType.setTypeName(name);
|
||||
newType.setParentId(parentId);
|
||||
newType.setLevel(level);
|
||||
newType.setCreateTime(DateUtils.getNowDate());
|
||||
newType.setCreateBy(SecurityUtils.getUserId().toString());
|
||||
|
||||
int count = typeMapper.insertType(newType);
|
||||
if (count <= 0) {
|
||||
throw new RuntimeException("Failed to insert category: " + name);
|
||||
}
|
||||
|
||||
return newType.getTypeId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理四级分类和机具信息
|
||||
* @param formDate
|
||||
* @param items
|
||||
* @param parentId
|
||||
* @param categoryKeys
|
||||
* @param typeMapper
|
||||
* @param machineMapper
|
||||
*/
|
||||
private void processLevel4Items(String formDate, List<Type> items, Long parentId, String[] categoryKeys,
|
||||
TypeMapper typeMapper, MachineMapper machineMapper) {
|
||||
for (Type item : items) {
|
||||
item.setLevel("4");
|
||||
item.setParentId(parentId);
|
||||
item.setTypeName(item.getModelCode());
|
||||
|
||||
Type existing = typeMapper.queryByNameAndParentId(item.getModelCode(), parentId);
|
||||
|
||||
if (existing != null) {
|
||||
// 更新库存数量
|
||||
existing.setStorageNum(item.getStorageNum());
|
||||
typeMapper.updateNum(existing);
|
||||
item.setTypeId(existing.getTypeId());
|
||||
} else {
|
||||
int count = typeMapper.insertType(item);
|
||||
if (count <= 0) {
|
||||
throw new RuntimeException("Failed to insert level 4 item: " + item.getModelCode());
|
||||
}
|
||||
}
|
||||
|
||||
// 查询并更新机具信息
|
||||
Type queryDto = new Type();
|
||||
queryDto.setMaterialName(categoryKeys[0]);
|
||||
queryDto.setTypeName(categoryKeys[1]);
|
||||
queryDto.setTypeCode(categoryKeys[2]);
|
||||
queryDto.setModelCode(item.getModelCode());
|
||||
queryDto.setPushTime(formDate);
|
||||
|
||||
List<Machine> machineList = typeMapper.getMaTypeDetails(queryDto);
|
||||
|
||||
if (CollectionUtils.isNotEmpty(machineList)) {
|
||||
for (Machine machine : machineList) {
|
||||
machine.setTypeId(item.getTypeId());
|
||||
Machine existingMachine = machineMapper.getMachineById(machine);
|
||||
if (existingMachine == null) {
|
||||
// 推送过来的数据默认状态为 在库
|
||||
machine.setMaStatus("1");
|
||||
machineMapper.insertMachine(machine);
|
||||
} /*else {
|
||||
machineMapper.updateMachine(machine);
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
# Tomcat
|
||||
server:
|
||||
port: 18588
|
||||
port: 18589
|
||||
|
||||
# Spring
|
||||
spring:
|
||||
|
|
|
|||
|
|
@ -932,4 +932,34 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
and bcd.type_id = #{typeId}
|
||||
</if>
|
||||
</select>
|
||||
<select id="getTotalList" resultType="com.bonus.material.back.domain.BackApplyInfo">
|
||||
SELECT
|
||||
lease_name AS unitName,
|
||||
project_name AS proName,
|
||||
task_time AS leaseTime,
|
||||
task_code AS code,
|
||||
out_person AS backPerson,
|
||||
GROUP_CONCAT( DISTINCT ma_name ) AS typeName
|
||||
FROM
|
||||
ma_station_push
|
||||
WHERE
|
||||
task_type = '2'
|
||||
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
||||
<![CDATA[and DATE_FORMAT( task_time, '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime} ]]>
|
||||
</if>
|
||||
GROUP BY
|
||||
task_code
|
||||
</select>
|
||||
|
||||
<select id="getDetailsList" resultType="com.bonus.common.biz.domain.lease.LeaseApplyInfo">
|
||||
SELECT
|
||||
ma_name AS typeCode,
|
||||
ma_model AS modelCode,
|
||||
ma_unit AS unitName,
|
||||
NUM AS backNum
|
||||
FROM
|
||||
ma_station_push
|
||||
WHERE
|
||||
task_code = #{code}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -55,6 +55,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="unitId != null and unitId != ''">
|
||||
and bu.unit_id = #{unitId}
|
||||
</if>
|
||||
<if test="unitId != null and unitId != ''">
|
||||
and bu.unit_id = #{unitId}
|
||||
</if>
|
||||
<if test="projectId != null and projectId != ''">
|
||||
and bp.pro_id = #{projectId}
|
||||
</if>
|
||||
|
|
@ -151,4 +154,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
from sys_dict_data sdd
|
||||
where sdd.dict_type="branch_project" and sdd.dict_value = #{id} and sdd.`status` = 0
|
||||
</select>
|
||||
<select id="queryByTeamIdAndProjectId" resultType="com.bonus.material.basic.domain.BmAgreementInfo">
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
bm_agreement_info
|
||||
WHERE
|
||||
team_id = #{teamId}
|
||||
and project_id = #{projectId}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -542,4 +542,43 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
lod.create_time DESC
|
||||
</select>
|
||||
|
||||
<select id="getLeaseInfo" resultType="com.bonus.material.lease.domain.LeaseApplyDetailsInfo">
|
||||
SELECT
|
||||
lad.id AS id,
|
||||
lad.parent_id AS parentId,
|
||||
mt.type_id AS typeId,
|
||||
mt.type_name AS typeName,
|
||||
mt2.type_name AS maTypeName,
|
||||
mt.manage_type AS manageType,
|
||||
(lad.pre_num - IF( lad.al_num IS NULL, '0', lad.al_num )) AS outNum,
|
||||
IFNULL( lad.pre_num, 0 ) AS preNum,
|
||||
IFNULL( lad.al_num, 0 ) AS alNum,
|
||||
IFNULL( lad.STATUS, 0 ) AS STATUS,
|
||||
mt.unit_name AS unitName,
|
||||
mt.unit_value AS unitValue,
|
||||
lai.create_time as leaseDate,
|
||||
MAX(lod.create_time) as outDate,
|
||||
lai.create_by as leasePerson,
|
||||
GROUP_CONCAT(DISTINCT lod.create_by) as outPerson,
|
||||
lai.`code` as leaseCode,
|
||||
bt.team_name as teamName,
|
||||
bp.pro_name as projectName
|
||||
FROM
|
||||
lease_apply_info lai
|
||||
LEFT JOIN lease_apply_details lad ON lai.id = lad.parent_id
|
||||
LEFT JOIN ma_type mt ON lad.type_id = mt.type_id
|
||||
AND mt.`level` = '4' AND mt.del_flag = '0'
|
||||
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
|
||||
AND mt2.`level` = '3' AND mt2.del_flag = '0'
|
||||
LEFT JOIN lease_out_details lod on lai.id = lod.parent_id
|
||||
LEFT JOIN bm_team bt ON lai.team_id = bt.id
|
||||
LEFT JOIN bm_project bp ON bp.pro_id = lai.pro_id
|
||||
WHERE lai.lease_style = '1'
|
||||
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
||||
<![CDATA[and DATE_FORMAT( lai.create_time, '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime} ]]>
|
||||
</if>
|
||||
GROUP BY
|
||||
lai.`code`,mt.type_id
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -45,8 +45,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
lai.dept_audit_remark, lai.direct_audit_by, lai.direct_audit_time, lai.direct_audit_remark,
|
||||
lai.create_by, lai.create_time, lai.update_by, lai.update_time, lai.remark, lai.company_id,
|
||||
lai.direct_id, lai.lease_type, lai.estimate_lease_time, lai.cost_bearing_party, lai.lease_sign_url, lai.lease_sign_type,
|
||||
bai.unit_id,bai.project_id,bu.unit_name, bp.pro_name, bai.agreement_code, tt.task_status as taskStatus,
|
||||
lai.pro_id as projectId, bp.pro_name as projectName, tt.task_status as taskStatus,
|
||||
sda.dict_label as taskStatusName,
|
||||
lai.team_id as teamId,
|
||||
bt.team_name as teamName,
|
||||
IFNULL(sum(lad.pre_num),0) as preCountNum,
|
||||
IFNULL(sum(lad.al_num),0) as alNum,
|
||||
GROUP_CONCAT(mt1.type_name) as maTypeNames,
|
||||
|
|
@ -56,10 +58,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
lease_apply_info lai
|
||||
left join tm_task tt on lai.task_id = tt.task_id
|
||||
left join lease_apply_details lad on lai.id = lad.parent_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 bu on bu.unit_id = bai.unit_id
|
||||
left join bm_project bp on bp.pro_id = bai.project_id
|
||||
left join bm_project bp on bp.pro_id = lai.pro_id
|
||||
left join bm_team bt on bt.id = lai.team_id
|
||||
left join sys_dept sd on sd.dept_id = bp.imp_unit
|
||||
left join sys_dict_data sda on tt.task_status = sda.dict_value
|
||||
and sda.dict_type = 'lease_task_status'
|
||||
|
|
@ -101,7 +101,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="leaseType != null and leaseType != ''"> and lai.lease_type = #{leaseType}</if>
|
||||
<if test="estimateLeaseTime != null "> and lai.estimate_lease_time = #{estimateLeaseTime}</if>
|
||||
<if test="costBearingParty != null and costBearingParty != ''"> and lai.cost_bearing_party = #{costBearingParty}</if>
|
||||
and tt.task_type = '2'
|
||||
and tt.task_type = '2' and lai.lease_style = '1'
|
||||
</where>
|
||||
GROUP BY lai.id
|
||||
ORDER BY tt.task_status,tt.create_time desc
|
||||
|
|
@ -139,6 +139,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="leaseType != null">lease_type,</if>
|
||||
<if test="estimateLeaseTime != null">estimate_lease_time,</if>
|
||||
<if test="costBearingParty != null">cost_bearing_party,</if>
|
||||
<if test="teamId != null">team_id,</if>
|
||||
<if test="projectId != null">pro_id,</if>
|
||||
<if test="leaseStyle != null">lease_style,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="code != null">#{code},</if>
|
||||
|
|
@ -165,6 +168,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="leaseType != null">#{leaseType},</if>
|
||||
<if test="estimateLeaseTime != null">#{estimateLeaseTime},</if>
|
||||
<if test="costBearingParty != null">#{costBearingParty},</if>
|
||||
<if test="teamId != null">#{teamId},</if>
|
||||
<if test="projectId != null">#{projectId},</if>
|
||||
<if test="leaseStyle != null">#{leaseStyle},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
|
@ -193,6 +199,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="leaseType != null">lease_type = #{leaseType},</if>
|
||||
<if test="estimateLeaseTime != null">estimate_lease_time = #{estimateLeaseTime},</if>
|
||||
<if test="costBearingParty != null">cost_bearing_party = #{costBearingParty},</if>
|
||||
<if test="teamId != null">team_id = #{teamId},</if>
|
||||
<if test="projectId != null">pro_id = #{projectId},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
|
@ -302,4 +310,35 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
ORDER BY
|
||||
lpd.create_time DESC
|
||||
</select>
|
||||
|
||||
<select id="getTotalList" resultType="com.bonus.common.biz.domain.lease.LeaseApplyInfo">
|
||||
SELECT
|
||||
lease_name AS leaseUnit,
|
||||
project_name AS leaseProject,
|
||||
task_time AS leaseTime,
|
||||
task_code AS code,
|
||||
lease_person AS leasePerson,
|
||||
GROUP_CONCAT( DISTINCT ma_name ) AS maTypeNames
|
||||
FROM
|
||||
ma_station_push
|
||||
WHERE
|
||||
task_type = '1'
|
||||
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
||||
<![CDATA[and DATE_FORMAT( task_time, '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime} ]]>
|
||||
</if>
|
||||
GROUP BY
|
||||
task_code
|
||||
</select>
|
||||
|
||||
<select id="getDetailsList" resultType="com.bonus.common.biz.domain.lease.LeaseApplyInfo">
|
||||
SELECT
|
||||
ma_name AS typeCode,
|
||||
ma_model AS modelCode,
|
||||
ma_unit AS unitNames,
|
||||
NUM AS preCountNum
|
||||
FROM
|
||||
ma_station_push
|
||||
WHERE
|
||||
task_code = #{code}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -249,6 +249,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="inspectMan != null">inspect_man,</if>
|
||||
<if test="inspectStatus != null">inspect_status,</if>
|
||||
<if test="phone != null">phone,</if>
|
||||
<if test="inputTime != null">input_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="typeId != null">#{typeId},</if>
|
||||
|
|
@ -277,6 +278,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="inspectMan != null">#{inspectMan},</if>
|
||||
<if test="inspectStatus != null">#{inspectStatus},</if>
|
||||
<if test="phone != null">#{phone},</if>
|
||||
<if test="inputTime != null">#{inputTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
|
@ -473,6 +475,49 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
mm.ma_status = '2' and
|
||||
mm.ma_code like concat('%', #{maCode}, '%')
|
||||
</select>
|
||||
<select id="getMachineById" resultType="com.bonus.material.ma.domain.Machine">
|
||||
SELECT
|
||||
mm.ma_id as maId,
|
||||
mm.ma_code as maCode,
|
||||
mm.ma_status as maStatus,
|
||||
mm.qr_code as qrCode,
|
||||
mm.buy_price as buyPrice,
|
||||
mm.ma_vender as maVender,
|
||||
mm.out_fac_time as outFacTime,
|
||||
mm.out_fac_code as outFacCode
|
||||
FROM
|
||||
ma_machine mm
|
||||
where mm.ma_code = #{maCode}
|
||||
and mm.type_id = #{typeId}
|
||||
</select>
|
||||
|
||||
<select id="getMachineInfo" resultType="com.bonus.material.ma.domain.Machine">
|
||||
SELECT
|
||||
ma_material AS materialName,
|
||||
ma_type AS typeName,
|
||||
ma_name AS typeCode,
|
||||
ma_model AS maModel,
|
||||
ma_code AS modelCode,
|
||||
ma_qrcode AS qrCode,
|
||||
ma_status AS maStatus,
|
||||
this_check_time AS thisCheckTime,
|
||||
next_check_time AS nextCheckTime,
|
||||
check_man AS checkMan,
|
||||
out_fac_time AS outFacTime,
|
||||
input_time AS inputTime
|
||||
FROM
|
||||
ma_station_code
|
||||
WHERE 1 = 1
|
||||
<if test="keyWord != null and keyWord != ''">
|
||||
and (
|
||||
ma_code like concat('%', #{keyWord}, '%') or
|
||||
ma_qrcode like concat('%', #{keyWord}, '%') or
|
||||
check_man like concat('%', #{keyWord}, '%') or
|
||||
)
|
||||
</if>
|
||||
GROUP BY
|
||||
ma_code
|
||||
</select>
|
||||
|
||||
<delete id="deleteMachineByMaCodeAndTypeId">
|
||||
delete from ma_machine where ma_code = #{maCode} and type_id = #{typeId}
|
||||
|
|
|
|||
|
|
@ -609,7 +609,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
select
|
||||
type_id as typeId, parent_id as parentId, type_name as typeName, level as level
|
||||
from ma_type
|
||||
where type_name = #{typeName} and parent_id = #{parentId} and del_flag = '0'
|
||||
where type_name = #{typeName}
|
||||
and del_flag = '0'
|
||||
<if test="parentId != null and parentId !=''">
|
||||
and parent_id = #{parentId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="selectById" resultType="com.bonus.material.ma.domain.Type">
|
||||
|
|
@ -790,6 +794,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
type_id = #{record.typeId}
|
||||
</update>
|
||||
|
||||
<update id="updateNum">
|
||||
UPDATE
|
||||
ma_type
|
||||
SET
|
||||
storage_num = IFNULL(storage_num, 0) + #{storageNum},
|
||||
update_time = NOW()
|
||||
WHERE
|
||||
type_id = #{typeId}
|
||||
</update>
|
||||
|
||||
<select id="selectByTypeId" resultType="com.bonus.material.ma.domain.Type">
|
||||
select * from ma_type WHERE
|
||||
type_id = #{record.typeId}
|
||||
|
|
@ -932,4 +946,84 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
ma_type
|
||||
WHERE `level` = '1'
|
||||
</select>
|
||||
|
||||
<select id="getPushDetailsInfo" resultType="com.bonus.material.ma.domain.Type">
|
||||
SELECT
|
||||
COALESCE(t1.ma_material, t2.ma_material) AS materialName,
|
||||
COALESCE(t1.ma_type, t2.ma_type) AS typeName,
|
||||
COALESCE(t1.ma_name, t2.ma_name) AS typeCode,
|
||||
COALESCE(t1.ma_model, t2.ma_model) AS modelCode,
|
||||
COALESCE(t1.sum_num_1, 0) - COALESCE(t2.sum_num_2, 0) AS storageNum,
|
||||
COALESCE(t1.lease_price, t2.lease_price) AS leasePrice,
|
||||
COALESCE(t1.push_time, t2.push_time) AS pushTime,
|
||||
COALESCE(t1.manage_type, t2.manage_type) AS manageType
|
||||
FROM (
|
||||
SELECT
|
||||
ma_material,
|
||||
ma_type,
|
||||
ma_name,
|
||||
ma_model,
|
||||
ma_code,
|
||||
SUM(NUM) AS sum_num_1,
|
||||
lease_price,
|
||||
push_time,
|
||||
manage_type
|
||||
FROM ma_station_push
|
||||
WHERE task_type = '1'
|
||||
<if test="pushTime != null">
|
||||
and push_time = #{pushTime}
|
||||
</if>
|
||||
GROUP BY ma_material, ma_type, ma_name, ma_model
|
||||
) t1
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
ma_material,
|
||||
ma_type,
|
||||
ma_name,
|
||||
ma_model,
|
||||
ma_code,
|
||||
SUM(NUM) AS sum_num_2,
|
||||
lease_price,
|
||||
push_time,
|
||||
manage_type
|
||||
FROM ma_station_push
|
||||
WHERE task_type = '2'
|
||||
<if test="pushTime != null">
|
||||
and push_time = #{pushTime}
|
||||
</if>
|
||||
GROUP BY ma_material, ma_type, ma_name, ma_model
|
||||
) t2
|
||||
ON t1.ma_material = t2.ma_material
|
||||
AND t1.ma_type = t2.ma_type
|
||||
AND t1.ma_name = t2.ma_name
|
||||
AND t1.ma_model = t2.ma_model
|
||||
AND t1.manage_type = t2.manage_type
|
||||
</select>
|
||||
|
||||
<select id="getMaTypeDetails" resultType="com.bonus.material.ma.domain.Machine">
|
||||
SELECT
|
||||
ma_code AS maCode,
|
||||
ma_qrcode AS qrCode,
|
||||
ma_status AS maStatus,
|
||||
this_check_time AS thisCheckTime,
|
||||
next_check_time AS nextCheckTime,
|
||||
check_man AS checkMan,
|
||||
out_fac_time AS outFacTime,
|
||||
input_time AS inputTime
|
||||
FROM
|
||||
ma_station_code
|
||||
WHERE 1 =1 and push_time = #{pushTime}
|
||||
<if test="materialName != null and materialName != ''">
|
||||
and ma_material = #{materialName}
|
||||
</if>
|
||||
<if test="typeName != null and typeName != ''">
|
||||
and ma_type = #{typeName}
|
||||
</if>
|
||||
<if test="typeCode != null and typeCode != ''">
|
||||
and ma_name = #{typeCode}
|
||||
</if>
|
||||
<if test="modelCode != null and modelCode != ''">
|
||||
and ma_model = #{modelCode}
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue