Merge branch 'master' of http://36.33.26.201:3000/bonus/Bonus-Cloud-Material
This commit is contained in:
commit
a94f01e29b
|
|
@ -23,18 +23,22 @@ public class MaterialSltInfoVo {
|
|||
* 结算工程
|
||||
*/
|
||||
private String projectName;
|
||||
|
||||
/**
|
||||
* 租赁费用列表
|
||||
*/
|
||||
List<MaterialSltAgreementInfo> leaseList;
|
||||
|
||||
/**
|
||||
* 维修费用列表
|
||||
*/
|
||||
List<MaterialSltAgreementInfo> repairList;
|
||||
|
||||
/**
|
||||
* 报废费用列表
|
||||
*/
|
||||
List<MaterialSltAgreementInfo> scrapList;
|
||||
|
||||
/**
|
||||
* 丢失费用列表
|
||||
*/
|
||||
|
|
@ -90,6 +94,7 @@ public class MaterialSltInfoVo {
|
|||
@Excel(name = "创建时间", dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
@ApiModelProperty(value = "更新人")
|
||||
private String updateBy;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
|
|
|
|||
|
|
@ -35,12 +35,12 @@ public interface ClzSltAgreementInfoMapper {
|
|||
/**
|
||||
* 更新协议结算状态
|
||||
*/
|
||||
int updateClzSltInfoByIds(@Param("agreementIds") List<Long> agreementIds);
|
||||
int updateClzAgreementInfoByIds(@Param("agreementIds") List<Long> agreementIds);
|
||||
|
||||
/**
|
||||
* 更新协议明细表状态
|
||||
*/
|
||||
int updateClzSltDetailsByIds(@Param("agreementIds") List<Long> agreementIds);
|
||||
int updateClzSltInfoByIds(@Param("agreementIds") List<Long> agreementIds);
|
||||
|
||||
/**
|
||||
* 查询结算审批列表
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ public class ClzSltAgreementInfoServiceImpl implements ClzSltAgreementInfoServic
|
|||
* @param sltAgreementApply
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult costExamine(SltAgreementApply sltAgreementApply) {
|
||||
if (Objects.isNull(sltAgreementApply) || Objects.isNull(sltAgreementApply.getStatus())) {
|
||||
return AjaxResult.error("结算信息为空,请刷新后重试!");
|
||||
|
|
@ -82,18 +83,19 @@ public class ClzSltAgreementInfoServiceImpl implements ClzSltAgreementInfoServic
|
|||
} else if (Objects.equals(REVIEW_PASS, sltAgreementApply.getStatus())) {
|
||||
// 通过,更新slt_apply协议审批状态
|
||||
int examNum = clzSltAgreementInfoMapper.costExame(sltAgreementApply);
|
||||
if (examNum == GlobalConstants.INT_0) {
|
||||
if (examNum <= 0) {
|
||||
return AjaxResult.error("结算审批失败");
|
||||
} else {
|
||||
// 更新结算协议表及相关信息
|
||||
clzSltAgreementInfoMapper.updateClzAgreementInfoByIds(idsBySltApplyCode);
|
||||
clzSltAgreementInfoMapper.updateClzSltInfoByIds(idsBySltApplyCode);
|
||||
clzSltAgreementInfoMapper.updateClzSltDetailsByIds(idsBySltApplyCode);
|
||||
return AjaxResult.success();
|
||||
return AjaxResult.success("审批完成");
|
||||
}
|
||||
} else {
|
||||
return AjaxResult.error("审批错误,状态码错误");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.err.println("结算审批失败,失败原因:" + e.getMessage());
|
||||
return AjaxResult.error();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -107,9 +107,9 @@ public class IwsCostPushController extends BaseController {
|
|||
|
||||
// 计算统计信息
|
||||
BigDecimal totalLeaseMoney = exportVoList.stream().map(IwsCostPushExportVo::getLeaseMoney).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
BigDecimal totalRepairMoney = exportVoList.stream().map(IwsCostPushExportVo::getRepairMoney).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
BigDecimal totalLostMoney = exportVoList.stream().map(IwsCostPushExportVo::getLostMoney).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
BigDecimal totalScrapMoney = exportVoList.stream().map(IwsCostPushExportVo::getScrapMoney).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
// BigDecimal totalRepairMoney = exportVoList.stream().map(IwsCostPushExportVo::getRepairMoney).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
// BigDecimal totalLostMoney = exportVoList.stream().map(IwsCostPushExportVo::getLostMoney).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
// BigDecimal totalScrapMoney = exportVoList.stream().map(IwsCostPushExportVo::getScrapMoney).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
|
||||
// 创建统计行
|
||||
IwsCostPushExportVo summaryVo = new IwsCostPushExportVo();
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ import com.bonus.common.core.web.page.TableDataInfo;
|
|||
@RestController
|
||||
@RequestMapping("/slt_agreement_apply")
|
||||
public class SltAgreementApplyController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private ISltAgreementApplyService sltAgreementApplyService;
|
||||
|
||||
|
|
@ -49,20 +50,6 @@ public class SltAgreementApplyController extends BaseController {
|
|||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出结算协议申请列表
|
||||
*/
|
||||
@ApiOperation(value = "导出结算协议申请列表")
|
||||
@PreventRepeatSubmit
|
||||
@RequiresPermissions("settlement:apply:export")
|
||||
@SysLog(title = "结算协议申请", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出结算协议申请")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, SltAgreementApply sltAgreementApply) {
|
||||
List<SltAgreementApply> list = sltAgreementApplyService.selectSltAgreementApplyList(sltAgreementApply);
|
||||
ExcelUtil<SltAgreementApply> util = new ExcelUtil<SltAgreementApply>(SltAgreementApply.class);
|
||||
util.exportExcel(response, list, "结算协议申请数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取结算协议申请详细信息
|
||||
*/
|
||||
|
|
@ -116,4 +103,18 @@ public class SltAgreementApplyController extends BaseController {
|
|||
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||
return toAjax(sltAgreementApplyService.deleteSltAgreementApplyByIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出结算协议申请列表
|
||||
*/
|
||||
@ApiOperation(value = "导出结算协议申请列表")
|
||||
@PreventRepeatSubmit
|
||||
@RequiresPermissions("settlement:apply:export")
|
||||
@SysLog(title = "结算协议申请", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出结算协议申请")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, SltAgreementApply sltAgreementApply) {
|
||||
List<SltAgreementApply> list = sltAgreementApplyService.selectSltAgreementApplyList(sltAgreementApply);
|
||||
ExcelUtil<SltAgreementApply> util = new ExcelUtil<>(SltAgreementApply.class);
|
||||
util.exportExcel(response, list, "结算协议申请数据");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,10 +71,10 @@ public class SltAgreementInfoController extends BaseController {
|
|||
@Autowired
|
||||
private ISltAgreementInfoService sltAgreementInfoService;
|
||||
|
||||
@Autowired
|
||||
@Resource
|
||||
private SltAgreementInfoMapper sltAgreementInfoMapper;
|
||||
|
||||
@Autowired
|
||||
@Resource
|
||||
private TmTaskMapper taskMapper;
|
||||
|
||||
@Resource
|
||||
|
|
@ -197,14 +197,11 @@ public class SltAgreementInfoController extends BaseController {
|
|||
return AjaxResult.success(bean);
|
||||
}
|
||||
|
||||
public SltInfoVo mergerData(SltInfoVo vo,List<SltInfoVo> list,List<String> unitNames,List<String> projectNames){
|
||||
public SltInfoVo mergerData(SltInfoVo vo,List<SltInfoVo> list, List<String> unitNames, List<String> projectNames) {
|
||||
vo.setUnitName(handleData(unitNames));
|
||||
vo.setProjectName(handleData(projectNames));
|
||||
BigDecimal leaseCost = BigDecimal.valueOf(0.00);
|
||||
BigDecimal repairCost = BigDecimal.valueOf(0.00);
|
||||
BigDecimal scrapCost = BigDecimal.valueOf(0.00);
|
||||
BigDecimal loseCost = BigDecimal.valueOf(0.00);
|
||||
BigDecimal reducCost = BigDecimal.valueOf(0.00);
|
||||
BigDecimal leaseCost = BigDecimal.ZERO, repairCost = BigDecimal.ZERO, scrapCost = BigDecimal.ZERO;;
|
||||
BigDecimal loseCost = BigDecimal.ZERO, reducCost = BigDecimal.ZERO;
|
||||
//租赁费用列表
|
||||
List<SltAgreementInfo> leaseList = new ArrayList<>();
|
||||
//维修费用列表
|
||||
|
|
@ -1426,10 +1423,10 @@ public class SltAgreementInfoController extends BaseController {
|
|||
public AjaxResult submitCosts(@RequestBody SltInfoVo sltInfoVo) {
|
||||
return toAjax(sltAgreementInfoService.submitCosts(sltInfoVo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 维修单据查询
|
||||
*/
|
||||
|
||||
@ApiOperation(value = "维修报表list查询")
|
||||
@GetMapping("/viewRepairCode")
|
||||
public TableDataInfo viewRepairCode(SltAgreementInfo bean) {
|
||||
|
|
@ -1499,7 +1496,6 @@ public class SltAgreementInfoController extends BaseController {
|
|||
@ApiOperation(value = "未结算报表list查询")
|
||||
@GetMapping("/getSltReportList")
|
||||
public TableDataInfo getSltReportList(SltAgreementInfo query) {
|
||||
long startTime = System.currentTimeMillis();
|
||||
try {
|
||||
// 参数预处理和校验
|
||||
if (query == null) {
|
||||
|
|
@ -1514,7 +1510,6 @@ public class SltAgreementInfoController extends BaseController {
|
|||
if (CollectionUtils.isEmpty(list)) {
|
||||
return getDataTable(new ArrayList<>());
|
||||
}
|
||||
|
||||
log.info("查询到未结算协议数量: {}", list.size());
|
||||
|
||||
// ----------- 给查询出来的协议设置权限控制(例如只查询工器具) ---------------
|
||||
|
|
@ -1558,8 +1553,6 @@ public class SltAgreementInfoController extends BaseController {
|
|||
// && CollectionUtils.isEmpty(vo.getLoseList())
|
||||
// );
|
||||
|
||||
long endTime = System.currentTimeMillis();
|
||||
log.info("未结算报表查询完成,耗时: {}ms,返回数据: {}条", (endTime - startTime), dataList.size());
|
||||
|
||||
TableDataInfo resultTableData = getDataTable(dataList);
|
||||
if (RequestContext.get("unSltAgreementListCount") != null) {
|
||||
|
|
|
|||
|
|
@ -16,11 +16,10 @@ import org.apache.poi.ss.usermodel.HorizontalAlignment;
|
|||
* @author xsheng
|
||||
* @date 2024-10-16
|
||||
*/
|
||||
|
||||
|
||||
@Data
|
||||
@ToString
|
||||
public class SltAgreementApply extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** $column.columnComment */
|
||||
|
|
@ -35,7 +34,8 @@ public class SltAgreementApply extends BaseEntity {
|
|||
private String code;
|
||||
|
||||
/** 结算类型 1工器具 2安全工器具 */
|
||||
private Byte settlementType;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Integer settlementType;
|
||||
|
||||
/**
|
||||
* 是否结算 0未结算 1结算完成 2部分结算
|
||||
|
|
|
|||
|
|
@ -23,6 +23,12 @@ import org.apache.ibatis.annotations.Param;
|
|||
* @date 2024-10-16
|
||||
*/
|
||||
public interface SltAgreementInfoMapper {
|
||||
|
||||
/**
|
||||
* 根据协议ID+结算类型去更新对应的费用明细
|
||||
*/
|
||||
int updateSltInfoByAgreementIdType(SltAgreementInfo sltAgreementInfo);
|
||||
|
||||
/**
|
||||
* 查询结算信息
|
||||
*
|
||||
|
|
@ -237,6 +243,11 @@ public interface SltAgreementInfoMapper {
|
|||
*/
|
||||
int costExame(SltAgreementApply sltAgreementApply);
|
||||
|
||||
|
||||
/**
|
||||
* 删除结算明细
|
||||
* @param sltAgreementApply 结算申请单
|
||||
*/
|
||||
void costDeleteDetail(SltAgreementApply sltAgreementApply);
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ import com.bonus.material.settlement.domain.SltAgreementApply;
|
|||
import com.bonus.material.settlement.domain.SltAgreementReduce;
|
||||
import com.bonus.material.settlement.domain.SltAgreementRelation;
|
||||
import com.bonus.material.settlement.domain.vo.SltInfoVo;
|
||||
import com.bonus.material.settlement.mapper.SltAgreementApplyMapper;
|
||||
import com.bonus.material.settlement.mapper.SltAgreementReduceMapper;
|
||||
import com.bonus.material.task.domain.TmTask;
|
||||
import com.bonus.material.task.mapper.TmTaskMapper;
|
||||
|
|
@ -74,16 +75,25 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService {
|
|||
// 安全工器具结算类型settlement_type键值
|
||||
private static final int SAFETY_EQUIPMENT_SETTLEMENT_TYPE = GlobalConstants.INT_2;
|
||||
|
||||
@Autowired
|
||||
// 结算审核通过
|
||||
private static final String REVIEW_PASS = "2";
|
||||
|
||||
// 结算审核驳回
|
||||
private static final String REVIEW_REJECT = "3";
|
||||
|
||||
@Resource
|
||||
private SltAgreementInfoMapper sltAgreementInfoMapper;
|
||||
|
||||
@Autowired
|
||||
@Resource
|
||||
private BmAgreementInfoMapper bmAgreementInfoMapper;
|
||||
|
||||
@Autowired
|
||||
@Resource
|
||||
private SltAgreementApplyMapper sltAgreementApplyMapper;
|
||||
|
||||
@Resource
|
||||
private BmConfigMapper bmConfigMapper;
|
||||
|
||||
@Autowired
|
||||
@Resource
|
||||
private TmTaskMapper taskMapper;
|
||||
|
||||
@Resource
|
||||
|
|
@ -227,12 +237,12 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService {
|
|||
}
|
||||
}
|
||||
for (SltAgreementInfo lose : loseList) {
|
||||
if(lose.getCosts()!=null){
|
||||
if (lose.getCosts() != null) {
|
||||
loseCost = loseCost.add(lose.getCosts());
|
||||
}
|
||||
}
|
||||
for (SltAgreementReduce reduction : reductionList) {
|
||||
if(reduction.getLeaseMoney()!=null){
|
||||
if (reduction.getLeaseMoney() != null) {
|
||||
reducCost = reducCost.add(reduction.getLeaseMoney());
|
||||
}
|
||||
}
|
||||
|
|
@ -642,6 +652,7 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService {
|
|||
throw new ServiceException("协议id错误");
|
||||
}
|
||||
|
||||
// 查询【待审核】+【审核通过】的结算单数量
|
||||
int theSettledCount = sltAgreementInfoMapper.selectTheSettledCountByAgreementIdType(sltInfoVo.getSettlementType(), agreementId);
|
||||
if (sltInfoVo.getAgreementIds().length <= 1) {
|
||||
// 如果不是批量提交,已结算的费用类型就直接提示已结算
|
||||
|
|
@ -804,7 +815,7 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService {
|
|||
public List<SltAgreementInfo> getSltList(SltAgreementInfo bean) {
|
||||
List<SltAgreementInfo> list = sltAgreementInfoMapper.getSltList(bean);
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
for (SltAgreementInfo row : list){
|
||||
for (SltAgreementInfo row : list) {
|
||||
SltInfoVo sltInfoVo;
|
||||
sltInfoVo = getSltInfo(row);
|
||||
if (sltInfoVo != null) {
|
||||
|
|
@ -959,41 +970,74 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService {
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult costExamine(SltAgreementApply sltAgreementApply) {
|
||||
if (Objects.isNull(sltAgreementApply) || Objects.isNull(sltAgreementApply.getStatus())) {
|
||||
return AjaxResult.error("结算信息为空,请刷新后重试!");
|
||||
}
|
||||
try {
|
||||
Long userid = SecurityUtils.getLoginUser().getUserid();
|
||||
sltAgreementApply.setAuditor(String.valueOf(userid));
|
||||
sltAgreementApply.setAuditor(String.valueOf(SecurityUtils.getLoginUser().getUserid()));
|
||||
sltAgreementApply.setAuditTime(DateUtils.getNowDate());
|
||||
sltAgreementApply.setUpdateTime(DateUtils.getNowDate());
|
||||
if (sltAgreementApply.getStatus().equals("3")) {
|
||||
// 驳回,更新slt协议审批状态
|
||||
int count = sltAgreementInfoMapper.costExame(sltAgreementApply);
|
||||
|
||||
if (Objects.equals(REVIEW_REJECT, sltAgreementApply.getStatus())) {
|
||||
// 驳回,更新slt_apply协议审批状态
|
||||
int updateNum = sltAgreementInfoMapper.costExame(sltAgreementApply);
|
||||
// 删除结算详情
|
||||
sltAgreementInfoMapper.costDeleteDetail(sltAgreementApply);
|
||||
if (count != 1) {
|
||||
if (updateNum != GlobalConstants.INT_1) {
|
||||
return AjaxResult.error("结算审批失败");
|
||||
} else {
|
||||
// 更新协议状态
|
||||
// 获取已审核和待审核的条数
|
||||
int beforeSettlementCount = sltAgreementInfoMapper.getBeforeSettlementCount(new SltInfoVo().setAgreementId(sltAgreementApply.getAgreementId()));
|
||||
// 根据待审核+已审核的数量来决定更新到哪种状态
|
||||
sltAgreementApply.setIsSlt(beforeSettlementCount > GlobalConstants.INT_0 ? GlobalConstants.INT_2 : GlobalConstants.INT_0);
|
||||
int countTwo = sltAgreementInfoMapper.updateBmAgreementReject(sltAgreementApply);
|
||||
if(countTwo != GlobalConstants.INT_1) {
|
||||
if (countTwo != GlobalConstants.INT_1) {
|
||||
return AjaxResult.error("bm_agreement_info修改失败");
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
} else {
|
||||
//通过
|
||||
int count = sltAgreementInfoMapper.costExame(sltAgreementApply);
|
||||
if (count == GlobalConstants.INT_0) {
|
||||
} else if (Objects.equals(REVIEW_PASS, sltAgreementApply.getStatus())) {
|
||||
// 根据ID查询settlement_type
|
||||
SltAgreementApply sltAgreementApplyFromDb = sltAgreementApplyMapper.selectSltAgreementApplyById(sltAgreementApply.getId());
|
||||
if (sltAgreementApplyFromDb == null || sltAgreementApplyFromDb.getSettlementType() == null) {
|
||||
return AjaxResult.error("结算类型错误,结算权限码为空");
|
||||
}
|
||||
|
||||
// 通过,更新slt_apply协议审批状态
|
||||
int examNum = sltAgreementInfoMapper.costExame(sltAgreementApply);
|
||||
|
||||
// 更新bm_agreement_info结算状态
|
||||
int beforeCount = sltAgreementInfoMapper.getBeforeSettlementCount(new SltInfoVo().setAgreementId(sltAgreementApply.getAgreementId()));
|
||||
sltAgreementApply.setIsSlt(beforeCount == 0 ? GlobalConstants.INT_1 : GlobalConstants.INT_2);
|
||||
int countTwo = bmAgreementInfoMapper.updateBmAgreementInfo(new BmAgreementInfo().setIsSlt(Long.valueOf(sltAgreementApply.getIsSlt()))
|
||||
.setAgreementId(sltAgreementApply.getAgreementId())
|
||||
);
|
||||
if (countTwo != GlobalConstants.INT_1) {
|
||||
throw new ServiceException("bm_agreement_info修改失败");
|
||||
}
|
||||
|
||||
// 修改slt_agreement_info的结算状态
|
||||
int countThree = sltAgreementInfoMapper.updateSltInfoByAgreementIdType(
|
||||
new SltAgreementInfo()
|
||||
.setAgreementId(sltAgreementApply.getAgreementId())
|
||||
.setSettlementType(Integer.valueOf(sltAgreementApplyFromDb.getSettlementType()))
|
||||
);
|
||||
if (countThree == 0) {
|
||||
throw new ServiceException("slt_agreement_info修改失败");
|
||||
}
|
||||
|
||||
if (examNum == GlobalConstants.INT_0) {
|
||||
return AjaxResult.error("结算审批失败");
|
||||
} else {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
} else {
|
||||
return AjaxResult.error("审批错误,状态码错误");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return AjaxResult.error();
|
||||
throw new ServiceException(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.bonus.material.clz.mapper.ClzSltAgreementInfoMapper">
|
||||
|
||||
<insert id="insertSltAgreementApply" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into clz_slt_agreement_apply
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
|
|
@ -294,7 +295,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
saa.`code` = #{sltApplyCode}
|
||||
</select>
|
||||
|
||||
<select id="costExame" resultType="int">
|
||||
<update id="costExame">
|
||||
update clz_slt_agreement_apply
|
||||
<set>
|
||||
<if test="status != null and status!=''">status = #{status},</if>
|
||||
|
|
@ -303,8 +304,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="auditor != null and auditor!=''">auditor = #{auditor},</if>
|
||||
<if test="remark != null and remark!=''">remark = #{remark}</if>
|
||||
</set>
|
||||
where `code` = #{code,jdbcType=VARCHAR}
|
||||
</select>
|
||||
where `code` = #{code}
|
||||
</update>
|
||||
|
||||
<select id="getSltAgreementIdsBySltApplyCode" resultType="java.lang.Long">
|
||||
select agreement_id
|
||||
|
|
@ -312,20 +313,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
where `code` = #{sltApplyCode}
|
||||
</select>
|
||||
|
||||
<update id="updateClzSltInfoByIds">
|
||||
<update id="updateClzAgreementInfoByIds">
|
||||
update clz_bm_agreement_info
|
||||
set is_slt = 1, update_time = now(), slt_time = now()
|
||||
set is_slt = 1, update_time = now()
|
||||
where agreement_id in
|
||||
<foreach item="item" index="index" collection="agreementIds" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<update id="updateClzSltDetailsByIds">
|
||||
<update id="updateClzSltInfoByIds">
|
||||
update clz_slt_agreement_info
|
||||
set end_time = now(), update_time = now()
|
||||
where id in
|
||||
<foreach item="item" index="index" collection="ids" open="(" separator="," close=")">
|
||||
set slt_time = now(), update_time = now(), is_slt = '1'
|
||||
where agreement_id in
|
||||
<foreach item="item" index="index" collection="agreementIds" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</update>
|
||||
|
|
|
|||
|
|
@ -15,10 +15,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<result property="companyId" column="company_id" />
|
||||
<result property="cost" column="cost" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="settlementType" column="settlement_type"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSltAgreementApplyVo">
|
||||
select id, code, creator, create_time, update_time, auditor, audit_time, status, company_id, cost, remark from slt_agreement_apply
|
||||
select id, code, creator, create_time, update_time, auditor, audit_time, status, company_id, cost, remark, settlement_type from slt_agreement_apply
|
||||
</sql>
|
||||
|
||||
<select id="selectSltAgreementApplyList" parameterType="com.bonus.material.settlement.domain.SltAgreementApply" resultMap="SltAgreementApplyResult">
|
||||
|
|
|
|||
|
|
@ -1304,11 +1304,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
sai.type_id,
|
||||
mt.type_name as model_name, mt.buy_price,
|
||||
mt1.type_name as type_name,
|
||||
sai.ma_id, sai.num, sai.price as lease_price, sai.start_time, sai.end_time,
|
||||
sai.ma_id, sai.num, sai.price as lease_price, sai.start_time, IFNULL(sai.end_time,saa.create_time) as end_time,
|
||||
mt.unit_name as mt_unit_name, mt.comsumable,
|
||||
bai.remark
|
||||
FROM bm_agreement_info bai
|
||||
INNER JOIN slt_agreement_details sai ON bai.agreement_id = sai.apply_id
|
||||
LEFT JOIN slt_agreement_apply saa on bai.agreement_id = saa.agreement_id
|
||||
LEFT JOIN slt_agreement_details sai ON saa.ID = sai.apply_id
|
||||
LEFT JOIN bm_unit bu ON bai.unit_id = bu.unit_id
|
||||
LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id
|
||||
LEFT JOIN ma_type mt ON sai.type_id = mt.type_id AND mt.`level` = '4'
|
||||
|
|
@ -1338,13 +1339,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<!-- 数据库层面的时间范围过滤 - 修正跨区间租赁逻辑 -->
|
||||
AND (
|
||||
<!-- 已结算协议:租赁期间与查询区间有交集 -->
|
||||
(bai.is_slt = 1 AND (
|
||||
(bai.is_slt IN(1,2) AND (
|
||||
<!-- 情况1:领料时间在查询区间内 -->
|
||||
(sai.start_time IS NOT NULL AND DATE(sai.start_time) >= #{startDate} AND DATE(sai.start_time) <= #{endDate})
|
||||
OR
|
||||
<!-- 情况2:退料时间在查询区间内 -->
|
||||
(sai.end_time IS NOT NULL AND DATE(sai.end_time) >= #{startDate} AND DATE(sai.end_time) <= #{endDate})
|
||||
OR
|
||||
<!-- 情况2+:结算时间在查询区间内 -->
|
||||
(sai.end_time IS NULL AND DATE(saa.create_time) >= #{startDate} AND DATE(saa.create_time) <= #{endDate})
|
||||
OR
|
||||
<!-- 情况4:跨区间租赁(领料在区间前,退料/结算在区间后) -->
|
||||
(sai.start_time IS NOT NULL AND DATE(sai.start_time) < #{startDate} AND
|
||||
((sai.end_time IS NOT NULL AND DATE(sai.end_time) > #{endDate}) ))
|
||||
|
|
@ -1419,4 +1423,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
where
|
||||
bai.agreement_id = #{agreementId}
|
||||
</select>
|
||||
|
||||
<update id="updateSltInfoByAgreementIdType">
|
||||
UPDATE
|
||||
slt_agreement_info sai
|
||||
JOIN
|
||||
ma_type mt ON sai.type_id = mt.type_id AND mt.`level` = '4'
|
||||
SET
|
||||
sai.is_slt = '1', sai.slt_time = NOW()
|
||||
WHERE
|
||||
sai.agreement_id = #{agreementId} AND mt.jiju_type = #{settlementType}
|
||||
</update>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue