bug修复
This commit is contained in:
parent
b4666fa566
commit
c1e28938c9
|
|
@ -191,4 +191,6 @@ public class LeaseOutDetails implements Serializable {
|
|||
private int preStoreNum;
|
||||
/** 操作后库存 */
|
||||
private int postStoreNum;
|
||||
|
||||
private String token;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -235,4 +235,6 @@ public class SltAgreementInfo {
|
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private String endTimeTemp;
|
||||
|
||||
private int manageType;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ import org.apache.commons.lang3.StringUtils;
|
|||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -163,11 +164,11 @@ public class LeaseOutDetailsController extends BaseController {
|
|||
@Log(title = "领料出库", businessType = BusinessType.MATERIAL)
|
||||
//@PreventRepeatSubmit
|
||||
@PostMapping("/submitOutRfid")
|
||||
public AjaxResult submitOutRfid(@RequestBody List<LeaseOutDetails> recordList) {
|
||||
public AjaxResult submitOutRfid(@RequestBody List<LeaseOutDetails> recordList, HttpServletRequest request) {
|
||||
if (CollUtil.isEmpty(recordList)) {
|
||||
return AjaxResult.error("请选择要出库的机具");
|
||||
} else {
|
||||
return leaseOutDetailsService.submitOutRfid(recordList);
|
||||
return leaseOutDetailsService.submitOutRfid(recordList,request);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import com.bonus.sgzb.base.api.domain.LeaseOutDetails;
|
|||
import com.bonus.sgzb.base.api.domain.MaMachine;
|
||||
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -74,7 +75,7 @@ public interface LeaseOutDetailsService {
|
|||
*/
|
||||
List<LeaseApplyDetails> proUseRecord(LeaseApplyDetails bean);
|
||||
|
||||
AjaxResult submitOutRfid(List<LeaseOutDetails> recordList);
|
||||
AjaxResult submitOutRfid(List<LeaseOutDetails> recordList, HttpServletRequest request);
|
||||
|
||||
List<TmTask> getDetailsByApplyId(TmTask id);
|
||||
|
||||
|
|
|
|||
|
|
@ -24,8 +24,12 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
|
||||
|
|
@ -131,13 +135,60 @@ public class LeaseOutDetailsServiceImpl implements LeaseOutDetailsService {
|
|||
|
||||
@Override
|
||||
@Transactional
|
||||
public AjaxResult submitOutRfid(List<LeaseOutDetails> recordList) {
|
||||
public AjaxResult submitOutRfid(List<LeaseOutDetails> recordList,HttpServletRequest request) {
|
||||
HttpSession session = request.getSession();
|
||||
// 从请求头获取 token
|
||||
String headerToken = request.getHeader("X-Submit-Token");
|
||||
|
||||
if (headerToken == null || headerToken.isEmpty()) {
|
||||
return AjaxResult.error("缺少提交令牌");
|
||||
}
|
||||
|
||||
// 获取存储所有 token 处理状态的 Map
|
||||
Map<String, Boolean> tokenProcessedMap = (Map<String, Boolean>) session.getAttribute("X-Submit-Token-Processed-Map");
|
||||
if (tokenProcessedMap == null) {
|
||||
tokenProcessedMap = new HashMap<>();
|
||||
session.setAttribute("X-Submit-Token-Processed-Map", tokenProcessedMap);
|
||||
}
|
||||
|
||||
// 检查当前 token 是否已经处理过
|
||||
if (tokenProcessedMap.getOrDefault(headerToken, false)) {
|
||||
return AjaxResult.error("请不要重复提交");
|
||||
}
|
||||
|
||||
// 从 session 中获取 token
|
||||
String sessionToken = (String) session.getAttribute("X-Submit-Token-" + headerToken);
|
||||
if (sessionToken == null) {
|
||||
// 首次请求,将请求头中的 token 存入 session
|
||||
session.setAttribute("X-Submit-Token-" + headerToken, headerToken);
|
||||
sessionToken = headerToken;
|
||||
} else if (!sessionToken.equals(headerToken)) {
|
||||
// token 不匹配,判定为重复提交
|
||||
return AjaxResult.error("提交令牌不匹配,请不要重复提交");
|
||||
}
|
||||
|
||||
if (recordList.isEmpty() || recordList.get(0).getToken() == null) {
|
||||
return AjaxResult.error("请求参数中缺少提交令牌");
|
||||
}
|
||||
|
||||
// 获取传参中的 token
|
||||
String paramToken = recordList.get(0).getToken();
|
||||
|
||||
// 比较 session 中的 token 和传参中的 token
|
||||
if (!sessionToken.equals(paramToken)) {
|
||||
return AjaxResult.error("提交令牌不匹配,请不要重复提交");
|
||||
}
|
||||
|
||||
for (LeaseOutDetails bean : recordList) {
|
||||
AjaxResult ajaxResult = submitOut(bean);
|
||||
if (ajaxResult.isError()) {
|
||||
return ajaxResult;
|
||||
}
|
||||
}
|
||||
// 处理完成后移除 session 中的 token
|
||||
session.removeAttribute("X-Submit-Token-" + headerToken);
|
||||
// 标记当前 token 已处理
|
||||
tokenProcessedMap.put(headerToken, true);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ public class RepairTestInputController extends BaseController {
|
|||
|
||||
@ApiOperation(value = "获取修试后入库列表")
|
||||
@GetMapping("getRepairedList")
|
||||
@RequiresPermissions("warehousing:repair:list")
|
||||
@RequiresPermissions("warehousing:repair:view")
|
||||
public TableDataInfo getRepairedList(RepairTestInputDto dto){
|
||||
startPage();
|
||||
List<RepairTestInputVo> list = service.getRepairedList(dto);
|
||||
|
|
@ -43,7 +43,7 @@ public class RepairTestInputController extends BaseController {
|
|||
|
||||
@ApiOperation(value = "获取修试后入库列表")
|
||||
@PostMapping("getAppRepairedList")
|
||||
@RequiresPermissions("warehousing:repair:list")
|
||||
@RequiresPermissions("warehousing:repair:view")
|
||||
public AjaxResult getAppRepairedList(@Validated @RequestBody RepairTestInputDto dto){
|
||||
List<RepairTestInputVo> list = service.getRepairedList(dto);
|
||||
return AjaxResult.success(list);
|
||||
|
|
|
|||
|
|
@ -107,9 +107,15 @@ public class SltAgreementInfoController extends BaseController {
|
|||
*/
|
||||
// @RequiresPermissions("month:record:query")
|
||||
@ApiOperation(value = "根据协议获取月结算清单")
|
||||
@PostMapping("/getSltInfoMonth")
|
||||
public AjaxResult getSltInfoMonth(@RequestBody List<AgreementInfo> list) {
|
||||
return AjaxResult.success(sltAgreementInfoService.getSltInfoMonth(list));
|
||||
@GetMapping("/getSltInfoMonth")
|
||||
public AjaxResult getSltInfoMonth(AgreementInfo info) {
|
||||
List<AgreementInfo> list = new ArrayList<>();
|
||||
list.add(info);
|
||||
List result = sltAgreementInfoService.getSltInfoMonth(list);
|
||||
if (!result.isEmpty() && result.get(0) instanceof AjaxResult) {
|
||||
return (AjaxResult) result.get(0);
|
||||
}
|
||||
return AjaxResult.success(result);
|
||||
}
|
||||
|
||||
// @RequiresPermissions("cost:settlement:export")
|
||||
|
|
@ -920,21 +926,21 @@ public class SltAgreementInfoController extends BaseController {
|
|||
// 关闭写入器
|
||||
excelWriter.finish();
|
||||
}
|
||||
// @GetMapping("/taskCycle")
|
||||
// public void taskCycle() {
|
||||
// System.out.println("===springMVC定时器启动====");
|
||||
// try {
|
||||
//
|
||||
//// if (com.bonus.sgzb.common.core.utils.StringUtils.isEmpty(settlementJobDay)) {
|
||||
//// calcMonthlyService.calcMonthInfo(1);
|
||||
//// } else {
|
||||
//// int calDay = Integer.parseInt(settlementJobDay);
|
||||
// calcMonthlyService.calcMonthInfo(30);
|
||||
//// }
|
||||
//
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// System.out.println("===springMVC定时器结束====");
|
||||
// }
|
||||
@GetMapping("/taskCycle")
|
||||
public void taskCycle() {
|
||||
System.out.println("===springMVC定时器启动====");
|
||||
try {
|
||||
|
||||
// if (com.bonus.sgzb.common.core.utils.StringUtils.isEmpty(settlementJobDay)) {
|
||||
// calcMonthlyService.calcMonthInfo(1);
|
||||
// } else {
|
||||
// int calDay = Integer.parseInt(settlementJobDay);
|
||||
calcMonthlyService.calcMonthInfo(30);
|
||||
// }
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
System.out.println("===springMVC定时器结束====");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,6 +70,10 @@ public interface SltAgreementInfoMapper {
|
|||
|
||||
List<SltAgreementInfo> getLeaseListMonthNotNull(AgreementInfo bean);
|
||||
|
||||
List<SltAgreementInfo> getLeaseListMonthOne(AgreementInfo bean);
|
||||
|
||||
List<SltAgreementInfo> getLeaseListMonthTwo(AgreementInfo bean);
|
||||
|
||||
List<SltAgreementInfo> getPreScrapDetailsList(@Param("taskList") List<TmTask> taskList);
|
||||
|
||||
int updateOutSourceCosts(SltAgreementInfo sltAgreementInfo);
|
||||
|
|
|
|||
|
|
@ -88,9 +88,16 @@ public class CalcMonthlyServiceImp implements CalcMonthlyService {
|
|||
calMonthlyMapper.insertCalcRecord(record);
|
||||
String taskId = record.getId();
|
||||
for (AgreementInfo bean : list) {
|
||||
|
||||
|
||||
if (StringUtils.isNotBlank(bean.getStartTime()) && StringUtils.isNotBlank(bean.getEndTime())) {
|
||||
List<SltAgreementInfo> monthList = sltAgreementInfoMapper.getLeaseListMonthNotNull(bean);
|
||||
monthList.stream().filter(Objects::nonNull);
|
||||
List<SltAgreementInfo> monthOneList = sltAgreementInfoMapper.getLeaseListMonthOne(bean);
|
||||
List<SltAgreementInfo> monthTwoList = sltAgreementInfoMapper.getLeaseListMonthTwo(bean);
|
||||
monthOneList.stream().filter(Objects::nonNull);
|
||||
monthTwoList.stream().filter(Objects::nonNull);
|
||||
List<SltAgreementInfo> monthList = new ArrayList<>();
|
||||
monthList.addAll(monthOneList);
|
||||
monthList.addAll(monthTwoList);
|
||||
|
||||
for (SltAgreementInfo sltAgreementInfo : monthList) {
|
||||
ProjectMonthCosts projectMonthCosts = new ProjectMonthCosts();
|
||||
|
|
|
|||
|
|
@ -509,9 +509,11 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService {
|
|||
//租赁费用列表
|
||||
for (AgreementInfo agreementInfo : list) {
|
||||
// 如果选择了最新月份则需要查数据
|
||||
if (StringUtils.isNotBlank(agreementInfo.getStartTime()) && StringUtils.isNotBlank(agreementInfo.getEndTime()) && DateTimeHelper.getNowMonth().equals(DateTimeHelper.getNowMonth(DateTimeHelper.parse(agreementInfo.getEndTime(), "yyyy-MM")))) {
|
||||
List<SltAgreementInfo> listMonth = getLeaseListMonth(agreementInfo, num);
|
||||
leaseListMonth.addAll(listMonth);
|
||||
if (StringUtils.isNotBlank(agreementInfo.getStartTime()) && StringUtils.isNotBlank(agreementInfo.getEndTime())
|
||||
&& DateTimeHelper.getNowMonth().compareTo(DateTimeHelper.getNowMonth(DateTimeHelper.parse(agreementInfo.getStartTime(), "yyyy-MM"))) <= 0) {
|
||||
// List<SltAgreementInfo> listMonth = getLeaseListMonth(agreementInfo, num);
|
||||
// leaseListMonth.addAll(listMonth);
|
||||
return Collections.singletonList(new AjaxResult(500, "当前月暂未结算"));
|
||||
} else {
|
||||
// 如果不传日期或传以往日期 则查定时任务记录的数据
|
||||
List<SltAgreementInfo> listMonth = getLeaseJobListMonth(agreementInfo);
|
||||
|
|
@ -533,7 +535,30 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService {
|
|||
monthCost.setCodeNum(num++);
|
||||
for (String id : monthCost.getIds().split(",")) {
|
||||
monthCost.setId(Long.parseLong(id));
|
||||
monthDetails.addAll(calMonthlyMapper.getMonthDetails(monthCost));
|
||||
List<SltAgreementInfo> details = calMonthlyMapper.getMonthDetails(monthCost);
|
||||
// 合并相同typeId、manageType=0、startTime和endTime相同的数据
|
||||
Map<String, SltAgreementInfo> mergedMap = new HashMap<>();
|
||||
for (SltAgreementInfo detail : details) {
|
||||
String key = detail.getTypeId() + "_" + detail.getStartTime() + "_" + detail.getEndTime();
|
||||
|
||||
if (detail.getManageType() == 0 && mergedMap.containsKey(key)) {
|
||||
SltAgreementInfo mergedDetail = mergedMap.get(key);
|
||||
// 数量相加
|
||||
mergedDetail.setNum(mergedDetail.getNum() + detail.getNum());
|
||||
// 费用相加
|
||||
mergedDetail.setCosts(mergedDetail.getCosts().add(detail.getCosts()));
|
||||
// 实际费用相加
|
||||
mergedDetail.setRealCosts(mergedDetail.getRealCosts().add(detail.getRealCosts()));
|
||||
// 备注相加
|
||||
if (detail.getRemark() != null && !detail.getRemark().isEmpty()) {
|
||||
mergedDetail.setRemark(mergedDetail.getRemark() + "、" + detail.getRemark());
|
||||
}
|
||||
} else {
|
||||
mergedMap.put(key, detail);
|
||||
}
|
||||
}
|
||||
monthDetails.addAll(new ArrayList<>(mergedMap.values()));
|
||||
// monthDetails.addAll(calMonthlyMapper.getMonthDetails(monthCost));
|
||||
}
|
||||
monthCost.setNode(monthDetails);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -758,7 +758,6 @@
|
|||
IFNULL(aa.back_num,0) as in_completed_back_num,
|
||||
IFNULL(bb.finished_back_num, 0) as finished_back_num,
|
||||
mt.manage_type as manageType,
|
||||
mtk.user_id,
|
||||
CONCAT('NSJJ',mt.`code`,mt.model_code) as `code`,
|
||||
bad.remark as remark
|
||||
FROM
|
||||
|
|
@ -769,7 +768,6 @@
|
|||
group by agreement_id,type_id) sai on tta.agreement_id=sai.agreement_id and sai.type_id=bad.type_id
|
||||
LEFT JOIN ma_type mt on mt.type_id=bad.type_id
|
||||
LEFT JOIN ma_type mt2 ON mt2.type_id=mt.parent_id
|
||||
LEFT JOIN ma_type_keeper mtk on mt.type_id=mtk.type_id
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
type_id as typeId,
|
||||
|
|
|
|||
|
|
@ -1312,11 +1312,9 @@
|
|||
LEFT JOIN bm_project_lot bpl ON bpl.lot_id = bai.project_id
|
||||
LEFT JOIN bm_unit_info bui ON bui.unit_id = bai.unit_id
|
||||
LEFT JOIN lease_apply_details lad on lai.id = lad.parennt_id
|
||||
LEFT JOIN ma_type_keeper mtk on lad.type_id = mtk.type_id
|
||||
|
||||
WHERE tt.task_status in(33,34,35)
|
||||
<if test="userId != 1">
|
||||
and mtk.user_id = #{userId}
|
||||
</if>
|
||||
|
||||
<if test="code != null and code != ''">
|
||||
and tt.code like concat('%', #{code}, '%')
|
||||
</if>
|
||||
|
|
|
|||
|
|
@ -117,12 +117,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
LEFT JOIN ma_type mt ON mt.type_id = bcd.type_id
|
||||
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
|
||||
LEFT JOIN ma_machine mm ON mm.ma_id = bcd.ma_id
|
||||
-- LEFT JOIN sys_user su ON su.user_id = baif.back_person
|
||||
where 1 = 1
|
||||
<if test="keyWord != null and keyWord != ''">
|
||||
and (baif.`code` like concat('%',#{keyWord},'%') or
|
||||
mm.ma_code like concat('%',#{keyWord},'%') or
|
||||
su.nick_name like concat('%',#{keyWord},'%'))
|
||||
and (baif.`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
|
||||
mt.type_name like concat('%',#{keyWord,jdbcType=VARCHAR},'%'))
|
||||
</if>
|
||||
<if test="typeName != null and typeName != ''">
|
||||
and mt2.type_name like concat('%',#{typeName},'%')
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
LEFT JOIN bm_unit_info bui ON bui.unit_id = bai.unit_id
|
||||
WHERE 1=1
|
||||
<if test="endTime != null and endTime != ''">
|
||||
and spm.month = #{endTime}
|
||||
and spm.month = DATE_FORMAT(#{endTime}, '%Y-%m')
|
||||
</if>
|
||||
AND pmc.agreement_id = #{agreementId}
|
||||
<if test="costBearingParty != null and costBearingParty != ''">
|
||||
|
|
@ -53,6 +53,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</select>
|
||||
<select id="getMonthDetails" resultType="com.bonus.sgzb.base.api.domain.SltAgreementInfo">
|
||||
SELECT
|
||||
mt.type_id as typeId,
|
||||
mt1.type_name AS typeName,
|
||||
mt.type_name AS modelName,
|
||||
bui.unit_name AS unitName,
|
||||
|
|
@ -67,7 +68,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
pmd.slt_days as leaseDays,
|
||||
pmd.slt_costs as costs,
|
||||
pmd.month_temporarily_costs as realCosts,
|
||||
pmd.remark as remark
|
||||
pmd.remark as remark,
|
||||
mt.manage_type as manageType
|
||||
FROM
|
||||
project_month_detail pmd
|
||||
LEFT JOIN project_month_costs pmc ON pmd.pro_month_cost_id = pmc.id
|
||||
|
|
|
|||
|
|
@ -45,10 +45,11 @@ 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},'%') or
|
||||
mm.ma_code like concat('%',#{keyWord},'%') or
|
||||
mt.unit_name like concat('%',#{keyWord},'%') or
|
||||
su.nick_name like concat('%',#{keyWord},'%'))
|
||||
and (bai.agreement_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
|
||||
mt.type_name like concat('%',#{keyWord,jdbcType=VARCHAR},'%'))
|
||||
</if>
|
||||
<if test="typeName != null and typeName != ''">
|
||||
and mt2.type_name like concat('%',#{typeName},'%')
|
||||
|
|
|
|||
|
|
@ -232,7 +232,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
left join ma_supplier_info msi on pcd.supplier_id = msi.supplier_id
|
||||
left join tm_task tk on pcd.task_id = tk.task_id
|
||||
where 1=1
|
||||
and pcd.check_result='通过'
|
||||
-- and pcd.check_result='通过'
|
||||
-- and pcd.status !=3
|
||||
-- AND (
|
||||
-- (pcd.bind_num IS NULL OR pcd.bind_num = 0) AND pcd.STATUS != 5
|
||||
|
|
|
|||
|
|
@ -628,6 +628,104 @@ 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="getLeaseListMonthOne" resultType="com.bonus.sgzb.base.api.domain.SltAgreementInfo">
|
||||
SELECT
|
||||
( CASE WHEN #{startTime} >= DATE( sai.start_time ) THEN #{startTime} ELSE DATE( sai.start_time ) END ) AS beginTime,
|
||||
(
|
||||
CASE
|
||||
|
||||
WHEN #{endTime} >= DATE( COALESCE ( sai.end_time, CURDATE() ) ) THEN
|
||||
DATE(
|
||||
COALESCE (
|
||||
sai.end_time,
|
||||
CURDATE())) ELSE #{endTime}
|
||||
END
|
||||
) AS offTime,
|
||||
GROUP_CONCAT(sai.id) AS ids,
|
||||
sai.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( sai.start_time ) AS startTime,
|
||||
lai.cost_bearing_party AS costBearingParty,
|
||||
IF (
|
||||
sai.replace_type_id > 0,
|
||||
'以大代小',
|
||||
''
|
||||
) AS remark,
|
||||
DATE( COALESCE ( sai.end_time, CURDATE() ) ) AS endTime
|
||||
FROM
|
||||
slt_agreement_info sai
|
||||
LEFT JOIN lease_apply_info lai ON lai.id = sai.lease_id
|
||||
LEFT JOIN bm_agreement_info bai ON sai.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 sai.type_id = mt.type_id
|
||||
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
|
||||
WHERE
|
||||
sai.agreement_id = #{agreementId}
|
||||
AND sai.lease_type = 0
|
||||
|
||||
AND lai.cost_bearing_party = '01'
|
||||
|
||||
AND sai.start_time <= #{endTime}
|
||||
AND (sai.end_time >= #{startTime} OR sai.end_time IS NULL)
|
||||
GROUP BY
|
||||
beginTime,offTime,lai.cost_bearing_party
|
||||
ORDER BY
|
||||
DATE_FORMAT( DATE_ADD( DATE( sai.start_time ), INTERVAL 1 - DAYOFMONTH( sai.start_time ) DAY ), '%Y-%m' )
|
||||
</select>
|
||||
|
||||
<select id="getLeaseListMonthTwo" resultType="com.bonus.sgzb.base.api.domain.SltAgreementInfo">
|
||||
SELECT
|
||||
( CASE WHEN #{startTime} >= DATE( sai.start_time ) THEN #{startTime} ELSE DATE( sai.start_time ) END ) AS beginTime,
|
||||
(
|
||||
CASE
|
||||
|
||||
WHEN #{endTime} >= DATE( COALESCE ( sai.end_time, CURDATE() ) ) THEN
|
||||
DATE(
|
||||
COALESCE (
|
||||
sai.end_time,
|
||||
CURDATE())) ELSE #{endTime}
|
||||
END
|
||||
) AS offTime,
|
||||
GROUP_CONCAT(sai.id) AS ids,
|
||||
sai.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( sai.start_time ) AS startTime,
|
||||
lai.cost_bearing_party AS costBearingParty,
|
||||
IF (
|
||||
sai.replace_type_id > 0,
|
||||
'以大代小',
|
||||
''
|
||||
) AS remark,
|
||||
DATE( COALESCE ( sai.end_time, CURDATE() ) ) AS endTime
|
||||
FROM
|
||||
slt_agreement_info sai
|
||||
LEFT JOIN lease_apply_info lai ON lai.id = sai.lease_id
|
||||
LEFT JOIN bm_agreement_info bai ON sai.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 sai.type_id = mt.type_id
|
||||
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
|
||||
WHERE
|
||||
sai.agreement_id = #{agreementId}
|
||||
AND sai.lease_type = 0
|
||||
|
||||
AND lai.cost_bearing_party = '03'
|
||||
|
||||
AND sai.start_time <= #{endTime}
|
||||
AND (sai.end_time >= #{startTime} OR sai.end_time IS NULL)
|
||||
GROUP BY
|
||||
beginTime,offTime,lai.cost_bearing_party
|
||||
ORDER BY
|
||||
DATE_FORMAT( DATE_ADD( DATE( sai.start_time ), INTERVAL 1 - DAYOFMONTH( sai.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