领用申请
This commit is contained in:
parent
e564497ad4
commit
21c0c50a92
|
|
@ -255,4 +255,12 @@ public class LeaseApplyInfo extends BaseEntity{
|
|||
private String applyCode;
|
||||
|
||||
private Integer isApp;
|
||||
|
||||
@ApiModelProperty(value = "供应时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date supplierTime;
|
||||
|
||||
@ApiModelProperty(value = "供应地点")
|
||||
private String supplierPlace;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,11 +11,11 @@ import lombok.Getter;
|
|||
public enum LeaseTaskStatusEnum {
|
||||
//0-领用申请任务待审核,其余为领料申请流程状态
|
||||
LEASE_TASK_ZERO(0, "待审核"),
|
||||
LEASE_TASK_SUBMIT(5, "待提交"),
|
||||
LEASE_TASK_TO_PUBLISHED(1, "待发布"),
|
||||
LEASE_TASK_TO_AUDIT(2, "待审核"),
|
||||
LEASE_TASK_IN_PROGRESS(3, "出库进行中"),
|
||||
LEASE_TASK_FINISHED(4, "出库已完成");
|
||||
|
||||
private final Integer status;
|
||||
private final String statusName;
|
||||
|
||||
|
|
|
|||
|
|
@ -34,4 +34,7 @@ public class SelectDto {
|
|||
/** 标段工程id*/
|
||||
private int projectId;
|
||||
|
||||
/** 计量单位*/
|
||||
private String unitName;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,4 +20,6 @@ public class SelectVo {
|
|||
|
||||
/** 层级*/
|
||||
private String level;
|
||||
|
||||
private String unitName;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,21 +4,26 @@ 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.core.utils.poi.ExcelUtil;
|
||||
import com.bonus.common.core.web.controller.BaseController;
|
||||
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.common.security.annotation.RequiresPermissions;
|
||||
import com.bonus.material.common.annotation.PreventRepeatSubmit;
|
||||
import com.bonus.material.lease.domain.vo.LeaseApplyRequestVo;
|
||||
import com.bonus.material.lease.service.ILeaseApplyInfoService;
|
||||
import com.bonus.material.lease.service.ILeaseTaskService;
|
||||
import com.bonus.material.ma.domain.Type;
|
||||
import com.bonus.material.ma.domain.vo.MaTypeVo;
|
||||
import com.bonus.material.ma.domain.vo.StandardConfigDetailsVo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
|
@ -150,4 +155,44 @@ public class LeaseTaskController extends BaseController {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成采购单号
|
||||
*/
|
||||
@ApiOperation(value = "生成采购单号")
|
||||
@GetMapping(value = "/getCode")
|
||||
public AjaxResult getCode() {
|
||||
return AjaxResult.success(service.getCode());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导出物资类型管理列表
|
||||
*/
|
||||
@ApiOperation(value = "导出物资类型列表")
|
||||
@PreventRepeatSubmit
|
||||
@SysLog(title = "工器具物资类型", businessType = OperaType.EXPORT, module = "->导出物资类型")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response) {
|
||||
List<Integer> parentIds = service.selectParentId();
|
||||
List<MaTypeVo> maTypeVos = new ArrayList<>();
|
||||
ExcelUtil<MaTypeVo> util = new ExcelUtil<>(MaTypeVo.class);
|
||||
|
||||
for (Integer parentId : parentIds) {
|
||||
maTypeVos.addAll(service.getListByParentId(parentId.longValue()));
|
||||
}
|
||||
util.exportExcel(response, maTypeVos, "物资类型管理数据");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询物资类型3级--前端联动式下拉框
|
||||
* 没有4级规格型号
|
||||
*/
|
||||
@ApiOperation(value = "获取物资类型连动式下拉框")
|
||||
@GetMapping("/equipmentThreeType")
|
||||
public AjaxResult equipmentThreeType() {
|
||||
List<Type> listByMaType = service.getEquipmentThreeTypes();
|
||||
return success(listByMaType);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,6 +37,14 @@ public class LeaseApplyDetails extends BaseEntity {
|
|||
@Excel(name = "类型名称")
|
||||
private String maTypeName;
|
||||
|
||||
/** 物资类型ids */
|
||||
@ApiModelProperty(value = "物资类型ids")
|
||||
private int[] maTypeIds;
|
||||
|
||||
private String maTypeIdsStr;
|
||||
|
||||
private int isManual;
|
||||
|
||||
/** 规格型号id */
|
||||
@ApiModelProperty(value = "规格型号id")
|
||||
private Long typeId;
|
||||
|
|
|
|||
|
|
@ -34,4 +34,6 @@ public class LeaseApplyRequestVo extends BaseEntity {
|
|||
|
||||
private List<LeaseOutVo> leaseOutVoList;
|
||||
|
||||
private int statusFlag;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,44 @@
|
|||
package com.bonus.material.lease.domain.vo;
|
||||
|
||||
import com.bonus.common.core.web.domain.BaseEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hongchao
|
||||
* @date 2025-02-28
|
||||
*/
|
||||
|
||||
|
||||
@Data
|
||||
@ToString
|
||||
public class LeaseDeptInfo extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 部门 */
|
||||
private Long dept_id;
|
||||
|
||||
/** 父级id */
|
||||
@ApiModelProperty(value = "父级id")
|
||||
private Long parentId;
|
||||
|
||||
/** 部门名称 */
|
||||
@ApiModelProperty(value = "部门名称")
|
||||
private String deptName;
|
||||
|
||||
/** 部门缩写 */
|
||||
@ApiModelProperty(value = "部门缩写")
|
||||
private String companySX;
|
||||
|
||||
/** 父组 */
|
||||
@ApiModelProperty(value = "父组")
|
||||
private String ancestors;
|
||||
|
||||
/** 采购申请编号 */
|
||||
@ApiModelProperty(value = "采购申请编号")
|
||||
private String taskCode;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -3,7 +3,10 @@ package com.bonus.material.lease.mapper;
|
|||
|
||||
import com.bonus.common.biz.domain.lease.LeaseApplyInfo;
|
||||
import com.bonus.material.lease.domain.LeaseApplyDetails;
|
||||
import com.bonus.material.lease.domain.vo.LeaseDeptInfo;
|
||||
import com.bonus.material.ma.domain.Type;
|
||||
import com.bonus.material.ma.domain.vo.MaTypeVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -71,4 +74,24 @@ public interface LeaseTaskMapper {
|
|||
List<Type> getTypeDataList(Type bean);
|
||||
|
||||
List<LeaseApplyInfo> selectAuditLeaseApplyInfoList(LeaseApplyInfo leaseApplyInfo);
|
||||
|
||||
Long getDeptIdByUserId(Long userId);
|
||||
|
||||
LeaseDeptInfo getDeptIdByParentId(Long deptId);
|
||||
|
||||
|
||||
/**
|
||||
* 查询三级物资类型
|
||||
* @return
|
||||
*/
|
||||
List<Type> selectMaTypeThreeLists();
|
||||
|
||||
/**
|
||||
* 根据level层级和typeID 查询父级ID
|
||||
*/
|
||||
List<Integer> selectParentId();
|
||||
|
||||
List<MaTypeVo> getListByTypeName(@Param("typeId") Long typeId);
|
||||
|
||||
void updateLeaseTaskStatus(@Param("taskId") Long taskId, @Param("taskStatus") int taskStatus);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,9 @@ package com.bonus.material.lease.service;
|
|||
import com.bonus.common.biz.domain.lease.LeaseApplyInfo;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.material.lease.domain.vo.LeaseApplyRequestVo;
|
||||
import com.bonus.material.lease.domain.vo.LeaseDeptInfo;
|
||||
import com.bonus.material.ma.domain.Type;
|
||||
import com.bonus.material.ma.domain.vo.MaTypeVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -66,5 +68,24 @@ public interface ILeaseTaskService {
|
|||
List<Type> getTypeDataList(Type bean);
|
||||
|
||||
List<LeaseApplyInfo> selectAuditLeaseApplyInfoList(LeaseApplyInfo leaseApplyInfo);
|
||||
|
||||
/**
|
||||
* 生成采购单号
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
LeaseDeptInfo getCode();
|
||||
|
||||
List<Integer> selectParentId();
|
||||
|
||||
|
||||
/**
|
||||
* 查询物资类型3级--前端联动式下拉框
|
||||
* 没有4级规格型号
|
||||
* @return
|
||||
*/
|
||||
List<Type> getEquipmentThreeTypes();
|
||||
|
||||
List<MaTypeVo> getListByParentId(Long typeId);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,11 +15,13 @@ import com.bonus.material.back.domain.vo.MaCodeVo;
|
|||
import com.bonus.material.basic.mapper.BmFileInfoMapper;
|
||||
import com.bonus.material.lease.domain.LeaseApplyDetails;
|
||||
import com.bonus.material.lease.domain.vo.LeaseApplyRequestVo;
|
||||
import com.bonus.material.lease.domain.vo.LeaseDeptInfo;
|
||||
import com.bonus.material.lease.mapper.LeaseApplyDetailsMapper;
|
||||
import com.bonus.material.lease.mapper.LeaseApplyInfoMapper;
|
||||
import com.bonus.material.lease.mapper.LeaseTaskMapper;
|
||||
import com.bonus.material.lease.service.ILeaseTaskService;
|
||||
import com.bonus.material.ma.domain.Type;
|
||||
import com.bonus.material.ma.domain.vo.MaTypeVo;
|
||||
import com.bonus.material.task.domain.TmTask;
|
||||
import com.bonus.material.task.domain.TmTaskAgreement;
|
||||
import com.bonus.material.task.mapper.TmTaskAgreementMapper;
|
||||
|
|
@ -37,9 +39,7 @@ import org.springframework.util.CollectionUtils;
|
|||
|
||||
import javax.annotation.Resource;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
|
@ -89,18 +89,26 @@ public class LeaseTaskServiceImpl implements ILeaseTaskService {
|
|||
leaseApplyRequestVo.getLeaseApplyInfo().setCreateTime(DateUtils.getNowDate());
|
||||
leaseApplyRequestVo.getLeaseApplyInfo().setCreateBy(SecurityUtils.getUsername());
|
||||
try {
|
||||
Integer statusFlag = leaseApplyRequestVo.getStatusFlag();
|
||||
// 根据状态标志选择合适的状态
|
||||
Integer taskStatus;
|
||||
if (statusFlag != null && statusFlag == 0) {
|
||||
taskStatus = LeaseTaskStatusEnum.LEASE_TASK_ZERO.getStatus();
|
||||
} else {
|
||||
taskStatus = LeaseTaskStatusEnum.LEASE_TASK_SUBMIT.getStatus();
|
||||
}
|
||||
int thisMonthMaxOrder = tmTaskMapper.getMonthMaxOrderByDate(DateUtils.getCurrentYear(), DateUtils.getCurrentMonth(), TmTaskTypeEnum.TM_TASK_LEASE.getTaskTypeId());
|
||||
String taskCode = genderTaskCode(thisMonthMaxOrder);
|
||||
String taskCode = leaseApplyRequestVo.getLeaseApplyInfo().getCode();
|
||||
TmTask tmTask = new TmTask(null, TmTaskTypeEnum.TM_TASK_LEASE.getTaskTypeId(),
|
||||
LeaseTaskStatusEnum.LEASE_TASK_ZERO.getStatus(),
|
||||
taskStatus,
|
||||
leaseApplyRequestVo.getLeaseApplyInfo().getCompanyId(),thisMonthMaxOrder + 1, taskCode);
|
||||
tmTask.setCreateTime(DateUtils.getNowDate());
|
||||
tmTask.setCreateBy(SecurityUtils.getUsername());
|
||||
tmTaskMapper.insertTmTask(tmTask);
|
||||
TmTaskAgreement tmTaskAgreement = new TmTaskAgreement(tmTask.getTaskId(), leaseApplyRequestVo.getLeaseApplyInfo().getAgreementId());
|
||||
tmTaskAgreement.setCreateTime(DateUtils.getNowDate());
|
||||
tmTaskAgreement.setCreateBy(SecurityUtils.getUsername());
|
||||
tmTaskAgreementMapper.insertTmTaskAgreement(tmTaskAgreement);
|
||||
// TmTaskAgreement tmTaskAgreement = new TmTaskAgreement(tmTask.getTaskId(), leaseApplyRequestVo.getLeaseApplyInfo().getAgreementId());
|
||||
// tmTaskAgreement.setCreateTime(DateUtils.getNowDate());
|
||||
// tmTaskAgreement.setCreateBy(SecurityUtils.getUsername());
|
||||
// tmTaskAgreementMapper.insertTmTaskAgreement(tmTaskAgreement);
|
||||
leaseApplyRequestVo.getLeaseApplyInfo().setTaskId(tmTask.getTaskId());
|
||||
leaseApplyRequestVo.getLeaseApplyInfo().setCode(taskCode);
|
||||
|
||||
|
|
@ -121,7 +129,9 @@ public class LeaseTaskServiceImpl implements ILeaseTaskService {
|
|||
bmFileInfoMapper.insertBmFileInfo(bmFileInfo);
|
||||
});
|
||||
}
|
||||
sysWorkflowRecordService.addSysWorkflowRecord(tmTask.getTaskId().intValue(),taskCode,2);
|
||||
if(statusFlag!= null && statusFlag == 0){
|
||||
sysWorkflowRecordService.addSysWorkflowRecord(tmTask.getTaskId().intValue(),taskCode,2);
|
||||
}
|
||||
if (count > 0) {
|
||||
return insertPurchaseCheckDetails(leaseApplyRequestVo.getLeaseApplyDetailsList(), leaseApplyRequestVo.getLeaseApplyInfo().getId());
|
||||
} else {
|
||||
|
|
@ -218,14 +228,63 @@ public class LeaseTaskServiceImpl implements ILeaseTaskService {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成采购申请编号
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public LeaseDeptInfo getCode() {
|
||||
try {
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
Long deptId = mapper.getDeptIdByUserId(userId);
|
||||
LeaseDeptInfo leaseDeptInfo = new LeaseDeptInfo();
|
||||
leaseDeptInfo = mapper.getDeptIdByParentId(deptId);
|
||||
Long parentIdTemp = leaseDeptInfo.getParentId();
|
||||
String deptName = "";
|
||||
String taskCode = "";
|
||||
while (leaseDeptInfo != null) {
|
||||
parentIdTemp = leaseDeptInfo.getParentId();
|
||||
String ancestors = leaseDeptInfo.getAncestors();
|
||||
if (ancestors != null && StringUtils.countMatches(ancestors, ",") < 1) {
|
||||
break;
|
||||
}
|
||||
if (ancestors != null && StringUtils.countMatches(ancestors, ",") == 1) {
|
||||
deptName = leaseDeptInfo.getDeptName();
|
||||
break;
|
||||
}
|
||||
leaseDeptInfo = mapper.getDeptIdByParentId(parentIdTemp);
|
||||
}
|
||||
if(!deptName.equals("")){
|
||||
int thisMonthMaxOrder = tmTaskMapper.getMonthMaxOrderByDate(DateUtils.getCurrentYear(), DateUtils.getCurrentMonth(), TmTaskTypeEnum.TM_TASK_LEASE.getTaskTypeId());
|
||||
taskCode = genderTaskCodeTwo(thisMonthMaxOrder,leaseDeptInfo.getCompanySX());
|
||||
leaseDeptInfo.setTaskCode(taskCode);
|
||||
}
|
||||
return leaseDeptInfo;
|
||||
} catch (DataAccessException dae) {
|
||||
throw new ServiceException("数据访问异常: " + dae.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateLeaseApplyInfo(LeaseApplyRequestVo leaseApplyRequestVo) {
|
||||
try {
|
||||
// 提取到局部变量中,减少重复代码
|
||||
LeaseApplyInfo leaseApplyInfo = leaseApplyRequestVo.getLeaseApplyInfo();
|
||||
// 根据状态标志选择合适的状态
|
||||
Integer statusFlag = leaseApplyRequestVo.getStatusFlag();
|
||||
Integer taskStatus;
|
||||
if (statusFlag != null && statusFlag == 0) {
|
||||
taskStatus = LeaseTaskStatusEnum.LEASE_TASK_ZERO.getStatus();
|
||||
} else {
|
||||
taskStatus = LeaseTaskStatusEnum.LEASE_TASK_SUBMIT.getStatus();
|
||||
}
|
||||
|
||||
if (leaseApplyInfo != null && leaseApplyInfo.getId() != null) {
|
||||
leaseApplyInfo.setUpdateTime(DateUtils.getNowDate());
|
||||
leaseApplyInfo.setUpdateBy(SecurityUtils.getUsername());
|
||||
//修改任务状态
|
||||
mapper.updateLeaseTaskStatus(leaseApplyInfo.getTaskId(),taskStatus);
|
||||
|
||||
|
||||
// 去除创建一个新的数组对象,直接复用
|
||||
Long[] ids = {leaseApplyInfo.getId()};
|
||||
|
|
@ -324,6 +383,15 @@ public class LeaseTaskServiceImpl implements ILeaseTaskService {
|
|||
details.setParentId(parentId);
|
||||
details.setCreateTime(DateUtils.getNowDate());
|
||||
details.setCreateBy(SecurityUtils.getUsername());
|
||||
// 将 maTypeIds 数组转换为用逗号分隔的字符串
|
||||
if (details.getMaTypeIds() != null && details.getMaTypeIds().length > 0) {
|
||||
String maType = Arrays.stream(details.getMaTypeIds())
|
||||
.mapToObj(String::valueOf)
|
||||
.collect(Collectors.joining(","));
|
||||
details.setMaTypeIdsStr(maType);
|
||||
} else {
|
||||
details.setMaTypeIdsStr("");
|
||||
}
|
||||
}
|
||||
// 批量插入详情数据
|
||||
int count = mapper.insertLeaseApplyDetailsList(leaseApplyDetailsList);
|
||||
|
|
@ -347,6 +415,68 @@ public class LeaseTaskServiceImpl implements ILeaseTaskService {
|
|||
Date nowDate = DateUtils.getNowDate();
|
||||
String format = dateFormat.format(nowDate);
|
||||
String result = format.replace("-", "");
|
||||
return MaterialConstants.LEASE_TASK_TYPE_LABEL + result + String.format("-%03d", thisMonthMaxOrder + 1);
|
||||
return MaterialConstants.LEASE_TASK_TYPE_LABEL + result + String.format("-%05d", thisMonthMaxOrder + 1);
|
||||
}
|
||||
private static String genderTaskCodeTwo(Integer thisMonthMaxOrder,String deptName) {
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Date nowDate = DateUtils.getNowDate();
|
||||
String format = dateFormat.format(nowDate);
|
||||
String result = format.replace("-", "");
|
||||
if(deptName!=null && !"".equals(deptName)){
|
||||
return deptName + result + String.format("-%05d", thisMonthMaxOrder + 1);
|
||||
}else{
|
||||
return MaterialConstants.LEASE_TASK_TYPE_LABEL + result + String.format("-%05d", thisMonthMaxOrder + 1);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Type> getEquipmentThreeTypes() {
|
||||
List<Type> maTypes = mapper.selectMaTypeThreeLists();
|
||||
List<Type> list = new ArrayList<>();
|
||||
for (Type maType : maTypes) {
|
||||
if (maType.getParentId() == 0) {
|
||||
list.add(maType);
|
||||
}
|
||||
}
|
||||
//根据父节点获取对应的儿子节点
|
||||
for (Type maType : list) {
|
||||
List<Type> child = getChild(maTypes, maType.getTypeId());
|
||||
maType.setChildren(child);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归调用获取子级
|
||||
* @param list 集合
|
||||
* @param parentId 父级id
|
||||
*/
|
||||
public List<Type> getChild(List<Type> list, Long parentId) {
|
||||
List<Type> childList = new ArrayList<Type>();
|
||||
for (Type maType : list) {
|
||||
Long typeId = maType.getTypeId();
|
||||
Long pid = maType.getParentId();
|
||||
if (parentId.equals(pid)) {
|
||||
List<Type> childLists = getChild(list, typeId);
|
||||
maType.setChildren(childLists);
|
||||
childList.add(maType);
|
||||
}
|
||||
}
|
||||
return childList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Integer> selectParentId() {
|
||||
return mapper.selectParentId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据组织树parent_id查询结果
|
||||
*
|
||||
* @param typeId 父级id
|
||||
*/
|
||||
@Override
|
||||
public List<MaTypeVo> getListByParentId(Long typeId) {
|
||||
return mapper.getListByTypeName(typeId);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -378,7 +378,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
SELECT type_id AS typeId,
|
||||
type_name AS name,
|
||||
parent_id AS parentId,
|
||||
level AS level
|
||||
level AS level,
|
||||
unit_name AS unitName
|
||||
FROM ma_type
|
||||
WHERE del_flag = '0'
|
||||
<if test="level != null and level != ''">
|
||||
|
|
|
|||
|
|
@ -102,6 +102,8 @@
|
|||
<result property="isTest" column="is_test"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
|
||||
<sql id="selectLeaseApplyInfoVo">
|
||||
select
|
||||
lai.id, lai.code, lai.task_id, lai.lease_person, lai.phone, lai.type, lai.company_audit_by,lai.apply_code,
|
||||
|
|
@ -207,6 +209,10 @@
|
|||
<if test="estimateLeaseTime != null">estimate_lease_time,</if>
|
||||
<if test="costBearingParty != null">cost_bearing_party,</if>
|
||||
<if test="applyCode != null">apply_code,</if>
|
||||
<if test="supplierTime != null">supplier_time,</if>
|
||||
<if test="supplierPlace != null">supplier_place,</if>
|
||||
<if test="unitId != null">unit_id,</if>
|
||||
<if test="projectId != null">project_id,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="code != null">#{code},</if>
|
||||
|
|
@ -234,6 +240,10 @@
|
|||
<if test="estimateLeaseTime != null">#{estimateLeaseTime},</if>
|
||||
<if test="costBearingParty != null">#{costBearingParty},</if>
|
||||
<if test="applyCode != null">#{applyCode},</if>
|
||||
<if test="supplierTime != null">#{supplierTime},</if>
|
||||
<if test="supplierPlace != null">#{supplierPlace},</if>
|
||||
<if test="unitId != null">#{unitId},</if>
|
||||
<if test="projectId != null">#{projectId},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
|
@ -241,13 +251,14 @@
|
|||
useGeneratedKeys="true">
|
||||
insert into lease_apply_details
|
||||
(parent_id, type_id, pre_num, al_num, `status`, create_by, create_time, update_by,
|
||||
update_time, remark, company_id)
|
||||
update_time, remark, company_id,ma_type_ids,is_manual)
|
||||
values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.parentId,jdbcType=INTEGER}, #{item.typeId,jdbcType=INTEGER}, #{item.preNum,jdbcType=INTEGER},
|
||||
#{item.alNum,jdbcType=INTEGER}, #{item.status,jdbcType=VARCHAR}, #{item.createBy,jdbcType=VARCHAR},
|
||||
NOW(), #{item.updateBy,jdbcType=VARCHAR}, NOW(),
|
||||
#{item.remark,jdbcType=VARCHAR}, #{item.companyId,jdbcType=INTEGER})
|
||||
#{item.remark,jdbcType=VARCHAR}, #{item.companyId,jdbcType=INTEGER},#{item.maTypeIdsStr,jdbcType=VARCHAR},
|
||||
#{item.isManual,jdbcType=INTEGER})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
|
|
@ -270,6 +281,8 @@
|
|||
<if test="directAuditRemark != null">direct_audit_remark = #{directAuditRemark},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="applyCode != null">apply_code = #{applyCode},</if>
|
||||
<if test="supplierTime != null">supplier_time = #{supplierTime},</if>
|
||||
<if test="supplierPlace != null">supplier_place = #{supplierPlace},</if>
|
||||
update_time = now(),
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="companyId != null">company_id = #{companyId},</if>
|
||||
|
|
@ -283,7 +296,39 @@
|
|||
|
||||
<select id="selectLeaseApplyInfoList" parameterType="com.bonus.common.biz.domain.lease.LeaseApplyInfo"
|
||||
resultMap="LeaseApplyInfoResult">
|
||||
<include refid="selectLeaseApplyInfoVo"/>
|
||||
select
|
||||
lai.id, lai.code, lai.task_id, lai.lease_person, lai.phone, lai.type, lai.company_audit_by,lai.apply_code,
|
||||
lai.company_audit_time, lai.company_audit_remark, lai.dept_audit_by, lai.dept_audit_time,
|
||||
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,tt.task_id as taskId,
|
||||
lai.unit_id,lai.project_id,bu.unit_name, bp.pro_name, tt.task_status as taskStatus,
|
||||
|
||||
case tt.task_status
|
||||
when 0 then '待审核'
|
||||
when 1 then '待审核'
|
||||
when 2 then '审核中'
|
||||
when 3 then '已完成'
|
||||
when 4 then '已完成'
|
||||
end as taskStatusName,
|
||||
IFNULL(sum(lad.pre_num),0) as preCountNum,
|
||||
IFNULL(sum(lad.al_num),0) as alNum,
|
||||
GROUP_CONCAT(DISTINCT mt1.type_name) AS maTypeNames,
|
||||
bp.contract_part as contractPart,
|
||||
sd.dept_name as impUnitName
|
||||
from
|
||||
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_unit bu on bu.unit_id = lai.unit_id
|
||||
left join bm_project bp on bp.pro_id = lai.project_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'
|
||||
left join ma_type mt on lad.type_id = mt.type_id and mt.del_flag = '0'
|
||||
left join ma_type mt1 on mt.parent_id = mt1.type_id and mt1.del_flag = '0'
|
||||
where 1=1
|
||||
<if test="code != null and code != ''">and lai.code = #{code}</if>
|
||||
<if test="taskId != null ">and lai.task_id = #{taskId}</if>
|
||||
|
|
@ -332,7 +377,6 @@
|
|||
<if test="costBearingParty != null and costBearingParty != ''">and lai.cost_bearing_party =
|
||||
#{costBearingParty}
|
||||
</if>
|
||||
and lai.apply_code is not null
|
||||
<if test="isApp != null and taskStatus==1">and (tt.task_status = 0 or tt.task_status = 1 or tt.task_status = 2) </if>
|
||||
<if test="isApp != null and taskStatus==3">and (tt.task_status = 3 or tt.task_status = 4)</if>
|
||||
GROUP BY lai.id
|
||||
|
|
@ -358,7 +402,40 @@
|
|||
</select>
|
||||
|
||||
<select id="selectLeaseApplyInfoById" parameterType="Long" resultMap="LeaseApplyInfoResult">
|
||||
<include refid="selectLeaseApplyInfoVo"/>
|
||||
select
|
||||
lai.id, lai.code, lai.task_id, lai.lease_person, lai.phone, lai.type, lai.company_audit_by,lai.apply_code,
|
||||
lai.company_audit_time, lai.company_audit_remark, lai.dept_audit_by, lai.dept_audit_time,
|
||||
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,tt.task_id as taskId,
|
||||
lai.unit_id,lai.project_id,bu.unit_name, bp.pro_name, tt.task_status as taskStatus,
|
||||
lai.supplier_time as supplierTime,
|
||||
lai.supplier_place as supplierPlace,
|
||||
case tt.task_status
|
||||
when 0 then '待审核'
|
||||
when 1 then '待审核'
|
||||
when 2 then '审核中'
|
||||
when 3 then '已完成'
|
||||
when 4 then '已完成'
|
||||
end as taskStatusName,
|
||||
IFNULL(sum(lad.pre_num),0) as preCountNum,
|
||||
IFNULL(sum(lad.al_num),0) as alNum,
|
||||
GROUP_CONCAT(DISTINCT mt1.type_name) AS maTypeNames,
|
||||
bp.contract_part as contractPart,
|
||||
sd.dept_name as impUnitName
|
||||
from
|
||||
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_unit bu on bu.unit_id = lai.unit_id
|
||||
left join bm_project bp on bp.pro_id = lai.project_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'
|
||||
left join ma_type mt on lad.type_id = mt.type_id and mt.del_flag = '0'
|
||||
left join ma_type mt1 on mt.parent_id = mt1.type_id and mt1.del_flag = '0'
|
||||
where lai.id = #{id}
|
||||
</select>
|
||||
|
||||
|
|
@ -485,4 +562,82 @@
|
|||
GROUP BY lai.id
|
||||
ORDER BY tt.task_status,tt.create_time desc
|
||||
</select>
|
||||
|
||||
<select id="getDeptIdByUserId" resultType="long">
|
||||
select
|
||||
dept_id as deptId
|
||||
from sys_user su
|
||||
where user_id = #{userId} and del_flag = 0
|
||||
</select>
|
||||
|
||||
<select id="getDeptIdByParentId" resultType="com.bonus.material.lease.domain.vo.LeaseDeptInfo">
|
||||
select
|
||||
dept_id as deptId,
|
||||
parent_id as parentId,
|
||||
dept_name as deptName,
|
||||
ancestors as ancestors,
|
||||
company_sx as companySx
|
||||
from sys_dept
|
||||
where dept_id = #{deptId} and del_flag = 0
|
||||
</select>
|
||||
|
||||
<select id="selectMaTypeThreeLists" resultMap="TypeResult">
|
||||
SELECT m.type_id,
|
||||
m.type_name,
|
||||
m.parent_id,
|
||||
m.manage_type,
|
||||
m.LEVEL,
|
||||
m.type_id AS id,
|
||||
m.type_name AS label
|
||||
FROM ma_type m
|
||||
</select>
|
||||
|
||||
<select id="selectParentId" resultType="java.lang.Integer">
|
||||
SELECT DISTINCT
|
||||
mt2.type_id
|
||||
FROM
|
||||
ma_type mt
|
||||
LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id
|
||||
LEFT JOIN ma_type mt3 ON mt2.parent_id = mt3.type_id
|
||||
LEFT JOIN ma_type mt4 ON mt3.parent_id = mt4.type_id
|
||||
where mt2.type_id is not null
|
||||
|
||||
</select>
|
||||
|
||||
<select id="getListByTypeName" resultType="com.bonus.material.ma.domain.vo.MaTypeVo">
|
||||
SELECT DISTINCT
|
||||
m3.type_name AS itemType,
|
||||
m2.type_name AS materialType,
|
||||
m1.type_name AS materialName,
|
||||
m.type_id AS typeId,
|
||||
m.type_name AS typeName,
|
||||
m.parent_id as parentId,
|
||||
m.manage_type as manageType,
|
||||
m.unit_name as unitName,
|
||||
m.lease_price as leasePrice,
|
||||
m.rent_price as rentPrice,
|
||||
m.eff_time as effTime,
|
||||
m.buy_price as buyPrice,
|
||||
m.LEVEL as level,
|
||||
m.rated_load as ratedLoad,
|
||||
m.test_load as testLoad,
|
||||
m.holding_time as holdingTime,
|
||||
m.remark as remark,
|
||||
m.fac_model AS facModel
|
||||
FROM
|
||||
ma_type m
|
||||
LEFT JOIN ma_type m1 ON m.parent_id = m1.type_id and m1.del_flag = '0'
|
||||
LEFT JOIN ma_type m2 ON m1.parent_id = m2.type_id and m2.del_flag = '0'
|
||||
LEFT JOIN ma_type m3 ON m2.parent_id = m3.type_id and m3.del_flag = '0'
|
||||
WHERE m.parent_id = #{typeId} and m.del_flag = '0'
|
||||
GROUP BY m.type_id
|
||||
</select>
|
||||
|
||||
<update id="updateLeaseTaskStatus">
|
||||
update tm_task
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="taskStatus != null">task_status = #{taskStatus},</if>
|
||||
</trim>
|
||||
where task_Id = #{taskId}
|
||||
</update>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue