ezhizao_zx 10 luni în urmă
părinte
comite
92e7687820

+ 11 - 0
src/main/java/cn/ezhizao/common/utils/StringUtils.java

@@ -5,6 +5,9 @@ import cn.ezhizao.common.core.text.StrFormatter;
 import org.springframework.util.AntPathMatcher;
 
 import java.util.*;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.function.Function;
+import java.util.function.Predicate;
 
 /**
  * 字符串工具类
@@ -604,4 +607,12 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
         }
         return sb.toString();
     }
+
+    /**
+     * 根据属性去重
+     */
+    public static <T> Predicate<T> distinctByKey(Function<? super T, ?> keyExtractor) {
+        Map<Object, Boolean> seen = new ConcurrentHashMap<>();
+        return t -> seen.putIfAbsent(keyExtractor.apply(t), Boolean.TRUE) == null;
+    }
 }

+ 126 - 0
src/main/java/cn/ezhizao/project/business/outsourceBalanceMonth/controller/BizOutsourceBalanceMonthController.java

@@ -0,0 +1,126 @@
+package cn.ezhizao.project.business.outsourceBalanceMonth.controller;
+
+import java.util.Date;
+import java.util.List;
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletResponse;
+
+import cn.ezhizao.common.utils.poi.ExcelUtil;
+import cn.ezhizao.framework.aspectj.lang.annotation.Log;
+import cn.ezhizao.framework.aspectj.lang.enums.BusinessType;
+import cn.ezhizao.framework.web.controller.BaseController;
+import cn.ezhizao.framework.web.domain.AjaxResult;
+import cn.ezhizao.framework.web.page.TableDataInfo;
+import cn.ezhizao.project.business.outsourceBalanceMonth.domain.BizOutsourceBalanceMonth;
+import cn.ezhizao.project.business.outsourceBalanceMonth.service.IBizOutsourceBalanceMonthService;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * 外协结算月设置Controller
+ *
+ * @author ezhizao
+ * @date 2024-08-13
+ */
+@RestController
+@RequestMapping("/business/outsourceBalanceMonth")
+public class BizOutsourceBalanceMonthController extends BaseController
+{
+    @Resource
+    private IBizOutsourceBalanceMonthService bizOutsourceBalanceMonthService;
+
+    /**
+     * 查询外协结算月设置列表
+     */
+    @PreAuthorize("@ss.hasPermi('business:outsourceBalanceMonth:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(BizOutsourceBalanceMonth bizOutsourceBalanceMonth) throws NoSuchFieldException, IllegalAccessException
+    {
+        setTenantId(bizOutsourceBalanceMonth);
+        startPage();
+        List<BizOutsourceBalanceMonth> list = bizOutsourceBalanceMonthService.getList(bizOutsourceBalanceMonth);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出外协结算月设置列表
+     */
+    @PreAuthorize("@ss.hasPermi('business:outsourceBalanceMonth:export')")
+    @Log(title = "外协结算月设置", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, BizOutsourceBalanceMonth bizOutsourceBalanceMonth) throws NoSuchFieldException, IllegalAccessException
+    {
+        setTenantId(bizOutsourceBalanceMonth);
+        List<BizOutsourceBalanceMonth> list = bizOutsourceBalanceMonthService.getList(bizOutsourceBalanceMonth);
+        ExcelUtil<BizOutsourceBalanceMonth> util = new ExcelUtil<BizOutsourceBalanceMonth>(BizOutsourceBalanceMonth.class);
+        util.exportExcel(response, list, "外协结算月设置数据");
+    }
+
+    /**
+     * 获取外协结算月设置详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('business:outsourceBalanceMonth:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return success(bizOutsourceBalanceMonthService.getById(id));
+    }
+
+    /**
+     * 新增外协结算月设置
+     */
+    @PreAuthorize("@ss.hasPermi('business:outsourceBalanceMonth:add')")
+    @Log(title = "外协结算月设置", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody BizOutsourceBalanceMonth bizOutsourceBalanceMonth) throws NoSuchFieldException, IllegalAccessException
+    {
+        setTenantId(bizOutsourceBalanceMonth);
+        return toAjax(bizOutsourceBalanceMonthService.save(bizOutsourceBalanceMonth));
+    }
+
+    /**
+     * 修改外协结算月设置
+     */
+    @PreAuthorize("@ss.hasPermi('business:outsourceBalanceMonth:edit')")
+    @Log(title = "外协结算月设置", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody BizOutsourceBalanceMonth bizOutsourceBalanceMonth) throws NoSuchFieldException, IllegalAccessException
+    {
+        setTenantId(bizOutsourceBalanceMonth);
+        return toAjax(bizOutsourceBalanceMonthService.updateById(bizOutsourceBalanceMonth));
+    }
+
+    /**
+     * 删除外协结算月设置
+     */
+    @PreAuthorize("@ss.hasPermi('business:outsourceBalanceMonth:remove')")
+    @Log(title = "外协结算月设置", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable List<Long> ids)
+    {
+        return toAjax(bizOutsourceBalanceMonthService.removeBatchByIds(ids));
+    }
+
+    /**
+     * 修改外协结算月设置
+     */
+    @PreAuthorize("@ss.hasPermi('business:outsourceBalanceMonth:save')")
+    @Log(title = "外协结算月设置", businessType = BusinessType.INSERT)
+    @PostMapping("/save")
+    public AjaxResult save(@RequestBody BizOutsourceBalanceMonth bizOutsourceBalanceMonth) throws NoSuchFieldException, IllegalAccessException
+    {
+        setTenantId(bizOutsourceBalanceMonth);
+        bizOutsourceBalanceMonth.setUserId(getUserId());
+        List<BizOutsourceBalanceMonth> month = bizOutsourceBalanceMonthService.query().isNull("stop_date").list();
+        month.forEach(l -> l.setStopDate(new Date()));
+        bizOutsourceBalanceMonthService.updateBatchById(month);
+        return toAjax(bizOutsourceBalanceMonthService.save(bizOutsourceBalanceMonth));
+    }
+}

+ 46 - 0
src/main/java/cn/ezhizao/project/business/outsourceBalanceMonth/domain/BizOutsourceBalanceMonth.java

@@ -0,0 +1,46 @@
+package cn.ezhizao.project.business.outsourceBalanceMonth.domain;
+
+import java.util.Date;
+
+import cn.ezhizao.framework.aspectj.lang.annotation.Excel;
+import cn.ezhizao.framework.web.domain.BaseEntity;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * 外协结算月设置对象 biz_outsource_balance_month
+ *
+ * @author ezhizao
+ * @date 2024-08-13
+ */
+@Data
+@TableName(value = "biz_outsource_balance_month")
+public class BizOutsourceBalanceMonth extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 开始日期 */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "开始日期", width = 30, dateFormat = "yyyy-MM-dd")
+    @ApiModelProperty(value = "开始日期")
+    private Date startDate;
+
+    /** 结束日期 */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "结束日期", width = 30, dateFormat = "yyyy-MM-dd")
+    @ApiModelProperty(value = "结束日期")
+    private Date endDate;
+
+    /** 设置人 */
+    @ApiModelProperty(value = "结束日期")
+    private Long userId;
+
+    /** 停用时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "停用时间", width = 30, dateFormat = "yyyy-MM-dd")
+    @ApiModelProperty(value = "停用时间")
+    private Date stopDate;
+
+}

+ 30 - 0
src/main/java/cn/ezhizao/project/business/outsourceBalanceMonth/mapper/BizOutsourceBalanceMonthMapper.java

@@ -0,0 +1,30 @@
+package cn.ezhizao.project.business.outsourceBalanceMonth.mapper;
+
+import java.util.List;
+
+import cn.ezhizao.project.business.outsourceBalanceMonth.domain.BizOutsourceBalanceMonth;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 外协结算月设置Mapper接口
+ *
+ * @author ezhizao
+ * @date 2024-08-13
+ */
+public interface BizOutsourceBalanceMonthMapper extends BaseMapper<BizOutsourceBalanceMonth>
+{
+    /**
+     * 查询外协结算月设置列表
+     *
+     * @param bizOutsourceBalanceMonth 外协结算月设置
+     * @return 外协结算月设置集合
+     */
+    public List<BizOutsourceBalanceMonth> getList(BizOutsourceBalanceMonth bizOutsourceBalanceMonth);
+
+    /**
+     * 物理删除
+     * @param bizOutsourceBalanceMonth
+     * @return 删除结果
+    */
+    public int physicalDelete(BizOutsourceBalanceMonth bizOutsourceBalanceMonth);
+}

+ 31 - 0
src/main/java/cn/ezhizao/project/business/outsourceBalanceMonth/service/IBizOutsourceBalanceMonthService.java

@@ -0,0 +1,31 @@
+package cn.ezhizao.project.business.outsourceBalanceMonth.service;
+
+import java.util.List;
+
+import cn.ezhizao.project.business.outsourceBalanceMonth.domain.BizOutsourceBalanceMonth;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * 外协结算月设置Service接口
+ *
+ * @author ezhizao
+ * @date 2024-08-13
+ */
+public interface IBizOutsourceBalanceMonthService extends IService<BizOutsourceBalanceMonth>
+{
+    /**
+     * 查询外协结算月设置列表
+     *
+     * @param bizOutsourceBalanceMonth 外协结算月设置
+     * @return 外协结算月设置集合
+     */
+    public List<BizOutsourceBalanceMonth> getList(BizOutsourceBalanceMonth bizOutsourceBalanceMonth);
+
+    /**
+     * 物理删除
+     * @param bizOutsourceBalanceMonth
+     * @return 删除结果
+     */
+    public int physicalDelete(BizOutsourceBalanceMonth bizOutsourceBalanceMonth);
+
+}

+ 44 - 0
src/main/java/cn/ezhizao/project/business/outsourceBalanceMonth/service/impl/BizOutsourceBalanceMonthServiceImpl.java

@@ -0,0 +1,44 @@
+package cn.ezhizao.project.business.outsourceBalanceMonth.service.impl;
+
+import java.util.List;
+import javax.annotation.Resource;
+
+import cn.ezhizao.project.business.outsourceBalanceMonth.domain.BizOutsourceBalanceMonth;
+import cn.ezhizao.project.business.outsourceBalanceMonth.mapper.BizOutsourceBalanceMonthMapper;
+import cn.ezhizao.project.business.outsourceBalanceMonth.service.IBizOutsourceBalanceMonthService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * 外协结算月设置Service业务层处理
+ *
+ * @author ezhizao
+ * @date 2024-08-13
+ */
+@Service
+public class BizOutsourceBalanceMonthServiceImpl  extends ServiceImpl<BizOutsourceBalanceMonthMapper, BizOutsourceBalanceMonth> implements IBizOutsourceBalanceMonthService
+{
+    @Resource
+    private BizOutsourceBalanceMonthMapper bizOutsourceBalanceMonthMapper;
+
+    /**
+     * 查询外协结算月设置列表
+     *
+     * @param bizOutsourceBalanceMonth 外协结算月设置
+     * @return 外协结算月设置
+     */
+    @Override
+    public List<BizOutsourceBalanceMonth> getList(BizOutsourceBalanceMonth bizOutsourceBalanceMonth)
+    {
+        return bizOutsourceBalanceMonthMapper.getList(bizOutsourceBalanceMonth);
+    }
+
+    /**
+     * 物理删除
+     * @param bizOutsourceBalanceMonth
+     * @return 删除结果
+     */
+    @Override
+    public int physicalDelete(BizOutsourceBalanceMonth bizOutsourceBalanceMonth){ return bizOutsourceBalanceMonthMapper.physicalDelete(bizOutsourceBalanceMonth); };
+
+}

+ 31 - 0
src/main/resources/mybatis/business/outsourceBalanceMonth/BizOutsourceBalanceMonthMapper.xml

@@ -0,0 +1,31 @@
+<?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="cn.ezhizao.project.business.outsourceBalanceMonth.mapper.BizOutsourceBalanceMonthMapper">
+
+    <resultMap type="cn.ezhizao.project.business.outsourceBalanceMonth.domain.BizOutsourceBalanceMonth" id="BizOutsourceBalanceMonthResult">
+        <id column="id" property="id"/>
+    </resultMap>
+
+
+    <select id="getList" parameterType="BizOutsourceBalanceMonth" resultMap="BizOutsourceBalanceMonthResult">
+        SELECT * FROM biz_outsource_balance_month
+        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
+            deleted = 0 and stop_date is null
+            <if test="startDate != null "> AND start_date = #{startDate}</if>
+            <if test="endDate != null "> AND end_date = #{endDate}</if>
+            <if test="stopDate != null "> AND stop_date = #{stopDate}</if>
+        </trim>
+    </select>
+
+    <delete id="physicalDelete">
+        DELETE FROM biz_outsource_balance_month
+        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
+            <if test="id != null">
+                id = #{id} AND
+            </if>
+       <!-- 删除条件为其他外键可以在这里加 -->
+        </trim>
+    </delete>
+</mapper>