This commit is contained in:
parent
a3637a710b
commit
d5bec70961
|
|
@ -3,6 +3,7 @@ package com.bonus.common.biz.domain.lease;
|
|||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import com.bonus.common.biz.domain.BmFileInfo;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
|
@ -369,4 +370,16 @@ public class LeaseApplyInfo extends BaseEntity{
|
|||
|
||||
@ApiModelProperty(value = "项目部名称")
|
||||
private String departName;
|
||||
|
||||
@ApiModelProperty(value = "绳索类出库量")
|
||||
private BigDecimal ropeNum;
|
||||
|
||||
@ApiModelProperty(value = "计件类出库量")
|
||||
private BigDecimal inCountNum;
|
||||
|
||||
@ApiModelProperty(value = "附件配件类出库量")
|
||||
private BigDecimal fileTypeNum;
|
||||
|
||||
@ApiModelProperty(value = "附件配件类四级类型id集合")
|
||||
private Set<String> typeIdSet;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -276,4 +276,14 @@ public class LeasePublishInfo extends BaseEntity{
|
|||
|
||||
@ApiModelProperty(value = "一级类型id")
|
||||
private String firstId;
|
||||
|
||||
@ApiModelProperty(value = "是否授权 0 已授权,1 空")
|
||||
@Excel(name = "是否授权", readConverterExp = "0=已授权,1=空")
|
||||
private Integer isAuth;
|
||||
|
||||
@ApiModelProperty(value = "授权书名称")
|
||||
private String fileName;
|
||||
|
||||
@ApiModelProperty(value = "授权书路径")
|
||||
private String fileUrl;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import com.bonus.common.core.annotation.Excel;
|
|||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.apache.poi.ss.usermodel.HorizontalAlignment;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
|
@ -38,15 +39,15 @@ public class LeaseOutInfo {
|
|||
private String unitName;
|
||||
|
||||
@ApiModelProperty(value = "领料数量")
|
||||
@Excel(name = "领料数量")
|
||||
@Excel(name = "领料数量", cellType = Excel.ColumnType.NUMERIC, align = HorizontalAlignment.RIGHT)
|
||||
private BigDecimal leaseNum;
|
||||
|
||||
@ApiModelProperty(value = "出库数量")
|
||||
@Excel(name = "出库数量")
|
||||
@Excel(name = "出库数量", cellType = Excel.ColumnType.NUMERIC, align = HorizontalAlignment.RIGHT)
|
||||
private BigDecimal outNum;
|
||||
|
||||
@ApiModelProperty(value = "待出库数量")
|
||||
@Excel(name = "待出库数量")
|
||||
@Excel(name = "待出库数量", cellType = Excel.ColumnType.NUMERIC, align = HorizontalAlignment.RIGHT)
|
||||
private BigDecimal pendingOutNum;
|
||||
|
||||
@ApiModelProperty(value = "领料日期")
|
||||
|
|
@ -64,7 +65,7 @@ public class LeaseOutInfo {
|
|||
private String leaseUnitName;
|
||||
|
||||
@ApiModelProperty(value = "领料工程")
|
||||
@Excel(name = "领料工程")
|
||||
@Excel(name = "领料工程", width = 40)
|
||||
private String leaseProjectName;
|
||||
|
||||
@ApiModelProperty(value = "领料人")
|
||||
|
|
|
|||
|
|
@ -1122,6 +1122,12 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
|
|||
if (!CollectionUtils.isEmpty(projectIdList)) {
|
||||
bean.setProjectIdList(projectIdList);
|
||||
}
|
||||
} else {
|
||||
// 根据用户名查询是否为技术员或项目总工,进行项目部条件过滤
|
||||
List<String> departList = mapper.getDepartList(username);
|
||||
if (!CollectionUtils.isEmpty(departList)) {
|
||||
bean.setDepartIdList(departList);
|
||||
}
|
||||
}
|
||||
// 部门查询赋值
|
||||
extractedDept(bean);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.bonus.material.lease.mapper;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import com.bonus.common.biz.domain.lease.LeaseApplyInfo;
|
||||
import com.bonus.common.biz.domain.lease.LeaseConfirmSign;
|
||||
|
|
@ -173,6 +174,8 @@ public interface LeaseApplyInfoMapper {
|
|||
/**
|
||||
* 查询领用单的领用单出库签名
|
||||
* @param id
|
||||
* @param leaseSignId
|
||||
* @param publishTask
|
||||
* @return
|
||||
*/
|
||||
List<LeaseOutSign> selectOutList(@Param("id") Long id, @Param("leaseSignId") String leaseSignId, @Param("publishTask") String publishTask);
|
||||
|
|
@ -252,4 +255,61 @@ public interface LeaseApplyInfoMapper {
|
|||
* @return
|
||||
*/
|
||||
int updateLeasePublish(LeaseApplyDetails leaseApplyDetails);
|
||||
|
||||
/**
|
||||
* 10.29号修改为查询已签名领用发布数据,供于出库
|
||||
* @param leaseApplyInfo
|
||||
* @return
|
||||
*/
|
||||
List<LeaseApplyInfo> getSignPublishList(LeaseApplyInfo leaseApplyInfo);
|
||||
|
||||
/**
|
||||
* 领用签名
|
||||
* @param id
|
||||
* @param publishTask
|
||||
* @return
|
||||
*/
|
||||
List<LeaseOutSign> getPublishSign(@Param("id") Long id, @Param("publishTask") String publishTask);
|
||||
|
||||
/**
|
||||
* 领料签名
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
List<LeaseOutSign> getLeaseSign(Long id);
|
||||
|
||||
/**
|
||||
* 根据i8工程id查询项目部
|
||||
* @param externalId
|
||||
* @return
|
||||
*/
|
||||
String getDeptName(String externalId);
|
||||
|
||||
/**
|
||||
* 查询附件配件类四级id
|
||||
* @param leaseApplyInfo
|
||||
* @return
|
||||
*/
|
||||
String getTypeIds(LeaseApplyInfo leaseApplyInfo);
|
||||
|
||||
/**
|
||||
* 查询附件配件类出库数量
|
||||
* @param leaseApplyInfo
|
||||
* @return
|
||||
*/
|
||||
BigDecimal getTypeNum(LeaseApplyInfo leaseApplyInfo);
|
||||
|
||||
/**
|
||||
* 查询绳索类出库量出库数量
|
||||
* @param leaseApplyInfo
|
||||
* @return
|
||||
*/
|
||||
BigDecimal getRopeNum(LeaseApplyInfo leaseApplyInfo);
|
||||
|
||||
/**
|
||||
* 查询计件类类出库数量
|
||||
* @param leaseApplyInfo
|
||||
* @return
|
||||
*/
|
||||
BigDecimal getInCountNum(LeaseApplyInfo leaseApplyInfo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -105,9 +105,16 @@ public interface LeaseOutDetailsMapper {
|
|||
int updateMachine(LeaseOutDetails record);
|
||||
|
||||
/**
|
||||
* 修改领料出库详细
|
||||
* 领用电子签名
|
||||
* @param leaseApplyInfo
|
||||
* @return
|
||||
*/
|
||||
int updateLeaseOutSign(LeaseApplyInfo leaseApplyInfo);
|
||||
|
||||
/**
|
||||
* 领料电子签名
|
||||
* @param leaseApplyInfo
|
||||
* @return
|
||||
*/
|
||||
int updateLeaseSignInfo(LeaseApplyInfo leaseApplyInfo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -349,4 +349,11 @@ public interface LeaseTaskMapper {
|
|||
* @return
|
||||
*/
|
||||
LeaseApplyInfo getIdByBusinessCode(LeaseApplyInfo leaseApplyInfo);
|
||||
|
||||
/**
|
||||
* 根据id去授权表中查询是否已经授权
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
LeasePublishInfo getIsAuth(Long id);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,17 +9,14 @@ import java.util.stream.Collectors;
|
|||
|
||||
import com.bonus.common.biz.constant.GlobalConstants;
|
||||
import com.bonus.common.biz.enums.*;
|
||||
import com.bonus.material.clz.domain.vo.MaterialRetainedEquipmentInfo;
|
||||
import com.bonus.material.basic.domain.BmAgreementInfo;
|
||||
import com.bonus.material.basic.mapper.BmAgreementInfoMapper;
|
||||
import com.bonus.material.common.mapper.SelectMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.ah.sbd.SmsTool;
|
||||
import com.ah.sbd.utils.param.BatchSmsByContentParam;
|
||||
import com.bonus.common.biz.config.DateTimeHelper;
|
||||
import com.bonus.common.biz.config.PoiOutPage;
|
||||
import com.bonus.common.biz.constant.BmConfigItems;
|
||||
import com.bonus.common.biz.constant.MaterialConstants;
|
||||
import com.bonus.common.biz.domain.BmFileInfo;
|
||||
import com.bonus.common.biz.domain.lease.*;
|
||||
|
|
@ -91,6 +88,9 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
|
|||
@Resource
|
||||
private SelectMapper selectMapper;
|
||||
|
||||
@Resource
|
||||
private BmAgreementInfoMapper bmAgreementInfoMapper;
|
||||
|
||||
/**
|
||||
* 查询领料任务
|
||||
*
|
||||
|
|
@ -313,6 +313,15 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
|
|||
// 步骤12: 查询领料人电子签名详情
|
||||
long step12Start = System.currentTimeMillis();
|
||||
List<LeaseOutSign> signList = leaseApplyInfoMapper.selectOutList(id, null, publishTask);
|
||||
if (CollectionUtils.isEmpty(signList)) {
|
||||
if (StringUtils.isNotBlank(publishTask)) {
|
||||
// 领用签名
|
||||
signList = leaseApplyInfoMapper.getPublishSign(id, publishTask);
|
||||
} else {
|
||||
// 领料签名
|
||||
signList = leaseApplyInfoMapper.getLeaseSign(id);
|
||||
}
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(signList)) {
|
||||
for (LeaseOutSign applyInfo : signList) {
|
||||
if (StringUtils.isNotBlank(applyInfo.getOutSignUrl())) {
|
||||
|
|
@ -564,6 +573,15 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
|
|||
// 步骤12: 查询领料人电子签名详情
|
||||
long step12Start = System.currentTimeMillis();
|
||||
List<LeaseOutSign> signList = leaseApplyInfoMapper.selectOutList(id, null, publishTask);
|
||||
if (CollectionUtils.isEmpty(signList)) {
|
||||
if (StringUtils.isNotBlank(publishTask)) {
|
||||
// 领用签名
|
||||
signList = leaseApplyInfoMapper.getPublishSign(id, publishTask);
|
||||
} else {
|
||||
// 领料签名
|
||||
signList = leaseApplyInfoMapper.getLeaseSign(id);
|
||||
}
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(signList)) {
|
||||
for (LeaseOutSign applyInfo : signList) {
|
||||
if (StringUtils.isNotBlank(applyInfo.getOutSignUrl())) {
|
||||
|
|
@ -764,6 +782,15 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
|
|||
Set<?> statusSet = CollectionUtils.isEmpty(statusList) ?
|
||||
Collections.emptySet() :
|
||||
new HashSet<>(statusList);
|
||||
if (!CollectionUtils.isEmpty(statusSet)) {
|
||||
if ((leaseApplyInfo.getStatusList().contains(3) && !leaseApplyInfo.getStatusList().contains(1))
|
||||
|| leaseApplyInfo.getStatusList().containsAll(Arrays.asList(3, 4, 5))) {
|
||||
// 过滤sortedList中leaseSignUrl或者leaseSignId不为空的数据
|
||||
sortedList = sortedList.stream()
|
||||
.filter(item -> StringUtils.isNotBlank(item.getSignUrl()) || item.getSignId() != null)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
||||
sortedList = sortedList.stream()
|
||||
// 关键词
|
||||
|
|
@ -807,12 +834,24 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
|
|||
* @param list
|
||||
*/
|
||||
private void extracted(LeaseApplyInfo leaseApplyInfo, List<LeaseApplyInfo> list) {
|
||||
// 查询领用出库数据
|
||||
//todo 查询领用出库数据, 10.29号修改为查询已签名领用发布数据,供于出库
|
||||
List<LeaseApplyInfo> leaseApplyOutList = leaseApplyInfoMapper.selectPublishList(leaseApplyInfo);
|
||||
if (!CollectionUtils.isEmpty(leaseApplyOutList)) {
|
||||
list.addAll(leaseApplyOutList);
|
||||
}
|
||||
for (LeaseApplyInfo applyInfo : list) {
|
||||
// 判断协议号是否为空
|
||||
if (StringUtils.isBlank(applyInfo.getAgreementCode())) {
|
||||
if (applyInfo.getLeaseUnit() != null && applyInfo.getLeaseProjectId() != null) {
|
||||
BmAgreementInfo bmAgreementInfo = new BmAgreementInfo();
|
||||
bmAgreementInfo.setUnitId(Long.valueOf(applyInfo.getLeaseUnitId()));
|
||||
bmAgreementInfo.setProjectId(Long.valueOf(applyInfo.getLeaseProjectId()));
|
||||
BmAgreementInfo info = bmAgreementInfoMapper.queryByTeamIdAndProjectId(bmAgreementInfo);
|
||||
if (info != null) {
|
||||
applyInfo.setAgreementCode(info.getAgreementCode());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (applyInfo.getTaskStatus() != null && (applyInfo.getTaskStatus() == 1 || applyInfo.getTaskStatus() == 4)) {
|
||||
continue;
|
||||
}
|
||||
|
|
@ -1031,7 +1070,21 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
|
|||
*/
|
||||
@Override
|
||||
public LeaseApplyInfo getOutNum(LeaseApplyInfo leaseApplyInfo) {
|
||||
return leaseApplyInfoMapper.getOutNum(leaseApplyInfo);
|
||||
LeaseApplyInfo info = leaseApplyInfoMapper.getOutNum(leaseApplyInfo);
|
||||
// 查询附件配件类四级id
|
||||
String typeIds = leaseApplyInfoMapper.getTypeIds(leaseApplyInfo);
|
||||
// 查询附件配件类出库数量
|
||||
Set<String> typeIdSet = new HashSet<>(Arrays.asList(typeIds.split(",")));
|
||||
leaseApplyInfo.setTypeIdSet(typeIdSet);
|
||||
BigDecimal fileTypeNum = leaseApplyInfoMapper.getTypeNum(leaseApplyInfo);
|
||||
info.setFileTypeNum(fileTypeNum);
|
||||
// 查询绳索类出库量出库数量,剔除附件配件类
|
||||
BigDecimal ropeNum = leaseApplyInfoMapper.getRopeNum(leaseApplyInfo);
|
||||
info.setRopeNum(ropeNum);
|
||||
// 查询计件类类出库数量,剔除附件配件类
|
||||
BigDecimal inCountNum = leaseApplyInfoMapper.getInCountNum(leaseApplyInfo);
|
||||
info.setInCountNum(inCountNum);
|
||||
return info;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -1706,45 +1759,25 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
|
|||
@Override
|
||||
public int updateLeaseApplyInfoSign(LeaseApplyInfo leaseApplyInfo) {
|
||||
int result = 0;
|
||||
Long userid = SecurityUtils.getLoginUser().getUserid();
|
||||
String nickName = SecurityUtils.getLoginUser().getSysUser().getNickName();
|
||||
leaseApplyInfo.setSignPerson(nickName);
|
||||
leaseApplyInfo.setCreateBy(userid.toString());
|
||||
leaseApplyInfo.setCreateTime(DateUtils.getNowDate());
|
||||
// 新增领料签字表lease_sign_info
|
||||
result = leaseApplyInfoMapper.insertLeaseSign(leaseApplyInfo);
|
||||
if (result == 0) {
|
||||
throw new RuntimeException("添加签名信息失败");
|
||||
}
|
||||
// 往lease_out_details表增加新增签字id字段
|
||||
// 根据领料或者领用,往相对应表新增签名信息
|
||||
if (StringUtils.isNotBlank(leaseApplyInfo.getIds())) {
|
||||
String[] ids = leaseApplyInfo.getIds().split(",");
|
||||
for (String id : ids) {
|
||||
leaseApplyInfo.setId(Long.parseLong(id));
|
||||
leaseApplyInfo.setCreateTime(DateUtils.getNowDate());
|
||||
if (StringUtils.isNotBlank(leaseApplyInfo.getPublishTask())) {
|
||||
result = leaseOutDetailsMapper.updateLeaseOutSign(leaseApplyInfo);
|
||||
if (result == 0) {
|
||||
throw new RuntimeException("修改领料签字信息失败");
|
||||
}
|
||||
} else {
|
||||
result = leaseOutDetailsMapper.updateLeaseSignInfo(leaseApplyInfo);
|
||||
if (result == 0) {
|
||||
throw new RuntimeException("修改领料签字信息失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<LeaseApplyInfo> userList = leaseApplyInfoMapper.getUserList(leaseApplyInfo);
|
||||
// 省公司短信发送
|
||||
List<String> mobileList = new ArrayList<>();
|
||||
if(userList !=null && !userList.isEmpty()) {
|
||||
for (LeaseApplyInfo item : userList){
|
||||
LeaseApplyInfo item1 = leaseApplyInfoMapper.getUserPhoneById(item);
|
||||
mobileList.add(item1.getPhone());
|
||||
}
|
||||
}
|
||||
if (!mobileList.isEmpty()){
|
||||
JSONObject sendResult = SmsTool.sendSms(new BatchSmsByContentParam(mobileList, "您有一条待确认的领料信息,请尽快登录机具系统进行确认!"), BmConfigItems.ANHUI_COMPANY_SMS_KEY);
|
||||
if (sendResult != null) {
|
||||
// 短信发送成功
|
||||
result =1;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -219,10 +219,13 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService {
|
|||
String taskId = leaseApplyInfoMapper.getTaskId(record.getParentId());
|
||||
record.setTaskId(taskId);
|
||||
|
||||
if (Boolean.FALSE.equals(record.getLeaseUnitIsTeam())) {
|
||||
record.setSource(DIRECT_RESOURCE);
|
||||
}
|
||||
// 判断如果是班组领料,则插入原本项目部的协议结算记录
|
||||
if (record.getLeaseUnitIsTeam() != null && record.getLeaseUnitIsTeam()) {
|
||||
// 设置数据来源是2(班组同步)
|
||||
record.setSource(SYNC_RESOURCE);
|
||||
if (Boolean.TRUE.equals(record.getLeaseUnitIsTeam())) {
|
||||
// 设置数据来源是1(项目部数据)
|
||||
record.setSource(DIRECT_RESOURCE);
|
||||
// 暂存现在出库的班组单位ID
|
||||
Integer thisOutId = record.getLeaseUnitId();
|
||||
// 查询班组挂靠的项目部协议ID
|
||||
|
|
@ -240,15 +243,14 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService {
|
|||
// 插入项目部领料的结算记录
|
||||
int inserts = insSltInfo(taskId, record);
|
||||
System.out.println("插入原本项目部领料结算记录" + (inserts > GlobalConstants.INT_0 ? "成功" : "失败"));
|
||||
|
||||
// 班组直领数据赋值2
|
||||
record.setSource(SYNC_RESOURCE);
|
||||
// 恢复出库班组单位ID
|
||||
record.setLeaseUnitId(thisOutId);
|
||||
record.setLeaseUnitIsTeam(false);
|
||||
// 设置可退还数量是0,因为默认全部发给班组了,不允许项目部协议直接退,要等班组退还到项目部后才能恢复
|
||||
record.setReturnNum(BigDecimal.ZERO);
|
||||
}
|
||||
// 设置数据来源是1(直领)
|
||||
record.setSource(DIRECT_RESOURCE);
|
||||
res = insSltInfo(taskId, record);
|
||||
if (res == GlobalConstants.INT_0) {
|
||||
throw new RuntimeException("出库失败,插入结算记录失败");
|
||||
|
|
|
|||
|
|
@ -497,6 +497,11 @@ public class LeaseTaskServiceImpl implements ILeaseTaskService {
|
|||
String sendUnit = leaseApplyInfoMapper.getSendUnit(info);
|
||||
info.setSendUnit(sendUnit);
|
||||
}
|
||||
// 根据i8工程id查询项目部
|
||||
if (StringUtils.isNotBlank(info.getExternalId())) {
|
||||
String deptName = leaseApplyInfoMapper.getDeptName(info.getExternalId());
|
||||
info.setDepartName(deptName);
|
||||
}
|
||||
/** 设置发料单位 防止代码冲突 **/
|
||||
|
||||
leaseApplyRequestVo.setLeaseApplyInfo(info);
|
||||
|
|
@ -973,6 +978,17 @@ public class LeaseTaskServiceImpl implements ILeaseTaskService {
|
|||
})
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
list.forEach(item -> {
|
||||
// 根据id去授权表中查询是否已经授权
|
||||
LeasePublishInfo info = mapper.getIsAuth(item.getId());
|
||||
if (info != null) {
|
||||
item.setIsAuth(0);
|
||||
item.setFileName(info.getFileName());
|
||||
item.setFileUrl(info.getFileUrl());
|
||||
} else {
|
||||
item.setIsAuth(1);
|
||||
}
|
||||
});
|
||||
String keyWord = leaseApplyInfo.getKeyWord();
|
||||
// 如果关键字不为空,进行过滤
|
||||
if (!StringUtils.isBlank(keyWord)) {
|
||||
|
|
|
|||
|
|
@ -62,12 +62,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
COALESCE(lai.release_time, lai.create_time) as releaseTime,
|
||||
GROUP_CONCAT(DISTINCT mt3.type_id) as firstId,
|
||||
su.sign_type as lease_sign_type,
|
||||
su.sign_url as lease_sign_url
|
||||
su.sign_url as lease_sign_url,
|
||||
lod.lease_sign_id as signId,
|
||||
lad.lease_sign_url as signUrl
|
||||
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 (SELECT parent_id,type_id ,IFNULL( sum( out_num ), 0 ) as num FROM lease_out_details
|
||||
LEFT JOIN (SELECT parent_id,type_id ,IFNULL( sum( out_num ), 0 )as num, lease_sign_id FROM lease_out_details
|
||||
GROUP BY parent_id,type_id) lod ON lai.id = lod.parent_id and lad.type_id = lod.type_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
|
||||
|
|
@ -348,12 +350,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
lai.confirm_remark AS confirmRemark,
|
||||
mt3.type_id AS firstId,
|
||||
lpd.create_time AS releaseTime,
|
||||
lpd.parent_id AS parentId
|
||||
lpd.parent_id AS parentId,
|
||||
lpd.lease_sign_url AS signUrl,
|
||||
lod.lease_sign_id AS signId
|
||||
FROM
|
||||
lease_publish_details lpd
|
||||
LEFT JOIN lease_apply_info lai ON lai.id = lpd.parent_id
|
||||
LEFT JOIN tm_task tt ON lai.task_id = tt.task_id
|
||||
LEFT JOIN (SELECT IFNULL( sum(out_num ), 0) AS num, parent_id, publish_task from lease_out_details a
|
||||
LEFT JOIN (SELECT IFNULL( sum(out_num ), 0) AS num, parent_id, publish_task, lease_sign_id from lease_out_details a
|
||||
<if test="userId != null">
|
||||
JOIN ma_type_keeper mtk ON mtk.type_id = a.type_id AND mtk.user_id = #{userId}
|
||||
</if>
|
||||
|
|
@ -557,7 +561,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<select id="selectNoSignList" resultType="com.bonus.common.biz.domain.lease.LeaseApplyInfo">
|
||||
SELECT
|
||||
GROUP_CONCAT( DISTINCT lod.id ) AS ids,
|
||||
GROUP_CONCAT( DISTINCT lad.id ) AS ids,
|
||||
lai.id AS id,
|
||||
lai.CODE AS CODE,
|
||||
lai.create_by AS createBy,
|
||||
|
|
@ -569,7 +573,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
bu.unit_name AS leaseUnit,
|
||||
bp.pro_name AS leaseProject,
|
||||
bai.agreement_code AS agreementCode,
|
||||
IFNULL( sum( lod.out_num ), 0 ) AS alNum,
|
||||
IFNULL( sum( lad.pre_num ), 0 ) AS alNum,
|
||||
GROUP_CONCAT( DISTINCT mt1.type_name ) AS maTypeNames,
|
||||
lai.task_id AS taskId,
|
||||
tt.task_type AS taskType,
|
||||
|
|
@ -578,29 +582,32 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
mt4.type_id AS firstId,
|
||||
COALESCE(lai.release_time, lai.create_time) as releaseTime
|
||||
FROM
|
||||
lease_out_details lod
|
||||
LEFT JOIN lease_apply_info lai ON lai.id = lod.parent_id
|
||||
lease_apply_details lad
|
||||
LEFT JOIN lease_apply_info lai ON lai.id = lad.parent_id
|
||||
LEFT JOIN (SELECT parent_id, lease_sign_id FROM lease_out_details GROUP BY
|
||||
parent_id) lod ON lad.parent_id = lod.parent_id
|
||||
LEFT JOIN tm_task tt ON lai.task_id = tt.task_id
|
||||
LEFT JOIN tm_task_agreement tta ON tt.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 ma_type mt ON lod.type_id = mt.type_id
|
||||
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'
|
||||
LEFT JOIN ma_type mt3 ON mt1.parent_id = mt3.type_id and mt3.del_flag = '0'
|
||||
LEFT JOIN ma_type mt4 ON mt3.parent_id = mt4.type_id and mt4.del_flag = '0'
|
||||
WHERE
|
||||
lod.lease_sign_id is null and lai.direct_id is null
|
||||
and tt.task_type = '2'
|
||||
lad.lease_sign_url is null and lai.direct_id is null
|
||||
and tt.task_type = '2' and lod.lease_sign_id is null
|
||||
and tt.task_status in (3, 4)
|
||||
<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
|
||||
lod.parent_id
|
||||
lad.parent_id
|
||||
ORDER BY
|
||||
lod.create_time DESC
|
||||
lai.release_time DESC
|
||||
</select>
|
||||
|
||||
<select id="selectTypeIdList" resultType="java.lang.Long">
|
||||
|
|
@ -667,55 +674,55 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<select id="selectLeaseOutList" resultType="com.bonus.common.biz.domain.lease.LeaseApplyInfo">
|
||||
SELECT
|
||||
GROUP_CONCAT( DISTINCT lod.id ) AS ids,
|
||||
GROUP_CONCAT( DISTINCT lpd.id ) AS ids,
|
||||
lai.id AS id,
|
||||
a.`code` AS CODE,
|
||||
lpd.`code` AS CODE,
|
||||
lai.create_by AS createBy,
|
||||
lai.create_time AS createTime,
|
||||
a.lease_person AS leasePerson,
|
||||
lpd.lease_person AS leasePerson,
|
||||
lai.phone AS phone,
|
||||
a.unit_id AS leaseUnitId,
|
||||
a.project_id AS leaseProjectId,
|
||||
lpd.unit_id AS leaseUnitId,
|
||||
lpd.project_id AS leaseProjectId,
|
||||
bu.unit_name AS leaseUnit,
|
||||
bp.pro_name AS leaseProject,
|
||||
bai.agreement_code AS agreementCode,
|
||||
IFNULL( sum( lod.out_num ), 0 ) AS alNum,
|
||||
IFNULL( sum( lpd.num ), 0 ) AS alNum,
|
||||
GROUP_CONCAT( DISTINCT mt1.type_name ) AS maTypeNames,
|
||||
lai.task_id AS taskId,
|
||||
tt.task_type AS taskType,
|
||||
bp.external_id AS externalId,
|
||||
bu.bzz_idcard AS idCard,
|
||||
mt4.type_id AS firstId,
|
||||
a.create_time AS releaseTime,
|
||||
lod.publish_task AS publishTask
|
||||
lpd.create_time AS releaseTime,
|
||||
lpd.publish_task AS publishTask
|
||||
FROM
|
||||
lease_out_details lod
|
||||
LEFT JOIN lease_apply_info lai ON lai.id = lod.parent_id
|
||||
lease_publish_details lpd
|
||||
LEFT JOIN lease_apply_info lai ON lai.id = lpd.parent_id
|
||||
LEFT JOIN (SELECT parent_id, publish_task, lease_sign_id FROM lease_out_details GROUP BY
|
||||
parent_id,publish_task) lod ON lpd.parent_id = lod.parent_id
|
||||
and lod.publish_task = lpd.publish_task
|
||||
LEFT JOIN tm_task tt ON lai.task_id = tt.task_id
|
||||
LEFT JOIN (SELECT parent_id, unit_id,project_id,create_time,`code`,publish_task,lease_person from lease_publish_details
|
||||
GROUP BY parent_id,publish_task) a ON a.parent_id = lod.parent_id
|
||||
and a.publish_task = lod.publish_task
|
||||
LEFT JOIN bm_unit bu ON bu.unit_id = a.unit_id
|
||||
LEFT JOIN bm_project bp ON bp.pro_id = a.project_id
|
||||
LEFT JOIN bm_agreement_info bai ON a.unit_id = bai.unit_id
|
||||
AND a.project_id = bai.project_id
|
||||
LEFT JOIN ma_type mt ON lod.type_id = mt.type_id
|
||||
LEFT JOIN bm_unit bu ON bu.unit_id = lpd.unit_id
|
||||
LEFT JOIN bm_project bp ON bp.pro_id = lpd.project_id
|
||||
LEFT JOIN bm_agreement_info bai ON lpd.unit_id = bai.unit_id
|
||||
AND lpd.project_id = bai.project_id
|
||||
LEFT JOIN ma_type mt ON lpd.new_type = 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'
|
||||
LEFT JOIN ma_type mt3 ON mt1.parent_id = mt3.type_id and mt3.del_flag = '0'
|
||||
LEFT JOIN ma_type mt4 ON mt3.parent_id = mt4.type_id and mt4.del_flag = '0'
|
||||
WHERE
|
||||
lod.lease_sign_id is null and lai.direct_id is null
|
||||
and tt.task_type = '19'
|
||||
lpd.lease_sign_url is null and lai.direct_id is null
|
||||
and tt.task_type = '19' and lod.lease_sign_id is null
|
||||
<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
|
||||
lod.parent_id,
|
||||
lod.publish_task
|
||||
lpd.parent_id,
|
||||
lpd.publish_task
|
||||
ORDER BY
|
||||
lod.create_time DESC
|
||||
lpd.create_time DESC
|
||||
</select>
|
||||
|
||||
<select id="selectPublish" resultType="com.bonus.common.biz.domain.lease.LeaseApplyInfo">
|
||||
|
|
@ -916,12 +923,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<select id="getOutNum" resultType="com.bonus.common.biz.domain.lease.LeaseApplyInfo">
|
||||
SELECT
|
||||
IFNULL(SUM(out_num), 0) as alNum
|
||||
IFNULL(SUM(lod.out_num), 0) as alNum
|
||||
FROM
|
||||
lease_out_details
|
||||
where 1 = 1
|
||||
lease_out_details lod
|
||||
LEFT JOIN lease_apply_info lai on lod.parent_id = lai.id
|
||||
where lai.direct_id is null
|
||||
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
||||
and create_time BETWEEN CONCAT(#{startTime}, ' 00:00:00') AND CONCAT(#{endTime}, ' 23:59:59')
|
||||
and lod.create_time BETWEEN CONCAT(#{startTime}, ' 00:00:00') AND CONCAT(#{endTime}, ' 23:59:59')
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
|
@ -964,4 +972,185 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
parent_id = #{parentId}
|
||||
and new_type = #{newTypeId}
|
||||
</select>
|
||||
|
||||
<select id="getSignPublishList" resultType="com.bonus.common.biz.domain.lease.LeaseApplyInfo">
|
||||
SELECT
|
||||
lai.id AS id,
|
||||
lpd.code AS code,
|
||||
tt.code AS businessCode,
|
||||
lai.create_by AS createBy,
|
||||
lai.create_time AS createTime,
|
||||
sd.dept_name AS impUnitName,
|
||||
bp.contract_part AS contractPart,
|
||||
lpd.lease_person AS leasePerson,
|
||||
lpd.phone AS phone,
|
||||
lpd.unit_id AS leaseUnitId,
|
||||
lpd.project_id AS leaseProjectId,
|
||||
bu.unit_name AS leaseUnit,
|
||||
bp.pro_name AS leaseProject,
|
||||
bai.agreement_code AS agreementCode,
|
||||
IFNULL( sum( lpd.num ), 0 ) AS preCountNum,
|
||||
IFNULL(lod.num, 0) AS alNum,
|
||||
GROUP_CONCAT( DISTINCT mt1.type_name ) AS maTypeNames,
|
||||
lpd.publish_task AS publishTask,
|
||||
lai.task_id AS taskId,
|
||||
su.sign_url AS leaseSignUrl,
|
||||
su.sign_type AS leaseSignType,
|
||||
tt.task_type AS taskType,
|
||||
tt.task_status AS taskStatus,
|
||||
lai.material_man AS materialMan,
|
||||
lai.confirm_time AS confirmTime,
|
||||
lai.is_confirm AS isConfirm,
|
||||
lai.confirm_remark AS confirmRemark,
|
||||
mt3.type_id AS firstId,
|
||||
lpd.create_time AS releaseTime,
|
||||
lpd.parent_id AS parentId
|
||||
FROM
|
||||
lease_publish_details lpd
|
||||
LEFT JOIN lease_apply_info lai ON lai.id = lpd.parent_id
|
||||
LEFT JOIN tm_task tt ON lai.task_id = tt.task_id
|
||||
LEFT JOIN (SELECT IFNULL( sum(out_num ), 0) AS num, parent_id, publish_task,lease_sign_id from lease_out_details a
|
||||
<if test="userId != null">
|
||||
JOIN ma_type_keeper mtk ON mtk.type_id = a.type_id AND mtk.user_id = #{userId}
|
||||
</if>
|
||||
WHERE a.publish_task is not null
|
||||
GROUP BY parent_id, publish_task) lod ON lpd.parent_id = lod.parent_id
|
||||
AND lpd.publish_task = lod.publish_task
|
||||
LEFT JOIN bm_unit bu ON bu.unit_id = lpd.unit_id
|
||||
LEFT JOIN bm_project bp ON bp.pro_id = lpd.project_id
|
||||
LEFT JOIN sys_dept sd ON sd.dept_id = bp.imp_unit
|
||||
LEFT JOIN ma_type mt ON lpd.new_type = 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'
|
||||
left join ma_type mt2 ON mt1.parent_id = mt2.type_id and mt2.del_flag = '0'
|
||||
left join ma_type mt3 ON mt2.parent_id = mt3.type_id and mt3.del_flag = '0'
|
||||
LEFT JOIN bm_agreement_info bai ON lpd.unit_id = bai.unit_id AND lpd.project_id = bai.project_id AND bai.project_unit_id IS NULL
|
||||
left join sys_user su on lpd.create_by = su.user_id
|
||||
<if test="userId != null">
|
||||
JOIN ma_type_keeper mtk ON mtk.type_id = lpd.new_type AND mtk.user_id = #{userId}
|
||||
</if>
|
||||
where
|
||||
(lpd.lease_sign_url is not null or lod.lease_sign_id is not null)
|
||||
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
||||
<![CDATA[ AND DATE_FORMAT( lpd.create_time, '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime} ]]>
|
||||
</if>
|
||||
<if test="id != null ">
|
||||
AND lai.id = #{id}
|
||||
</if>
|
||||
<if test="publishTask != null and publishTask != ''">
|
||||
AND lpd.publish_task = #{publishTask}
|
||||
</if>
|
||||
GROUP BY
|
||||
lpd.publish_task
|
||||
ORDER BY lpd.code DESC;
|
||||
</select>
|
||||
|
||||
<select id="getPublishSign" resultType="com.bonus.common.biz.domain.lease.LeaseOutSign">
|
||||
SELECT
|
||||
lease_sign_type as outSignType,
|
||||
lease_sign_url as outSignUrl
|
||||
FROM
|
||||
lease_publish_details
|
||||
WHERE
|
||||
lease_sign_url IS NOT NULL
|
||||
and parent_id = #{id}
|
||||
and publish_task = #{publishTask}
|
||||
GROUP BY
|
||||
publish_task
|
||||
</select>
|
||||
|
||||
<select id="getLeaseSign" resultType="com.bonus.common.biz.domain.lease.LeaseOutSign">
|
||||
SELECT
|
||||
lease_sign_type as outSignType,
|
||||
lease_sign_url as outSignUrl
|
||||
FROM
|
||||
lease_apply_details
|
||||
WHERE
|
||||
lease_sign_url IS NOT NULL
|
||||
and parent_id = #{id}
|
||||
GROUP BY
|
||||
parent_id
|
||||
</select>
|
||||
|
||||
<select id="getDeptName" resultType="java.lang.String">
|
||||
SELECT
|
||||
project_dept
|
||||
FROM
|
||||
`data_center`.dx_fb_son
|
||||
WHERE
|
||||
id = #{externalId}
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
<select id="getTypeIds" resultType="java.lang.String">
|
||||
SELECT
|
||||
GROUP_CONCAT(mt.type_id)
|
||||
FROM
|
||||
ma_type mt
|
||||
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
|
||||
AND mt1.del_flag = 0
|
||||
LEFT JOIN ma_type mt2 ON mt1.parent_id = mt2.type_id
|
||||
AND mt2.del_flag = 0
|
||||
LEFT JOIN ma_type mt3 ON mt2.parent_id = mt3.type_id
|
||||
AND mt3.del_flag = 0
|
||||
WHERE
|
||||
mt.del_flag = '0'
|
||||
AND mt3.type_id = 1169
|
||||
</select>
|
||||
<select id="getTypeNum" resultType="java.math.BigDecimal">
|
||||
SELECT
|
||||
IFNULL(SUM(lod.out_num), 0) as alNum
|
||||
FROM
|
||||
lease_out_details lod
|
||||
LEFT JOIN lease_apply_info lai on lod.parent_id = lai.id
|
||||
where lai.direct_id is null
|
||||
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
||||
and lod.create_time BETWEEN CONCAT(#{startTime}, ' 00:00:00') AND CONCAT(#{endTime}, ' 23:59:59')
|
||||
</if>
|
||||
<if test="typeIdSet != null and typeIdSet.size() > 0">
|
||||
and lod.type_id in
|
||||
<foreach item="item" collection="typeIdSet" separator="," close=")" index="index" open="(">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getRopeNum" resultType="java.math.BigDecimal">
|
||||
SELECT
|
||||
IFNULL(SUM(lod.out_num), 0) as alNum
|
||||
FROM
|
||||
lease_out_details lod
|
||||
LEFT JOIN lease_apply_info lai on lod.parent_id = lai.id
|
||||
LEFT JOIN ma_type mt ON lod.type_id = mt.type_id and mt.del_flag = '0'
|
||||
where
|
||||
mt.unit_value = '1' and lai.direct_id is null
|
||||
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
||||
and lod.create_time BETWEEN CONCAT(#{startTime}, ' 00:00:00') AND CONCAT(#{endTime}, ' 23:59:59')
|
||||
</if>
|
||||
<if test="typeIdSet != null and typeIdSet.size() > 0">
|
||||
and lod.type_id not in
|
||||
<foreach item="item" collection="typeIdSet" separator="," close=")" index="index" open="(">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getInCountNum" resultType="java.math.BigDecimal">
|
||||
SELECT
|
||||
IFNULL(SUM(lod.out_num), 0) as alNum
|
||||
FROM
|
||||
lease_out_details lod
|
||||
LEFT JOIN lease_apply_info lai on lod.parent_id = lai.id
|
||||
LEFT JOIN ma_type mt ON lod.type_id = mt.type_id and mt.del_flag = '0'
|
||||
where
|
||||
mt.unit_value = '0' and lai.direct_id is null
|
||||
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
||||
and lod.create_time BETWEEN CONCAT(#{startTime}, ' 00:00:00') AND CONCAT(#{endTime}, ' 23:59:59')
|
||||
</if>
|
||||
<if test="typeIdSet != null and typeIdSet.size() > 0">
|
||||
and lod.type_id not in
|
||||
<foreach item="item" collection="typeIdSet" separator="," close=")" index="index" open="(">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -272,10 +272,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
where id = #{maId}
|
||||
</update>
|
||||
<update id="updateLeaseOutSign">
|
||||
update lease_out_details
|
||||
update lease_publish_details
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="createTime != null">update_time = #{createTime},</if>
|
||||
<if test="leaseSignId != null">lease_sign_id = #{leaseSignId},</if>
|
||||
<if test="leaseSignUrl != null">lease_sign_url = #{leaseSignUrl},</if>
|
||||
<if test="leaseSignType != null">lease_sign_type = #{leaseSignType},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="updateLeaseSignInfo">
|
||||
update lease_apply_details
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="createTime != null">update_time = #{createTime},</if>
|
||||
<if test="leaseSignUrl != null">lease_sign_url = #{leaseSignUrl},</if>
|
||||
<if test="leaseSignType != null">lease_sign_type = #{leaseSignType},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
|
|
|||
|
|
@ -505,7 +505,8 @@
|
|||
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
|
||||
sd.dept_name as impUnitName,
|
||||
bp.external_id as externalId
|
||||
from
|
||||
lease_apply_info lai
|
||||
left join tm_task tt on lai.task_id = tt.task_id
|
||||
|
|
@ -1331,4 +1332,14 @@
|
|||
WHERE
|
||||
`code`=#{businessCode}
|
||||
</select>
|
||||
|
||||
<select id="getIsAuth" resultType="com.bonus.common.biz.domain.lease.LeasePublishInfo">
|
||||
SELECT
|
||||
file_name as fileName,
|
||||
url as fileUrl
|
||||
FROM
|
||||
pro_authorize_info
|
||||
WHERE
|
||||
lease_id = #{id}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue