From 688fb1c93eabaea3facf4e7ace1b27b1bac53fbe Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期三, 20 九月 2023 16:54:59 +0800
Subject: [PATCH] 代码提交

---
 ruoyi-project/src/main/java/com/ruoyi/project/service/impl/BaseOnlyvalueServiceImpl.java       |   84 +++++++++++++++++++++
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceReimbursementController.java |    5 +
 ruoyi-project/src/main/java/com/ruoyi/project/domain/BaseOnlyvalue.java                        |   51 ++++++++++++
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceFundController.java          |    6 +
 ruoyi-project/src/main/resources/mapper/project/BaseOnlyvalueMapper.xml                        |   29 +++++++
 ruoyi-project/src/main/java/com/ruoyi/project/mapper/BaseOnlyvalueMapper.java                  |   25 ++++++
 ruoyi-project/src/main/java/com/ruoyi/project/service/IBaseOnlyvalueService.java               |   31 +++++++
 7 files changed, 229 insertions(+), 2 deletions(-)

diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceFundController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceFundController.java
index 493efff..82cf182 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceFundController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceFundController.java
@@ -76,7 +76,7 @@
     private IServiceSystemmessageService ServiceSystemmessage;
 
     @Autowired
-    private IServiceFundSharedService fundServiceShare;
+    private IBaseOnlyvalueService baseOnlyvalueService;
 
     @Autowired
     private IServiceExternalpersonService externalpersonService;
@@ -545,6 +545,8 @@
             //001瀹℃壒閫氳繃涔嬪悗锛屽氨闇�瑕佹妸鈥滃姙鍏涓讳换鈥濈殑鍚嶅瓧濉笂
             if (checkFundVO.getFlowconclusion() == 1 && user.getUserName().equals("001")) {
                 serviceFund.setOfficedirector(user.getNickName());
+                String bh = baseOnlyvalueService.getOnlyCode("fund");
+                serviceFund.setBh(bh);
             }
             serviceFundService.updateById(serviceFund);
 
@@ -1171,7 +1173,7 @@
             count++;
             map.put("XH", count);
             map.put("FWNR", f.getItemname() == null ? "" : f.getItemname());
-            map.put("DW", f.getUnitname() == null ? "" : f.getUnitname());
+            map.put("DW", f.getBeneficiaryname() == null ? "" : f.getBeneficiaryname());
             map.put("SL", f.getQuantity() == 0.00 ? "" : f.getQuantity());
             map.put("JG", f.getPrice() == 0.00 ? "" : f.getPrice());
 
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceReimbursementController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceReimbursementController.java
index b80bee6..0f3045e 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceReimbursementController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceReimbursementController.java
@@ -75,6 +75,9 @@
     private IServiceFundService serviceFundService;
 
     @Autowired
+    private IBaseOnlyvalueService baseOnlyvalueService;
+
+    @Autowired
     private ISysPostService postService;
 
     @Autowired
@@ -632,6 +635,8 @@
             //001瀹℃壒閫氳繃涔嬪悗锛屽氨闇�瑕佹妸鈥滃姙鍏涓讳换鈥濈殑鍚嶅瓧濉笂
             if (checkFundVO.getFlowconclusion() == 1 && user.getUserName().equals("001")) {
                 serviceReimbursement.setOfficedirector(user.getNickName());
+                String bh = baseOnlyvalueService.getOnlyCode("fund");
+                serviceReimbursement.setBh(bh);
             }
 
             serviceReimbursementService.updateById(serviceReimbursement);
diff --git a/ruoyi-project/src/main/java/com/ruoyi/project/domain/BaseOnlyvalue.java b/ruoyi-project/src/main/java/com/ruoyi/project/domain/BaseOnlyvalue.java
new file mode 100644
index 0000000..0efa713
--- /dev/null
+++ b/ruoyi-project/src/main/java/com/ruoyi/project/domain/BaseOnlyvalue.java
@@ -0,0 +1,51 @@
+package com.ruoyi.project.domain;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * 涓氬姟鏁版嵁鍞竴鍊煎璞� base_onlyvalue
+ *
+ * @author ruoyi
+ * @date 2023-09-20
+ */
+@Data
+@ApiModel("涓氬姟鏁版嵁鍞竴鍊�")
+public class BaseOnlyvalue {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * $column.columnComment
+     */
+    @ApiModelProperty("$column.columnComment")
+    @TableId(type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * $column.columnComment
+     */
+    @ApiModelProperty("$column.columnComment")
+    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
+    private String businesstype;
+
+    /**
+     * $column.columnComment
+     */
+    @ApiModelProperty("$column.columnComment")
+    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
+    private String appentvalue;
+
+    /**
+     * $column.columnComment
+     */
+    @ApiModelProperty("$column.columnComment")
+    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
+    private Long currentvalue;
+
+}
+
diff --git a/ruoyi-project/src/main/java/com/ruoyi/project/mapper/BaseOnlyvalueMapper.java b/ruoyi-project/src/main/java/com/ruoyi/project/mapper/BaseOnlyvalueMapper.java
new file mode 100644
index 0000000..a6f13ab
--- /dev/null
+++ b/ruoyi-project/src/main/java/com/ruoyi/project/mapper/BaseOnlyvalueMapper.java
@@ -0,0 +1,25 @@
+package com.ruoyi.project.mapper;
+
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.project.domain.BaseOnlyvalue;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+/**
+ * 涓氬姟鏁版嵁鍞竴鍊糓apper鎺ュ彛
+ *
+ * @author ruoyi
+ * @date 2023-09-20
+ */
+@Mapper
+public interface BaseOnlyvalueMapper extends BaseMapper<BaseOnlyvalue> {
+    /**
+     * 鏌ヨ涓氬姟鏁版嵁鍞竴鍊煎垪琛�
+     *
+     * @param baseOnlyvalue 涓氬姟鏁版嵁鍞竴鍊�
+     * @return 涓氬姟鏁版嵁鍞竴鍊奸泦鍚�
+     */
+    public List<BaseOnlyvalue> selectBaseOnlyvalueList(BaseOnlyvalue baseOnlyvalue);
+}
diff --git a/ruoyi-project/src/main/java/com/ruoyi/project/service/IBaseOnlyvalueService.java b/ruoyi-project/src/main/java/com/ruoyi/project/service/IBaseOnlyvalueService.java
new file mode 100644
index 0000000..4d0adf6
--- /dev/null
+++ b/ruoyi-project/src/main/java/com/ruoyi/project/service/IBaseOnlyvalueService.java
@@ -0,0 +1,31 @@
+package com.ruoyi.project.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.project.domain.BaseOnlyvalue;
+
+import java.util.List;
+
+/**
+ * 涓氬姟鏁版嵁鍞竴鍊糞ervice鎺ュ彛
+ *
+ * @author ruoyi
+ * @date 2023-09-20
+ */
+public interface IBaseOnlyvalueService extends IService<BaseOnlyvalue> {
+
+    /**
+     * 鏌ヨ涓氬姟鏁版嵁鍞竴鍊煎垪琛�
+     *
+     * @param baseOnlyvalue 涓氬姟鏁版嵁鍞竴鍊�
+     * @return 涓氬姟鏁版嵁鍞竴鍊奸泦鍚�
+     */
+    public List<BaseOnlyvalue> queryList(BaseOnlyvalue baseOnlyvalue);
+
+    /**
+     * 鑾峰彇鍞竴缂栧彿
+     *
+     * @param businessType
+     * @return
+     */
+    public String getOnlyCode(String businessType);
+}
diff --git a/ruoyi-project/src/main/java/com/ruoyi/project/service/impl/BaseOnlyvalueServiceImpl.java b/ruoyi-project/src/main/java/com/ruoyi/project/service/impl/BaseOnlyvalueServiceImpl.java
new file mode 100644
index 0000000..8e835ed
--- /dev/null
+++ b/ruoyi-project/src/main/java/com/ruoyi/project/service/impl/BaseOnlyvalueServiceImpl.java
@@ -0,0 +1,84 @@
+package com.ruoyi.project.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.project.domain.BaseOnlyvalue;
+import com.ruoyi.project.mapper.BaseOnlyvalueMapper;
+import com.ruoyi.project.service.IBaseOnlyvalueService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
+
+import java.time.LocalDate;
+import java.util.List;
+
+/**
+ * 涓氬姟鏁版嵁鍞竴鍊糞ervice涓氬姟灞傚鐞�
+ *
+ * @author ruoyi
+ * @date 2023-09-20
+ */
+@Service
+public class BaseOnlyvalueServiceImpl extends ServiceImpl<BaseOnlyvalueMapper, BaseOnlyvalue> implements IBaseOnlyvalueService {
+
+    @Autowired
+    BaseOnlyvalueMapper baseOnlyvalueMapper;
+
+    /**
+     * 鏌ヨ涓氬姟鏁版嵁鍞竴鍊煎垪琛�
+     *
+     * @param baseOnlyvalue 涓氬姟鏁版嵁鍞竴鍊�
+     * @return 涓氬姟鏁版嵁鍞竴鍊�
+     */
+    @Override
+    public List<BaseOnlyvalue> queryList(BaseOnlyvalue baseOnlyvalue) {
+        LambdaQueryWrapper<BaseOnlyvalue> wrappers = Wrappers.lambdaQuery();
+        if (StringUtils.isNotBlank(baseOnlyvalue.getBusinesstype())) {
+            wrappers.eq(BaseOnlyvalue::getBusinesstype, baseOnlyvalue.getBusinesstype());
+        }
+        if (StringUtils.isNotBlank(baseOnlyvalue.getAppentvalue())) {
+            wrappers.eq(BaseOnlyvalue::getAppentvalue, baseOnlyvalue.getAppentvalue());
+        }
+        if (baseOnlyvalue.getCurrentvalue() != null) {
+            wrappers.eq(BaseOnlyvalue::getCurrentvalue, baseOnlyvalue.getCurrentvalue());
+        }
+        return this.list(wrappers);
+    }
+
+
+    @Override
+    public String getOnlyCode(String businessType) {
+        LocalDate currentDate = LocalDate.now();
+        int year = currentDate.getYear();
+        int month = currentDate.getMonthValue();
+
+        //閫氳繃骞存湀鏃ユ湡鍘绘煡璇㈣鏈堜唤鏄惁瀛樺湪
+        String data = String.valueOf(year) + String.valueOf(month);
+        BaseOnlyvalue baseOnlyvalue = new BaseOnlyvalue();
+        baseOnlyvalue.setAppentvalue(data);
+
+
+        List<BaseOnlyvalue> baseOnlyvalues = queryList(baseOnlyvalue);
+        if (CollectionUtils.isEmpty(baseOnlyvalues)) {
+            //濡傛灉涓虹┖鐨勮瘽锛屽垯寰�琛ㄤ腑鏂板涓�鏉★紝灏哻urrentValue璁剧疆涓�1;
+            //鐢熸垚鏂扮殑缂栧彿杩斿洖
+            baseOnlyvalue.setCurrentvalue(1L);
+            baseOnlyvalue.setBusinesstype(businessType);
+            save(baseOnlyvalue);
+
+            return "OPO-" + data + "1";
+        } else {
+            //鍒欏皢currentValue+1,閲嶆柊璧嬪��
+            BaseOnlyvalue baseOnlyvalue1 = baseOnlyvalues.get(0);
+            long newCurrentvalue = baseOnlyvalue1.getCurrentvalue() + 1;
+            baseOnlyvalue1.setCurrentvalue(newCurrentvalue);
+            updateById(baseOnlyvalue1);
+
+            return "OPO-" + data + "" + newCurrentvalue;
+        }
+
+    }
+
+}
diff --git a/ruoyi-project/src/main/resources/mapper/project/BaseOnlyvalueMapper.xml b/ruoyi-project/src/main/resources/mapper/project/BaseOnlyvalueMapper.xml
new file mode 100644
index 0000000..e8717c5
--- /dev/null
+++ b/ruoyi-project/src/main/resources/mapper/project/BaseOnlyvalueMapper.xml
@@ -0,0 +1,29 @@
+<?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.system.mapper.BaseOnlyvalueMapper">
+
+    <resultMap type="com.ruoyi.project.domain.BaseOnlyvalue" id="BaseOnlyvalueResult">
+        <result property="id" column="id"/>
+        <result property="businesstype" column="businessType"/>
+        <result property="appentvalue" column="appentValue"/>
+        <result property="currentvalue" column="currentValue"/>
+    </resultMap>
+
+    <sql id="selectBaseOnlyvalueVo">
+        select id, businessType, appentValue, currentValue
+        from base_onlyvalue
+    </sql>
+
+    <select id="selectBaseOnlyvalueList" parameterType="com.ruoyi.project.domain.BaseOnlyvalue"
+            resultMap="BaseOnlyvalueResult">
+        <include refid="selectBaseOnlyvalueVo"/>
+        <where>
+            <if test="businesstype != null  and businesstype != ''">and businessType = #{businesstype}</if>
+            <if test="appentvalue != null  and appentvalue != ''">and appentValue = #{appentvalue}</if>
+            <if test="currentvalue != null ">and currentValue = #{currentvalue}</if>
+        </where>
+    </select>
+
+</mapper>
\ No newline at end of file

--
Gitblit v1.9.3