diff --git a/sgzb-common/sgzb-common-core/src/main/java/com/bonus/sgzb/common/core/utils/DateTimeHelper.java b/sgzb-common/sgzb-common-core/src/main/java/com/bonus/sgzb/common/core/utils/DateTimeHelper.java index 2565729..824031f 100644 --- a/sgzb-common/sgzb-common-core/src/main/java/com/bonus/sgzb/common/core/utils/DateTimeHelper.java +++ b/sgzb-common/sgzb-common-core/src/main/java/com/bonus/sgzb/common/core/utils/DateTimeHelper.java @@ -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());*/ } } diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/controller/SltMonthInfoController.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/controller/SltMonthInfoController.java new file mode 100644 index 0000000..a4caade --- /dev/null +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/controller/SltMonthInfoController.java @@ -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 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("审核成功"); + } + +} diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/domain/SltMonthInfo.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/domain/SltMonthInfo.java new file mode 100644 index 0000000..c1c9400 --- /dev/null +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/domain/SltMonthInfo.java @@ -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 dataCondition; +} diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/mapper/SltMonthInfoMapper.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/mapper/SltMonthInfoMapper.java new file mode 100644 index 0000000..38a8601 --- /dev/null +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/mapper/SltMonthInfoMapper.java @@ -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 getSltMonthInfo(SltMonthInfo bean); + + + int auditSlt(SltMonthInfo slt); +} diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/SltMonthInfoService.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/SltMonthInfoService.java new file mode 100644 index 0000000..0572963 --- /dev/null +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/SltMonthInfoService.java @@ -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 getSltMonthInfo(SltMonthInfo bean); + + + int auditSlt(SltMonthInfo slt); +} diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/SltMonthInfoServiceImpl.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/SltMonthInfoServiceImpl.java new file mode 100644 index 0000000..101811d --- /dev/null +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/SltMonthInfoServiceImpl.java @@ -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 getSltMonthInfo(SltMonthInfo bean) { + return sltMonthInfoInfoMapper.getSltMonthInfo(bean); + } + + @Override + public int auditSlt(SltMonthInfo slt) { + return sltMonthInfoInfoMapper.auditSlt(slt); + } +} diff --git a/sgzb-modules/sgzb-material/src/main/resources/mapper/material/SltMonthInfoMapper.xml b/sgzb-modules/sgzb-material/src/main/resources/mapper/material/SltMonthInfoMapper.xml new file mode 100644 index 0000000..c4eb142 --- /dev/null +++ b/sgzb-modules/sgzb-material/src/main/resources/mapper/material/SltMonthInfoMapper.xml @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + UPDATE project_month_costs + SET status = 1 + WHERE id IN + + #{id} + + + +