功能优化,冲减账,领料退料查询
This commit is contained in:
parent
8f7067c77f
commit
993b9984b8
|
|
@ -356,6 +356,12 @@ public class TmTask implements Serializable {
|
|||
private int costType;
|
||||
private long days;
|
||||
|
||||
@ApiModelProperty(value = "退料id")
|
||||
private Integer backId;
|
||||
|
||||
@ApiModelProperty(value = "领料id")
|
||||
private Integer leaseId;
|
||||
|
||||
public void setLeaseFee(BigDecimal leaseFee) {
|
||||
this.leaseFee = leaseFee;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ import javax.annotation.Resource;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.YearMonth;
|
||||
import java.time.ZoneId;
|
||||
|
|
@ -247,12 +248,21 @@ public class LeaseOutDetailsServiceImpl implements LeaseOutDetailsService {
|
|||
if (k == 0) {
|
||||
return AjaxResult.error("出库时间修改失败");
|
||||
}
|
||||
// 检查是否有退料记录
|
||||
boolean hasBackRecord = sltList.stream().anyMatch(task -> task.getBackId() != null);
|
||||
if (!hasBackRecord) {
|
||||
//冲减帐
|
||||
int l = updateTimeAccount(bean);
|
||||
}else{
|
||||
return AjaxResult.success("出库时间修改成功,但该领料单存在已退料情况,无法冲减账单");
|
||||
}
|
||||
} else {
|
||||
//冲减帐
|
||||
int l = updateTimeAccount(bean);
|
||||
}
|
||||
|
||||
//冲减帐
|
||||
int l = updateTimeAccount( bean);
|
||||
} catch (Exception e) {
|
||||
log.error("出库时间修改失败", e.getMessage());
|
||||
log.error("出库时间修改失败", e);
|
||||
throw new RuntimeException("出库时间修改失败");
|
||||
}
|
||||
return AjaxResult.success("出库时间修改成功");
|
||||
|
|
@ -285,18 +295,22 @@ public class LeaseOutDetailsServiceImpl implements LeaseOutDetailsService {
|
|||
Integer agreementId = tmTask.getAgreementId();
|
||||
Date StartTime = bean.getPreTime();
|
||||
Date endTime = bean.getOutTime();
|
||||
long day = DateUtil.betweenDay(StartTime, endTime, true);
|
||||
long day = DateUtil.betweenDay(StartTime, endTime, false)+ 1;
|
||||
BigDecimal leaseFee = leasePrice.multiply(new BigDecimal(day)).multiply(new BigDecimal(outNum));
|
||||
TmTask fee = new TmTask();
|
||||
fee.setTypeId(typeId);
|
||||
fee.setLeaseFee(leaseFee);
|
||||
fee.setStartTime(StartTime+"");
|
||||
fee.setEndTime(endTime+"");
|
||||
fee.setLeaseFee(leaseFee.multiply(new BigDecimal(-1)));
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
fee.setStartTime(sdf.format(StartTime));
|
||||
fee.setEndTime(sdf.format(endTime));
|
||||
fee.setDays(day);
|
||||
fee.setCostType(2);
|
||||
fee.setOutNum(outNum);
|
||||
fee.setAgreementId(agreementId);
|
||||
fee.setLeasePrice(leasePrice);
|
||||
fee.setLeaseId(Integer.valueOf(bean.getId()));
|
||||
//4存入临时表
|
||||
leaseApplyDetailsMapper.insertSltFee(tmTask);
|
||||
leaseApplyDetailsMapper.insertSltFee(fee);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -310,18 +324,22 @@ public class LeaseOutDetailsServiceImpl implements LeaseOutDetailsService {
|
|||
Integer agreementId = tmTask.getAgreementId();
|
||||
Date StartTime = bean.getOutTime();
|
||||
Date endTime = bean.getPreTime();
|
||||
long day = DateUtil.betweenDay(StartTime, endTime, true);
|
||||
long day = DateUtil.betweenDay(StartTime, endTime, false) + 1;
|
||||
BigDecimal leaseFee = leasePrice.multiply(new BigDecimal(day)).multiply(new BigDecimal(outNum));
|
||||
TmTask fee = new TmTask();
|
||||
fee.setTypeId(typeId);
|
||||
fee.setLeaseFee(leaseFee);
|
||||
fee.setStartTime(StartTime+"");
|
||||
fee.setEndTime(endTime+"");
|
||||
fee.setCostType(0);
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
fee.setStartTime(sdf.format(StartTime));
|
||||
fee.setEndTime(sdf.format(endTime));
|
||||
fee.setCostType(1);
|
||||
fee.setDays(day);
|
||||
fee.setOutNum(outNum);
|
||||
fee.setAgreementId(agreementId);
|
||||
fee.setLeasePrice(leasePrice);
|
||||
fee.setLeaseId(Integer.valueOf(bean.getId()));
|
||||
//4存入临时表
|
||||
leaseApplyDetailsMapper.insertSltFee(tmTask);
|
||||
leaseApplyDetailsMapper.insertSltFee(fee);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -352,9 +370,9 @@ public class LeaseOutDetailsServiceImpl implements LeaseOutDetailsService {
|
|||
if (isInCycle(preDate, cycleStart, cycleEnd) &&
|
||||
isInCycle(outDate, cycleStart, cycleEnd)) {
|
||||
return 0; // 都在周期内
|
||||
} else if (outDate.isBefore(cycleStart)) {
|
||||
} else if (outDate.isBefore(preDate)) {
|
||||
return 1; // 修改时间早于周期
|
||||
} else if (outDate.isAfter(cycleEnd)) {
|
||||
} else if (outDate.isAfter(preDate)) {
|
||||
return 2; // 修改时间晚于周期
|
||||
} else {
|
||||
return 0; // 仅修改时间在周期内
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ public class BackRecord {
|
|||
* 类型名称
|
||||
*/
|
||||
@ApiModelProperty(value = "类型名称")
|
||||
@Excel(name = "机具名称")
|
||||
@Excel(name = "机具名称",sort=1)
|
||||
private String typeName;
|
||||
|
||||
/**
|
||||
|
|
@ -40,14 +40,14 @@ public class BackRecord {
|
|||
* 规格型号
|
||||
*/
|
||||
@ApiModelProperty(value = "规格型号")
|
||||
@Excel(name = "机具规格")
|
||||
@Excel(name = "机具规格",sort=2)
|
||||
private String typeModelName;
|
||||
|
||||
/**
|
||||
* 退料单号
|
||||
*/
|
||||
@ApiModelProperty(value = "退料单号")
|
||||
@Excel(name = "退料单号")
|
||||
@Excel(name = "退料单号",sort=3)
|
||||
private String code;
|
||||
|
||||
/**
|
||||
|
|
@ -60,7 +60,7 @@ public class BackRecord {
|
|||
* 设备编码
|
||||
*/
|
||||
@ApiModelProperty(value = "设备编码")
|
||||
@Excel(name = "设备编码")
|
||||
@Excel(name = "设备编码",sort=4)
|
||||
private String maCode;
|
||||
|
||||
/**
|
||||
|
|
@ -73,14 +73,14 @@ public class BackRecord {
|
|||
* 退料数量
|
||||
*/
|
||||
@ApiModelProperty(value = "退料数量")
|
||||
@Excel(name = "退料数量",cellType = Excel.ColumnType.NUMERIC)
|
||||
@Excel(name = "退料数量",cellType = Excel.ColumnType.NUMERIC,sort=5)
|
||||
private Integer backNum;
|
||||
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Excel(name = "损坏情况")
|
||||
@Excel(name = "损坏情况",sort=6)
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
|
|
@ -88,7 +88,7 @@ public class BackRecord {
|
|||
* 退料人
|
||||
*/
|
||||
@ApiModelProperty(value = "退料人")
|
||||
@Excel(name = "退料人")
|
||||
@Excel(name = "退料人",sort=7)
|
||||
private String backPerson;
|
||||
|
||||
|
||||
|
|
@ -100,14 +100,23 @@ public class BackRecord {
|
|||
private String createBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
* 制单日期
|
||||
*/
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
@ApiModelProperty(value = "制单日期")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "退料日期", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "制单日期", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss",sort=8)
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 回库日期
|
||||
*/
|
||||
@ApiModelProperty(value = "回库日期")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "回库日期", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss",sort=9)
|
||||
private Date backTime;
|
||||
|
||||
/**
|
||||
* 更新者
|
||||
*/
|
||||
|
|
@ -132,7 +141,7 @@ public class BackRecord {
|
|||
* 退料单位
|
||||
*/
|
||||
@ApiModelProperty(value = "退料单位")
|
||||
@Excel(name = "退料单位")
|
||||
@Excel(name = "退料单位",sort=10)
|
||||
private String unitName;
|
||||
|
||||
/**
|
||||
|
|
@ -145,7 +154,7 @@ public class BackRecord {
|
|||
* 退料工程
|
||||
*/
|
||||
@ApiModelProperty(value = "退料工程")
|
||||
@Excel(name = "退料工程")
|
||||
@Excel(name = "退料工程",sort=11,width = 30)
|
||||
private String proName;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ public class LeaseRecord{
|
|||
* 类型名称
|
||||
*/
|
||||
@ApiModelProperty(value = "类型名称")
|
||||
@Excel(name = "机具名称")
|
||||
@Excel(name = "机具名称",sort = 1)
|
||||
private String typeName;
|
||||
|
||||
/**
|
||||
|
|
@ -41,45 +41,52 @@ public class LeaseRecord{
|
|||
* 规格型号
|
||||
*/
|
||||
@ApiModelProperty(value = "规格型号")
|
||||
@Excel(name = "机具规格")
|
||||
@Excel(name = "机具规格",sort = 2)
|
||||
private String typeModelName;
|
||||
|
||||
/**
|
||||
* 协议号
|
||||
*/
|
||||
@ApiModelProperty(value = "协议号")
|
||||
@Excel(name = "协议号")
|
||||
// @Excel(name = "协议号")
|
||||
private String agreementCode;
|
||||
|
||||
/**
|
||||
* 设备编码
|
||||
*/
|
||||
@ApiModelProperty(value = "设备编码")
|
||||
@Excel(name = "设备编码")
|
||||
@Excel(name = "设备编码",sort = 4)
|
||||
private String maCode;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 计量单位
|
||||
*/
|
||||
@ApiModelProperty(value = "计量单位")
|
||||
@Excel(name = "单位")
|
||||
@Excel(name = "单位",sort = 5)
|
||||
private String unit;
|
||||
|
||||
/**
|
||||
* 预领料数
|
||||
*/
|
||||
@ApiModelProperty(value = "预领料数")
|
||||
@Excel(name = "领料数量",cellType = Excel.ColumnType.NUMERIC)
|
||||
@Excel(name = "领料数量",cellType = Excel.ColumnType.NUMERIC,sort = 6)
|
||||
private Integer preNum;
|
||||
|
||||
/**
|
||||
* 领料人
|
||||
*/
|
||||
@ApiModelProperty(value = "领料人")
|
||||
@Excel(name = "领料人")
|
||||
@Excel(name = "领料人",sort = 7)
|
||||
private String leasePerson;
|
||||
|
||||
|
||||
/**
|
||||
* 领料单号
|
||||
*/
|
||||
@ApiModelProperty(value = "领料单号")
|
||||
@Excel(name = "领料单号",sort = 3)
|
||||
private String leaseCode;
|
||||
|
||||
/**
|
||||
* 创建者
|
||||
|
|
@ -88,12 +95,21 @@ public class LeaseRecord{
|
|||
private String createBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
* 申请日期
|
||||
*/
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
@ApiModelProperty(value = "申请日期")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "领料日期", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "申请日期", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss",sort = 8)
|
||||
private Date leaseTime;
|
||||
|
||||
/**
|
||||
* 出库日期
|
||||
*/
|
||||
@ApiModelProperty(value = "出库日期")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "出库日期", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss",sort = 9)
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
|
|
@ -120,7 +136,7 @@ public class LeaseRecord{
|
|||
* 领料单位
|
||||
*/
|
||||
@ApiModelProperty(value = "领料单位")
|
||||
@Excel(name = "领料单位")
|
||||
@Excel(name = "领料单位",sort = 10)
|
||||
private String unitName;
|
||||
|
||||
/**
|
||||
|
|
@ -133,7 +149,7 @@ public class LeaseRecord{
|
|||
* 领料工程
|
||||
*/
|
||||
@ApiModelProperty(value = "领料工程")
|
||||
@Excel(name = "领料工程")
|
||||
@Excel(name = "领料工程",sort = 11,width = 30)
|
||||
private String proName;
|
||||
|
||||
/**
|
||||
|
|
@ -199,4 +215,5 @@ public class LeaseRecord{
|
|||
*/
|
||||
@ApiModelProperty(value = "是否显示")
|
||||
private String isView;
|
||||
|
||||
}
|
||||
|
|
@ -74,6 +74,8 @@ public interface SltAgreementInfoMapper {
|
|||
|
||||
List<SltAgreementInfo> getLeaseListMonthTwo(AgreementInfo bean);
|
||||
|
||||
List<SltAgreementInfo> getLeaseListMonthThree(AgreementInfo bean);
|
||||
|
||||
List<SltAgreementInfo> getPreScrapDetailsList(@Param("taskList") List<TmTask> taskList);
|
||||
|
||||
int updateOutSourceCosts(SltAgreementInfo sltAgreementInfo);
|
||||
|
|
|
|||
|
|
@ -93,11 +93,15 @@ public class CalcMonthlyServiceImp implements CalcMonthlyService {
|
|||
if (StringUtils.isNotBlank(bean.getStartTime()) && StringUtils.isNotBlank(bean.getEndTime())) {
|
||||
List<SltAgreementInfo> monthOneList = sltAgreementInfoMapper.getLeaseListMonthOne(bean);
|
||||
List<SltAgreementInfo> monthTwoList = sltAgreementInfoMapper.getLeaseListMonthTwo(bean);
|
||||
//冲账数据
|
||||
List<SltAgreementInfo> monthThreeList = sltAgreementInfoMapper.getLeaseListMonthThree(bean);
|
||||
monthOneList.stream().filter(Objects::nonNull);
|
||||
monthTwoList.stream().filter(Objects::nonNull);
|
||||
monthThreeList.stream().filter(Objects::nonNull);
|
||||
List<SltAgreementInfo> monthList = new ArrayList<>();
|
||||
monthList.addAll(monthOneList);
|
||||
monthList.addAll(monthTwoList);
|
||||
monthList.addAll(monthThreeList);
|
||||
|
||||
for (SltAgreementInfo sltAgreementInfo : monthList) {
|
||||
ProjectMonthCosts projectMonthCosts = new ProjectMonthCosts();
|
||||
|
|
|
|||
|
|
@ -634,7 +634,75 @@
|
|||
</select>
|
||||
|
||||
<insert id="insertSltFee">
|
||||
insert into project_temp_cost (agreement_id,type_id, lease_num, start_time,end_time, day, price, lease_money, cost_type, mark_time)
|
||||
values (#{agreementId}, #{typeId}, #{outNum}, #{startTime}, #{endTime}, #{day}, #{leasePrice}, #{leaseFee}, #{costType}, now())
|
||||
</insert>
|
||||
insert into project_temp_cost
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="leaseId != null">
|
||||
lease_id,
|
||||
</if>
|
||||
<if test="agreementId != null">
|
||||
agreement_id,
|
||||
</if>
|
||||
<if test="typeId != null">
|
||||
type_id,
|
||||
</if>
|
||||
<if test="outNum != null">
|
||||
lease_num,
|
||||
</if>
|
||||
<if test="startTime != null and startTime != ''">
|
||||
start_time,
|
||||
</if>
|
||||
<if test="endTime != null and endTime != ''">
|
||||
end_time,
|
||||
</if>
|
||||
<if test="days != null">
|
||||
day,
|
||||
</if>
|
||||
<if test="leasePrice != null">
|
||||
price,
|
||||
</if>
|
||||
<if test="leaseFee != null">
|
||||
lease_money,
|
||||
</if>
|
||||
<if test="costType != null">
|
||||
cost_type,
|
||||
</if>
|
||||
mark_time,
|
||||
</trim>
|
||||
values
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="leaseId != null">
|
||||
#{leaseId},
|
||||
</if>
|
||||
<if test="agreementId != null">
|
||||
#{agreementId},
|
||||
</if>
|
||||
<if test="typeId != null">
|
||||
#{typeId},
|
||||
</if>
|
||||
<if test="outNum != null">
|
||||
#{outNum},
|
||||
</if>
|
||||
<if test="startTime != null and startTime != ''">
|
||||
#{startTime},
|
||||
</if>
|
||||
<if test="endTime != null and endTime != ''">
|
||||
#{endTime},
|
||||
</if>
|
||||
<if test="days != null">
|
||||
#{days},
|
||||
</if>
|
||||
<if test="leasePrice != null">
|
||||
#{leasePrice},
|
||||
</if>
|
||||
<if test="leaseFee != null">
|
||||
#{leaseFee},
|
||||
</if>
|
||||
<if test="costType != null">
|
||||
#{costType},
|
||||
</if>
|
||||
now(),
|
||||
</trim>
|
||||
</insert>
|
||||
<!-- insert into project_temp_cost (agreement_id,type_id, lease_num, start_time,end_time, day, price, lease_money, cost_type, mark_time)-->
|
||||
<!-- values (#{agreementId}, #{typeId}, #{outNum}, #{startTime}, #{endTime}, #{day}, #{leasePrice}, #{leaseFee}, #{costType}, now())-->
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -552,7 +552,7 @@
|
|||
|
||||
<select id="getSlt" resultType="com.bonus.sgzb.app.domain.TmTask">
|
||||
SELECT
|
||||
id AS id
|
||||
id AS id,back_id AS backId
|
||||
FROM
|
||||
slt_agreement_info
|
||||
WHERE
|
||||
|
|
|
|||
|
|
@ -105,6 +105,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
bcd.back_num AS backNum,
|
||||
baif.back_person AS backPerson,
|
||||
bcd.create_time AS createTime,
|
||||
baif.back_time AS backTime,
|
||||
bpl.lot_name AS proName,
|
||||
bui.unit_name AS unitName,
|
||||
bcd.remark AS remark
|
||||
|
|
@ -139,7 +140,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
and bpl.lot_id = #{proId}
|
||||
</if>
|
||||
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
||||
AND bcd.create_time BETWEEN CONCAT(#{startTime}, ' 00:00:00') AND CONCAT(#{endTime}, ' 23:59:59')
|
||||
AND baif.back_time BETWEEN CONCAT(#{startTime}, ' 00:00:00') AND CONCAT(#{endTime}, ' 23:59:59')
|
||||
</if>
|
||||
<if test="agreementCode != null and agreementCode != ''">
|
||||
and bai.agreement_code like concat('%',#{agreementCode},'%')
|
||||
|
|
|
|||
|
|
@ -21,18 +21,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<select id="getLeaseRecordList" resultType="com.bonus.sgzb.material.domain.LeaseRecord">
|
||||
SELECT lod.id as id,
|
||||
mt2.type_name as typeName,
|
||||
mt.type_name as typeModelName,
|
||||
bai.agreement_code as agreementCode,
|
||||
mm.ma_code as maCode,
|
||||
mt.unit_name as unit,
|
||||
mt.manage_type as manageType,
|
||||
lod.out_num as preNum,
|
||||
lai.lease_person as leasePerson,
|
||||
lod.create_time as createTime,
|
||||
bpl.lot_name as proName,
|
||||
bui.unit_name as unitName,
|
||||
lod.push_notifications as pushNotifications
|
||||
mt2.type_name as typeName,
|
||||
mt.type_name as typeModelName,
|
||||
lai.code as leaseCode,
|
||||
mm.ma_code as maCode,
|
||||
mt.unit_name as unit,
|
||||
mt.manage_type as manageType,
|
||||
lod.out_num as preNum,
|
||||
lai.lease_person as leasePerson,
|
||||
lai.create_time as leaseTime,
|
||||
lod.create_time as createTime,
|
||||
bpl.lot_name as proName,
|
||||
bui.unit_name as unitName,
|
||||
lod.push_notifications as pushNotifications
|
||||
FROM lease_out_details lod
|
||||
LEFT JOIN lease_apply_info lai on lai.id = lod.parent_id
|
||||
LEFT JOIN tm_task_agreement tta on tta.task_id = lai.task_id
|
||||
|
|
@ -45,7 +46,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
-- LEFT JOIN sys_user su on su.user_id = lai.lease_person
|
||||
where 1 = 1
|
||||
<if test="keyWord != null and keyWord != ''">
|
||||
and (bai.agreement_code like concat('%',#{keyWord,jdbcType=VARCHAR},'%') or
|
||||
and (lai.code like concat('%',#{keyWord,jdbcType=VARCHAR},'%') or
|
||||
mm.ma_code like concat('%',#{keyWord,jdbcType=VARCHAR},'%') or
|
||||
mt.unit_name like concat('%',#{keyWord,jdbcType=VARCHAR},'%') or
|
||||
mt2.type_name like concat('%',#{keyWord,jdbcType=VARCHAR},'%') or
|
||||
|
|
|
|||
|
|
@ -726,6 +726,52 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
ORDER BY
|
||||
DATE_FORMAT( DATE_ADD( DATE( sai.start_time ), INTERVAL 1 - DAYOFMONTH( sai.start_time ) DAY ), '%Y-%m' )
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getLeaseListMonthThree" resultType="com.bonus.sgzb.base.api.domain.SltAgreementInfo">
|
||||
SELECT
|
||||
( CASE WHEN #{startTime} >= DATE( ptc.start_time ) THEN #{startTime} ELSE DATE( ptc.start_time ) END ) AS beginTime,
|
||||
(
|
||||
CASE
|
||||
|
||||
WHEN #{endTime} >= DATE( COALESCE ( ptc.end_time, CURDATE() ) ) THEN
|
||||
DATE(
|
||||
COALESCE (
|
||||
ptc.end_time,
|
||||
CURDATE())) ELSE #{endTime}
|
||||
END
|
||||
) AS offTime,
|
||||
GROUP_CONCAT(ptc.id) AS ids,
|
||||
ptc.agreement_id AS agreementId,
|
||||
bui.unit_name AS unitName,
|
||||
bui.unit_id AS unitId,
|
||||
bp.lot_name AS projectName,
|
||||
bp.lot_id AS lotId,
|
||||
DATE( ptc.start_time ) AS startTime,
|
||||
lai.cost_bearing_party AS costBearingParty,
|
||||
|
||||
DATE( COALESCE ( ptc.end_time, CURDATE() ) ) AS endTime
|
||||
FROM
|
||||
project_temp_cost ptc
|
||||
LEFT JOIN lease_apply_info lai ON lai.id = ptc.lease_id
|
||||
LEFT JOIN bm_agreement_info bai ON ptc.agreement_id = bai.agreement_id
|
||||
LEFT JOIN bm_project_lot bp ON bp.lot_id = bai.project_id
|
||||
LEFT JOIN bm_unit_info bui ON bui.unit_id = bai.unit_id
|
||||
LEFT JOIN ma_type mt ON ptc.type_id = mt.type_id
|
||||
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
|
||||
WHERE
|
||||
ptc.agreement_id = #{agreementId}
|
||||
AND lai.lease_type = 0
|
||||
|
||||
AND ptc.start_time <= #{endTime}
|
||||
AND (ptc.end_time >= #{startTime} OR ptc.end_time IS NULL)
|
||||
GROUP BY
|
||||
beginTime,offTime,lai.cost_bearing_party
|
||||
ORDER BY
|
||||
DATE_FORMAT( DATE_ADD( DATE( ptc.start_time ), INTERVAL 1 - DAYOFMONTH( ptc.start_time ) DAY ), '%Y-%m' )
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getPreScrapDetailsList" resultType="com.bonus.sgzb.base.api.domain.SltAgreementInfo">
|
||||
select tta.agreement_id as agreementId,
|
||||
bui.unit_name as unitName,
|
||||
|
|
|
|||
Loading…
Reference in New Issue