feat(material): 支持班组领料功能
- 新增字段和方法以支持班组领料 - 修改出库流程,增加对班组领料的处理逻辑 - 更新退料和结算相关功能,以适应班组领料 - 优化查询接口,支持按班组查询领料信息
This commit is contained in:
parent
185769e896
commit
a0f4d1e8d5
|
|
@ -48,4 +48,7 @@ public class TypeTreeNode {
|
|||
|
||||
@ApiModelProperty(value = "协议id")
|
||||
private Long agreementId;
|
||||
|
||||
@ApiModelProperty(value = "领料方式 0材料领料 1工器具领料 2数据同步")
|
||||
private Integer leaseStyle;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -108,6 +108,9 @@ public class LeaseOutDetails extends BaseEntity {
|
|||
@ApiModelProperty(value = "协议id")
|
||||
private Long agreementId;
|
||||
|
||||
@ApiModelProperty(value = "项目部协议id")
|
||||
private Long projectUnitAgreementId;
|
||||
|
||||
@ApiModelProperty(value = "是否完成 (0:未完成 1:已完成)")
|
||||
private Integer isFinished;
|
||||
|
||||
|
|
@ -140,6 +143,9 @@ public class LeaseOutDetails extends BaseEntity {
|
|||
@ApiModelProperty(value = "领料id")
|
||||
private Integer leaseUnitId;
|
||||
|
||||
@ApiModelProperty(value = "领料单位是否为班组")
|
||||
private Boolean leaseUnitIsTeam;
|
||||
|
||||
@ApiModelProperty(value = "领料工程id")
|
||||
private Integer leaseProjectId;
|
||||
|
||||
|
|
|
|||
|
|
@ -39,6 +39,9 @@ public class BackApplyInfo implements Serializable {
|
|||
@ApiModelProperty(value = "协议id")
|
||||
private Long agreementId;
|
||||
|
||||
@ApiModelProperty(value = "材料站协议id")
|
||||
private Long clzAgreementId;
|
||||
|
||||
@ApiModelProperty(value = "任务类型")
|
||||
private Integer taskType;
|
||||
|
||||
|
|
|
|||
|
|
@ -49,6 +49,13 @@ public class BmAgreementInfo extends BaseEntity
|
|||
@NotNull(message = "往来单位id不能为空")
|
||||
private Long unitId;
|
||||
|
||||
/**
|
||||
* 往来单位所属项目部ID
|
||||
*/
|
||||
@NotNull(message = "所属项目部ID不能为空")
|
||||
@ApiModelProperty(value = "所属项目部ID")
|
||||
private Long projectUnitId;
|
||||
|
||||
/**
|
||||
* 往来单位
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -62,6 +62,11 @@ public interface BmAgreementInfoMapper
|
|||
|
||||
public int selectNumByMonth(Date nowDate);
|
||||
|
||||
/**
|
||||
* 查询单位类型,是内部单位/外部单位
|
||||
* @param agreementId
|
||||
* @return
|
||||
*/
|
||||
String getProtocol(String agreementId);
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -119,6 +119,10 @@ public class MaterialBackApplyDetails extends BaseEntity {
|
|||
@ApiModelProperty(value = "数据所属组织")
|
||||
private Long companyId;
|
||||
|
||||
/** 领用方式 */
|
||||
@ApiModelProperty(value = "领用方式 2数据同步")
|
||||
private Integer leaseStyle;
|
||||
|
||||
/**
|
||||
* 附件列表
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -416,6 +416,7 @@ public class MaterialBackApplyInfoServiceImpl implements MaterialBackApplyInfoSe
|
|||
TmTaskAgreement tmTaskAgreement = new TmTaskAgreement(tmTask.getTaskId(), dto.getBackApplyInfo().getAgreementId());
|
||||
tmTaskAgreement.setCreateTime(DateUtils.getNowDate());
|
||||
tmTaskAgreement.setCreateBy(createBy);
|
||||
// 增加任务和协议关联表数据
|
||||
taskAgreementMapper.insertTmTaskAgreement(tmTaskAgreement);
|
||||
backApplyInfo.setTaskId(tmTask.getTaskId());
|
||||
backApplyInfo.setBackStyle("1");
|
||||
|
|
@ -443,7 +444,7 @@ public class MaterialBackApplyInfoServiceImpl implements MaterialBackApplyInfoSe
|
|||
//对提交的退料详情数量进行校验
|
||||
for (MaterialBackApplyDetails backApplyDetails : dto.getBackApplyDetailsList()) {
|
||||
if (backApplyDetails.getNum() != null && backApplyDetails.getPreNum() != null) {
|
||||
if (backApplyDetails.getNum().compareTo(backApplyDetails.getPreNum())<0 ) {
|
||||
if (backApplyDetails.getNum().compareTo(backApplyDetails.getPreNum()) < 0) {
|
||||
return AjaxResult.error(backApplyDetails.getTypeName() + "退料数量不能大于预退数量,请重新填写!");
|
||||
}
|
||||
}
|
||||
|
|
@ -851,6 +852,7 @@ public class MaterialBackApplyInfoServiceImpl implements MaterialBackApplyInfoSe
|
|||
* @return
|
||||
*/
|
||||
private int saveBackApplyDetails(String createBy, MaterialBackApplyRequestVo dto, MaterialBackApplyInfo backApplyInfo, int result) {
|
||||
// 循环退料详情
|
||||
for (MaterialBackApplyDetails details : dto.getBackApplyDetailsList()) {
|
||||
details.setCode(backApplyInfo.getCode());
|
||||
details.setParentId(backApplyInfo.getId());
|
||||
|
|
@ -862,15 +864,18 @@ public class MaterialBackApplyInfoServiceImpl implements MaterialBackApplyInfoSe
|
|||
result += materialBackInfoMapper.insertBackApplyDetails(details);
|
||||
// 处理附件
|
||||
result = saveBmFileInfo(details, backApplyInfo.getId(), result);
|
||||
|
||||
// 判断是否为编码设备并处理附件
|
||||
Integer isBack = dto.getBackApplyInfo().getIsBack();
|
||||
details.setIsFinished(isBack);
|
||||
result = saveMaCodeBmFileInfo(createBy, isBack, details, backApplyInfo.getId(), result);
|
||||
|
||||
if (isBack == 1) {
|
||||
// 更新任务表及退料申请表状态
|
||||
result += updateTaskAndBackInfo(backApplyInfo);
|
||||
// 更新结算表
|
||||
backApplyInfo.setTypeId(details.getTypeId().toString());
|
||||
// 查询材料站的退料明细
|
||||
List<MaterialBackApplyInfo> allList = materialBackInfoMapper.selectBackDetails(backApplyInfo);
|
||||
if (CollectionUtils.isNotEmpty(allList)) {
|
||||
List<MaterialBackApplyInfo> newList = new ArrayList<>();
|
||||
|
|
@ -892,6 +897,7 @@ public class MaterialBackApplyInfoServiceImpl implements MaterialBackApplyInfoSe
|
|||
}
|
||||
}
|
||||
}
|
||||
// 更新材料站的结算协议表
|
||||
int res = updateSlt4Bean(backApplyInfo, newList);
|
||||
// 检查机具是否领料
|
||||
if (res == 0) {
|
||||
|
|
|
|||
|
|
@ -1380,8 +1380,7 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
|
|||
// 获取要减去的值,默认值为BigDecimal.ZERO
|
||||
BigDecimal subtractNum = typeIdToNum.getOrDefault(typeId, BigDecimal.ZERO);
|
||||
// 计算新值,处理num为null的情况(若业务允许)
|
||||
BigDecimal currentNum = Optional.ofNullable(node.getNum())
|
||||
.orElse(BigDecimal.ZERO);
|
||||
BigDecimal currentNum = Optional.ofNullable(node.getNum()).orElse(BigDecimal.ZERO);
|
||||
BigDecimal newNum = currentNum.subtract(subtractNum);
|
||||
if (newNum.compareTo(BigDecimal.ZERO) == 0) {
|
||||
iterator.remove();
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.bonus.material.common.domain.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -8,6 +9,7 @@ import java.util.List;
|
|||
* @author 10488
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class SelectDto {
|
||||
|
||||
/** 参数id*/
|
||||
|
|
|
|||
|
|
@ -507,6 +507,14 @@ public class SelectServiceImpl implements SelectService {
|
|||
List<TypeTreeNode> listL3 = new ArrayList<>();
|
||||
List<TypeTreeNode> listL21 = new ArrayList<>();
|
||||
try {
|
||||
// 判断单位是否为班组,如果为班组的话,把材料站的领用数据也查询出来
|
||||
if (bean.getUnitId() != null && bean.getProId() != null) {
|
||||
List<AgreementVo> clzAgreementInfos = mapper.getAgreementInfoByIdBack(new SelectDto().setProId(bean.getProId()).setUnitId(Math.toIntExact(bean.getUnitId())));
|
||||
// 如果在材料站该单位有签署协议,说明该单位是班组
|
||||
if (CollectionUtils.isNotEmpty(clzAgreementInfos)) {
|
||||
bean.setClzAgreementId(Long.valueOf(clzAgreementInfos.get(0).getAgreementId()));
|
||||
}
|
||||
}
|
||||
// 先查第四层类型
|
||||
listL4 = mapper.getUseTypeTreeL4(bean);
|
||||
if (CollectionUtils.isNotEmpty(listL4)) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package com.bonus.material.lease.mapper;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import com.bonus.common.biz.domain.lease.LeaseApplyInfo;
|
||||
import com.bonus.common.biz.domain.lease.LeaseConfirmSign;
|
||||
|
|
@ -75,6 +74,33 @@ public interface LeaseApplyInfoMapper {
|
|||
*/
|
||||
int deleteLeaseApplyInfoByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 查询领料任务的单位类型是否是班组
|
||||
* @param leaseId 领料任务id
|
||||
* @return 领料单位类型
|
||||
*/
|
||||
Long selectLeaseApplyInfoIsTeam(Long leaseId);
|
||||
|
||||
/**
|
||||
* 根据单位id查询单位类型
|
||||
*/
|
||||
Long selectUnitTypeByUnitId(Long unitId);
|
||||
|
||||
/**
|
||||
* 查询领料任务的单位ID
|
||||
* @param leaseId 领料任务id
|
||||
* @return 单位ID
|
||||
*/
|
||||
Long selectLeaseApplyInfoUnitIdByLeaseId(Long leaseId);
|
||||
|
||||
/**
|
||||
* 根据班组ID和工程ID查询挂靠的项目部的协议id
|
||||
* @param teamId 班组单位id
|
||||
* @param projectId 工程id
|
||||
* @return 挂靠的项目部协议id
|
||||
*/
|
||||
Long selectProjectUnitAgreementIdByTeamAndProject(@Param("teamId") Integer teamId, @Param("projectId") Integer projectId);
|
||||
|
||||
String getTaskId(Long parentId);
|
||||
|
||||
/** 设置审批人为默认的董班长 --防止代码冲突 **/
|
||||
|
|
|
|||
|
|
@ -1273,6 +1273,22 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
|
|||
@Override
|
||||
public AjaxResult leaseOut(LeaseOutRequestVo leaseOutRequestVo) {
|
||||
for (LeaseOutDetails bean : leaseOutRequestVo.getLeaseOutDetailsList()) {
|
||||
if (Objects.isNull(bean)) {
|
||||
continue;
|
||||
}
|
||||
// 默认设置领料单位为非班组
|
||||
bean.setLeaseUnitIsTeam(false);
|
||||
// 根据现在的领料发布出库单位ID来判断类型是否是班组
|
||||
if (bean.getLeaseUnitId() != null) {
|
||||
// 查询单位类型
|
||||
Long leaseUnitTypeId = leaseApplyInfoMapper.selectUnitTypeByUnitId(Long.valueOf(bean.getLeaseUnitId()));
|
||||
if (leaseUnitTypeId != null && Objects.equals(leaseUnitTypeId, 1731L)) {
|
||||
System.out.println("发布出库的领料单位是班组,Yes");
|
||||
bean.setLeaseUnitIsTeam(true);
|
||||
} else {
|
||||
System.out.println("发布出库的领料单位不是班组,No");
|
||||
}
|
||||
}
|
||||
AjaxResult ajaxResult = leaseOutDetailsService.leaseOut(bean);
|
||||
if (ajaxResult.isError()) {
|
||||
return ajaxResult;
|
||||
|
|
|
|||
|
|
@ -205,6 +205,27 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService {
|
|||
// 5、插入结算记录
|
||||
String taskId = leaseApplyInfoMapper.getTaskId(record.getParentId());
|
||||
record.setTaskId(taskId);
|
||||
// 判断如果是班组领料,则插入原本项目部的协议结算记录
|
||||
if (record.getLeaseUnitIsTeam() != null && record.getLeaseUnitIsTeam()) {
|
||||
// 暂存现在出库的班组单位ID
|
||||
Integer thisOutId = record.getLeaseUnitId();
|
||||
// 查询班组挂靠的项目部协议ID
|
||||
Long projectUnitAgreementId = leaseApplyInfoMapper.selectProjectUnitAgreementIdByTeamAndProject(record.getLeaseUnitId(), record.getLeaseProjectId());
|
||||
if (projectUnitAgreementId != null && projectUnitAgreementId > 0L) {
|
||||
record.setProjectUnitAgreementId(projectUnitAgreementId);
|
||||
} else {
|
||||
return AjaxResult.error("出库失败,没有找到班组所属项目部协议信息");
|
||||
}
|
||||
// 查询申请领料的项目部单位ID
|
||||
Long originLeaseUnitId = leaseApplyInfoMapper.selectLeaseApplyInfoUnitIdByLeaseId(record.getParentId());
|
||||
record.setLeaseUnitId(Math.toIntExact(originLeaseUnitId));
|
||||
// 插入项目部领料的结算记录
|
||||
int inserts = insSltInfo(taskId, record);
|
||||
System.out.println("插入原本项目部领料结算记录" + (inserts > 0 ? "成功" : "失败"));
|
||||
// 恢复出库班组单位ID
|
||||
record.setLeaseUnitId(thisOutId);
|
||||
record.setLeaseUnitIsTeam(false);
|
||||
}
|
||||
res = insSltInfo(taskId, record);
|
||||
if (res == 0) {
|
||||
throw new RuntimeException("出库失败,插入结算记录失败");
|
||||
|
|
@ -230,8 +251,7 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService {
|
|||
if (task == null) {
|
||||
int thisMonthMaxOrder = tmTaskMapper.getMonthMaxOrderByDate(DateUtils.getCurrentYear(), DateUtils.getCurrentMonth(), TmTaskTypeEnum.TM_TASK_MATERIAL_LEASE.getTaskTypeId());
|
||||
String taskCode = genderTaskCode(thisMonthMaxOrder);
|
||||
TmTask tmTask = new TmTask();
|
||||
tmTask = new TmTask(null, TmTaskTypeEnum.TM_TASK_MATERIAL_LEASE.getTaskTypeId(),
|
||||
TmTask tmTask = new TmTask(null, TmTaskTypeEnum.TM_TASK_MATERIAL_LEASE.getTaskTypeId(),
|
||||
LeaseTaskStatusEnum.LEASE_TASK_FINISHED.getStatus(),
|
||||
null, thisMonthMaxOrder + 1, taskCode);
|
||||
tmTask.setCreateTime(DateUtils.getNowDate());
|
||||
|
|
@ -261,6 +281,7 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService {
|
|||
bmAgreementInfo.setUnitId(tbTeam.getId());
|
||||
} else {
|
||||
bmAgreementInfo.setUnitId(bmTeam.getId());
|
||||
// 修改班组信息
|
||||
bmTeamMapper.update(tbTeam);
|
||||
}
|
||||
// 先根据班组和工程id查询,若存在则直接返回,不存在则新增
|
||||
|
|
@ -313,6 +334,7 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService {
|
|||
throw new Exception("更新clz_lease_apply_details表数据失败");
|
||||
}
|
||||
} else {
|
||||
// 走新增
|
||||
record.setPreNum(record.getOutNum());
|
||||
record.setAlNum(record.getOutNum());
|
||||
res = materialLeaseInfoMapper.insertLeaseApplyDetails(record);
|
||||
|
|
@ -357,7 +379,7 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService {
|
|||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
return AjaxResult.error("出库失败");
|
||||
return AjaxResult.error("出库失败" + e.getMessage());
|
||||
}
|
||||
return AjaxResult.success("出库成功");
|
||||
}
|
||||
|
|
@ -758,21 +780,35 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService {
|
|||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 插入结算信息
|
||||
* @param taskId 任务id
|
||||
* @param record 出库记录
|
||||
*/
|
||||
public int insSltInfo(String taskId, LeaseOutDetails record) {
|
||||
int res = 0;
|
||||
SltAgreementInfo sltAgreementInfo = sltAgreementInfoMapper.getSltAgreementInfo(record);
|
||||
// 根据发布批次查询结算协议信息
|
||||
SltAgreementInfo sltAgreementInfo;
|
||||
// 判断是否是班组领用
|
||||
sltAgreementInfo = sltAgreementInfoMapper.getSltAgreementInfo(record);
|
||||
if (sltAgreementInfo != null) {
|
||||
BigDecimal num = sltAgreementInfo.getNum();
|
||||
BigDecimal outNum = record.getOutNum();
|
||||
sltAgreementInfo.setNum(num.add(outNum));
|
||||
res = sltAgreementInfoMapper.updSltInfo(sltAgreementInfo);
|
||||
if (!record.getLeaseUnitIsTeam()) {
|
||||
record.setAgreementId(sltAgreementInfo.getAgreementId());
|
||||
}
|
||||
} else {
|
||||
String agreementId = " ";
|
||||
agreementId = tmTaskAgreementMapper.getAgreementId(taskId);
|
||||
String agreementId = tmTaskAgreementMapper.getAgreementId(taskId);
|
||||
// 根据发布批次,查询协议ID🆔
|
||||
if (StringUtils.isNotBlank(record.getPublishTask())) {
|
||||
agreementId = tmTaskAgreementMapper.selectAgreementId(record.getPublishTask());
|
||||
}
|
||||
if (record.getLeaseUnitIsTeam()) {
|
||||
agreementId = String.valueOf(record.getProjectUnitAgreementId());
|
||||
}
|
||||
// 查询单位类型:内部单位/外部单位
|
||||
String protocol = bmAgreementInfoMapper.getProtocol(agreementId);
|
||||
Type maType = typeMapper.getMaType(record.getTypeId());
|
||||
if (StringUtils.isEmpty(protocol)) {
|
||||
|
|
@ -787,8 +823,10 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService {
|
|||
}
|
||||
}
|
||||
res = sltAgreementInfoMapper.insSltInfo(record, agreementId, maType);
|
||||
if (!record.getLeaseUnitIsTeam()) {
|
||||
record.setAgreementId(Long.valueOf(agreementId));
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -587,7 +587,7 @@ public class LeaseTaskServiceImpl implements ILeaseTaskService {
|
|||
if (0==sysWorkflowNode.getNodeSignType()){
|
||||
//当前节点已经审核需要修改节点值
|
||||
if (SysWorkflowRecordHistoryList.get(0) != null) {
|
||||
// todo 固定的人员id 修改成 判断人员/角色 如果是人员的话要进行二次查询
|
||||
// 固定的人员id 修改成 判断人员/角色 如果是人员的话要进行二次查询
|
||||
// String configValueNew = sysWorkflowConfigMapper.selectConfigValueByNodeId(SysWorkflowRecordHistoryList.get(0).getNextNodeId());
|
||||
// leaseApplyInfoNew.setNodeId(SysWorkflowRecordHistoryList.get(0).getNextNodeId());
|
||||
// leaseApplyInfoNew.setConfigValue(configValueNew);
|
||||
|
|
|
|||
|
|
@ -330,7 +330,6 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService {
|
|||
}
|
||||
for (SltAgreementInfo lose : loseList) {
|
||||
if (lose.getAgreementId().equals(sltInfo.getAgreementId().toString())) {
|
||||
//TODO 上面已经set过值,这里为什么还要set值
|
||||
relation.setAgreementId(String.valueOf(lose.getAgreementId()));
|
||||
relation.setProjectName(lose.getProjectName());
|
||||
relation.setUnitName(lose.getUnitName());
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<result property="agreementCode" column="agreement_code" />
|
||||
<result property="signTime" column="sign_time" />
|
||||
<result property="unitId" column="unit_id" />
|
||||
<result property="projectUnitId" column="project_unit_id" />
|
||||
<result property="unitName" column="unit_name" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="leaseDay" column="lease_day" />
|
||||
|
|
@ -28,7 +29,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<select id="selectBmAgreementInfoList" parameterType="com.bonus.material.basic.domain.BmAgreementInfo" resultMap="BmAgreementInfoResult">
|
||||
SELECT bai.agreement_id, bai.agreement_code , contract_code,sign_time,
|
||||
bu.unit_id,bu.unit_name , bp.pro_id as projectId , bp.pro_name as projectName,
|
||||
bu.unit_id, bai.project_unit_id, bu.unit_name , bp.pro_id as projectId , bp.pro_name as projectName,
|
||||
plan_start_time,lease_day,auth_person,phone,bai.remark,bai.protocol,bai.branch_project as branchProIdsStr
|
||||
FROM bm_agreement_info bai
|
||||
LEFT JOIN bm_project bp ON bp.pro_id = bai.project_id
|
||||
|
|
@ -63,7 +64,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<select id="selectBmAgreementInfoByAgreementId" parameterType="Long" resultMap="BmAgreementInfoResult">
|
||||
SELECT bai.agreement_id, bai.agreement_code , contract_code,sign_time,
|
||||
bu.unit_id,bu.unit_name , bp.pro_id as projectId , bp.pro_name as projectName,
|
||||
bu.unit_id, bai.project_unit_id, bu.unit_name , bp.pro_id as projectId , bp.pro_name as projectName,
|
||||
plan_start_time,lease_day,auth_person,phone,bai.remark,bai.protocol,tta.task_id,bai.branch_project as branchProIdsStr
|
||||
FROM bm_agreement_info bai
|
||||
LEFT JOIN bm_project bp ON bp.pro_id = bai.project_id
|
||||
|
|
@ -74,14 +75,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</select>
|
||||
|
||||
<insert id="insertBmAgreementInfo" parameterType="com.bonus.material.basic.domain.BmAgreementInfo" useGeneratedKeys="true" keyProperty="agreementId">
|
||||
insert into bm_agreement_info (agreement_code, sign_time, unit_id,
|
||||
insert into bm_agreement_info (agreement_code, sign_time, unit_id, project_unit_id,
|
||||
project_id, create_by, lease_day,
|
||||
plan_start_time, contract_code, auth_person,
|
||||
phone, create_time, update_by,
|
||||
update_time, remark, company_id, protocol,
|
||||
branch_project
|
||||
)
|
||||
values (#{agreementCode,jdbcType=VARCHAR}, #{signTime,jdbcType=VARCHAR}, #{unitId,jdbcType=INTEGER},
|
||||
values (#{agreementCode,jdbcType=VARCHAR}, #{signTime,jdbcType=VARCHAR}, #{unitId,jdbcType=INTEGER}, #{projectUnitId,jdbcType=INTEGER},
|
||||
#{projectId,jdbcType=INTEGER}, #{createBy,jdbcType=VARCHAR}, #{leaseDay,jdbcType=INTEGER},
|
||||
#{planStartTime,jdbcType=TIMESTAMP}, #{contractCode,jdbcType=VARCHAR}, #{authPerson,jdbcType=VARCHAR},
|
||||
#{phone,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=VARCHAR},
|
||||
|
|
@ -113,6 +114,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="agreementCode != null">agreement_code = #{agreementCode},</if>
|
||||
<if test="signTime != null">sign_time = #{signTime},</if>
|
||||
<if test="unitId != null">unit_id = #{unitId},</if>
|
||||
<if test="projectUnitId != null">project_unit_id = #{projectUnitId},</if>
|
||||
<if test="projectId != null">project_id = #{projectId},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="leaseDay != null">lease_day = #{leaseDay},</if>
|
||||
|
|
|
|||
|
|
@ -663,11 +663,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
mt.unit_value as unitValue,
|
||||
mt.manage_type as manageType,
|
||||
SUM(sai.num) AS num,
|
||||
mt.LEVEL as level
|
||||
mt.LEVEL as level,
|
||||
clai.lease_style as leaseStyle
|
||||
FROM
|
||||
ma_type mt
|
||||
LEFT JOIN clz_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'
|
||||
LEFT JOIN clz_lease_apply_info clai ON sai.lease_id = clai.id
|
||||
WHERE
|
||||
sai.STATUS = '0' and sai.agreement_id = #{agreementId}
|
||||
GROUP BY
|
||||
|
|
|
|||
|
|
@ -222,7 +222,34 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
sai.STATUS = '0' and sai.agreement_id = #{agreementId}
|
||||
GROUP BY
|
||||
mt.type_id
|
||||
HAVING num> 0
|
||||
HAVING
|
||||
num > 0
|
||||
|
||||
<if test="clzAgreementId != null and clzAgreementId != 0">
|
||||
union all
|
||||
|
||||
SELECT
|
||||
mt.type_id as typeId,
|
||||
mt1.type_name as materialName,
|
||||
mt.type_name as typeName,
|
||||
mt.parent_id as parentId,
|
||||
mt.unit_name as unitName,
|
||||
mt.unit_value as unitValue,
|
||||
mt.manage_type as manageType,
|
||||
SUM( IF(sai.agreement_id = #{clzAgreementId} AND sai.STATUS = '0', sai.num, 0) ) AS num,
|
||||
mt.LEVEL as level
|
||||
FROM
|
||||
ma_type mt
|
||||
LEFT JOIN clz_slt_agreement_info sai ON mt.type_id = sai.type_id
|
||||
LEFT JOIN clz_lease_apply_info clai ON sai.lease_id = clai.id
|
||||
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id and mt1.del_flag = '0'
|
||||
WHERE
|
||||
sai.STATUS = '0' and clai.lease_style != 2
|
||||
GROUP BY
|
||||
mt.type_id
|
||||
HAVING
|
||||
num> 0
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getUseTypeTreeL3" resultType="com.bonus.common.biz.domain.TypeTreeNode">
|
||||
|
|
@ -753,6 +780,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
team_id as unitId
|
||||
FROM pro_authorize_info
|
||||
WHERE lease_id = #{leaseId}
|
||||
limit 1
|
||||
</select>
|
||||
<select id="getBackDeviceTypeTree" resultType="com.bonus.common.biz.domain.TreeNode">
|
||||
SELECT mt.type_id AS id,
|
||||
|
|
|
|||
|
|
@ -824,4 +824,39 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
sys_user
|
||||
where user_name = #{cno}
|
||||
</select>
|
||||
|
||||
<select id="selectLeaseApplyInfoIsTeam" resultType="java.lang.Long">
|
||||
select
|
||||
bu.type_id as typeId
|
||||
from
|
||||
lease_apply_info lai
|
||||
left join bm_unit bu on lai.unit_id = bu.unit_id
|
||||
where
|
||||
lai.id = #{leaseId}
|
||||
</select>
|
||||
|
||||
<select id="selectLeaseApplyInfoUnitIdByLeaseId" resultType="java.lang.Long">
|
||||
select
|
||||
lai.unit_id as unitId
|
||||
from
|
||||
lease_apply_info lai
|
||||
where
|
||||
lai.id = #{leaseId}
|
||||
</select>
|
||||
|
||||
<select id="selectUnitTypeByUnitId" resultType="java.lang.Long">
|
||||
select type_id as typeId
|
||||
from bm_unit
|
||||
where unit_id = #{unitId}
|
||||
</select>
|
||||
|
||||
<select id="selectProjectUnitAgreementIdByTeamAndProject" resultType="java.lang.Long">
|
||||
SELECT
|
||||
baii.agreement_id AS projectUnitAgreementId
|
||||
FROM
|
||||
bm_agreement_info bai
|
||||
LEFT JOIN bm_agreement_info baii ON baii.unit_id = bai.project_unit_id AND baii.project_id = #{projectId}
|
||||
WHERE
|
||||
bai.unit_id = #{teamId} AND bai.project_id = #{projectId}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -177,6 +177,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="publishTask != null and publishTask != ''">
|
||||
AND publish_task = #{publishTask}
|
||||
</if>
|
||||
<if test="leaseUnitIsTeam">
|
||||
AND agreement_id = #{projectUnitAgreementId}
|
||||
</if>
|
||||
<if test="!leaseUnitIsTeam">
|
||||
AND agreement_id = #{agreementId}
|
||||
</if>
|
||||
AND
|
||||
DATE(start_time) = CURDATE();
|
||||
</select>
|
||||
|
|
|
|||
Loading…
Reference in New Issue