月度费用审核开发
This commit is contained in:
parent
00d19721a4
commit
0abb17dbde
|
|
@ -980,10 +980,23 @@ public class DateTimeHelper {
|
|||
}
|
||||
|
||||
public static String getCurrentMonthCalEndDay(int day) {
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
||||
|
||||
// 获取当前日期
|
||||
LocalDate currentDate = LocalDate.now();
|
||||
// 检查 day 是否超过当前月份的最大天数
|
||||
int currentMonthMaxDay = currentDate.lengthOfMonth();
|
||||
int adjustedDay = Math.min(day, currentMonthMaxDay);
|
||||
// 设置日期为当前月份的 adjustedDay
|
||||
LocalDate resultDate = currentDate.withDayOfMonth(adjustedDay);
|
||||
// 返回前一天
|
||||
LocalDate previousDay = resultDate.minusDays(1);
|
||||
// 格式化并返回
|
||||
return previousDay.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
||||
|
||||
/*SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Calendar c = Calendar.getInstance();
|
||||
c.add(Calendar.MONTH, 0);
|
||||
c.set(Calendar.DAY_OF_MONTH, day);
|
||||
return format.format(c.getTime());
|
||||
return format.format(c.getTime());*/
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,69 @@
|
|||
package com.bonus.sgzb.material.controller;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.alibaba.excel.ExcelWriter;
|
||||
import com.alibaba.excel.write.metadata.WriteSheet;
|
||||
import com.bonus.sgzb.base.api.domain.SltAgreementApply;
|
||||
import com.bonus.sgzb.base.api.domain.SltAgreementInfo;
|
||||
import com.bonus.sgzb.base.api.domain.SltInfoVo;
|
||||
import com.bonus.sgzb.common.core.utils.poi.ExcelUtil;
|
||||
import com.bonus.sgzb.common.core.web.controller.BaseController;
|
||||
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.sgzb.common.core.web.page.TableDataInfo;
|
||||
import com.bonus.sgzb.common.log.annotation.Log;
|
||||
import com.bonus.sgzb.common.log.enums.BusinessType;
|
||||
import com.bonus.sgzb.common.security.annotation.RequiresPermissions;
|
||||
import com.bonus.sgzb.material.domain.*;
|
||||
import com.bonus.sgzb.material.service.SltAgreementInfoService;
|
||||
import com.bonus.sgzb.material.service.SltMonthInfoService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author c liu
|
||||
* @date 2024/2/22
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/sltMonthInfo")
|
||||
public class SltMonthInfoController extends BaseController {
|
||||
@Resource
|
||||
private SltMonthInfoService sltMonthInfoService;
|
||||
|
||||
/**
|
||||
* 根据条件获取协议结算列表
|
||||
*/
|
||||
@RequiresPermissions("cost:settlement:list")
|
||||
@ApiOperation(value = "根据条件获取协议结算列表")
|
||||
@GetMapping("/getSltMonthInfo")
|
||||
public TableDataInfo getSltMonthInfo(SltMonthInfo bean) {
|
||||
startPage();
|
||||
List<SltMonthInfo> list = sltMonthInfoService.getSltMonthInfo(bean);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 调整天数
|
||||
*/
|
||||
@ApiOperation(value = "审核月度费用")
|
||||
@PostMapping("/auditSlt")
|
||||
@RequiresPermissions("cost:settlement:edit")
|
||||
public AjaxResult auditSlt(@RequestBody SltMonthInfo slt) {
|
||||
int bean = sltMonthInfoService.auditSlt(slt);
|
||||
if (bean == 0) {
|
||||
return AjaxResult.error("审核失败");
|
||||
}
|
||||
return AjaxResult.success("审核成功");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,104 @@
|
|||
package com.bonus.sgzb.material.domain;
|
||||
|
||||
import com.bonus.sgzb.common.core.annotation.Excel;
|
||||
import com.bonus.sgzb.common.core.web.domain.BaseEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author lsun
|
||||
*/
|
||||
@Data
|
||||
public class SltMonthInfo extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private String ids;
|
||||
|
||||
/**
|
||||
* 协议ID
|
||||
*/
|
||||
@ApiModelProperty(value = "ID")
|
||||
private Long id;
|
||||
/**
|
||||
* 协议ID
|
||||
*/
|
||||
@ApiModelProperty(value = "协议ID")
|
||||
private Long agreementId;
|
||||
|
||||
/**
|
||||
* 协议编号
|
||||
*/
|
||||
@Excel(name = "协议编号")
|
||||
@ApiModelProperty(value = "协议编号")
|
||||
private String agreementCode;
|
||||
|
||||
/**
|
||||
* 合同
|
||||
*/
|
||||
@Excel(name = "合同编号")
|
||||
@ApiModelProperty(value = "合同")
|
||||
private String contractCode;
|
||||
|
||||
|
||||
/**
|
||||
* 往来单位id
|
||||
*/
|
||||
@ApiModelProperty(value = "往来单位id")
|
||||
private Long unitId;
|
||||
|
||||
/**
|
||||
* 往来单位
|
||||
*/
|
||||
@Excel(name = "往来单位")
|
||||
@ApiModelProperty(value = "往来单位")
|
||||
private String unitName;
|
||||
|
||||
/**
|
||||
* 工程标段ID
|
||||
*/
|
||||
@ApiModelProperty(value = "工程标段ID")
|
||||
private Long projectId;
|
||||
|
||||
/**
|
||||
* 工程标段
|
||||
*/
|
||||
@Excel(name = "工程名称")
|
||||
@ApiModelProperty(value = "工程标段")
|
||||
private String projectName;
|
||||
|
||||
/**
|
||||
* 租赁费用
|
||||
*/
|
||||
@Excel(name = "租赁费用")
|
||||
@ApiModelProperty(value = "租赁费用")
|
||||
private BigDecimal leaseMoney;
|
||||
|
||||
/**
|
||||
* 租赁费用月份
|
||||
*/
|
||||
@Excel(name = "费用月份")
|
||||
@ApiModelProperty(value = "费用月份")
|
||||
private String month;
|
||||
|
||||
/**
|
||||
* 租赁费用月份
|
||||
*/
|
||||
@Excel(name = "状态")
|
||||
@ApiModelProperty(value = "状态")
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 费用承担方
|
||||
*/
|
||||
@Excel(name = "费用承担方")
|
||||
@ApiModelProperty(value = "费用承担方")
|
||||
private String bearPart;
|
||||
|
||||
/**
|
||||
* 导出选中列表
|
||||
*/
|
||||
@ApiModelProperty(value = "导出选中列表")
|
||||
private List<Long> dataCondition;
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
package com.bonus.sgzb.material.mapper;
|
||||
|
||||
import com.bonus.sgzb.base.api.domain.ApplyRelation;
|
||||
import com.bonus.sgzb.base.api.domain.SltAgreementApply;
|
||||
import com.bonus.sgzb.base.api.domain.SltAgreementInfo;
|
||||
import com.bonus.sgzb.base.api.domain.SltAgreementRelation;
|
||||
import com.bonus.sgzb.material.domain.AgreementInfo;
|
||||
import com.bonus.sgzb.material.domain.SltMonthInfo;
|
||||
import com.bonus.sgzb.material.domain.TmTask;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author c liu
|
||||
* @date 2024/2/22
|
||||
*/
|
||||
@Mapper
|
||||
public interface SltMonthInfoMapper {
|
||||
List<SltMonthInfo> getSltMonthInfo(SltMonthInfo bean);
|
||||
|
||||
|
||||
int auditSlt(SltMonthInfo slt);
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
package com.bonus.sgzb.material.service;
|
||||
|
||||
import com.bonus.sgzb.base.api.domain.SltAgreementApply;
|
||||
import com.bonus.sgzb.base.api.domain.SltAgreementInfo;
|
||||
import com.bonus.sgzb.base.api.domain.SltInfoVo;
|
||||
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.sgzb.material.domain.AgreementInfo;
|
||||
import com.bonus.sgzb.material.domain.SltMonthInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author c liu
|
||||
* @date 2024/2/22
|
||||
*/
|
||||
public interface SltMonthInfoService {
|
||||
List<SltMonthInfo> getSltMonthInfo(SltMonthInfo bean);
|
||||
|
||||
|
||||
int auditSlt(SltMonthInfo slt);
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
package com.bonus.sgzb.material.service.impl;
|
||||
|
||||
import com.bonus.sgzb.base.api.domain.*;
|
||||
import com.bonus.sgzb.common.core.utils.DateTimeHelper;
|
||||
import com.bonus.sgzb.common.core.utils.DateUtils;
|
||||
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.sgzb.material.domain.AgreementInfo;
|
||||
import com.bonus.sgzb.material.domain.SltMonthInfo;
|
||||
import com.bonus.sgzb.material.domain.TmTask;
|
||||
import com.bonus.sgzb.material.mapper.CalMonthlyMapper;
|
||||
import com.bonus.sgzb.material.mapper.SltAgreementInfoMapper;
|
||||
import com.bonus.sgzb.material.mapper.SltMonthInfoMapper;
|
||||
import com.bonus.sgzb.material.service.SltAgreementInfoService;
|
||||
import com.bonus.sgzb.material.service.SltMonthInfoService;
|
||||
import com.bonus.sgzb.material.vo.GlobalContants;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author c liu
|
||||
* @date 2024/2/22
|
||||
*/
|
||||
@Service
|
||||
public class SltMonthInfoServiceImpl implements SltMonthInfoService {
|
||||
@Resource
|
||||
private SltMonthInfoMapper sltMonthInfoInfoMapper;
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public List<SltMonthInfo> getSltMonthInfo(SltMonthInfo bean) {
|
||||
return sltMonthInfoInfoMapper.getSltMonthInfo(bean);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int auditSlt(SltMonthInfo slt) {
|
||||
return sltMonthInfoInfoMapper.auditSlt(slt);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.bonus.sgzb.material.mapper.SltMonthInfoMapper">
|
||||
|
||||
<resultMap type="com.bonus.sgzb.material.domain.SltMonthInfo" id="BmAgreementInfoResult">
|
||||
<result property="agreementId" column="agreement_id"/>
|
||||
<result property="agreementCode" column="agreement_code"/>
|
||||
<result property="unitId" column="unit_id"/>
|
||||
<result property="unitName" column="unit_name"/>
|
||||
<result property="projectId" column="project_id"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="contractCode" column="contract_code"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="leaseMoney" column="costs"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
|
||||
|
||||
<select id="getSltMonthInfo" resultType="com.bonus.sgzb.material.domain.SltMonthInfo">
|
||||
SELECT
|
||||
pmc.id,
|
||||
bai.agreement_code as agreementCode,
|
||||
bui.unit_name as unitName,
|
||||
bp.lot_name as projectName,
|
||||
pmc.`month` ,
|
||||
pmc.costs as leaseMoney,
|
||||
pmc.status,
|
||||
pmc.cost_bearing_party as bearPart
|
||||
FROM
|
||||
project_month_costs pmc
|
||||
LEFT JOIN bm_agreement_info bai on pmc.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
|
||||
WHERE pmc.`month` =#{month}
|
||||
<if test="unitId != null and unitId != ''">
|
||||
and bai.unit_id = #{unitId}
|
||||
</if>
|
||||
<if test="projectId != null and projectId != ''">
|
||||
and bai.project_id = #{projectId}
|
||||
</if>
|
||||
<if test="agreementCode != null and agreementCode != ''">
|
||||
and bai.agreement_code = #{agreementCode}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<update id="auditSlt" >
|
||||
|
||||
<if test="dataCondition != null and dataCondition.size() > 0">
|
||||
UPDATE project_month_costs
|
||||
SET status = 1
|
||||
WHERE id IN
|
||||
<foreach collection="dataCondition" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
</update>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue