Răsfoiți Sursa

财务分析数据录入

wukai 3 luni în urmă
părinte
comite
197fb335e9

+ 108 - 0
jjt-biz/src/main/java/com/jjt/lean/controller/LeanCostController.java

@@ -0,0 +1,108 @@
+package com.jjt.lean.controller;
+
+import com.jjt.common.annotation.Log;
+import com.jjt.common.core.controller.BaseController;
+import com.jjt.common.core.domain.AjaxResult;
+import com.jjt.common.core.page.TableDataInfo;
+import com.jjt.common.enums.BusinessType;
+import com.jjt.common.utils.poi.ExcelUtil;
+import com.jjt.lean.domain.LeanCost;
+import com.jjt.lean.service.ILeanCostService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+/**
+ * 财务分析Controller
+ *
+ * @author wukai
+ * @date 2025-11-10
+ */
+@Api(tags = "财务分析")
+@RestController
+@RequestMapping("/lean/cost")
+public class LeanCostController extends BaseController {
+    @Resource
+    private ILeanCostService leanCostService;
+
+    /**
+     * 查询财务分析列表
+     */
+    @ApiOperation("查询财务分析列表")
+    // @PreAuthorize("@ss.hasPermi('lean:cost:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(LeanCost leanCost) {
+        startPage();
+        List<LeanCost> list = leanCostService.selectLeanCostList(leanCost);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出财务分析列表
+     */
+    @ApiOperation("导出财务分析列表")
+    // @PreAuthorize("@ss.hasPermi('lean:cost:export')")
+    @Log(title = "财务分析", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, LeanCost leanCost) {
+        List<LeanCost> list = leanCostService.selectLeanCostList(leanCost);
+        ExcelUtil<LeanCost> util = new ExcelUtil<LeanCost>(LeanCost.class);
+        util.exportExcel(response, list, "财务分析数据");
+    }
+
+    /**
+     * 获取财务分析详细信息
+     */
+    @ApiOperation("获取财务分析详细信息")
+    // @PreAuthorize("@ss.hasPermi('lean:cost:query')")
+    @GetMapping(value = "/{costId}")
+    public AjaxResult getInfo(@PathVariable("costId") Long costId) {
+        return success(leanCostService.selectLeanCostByCostId(costId));
+    }
+
+    /**
+     * 新增财务分析
+     */
+    @ApiOperation("新增财务分析")
+    // @PreAuthorize("@ss.hasPermi('lean:cost:add')")
+    @Log(title = "财务分析", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody LeanCost leanCost) {
+        return toAjax(leanCostService.insertLeanCost(leanCost));
+    }
+
+    @ApiOperation("新增财务分析")
+    // @PreAuthorize("@ss.hasPermi('lean:cost:add')")
+    @Log(title = "财务分析", businessType = BusinessType.INSERT)
+    @PostMapping("/batchSave")
+    public AjaxResult batchSave(@RequestBody List<LeanCost> leanCost) {
+        return toAjax(leanCostService.batchSave(leanCost));
+    }
+
+
+    /**
+     * 修改财务分析
+     */
+    @ApiOperation("修改财务分析")
+    // @PreAuthorize("@ss.hasPermi('lean:cost:edit')")
+    @Log(title = "财务分析", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody LeanCost leanCost) {
+        return toAjax(leanCostService.updateLeanCost(leanCost));
+    }
+
+    /**
+     * 删除财务分析
+     */
+    @ApiOperation("删除财务分析")
+    // @PreAuthorize("@ss.hasPermi('lean:cost:remove')")
+    @Log(title = "财务分析", businessType = BusinessType.DELETE)
+    @DeleteMapping("/{costIds}")
+    public AjaxResult remove(@PathVariable Long[] costIds) {
+        return toAjax(leanCostService.deleteLeanCostByCostIds(costIds));
+    }
+}

+ 137 - 0
jjt-biz/src/main/java/com/jjt/lean/domain/LeanCost.java

@@ -0,0 +1,137 @@
+package com.jjt.lean.domain;
+
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.jjt.common.annotation.Excel;
+import com.jjt.common.core.domain.BaseEntity;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 财务分析对象 LEAN_COST
+ *
+ * @author wukai
+ * @date 2025-11-10
+ */
+@ApiModel(value = "LeanCost", description = "财务分析")
+@Data
+public class LeanCost extends BaseEntity {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * ID
+     */
+    @ApiModelProperty("ID")
+    @TableId
+    private Long costId;
+
+    /**
+     * 车间
+     */
+    @ApiModelProperty("车间")
+    @Excel(name = "车间")
+    private String wsName;
+
+    /**
+     * 时间
+     */
+    @ApiModelProperty("时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Excel(name = "时间", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date costTime;
+
+    /**
+     * 产量
+     */
+    @ApiModelProperty("产量")
+    @Excel(name = "产量")
+    private BigDecimal length;
+
+    /**
+     * 总成本
+     */
+    @ApiModelProperty("总成本")
+    @Excel(name = "总成本")
+    private BigDecimal totalCost;
+
+    /**
+     * 人工工资
+     */
+    @ApiModelProperty("人工工资")
+    @Excel(name = "人工工资")
+    private BigDecimal laborWage;
+
+    /**
+     * 社会保险
+     */
+    @ApiModelProperty("社会保险")
+    @Excel(name = "社会保险")
+    private BigDecimal socialInsurance;
+
+    /**
+     * 配件/修理费
+     */
+    @ApiModelProperty("配件/修理费")
+    @Excel(name = "配件/修理费")
+    private BigDecimal partsRepair;
+
+    /**
+     * 染料
+     */
+    @ApiModelProperty("染料")
+    @Excel(name = "染料")
+    private BigDecimal dyeCost;
+
+    /**
+     * 助剂/辅料
+     */
+    @ApiModelProperty("助剂/辅料")
+    @Excel(name = "助剂/辅料")
+    private BigDecimal auxiliaryMaterials;
+
+    /**
+     * 水电费
+     */
+    @ApiModelProperty("水电费")
+    @Excel(name = "水电费")
+    private BigDecimal waterElectricity;
+
+    /**
+     * 摊销及工程费
+     */
+    @ApiModelProperty("摊销及工程费")
+    @Excel(name = "摊销及工程费")
+    private BigDecimal amortizationEngineering;
+
+    /**
+     * 折旧
+     */
+    @ApiModelProperty("折旧")
+    @Excel(name = "折旧")
+    private BigDecimal depreciation;
+
+    /**
+     * 其他
+     */
+    @ApiModelProperty("其他")
+    @Excel(name = "其他")
+    private BigDecimal otherCost;
+
+    /**
+     * 单位成本(元/米)
+     */
+    @ApiModelProperty("单位成本(元/米)")
+    @Excel(name = "单位成本", readConverterExp = "元=/米")
+    private BigDecimal costPerMeter;
+
+    /**
+     * 成本性态分类
+     */
+    @ApiModelProperty("成本性态分类")
+    @Excel(name = "成本性态分类")
+    private String costCategory;
+}

+ 62 - 0
jjt-biz/src/main/java/com/jjt/lean/mapper/LeanCostMapper.java

@@ -0,0 +1,62 @@
+package com.jjt.lean.mapper;
+
+import java.util.List;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.jjt.lean.domain.LeanCost;
+
+/**
+ * 财务分析Mapper接口
+ * 
+ * @author wukai
+ * @date 2025-11-10
+ */
+public interface LeanCostMapper extends BaseMapper<LeanCost>
+{
+    /**
+     * 查询财务分析
+     * 
+     * @param costId 财务分析主键
+     * @return 财务分析
+     */
+    public LeanCost selectLeanCostByCostId(Long costId);
+
+    /**
+     * 查询财务分析列表
+     * 
+     * @param leanCost 财务分析
+     * @return 财务分析集合
+     */
+    public List<LeanCost> selectLeanCostList(LeanCost leanCost);
+
+    /**
+     * 新增财务分析
+     * 
+     * @param leanCost 财务分析
+     * @return 结果
+     */
+    public int insertLeanCost(LeanCost leanCost);
+
+    /**
+     * 修改财务分析
+     * 
+     * @param leanCost 财务分析
+     * @return 结果
+     */
+    public int updateLeanCost(LeanCost leanCost);
+
+    /**
+     * 删除财务分析
+     * 
+     * @param costId 财务分析主键
+     * @return 结果
+     */
+    public int deleteLeanCostByCostId(Long costId);
+
+    /**
+     * 批量删除财务分析
+     * 
+     * @param costIds 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteLeanCostByCostIds(Long[] costIds);
+}

+ 69 - 0
jjt-biz/src/main/java/com/jjt/lean/service/ILeanCostService.java

@@ -0,0 +1,69 @@
+package com.jjt.lean.service;
+
+import com.jjt.lean.domain.LeanCost;
+
+import java.util.List;
+
+/**
+ * 财务分析Service接口
+ *
+ * @author wukai
+ * @date 2025-11-10
+ */
+public interface ILeanCostService {
+    /**
+     * 查询财务分析
+     *
+     * @param costId 财务分析主键
+     * @return 财务分析
+     */
+    public LeanCost selectLeanCostByCostId(Long costId);
+
+    /**
+     * 查询财务分析列表
+     *
+     * @param leanCost 财务分析
+     * @return 财务分析集合
+     */
+    public List<LeanCost> selectLeanCostList(LeanCost leanCost);
+
+    /**
+     * 新增财务分析
+     *
+     * @param leanCost 财务分析
+     * @return 结果
+     */
+    public int insertLeanCost(LeanCost leanCost);
+
+    /**
+     * 修改财务分析
+     *
+     * @param leanCost 财务分析
+     * @return 结果
+     */
+    public int updateLeanCost(LeanCost leanCost);
+
+    /**
+     * 批量删除财务分析
+     *
+     * @param costIds 需要删除的财务分析主键集合
+     * @return 结果
+     */
+    public int deleteLeanCostByCostIds(Long[] costIds);
+
+    /**
+     * 删除财务分析信息
+     *
+     * @param costId 财务分析主键
+     * @return 结果
+     */
+    public int deleteLeanCostByCostId(Long costId);
+
+    /**
+     * 批量保存
+     *
+     * @param leanCost 列表
+     * @return 结果
+     */
+    int batchSave(List<LeanCost> leanCost);
+}

+ 113 - 0
jjt-biz/src/main/java/com/jjt/lean/service/impl/LeanCostServiceImpl.java

@@ -0,0 +1,113 @@
+package com.jjt.lean.service.impl;
+
+import com.jjt.common.utils.DateUtils;
+import com.jjt.lean.domain.LeanCost;
+import com.jjt.lean.mapper.LeanCostMapper;
+import com.jjt.lean.service.ILeanCostService;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * 财务分析Service业务层处理
+ *
+ * @author wukai
+ * @date 2025-11-10
+ */
+@Service
+public class LeanCostServiceImpl implements ILeanCostService {
+    @Resource
+    private LeanCostMapper leanCostMapper;
+
+    /**
+     * 查询财务分析
+     *
+     * @param costId 财务分析主键
+     * @return 财务分析
+     */
+    @Override
+    public LeanCost selectLeanCostByCostId(Long costId) {
+        return leanCostMapper.selectLeanCostByCostId(costId);
+    }
+
+    /**
+     * 查询财务分析列表
+     *
+     * @param leanCost 财务分析
+     * @return 财务分析
+     */
+    @Override
+    public List<LeanCost> selectLeanCostList(LeanCost leanCost) {
+        return leanCostMapper.selectLeanCostList(leanCost);
+    }
+
+    /**
+     * 新增财务分析
+     *
+     * @param leanCost 财务分析
+     * @return 结果
+     */
+    @Override
+    public int insertLeanCost(LeanCost leanCost) {
+        leanCost.setCreateTime(DateUtils.getNowDate());
+        return leanCostMapper.insertLeanCost(leanCost);
+    }
+
+    /**
+     * 修改财务分析
+     *
+     * @param leanCost 财务分析
+     * @return 结果
+     */
+    @Override
+    public int updateLeanCost(LeanCost leanCost) {
+        leanCost.setUpdateTime(DateUtils.getNowDate());
+        return leanCostMapper.updateLeanCost(leanCost);
+    }
+
+    /**
+     * 批量删除财务分析
+     *
+     * @param costIds 需要删除的财务分析主键
+     * @return 结果
+     */
+    @Override
+    public int deleteLeanCostByCostIds(Long[] costIds) {
+        return leanCostMapper.deleteLeanCostByCostIds(costIds);
+    }
+
+    /**
+     * 删除财务分析信息
+     *
+     * @param costId 财务分析主键
+     * @return 结果
+     */
+    @Override
+    public int deleteLeanCostByCostId(Long costId) {
+        return leanCostMapper.deleteLeanCostByCostId(costId);
+    }
+
+    /**
+     * 批量保存
+     *
+     * @param leanCost 列表
+     * @return 结果
+     */
+    @Override
+    public int batchSave(List<LeanCost> leanCost) {
+        int result = 0;
+        for (LeanCost cost : leanCost) {
+            if (cost.getCostId() != null) {
+                // 更新操作
+                cost.setUpdateTime(DateUtils.getNowDate());
+                result += leanCostMapper.updateLeanCost(cost);
+            } else {
+                // 插入操作
+                cost.setCreateTime(DateUtils.getNowDate());
+                result += leanCostMapper.insertLeanCost(cost);
+            }
+        }
+        return result;
+    }
+}

+ 152 - 0
jjt-biz/src/main/resources/mapper/lean/LeanCostMapper.xml

@@ -0,0 +1,152 @@
+<?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.jjt.lean.mapper.LeanCostMapper">
+
+    <resultMap type="LeanCost" id="LeanCostResult">
+        <result property="costId"    column="COST_ID"    />
+        <result property="wsName"    column="WS_NAME"    />
+        <result property="costTime"    column="COST_TIME"    />
+        <result property="length"    column="LENGTH"    />
+        <result property="totalCost"    column="TOTAL_COST"    />
+        <result property="laborWage"    column="LABOR_WAGE"    />
+        <result property="socialInsurance"    column="SOCIAL_INSURANCE"    />
+        <result property="partsRepair"    column="PARTS_REPAIR"    />
+        <result property="dyeCost"    column="DYE_COST"    />
+        <result property="auxiliaryMaterials"    column="AUXILIARY_MATERIALS"    />
+        <result property="waterElectricity"    column="WATER_ELECTRICITY"    />
+        <result property="amortizationEngineering"    column="AMORTIZATION_ENGINEERING"    />
+        <result property="depreciation"    column="DEPRECIATION"    />
+        <result property="otherCost"    column="OTHER_COST"    />
+        <result property="costPerMeter"    column="COST_PER_METER"    />
+        <result property="costCategory"    column="COST_CATEGORY"    />
+        <result property="createBy"    column="CREATE_BY"    />
+        <result property="createTime"    column="CREATE_TIME"    />
+        <result property="updateBy"    column="UPDATE_BY"    />
+        <result property="updateTime"    column="UPDATE_TIME"    />
+        <result property="remark"    column="REMARK"    />
+    </resultMap>
+
+    <sql id="selectLeanCostVo">
+        select COST_ID, WS_NAME, COST_TIME, LENGTH, TOTAL_COST, LABOR_WAGE, SOCIAL_INSURANCE, PARTS_REPAIR, DYE_COST, AUXILIARY_MATERIALS, WATER_ELECTRICITY, AMORTIZATION_ENGINEERING, DEPRECIATION, OTHER_COST, COST_PER_METER, COST_CATEGORY, CREATE_BY, CREATE_TIME, UPDATE_BY, UPDATE_TIME, REMARK from LEAN_COST
+    </sql>
+
+    <select id="selectLeanCostList" parameterType="LeanCost" resultMap="LeanCostResult">
+        <include refid="selectLeanCostVo"/>
+        <where>
+            <if test="wsName != null  and wsName != ''"> and WS_NAME = #{wsName}</if>
+            <if test="costTime != null "> and COST_TIME = #{costTime}</if>
+            <if test="length != null "> and LENGTH = #{length}</if>
+            <if test="totalCost != null "> and TOTAL_COST = #{totalCost}</if>
+            <if test="laborWage != null "> and LABOR_WAGE = #{laborWage}</if>
+            <if test="socialInsurance != null "> and SOCIAL_INSURANCE = #{socialInsurance}</if>
+            <if test="partsRepair != null "> and PARTS_REPAIR = #{partsRepair}</if>
+            <if test="dyeCost != null "> and DYE_COST = #{dyeCost}</if>
+            <if test="auxiliaryMaterials != null "> and AUXILIARY_MATERIALS = #{auxiliaryMaterials}</if>
+            <if test="waterElectricity != null "> and WATER_ELECTRICITY = #{waterElectricity}</if>
+            <if test="amortizationEngineering != null "> and AMORTIZATION_ENGINEERING = #{amortizationEngineering}</if>
+            <if test="depreciation != null "> and DEPRECIATION = #{depreciation}</if>
+            <if test="otherCost != null "> and OTHER_COST = #{otherCost}</if>
+            <if test="costPerMeter != null "> and COST_PER_METER = #{costPerMeter}</if>
+            <if test="costCategory != null  and costCategory != ''"> and COST_CATEGORY = #{costCategory}</if>
+            <if test="createBy != null  and createBy != ''"> and CREATE_BY = #{createBy}</if>
+            <if test="createTime != null "> and CREATE_TIME = #{createTime}</if>
+            <if test="updateBy != null  and updateBy != ''"> and UPDATE_BY = #{updateBy}</if>
+            <if test="updateTime != null "> and UPDATE_TIME = #{updateTime}</if>
+            <if test="remark != null  and remark != ''"> and REMARK = #{remark}</if>
+            <if test="params.year != null and params.year != ''"> and YEAR(COST_TIME) = #{params.year}</if>
+        </where>
+    </select>
+
+    <select id="selectLeanCostByCostId" parameterType="Long" resultMap="LeanCostResult">
+        <include refid="selectLeanCostVo"/>
+        where COST_ID = #{costId}
+    </select>
+
+    <insert id="insertLeanCost" parameterType="LeanCost" useGeneratedKeys="true" keyProperty="costId">
+        insert into LEAN_COST
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="wsName != null">WS_NAME,</if>
+            <if test="costTime != null">COST_TIME,</if>
+            <if test="length != null">LENGTH,</if>
+            <if test="totalCost != null">TOTAL_COST,</if>
+            <if test="laborWage != null">LABOR_WAGE,</if>
+            <if test="socialInsurance != null">SOCIAL_INSURANCE,</if>
+            <if test="partsRepair != null">PARTS_REPAIR,</if>
+            <if test="dyeCost != null">DYE_COST,</if>
+            <if test="auxiliaryMaterials != null">AUXILIARY_MATERIALS,</if>
+            <if test="waterElectricity != null">WATER_ELECTRICITY,</if>
+            <if test="amortizationEngineering != null">AMORTIZATION_ENGINEERING,</if>
+            <if test="depreciation != null">DEPRECIATION,</if>
+            <if test="otherCost != null">OTHER_COST,</if>
+            <if test="costPerMeter != null">COST_PER_METER,</if>
+            <if test="costCategory != null">COST_CATEGORY,</if>
+            <if test="createBy != null">CREATE_BY,</if>
+            <if test="createTime != null">CREATE_TIME,</if>
+            <if test="updateBy != null">UPDATE_BY,</if>
+            <if test="updateTime != null">UPDATE_TIME,</if>
+            <if test="remark != null">REMARK,</if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="wsName != null">#{wsName},</if>
+            <if test="costTime != null">#{costTime},</if>
+            <if test="length != null">#{length},</if>
+            <if test="totalCost != null">#{totalCost},</if>
+            <if test="laborWage != null">#{laborWage},</if>
+            <if test="socialInsurance != null">#{socialInsurance},</if>
+            <if test="partsRepair != null">#{partsRepair},</if>
+            <if test="dyeCost != null">#{dyeCost},</if>
+            <if test="auxiliaryMaterials != null">#{auxiliaryMaterials},</if>
+            <if test="waterElectricity != null">#{waterElectricity},</if>
+            <if test="amortizationEngineering != null">#{amortizationEngineering},</if>
+            <if test="depreciation != null">#{depreciation},</if>
+            <if test="otherCost != null">#{otherCost},</if>
+            <if test="costPerMeter != null">#{costPerMeter},</if>
+            <if test="costCategory != null">#{costCategory},</if>
+            <if test="createBy != null">#{createBy},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="updateBy != null">#{updateBy},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+            <if test="remark != null">#{remark},</if>
+        </trim>
+    </insert>
+
+    <update id="updateLeanCost" parameterType="LeanCost">
+        update LEAN_COST
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="wsName != null">WS_NAME = #{wsName},</if>
+            <if test="costTime != null">COST_TIME = #{costTime},</if>
+            <if test="length != null">LENGTH = #{length},</if>
+            <if test="totalCost != null">TOTAL_COST = #{totalCost},</if>
+            <if test="laborWage != null">LABOR_WAGE = #{laborWage},</if>
+            <if test="socialInsurance != null">SOCIAL_INSURANCE = #{socialInsurance},</if>
+            <if test="partsRepair != null">PARTS_REPAIR = #{partsRepair},</if>
+            <if test="dyeCost != null">DYE_COST = #{dyeCost},</if>
+            <if test="auxiliaryMaterials != null">AUXILIARY_MATERIALS = #{auxiliaryMaterials},</if>
+            <if test="waterElectricity != null">WATER_ELECTRICITY = #{waterElectricity},</if>
+            <if test="amortizationEngineering != null">AMORTIZATION_ENGINEERING = #{amortizationEngineering},</if>
+            <if test="depreciation != null">DEPRECIATION = #{depreciation},</if>
+            <if test="otherCost != null">OTHER_COST = #{otherCost},</if>
+            <if test="costPerMeter != null">COST_PER_METER = #{costPerMeter},</if>
+            <if test="costCategory != null">COST_CATEGORY = #{costCategory},</if>
+            <if test="createBy != null">CREATE_BY = #{createBy},</if>
+            <if test="createTime != null">CREATE_TIME = #{createTime},</if>
+            <if test="updateBy != null">UPDATE_BY = #{updateBy},</if>
+            <if test="updateTime != null">UPDATE_TIME = #{updateTime},</if>
+            <if test="remark != null">REMARK = #{remark},</if>
+        </trim>
+        where COST_ID = #{costId}
+    </update>
+
+    <delete id="deleteLeanCostByCostId" parameterType="Long">
+        delete from LEAN_COST where COST_ID = #{costId}
+    </delete>
+
+    <delete id="deleteLeanCostByCostIds" parameterType="String">
+        delete from LEAN_COST where COST_ID in
+        <foreach item="costId" collection="array" open="(" separator="," close=")">
+            #{costId}
+        </foreach>
+    </delete>
+</mapper>