소스 검색

安品业务

lazhaoqian 4 년 전
부모
커밋
72f6ff716c

+ 105 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/anpin/TMonthEndingClosingController.java

@@ -0,0 +1,105 @@
+package com.ruoyi.web.controller.anpin;
+
+import java.util.List;
+
+import com.ruoyi.anpin.domain.TMonthEndingClosing;
+import com.ruoyi.anpin.service.ITMonthEndingClosingService;
+import com.ruoyi.common.utils.StringUtils;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+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;
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.common.core.page.TableDataInfo;
+
+/**
+ * 月末结账Controller
+ * 
+ * @author ruoyi
+ * @date 2021-06-04
+ */
+@RestController
+@RequestMapping("/warehouse/closing")
+public class TMonthEndingClosingController extends BaseController
+{
+    @Autowired
+    private ITMonthEndingClosingService tMonthEndingClosingService;
+
+    /**
+     * 查询月末结账列表
+     */
+    @PreAuthorize("@ss.hasPermi('warehouse:closing:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(TMonthEndingClosing tMonthEndingClosing)
+    {
+        startPage();
+        List<TMonthEndingClosing> list = tMonthEndingClosingService.selectTMonthEndingClosingList(tMonthEndingClosing);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出月末结账列表
+     */
+    @PreAuthorize("@ss.hasPermi('warehouse:closing:export')")
+    @Log(title = "月末结账", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(TMonthEndingClosing tMonthEndingClosing)
+    {
+        List<TMonthEndingClosing> list = tMonthEndingClosingService.selectTMonthEndingClosingList(tMonthEndingClosing);
+        ExcelUtil<TMonthEndingClosing> util = new ExcelUtil<TMonthEndingClosing>(TMonthEndingClosing.class);
+        return util.exportExcel(list, "closing");
+    }
+
+    /**
+     * 获取月末结账详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('warehouse:closing:query')")
+    @GetMapping(value = "/{fId}")
+    public AjaxResult getInfo(@PathVariable("fId") Long fId)
+    {
+        return AjaxResult.success(tMonthEndingClosingService.selectTMonthEndingClosingById(fId));
+    }
+
+    /**
+     * 新增月末结账
+     */
+    @PreAuthorize("@ss.hasPermi('warehouse:closing:add')")
+    @Log(title = "月末结账", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody TMonthEndingClosing tMonthEndingClosing)
+    {
+        return toAjax(tMonthEndingClosingService.insertTMonthEndingClosing(tMonthEndingClosing));
+    }
+
+    /**
+     * 修改月末结账
+     */
+    @PreAuthorize("@ss.hasPermi('warehouse:closing:edit')")
+    @Log(title = "月末结账", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody TMonthEndingClosing tMonthEndingClosing)
+    {
+        return toAjax(tMonthEndingClosingService.updateTMonthEndingClosing(tMonthEndingClosing));
+    }
+
+    /**
+     * 删除月末结账
+     */
+    @PreAuthorize("@ss.hasPermi('warehouse:closing:remove')")
+    @Log(title = "月末结账", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{fIds}")
+    public AjaxResult remove(@PathVariable Long[] fIds)
+    {
+        return toAjax(tMonthEndingClosingService.deleteTMonthEndingClosingByIds(fIds));
+    }
+}

+ 111 - 0
ruoyi-anpin/src/main/java/com/ruoyi/anpin/domain/TMonthEndingClosing.java

@@ -0,0 +1,111 @@
+package com.ruoyi.anpin.domain;
+
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+
+/**
+ * 月末结账对象 t_month_ending_closing
+ * 
+ * @author ruoyi
+ * @date 2021-06-04
+ */
+public class TMonthEndingClosing extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** $column.columnComment */
+    private Long fId;
+
+    /** 年 */
+    @Excel(name = "年")
+    private String fYear;
+
+    /** 月 */
+    @Excel(name = "月")
+    private String fMonth;
+
+    /** 开始时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date fStart;
+
+    /** 结束时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "结束时间", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date fEnf;
+
+    /** 是否结账 T 是 F 否 */
+    @Excel(name = "是否结账 T 是 F 否")
+    private String fStatus;
+
+    public void setfId(Long fId) 
+    {
+        this.fId = fId;
+    }
+
+    public Long getfId() 
+    {
+        return fId;
+    }
+    public void setfYear(String fYear) 
+    {
+        this.fYear = fYear;
+    }
+
+    public String getfYear() 
+    {
+        return fYear;
+    }
+    public void setfMonth(String fMonth) 
+    {
+        this.fMonth = fMonth;
+    }
+
+    public String getfMonth() 
+    {
+        return fMonth;
+    }
+    public void setfStart(Date fStart) 
+    {
+        this.fStart = fStart;
+    }
+
+    public Date getfStart() 
+    {
+        return fStart;
+    }
+    public void setfEnf(Date fEnf) 
+    {
+        this.fEnf = fEnf;
+    }
+
+    public Date getfEnf() 
+    {
+        return fEnf;
+    }
+    public void setfStatus(String fStatus) 
+    {
+        this.fStatus = fStatus;
+    }
+
+    public String getfStatus() 
+    {
+        return fStatus;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("fId", getfId())
+            .append("fYear", getfYear())
+            .append("fMonth", getfMonth())
+            .append("fStart", getfStart())
+            .append("fEnf", getfEnf())
+            .append("fStatus", getfStatus())
+            .toString();
+    }
+}

+ 62 - 0
ruoyi-anpin/src/main/java/com/ruoyi/anpin/mapper/TMonthEndingClosingMapper.java

@@ -0,0 +1,62 @@
+package com.ruoyi.anpin.mapper;
+
+import com.ruoyi.anpin.domain.TMonthEndingClosing;
+
+import java.util.List;
+
+/**
+ * 月末结账Mapper接口
+ * 
+ * @author ruoyi
+ * @date 2021-06-04
+ */
+public interface TMonthEndingClosingMapper 
+{
+    /**
+     * 查询月末结账
+     * 
+     * @param fId 月末结账ID
+     * @return 月末结账
+     */
+    public TMonthEndingClosing selectTMonthEndingClosingById(Long fId);
+
+    /**
+     * 查询月末结账列表
+     * 
+     * @param tMonthEndingClosing 月末结账
+     * @return 月末结账集合
+     */
+    public List<TMonthEndingClosing> selectTMonthEndingClosingList(TMonthEndingClosing tMonthEndingClosing);
+
+    /**
+     * 新增月末结账
+     * 
+     * @param tMonthEndingClosing 月末结账
+     * @return 结果
+     */
+    public int insertTMonthEndingClosing(TMonthEndingClosing tMonthEndingClosing);
+
+    /**
+     * 修改月末结账
+     * 
+     * @param tMonthEndingClosing 月末结账
+     * @return 结果
+     */
+    public int updateTMonthEndingClosing(TMonthEndingClosing tMonthEndingClosing);
+
+    /**
+     * 删除月末结账
+     * 
+     * @param fId 月末结账ID
+     * @return 结果
+     */
+    public int deleteTMonthEndingClosingById(Long fId);
+
+    /**
+     * 批量删除月末结账
+     * 
+     * @param fIds 需要删除的数据ID
+     * @return 结果
+     */
+    public int deleteTMonthEndingClosingByIds(Long[] fIds);
+}

+ 62 - 0
ruoyi-anpin/src/main/java/com/ruoyi/anpin/service/ITMonthEndingClosingService.java

@@ -0,0 +1,62 @@
+package com.ruoyi.anpin.service;
+
+import com.ruoyi.anpin.domain.TMonthEndingClosing;
+
+import java.util.List;
+
+/**
+ * 月末结账Service接口
+ * 
+ * @author ruoyi
+ * @date 2021-06-04
+ */
+public interface ITMonthEndingClosingService 
+{
+    /**
+     * 查询月末结账
+     * 
+     * @param fId 月末结账ID
+     * @return 月末结账
+     */
+    public TMonthEndingClosing selectTMonthEndingClosingById(Long fId);
+
+    /**
+     * 查询月末结账列表
+     * 
+     * @param tMonthEndingClosing 月末结账
+     * @return 月末结账集合
+     */
+    public List<TMonthEndingClosing> selectTMonthEndingClosingList(TMonthEndingClosing tMonthEndingClosing);
+
+    /**
+     * 新增月末结账
+     * 
+     * @param tMonthEndingClosing 月末结账
+     * @return 结果
+     */
+    public int insertTMonthEndingClosing(TMonthEndingClosing tMonthEndingClosing);
+
+    /**
+     * 修改月末结账
+     * 
+     * @param tMonthEndingClosing 月末结账
+     * @return 结果
+     */
+    public int updateTMonthEndingClosing(TMonthEndingClosing tMonthEndingClosing);
+
+    /**
+     * 批量删除月末结账
+     * 
+     * @param fIds 需要删除的月末结账ID
+     * @return 结果
+     */
+    public int deleteTMonthEndingClosingByIds(Long[] fIds);
+
+    /**
+     * 删除月末结账信息
+     * 
+     * @param fId 月末结账ID
+     * @return 结果
+     */
+    public int deleteTMonthEndingClosingById(Long fId);
+}

+ 135 - 0
ruoyi-anpin/src/main/java/com/ruoyi/anpin/service/impl/TMonthEndingClosingServiceImpl.java

@@ -0,0 +1,135 @@
+package com.ruoyi.anpin.service.impl;
+
+import java.time.*;
+import java.util.Date;
+import java.util.List;
+
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import com.ruoyi.anpin.domain.TMonthEndingClosing;
+import com.ruoyi.anpin.mapper.TMonthEndingClosingMapper;
+import com.ruoyi.anpin.service.ITMonthEndingClosingService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+/**
+ * 月末结账Service业务层处理
+ * 
+ * @author ruoyi
+ * @date 2021-06-04
+ */
+@Service
+public class TMonthEndingClosingServiceImpl implements ITMonthEndingClosingService
+{
+    @Autowired
+    private TMonthEndingClosingMapper tMonthEndingClosingMapper;
+
+    /**
+     * 查询月末结账
+     * 
+     * @param fId 月末结账ID
+     * @return 月末结账
+     */
+    @Override
+    public TMonthEndingClosing selectTMonthEndingClosingById(Long fId)
+    {
+        return tMonthEndingClosingMapper.selectTMonthEndingClosingById(fId);
+    }
+
+    /**
+     * 查询月末结账列表
+     * 
+     * @param tMonthEndingClosing 月末结账
+     * @return 月末结账
+     */
+    @Override
+    public List<TMonthEndingClosing> selectTMonthEndingClosingList(TMonthEndingClosing tMonthEndingClosing)
+    {
+        List<TMonthEndingClosing> tMonthEndingClosings = tMonthEndingClosingMapper.selectTMonthEndingClosingList(tMonthEndingClosing);
+        if (CollectionUtils.isEmpty(tMonthEndingClosings)){
+            for (int i=1; i<= 12; i++){
+                TMonthEndingClosing monthEndingClosing = new TMonthEndingClosing();
+                monthEndingClosing.setfYear(tMonthEndingClosing.getfYear());
+                monthEndingClosing.setfMonth(i+"");
+                monthEndingClosing.setfStart(this.getBeginTime(Integer.valueOf(tMonthEndingClosing.getfYear()),i));
+                monthEndingClosing.setfEnf(this.getEndTime(Integer.valueOf(tMonthEndingClosing.getfYear()),i));
+                monthEndingClosing.setfStatus("T");
+                tMonthEndingClosingMapper.insertTMonthEndingClosing(monthEndingClosing);
+
+            }
+        }
+        return tMonthEndingClosingMapper.selectTMonthEndingClosingList(tMonthEndingClosing);
+    }
+
+    /**
+     * 新增月末结账
+     * 
+     * @param tMonthEndingClosing 月末结账
+     * @return 结果
+     */
+    @Override
+    public int insertTMonthEndingClosing(TMonthEndingClosing tMonthEndingClosing)
+    {
+        return tMonthEndingClosingMapper.insertTMonthEndingClosing(tMonthEndingClosing);
+    }
+
+    /**
+     * 修改月末结账
+     * 
+     * @param tMonthEndingClosing 月末结账
+     * @return 结果
+     */
+    @Override
+    public int updateTMonthEndingClosing(TMonthEndingClosing tMonthEndingClosing)
+    {
+        return tMonthEndingClosingMapper.updateTMonthEndingClosing(tMonthEndingClosing);
+    }
+
+    /**
+     * 批量删除月末结账
+     * 
+     * @param fIds 需要删除的月末结账ID
+     * @return 结果
+     */
+    @Override
+    public int deleteTMonthEndingClosingByIds(Long[] fIds)
+    {
+        return tMonthEndingClosingMapper.deleteTMonthEndingClosingByIds(fIds);
+    }
+
+    /**
+     * 删除月末结账信息
+     * 
+     * @param fId 月末结账ID
+     * @return 结果
+     */
+    @Override
+    public int deleteTMonthEndingClosingById(Long fId)
+    {
+        return tMonthEndingClosingMapper.deleteTMonthEndingClosingById(fId);
+    }
+
+
+    /**
+     * 根据年月获取月的开始时间结束时间
+     * @param year
+     * @param month
+     * @return
+     */
+    public Date getBeginTime(int year, int month) {
+        YearMonth yearMonth = YearMonth.of(year, month);
+        LocalDate localDate = yearMonth.atDay(1);
+        LocalDateTime startOfDay = localDate.atStartOfDay();
+        ZonedDateTime zonedDateTime = startOfDay.atZone(ZoneId.of("Asia/Shanghai"));
+
+        return Date.from(zonedDateTime.toInstant());
+    }
+
+    public  Date getEndTime(int year, int month) {
+        YearMonth yearMonth = YearMonth.of(year, month);
+        LocalDate endOfMonth = yearMonth.atEndOfMonth();
+        LocalDateTime localDateTime = endOfMonth.atTime(23, 59, 59, 999);
+        ZonedDateTime zonedDateTime = localDateTime.atZone(ZoneId.of("Asia/Shanghai"));
+        return Date.from(zonedDateTime.toInstant());
+    }
+
+}

+ 77 - 0
ruoyi-anpin/src/main/resources/mapper/anpin/TMonthEndingClosingMapper.xml

@@ -0,0 +1,77 @@
+<?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.ruoyi.anpin.mapper.TMonthEndingClosingMapper">
+    
+    <resultMap type="TMonthEndingClosing" id="TMonthEndingClosingResult">
+        <result property="fId"    column="f_id"    />
+        <result property="fYear"    column="f_year"    />
+        <result property="fMonth"    column="f_month"    />
+        <result property="fStart"    column="f_start"    />
+        <result property="fEnf"    column="f_enf"    />
+        <result property="fStatus"    column="f_status"    />
+    </resultMap>
+
+    <sql id="selectTMonthEndingClosingVo">
+        select f_id, f_year, f_month, f_start, f_enf, f_status from t_month_ending_closing
+    </sql>
+
+    <select id="selectTMonthEndingClosingList" parameterType="TMonthEndingClosing" resultMap="TMonthEndingClosingResult">
+        <include refid="selectTMonthEndingClosingVo"/>
+        <where>  
+            <if test="fYear != null  and fYear != ''"> and f_year = #{fYear}</if>
+            <if test="fMonth != null  and fMonth != ''"> and f_month = #{fMonth}</if>
+            <if test="fStart != null "> and f_start = #{fStart}</if>
+            <if test="fEnf != null "> and f_enf = #{fEnf}</if>
+            <if test="fStatus != null  and fStatus != ''"> and f_status = #{fStatus}</if>
+        </where>
+    </select>
+    
+    <select id="selectTMonthEndingClosingById" parameterType="Long" resultMap="TMonthEndingClosingResult">
+        <include refid="selectTMonthEndingClosingVo"/>
+        where f_id = #{fId}
+    </select>
+        
+    <insert id="insertTMonthEndingClosing" parameterType="TMonthEndingClosing" useGeneratedKeys="true" keyProperty="fId">
+        insert into t_month_ending_closing
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="fYear != null">f_year,</if>
+            <if test="fMonth != null">f_month,</if>
+            <if test="fStart != null">f_start,</if>
+            <if test="fEnf != null">f_enf,</if>
+            <if test="fStatus != null">f_status,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="fYear != null">#{fYear},</if>
+            <if test="fMonth != null">#{fMonth},</if>
+            <if test="fStart != null">#{fStart},</if>
+            <if test="fEnf != null">#{fEnf},</if>
+            <if test="fStatus != null">#{fStatus},</if>
+         </trim>
+    </insert>
+
+    <update id="updateTMonthEndingClosing" parameterType="TMonthEndingClosing">
+        update t_month_ending_closing
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="fYear != null">f_year = #{fYear},</if>
+            <if test="fMonth != null">f_month = #{fMonth},</if>
+            <if test="fStart != null">f_start = #{fStart},</if>
+            <if test="fEnf != null">f_enf = #{fEnf},</if>
+            <if test="fStatus != null">f_status = #{fStatus},</if>
+        </trim>
+        where f_id = #{fId}
+    </update>
+
+    <delete id="deleteTMonthEndingClosingById" parameterType="Long">
+        delete from t_month_ending_closing where f_id = #{fId}
+    </delete>
+
+    <delete id="deleteTMonthEndingClosingByIds" parameterType="String">
+        delete from t_month_ending_closing where f_id in 
+        <foreach item="fId" collection="array" open="(" separator="," close=")">
+            #{fId}
+        </foreach>
+    </delete>
+    
+</mapper>

+ 12 - 12
ruoyi-warehouse/src/main/java/com/ruoyi/anpin/ProfitExcel.java

@@ -15,10 +15,10 @@ public class ProfitExcel {
 
     //年
     @Excel(name = "年")
-    private String years;
+    private String annual;
     //月
     @Excel(name = "月")
-    private String months;
+    private String abbreviated;
     //客户
     private Long fCorpid;
     //客户中文名
@@ -34,20 +34,20 @@ public class ProfitExcel {
     @Excel(name = "利润")
     private BigDecimal profit;
 
-    public String getYears() {
-        return years;
+    public String getAnnual() {
+        return annual;
     }
 
-    public void setYears(String years) {
-        this.years = years;
+    public void setAnnual(String annual) {
+        this.annual = annual;
     }
 
-    public String getMonths() {
-        return months;
+    public String getAbbreviated() {
+        return abbreviated;
     }
 
-    public void setMonths(String months) {
-        this.months = months;
+    public void setAbbreviated(String abbreviated) {
+        this.abbreviated = abbreviated;
     }
 
     public Long getfCorpid() {
@@ -93,8 +93,8 @@ public class ProfitExcel {
     @Override
     public String toString() {
         return "ProfitExcel{" +
-                "years='" + years + '\'' +
-                ", months='" + months + '\'' +
+                "years='" + annual + '\'' +
+                ", months='" + abbreviated + '\'' +
                 ", fCorpid=" + fCorpid +
                 ", fCorpName='" + fCorpName + '\'' +
                 ", market=" + market +

+ 3 - 3
ruoyi-warehouse/src/main/resources/mapper/warehouseBusiness/TWarehousebillsfeesMapper.xml

@@ -1098,7 +1098,7 @@
         WHERE
         tw.del_flag = '0'
         AND tw.f_billtype = 'XS'
-        <if test="fBillstatus != null  and fBillstatus == 1">and tw.f_billstatus = #{fBillstatus}</if>
+        <if test="fBillstatus != null">and tw.f_billstatus = #{fBillstatus}</if>
         <if test="fGoodsid != null  and fGoodsid != ''">and tb.f_goodsid = #{fGoodsid}</if>
         <if test="fFeeid != null">and tw.f_feeid = #{fFeeid}</if>
         <if test="fFeeType != null ">and tf.f_feetype = #{fFeeType}</if>
@@ -1125,8 +1125,8 @@
     <select id="salectAnpinProfit" parameterType="TWarehousebills"
             resultType="com.ruoyi.anpin.ProfitExcel">
         SELECT
-        temp.years AS years,
-        temp.months AS months,
+        temp.years AS annual,
+        temp.months AS abbreviated,
         temp.fCorpName AS fCorpName,
         temp.market AS market,
         temp.purchase AS purchase,

+ 3 - 3
ruoyi-warehouse/target/classes/mapper/warehouseBusiness/TWarehousebillsfeesMapper.xml

@@ -1098,7 +1098,7 @@
         WHERE
         tw.del_flag = '0'
         AND tw.f_billtype = 'XS'
-        <if test="fBillstatus != null  and fBillstatus == 1">and tw.f_billstatus = #{fBillstatus}</if>
+        <if test="fBillstatus != null">and tw.f_billstatus = #{fBillstatus}</if>
         <if test="fGoodsid != null  and fGoodsid != ''">and tb.f_goodsid = #{fGoodsid}</if>
         <if test="fFeeid != null">and tw.f_feeid = #{fFeeid}</if>
         <if test="fFeeType != null ">and tf.f_feetype = #{fFeeType}</if>
@@ -1125,8 +1125,8 @@
     <select id="salectAnpinProfit" parameterType="TWarehousebills"
             resultType="com.ruoyi.anpin.ProfitExcel">
         SELECT
-        temp.years AS years,
-        temp.months AS months,
+        temp.years AS annual,
+        temp.months AS abbreviated,
         temp.fCorpName AS fCorpName,
         temp.market AS market,
         temp.purchase AS purchase,