Merge branch 'master' of http://192.168.30.2:3000/bonus/Bonus-Cloud-Material
This commit is contained in:
commit
288d52e280
|
|
@ -3,6 +3,7 @@ package com.bonus.material.clz.controller;
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.convert.Convert;
|
import cn.hutool.core.convert.Convert;
|
||||||
|
import cn.hutool.core.date.DateTime;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.alibaba.nacos.common.utils.StringUtils;
|
import com.alibaba.nacos.common.utils.StringUtils;
|
||||||
import com.bonus.common.biz.config.PoiOutPage;
|
import com.bonus.common.biz.config.PoiOutPage;
|
||||||
|
|
@ -182,7 +183,17 @@ public class ClzSltAgreementInfoController extends BaseController {
|
||||||
List<MaterialSltAgreementInfo> oneOfList = clzSltAgreementInfoMapper.getLeaseList(sltAgreementInfo);
|
List<MaterialSltAgreementInfo> oneOfList = clzSltAgreementInfoMapper.getLeaseList(sltAgreementInfo);
|
||||||
//设定班组实际出场时间
|
//设定班组实际出场时间
|
||||||
if(!oneOfList.isEmpty()){
|
if(!oneOfList.isEmpty()){
|
||||||
String date = clzSltAgreementInfoMapper.getTeamOutTime(oneOfList.get(0));
|
|
||||||
|
String date = "暂无" ;
|
||||||
|
//先判断是否在场
|
||||||
|
String exitTime = clzSltAgreementInfoMapper.getTeamSjOutTime(oneOfList.get(0));
|
||||||
|
if( exitTime!=null && !exitTime.isEmpty() ){
|
||||||
|
|
||||||
|
}else{
|
||||||
|
date = clzSltAgreementInfoMapper.getTeamOutTime(oneOfList.get(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if(date!=null && !date.isEmpty()){
|
if(date!=null && !date.isEmpty()){
|
||||||
oneOfList.get(0).setActualExitTime(date);
|
oneOfList.get(0).setActualExitTime(date);
|
||||||
}
|
}
|
||||||
|
|
@ -280,7 +291,16 @@ public class ClzSltAgreementInfoController extends BaseController {
|
||||||
loseList.addAll(overdueReturnedList);
|
loseList.addAll(overdueReturnedList);
|
||||||
//设定班组实际出场时间
|
//设定班组实际出场时间
|
||||||
if(!loseList.isEmpty()){
|
if(!loseList.isEmpty()){
|
||||||
String date = clzSltAgreementInfoMapper.getTeamOutTime(loseList.get(0));
|
|
||||||
|
String date = "暂无" ;
|
||||||
|
//先判断是否在场
|
||||||
|
String exitTime = clzSltAgreementInfoMapper.getTeamSjOutTime(oneOfList.get(0));
|
||||||
|
if( exitTime!=null && !exitTime.isEmpty() ){
|
||||||
|
|
||||||
|
}else{
|
||||||
|
date = clzSltAgreementInfoMapper.getTeamOutTime(loseList.get(0));
|
||||||
|
}
|
||||||
|
|
||||||
if(date!=null && !date.isEmpty()){
|
if(date!=null && !date.isEmpty()){
|
||||||
loseList.get(0).setActualExitTime(date);
|
loseList.get(0).setActualExitTime(date);
|
||||||
}
|
}
|
||||||
|
|
@ -442,7 +462,15 @@ public class ClzSltAgreementInfoController extends BaseController {
|
||||||
}
|
}
|
||||||
//设定班组实际出场时间
|
//设定班组实际出场时间
|
||||||
if(!listAll.isEmpty()){
|
if(!listAll.isEmpty()){
|
||||||
String date = clzSltAgreementInfoMapper.getTeamOutTime(listAll.get(0));
|
String date = "暂无" ;
|
||||||
|
//先判断是否在场
|
||||||
|
String exitTime = clzSltAgreementInfoMapper.getTeamSjOutTime(listAll.get(0));
|
||||||
|
if( exitTime!=null && !exitTime.isEmpty() ){
|
||||||
|
|
||||||
|
}else{
|
||||||
|
date = clzSltAgreementInfoMapper.getTeamOutTime(listAll.get(0));
|
||||||
|
}
|
||||||
|
|
||||||
if(date!=null && !date.isEmpty()){
|
if(date!=null && !date.isEmpty()){
|
||||||
listAll.get(0).setActualExitTime(date);
|
listAll.get(0).setActualExitTime(date);
|
||||||
}
|
}
|
||||||
|
|
@ -551,7 +579,19 @@ public class ClzSltAgreementInfoController extends BaseController {
|
||||||
|
|
||||||
private BigDecimal calculateRentalCostByTeamExitTime(MaterialSltAgreementInfo bean, BigDecimal leasePrice, BigDecimal num) {
|
private BigDecimal calculateRentalCostByTeamExitTime(MaterialSltAgreementInfo bean, BigDecimal leasePrice, BigDecimal num) {
|
||||||
// 模拟班组退场时间(后续会通过参数传入)
|
// 模拟班组退场时间(后续会通过参数传入)
|
||||||
Date teamExitTime = simulateTeamExitTime();
|
// Date teamExitTime = simulateTeamExitTime();
|
||||||
|
String teamExitTime = bean.getActualExitTime();
|
||||||
|
if (teamExitTime == null) {
|
||||||
|
teamExitTime = DateTime.now().toString("yyyy-MM-dd");
|
||||||
|
}
|
||||||
|
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
Date exitTime = null;
|
||||||
|
try {
|
||||||
|
exitTime = format.parse(teamExitTime);
|
||||||
|
}catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// 物资是否已退还(根据endTime字段判断)
|
// 物资是否已退还(根据endTime字段判断)
|
||||||
boolean isReturned = bean.getEndTime() != null;
|
boolean isReturned = bean.getEndTime() != null;
|
||||||
|
|
@ -565,7 +605,7 @@ public class ClzSltAgreementInfoController extends BaseController {
|
||||||
Date materialReturnTime = bean.getEndTime();
|
Date materialReturnTime = bean.getEndTime();
|
||||||
|
|
||||||
// 计算超期天数
|
// 计算超期天数
|
||||||
long overdueDays = calculateOverdueDays(materialReturnTime, teamExitTime);
|
long overdueDays = calculateOverdueDays(materialReturnTime, exitTime);
|
||||||
|
|
||||||
if (overdueDays <= 0) {
|
if (overdueDays <= 0) {
|
||||||
// 1.3 在班组退场之前归还的物资不收费
|
// 1.3 在班组退场之前归还的物资不收费
|
||||||
|
|
|
||||||
|
|
@ -123,4 +123,6 @@ public interface ClzSltAgreementInfoMapper {
|
||||||
List<MaterialSltAgreementInfo> getClzTeamList(MaterialSltAgreementInfo bean);
|
List<MaterialSltAgreementInfo> getClzTeamList(MaterialSltAgreementInfo bean);
|
||||||
|
|
||||||
String getTeamOutTime(MaterialSltAgreementInfo materialSltAgreementInfo);
|
String getTeamOutTime(MaterialSltAgreementInfo materialSltAgreementInfo);
|
||||||
|
|
||||||
|
String getTeamSjOutTime(MaterialSltAgreementInfo materialSltAgreementInfo);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.bonus.material.clz.service.impl;
|
package com.bonus.material.clz.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.date.DateTime;
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
import com.bonus.common.biz.constant.GlobalConstants;
|
import com.bonus.common.biz.constant.GlobalConstants;
|
||||||
import com.bonus.common.biz.domain.ProjectTreeBuild;
|
import com.bonus.common.biz.domain.ProjectTreeBuild;
|
||||||
|
|
@ -32,6 +33,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
@ -775,9 +777,17 @@ public class ClzSltAgreementInfoServiceImpl implements ClzSltAgreementInfoServic
|
||||||
*/
|
*/
|
||||||
private List<MaterialSltAgreementInfo> getLeaseList(MaterialSltAgreementInfo info) {
|
private List<MaterialSltAgreementInfo> getLeaseList(MaterialSltAgreementInfo info) {
|
||||||
List<MaterialSltAgreementInfo> oneOfList = clzSltAgreementInfoMapper.getLeaseList(info);
|
List<MaterialSltAgreementInfo> oneOfList = clzSltAgreementInfoMapper.getLeaseList(info);
|
||||||
|
String date = null ;
|
||||||
//设定班组实际出场时间
|
//设定班组实际出场时间
|
||||||
if(!oneOfList.isEmpty()){
|
if(!oneOfList.isEmpty()){
|
||||||
String date = clzSltAgreementInfoMapper.getTeamOutTime(oneOfList.get(0));
|
//先判断是否在场
|
||||||
|
String exitTime = clzSltAgreementInfoMapper.getTeamSjOutTime(oneOfList.get(0));
|
||||||
|
if( exitTime!=null && !exitTime.isEmpty() ){
|
||||||
|
|
||||||
|
}else{
|
||||||
|
date = clzSltAgreementInfoMapper.getTeamOutTime(oneOfList.get(0));
|
||||||
|
}
|
||||||
|
|
||||||
if(date!=null && !date.isEmpty()){
|
if(date!=null && !date.isEmpty()){
|
||||||
oneOfList.get(0).setActualExitTime(date);
|
oneOfList.get(0).setActualExitTime(date);
|
||||||
}
|
}
|
||||||
|
|
@ -816,7 +826,19 @@ public class ClzSltAgreementInfoServiceImpl implements ClzSltAgreementInfoServic
|
||||||
*/
|
*/
|
||||||
private BigDecimal calculateRentalCostByTeamExitTime(MaterialSltAgreementInfo bean, BigDecimal leasePrice, BigDecimal num) {
|
private BigDecimal calculateRentalCostByTeamExitTime(MaterialSltAgreementInfo bean, BigDecimal leasePrice, BigDecimal num) {
|
||||||
// 模拟班组退场时间(后续会通过参数传入)
|
// 模拟班组退场时间(后续会通过参数传入)
|
||||||
Date teamExitTime = simulateTeamExitTime();
|
// Date teamExitTime = simulateTeamExitTime();
|
||||||
|
String teamExitTime = bean.getActualExitTime();
|
||||||
|
if (teamExitTime == null) {
|
||||||
|
teamExitTime = DateTime.now().toString("yyyy-MM-dd");
|
||||||
|
}
|
||||||
|
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
Date exitTime = null;
|
||||||
|
try {
|
||||||
|
exitTime = format.parse(teamExitTime);
|
||||||
|
}catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// 物资是否已退还(根据endTime字段判断)
|
// 物资是否已退还(根据endTime字段判断)
|
||||||
boolean isReturned = bean.getEndTime() != null;
|
boolean isReturned = bean.getEndTime() != null;
|
||||||
|
|
@ -830,7 +852,7 @@ public class ClzSltAgreementInfoServiceImpl implements ClzSltAgreementInfoServic
|
||||||
Date materialReturnTime = bean.getEndTime();
|
Date materialReturnTime = bean.getEndTime();
|
||||||
|
|
||||||
// 计算超期天数
|
// 计算超期天数
|
||||||
long overdueDays = calculateOverdueDays(materialReturnTime, teamExitTime);
|
long overdueDays = calculateOverdueDays(materialReturnTime, exitTime);
|
||||||
|
|
||||||
if (overdueDays <= 0) {
|
if (overdueDays <= 0) {
|
||||||
// 1.3 在班组退场之前归还的物资不收费
|
// 1.3 在班组退场之前归还的物资不收费
|
||||||
|
|
|
||||||
|
|
@ -1380,17 +1380,6 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
|
||||||
if (CollectionUtils.isEmpty(recordList)) {
|
if (CollectionUtils.isEmpty(recordList)) {
|
||||||
return recordList;
|
return recordList;
|
||||||
}
|
}
|
||||||
// 获取所有领料未结算协议id
|
|
||||||
List<MaterialProvideNumInfo> subAgreementIds = materialMachineMapper.getSubAgreementIds(bean);
|
|
||||||
|
|
||||||
// 查询分包商领用数据,不作为库存,作为再用数据
|
|
||||||
List<MaterialRetainedEquipmentInfo> subList = materialMachineMapper.getSubInfoList(bean);
|
|
||||||
// 根据工程id获取分包的在用数量,存储在map集合中
|
|
||||||
Map<String, BigDecimal> subMap = new HashMap<>();
|
|
||||||
subList.forEach(info -> {
|
|
||||||
String key = getCompositeKey(info.getProId(), info.getTypeId());
|
|
||||||
subMap.putIfAbsent(key, info.getAllNum());
|
|
||||||
});
|
|
||||||
|
|
||||||
// 1. 过滤数据(并行流加速大集合过滤)
|
// 1. 过滤数据(并行流加速大集合过滤)
|
||||||
if (teamData != null) {
|
if (teamData != null) {
|
||||||
|
|
@ -1400,7 +1389,7 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. 转换参数:将agreementIds(逗号字符串)转为List<String>
|
// 2. 转换参数:将agreementIds(逗号字符串)转为List<String>
|
||||||
List<Map<String, Object>> queryParams = subAgreementIds.stream()
|
List<Map<String, Object>> queryParams = recordList.stream()
|
||||||
.map(record -> {
|
.map(record -> {
|
||||||
Map<String, Object> param = new HashMap<>(3);
|
Map<String, Object> param = new HashMap<>(3);
|
||||||
param.put("proId", record.getProId());
|
param.put("proId", record.getProId());
|
||||||
|
|
@ -1457,12 +1446,6 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
|
||||||
String key = getCompositeKey(record.getProId(), record.getTypeId());
|
String key = getCompositeKey(record.getProId(), record.getTypeId());
|
||||||
// 从Map获取数据(默认0,避免null)
|
// 从Map获取数据(默认0,避免null)
|
||||||
BigDecimal businessNum = leaseBusinessMap.getOrDefault(key, BigDecimal.ZERO);
|
BigDecimal businessNum = leaseBusinessMap.getOrDefault(key, BigDecimal.ZERO);
|
||||||
// 从subMap获取在用数量
|
|
||||||
BigDecimal useNum = subMap.getOrDefault(key, BigDecimal.ZERO);
|
|
||||||
// 追加在用数量给实际供应数量和已有在用数量
|
|
||||||
record.setSupplyNum(record.getSupplyNum().add(useNum));
|
|
||||||
record.setUseNum(record.getUseNum().add(useNum));
|
|
||||||
|
|
||||||
// 设置record的businessNum(原逻辑保留)
|
// 设置record的businessNum(原逻辑保留)
|
||||||
record.setBusinessNum(businessNum);
|
record.setBusinessNum(businessNum);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -98,6 +98,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
res.agreementId,
|
res.agreementId,
|
||||||
res.unitName,
|
res.unitName,
|
||||||
res.unitId,
|
res.unitId,
|
||||||
|
res.wsProId,
|
||||||
res.projectName,
|
res.projectName,
|
||||||
res.companyId,
|
res.companyId,
|
||||||
res.typeId,
|
res.typeId,
|
||||||
|
|
@ -118,9 +119,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
sai.agreement_id as agreementId,
|
sai.agreement_id as agreementId,
|
||||||
bui.unit_id as unitId,
|
bui.unit_id as unitId,
|
||||||
bui.unit_name as unitName,
|
bui.unit_name as unitName,
|
||||||
|
bp.external_id as wsProId,
|
||||||
bp.pro_name as projectName,
|
bp.pro_name as projectName,
|
||||||
sai.company_id as companyId,
|
sai.company_id as companyId,
|
||||||
sai.type_id as typeId,
|
sai.type_id as typeId,
|
||||||
|
|
||||||
sai.ma_id as maId,
|
sai.ma_id as maId,
|
||||||
mt.unit_value as unitValue,
|
mt.unit_value as unitValue,
|
||||||
mt1.type_name as typeName,
|
mt1.type_name as typeName,
|
||||||
|
|
@ -148,6 +151,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
res.unitId,
|
res.unitId,
|
||||||
res.unitName,
|
res.unitName,
|
||||||
res.projectName,
|
res.projectName,
|
||||||
|
res.wsProId,
|
||||||
res.companyId,
|
res.companyId,
|
||||||
res.typeId,
|
res.typeId,
|
||||||
res.typeName,
|
res.typeName,
|
||||||
|
|
@ -170,6 +174,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
bui.unit_id as unitId,
|
bui.unit_id as unitId,
|
||||||
bui.unit_name as unitName,
|
bui.unit_name as unitName,
|
||||||
bp.pro_name as projectName,
|
bp.pro_name as projectName,
|
||||||
|
bp.external_id as wsProId,
|
||||||
sai.company_id as companyId,
|
sai.company_id as companyId,
|
||||||
sai.type_id as typeId,
|
sai.type_id as typeId,
|
||||||
sai.ma_id as maId,
|
sai.ma_id as maId,
|
||||||
|
|
@ -177,7 +182,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
mt1.type_name as typeName,
|
mt1.type_name as typeName,
|
||||||
mt.type_name as modelName,
|
mt.type_name as modelName,
|
||||||
mt.unit_name as mtUnitName,
|
mt.unit_name as mtUnitName,
|
||||||
sai.buy_price as buyPrice,
|
mt.buy_price as buyPrice,
|
||||||
sai.num as num,
|
sai.num as num,
|
||||||
sai.start_time as startTime,
|
sai.start_time as startTime,
|
||||||
sai.end_time as endTime,
|
sai.end_time as endTime,
|
||||||
|
|
@ -384,14 +389,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
where `code` = #{sltApplyCode}
|
where `code` = #{sltApplyCode}
|
||||||
</select>
|
</select>
|
||||||
<select id="getClzTeamList" resultType="com.bonus.material.clz.domain.vo.MaterialSltAgreementInfo">
|
<select id="getClzTeamList" resultType="com.bonus.material.clz.domain.vo.MaterialSltAgreementInfo">
|
||||||
SELECT
|
SELECT
|
||||||
bu.unit_id AS unitId,
|
bu.unit_id AS unitId,
|
||||||
bu.unit_name AS unitName
|
bu.unit_name AS unitName
|
||||||
FROM
|
FROM
|
||||||
clz_bm_agreement_info bai
|
clz_bm_agreement_info bai
|
||||||
left join bm_unit bu on bai.unit_id = bu.unit_id
|
left join bm_unit bu on bai.unit_id = bu.unit_id
|
||||||
WHERE
|
WHERE
|
||||||
bai.project_id = #{proId}
|
bu.unit_name IS NOT NULL
|
||||||
|
AND bai.project_id = #{proId}
|
||||||
|
GROUP BY
|
||||||
|
bu.unit_id
|
||||||
</select>
|
</select>
|
||||||
<select id="getTeamOutTime" resultType="java.lang.String">
|
<select id="getTeamOutTime" resultType="java.lang.String">
|
||||||
select
|
select
|
||||||
|
|
@ -405,6 +413,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
order by bzj.sjccsj desc limit 1
|
order by bzj.sjccsj desc limit 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getTeamSjOutTime" resultType="java.lang.String">
|
||||||
|
select
|
||||||
|
|
||||||
|
bz.sjjcsj as time
|
||||||
|
from
|
||||||
|
bm_unit bu
|
||||||
|
left join `micro-tool`.bzgl_bz bz on bz.bzz_idcard = bu.bzz_idcard
|
||||||
|
|
||||||
|
where bu.unit_id = #{unitId} AND bz.project_id = #{wsProId}
|
||||||
|
LIMIT 1
|
||||||
|
</select>
|
||||||
|
|
||||||
<update id="updateClzAgreementInfoByIds">
|
<update id="updateClzAgreementInfoByIds">
|
||||||
update clz_bm_agreement_info
|
update clz_bm_agreement_info
|
||||||
set is_slt = 1, update_time = now()
|
set is_slt = 1, update_time = now()
|
||||||
|
|
|
||||||
|
|
@ -1975,19 +1975,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
subquery1.impUnit AS impUnit,
|
subquery1.impUnit AS impUnit,
|
||||||
subquery3.idCard AS idCard,
|
subquery3.idCard AS idCard,
|
||||||
CASE
|
CASE
|
||||||
WHEN IFNULL(subquery1.usNum, 0) - IFNULL(subquery3.usNum, 0) < 0
|
WHEN subquery1.typeId = 36 THEN
|
||||||
THEN 0
|
GREATEST(IFNULL(subquery1.usNum, 0) - IFNULL(subquery3.usNum, 0), 0)
|
||||||
ELSE IFNULL(subquery1.usNum, 0) - IFNULL(subquery3.usNum, 0)
|
ELSE
|
||||||
END
|
IFNULL(subquery3.usNum, 0)
|
||||||
AS storeNum,
|
END AS storeNum,
|
||||||
IFNULL(subquery3.usNum, 0) AS useNum,
|
|
||||||
(
|
|
||||||
CASE
|
CASE
|
||||||
WHEN IFNULL(subquery1.usNum, 0) - IFNULL(subquery3.usNum, 0) < 0
|
WHEN subquery1.typeId = 36 THEN
|
||||||
THEN 0
|
IFNULL(subquery3.usNum, 0)
|
||||||
ELSE IFNULL(subquery1.usNum, 0) - IFNULL(subquery3.usNum, 0)
|
ELSE
|
||||||
END + IFNULL(subquery3.usNum, 0)
|
IFNULL(subquery1.usNum, 0)
|
||||||
) AS supplyNum,
|
END AS useNum,
|
||||||
|
IFNULL(subquery1.supplyNum, 0) AS supplyNum,
|
||||||
subquery1.proCenter AS departName,
|
subquery1.proCenter AS departName,
|
||||||
subquery1.departName AS impUnitName,
|
subquery1.departName AS impUnitName,
|
||||||
CASE mt.manage_type
|
CASE mt.manage_type
|
||||||
|
|
@ -2015,7 +2014,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
mt2.type_name AS typeName,
|
mt2.type_name AS typeName,
|
||||||
mt2.type_id AS thirdTypeId,
|
mt2.type_id AS thirdTypeId,
|
||||||
mt.type_name AS typeModelName,
|
mt.type_name AS typeModelName,
|
||||||
SUM(IFNULL( sai.num, 0 )) AS usNum,
|
SUM(CASE WHEN sai.`status` = '0' THEN IFNULL(sai.num, 0) ELSE 0 END) AS usNum,
|
||||||
|
SUM(IFNULL( sai.num, 0 )) AS supplyNum,
|
||||||
bp.pro_name as proName,
|
bp.pro_name as proName,
|
||||||
bp.pro_id as proId,
|
bp.pro_id as proId,
|
||||||
bp.external_id as externalId,
|
bp.external_id as externalId,
|
||||||
|
|
@ -2023,7 +2023,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
bu.bzz_idcard AS idCard,
|
bu.bzz_idcard AS idCard,
|
||||||
df.project_dept AS proCenter,
|
df.project_dept AS proCenter,
|
||||||
sd.dept_name AS departName,
|
sd.dept_name AS departName,
|
||||||
GROUP_CONCAT(DISTINCT sai.agreement_id) AS agreementId
|
GROUP_CONCAT(DISTINCT sai.agreement_id) AS agreementId,
|
||||||
|
bu.type_id AS typeId
|
||||||
FROM
|
FROM
|
||||||
slt_agreement_info sai
|
slt_agreement_info sai
|
||||||
LEFT JOIN ma_type mt ON mt.type_id = sai.type_id
|
LEFT JOIN ma_type mt ON mt.type_id = sai.type_id
|
||||||
|
|
@ -2037,12 +2038,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
LEFT JOIN sys_dept sd ON sd.dept_id = bp.imp_unit
|
LEFT JOIN sys_dept sd ON sd.dept_id = bp.imp_unit
|
||||||
LEFT JOIN data_center.dx_fb_son df ON bp.external_id = df.id
|
LEFT JOIN data_center.dx_fb_son df ON bp.external_id = df.id
|
||||||
WHERE
|
WHERE
|
||||||
sai.`status` = '0'
|
sai.is_slt = '0'
|
||||||
AND sai.is_slt = '0'
|
|
||||||
AND sai.end_time IS NULL
|
|
||||||
AND sai.back_id IS NULL
|
|
||||||
AND bp.external_id IS NOT NULL
|
AND bp.external_id IS NOT NULL
|
||||||
AND bu.type_id = 36
|
|
||||||
<if test="impUnitName != null and impUnitName != ''">
|
<if test="impUnitName != null and impUnitName != ''">
|
||||||
AND sd.dept_name = #{impUnitName}
|
AND sd.dept_name = #{impUnitName}
|
||||||
</if>
|
</if>
|
||||||
|
|
@ -2164,6 +2161,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
LEFT JOIN ma_type mt4 ON mt4.type_id = mt3.parent_id
|
LEFT JOIN ma_type mt4 ON mt4.type_id = mt3.parent_id
|
||||||
WHERE mt.`level` = 4 and mt.del_flag = '0'
|
WHERE mt.`level` = 4 and mt.del_flag = '0'
|
||||||
AND subquery1.proName IS NOT NULL
|
AND subquery1.proName IS NOT NULL
|
||||||
|
AND (
|
||||||
|
IFNULL(subquery1.usNum, 0) > 0
|
||||||
|
OR (
|
||||||
|
CASE
|
||||||
|
WHEN subquery1.typeId = 36 THEN GREATEST(IFNULL(subquery1.usNum, 0) - IFNULL(subquery3.usNum, 0), 0)
|
||||||
|
ELSE IFNULL(subquery3.usNum, 0)
|
||||||
|
END
|
||||||
|
) > 0
|
||||||
|
OR (
|
||||||
|
CASE
|
||||||
|
WHEN subquery1.typeId = 36 THEN IFNULL(subquery3.usNum, 0)
|
||||||
|
ELSE IFNULL(subquery1.usNum, 0)
|
||||||
|
END
|
||||||
|
) > 0
|
||||||
|
)
|
||||||
GROUP BY
|
GROUP BY
|
||||||
subquery1.proId,
|
subquery1.proId,
|
||||||
mt.type_id
|
mt.type_id
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue