增加已结算费用查询功能,优化领料明细获取逻辑
This commit is contained in:
parent
fc24c9d576
commit
5cec3ddecf
|
|
@ -290,11 +290,7 @@ public class SltAgreementInfoController extends BaseController {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出结算单
|
* 导出结算单
|
||||||
* @param response
|
* @throws Exception 异常
|
||||||
* @param list
|
|
||||||
* @param filename
|
|
||||||
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
*/
|
||||||
private void expOutExcel(HttpServletResponse response, List<SltLeaseInfo> list, String filename,String projectName,String unitName,BigDecimal totalCost,int type) throws Exception {
|
private void expOutExcel(HttpServletResponse response, List<SltLeaseInfo> list, String filename,String projectName,String unitName,BigDecimal totalCost,int type) throws Exception {
|
||||||
if (list != null) {
|
if (list != null) {
|
||||||
|
|
@ -332,7 +328,7 @@ public class SltAgreementInfoController extends BaseController {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出结算单--all
|
* 导出结算单--all
|
||||||
* @throws Exception
|
* @throws Exception 异常信息
|
||||||
*/
|
*/
|
||||||
private void expOutExcelAll(HttpServletResponse response, List<SltLeaseInfo> lease,List<SltLeaseInfo> lose,List<SltLeaseInfo> repair,List<SltLeaseInfo> scrap,List<SltLeaseInfo> reduction,
|
private void expOutExcelAll(HttpServletResponse response, List<SltLeaseInfo> lease,List<SltLeaseInfo> lose,List<SltLeaseInfo> repair,List<SltLeaseInfo> scrap,List<SltLeaseInfo> reduction,
|
||||||
String filename,String projectName,String unitName,BigDecimal totalCostLease,BigDecimal totalCostLose,BigDecimal totalCostRepair,BigDecimal totalCostScrap,BigDecimal totalCostReduction)
|
String filename,String projectName,String unitName,BigDecimal totalCostLease,BigDecimal totalCostLose,BigDecimal totalCostRepair,BigDecimal totalCostScrap,BigDecimal totalCostReduction)
|
||||||
|
|
@ -388,7 +384,6 @@ public class SltAgreementInfoController extends BaseController {
|
||||||
workbook.write(out);
|
workbook.write(out);
|
||||||
out.flush();
|
out.flush();
|
||||||
out.close();
|
out.close();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,21 +8,21 @@ import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import com.bonus.common.core.annotation.Excel;
|
import com.bonus.common.core.annotation.Excel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
import com.bonus.common.core.web.domain.BaseEntity;
|
import com.bonus.common.core.web.domain.BaseEntity;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 结算信息对象 slt_agreement_info
|
* 结算信息对象 slt_agreement_info
|
||||||
*
|
|
||||||
* @author xsheng
|
|
||||||
* @date 2024-10-16
|
|
||||||
*/
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
@Data
|
@Data
|
||||||
@ToString
|
@ToString
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
public class SltAgreementInfo extends BaseEntity {
|
public class SltAgreementInfo extends BaseEntity {
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
private static final long serialVersionUID = -3531370525106104195L;
|
||||||
|
|
||||||
/** ID */
|
/** ID */
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
@ -159,7 +159,6 @@ public class SltAgreementInfo extends BaseEntity {
|
||||||
@ApiModelProperty(value = "租赁费用")
|
@ApiModelProperty(value = "租赁费用")
|
||||||
private BigDecimal costs;
|
private BigDecimal costs;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 项目名称
|
* 项目名称
|
||||||
*/
|
*/
|
||||||
|
|
@ -253,5 +252,10 @@ public class SltAgreementInfo extends BaseEntity {
|
||||||
|
|
||||||
private String unitValue;
|
private String unitValue;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否查询已结算的费用
|
||||||
|
*/
|
||||||
|
private Boolean enableQuerySltData = false;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -93,6 +93,9 @@ public interface SltAgreementInfoMapper {
|
||||||
|
|
||||||
int insSltInfo(@Param("record") LeaseOutDetails record, @Param("agreementId")String agreementId, @Param("ma") Type ma);
|
int insSltInfo(@Param("record") LeaseOutDetails record, @Param("agreementId")String agreementId, @Param("ma") Type ma);
|
||||||
|
|
||||||
|
// 查询一个协议号的已结算领料详情
|
||||||
|
List<SltAgreementInfo> getLeaseSltDetails(SltAgreementInfo record);
|
||||||
|
|
||||||
// 查询一个协议号的领料详情
|
// 查询一个协议号的领料详情
|
||||||
List<SltAgreementInfo> getLeaseList(SltAgreementInfo bean);
|
List<SltAgreementInfo> getLeaseList(SltAgreementInfo bean);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -381,7 +381,13 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService {
|
||||||
* 获取单个协议的领料明细
|
* 获取单个协议的领料明细
|
||||||
*/
|
*/
|
||||||
public List<SltAgreementInfo> getLeaseList(SltAgreementInfo info) {
|
public List<SltAgreementInfo> getLeaseList(SltAgreementInfo info) {
|
||||||
List<SltAgreementInfo> oneOfList = sltAgreementInfoMapper.getLeaseList(info);
|
List<SltAgreementInfo> oneOfList;
|
||||||
|
// 如果开启了查询已结算数据,那么就从结算记录📝里面查询已结算的租赁费用明细
|
||||||
|
if (info != null && info.getEnableQuerySltData() != null && info.getEnableQuerySltData()) {
|
||||||
|
oneOfList = sltAgreementInfoMapper.getLeaseSltDetails(info);
|
||||||
|
} else {
|
||||||
|
oneOfList = sltAgreementInfoMapper.getLeaseList(info);
|
||||||
|
}
|
||||||
List<SltAgreementInfo> leaseList = new ArrayList<>(oneOfList);
|
List<SltAgreementInfo> leaseList = new ArrayList<>(oneOfList);
|
||||||
|
|
||||||
for (SltAgreementInfo bean : leaseList) {
|
for (SltAgreementInfo bean : leaseList) {
|
||||||
|
|
@ -402,8 +408,11 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService {
|
||||||
if (leaseDays.compareTo(BigDecimal.ZERO) < 0) {
|
if (leaseDays.compareTo(BigDecimal.ZERO) < 0) {
|
||||||
leaseDays = BigDecimal.ZERO;
|
leaseDays = BigDecimal.ZERO;
|
||||||
}
|
}
|
||||||
BigDecimal costs = leasePrice.multiply(num).multiply(leaseDays).setScale(GlobalConstants.INT_2, RoundingMode.DOWN);
|
// 如果费用是空的、null、0 那么就根据数量和单价计算
|
||||||
bean.setCosts(costs);
|
if (bean.getCosts() == null || bean.getCosts().compareTo(BigDecimal.ZERO) < 0 || bean.getCosts().equals(BigDecimal.ZERO)) {
|
||||||
|
BigDecimal costs = leasePrice.multiply(num).multiply(leaseDays).setScale(GlobalConstants.INT_2, RoundingMode.DOWN);
|
||||||
|
bean.setCosts(costs);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return leaseList;
|
return leaseList;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1393,4 +1393,31 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getLeaseSltDetails" resultType="com.bonus.material.settlement.domain.SltAgreementInfo">
|
||||||
|
SELECT
|
||||||
|
bai.agreement_id AS agreementId,
|
||||||
|
bui.unit_name as unitName,
|
||||||
|
bp.pro_name as projectName,
|
||||||
|
sad.type_id as typeId,
|
||||||
|
sad.ma_id as maId,
|
||||||
|
sad.money as costs,
|
||||||
|
mt1.type_name as typeName,
|
||||||
|
mt.type_name as modelName,
|
||||||
|
mt.unit_name as mtUnitName,
|
||||||
|
sad.price as leasePrice,
|
||||||
|
sad.num as num,
|
||||||
|
DATE(sad.start_time) as startTime,
|
||||||
|
DATE(sad.end_time) as endTime,
|
||||||
|
DATEDIFF(IF(sad.end_time is null,CURDATE(),sad.end_time), sad.start_time) + 1 as leaseDays
|
||||||
|
FROM
|
||||||
|
bm_agreement_info bai
|
||||||
|
LEFT JOIN slt_agreement_apply saa ON bai.agreement_id = saa.agreement_id AND saa.settlement_type = #{settlementType}
|
||||||
|
LEFT JOIN slt_agreement_details sad ON saa.id = sad.apply_id AND sad.slt_type = '1'
|
||||||
|
LEFT JOIN bm_project bp ON bp.pro_id = bai.project_id
|
||||||
|
LEFT JOIN bm_unit bui ON bui.unit_id = bai.unit_id
|
||||||
|
left join ma_type mt on sad.type_id = mt.type_id
|
||||||
|
left join ma_type mt1 on mt.parent_id = mt1.type_id
|
||||||
|
where
|
||||||
|
bai.agreement_id = #{agreementId}
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue