材料站退料预约
This commit is contained in:
parent
cdb1ef32ce
commit
547af18752
|
|
@ -0,0 +1,100 @@
|
|||
package com.bonus.material.clz.controller;
|
||||
|
||||
import com.bonus.common.core.utils.poi.ExcelUtil;
|
||||
import com.bonus.common.core.web.controller.BaseController;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.material.clz.domain.back.MaterialBackApplyTotalInfo;
|
||||
import com.bonus.material.clz.domain.back.MaterialBackPreApply;
|
||||
import com.bonus.material.clz.service.MaterialBackAppointmentService;
|
||||
import com.bonus.material.common.annotation.PreventRepeatSubmit;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description 材料站退料预约
|
||||
* @author hay
|
||||
* @date 2025/9/14 10:37
|
||||
*/
|
||||
@Api(tags = "材料站退料预约")
|
||||
@RestController
|
||||
@RequestMapping("/material_back_appointment")
|
||||
public class MaterialBackAppointmentController extends BaseController {
|
||||
|
||||
@Resource
|
||||
private MaterialBackAppointmentService service;
|
||||
|
||||
@ApiOperation(value = "查询工程对应项目部")
|
||||
@GetMapping("/getProDepartmentByPro")
|
||||
public AjaxResult getProDepartmentByPro(MaterialBackPreApply bean) {
|
||||
return service.getProDepartmentByPro(bean);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询在用设备列表")
|
||||
@GetMapping("/getUseTypeList")
|
||||
public AjaxResult getUseTypeList(MaterialBackApplyTotalInfo bean) {
|
||||
return service.getUseTypeList(bean);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "新增退料预约")
|
||||
@PreventRepeatSubmit
|
||||
@PostMapping("/addBackAppointment")
|
||||
public AjaxResult addBackAppointment(@Valid @RequestBody MaterialBackPreApply bean) {
|
||||
return service.addBackAppointment(bean);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改退料预约
|
||||
*/
|
||||
@ApiOperation(value = "修改退料预约")
|
||||
@PreventRepeatSubmit
|
||||
@PostMapping("/edit")
|
||||
public AjaxResult editBackAppointment(@Valid @RequestBody MaterialBackPreApply bean) {
|
||||
return service.editBackAppointment(bean);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除退料预约
|
||||
*/
|
||||
@ApiOperation(value = "删除退料预约")
|
||||
@PreventRepeatSubmit
|
||||
@PostMapping("/deleteById")
|
||||
public AjaxResult remove(@RequestBody MaterialBackPreApply bean) {
|
||||
return service.deleteById(bean);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询退料预约列表
|
||||
*/
|
||||
@ApiOperation(value = "查询退料预约列表")
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list(MaterialBackPreApply bean) {
|
||||
startPage();
|
||||
List<MaterialBackPreApply> list = service.selectBackPreApplyList(bean);
|
||||
return AjaxResult.success(getDataTable(list));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询退料预约详情")
|
||||
@GetMapping("/getListDetails")
|
||||
public AjaxResult getListDetails(MaterialBackPreApply bean) {
|
||||
return service.getListDetails(bean);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出退料预约列表
|
||||
* @param response
|
||||
* @param bean
|
||||
*/
|
||||
@ApiOperation("导出退料预约列表")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, MaterialBackPreApply bean) {
|
||||
List<MaterialBackPreApply> list = service.export(bean);
|
||||
ExcelUtil<MaterialBackPreApply> util = new ExcelUtil<>(MaterialBackPreApply.class);
|
||||
util.exportExcel(response, list, "退料预约列表");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -129,4 +129,9 @@ public class BmTeam {
|
|||
* 班组长身份证号
|
||||
*/
|
||||
private String teamLeaderIdCard;
|
||||
|
||||
/**
|
||||
* 协议id
|
||||
*/
|
||||
private Long agreementId;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,140 @@
|
|||
package com.bonus.material.clz.domain.back;
|
||||
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.Size;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description 材料站退料预约
|
||||
* @author hay
|
||||
* @date 2025/9/14 12:59
|
||||
*/
|
||||
@Accessors(chain = true)
|
||||
@Data
|
||||
@ToString
|
||||
public class MaterialBackPreApply implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Boolean isExport;
|
||||
|
||||
@ApiModelProperty(value = "是否退料 0 否,1 是")
|
||||
private Integer isBack;
|
||||
|
||||
/** ID */
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "单位名称")
|
||||
@Excel(name = "退料单位")
|
||||
private String unitName;
|
||||
|
||||
@ApiModelProperty(value="工程id")
|
||||
private Long proId;
|
||||
|
||||
@ApiModelProperty(value="工程名称")
|
||||
@Excel(name = "退料工程")
|
||||
private String proName;
|
||||
|
||||
/** 退料单号 */
|
||||
@Excel(name = "退料单号")
|
||||
@ApiModelProperty(value = "退料单号")
|
||||
private String code;
|
||||
|
||||
/** 退料人 */
|
||||
@Excel(name = "退料人")
|
||||
private String backPerson;
|
||||
|
||||
@ApiModelProperty(value = "预退料时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "退料时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date backTime;
|
||||
|
||||
@ApiModelProperty(value = "单位名称")
|
||||
private String teamName;
|
||||
|
||||
@ApiModelProperty(value = "协议id")
|
||||
private Long agreementId;
|
||||
|
||||
@ApiModelProperty(value = "类型id")
|
||||
private String typeId;
|
||||
|
||||
@ApiModelProperty(value = "物资类型")
|
||||
private String materialType;
|
||||
|
||||
private String materialName;
|
||||
|
||||
@ApiModelProperty(value = "类型名称")
|
||||
@Excel(name = "物资名称")
|
||||
private String typeName;
|
||||
|
||||
@ApiModelProperty(value = "规格型号")
|
||||
@Excel(name = "规格型号")
|
||||
private String typeModel;
|
||||
|
||||
@ApiModelProperty(value = "单位")
|
||||
@Excel(name = "单位")
|
||||
private String unit;
|
||||
|
||||
@ApiModelProperty(value = "管理方式(0编号 1计数)")
|
||||
@Excel(name = "管理方式")
|
||||
private String manageType;
|
||||
|
||||
@ApiModelProperty(value = "退料数量")
|
||||
@Excel(name = "退料数量")
|
||||
private BigDecimal backNum;
|
||||
|
||||
@Size(max = 500, message = "备注长度不能超过500个字符")
|
||||
@Excel(name = "备注")
|
||||
private String remark;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "0.暂存,1.提交")
|
||||
private String status;
|
||||
|
||||
@ApiModelProperty(value = "班组id")
|
||||
private Long teamId;
|
||||
|
||||
private Long unitId;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
private String createBy;
|
||||
|
||||
private String updateBy;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
|
||||
@ApiModelProperty(value="开始时间")
|
||||
private String startTime;
|
||||
|
||||
@ApiModelProperty(value="结束时间")
|
||||
private String endTime;
|
||||
|
||||
@ApiModelProperty(value="关键字")
|
||||
private String keyWord;
|
||||
|
||||
@ApiModelProperty(value = "身份证号码")
|
||||
private String idCard;
|
||||
|
||||
/**
|
||||
* i8工程id集合
|
||||
*/
|
||||
private List<String> projectIdList;
|
||||
|
||||
@ApiModelProperty(value = "实施单位id")
|
||||
private String impUnit;
|
||||
|
||||
|
||||
List<MaterialBackPreDetails> backPreDetailsList;
|
||||
}
|
||||
|
|
@ -0,0 +1,134 @@
|
|||
package com.bonus.material.clz.domain.back;
|
||||
|
||||
import com.bonus.common.biz.domain.BmFileInfo;
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import com.bonus.common.core.web.domain.BaseEntity;
|
||||
import com.bonus.material.back.domain.MaCodeDto;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description 材料站退料预约
|
||||
* @author hay
|
||||
* @date 2025/9/14 13:54
|
||||
*/
|
||||
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@Data
|
||||
@ToString
|
||||
public class MaterialBackPreDetails extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** ID */
|
||||
private Long id;
|
||||
|
||||
/** 退料单号 */
|
||||
@Excel(name = "退料单号")
|
||||
@ApiModelProperty(value = "退料单号")
|
||||
private String code;
|
||||
|
||||
@ApiModelProperty(value = "机具id")
|
||||
private Long maId;
|
||||
|
||||
@ApiModelProperty(value = "机具id")
|
||||
private Long taskId;
|
||||
|
||||
/** 任务ID */
|
||||
@Excel(name = "任务ID")
|
||||
@ApiModelProperty(value = "任务ID")
|
||||
private Long parentId;
|
||||
|
||||
@ApiModelProperty(value = "物资类型")
|
||||
private String materialType;
|
||||
|
||||
/** 规格ID */
|
||||
@Excel(name = "规格ID")
|
||||
@ApiModelProperty(value = "规格ID")
|
||||
private Long typeId;
|
||||
|
||||
@ApiModelProperty(value = "类型名称")
|
||||
private String typeName;
|
||||
|
||||
@ApiModelProperty(value = "规格型号")
|
||||
private String typeModel;
|
||||
|
||||
@ApiModelProperty(value = "单位名称")
|
||||
private String unitName;
|
||||
|
||||
@ApiModelProperty(value = "单位名称数值")
|
||||
private String unitValue;
|
||||
|
||||
@ApiModelProperty(value = "管理方式(0编号 1计数)")
|
||||
private String manageType;
|
||||
|
||||
/**
|
||||
* 机具编码
|
||||
*/
|
||||
@ApiModelProperty(value = "机具编码")
|
||||
private String maCode;
|
||||
|
||||
private String materialName;
|
||||
|
||||
private String maStatus;
|
||||
|
||||
/**
|
||||
* 机具编码集合(可能存在多个,数据库存储用逗号分割)
|
||||
*/
|
||||
private List<MaCodeDto> maCodeList;
|
||||
|
||||
/** 退料数量 */
|
||||
@ApiModelProperty(value = "退料数量")
|
||||
private BigDecimal preNum;
|
||||
|
||||
/** 审批数量 */
|
||||
@ApiModelProperty(value = "审批数量")
|
||||
private BigDecimal auditNum;
|
||||
|
||||
@ApiModelProperty(value = "外观判断不合格数量")
|
||||
private BigDecimal badNum;
|
||||
|
||||
@ApiModelProperty(value = "外观判断合格数量")
|
||||
private BigDecimal goodNum;
|
||||
|
||||
/** 退料数量 */
|
||||
@ApiModelProperty(value = "退料数量")
|
||||
private BigDecimal backNum;
|
||||
|
||||
@ApiModelProperty(value = "在用数量")
|
||||
private BigDecimal num;
|
||||
|
||||
/** 状态(0待审批,1进行中,2已出库,3已驳回) */
|
||||
@ApiModelProperty(value = "状态(0待退料,1进行中,2已退料,3已驳回)")
|
||||
private String status;
|
||||
|
||||
@ApiModelProperty(value = "机具外观判断")
|
||||
private String apDetection;
|
||||
|
||||
@ApiModelProperty(value = "退料状态")
|
||||
private String backStatus;
|
||||
|
||||
@ApiModelProperty(value = "是否完成 (0:未完成退料,可以撤回 1:已完成退料,不能撤回)")
|
||||
private Integer isFinished;
|
||||
|
||||
/** 数据所属组织 */
|
||||
@ApiModelProperty(value = "数据所属组织")
|
||||
private Long companyId;
|
||||
|
||||
/** 领用方式 */
|
||||
@ApiModelProperty(value = "领用方式 2数据同步")
|
||||
private Integer leaseStyle;
|
||||
|
||||
/**
|
||||
* 附件列表
|
||||
*/
|
||||
@ApiModelProperty(value = "附件列表")
|
||||
List<BmFileInfo> bmFileInfos;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,95 @@
|
|||
package com.bonus.material.clz.mapper;
|
||||
|
||||
|
||||
import com.bonus.material.clz.domain.back.MaterialBackApplyDetails;
|
||||
import com.bonus.material.clz.domain.back.MaterialBackApplyTotalInfo;
|
||||
import com.bonus.material.clz.domain.back.MaterialBackPreApply;
|
||||
import com.bonus.material.clz.domain.back.MaterialBackPreDetails;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description 材料站退料预约
|
||||
* @author hay
|
||||
* @date 2025/9/14 10:41
|
||||
*/
|
||||
public interface MaterialBackAppointmentMapper {
|
||||
|
||||
/**
|
||||
* 获取退料使用类型列表
|
||||
* @param bean
|
||||
* @return List<MaterialBackApplyDetails>
|
||||
*/
|
||||
List<MaterialBackApplyDetails> getUseTypeList(MaterialBackApplyTotalInfo bean);
|
||||
|
||||
/**
|
||||
* 新增退料预约
|
||||
* @param bean
|
||||
* @return int
|
||||
*/
|
||||
int insertBackPreApply(MaterialBackPreApply bean);
|
||||
|
||||
/**
|
||||
* 获取退料预约数量
|
||||
* @param nowDate
|
||||
* @return int
|
||||
*/
|
||||
int selectNumByMonth(Date nowDate);
|
||||
|
||||
/**
|
||||
* 新增退料预约详情
|
||||
* @param details
|
||||
* @return int
|
||||
*/
|
||||
int insertBackPreDetails(MaterialBackPreDetails details);
|
||||
|
||||
/**
|
||||
* 获取退料预约列表
|
||||
* @param bean
|
||||
* @return List<MaterialBackPreApply>
|
||||
*/
|
||||
List<MaterialBackPreApply> selectBackPreApplyList(MaterialBackPreApply bean);
|
||||
|
||||
/**
|
||||
* 获取退料预约详情
|
||||
* @param bean
|
||||
* @return MaterialBackPreApply
|
||||
*/
|
||||
MaterialBackPreApply getBackPreApply(MaterialBackPreApply bean);
|
||||
|
||||
/**
|
||||
* 获取退料预约详情列表
|
||||
* @param apply
|
||||
* @return List<MaterialBackPreDetails>
|
||||
*/
|
||||
List<MaterialBackPreDetails> getListDetails(MaterialBackPreApply apply);
|
||||
|
||||
/**
|
||||
* 修改退料预约
|
||||
* @param bean
|
||||
* @return int
|
||||
*/
|
||||
int updateBackPreApply(MaterialBackPreApply bean);
|
||||
|
||||
/**
|
||||
* 删除退料预约详情
|
||||
* @param id
|
||||
* @return int
|
||||
*/
|
||||
int deleteBackPreDetails(Long id);
|
||||
|
||||
/**
|
||||
* 删除退料预约
|
||||
* @param bean
|
||||
* @return int
|
||||
*/
|
||||
int deleteById(MaterialBackPreApply bean);
|
||||
|
||||
/**
|
||||
* 获取退料预约列表
|
||||
* @param bean
|
||||
* @return List<MaterialBackPreApply>
|
||||
*/
|
||||
List<MaterialBackPreApply> export(MaterialBackPreApply bean);
|
||||
}
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
package com.bonus.material.clz.service;
|
||||
|
||||
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.material.clz.domain.back.MaterialBackApplyTotalInfo;
|
||||
import com.bonus.material.clz.domain.back.MaterialBackPreApply;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description 材料站退料预约
|
||||
* @author hay
|
||||
* @date 2025/9/14 10:39
|
||||
*/
|
||||
public interface MaterialBackAppointmentService {
|
||||
|
||||
/**
|
||||
* 查询在用设备列表
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
AjaxResult getUseTypeList(MaterialBackApplyTotalInfo bean);
|
||||
|
||||
/**
|
||||
* 新增退料预约
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
AjaxResult addBackAppointment(MaterialBackPreApply bean);
|
||||
|
||||
/**
|
||||
* 查询退料预约列表
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
List<MaterialBackPreApply> selectBackPreApplyList(MaterialBackPreApply bean);
|
||||
|
||||
/**
|
||||
* 查询工程对应项目部
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
AjaxResult getProDepartmentByPro(MaterialBackPreApply bean);
|
||||
|
||||
/**
|
||||
* 获取退料预约列表详情
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
AjaxResult getListDetails(MaterialBackPreApply bean);
|
||||
|
||||
/**
|
||||
* 修改退料预约
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
AjaxResult editBackAppointment(MaterialBackPreApply bean);
|
||||
|
||||
/**
|
||||
* 删除退料预约
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
AjaxResult deleteById(MaterialBackPreApply bean);
|
||||
|
||||
/**
|
||||
* 导出退料预约列表
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
List<MaterialBackPreApply> export(MaterialBackPreApply bean);
|
||||
}
|
||||
|
|
@ -0,0 +1,345 @@
|
|||
package com.bonus.material.clz.service.impl;
|
||||
|
||||
import com.bonus.common.core.utils.DateUtils;
|
||||
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.clz.domain.BmTeam;
|
||||
import com.bonus.material.clz.domain.back.MaterialBackApplyDetails;
|
||||
import com.bonus.material.clz.domain.back.MaterialBackApplyTotalInfo;
|
||||
import com.bonus.material.clz.domain.back.MaterialBackPreApply;
|
||||
import com.bonus.material.clz.domain.back.MaterialBackPreDetails;
|
||||
import com.bonus.material.clz.mapper.MaterialBackAppointmentMapper;
|
||||
import com.bonus.material.clz.mapper.MaterialMachineMapper;
|
||||
import com.bonus.material.clz.service.MaterialBackAppointmentService;
|
||||
import com.bonus.material.common.mapper.SelectMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.hibernate.validator.internal.util.StringHelper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @description 材料站退料预约
|
||||
* @author hay
|
||||
* @date 2025/9/14 10:39
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class MaterialBackAppointmentServiceImpl implements MaterialBackAppointmentService {
|
||||
|
||||
@Resource
|
||||
private MaterialBackAppointmentMapper mapper;
|
||||
|
||||
@Resource(name = "SelectMapper")
|
||||
private SelectMapper selectMapper;
|
||||
|
||||
@Resource
|
||||
private MaterialMachineMapper materialMachineMapper;
|
||||
|
||||
/**
|
||||
* @description 获取在用设备列表
|
||||
* @param bean
|
||||
* @return AjaxResult
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult getUseTypeList(MaterialBackApplyTotalInfo bean) {
|
||||
try {
|
||||
List<MaterialBackApplyDetails> list = mapper.getUseTypeList(bean);
|
||||
return AjaxResult.success(list);
|
||||
} catch (Exception e) {
|
||||
log.error("获取在用设备列表:{}", e);
|
||||
return AjaxResult.success(new ArrayList<>());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 新增退料预约
|
||||
* @param bean
|
||||
* @return AjaxResult
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult addBackAppointment(MaterialBackPreApply bean) {
|
||||
try {
|
||||
Long theLoginUserId = SecurityUtils.getLoginUser().getSysUser().getUserId();
|
||||
//生成单号
|
||||
String code = genderLeaseCode();
|
||||
bean.setCode(code);
|
||||
bean.setCreateBy(theLoginUserId.toString());
|
||||
//新插入申请表数据
|
||||
int insert = mapper.insertBackPreApply(bean);
|
||||
if (insert > 0 && bean.getBackPreDetailsList() != null) {
|
||||
//在插入申请表数据成功后,再插入申请明细表数据
|
||||
for (MaterialBackPreDetails details : bean.getBackPreDetailsList()) {
|
||||
details.setParentId(bean.getId());
|
||||
details.setCreateBy(theLoginUserId.toString());
|
||||
int insertDetails = mapper.insertBackPreDetails(details);
|
||||
if (insertDetails <= 0) {
|
||||
throw new RuntimeException("添加失败");
|
||||
}
|
||||
}
|
||||
return AjaxResult.success("添加成功");
|
||||
} else {
|
||||
return AjaxResult.error("添加失败");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("添加失败:{}", e);
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return AjaxResult.error("添加失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 查询退料预约列表
|
||||
* @param bean
|
||||
* @return List<MaterialBackPreApply>
|
||||
*/
|
||||
@Override
|
||||
public List<MaterialBackPreApply> selectBackPreApplyList(MaterialBackPreApply bean) {
|
||||
try {
|
||||
Set<String> userRoles = SecurityUtils.getLoginUser().getRoles();
|
||||
String username = SecurityUtils.getLoginUser().getUsername();
|
||||
BmTeam teamData = null;
|
||||
// 检查用户是否具有特殊角色
|
||||
boolean hasSpecialRole = hasSpecialRole(userRoles);
|
||||
if (!hasSpecialRole) {
|
||||
// 根据用户名判断用户是否为班组长
|
||||
teamData = materialMachineMapper.getTeamData(username);
|
||||
if (teamData == null) {
|
||||
// 根据用户名查询项目部信息
|
||||
List<String> departId = selectMapper.getDepartId(username);
|
||||
// 根据项目部id查询工程信息
|
||||
List<String> projectIdList = selectMapper.getProjectId(departId);
|
||||
if (!CollectionUtils.isEmpty(projectIdList)) {
|
||||
bean.setProjectIdList(projectIdList);
|
||||
}
|
||||
bean.setIdCard(null);
|
||||
}
|
||||
}
|
||||
List<MaterialBackPreApply> list = mapper.selectBackPreApplyList(bean);
|
||||
// 如果列表为空,直接返回空列表
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
if (!hasSpecialRole) {
|
||||
// 数据权限划分,获取当前用户的deptId
|
||||
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
|
||||
if (!CollectionUtils.isEmpty(list) && deptId != null) {
|
||||
// 删除元素
|
||||
list.removeIf(info -> !deptId.toString().equals(info.getImpUnit()));
|
||||
}
|
||||
}
|
||||
if (!org.springframework.util.CollectionUtils.isEmpty(list)) {
|
||||
// 班组长权限
|
||||
if (teamData != null) {
|
||||
// 将sortedList中班组身份证号与username相同的元素过滤处理
|
||||
list = list.stream()
|
||||
.filter(item -> StringUtils.isBlank(item.getIdCard()) || username.equals(item.getIdCard()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
// 物资类型过滤
|
||||
if (!StringHelper.isNullOrEmptyString(bean.getTypeName())) {
|
||||
list = list.stream()
|
||||
.filter(item -> bean.getTypeName().contains(item.getTypeName()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
return list;
|
||||
} catch (Exception e) {
|
||||
log.error("查询退料预约列表:{}", e);
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 查询工程对应项目部
|
||||
* @param bean
|
||||
* @return AjaxResult
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult getProDepartmentByPro(MaterialBackPreApply bean) {
|
||||
try {
|
||||
List<MaterialBackPreApply> list = selectMapper.getProDepartmentByPro(bean);
|
||||
return AjaxResult.success(list);
|
||||
} catch (Exception e) {
|
||||
log.error("查询工程对应项目部:{}", e);
|
||||
return AjaxResult.success(new ArrayList<>());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult getListDetails(MaterialBackPreApply bean) {
|
||||
try {
|
||||
MaterialBackPreApply apply = mapper.getBackPreApply(bean);
|
||||
if (apply != null){
|
||||
//查询详情
|
||||
List<MaterialBackPreDetails> details = mapper.getListDetails(apply);
|
||||
if (details != null && details.size() > 0){
|
||||
apply.setBackPreDetailsList(details);
|
||||
}
|
||||
}
|
||||
return AjaxResult.success(apply);
|
||||
} catch (Exception e) {
|
||||
log.error("查询退料单详情:{}", e);
|
||||
return AjaxResult.success(new MaterialBackPreApply());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult editBackAppointment(MaterialBackPreApply bean) {
|
||||
try {
|
||||
Long theLoginUserId = SecurityUtils.getLoginUser().getSysUser().getUserId();
|
||||
if (bean.getId() != null){
|
||||
bean.setUpdateBy(theLoginUserId.toString());
|
||||
int update = mapper.updateBackPreApply(bean);
|
||||
if (update > 0){
|
||||
//删除原明细表数据
|
||||
int delete = mapper.deleteBackPreDetails(bean.getId());
|
||||
if (delete > 0 && bean.getBackPreDetailsList() != null){
|
||||
//在插入申请明细表数据
|
||||
for (MaterialBackPreDetails details : bean.getBackPreDetailsList()) {
|
||||
details.setParentId(bean.getId());
|
||||
details.setCreateBy(theLoginUserId.toString());
|
||||
details.setUpdateBy(theLoginUserId.toString());
|
||||
details.setUpdateTime(DateUtils.getNowDate());
|
||||
int insertDetails = mapper.insertBackPreDetails(details);
|
||||
if (insertDetails <= 0) {
|
||||
throw new RuntimeException("修改失败");
|
||||
}
|
||||
}
|
||||
return AjaxResult.success("修改成功");
|
||||
}
|
||||
}
|
||||
return AjaxResult.success("修改失败");
|
||||
} else {
|
||||
return AjaxResult.error("修改失败,缺少必要条件id");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("修改退料预约:{}", e);
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return AjaxResult.error("修改失败");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult deleteById(MaterialBackPreApply bean) {
|
||||
try {
|
||||
int delete = mapper.deleteById(bean);
|
||||
if (delete > 0) {
|
||||
int deleteDetails = mapper.deleteBackPreDetails(bean.getId());
|
||||
if (deleteDetails > 0) {
|
||||
return AjaxResult.success("删除成功");
|
||||
} else {
|
||||
throw new RuntimeException("删除失败");
|
||||
}
|
||||
}
|
||||
return AjaxResult.error("删除失败");
|
||||
} catch (Exception e) {
|
||||
log.error("删除退料预约:{}", e);
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return AjaxResult.error("删除失败");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MaterialBackPreApply> export(MaterialBackPreApply bean) {
|
||||
try {
|
||||
Set<String> userRoles = SecurityUtils.getLoginUser().getRoles();
|
||||
String username = SecurityUtils.getLoginUser().getUsername();
|
||||
BmTeam teamData = null;
|
||||
// 检查用户是否具有特殊角色
|
||||
boolean hasSpecialRole = hasSpecialRole(userRoles);
|
||||
if (!hasSpecialRole) {
|
||||
// 根据用户名判断用户是否为班组长
|
||||
teamData = materialMachineMapper.getTeamData(username);
|
||||
if (teamData == null) {
|
||||
// 根据用户名查询项目部信息
|
||||
List<String> departId = selectMapper.getDepartId(username);
|
||||
// 根据项目部id查询工程信息
|
||||
List<String> projectIdList = selectMapper.getProjectId(departId);
|
||||
if (!CollectionUtils.isEmpty(projectIdList)) {
|
||||
bean.setProjectIdList(projectIdList);
|
||||
}
|
||||
bean.setIdCard(null);
|
||||
}
|
||||
}
|
||||
List<MaterialBackPreApply> list = mapper.export(bean);
|
||||
// 如果列表为空,直接返回空列表
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
if (!hasSpecialRole) {
|
||||
// 数据权限划分,获取当前用户的deptId
|
||||
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
|
||||
if (!CollectionUtils.isEmpty(list) && deptId != null) {
|
||||
// 删除元素
|
||||
list.removeIf(info -> !deptId.toString().equals(info.getImpUnit()));
|
||||
}
|
||||
}
|
||||
if (!org.springframework.util.CollectionUtils.isEmpty(list)) {
|
||||
// 班组长权限
|
||||
if (teamData != null) {
|
||||
// 将sortedList中班组身份证号与username相同的元素过滤处理
|
||||
list = list.stream()
|
||||
.filter(item -> StringUtils.isBlank(item.getIdCard()) || username.equals(item.getIdCard()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
// 物资类型过滤
|
||||
if (!StringHelper.isNullOrEmptyString(bean.getTypeName())) {
|
||||
list = list.stream()
|
||||
.filter(item -> bean.getTypeName().contains(item.getTypeName()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
return list;
|
||||
} catch (Exception e) {
|
||||
log.error("导出退料预约列表:{}", e);
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成退料单号
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
public String genderLeaseCode() {
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Date nowDate = DateUtils.getNowDate();
|
||||
String format = dateFormat.format(nowDate);
|
||||
String result = format.replace("-", "");
|
||||
int num = mapper.selectNumByMonth(nowDate);
|
||||
num = num + 1;
|
||||
String code;
|
||||
if (num > 9 && num < 100) {
|
||||
code = "MT" + result + "-0" + num;
|
||||
} else if (num > 99 && num < 1000) {
|
||||
code = "MT" + result + "-" + num;
|
||||
} else {
|
||||
code = "MT" + result + "-00" + num;
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查用户是否具有特殊角色
|
||||
* @param userRoles
|
||||
* @return
|
||||
*/
|
||||
private boolean hasSpecialRole(Set<String> userRoles) {
|
||||
if (userRoles == null) {
|
||||
return false;
|
||||
}
|
||||
List<String> allowedRoles = Collections.singletonList("clzcx");
|
||||
return allowedRoles.stream().anyMatch(userRoles::contains);
|
||||
}
|
||||
}
|
||||
|
|
@ -6,6 +6,7 @@ import com.bonus.common.biz.domain.TypeTreeNode;
|
|||
import com.bonus.material.back.domain.BackApplyInfo;
|
||||
import com.bonus.material.basic.domain.BmProject;
|
||||
import com.bonus.material.basic.domain.BmUnit;
|
||||
import com.bonus.material.clz.domain.back.MaterialBackPreApply;
|
||||
import com.bonus.material.clz.domain.BmTeam;
|
||||
import com.bonus.material.clz.domain.lease.MaterialLeaseApplyInfo;
|
||||
import com.bonus.material.common.domain.dto.SelectDto;
|
||||
|
|
@ -347,4 +348,11 @@ public interface SelectMapper {
|
|||
* @return
|
||||
*/
|
||||
List<String> getProjectIdByUseName(String username);
|
||||
|
||||
/**
|
||||
* 获取部门下拉选
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
List<MaterialBackPreApply> getProDepartmentByPro(MaterialBackPreApply bean);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -107,10 +107,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
SELECT DISTINCT bu.unit_id AS id,
|
||||
bu.unit_name AS teamName,
|
||||
bu.link_man AS relName,
|
||||
bu.telphone AS relPhone
|
||||
bu.telphone AS relPhone,
|
||||
bai.agreement_id as agreementId
|
||||
FROM bm_project bpl
|
||||
LEFT JOIN clz_bm_agreement_info bai ON bpl.pro_id = bai.project_id AND bai.`status` = '1'
|
||||
LEFT JOIN bm_unit bu ON bai.unit_id = bu.unit_id AND bu.del_flag = '0'
|
||||
WHERE bpl.pro_id = #{proId} AND bpl.del_flag = '0'
|
||||
and bu.unit_name is not null
|
||||
and bu.unit_id is not null
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,266 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.bonus.material.clz.mapper.MaterialBackAppointmentMapper">
|
||||
<insert id="insertBackPreApply" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into clz_back_pre_apply
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="agreementId != null">clz_agreement_id,</if>
|
||||
<if test="backTime != null">back_time,</if>
|
||||
<if test="backPerson != null">back_person,</if>
|
||||
<if test="code != null">back_code,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
create_time,
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="agreementId != null">#{agreementId},</if>
|
||||
<if test="backTime != null">#{backTime},</if>
|
||||
<if test="backPerson != null">#{backPerson},</if>
|
||||
<if test="code != null">#{code},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
NOW(),
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<insert id="insertBackPreDetails">
|
||||
insert into clz_back_pre_details
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="parentId != null">apply_id,</if>
|
||||
<if test="typeId != null">type_id,</if>
|
||||
<if test="maId != null">ma_id,</if>
|
||||
<if test="backNum != null">back_num,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
create_time,
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="parentId != null">#{parentId},</if>
|
||||
<if test="typeId != null">#{typeId},</if>
|
||||
<if test="maId != null">#{maId},</if>
|
||||
<if test="backNum != null">#{backNum},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
NOW(),
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<update id="updateBackPreApply">
|
||||
update clz_back_pre_apply
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="agreementId != null">clz_agreement_id = #{agreementId},</if>
|
||||
<if test="backTime != null">back_time = #{backTime},</if>
|
||||
<if test="backPerson != null">back_person = #{backPerson},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
update_time = NOW(),
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
<delete id="deleteBackPreDetails">
|
||||
delete
|
||||
from clz_back_pre_details
|
||||
where apply_id = #{parentId}
|
||||
</delete>
|
||||
<delete id="deleteById">
|
||||
delete
|
||||
from clz_back_pre_apply
|
||||
where id = #{id}
|
||||
</delete>
|
||||
|
||||
<select id="getUseTypeList" resultType="com.bonus.material.clz.domain.back.MaterialBackApplyDetails">
|
||||
SELECT
|
||||
mt.type_id as typeId,
|
||||
mt1.type_name as typeName,
|
||||
mt.type_name as typeModel,
|
||||
mt.parent_id as parentId,
|
||||
mt.unit_name as unitName,
|
||||
mt.unit_value as unitValue,
|
||||
mt.manage_type as manageType,
|
||||
SUM(sai.num) AS num,
|
||||
mt.LEVEL as level
|
||||
FROM
|
||||
ma_type mt
|
||||
LEFT JOIN slt_agreement_info sai ON mt.type_id = sai.type_id
|
||||
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id and mt1.del_flag = '0'
|
||||
WHERE
|
||||
sai.STATUS = '0' and sai.is_slt='0' and sai.agreement_id = #{agreementId}
|
||||
GROUP BY
|
||||
mt.type_id
|
||||
HAVING
|
||||
num > 0
|
||||
</select>
|
||||
<select id="selectNumByMonth" resultType="java.lang.Integer">
|
||||
select count(*)
|
||||
from clz_back_pre_apply
|
||||
where DATE_FORMAT(create_time, '%y%m') = DATE_FORMAT(#{date}, '%y%m')
|
||||
</select>
|
||||
<select id="selectBackPreApplyList" resultType="com.bonus.material.clz.domain.back.MaterialBackPreApply">
|
||||
SELECT
|
||||
cbpa.id,
|
||||
bu.unit_name as unitName,
|
||||
bp.pro_name as proName,
|
||||
cbpa.back_person as backPerson,
|
||||
cbpa.back_time as backTime,
|
||||
cbpa.back_code as `code`,
|
||||
cbpa.status,
|
||||
GROUP_CONCAT(DISTINCT mt2.type_name) AS typeName,
|
||||
bp.imp_unit as impUnit,
|
||||
bu.bzz_idcard AS idCard
|
||||
FROM
|
||||
clz_back_pre_apply cbpa
|
||||
LEFT JOIN clz_back_pre_details cbpd on cbpd.apply_id=cbpa.id
|
||||
LEFT JOIN ma_type mt on mt.type_id=cbpd.type_id
|
||||
LEFT JOIN ma_type mt2 on mt2.type_id=mt.parent_id
|
||||
LEFT JOIN bm_agreement_info cbai on cbai.agreement_id=cbpa.clz_agreement_id
|
||||
LEFT JOIN bm_unit bu on bu.unit_id=cbai.unit_id
|
||||
LEFT JOIN bm_project bp on bp.pro_id=cbai.project_id
|
||||
where 1=1
|
||||
<if test="unitName != null and unitName!=''">
|
||||
and bu.unit_name like CONCAT('%', #{unitName}, '%')
|
||||
</if>
|
||||
<if test="proName != null and proName!=''">
|
||||
and bp.pro_name like CONCAT('%', #{proName}, '%')
|
||||
</if>
|
||||
<if test="backPerson != null and backPerson!=''">
|
||||
and cbpa.back_person like CONCAT('%', #{backPerson}, '%')
|
||||
</if>
|
||||
<if test="code != null and code!=''">
|
||||
and cbpa.back_code like CONCAT('%', #{code}, '%')
|
||||
</if>
|
||||
<if test="projectIdList != null and projectIdList.size() > 0">
|
||||
and bp.external_id in
|
||||
<foreach item="item" collection="projectIdList" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="idCard != null and idCard != ''">
|
||||
and bu.bzz_idcard = #{idCard}
|
||||
</if>
|
||||
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
||||
and cbpa.back_time BETWEEN #{startTime} AND #{endTime}
|
||||
</if>
|
||||
GROUP BY cbpa.id
|
||||
ORDER BY cbpa.create_time DESC
|
||||
</select>
|
||||
<select id="getBackPreApply" resultType="com.bonus.material.clz.domain.back.MaterialBackPreApply">
|
||||
SELECT
|
||||
cbpa.id,
|
||||
bu.unit_id as unitId,
|
||||
bu.unit_name as unitName,
|
||||
bp.pro_id as proId,
|
||||
bp.pro_name as proName,
|
||||
cbpa.`status`,
|
||||
cbpa.clz_agreement_id as agreementId,
|
||||
cbpa.back_time as backTime,
|
||||
cbpa.back_person as backPerson
|
||||
FROM
|
||||
clz_back_pre_apply cbpa
|
||||
LEFT JOIN bm_agreement_info bai on bai.agreement_id=cbpa.clz_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
|
||||
WHERE
|
||||
cbpa.id=#{id}
|
||||
</select>
|
||||
<select id="getListDetails" resultType="com.bonus.material.clz.domain.back.MaterialBackPreDetails">
|
||||
SELECT cbpd.id,
|
||||
cbpd.apply_id as parentId,
|
||||
cbpd.type_id as typeId,
|
||||
mt2.type_name as typeName,
|
||||
mt.type_name as typeModel,
|
||||
mt.unit_name as unitName,
|
||||
aa.num,
|
||||
mt.manage_type as manageType,
|
||||
cbpd.back_num as backNum,
|
||||
cbpd.remark
|
||||
FROM clz_back_pre_details cbpd
|
||||
LEFT JOIN ma_type mt on mt.type_id = cbpd.type_id
|
||||
LEFT JOIN ma_type mt2 on mt2.type_id = mt.parent_id
|
||||
LEFT JOIN (SELECT mt.type_id as typeId,
|
||||
mt1.type_name as typeName,
|
||||
mt.type_name as typeModel,
|
||||
mt.parent_id as parentId,
|
||||
mt.unit_name as unitName,
|
||||
mt.unit_value as unitValue,
|
||||
mt.manage_type as manageType,
|
||||
SUM(sai.num) AS num,
|
||||
mt.LEVEL as level
|
||||
FROM ma_type mt
|
||||
LEFT JOIN slt_agreement_info sai ON mt.type_id = sai.type_id
|
||||
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id and mt1.del_flag = '0'
|
||||
WHERE sai.STATUS = '0'
|
||||
and sai.is_slt = '0'
|
||||
and sai.agreement_id = #{agreementId}
|
||||
GROUP BY mt.type_id
|
||||
HAVING num > 0) aa on aa.typeId = cbpd.type_id
|
||||
WHERE apply_id = #{id}
|
||||
</select>
|
||||
<select id="export" resultType="com.bonus.material.clz.domain.back.MaterialBackPreApply">
|
||||
SELECT cbpa.id,
|
||||
bu.unit_name as unitName,
|
||||
bp.pro_name as proName,
|
||||
cbpa.back_person as backPerson,
|
||||
cbpa.back_time as backTime,
|
||||
cbpa.back_code as `code`,
|
||||
cbpa.status,
|
||||
mt2.type_name as typeName,
|
||||
mt.type_name as typeModel,
|
||||
mt.unit_name as unit,
|
||||
bp.imp_unit as impUnit,
|
||||
bu.bzz_idcard AS idCard,
|
||||
CASE
|
||||
WHEN mt.manage_type = '0' THEN
|
||||
'编码'
|
||||
ELSE
|
||||
'数量'
|
||||
END manageType,
|
||||
cbpd.back_num as backNum,
|
||||
cbpd.remark
|
||||
|
||||
FROM clz_back_pre_apply cbpa
|
||||
LEFT JOIN clz_back_pre_details cbpd on cbpd.apply_id = cbpa.id
|
||||
LEFT JOIN ma_type mt on mt.type_id = cbpd.type_id
|
||||
LEFT JOIN ma_type mt2 on mt2.type_id = mt.parent_id
|
||||
LEFT JOIN bm_agreement_info cbai on cbai.agreement_id = cbpa.clz_agreement_id
|
||||
LEFT JOIN bm_unit bu on bu.unit_id = cbai.unit_id
|
||||
LEFT JOIN bm_project bp on bp.pro_id = cbai.project_id
|
||||
where 1 = 1
|
||||
and cbpa.status = '1'
|
||||
<if test="unitName != null and unitName!=''">
|
||||
and bu.unit_name like CONCAT('%', #{unitName}, '%')
|
||||
</if>
|
||||
<if test="proName != null and proName!=''">
|
||||
and bp.pro_name like CONCAT('%', #{proName}, '%')
|
||||
</if>
|
||||
<if test="backPerson != null and backPerson!=''">
|
||||
and cbpa.back_person like CONCAT('%', #{backPerson}, '%')
|
||||
</if>
|
||||
<if test="code != null and code!=''">
|
||||
and cbpa.back_code like CONCAT('%', #{code}, '%')
|
||||
</if>
|
||||
<if test="projectIdList != null and projectIdList.size() > 0">
|
||||
and bp.external_id in
|
||||
<foreach item="item" collection="projectIdList" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="idCard != null and idCard != ''">
|
||||
and bu.bzz_idcard = #{idCard}
|
||||
</if>
|
||||
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
||||
and cbpa.back_time BETWEEN #{startTime} AND #{endTime}
|
||||
</if>
|
||||
ORDER BY cbpa.create_time DESC
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -1089,4 +1089,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
WHERE
|
||||
bzz_idcard = #{username}
|
||||
</select>
|
||||
<select id="getProDepartmentByPro" resultType="com.bonus.material.clz.domain.back.MaterialBackPreApply">
|
||||
SELECT bu.unit_id as unitId,
|
||||
bu.unit_name as unitName,
|
||||
bai.agreement_id as agreementId
|
||||
FROM bm_agreement_info bai
|
||||
LEFT JOIN bm_unit bu on bu.unit_id = bai.unit_id
|
||||
WHERE bai.project_id = #{proId}
|
||||
and bu.type_id = '36'
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue